diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 023acd31..15533b25 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -4834,7 +4834,7 @@ class ClientController extends AdminController return $this->respond([ 'status' => false, 'code' => 404, - 'message' => 'No data found', + 'message' => 'No Employee found', 'param' => $param, 'type' => $type, 'dataForClientAndInsurer' => $dataForClientAndInsurer, @@ -4843,7 +4843,7 @@ class ClientController extends AdminController } } - public function getTheEmpDataForClaimSearchByMobile($param, $type = 'mobile', $client_policy_id = null) + public function getTheEmpDataForClaimSearchByMobile($param, $type = 'mobile', $client_policy_id = null, $client_id = null) { $field_name = 'employees.' . $type; @@ -4866,8 +4866,8 @@ class ClientController extends AdminController employee_polices.tpa_id AS tpa_no, employee_polices.client_policy_id AS policy_id ") - ->join('clients', 'client_policy.client_id = clients.id', 'left') - ->join('insurers', 'client_policy.insurer_id = insurers.id', 'left') + ->join('clients', 'client_policy.client_id = clients.id') + ->join('insurers', 'client_policy.insurer_id = insurers.id') ->join('tpa', 'client_policy.tpa_id = tpa.id', 'left') ->join('employees', 'clients.id = employees.client_id') ->join('employee_polices', 'employees.id = employee_polices.employee_id') @@ -4879,6 +4879,10 @@ class ClientController extends AdminController ->where('employee_polices.is_active', 1) ->where($field_name, $param); + if (!empty($client_id)) { + $query->where('employees.client_id', $client_id); + } + if (!empty($client_policy_id)) { $query->where('employee_polices.client_policy_id', $client_policy_id); } @@ -4902,7 +4906,7 @@ class ClientController extends AdminController if(!empty($data) && count($data) > 0){ - $memberData = $this->employeeModel->getEmployeeByEmployeeCode($data['emp_code'], $data['policy_id']); + $memberData = $this->employeeModel->getEmployeeByEmployeeCode($data['emp_code'], $data['policy_id'], $client_id); $acms = $this->clientRMModel ->select('user_profiles.id, user_profiles.first_name') @@ -4935,7 +4939,7 @@ class ClientController extends AdminController return $this->respond([ 'status' => false, 'code' => 404, - 'message' => 'No data found', + 'message' => 'No Employee found', 'param' => $param, 'client_policy_id' => $client_policy_id, 'type' => $type, diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 60394874..6da26715 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -34,6 +34,7 @@ class TicketController extends BaseController public $claimStatus; public $placeHolders; public $extraFields; + public $nonIDReason; protected $clientModel; protected $ticketMasterModel; @@ -98,7 +99,8 @@ class TicketController extends BaseController 4 => "Trigger 4", 5 => "Trigger 5", 6 => "Trigger 6", - 7 => "Trigger 7" + 7 => "Trigger 7", + 8 => "Trigger 8", ]; $this->placeHolders = [ @@ -114,7 +116,8 @@ class TicketController extends BaseController '((AUTO_QUERY_CONTENT))' => 'auto_query_content', ]; $this->extraFields = [ - + 1 => ['non_id_reason'], + 10 => ['pay_initiate_date'], 3 => ['raised_date'], 4 => ['raised_date'], 5 => ['claim_number', 'registration_date'], @@ -137,6 +140,13 @@ class TicketController extends BaseController 53 => ['cancel_remark'], 58 => ['cancel_remark'], ]; + $this->nonIDReason = [ + "Newborn Baby" => "Newborn Baby", + "Newly Wedded Spouse" => "Newly Wedded Spouse", + "Policy Pending" => "Policy Pending", + "New Joinee" => "New Joinee", + "Exceptional Case" => "Exceptional Case" + ]; $this->ticketMasterModel = new TicketMasterModel(); $this->claimStatus = new TicketClaimStatusModel(); @@ -296,7 +306,8 @@ class TicketController extends BaseController 'ticket_type' => $this->ticketType, 'priorityType' => $this->priorityType, 'relationshipType' => $this->relationshipType, - 'modeOFIntimate' => $this->modeOFIntimate + 'modeOFIntimate' => $this->modeOFIntimate, + 'nonIDReason' => $this->nonIDReason ]; switch ($ticket_type) { @@ -528,6 +539,12 @@ class TicketController extends BaseController $ticket_data['settled_date'] = change_date_format($ticket_data['settled_date'], null, $out_put_format); } + if (empty($ticket_data['pay_initiate_date'])) { + $ticket_data['pay_initiate_date'] = null; + } else { + $ticket_data['pay_initiate_date'] = change_date_format($ticket_data['pay_initiate_date'], null, $out_put_format); + } + return $ticket_data; } @@ -593,6 +610,17 @@ class TicketController extends BaseController $data['policy_type'] = $this->ticketType; $data['placeHolders'] = $this->placeHolders; $data['ticket_data'] = $this->ticketMailTemplateModel->where('is_active', 1)->findAll(); + + foreach ($data['ticket_data'] as $key => $ticket_data) { + + $tooltip_array = $this->claimStatus->select('claim_status')->where('ticket_type',$data['ticket_data'][$key]['ticket_type'])->where('trigger_type',$data['ticket_data'][$key]['trigger_type'])->where('is_active',1)->first(); + if (isset($tooltip_array) && $tooltip_array != null){ + $data['ticket_data'][$key]['tool_tip'] = $tooltip_array['claim_status']; + }else{ + $data['ticket_data'][$key]['tool_tip'] =$data['ticket_data'][$key]['template_name']; + } + } + // dd($data['ticket_data']); $data['ticket_type'] = $this->ticketType; $data['trigger_type'] = $this->triggerType; return $this->loadLayout('ticket_mail_template', $data); @@ -621,6 +649,21 @@ class TicketController extends BaseController } elseif ($action == 2) { $table_id = (int)$this->request->getPost('id'); $data = $this->ticketMailTemplateModel->where('id', $table_id)->where('is_active', 1)->first(); + if ($data && isset($data['ticket_type']) && isset($data['trigger_type'])) { + $tooltip_array = $this->claimStatus->select('claim_status') + ->where('ticket_type', $data['ticket_type']) + ->where('trigger_type', $data['trigger_type']) + ->where('is_active', 1) + ->first(); + + $data['tool_tip'] = (isset($tooltip_array['claim_status'])) + ? $tooltip_array['claim_status'] + : $data['template_name']; + } else { + // Handle case where $data is null or missing required fields + $data = $data ?: []; // Ensure $data is an array if null + $data['tool_tip'] = $data['template_name']; + } if ($data) { return $this->respond(['status' => true, 'data' => $data], 200); } else { diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index 58cf6010..14ec368d 100755 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -240,7 +240,7 @@ class EmployeeModel extends Model return $results; } - public function getEmployeeByEmployeeCode($emp_code, $client_policy_id = null) + public function getEmployeeByEmployeeCode($emp_code, $client_policy_id = null, $client_id = null) { $query = $this->select(" employees.id AS emp_id, @@ -257,6 +257,10 @@ class EmployeeModel extends Model ->where('employee_polices.is_active', 1) ->where('employees.emp_code', $emp_code); + if(!empty($client_id)){ + $query->where('employees.client_id', $client_id); + } + if(!empty($client_policy_id)){ $query->where('employee_polices.client_policy_id', $client_policy_id); } diff --git a/app/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php index da4b2eec..878fad2e 100644 --- a/app/Models/TicketMasterModel.php +++ b/app/Models/TicketMasterModel.php @@ -68,6 +68,10 @@ class TicketMasterModel extends Model 'return_remark', 'cancel_remark', 'awb_no_courier_name', + + 'non_id_reason', + 'head_rejection_reason', + 'pay_initiate_date', ]; diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php index d625a183..2c06d68b 100644 --- a/app/Views/policy_transaction_inception_form.php +++ b/app/Views/policy_transaction_inception_form.php @@ -1314,8 +1314,8 @@ $(document).ready(function(){ $(document).on('change', 'input[type="checkbox"][name="co_share_type[]"]', function() { - $('[name="base_premium[]"]').val(""); - $('[name="co_premium[]"]').val(""); + // $('[name="base_premium[]"]').val(""); + // $('[name="co_premium[]"]').val(""); let isAnyChecked = $('input[type="checkbox"][name="co_share_type[]"]:checked').length > 1; @@ -1764,7 +1764,7 @@ function checkAndDistributeTax(input) function amountCalculation(input) { - console.log('amountCalculation - ' + input); + console.log('amountCalculation : ' + input); let selectedOption = $('#policy_type_id').find('option:selected'); let bap = selectedOption.data('bap'); @@ -1816,10 +1816,8 @@ function amountCalculation(input) { // Calculate GST percentage let gst_per = igst; if (igst === 0) { - console.log('called' + cgst + sgst); gst_per = parseFloat(cgst) + parseFloat(sgst); // gst_per = (cgst) + (sgst); - console.log(gst_per); } console.log('gst_per', gst_per); @@ -4267,4 +4265,34 @@ function getCdAmount(cd_ac_pk, increment){ } +$('#bro_payable_by').on('change', function(){ + + var columnIndexes = []; + $('#insurerTable thead th').each(function(index) { + if(index == 0){ + console.log("columnIndexes is ", index); + }else{ + amountCalculation(index); + } + columnIndexes.push(index); + }); + console.log("columnIndexes", columnIndexes); + +}); + +$(document).on('change', '#insurerTable input, #insurerTable select, #insurerTable textarea', function() { + console.log('Changed in table:', $(this).attr('name'), 'Value:', $(this).val()); + getColumnIndexes() +}); + +function getColumnIndexes() { + $('#insurerTable thead th').each(function(index) { + if (index === 0) { + console.log("columnIndexes is", index); + } else { + amountCalculation(index); + } + }); +} + \ No newline at end of file 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) \ No newline at end of file diff --git a/app/Views/ticket_form_gpa.php b/app/Views/ticket_form_gpa.php index 42b916cb..798a625c 100644 --- a/app/Views/ticket_form_gpa.php +++ b/app/Views/ticket_form_gpa.php @@ -25,92 +25,18 @@