diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 52bf789b..5b24dafe 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2539,19 +2539,19 @@ class EmployeeRestController extends AdminController if($ClientPolicyValue['policy_type_id'] == 1) { $data['policy_terms'] = $this->policyTermsFiter($terms,'gpa'); - $data['department_id'] = 2; + $data['ticket_type_id'] = 2; }else if($ClientPolicyValue['policy_type_id'] == 6) { $data['policy_terms'] = $this->policyTermsFiter($terms,'gpa'); - $data['department_id'] = 3; + $data['ticket_type_id'] = 3; }else if($ClientPolicyValue['policy_type_id'] == 7) { $data['policy_terms'] = $this->policyTermsFiter($terms,'gpa'); - $data['department_id'] = 4; + $data['ticket_type_id'] = 4; }else { $data['policy_terms'] = $this->policyTermsFiter($terms,'gmc'); - $data['department_id'] = 1; + $data['ticket_type_id'] = 1; } $data['client_id'] = $ClientPolicyValue['client_id']; @@ -3251,6 +3251,8 @@ class EmployeeRestController extends AdminController $modeOFIntimate = $this->ticketController->modeOFIntimate; $claimType = $this->ticketController->claimType; $relationshipType = $this->ticketController->relationshipType; + $ticketTypeArray = $this->ticketController->ticketType; + $emp_id = $this->request->getGet('emp_id'); $ticket_type = $this->request->getGet('ticket_type') ?? null; @@ -3290,7 +3292,9 @@ class EmployeeRestController extends AdminController if (in_array($value['claim_type'], [2, 3, 4])) { $claimPrimaryTypey = "2"; } - $ticket_data[$key]['claim_type_value'] = $claimType[$claimPrimaryTypey][$value['claim_type']] ?? null; + $ticket_data[$key]['claim_type_value'] = $claimType[$claimPrimaryTypey][$value['claim_type']] ?? null; + $ticket_data[$key]['ticket_policy_type'] = $ticketTypeArray[$value['ticket_type_id']] ?? null; + } } diff --git a/app/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php index 1e3824a1..878fad2e 100644 --- a/app/Models/TicketMasterModel.php +++ b/app/Models/TicketMasterModel.php @@ -684,16 +684,17 @@ class TicketMasterModel extends Model //api public function get_ticket_data($emp_id, $ticket_type = null, $ticket_id = null) { - $query = $this->select('*') - ->where('is_active', 1) - ->where('emp_id', $emp_id); + $query = $this->select('ticket_master.*, tms.mail_subject as subject') + ->join('ticket_messages tms', 'ticket_master.id = tms.ticket_id', 'left') + ->where('ticket_master.is_active', 1) + ->where('ticket_master.emp_id', $emp_id); if (!empty($ticket_id)) { - $query->where('id', $ticket_id); + $query->where('ticket_master.id', $ticket_id); } if (!empty($ticket_type)) { - $query->where('ticket_type_id', $ticket_type); + $query->where('ticket_master.ticket_type_id', $ticket_type); } $data = $query->findAll(); diff --git a/app/Views/policy_transaction_inception_list.php b/app/Views/policy_transaction_inception_list.php index 6509a81f..173a128a 100644 --- a/app/Views/policy_transaction_inception_list.php +++ b/app/Views/policy_transaction_inception_list.php @@ -319,7 +319,7 @@ table.dataTable tbody td { Edit - + Delete @@ -370,25 +370,25 @@ table.dataTable tbody td { document.addEventListener("DOMContentLoaded", function () { const table = document.getElementById("tickets-table"); - // Create custom dropdown function createCustomDropdown(row) { - // Get the original dropdown items const originalDropdown = row.querySelector('.dropdown-menu'); if (!originalDropdown) return null; - // Create new dropdown with proper background and spacing const customDropdown = document.createElement('div'); customDropdown.className = 'custom-dropdown-menu'; - // Copy inner content while maintaining icon alignment - customDropdown.innerHTML = originalDropdown.innerHTML; + const items = originalDropdown.querySelectorAll('.dropdown-item'); + items.forEach(item => { + const newItem = item.cloneNode(true); + newItem.removeAttribute('onclick'); + customDropdown.appendChild(newItem); + }); return customDropdown; } let activeDropdown = null; - // Add click event listener to rows table.querySelectorAll("tbody tr").forEach(row => { const customDropdown = createCustomDropdown(row); if (!customDropdown) return; @@ -401,51 +401,56 @@ document.addEventListener("DOMContentLoaded", function () { return; } - // Hide any active dropdown - if (activeDropdown) { + // Close any existing dropdown + if (activeDropdown && activeDropdown !== customDropdown) { activeDropdown.style.display = 'none'; } - // Get click position const rect = event.target.getBoundingClientRect(); - // Position the dropdown with some offset customDropdown.style.display = 'block'; customDropdown.style.position = 'fixed'; customDropdown.style.left = `${rect.left}px`; - customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap + customDropdown.style.top = `${rect.bottom + 5}px`; - // Set as active dropdown activeDropdown = customDropdown; - event.stopPropagation(); }); - // Preserve click handlers and add auto-close + // Handle clicks on dropdown items customDropdown.querySelectorAll('.dropdown-item').forEach(item => { item.addEventListener('click', function(e) { - const onclickAttr = this.getAttribute('onclick'); - if (onclickAttr) { - eval(onclickAttr); - } + e.preventDefault(); + e.stopPropagation(); + + const id = this.getAttribute('data-id'); - const href = this.getAttribute('href'); - if (href && href !== '#') { - window.location.href = href; + // Handle edit button + if (this.classList.contains('btnEdit') && id) { + getPolicyTransactionDataForEdit(id); + } + // Handle delete button + else if (this.classList.contains('delete') && id) { + removePolicyTransaction(this, id); + } + // Handle other links + else { + const href = this.getAttribute('href'); + if (href && href !== '#' && href !== 'javascript: void(0);') { + window.location.href = href; + } } - // Close the dropdown after handling the click + // Close dropdown if (activeDropdown) { activeDropdown.style.display = 'none'; activeDropdown = null; } - - e.stopPropagation(); - }); + }, { once: true }); }); }); - // Close dropdown when clicking outside + // Close dropdown on outside click document.addEventListener("click", function() { if (activeDropdown) { activeDropdown.style.display = 'none'; @@ -1486,7 +1491,7 @@ function onlyNumbers(event)