From e5f84f7fe4362c09a897f13d7ddd79572b5701b8 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 29 Jul 2025 15:47:26 +0530 Subject: [PATCH 01/10] FIX_CLAIM_AUTO_UPDATE_STATUS :RV --- app/Controllers/TicketController.php | 63 ++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 4 deletions(-) diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 91ec3aae..6a311ea1 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -41,6 +41,8 @@ class TicketController extends BaseController public $placeHolders; public $extraFields; public $nonIDReason; + public $removeArrayKey; + protected $clientModel; protected $ticketMasterModel; @@ -278,7 +280,6 @@ class TicketController extends BaseController 58 => ['cancel_remark' => 'Cancel Remark'] ]; - $this->nonIDReason = [ "Newborn Baby" => "Newborn Baby", "Newly Wedded Spouse" => "Newly Wedded Spouse", @@ -287,6 +288,46 @@ class TicketController extends BaseController "Exceptional Case" => "Exceptional Case" ]; + $this->removeArrayKey = [ + 2 => [], + 6 => [], + 12 => [], + 15 => [], + 16 => [], + 17 => [], + 18 => [], + 19 => [], + 21 => [], + 22 => [], + 23 => [], + 25 => [], + 26 => [], + 27 => [], + 28 => [], + 29 => [], + 31 => [], + 32 => [], + 33 => [], + 35 => [], + 36 => [], + 37 => [], + 38 => [], + 39 => [], + 41 => [], + 42 => [], + 43 => [], + 45 => [], + 46 => [], + 49 => [], + 50 => [], + 51 => [], + 52 => [], + 55 => [], + 56 => [], + 57 => [], + 60 => [] + ]; + $this->ticketMasterModel = new TicketMasterModel(); $this->claimStatus = new TicketClaimStatusModel(); $this->clientModel = new ClientModel(); @@ -1705,9 +1746,22 @@ class TicketController extends BaseController $lastMatchedStatus = $incoming_form_values['claim_status_id']; // Use the provided `extra_fields_array_for_validate` from the incoming data - $statusMapping = json_decode($incoming_form_values['extra_fields_array_for_validate']); + $statusMapping = json_decode($incoming_form_values['extra_fields_array_for_validate'], true); + // print_r($statusMapping); + // echo "-------------------------------"; + + //for remove the non used arrays + foreach ($statusMapping as $key1 => $value1) { + foreach ($this->removeArrayKey as $key2 => $value2) { + if($key1 === $key2){ + unset($statusMapping[$key1]); + } + } + } + // print_r($statusMapping); die; - if($incoming_form_values['claim_status_id'] != $old_ticket_data['claim_status_id']){ + // if($incoming_form_values['claim_status_id'] != $old_ticket_data['claim_status_id']){ + foreach ($statusMapping as $status => $requiredFields) { if(!empty($requiredFields) && $status != $old_ticket_data['claim_status_id']){ @@ -1742,7 +1796,8 @@ class TicketController extends BaseController $lastMatchedStatus = 2; } } - } + + // } return $lastMatchedStatus; } From e6f292901b6fdbf59dc85bc807459b33eee4f810 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 29 Jul 2025 18:24:14 +0530 Subject: [PATCH 02/10] CHANGE_LEAD_FORM_PAGE_CHANGE : RV --- app/Controllers/LeadsController.php | 2 + app/Views/leads_form.php | 69 ++++++++--- app/Views/leads_form_handler.php | 2 +- app/Views/leads_list.php | 172 ++++++++++++++++++++++++---- app/Views/leads_non_eb.php | 2 +- app/Views/view_rfq.php | 149 ++++++++++++++++-------- app/Views/view_rfq_non_eb.php | 76 +++++++----- 7 files changed, 356 insertions(+), 116 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 174bad00..178b5599 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -207,6 +207,8 @@ class LeadsController extends BaseController private function prepareLeadData() { $data = $this->request->getPost(); + $data['client_type'] = 1; + $data['pan'] = ""; if ($data['lead_type'] != 1) { $client_data = $this->clientModel->where('id', $data['client_id'])->where('is_active', 1)->first(); diff --git a/app/Views/leads_form.php b/app/Views/leads_form.php index 76b6ef5e..f6370884 100644 --- a/app/Views/leads_form.php +++ b/app/Views/leads_form.php @@ -170,7 +170,7 @@ -
+
@@ -210,7 +210,7 @@ placeholder="Enter Client Short Name" onkeyup="validateInput(this, 'clients', 'short_name')" required>
- -
- +
+ -
-
+
@@ -302,9 +301,9 @@
- +
@@ -771,7 +770,8 @@ if (value.name && value.email) { - let display_value = `${value.name} - ${value.email} - ${value.mobile}`; + // let display_value = `${value.name} - ${value.email} - ${value.mobile}`; + let display_value = value.name; $('#contact_person_summary').append($('
@@ -293,18 +376,27 @@ document.addEventListener("DOMContentLoaded", function () { if (ticketsTable.length) { ticketsTable.DataTable({ - // scrollX: true, - dom: "<'row'<'col-sm-6'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right + scrollX: true, + dom: "<'row'<'col-sm-7'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector - buttons: [{ - extend: 'csv', - text: 'CSV', - title: 'Policy-Tranction-Inception-List', - exportOptions: { - columns: ':not(:last-child)' - }, - }, ], + buttons: [ + { + extend: 'csv', + text: 'CSV', + title: 'Policy-Tranction-Inception-List', + exportOptions: { + columns: ':not(:last-child)' + }, + }, + { + text: 'Add', + className: 'buttons-html5 addbtnStyle', + action: function (e, dt, node, config) { + openLeadTypeAskModal(); + } + } + ], language: { search: "_INPUT_", searchPlaceholder: "Search..." @@ -327,7 +419,8 @@ document.addEventListener("DOMContentLoaded", function () { console.log('function called') - let Lead_type = $('#openLeadTypeAskModal').val() + // let Lead_type = $('#openLeadTypeAskModal').val() + let Lead_type = $('input[name="lead_form_type"]:checked').val(); console.log('Lead_type ', Lead_type) let url = '' + Lead_type console.log('url ', url) @@ -346,3 +439,32 @@ document.addEventListener("DOMContentLoaded", function () { } + + diff --git a/app/Views/leads_non_eb.php b/app/Views/leads_non_eb.php index 0dc44253..04e0a15d 100644 --- a/app/Views/leads_non_eb.php +++ b/app/Views/leads_non_eb.php @@ -363,7 +363,7 @@
- +
diff --git a/app/Views/view_rfq.php b/app/Views/view_rfq.php index c6f1d3b4..83daa218 100644 --- a/app/Views/view_rfq.php +++ b/app/Views/view_rfq.php @@ -42,13 +42,13 @@ #rfqTable th:nth-child(-n+3), #rfqTable td:nth-child(-n+3) { - border: 3px solid snow; + border: 2px solid #007bff; } #rfqTable th:nth-child(n+4), #rfqTable td:nth-child(n+4) { border: 2px solid #007bff; - /* outline: none; */ + outline: none; } #rfqTable thead th { @@ -59,6 +59,7 @@ #rfqTable_for_calc th, #rfqTable_for_calc td { border: 2px solid #007bff; + } /* Remove border from first 2 and last column */ @@ -240,11 +241,26 @@ border: none !important; } + .save-indicator { + position: absolute; + top: 10px; + right: 10px; + background: #28a745; + color: white; + padding: 2px 8px; + border-radius: 10px; + font-size: 11px; + opacity: 0; + transition: opacity 0.3s; + } + + .save-indicator.show { + opacity: 1; + } + -
-
@@ -277,13 +293,14 @@ +
Saved
- - - + + + - + - - - + + + - + @@ -446,7 +463,7 @@
- + - +
- +
@@ -684,6 +701,7 @@ var multi_file_data = []; var totalSumAssuredData = []; var snoColumnWidth = "72px"; + var borderPixel = "2px solid #007bff"; const editorConfig = { buttons: [ @@ -851,15 +869,15 @@ }); $('#proposals').select2({ - placeholder: 'Select To proposal', + placeholder: 'Select proposal', }); $('#placement_to').select2({ - placeholder: 'Select To Mail', + placeholder: 'Select TO Mail', }); $('#to').select2({ - placeholder: 'Select To Mail', + placeholder: 'Select TO Mail', }); $("textarea.select2-search__field").attr('rows', '1'); @@ -1410,7 +1428,6 @@ function addSuggestionsToTable() { actionCell.classList.add('action'); actionCell.innerHTML = ' QCR Client '; - suggestionKeys.push(key); } } @@ -3979,18 +3996,18 @@ function ajaxRequest(formData) { }); $('#to').select2({ - placeholder: 'Select To Mail', + placeholder: 'Select TO Mail', }); $('#cc').val('').select2({ - placeholder : 'select CC Mail' + placeholder : 'Select CC Mail' }); // $('#subject').val(''); $('#proposals').val(''); $('#placement_to').val('').select2({ - placeholder : 'select To Mail' + placeholder : 'Select TO Mail' }); $('#placement_cc').val('').select2({ - placeholder : 'select CC Mail' + placeholder : 'Select CC Mail' }); // $('#placement_subject').val(''); @@ -4040,7 +4057,7 @@ function appendInsurerContact(data) { // Clear existing options and CC entries $('#placement_to').empty().append($('
S.No.ParticularsS.No.Particulars Proposal Coverage 1 @@ -301,14 +318,14 @@ ActionAction
- - - - Quote Asked - -
Client name{{CLIENT_NAME}}
Coverage Type{{POLICY_LONG_NAME}}
Policy Start Date{{POLICY_START_DATE}}
Policy Duration{{DURATION}}
Please note: Additional terms and details are included in the attachment for your reference.

Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.

Best regards,

Nhance India Pvt Ltd

'; + // $gmailapi = \Config\Services::gmailapi(); + $message = ''; // $attachments = [ // ["filePath" => WRITEPATH."uploads/excel/sample/correction.xls","fileName" => "correction.xls"], @@ -1661,34 +1808,34 @@ class MasterController extends AdminController // ]; $attachments = [ - ["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"], - ["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"], - ["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"] + ["filePath" => ROOTPATH . "public/sample_excel/sample_addition.xls", "fileName" => "sample_addition.xls"], + ["filePath" => ROOTPATH . "public/sample_excel/sample_inception.xls", "fileName" => "sample_inception.xls"], + ["filePath" => ROOTPATH . "public/assets/images/login_bg.jpg", "fileName" => "login_bg.jpg"] ]; - $common = ['mail_type'=>'test_mail_cli']; + $common = ['mail_type' => 'test_mail_cli']; $email_id = CLI::getOption('to') ? CLI::getOption('to') : $email_id; - $res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message,'attachments' => $attachments,'common'=>$common]); - echo "Inside the master controller"; - print_r($res); - + $res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message, 'attachments' => $attachments, 'common' => $common]); + echo "Inside the master controller"; + print_r($res); } - public function testZeptoSMTP() { + public function testZeptoSMTP() + { $message = ''; $attachments = [ - ["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"], - ["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"], - ["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"] + ["filePath" => ROOTPATH . "public/sample_excel/sample_addition.xls", "fileName" => "sample_addition.xls"], + ["filePath" => ROOTPATH . "public/sample_excel/sample_inception.xls", "fileName" => "sample_inception.xls"], + ["filePath" => ROOTPATH . "public/assets/images/login_bg.jpg", "fileName" => "login_bg.jpg"] ]; - $email_id = ['srinivas.saravanan@venbainfotech.com','srinivassaravanan2002@gmail.com']; - $params = ['mail'=>$email_id]; - $common = ['mail_type'=>'test_mail_cli']; + $email_id = ['srinivas.saravanan@venbainfotech.com', 'srinivassaravanan2002@gmail.com']; + $params = ['mail' => $email_id]; + $common = ['mail_type' => 'test_mail_cli']; // $bcc = "vijayalakshmi@nhanceindia.in,vitvelz@gmail.com,velmurugan.s@venbainfotech.com,hariharan@nhanceindia.in,hariharan@jubiliant.in,srinivas.saravanan@venbainfotech.com"; // Send email and get response - $result = MailHelper::send_email(['mail' => $email_id, 'params'=>$params,'subject' => 'Mail Via CLI','message' => $message,'attachments' => $attachments,'common'=>$common]); - + $result = MailHelper::send_email(['mail' => $email_id, 'params' => $params, 'subject' => 'Mail Via CLI', 'message' => $message, 'attachments' => $attachments, 'common' => $common]); - log_message('error',json_encode($result)); + + log_message('error', json_encode($result)); // Format the response for display/debugging $response = [ 'success' => $result['success'] ?? false, @@ -1703,15 +1850,16 @@ class MasterController extends AdminController // Return JSON response return $this->response->setJSON($result); } + public function testCheckBounceMails() { - $gmailapi = \Config\Services::gmailapi(); - $from_date = CLI::getOption('from') ? CLI::getOption('from') : null; - $to_date = CLI::getOption('to') ? CLI::getOption('to') : null; - $count = CLI::getOption('count') ? CLI::getOption('count') : null; - $page = CLI::getOption('page') ? CLI::getOption('page') : null; - $res = $gmailapi->checkBounceStatus(from_date:$from_date,to_date:$to_date,count:$count,page:$page); - print_r($res); + $gmailapi = \Config\Services::gmailapi(); + $from_date = CLI::getOption('from') ? CLI::getOption('from') : null; + $to_date = CLI::getOption('to') ? CLI::getOption('to') : null; + $count = CLI::getOption('count') ? CLI::getOption('count') : null; + $page = CLI::getOption('page') ? CLI::getOption('page') : null; + $res = $gmailapi->checkBounceStatus(from_date: $from_date, to_date: $to_date, count: $count, page: $page); + print_r($res); } public function appCheckList() @@ -1721,7 +1869,6 @@ class MasterController extends AdminController $this->checkGoogleOAuthCredentialsinDB(); $this->getCronJobsList(); $this->checkGdriveRootFolderID(); - } public function checkAndCreateDirectories() @@ -1740,7 +1887,7 @@ class MasterController extends AdminController 'tmp' => WRITEPATH . 'tmp/', 'e_card_imgs' => ROOTPATH . 'public/e_card_imgs', 'uploads' => ROOTPATH . 'public/uploads', - 'add_image_upload' => ROOTPATH . 'public/uploads/add_image_upload/',//adverdisement images for enrollment app + 'add_image_upload' => ROOTPATH . 'public/uploads/add_image_upload/', //adverdisement images for enrollment app 'logo' => ROOTPATH . 'public/uploads/logo/', 'template_bg' => ROOTPATH . 'public/uploads/template_bg/', 'attachments' => WRITEPATH . 'uploads/attachments/', @@ -1776,21 +1923,18 @@ class MasterController extends AdminController echo "################ CHECKING GMAIL OAUTH FOR EMAIL ###################\n"; if (is_array($token) && is_null($token['gmail_api_oauth_credentials'])) { - + echo "Email OAuth credentials not found in database.\n"; echo "Check the following..!\n"; echo "1. Update Gmail Oauth credentials in 'gmail_api_oauth_credentials' field in 'settings' table in JSON format.\n"; echo "2. Call this cli route to generate new access token: 'php public/index.php cli/new_gmail_token' from root of the project.\n"; echo "3. Call this cli route : 'php public/index.php cli/send_mail_cli --to someone@gmail.com' to send test mail to testGmailAPIViaCLI ( replace someone@gmail.com with real time mail).\n"; - } - else - { + } else { echo "Gmail OAuth for sending email is set in DB\n"; } echo "################################################################\n\n"; } - function getCronJobsList() { // Execute the shell command to get cron jobs @@ -1806,7 +1950,7 @@ class MasterController extends AdminController } elseif ($output) { // Return the cron job list echo nl2br($output); - echo "\n" ;// Convert newlines to
for easier HTML rendering + echo "\n"; // Convert newlines to
for easier HTML rendering } else { echo "Error retrieving cron jobs or no cron jobs set.\n"; } @@ -1818,13 +1962,10 @@ class MasterController extends AdminController { echo "#################### CHECKING GDRIVE FOLDER ID IN ENV FILE ############################\n"; $id = getenv('GDRIVE_ROOT_FOLDER_ID'); - if($id) - { - echo $this->cli_colors['green'] . "ID is :". $id . $this->cli_colors['reset']. "\n"; - } - else - { - echo $this->cli_colors['red'] ."Gdrive Folder id not set in env file. set it under 'GDRIVE_ROOT_FOLDER_ID' in env file.". $this->cli_colors['reset'] ."\n"; + if ($id) { + echo $this->cli_colors['green'] . "ID is :" . $id . $this->cli_colors['reset'] . "\n"; + } else { + echo $this->cli_colors['red'] . "Gdrive Folder id not set in env file. set it under 'GDRIVE_ROOT_FOLDER_ID' in env file." . $this->cli_colors['reset'] . "\n"; } echo "################################################################\n\n"; } @@ -1834,16 +1975,16 @@ class MasterController extends AdminController $message = ''; $attachments = [ - ["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"], - ["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"], - ["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"] + ["filePath" => ROOTPATH . "public/sample_excel/sample_addition.xls", "fileName" => "sample_addition.xls"], + ["filePath" => ROOTPATH . "public/sample_excel/sample_inception.xls", "fileName" => "sample_inception.xls"], + ["filePath" => ROOTPATH . "public/assets/images/login_bg.jpg", "fileName" => "login_bg.jpg"] ]; $email_id = 'venkateshraman786@gmail.com'; - $params = ['mail'=>$email_id]; + $params = ['mail' => $email_id]; $multi_mails = ['venkateshraman786@gmail.com', 'gowtham.manavalan.la@gmail.com', 'venkatesh.r@venbainfotech.com']; - $common = ['mail_type'=>'test_mail_cli']; + $common = ['mail_type' => 'test_mail_cli']; $bcc = "vitvelz@gmail.com,velmurugan.s@venbainfotech.com,srinivas.saravanan@venbainfotech.com"; - $result = MailHelper::send_email(['mail' => $multi_mails, 'bcc'=>$bcc, 'params'=>$params,'subject' => 'Send Multiple " To " emails','message' => $message,'attachments' => $attachments,'common'=>$common]); + $result = MailHelper::send_email(['mail' => $multi_mails, 'bcc' => $bcc, 'params' => $params, 'subject' => 'Send Multiple " To " emails', 'message' => $message, 'attachments' => $attachments, 'common' => $common]); dd($result); } diff --git a/app/Models/CDMasterModel.php b/app/Models/CDMasterModel.php index 663ea3bc..ee503a86 100755 --- a/app/Models/CDMasterModel.php +++ b/app/Models/CDMasterModel.php @@ -17,6 +17,7 @@ class CDMasterModel extends Model 'id', 'client_id', 'insurer_id', + 'insurer_branch_id', 'cd_ac_no', 'opening_bal', 'opening_date', @@ -66,9 +67,10 @@ class CDMasterModel extends Model $query = $this->db->table('cd_master') - ->select('cd_master.*, clients.client_name, clients.short_name, insurers.name AS insurer_name, user_profiles.first_name AS user_name, IFNULL(cd_ac_counts.cd_ac_no_count, 0) AS cd_ac_no_count, IFNULL(cd_ac_counts_for_cdt.cd_ac_no_count_cd_tranction, 0) AS cd_ac_no_count_cd_tranction') + ->select('cd_master.*, clients.client_name, clients.short_name, insurers.name AS insurer_name, user_profiles.first_name AS user_name, IFNULL(cd_ac_counts.cd_ac_no_count, 0) AS cd_ac_no_count, IFNULL(cd_ac_counts_for_cdt.cd_ac_no_count_cd_tranction, 0) AS cd_ac_no_count_cd_tranction, insurer_branch.branch_name as insurer_branch_name') ->join('clients', 'clients.id = cd_master.client_id') ->join('insurers', 'insurers.id = cd_master.insurer_id') + ->join('insurer_branch', 'cd_master.insurer_branch_id = insurer_branch.id', "left") ->join('user_profiles', 'user_profiles.id = cd_master.created_by') ->join( '(SELECT cd_master.cd_ac_no, cd_master.id, COUNT(client_policy.cd_ac_no) AS cd_ac_no_count @@ -102,6 +104,7 @@ class CDMasterModel extends Model ->where('clients.is_active', 1) ->where('insurers.is_active', 1) ->where('user_profiles.is_active', 1) + ->orderBy('cd_master.id', "desc") ->get(); $result = $query->getResultArray(); diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php index 1ad8e8bb..132080de 100755 --- a/app/Models/ClientPolicyModel.php +++ b/app/Models/ClientPolicyModel.php @@ -174,10 +174,11 @@ class ClientPolicyModel extends Model $builder = $this->db->table('client_policy') ->select('client_policy.*, cd_master.cd_ac_no as cd_master_account_no') - ->select('insurers.name as insurer_name, insurers.short_name as insurer_short') + ->select('insurers.name as insurer_name, insurers.short_name as insurer_short, insurer_branch.branch_name as insurer_branch_name') ->select('clients.client_name as client_name') ->join('clients', 'clients.id = client_policy.client_id') ->join('insurers', 'insurers.id = client_policy.insurer_id') + ->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id', 'left') ->join('cd_master', 'cd_master.insurer_id = insurers.id AND cd_master.client_id = client_policy.client_id') ->where('client_policy.client_id', $id) ->where('cd_master.id = client_policy.cd_ac_pk') @@ -190,7 +191,9 @@ class ClientPolicyModel extends Model $builder->whereIn('client_policy.id', $policyId); } - return $builder->get()->getResult(); + $data = $builder->get()->getResult(); + // dd($this->db->getLastQuery()); + return $data; diff --git a/app/Views/cd_master_add_modal.php b/app/Views/cd_master_add_modal.php new file mode 100644 index 00000000..738b9dcc --- /dev/null +++ b/app/Views/cd_master_add_modal.php @@ -0,0 +1,306 @@ + + + + + \ No newline at end of file diff --git a/app/Views/cd_master_list.php b/app/Views/cd_master_list.php index 67ac08a0..64dbaf47 100755 --- a/app/Views/cd_master_list.php +++ b/app/Views/cd_master_list.php @@ -16,6 +16,7 @@ table.dataTable thead th { max-width: 98% !important; } + .custom-dropdown-menu { display: none; position: absolute; @@ -42,6 +43,15 @@ table.dataTable thead th { color: #16181b !important; cursor: pointer !important; } + +.addbtnStyle{ + margin-left: 20px !important; +} + +.dataTables_filter { + position: absolute; +} +
@@ -53,17 +63,18 @@ table.dataTable thead th {

CD Master List

- + data-trigger="hover">ADD -->
- +
+ + @@ -71,17 +82,17 @@ table.dataTable thead th { - - + $row){ ?> + + - + + @@ -33,6 +34,7 @@ + - - + + diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index f218a241..e59e467d 100755 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -1,5 +1,26 @@ -
+ + +
Saved
+
@@ -7,9 +28,8 @@
- -
S.No. Client Name Insurer NameInsurer Branch Name Opening Date CD Account No Opening AmountAction
( ) by - by + - - - - \ No newline at end of file diff --git a/app/Views/client_deposit_list.php b/app/Views/client_deposit_list.php index 18f9fc29..b1818640 100755 --- a/app/Views/client_deposit_list.php +++ b/app/Views/client_deposit_list.php @@ -21,6 +21,7 @@
Insurer NameInsurer Branch Name CD Account Number Current Balance Action insurer_name;?>insurer_branch_name;?> cd_master_account_no;?> ₹ diff --git a/app/Views/client_onboarding.php b/app/Views/client_onboarding.php index 0cc8e7d7..2e6dddae 100755 --- a/app/Views/client_onboarding.php +++ b/app/Views/client_onboarding.php @@ -32,6 +32,13 @@ body { margin: 0 5px 10px!important; } +.readonly-select { + pointer-events: none; + /* background-color: #f0f0f0; */ + background-color: #e0e0e0; + color: #666; +} + -

Welcome to Insurance ChatBot

- +

Loading...Please wait

+ + - - - - - + \ No newline at end of file diff --git a/app/Views/chatbottest.php b/app/Views/chatbottest.php new file mode 100644 index 00000000..95bf5cde --- /dev/null +++ b/app/Views/chatbottest.php @@ -0,0 +1,84 @@ + + + + + + Insurance ChatBot + + + + +

Welcome to Insurance ChatBot

+ + + + + + + + + + From f56b2afc8d7f9e6a9b14bdf7b7c1e58e5b60829f Mon Sep 17 00:00:00 2001 From: velz Date: Sat, 2 Aug 2025 12:15:08 +0530 Subject: [PATCH 07/10] FIX_CHATBOT_URL --- app/Views/chatbot.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Views/chatbot.php b/app/Views/chatbot.php index 4bd3db4b..cfcaae2e 100644 --- a/app/Views/chatbot.php +++ b/app/Views/chatbot.php @@ -27,8 +27,8 @@ var botmanWidget = { // chatServer: 'https://venbait.in/nhance/chatbot/chat', // frameEndpoint: 'https://venbait.in/nhance/chatbot/widget', - chatServer: 'https://localhost/PHP828APPS/ruc/nhance/chat', - frameEndpoint: 'https://localhost/PHP828APPS/ruc/nhance/widget', + chatServer: ``, + frameEndpoint: ``, title: "Ask ILA", placeholderText: "Type your message here...", aboutText: "Insurance Assistant ILA", From fd56103835086df95ece19cf232cf2d24db35c18 Mon Sep 17 00:00:00 2001 From: velz Date: Sat, 2 Aug 2025 12:41:59 +0530 Subject: [PATCH 08/10] FIX_CHATBOT_SW&URL --- app/Controllers/ChatbotControllerNew.php | 2 +- app/Views/chatbot.php | 2 +- service-worker.js | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Controllers/ChatbotControllerNew.php b/app/Controllers/ChatbotControllerNew.php index e60e74ef..544c40d4 100644 --- a/app/Controllers/ChatbotControllerNew.php +++ b/app/Controllers/ChatbotControllerNew.php @@ -111,7 +111,7 @@ class ChatbotControllerNew extends BaseController log_message("error","Inside Bot Type Function"); $bot->types(); // Typing indicator for the first message - sleep(0.5); // Delay + sleep(0.1); // Delay }); // Start the Main Menu when user says "hi" or "start" $this->botman->hears('start|hi|hello|help|help me', function (BotMan $bot) { diff --git a/app/Views/chatbot.php b/app/Views/chatbot.php index cfcaae2e..5fd18fae 100644 --- a/app/Views/chatbot.php +++ b/app/Views/chatbot.php @@ -28,7 +28,7 @@ // chatServer: 'https://venbait.in/nhance/chatbot/chat', // frameEndpoint: 'https://venbait.in/nhance/chatbot/widget', chatServer: ``, - frameEndpoint: ``, + frameEndpoint: ``, title: "Ask ILA", placeholderText: "Type your message here...", aboutText: "Insurance Assistant ILA", diff --git a/service-worker.js b/service-worker.js index 349308f7..aa3577ae 100755 --- a/service-worker.js +++ b/service-worker.js @@ -12,10 +12,11 @@ self.addEventListener('activate', function(event) { // Fetch event self.addEventListener('fetch', function(event) { - // console.log('Fetching:', event.request.url); event.respondWith( - fetch(event.request).catch(function() { - return caches.match(event.request); + caches.match(event.request).then(function(response) { + // Respond with cached version or fetch from network + return response || fetch(event.request); }) ); }); + From 393270f2a66f9896afe283b5867a5fffe32648bc Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Sat, 2 Aug 2025 13:03:11 +0530 Subject: [PATCH 09/10] CHANGE_CLIENT_INCEPTION_CRS_AND_LIVE_ISSUE_AND_OTHERS : RV --- app/Config/Routes.php | 2 + app/Controllers/ClientController.php | 688 +++++++++++++++- app/Controllers/EmployeeController.php | 5 +- app/Controllers/EmployeeServiceController.php | 16 +- app/Helpers/excel_import_export_helper.php | 8 +- app/Models/ClientModel.php | 1 + app/Models/EmployeePolicyModel.php | 4 +- app/Views/UserList.php | 748 +++++++++++++++--- app/Views/client_basic_info.php | 18 +- app/Views/client_list.php | 88 ++- app/Views/insurer_export_templete.php | 37 +- app/Views/leads_list.php | 8 +- 12 files changed, 1451 insertions(+), 172 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 6e3e0e30..9b859b7d 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -87,6 +87,8 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) { $routes->get('deposit/(:num)', 'ClientController::deposit/$1'); $routes->get('remove/(:num)', 'ClientController::removeClient/$1'); $routes->get("list/(:any)", "ClientController::editClientOnboarding/$1"); + $routes->post('wipe', 'ClientController::wipeDemoClient'); + // application/config/routes.php // Add a route for the view_Deposit method diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index e639c97c..39a0285e 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -809,7 +809,12 @@ class ClientController extends AdminController $data['is_download_btn'] = 1; } + if(empty($data['parent_client_id'])){ + $data['parent_client_id'] = null; + } + $insert = $this->clientModel->insert($data); + if ($insert) { $client_data = $this->clientModel->where(['id' => $insert, 'is_active' => 1])->first(); return $this->respond(['status' => true, 'code' => 200, 'data' => $client_data], 200); @@ -838,6 +843,9 @@ class ClientController extends AdminController $data['is_download_btn'] = 1; } + if(empty($data['parent_client_id'])){ + $data['parent_client_id'] = null; + } // print_r($data);die; $update = $this->clientModel->update($id, $data); @@ -3557,21 +3565,54 @@ class ClientController extends AdminController public function get_cd_ac($client_id, $insurer_id, $insurer_branch_id) { + // Get client data + $client_data = $this->clientModel + ->where('is_active', 1) + ->where('id', $client_id) + ->first(); - $cd_data = $this->CDMasterModel + $cd_data = []; + + // If client has a parent, fetch parent client CD data + if (!empty($client_data['parent_client_id'])) { + $parent_cd_data = $this->CDMasterModel + ->where('client_id', $client_data['parent_client_id']) + ->where('insurer_id', $insurer_id) + ->where('insurer_branch_id', $insurer_branch_id) + ->where('is_active', 1) + ->findAll(); + + $cd_data = array_merge($cd_data, $parent_cd_data); + } + + // Fetch current client CD data + $client_cd_data = $this->CDMasterModel ->where('client_id', $client_id) ->where('insurer_id', $insurer_id) ->where('insurer_branch_id', $insurer_branch_id) ->where('is_active', 1) ->findAll(); - if ($cd_data) { - return $this->respond(['status' => true, 'code' => 200, 'data' => $cd_data], 200); + $cd_data = array_merge($cd_data, $client_cd_data); + + if (!empty($cd_data)) { + return $this->respond([ + 'status' => true, + 'code' => 200, + 'data' => $cd_data + ], 200); } else { - return $this->respond(['status' => false, 'code' => 404, 'insurer_id' => $insurer_id, 'client_id' => $client_id], 200); + return $this->respond([ + 'status' => false, + 'code' => 404, + 'client_id' => $client_id, + 'insurer_id' => $insurer_id, + 'insurer_branch_id' => $insurer_branch_id + ], 200); } } + public function otherPolicyTermsFormSubmit() { @@ -4100,22 +4141,60 @@ class ClientController extends AdminController } - - public function getCDAccNoByClientAndInsurer($client, $insurer, $insurer_branch_id) + public function getCDAccNoByClientAndInsurer($client_id, $insurer_id, $insurer_branch_id) { - $cdmData = $this->CDMasterModel - ->where('client_id', $client) - ->where('insurer_id', $insurer) - ->where('insurer_branch_id', $insurer_branch_id) - ->where('is_active', 1) - ->findAll(); + // Get client data + $client_data = $this->clientModel + ->where('is_active', 1) + ->where('id', $client_id) + ->first(); - if ($cdmData) { - return $this->respond(['status' => true, 'data' => $cdmData], 200); + $cd_data = []; + + // If client has a parent, fetch parent client CD data + if (!empty($client_data['parent_client_id'])) { + $parent_cd_data = $this->CDMasterModel + ->where('client_id', $client_data['parent_client_id']) + ->where('insurer_id', $insurer_id) + ->where('insurer_branch_id', $insurer_branch_id) + ->where('is_active', 1) + ->findAll(); + + $cd_data = array_merge($cd_data, $parent_cd_data); + } + + // Fetch current client CD data + $client_cd_data = $this->CDMasterModel + ->where('client_id', $client_id) + ->where('insurer_id', $insurer_id) + ->where('insurer_branch_id', $insurer_branch_id) + ->where('is_active', 1) + ->findAll(); + + $cd_data = array_merge($cd_data, $client_cd_data); + + if (!empty($cd_data)) { + return $this->respond([ 'status' => true,'code' => 200, 'data' => $cd_data], 200); } else { - return $this->respond(['status' => false], 200); + return $this->respond(['status' => false,'code' => 404,'client_id' => $client_id,'insurer_id' => $insurer_id,'insurer_branch_id' => $insurer_branch_id ], 200); } } + + // public function getCDAccNoByClientAndInsurer($client, $insurer, $insurer_branch_id) + // { + // $cdmData = $this->CDMasterModel + // ->where('client_id', $client) + // ->where('insurer_id', $insurer) + // ->where('insurer_branch_id', $insurer_branch_id) + // ->where('is_active', 1) + // ->findAll(); + + // if ($cdmData) { + // return $this->respond(['status' => true, 'data' => $cdmData], 200); + // } else { + // return $this->respond(['status' => false], 200); + // } + // } public function createClientWithMinimalData() { @@ -6147,7 +6226,7 @@ class ClientController extends AdminController } } - // --------------------------------------------------------------------------------------------------- + // ---------------- HR ACCESS CONTROL ----------------------------------------------------------------------------------- public function viewHrAccessData() { @@ -6493,8 +6572,585 @@ class ClientController extends AdminController } } + // ------------------- DEMO CLIENT FUNCTION -------------------------------------------------------------------------------- + // public function wipeDemoClient() + // { + // // $this->myLogger->logme('error', "Wipe Demo Client function called"); + // $this->myLogger->logme('error', "Wipe Demo Client function called"); // Red text + // $this->myLogger->logme('error', "Wipe Demo client Payload : " . json_encode($this->request->getPost() ?? [])); + // $client_id = $this->request->getPost('client_id'); + + // if (empty($client_id)) { + // return $this->respond(['status' => false, 'message' => 'Client id required'], 404); + // } + + // // 1. Client Model + // $client_data = $this->clientModel->where('id', $client_id)->where('is_active', 1)->first(); + // $this->myLogger->logme('error', "Client data : " . json_encode($client_data ?? [])); + + // if (!empty($client_data)) { + // $is_deleted = $this->clientModel->where('id', $client_id)->delete(); + + // if ($is_deleted) { + // $this->myLogger->logme('error', "Client data removed successfully."); + // } else { + // $this->myLogger->logme('error', "Client record does not exist."); + // } + // } else { + // return $this->respond(['status' => false, 'message' => 'Client not found'], 404); + // } + + // // 2. Client RM Model + // $client_rm_data = $this->clientRMModel->where('client_id', $client_id)->first(); + // $this->myLogger->logme('error', "Client Relationship Manager data : " . json_encode($client_rm_data ?? [])); + + // if (!empty($client_rm_data)) { + // $is_deleted = $this->clientRMModel->where('client_id', $client_id)->delete(); + + // if ($is_deleted) { + // $this->myLogger->logme('error', "Client Relationship Manager data removed successfully."); + // } else { + // $this->myLogger->logme('error', "Client Relationship Manager record does not exist. To delete"); + // } + // } else { + // $this->myLogger->logme('error', "Client Relationship Manager data not found."); + // } + + // // 3. Client KYC Docs Model + // $client_kyc_data = $this->clientKYCDocsModel->where('client_id', $client_id)->findAll(); + // $this->myLogger->logme('error', "Client KYC Docs data : " . json_encode($client_kyc_data ?? [])); + + // if (!empty($client_kyc_data)) { + // $is_deleted = $this->clientKYCDocsModel->where('client_id', $client_id)->delete(); + // if ($is_deleted) { + // $this->myLogger->logme('error', "Client KYC Docs data removed successfully."); + // } else { + // $this->myLogger->logme('error', "Client KYC Docs record does not exist. To delete"); + // } + // } else { + // $this->myLogger->logme('error', "Client KYC Docs data not found."); + // } + + // // 4. Client Branch Model + // $client_branch_data = $this->clientBranchModel->where('client_id', $client_id)->findAll(); + // $this->myLogger->logme('error', "Client Branch data : " . json_encode($client_branch_data ?? [])); + + // $branch_ids = array_column($client_branch_data, 'id') ?? []; + // $this->myLogger->logme('error', "Client Branch id count : " . count($branch_ids ?? [])); + + // if (!empty($client_branch_data)) { + + // $is_deleted = $this->clientBranchModel->where('client_id', $client_id)->delete(); + + // if ($is_deleted) { + // $this->myLogger->logme('error', "Client Branch data removed successfully."); + + // if(!empty($branch_ids)){ + + // $level_contact_data = $this->levelContactModel->where('contact_type', 'client')->whereIn('ref_id', $branch_ids)->findAll(); + // $this->myLogger->logme('error', "Level Contact data : " . json_encode($level_contact_data ?? [])); + + // $is_deleted = $this->levelContactModel->where('contact_type', 'client')->whereIn('ref_id', $branch_ids)->delete(); + // if ($is_deleted) { + // $this->myLogger->logme('error', "Level Contact data removed successfully."); + // } else { + // $this->myLogger->logme('error', "Level Contact record does not exist. To delete"); + // } + + // }else{ + // $this->myLogger->logme('error', "Level Contact data not found."); + // } + + // } else { + // $this->myLogger->logme('error', "Client Branch record does not exist. To delete"); + // } + // } else { + // $this->myLogger->logme('error', "Client Branch data not found."); + // } + + // // 5. Client Policy Model + // $client_policy_data = $this->clientPolicyModel->where('client_id', $client_id)->findAll(); + // $this->myLogger->logme('error', "Client Policy data : " . json_encode($client_policy_data ?? [])); + + // $policy_ids = array_column($client_policy_data, 'id') ?? []; + // $this->myLogger->logme('error', "Client Policy id count : " . count($policy_ids ?? [])); + + // if (!empty($client_policy_data)) { + // $is_deleted = $this->clientPolicyModel->where('client_id', $client_id)->delete(); + // if ($is_deleted) { + + // $this->myLogger->logme('error', "Client Policy data removed successfully."); + + // if(!empty($policy_ids)){ + + // $employee_policy_data = $this->employeePolicyModel->whereIn('client_policy_id', $policy_ids)->findAll(); + // $this->myLogger->logme('error', "Employee Policy data count : " . count($employee_policy_data ?? [])); + + // $is_deleted = $this->employeePolicyModel->whereIn('client_policy_id', $policy_ids)->delete(); + // if ($is_deleted) { + // $this->myLogger->logme('error', "Employee policy data removed successfully."); + // } else { + // $this->myLogger->logme('error', "Employee policy record does not exist. To delete"); + // } + + // }else{ + // $this->myLogger->logme('error', "Employee policy data not found."); + // } + + // } else { + // $this->myLogger->logme('error', "Client Policy record does not exist. To delete"); + // } + // } else { + // $this->myLogger->logme('error', "Client Policy data not found."); + // } + + // // 6. Employee Model + // $employee_data = $this->employeeModel->where('client_id', $client_id)->findAll(); + // $this->myLogger->logme('error', "Employee data count : " . count($employee_data ?? [])); + + // if (!empty($employee_data)) { + + // $is_deleted = $this->employeeModel->where('client_id', $client_id)->delete(); + // if ($is_deleted) { + // $this->myLogger->logme('error', "Employee data removed successfully."); + // } else { + // $this->myLogger->logme('error', "Employee record does not exist. To delete"); + // } + // } else { + // $this->myLogger->logme('error', "Employee data not found."); + // } + + // // 7. Client Deposit Model + // $client_deposit_data = $this->clientDepositModel->where('client_id', $client_id)->findAll(); + // $this->myLogger->logme('error', "Client Deposit data : " . json_encode($client_deposit_data ?? [])); + + // if (!empty($client_deposit_data)) { + // $is_deleted = $this->clientDepositModel->where('client_id', $client_id)->delete(); + // if ($is_deleted) { + // $this->myLogger->logme('error', "Client Deposit data removed successfully."); + // } else { + // $this->myLogger->logme('error', "Client Deposit record does not exist. To delete"); + // } + // } else { + // $this->myLogger->logme('error', "Client Deposit data not found."); + // } + + // // 8. Policy Premium 1 Model + // $policy_premium1_data = $this->policyPremium1Model->where('client_id', $client_id)->findAll(); + // $this->myLogger->logme('error', "Policy Premium 1 data count : " . count($policy_premium1_data ?? [])); + + // if (!empty($policy_premium1_data)) { + // $is_deleted = $this->policyPremium1Model->where('client_id', $client_id)->delete(); + // if ($is_deleted) { + // $this->myLogger->logme('error', "Policy Premium 1 data removed successfully."); + // } else { + // $this->myLogger->logme('error', "Policy Premium 1 record does not exist. To delete"); + // } + // } else { + // $this->myLogger->logme('error', "Policy Premium 1 data not found."); + // } + + // // 9. Policy Premium 2 Model + // $policy_premium2_data = $this->policyPremium2Model->where('client_id', $client_id)->findAll(); + // $this->myLogger->logme('error', "Policy Premium 2 data count: " . count($policy_premium2_data ?? [])); + + // if (!empty($policy_premium2_data)) { + // $is_deleted = $this->policyPremium2Model->where('client_id', $client_id)->delete(); + // if ($is_deleted) { + // $this->myLogger->logme('error', "Policy Premium 2 data removed successfully."); + // } else { + // $this->myLogger->logme('error', "Policy Premium 2 record does not exist. To delete"); + // } + // } else { + // $this->myLogger->logme('error', "Policy Premium 2 data not found."); + // } + + // // 10. Notification Model + // $notification_data = $this->notificationModel->where('client_id', $client_id)->findAll(); + // $this->myLogger->logme('error', "Notification data : " . json_encode($notification_data ?? [])); + + // if (!empty($notification_data)) { + // $is_deleted = $this->notificationModel->where('client_id', $client_id)->delete(); + // if ($is_deleted) { + // $this->myLogger->logme('error', "Notification data removed successfully."); + // } else { + // $this->myLogger->logme('error', "Notification record does not exist. To delete"); + // } + // } else { + // $this->myLogger->logme('error', "Notification data not found."); + // } + + // // 11. CD Master Model + // $cd_master_data = $this->CDMasterModel->where('client_id', $client_id)->findAll(); + // $this->myLogger->logme('error', "CD Master data : " . json_encode($cd_master_data ?? [])); + + // if (!empty($cd_master_data)) { + // $is_deleted = $this->CDMasterModel->where('client_id', $client_id)->delete(); + // if ($is_deleted) { + // $this->myLogger->logme('error', "CD Master data removed successfully."); + // } else { + // $this->myLogger->logme('error', "CD Master record does not exist. To delete"); + // } + // } else { + // $this->myLogger->logme('error', "CD Master data not found."); + // } + + // // 12. Policy Transaction Model + // $policy_transaction_data = $this->policyTransactionModel->where('client_id', $client_id)->findAll(); + // $this->myLogger->logme('error', "Policy Transaction data : " . json_encode($policy_transaction_data ?? [])); + + // $pt_ids = array_column($policy_transaction_data, 'id') ?? []; + // $this->myLogger->logme('error', "Policy Transaction id count : " . count($pt_ids ?? [])); + + // if (!empty($policy_transaction_data)) { + // $is_deleted = $this->policyTransactionModel->where('client_id', $client_id)->delete(); + // if ($is_deleted) { + // $this->myLogger->logme('error', "Policy Transaction data removed successfully."); + + // if(!empty($pt_ids)){ + + // $pt_co_share_data = $this->PTCOShareDetailsModel->whereIn('pt_id', $pt_ids)->findAll(); + // $this->myLogger->logme('error', "PT CO Share data : " . json_encode($pt_co_share_data ?? [])); + + // $is_deleted = $this->PTCOShareDetailsModel->whereIn('pt_id', $pt_ids)->delete(); + // if ($is_deleted) { + // $this->myLogger->logme('error', "PT CO Share data removed successfully."); + // } else { + // $this->myLogger->logme('error', "PT CO Share record does not exist. To delete"); + // } + + // }else{ + // $this->myLogger->logme('error', "PT CO Share data not found."); + // } + + // } else { + // $this->myLogger->logme('error', "Policy Transaction record does not exist. To delete"); + // } + // } else { + // $this->myLogger->logme('error', "Policy Transaction data not found."); + // } + + // $this->myLogger->logme('error', "Wipe Demo Client function closed"); + // return $this->respond(['status' => true, 'message' => 'Demo client data wiped successfully'], 200); + // } + + public function wipeDemoClient() + { + $this->myLogger->logme('error', "========================================"); + $this->myLogger->logme('error', "WIPE DEMO CLIENT FUNCTION STARTED"); + $this->myLogger->logme('error', "========================================"); + + $this->myLogger->logme('error', "Request Payload: " . json_encode($this->request->getPost() ?? [])); + $client_id = $this->request->getPost('client_id'); + + if (empty($client_id)) { + $this->myLogger->logme('error', "ERROR: Client ID is required"); + return $this->respond(['status' => false, 'message' => 'Client id required'], 404); + } + + $this->myLogger->logme('error', "Client ID to wipe: " . $client_id); + $this->myLogger->logme('error', "----------------------------------------"); + + // ======================================== + // 1. CLIENT MODEL DELETION + // ======================================== + $this->myLogger->logme('error', "1. PROCESSING CLIENT MODEL"); + $client_data = $this->clientModel->where('id', $client_id)->where('is_active', 1)->first(); + $this->myLogger->logme('error', " Found Client Data: " . json_encode($client_data ?? [])); + + if (!empty($client_data)) { + $is_deleted = $this->clientModel->where('id', $client_id)->delete(); + if ($is_deleted) { + $this->myLogger->logme('error', " ✓ Client data removed successfully"); + } else { + $this->myLogger->logme('error', " ✗ Failed to delete client record"); + } + } else { + $this->myLogger->logme('error', " ✗ Client not found or inactive"); + return $this->respond(['status' => false, 'message' => 'Client not found'], 404); + } + $this->myLogger->logme('error', "----------------------------------------"); + + // ======================================== + // 2. CLIENT RM MODEL DELETION + // ======================================== + $this->myLogger->logme('error', "2. PROCESSING CLIENT RM MODEL"); + $client_rm_data = $this->clientRMModel->where('client_id', $client_id)->first(); + $this->myLogger->logme('error', " Found Client RM Data: " . json_encode($client_rm_data ?? [])); + + if (!empty($client_rm_data)) { + $is_deleted = $this->clientRMModel->where('client_id', $client_id)->delete(); + if ($is_deleted) { + $this->myLogger->logme('error', " ✓ Client RM data removed successfully"); + } else { + $this->myLogger->logme('error', " ✗ Failed to delete Client RM record"); + } + } else { + $this->myLogger->logme('error', " ℹ No Client RM data found"); + } + $this->myLogger->logme('error', "----------------------------------------"); + + // ======================================== + // 3. CLIENT KYC DOCS MODEL DELETION + // ======================================== + $this->myLogger->logme('error', "3. PROCESSING CLIENT KYC DOCS MODEL"); + $client_kyc_data = $this->clientKYCDocsModel->where('client_id', $client_id)->findAll(); + $this->myLogger->logme('error', " Found Client KYC Records: " . count($client_kyc_data ?? [])); + $this->myLogger->logme('error', " Client KYC Data: " . json_encode($client_kyc_data ?? [])); + + if (!empty($client_kyc_data)) { + $is_deleted = $this->clientKYCDocsModel->where('client_id', $client_id)->delete(); + if ($is_deleted) { + $this->myLogger->logme('error', " ✓ Client KYC Docs data removed successfully"); + } else { + $this->myLogger->logme('error', " ✗ Failed to delete Client KYC Docs records"); + } + } else { + $this->myLogger->logme('error', " ℹ No Client KYC Docs data found"); + } + $this->myLogger->logme('error', "----------------------------------------"); + + // ======================================== + // 4. CLIENT BRANCH MODEL DELETION + // ======================================== + $this->myLogger->logme('error', "4. PROCESSING CLIENT BRANCH MODEL"); + $client_branch_data = $this->clientBranchModel->where('client_id', $client_id)->findAll(); + $branch_ids = array_column($client_branch_data, 'id') ?? []; + $this->myLogger->logme('error', " Found Client Branch Records: " . count($client_branch_data ?? [])); + $this->myLogger->logme('error', " Branch IDs: " . json_encode($branch_ids)); + $this->myLogger->logme('error', " Client Branch Data: " . json_encode($client_branch_data ?? [])); + + if (!empty($client_branch_data)) { + $is_deleted = $this->clientBranchModel->where('client_id', $client_id)->delete(); + if ($is_deleted) { + $this->myLogger->logme('error', " ✓ Client Branch data removed successfully"); + + // Delete related Level Contact data + if (!empty($branch_ids)) { + $this->myLogger->logme('error', " 4a. PROCESSING RELATED LEVEL CONTACT DATA"); + $level_contact_data = $this->levelContactModel->where('contact_type', 'client')->whereIn('ref_id', $branch_ids)->findAll(); + $this->myLogger->logme('error', " Found Level Contact Records: " . count($level_contact_data ?? [])); + $this->myLogger->logme('error', " Level Contact Data: " . json_encode($level_contact_data ?? [])); + + $is_deleted = $this->levelContactModel->where('contact_type', 'client')->whereIn('ref_id', $branch_ids)->delete(); + if ($is_deleted) { + $this->myLogger->logme('error', " ✓ Level Contact data removed successfully"); + } else { + $this->myLogger->logme('error', " ✗ Failed to delete Level Contact records"); + } + } else { + $this->myLogger->logme('error', " ℹ No Branch IDs available for Level Contact deletion"); + } + } else { + $this->myLogger->logme('error', " ✗ Failed to delete Client Branch records"); + } + } else { + $this->myLogger->logme('error', " ℹ No Client Branch data found"); + } + $this->myLogger->logme('error', "----------------------------------------"); + + // ======================================== + // 5. CLIENT POLICY MODEL DELETION + // ======================================== + $this->myLogger->logme('error', "5. PROCESSING CLIENT POLICY MODEL"); + $client_policy_data = $this->clientPolicyModel->where('client_id', $client_id)->findAll(); + $policy_ids = array_column($client_policy_data, 'id') ?? []; + $this->myLogger->logme('error', " Found Client Policy Records: " . count($client_policy_data ?? [])); + $this->myLogger->logme('error', " Policy IDs: " . json_encode($policy_ids)); + $this->myLogger->logme('error', " Client Policy Data: " . json_encode($client_policy_data ?? [])); + + if (!empty($client_policy_data)) { + $is_deleted = $this->clientPolicyModel->where('client_id', $client_id)->delete(); + if ($is_deleted) { + $this->myLogger->logme('error', " ✓ Client Policy data removed successfully"); + + // Delete related Employee Policy data + if (!empty($policy_ids)) { + $this->myLogger->logme('error', " 5a. PROCESSING RELATED EMPLOYEE POLICY DATA"); + $employee_policy_data = $this->employeePolicyModel->whereIn('client_policy_id', $policy_ids)->findAll(); + $this->myLogger->logme('error', " Found Employee Policy Records: " . count($employee_policy_data ?? [])); + + $is_deleted = $this->employeePolicyModel->whereIn('client_policy_id', $policy_ids)->delete(); + if ($is_deleted) { + $this->myLogger->logme('error', " ✓ Employee Policy data removed successfully"); + } else { + $this->myLogger->logme('error', " ✗ Failed to delete Employee Policy records"); + } + } else { + $this->myLogger->logme('error', " ℹ No Policy IDs available for Employee Policy deletion"); + } + } else { + $this->myLogger->logme('error', " ✗ Failed to delete Client Policy records"); + } + } else { + $this->myLogger->logme('error', " ℹ No Client Policy data found"); + } + $this->myLogger->logme('error', "----------------------------------------"); + + // ======================================== + // 6. EMPLOYEE MODEL DELETION + // ======================================== + $this->myLogger->logme('error', "6. PROCESSING EMPLOYEE MODEL"); + $employee_data = $this->employeeModel->where('client_id', $client_id)->findAll(); + $this->myLogger->logme('error', " Found Employee Records: " . count($employee_data ?? [])); + + if (!empty($employee_data)) { + $is_deleted = $this->employeeModel->where('client_id', $client_id)->delete(); + if ($is_deleted) { + $this->myLogger->logme('error', " ✓ Employee data removed successfully"); + } else { + $this->myLogger->logme('error', " ✗ Failed to delete Employee records"); + } + } else { + $this->myLogger->logme('error', " ℹ No Employee data found"); + } + $this->myLogger->logme('error', "----------------------------------------"); + + // ======================================== + // 7. CLIENT DEPOSIT MODEL DELETION + // ======================================== + $this->myLogger->logme('error', "7. PROCESSING CLIENT DEPOSIT MODEL"); + $client_deposit_data = $this->clientDepositModel->where('client_id', $client_id)->findAll(); + $this->myLogger->logme('error', " Found Client Deposit Records: " . count($client_deposit_data ?? [])); + $this->myLogger->logme('error', " Client Deposit Data: " . json_encode($client_deposit_data ?? [])); + + if (!empty($client_deposit_data)) { + $is_deleted = $this->clientDepositModel->where('client_id', $client_id)->delete(); + if ($is_deleted) { + $this->myLogger->logme('error', " ✓ Client Deposit data removed successfully"); + } else { + $this->myLogger->logme('error', " ✗ Failed to delete Client Deposit records"); + } + } else { + $this->myLogger->logme('error', " ℹ No Client Deposit data found"); + } + $this->myLogger->logme('error', "----------------------------------------"); + + // ======================================== + // 8. POLICY PREMIUM 1 MODEL DELETION + // ======================================== + $this->myLogger->logme('error', "8. PROCESSING POLICY PREMIUM 1 MODEL"); + $policy_premium1_data = $this->policyPremium1Model->where('client_id', $client_id)->findAll(); + $this->myLogger->logme('error', " Found Policy Premium 1 Records: " . count($policy_premium1_data ?? [])); + + if (!empty($policy_premium1_data)) { + $is_deleted = $this->policyPremium1Model->where('client_id', $client_id)->delete(); + if ($is_deleted) { + $this->myLogger->logme('error', " ✓ Policy Premium 1 data removed successfully"); + } else { + $this->myLogger->logme('error', " ✗ Failed to delete Policy Premium 1 records"); + } + } else { + $this->myLogger->logme('error', " ℹ No Policy Premium 1 data found"); + } + $this->myLogger->logme('error', "----------------------------------------"); + + // ======================================== + // 9. POLICY PREMIUM 2 MODEL DELETION + // ======================================== + $this->myLogger->logme('error', "9. PROCESSING POLICY PREMIUM 2 MODEL"); + $policy_premium2_data = $this->policyPremium2Model->where('client_id', $client_id)->findAll(); + $this->myLogger->logme('error', " Found Policy Premium 2 Records: " . count($policy_premium2_data ?? [])); + + if (!empty($policy_premium2_data)) { + $is_deleted = $this->policyPremium2Model->where('client_id', $client_id)->delete(); + if ($is_deleted) { + $this->myLogger->logme('error', " ✓ Policy Premium 2 data removed successfully"); + } else { + $this->myLogger->logme('error', " ✗ Failed to delete Policy Premium 2 records"); + } + } else { + $this->myLogger->logme('error', " ℹ No Policy Premium 2 data found"); + } + $this->myLogger->logme('error', "----------------------------------------"); + + // ======================================== + // 10. NOTIFICATION MODEL DELETION + // ======================================== + $this->myLogger->logme('error', "10. PROCESSING NOTIFICATION MODEL"); + $notification_data = $this->notificationModel->where('client_id', $client_id)->findAll(); + $this->myLogger->logme('error', " Found Notification Records: " . count($notification_data ?? [])); + $this->myLogger->logme('error', " Notification Data: " . json_encode($notification_data ?? [])); + + if (!empty($notification_data)) { + $is_deleted = $this->notificationModel->where('client_id', $client_id)->delete(); + if ($is_deleted) { + $this->myLogger->logme('error', " ✓ Notification data removed successfully"); + } else { + $this->myLogger->logme('error', " ✗ Failed to delete Notification records"); + } + } else { + $this->myLogger->logme('error', " ℹ No Notification data found"); + } + $this->myLogger->logme('error', "----------------------------------------"); + + // ======================================== + // 11. CD MASTER MODEL DELETION + // ======================================== + $this->myLogger->logme('error', "11. PROCESSING CD MASTER MODEL"); + $cd_master_data = $this->CDMasterModel->where('client_id', $client_id)->findAll(); + $this->myLogger->logme('error', " Found CD Master Records: " . count($cd_master_data ?? [])); + $this->myLogger->logme('error', " CD Master Data: " . json_encode($cd_master_data ?? [])); + + if (!empty($cd_master_data)) { + $is_deleted = $this->CDMasterModel->where('client_id', $client_id)->delete(); + if ($is_deleted) { + $this->myLogger->logme('error', " ✓ CD Master data removed successfully"); + } else { + $this->myLogger->logme('error', " ✗ Failed to delete CD Master records"); + } + } else { + $this->myLogger->logme('error', " ℹ No CD Master data found"); + } + $this->myLogger->logme('error', "----------------------------------------"); + + // ======================================== + // 12. POLICY TRANSACTION MODEL DELETION + // ======================================== + $this->myLogger->logme('error', "12. PROCESSING POLICY TRANSACTION MODEL"); + $policy_transaction_data = $this->policyTransactionModel->where('client_id', $client_id)->findAll(); + $pt_ids = array_column($policy_transaction_data, 'id') ?? []; + $this->myLogger->logme('error', " Found Policy Transaction Records: " . count($policy_transaction_data ?? [])); + $this->myLogger->logme('error', " Policy Transaction IDs: " . json_encode($pt_ids)); + $this->myLogger->logme('error', " Policy Transaction Data: " . json_encode($policy_transaction_data ?? [])); + + if (!empty($policy_transaction_data)) { + $is_deleted = $this->policyTransactionModel->where('client_id', $client_id)->delete(); + if ($is_deleted) { + $this->myLogger->logme('error', " ✓ Policy Transaction data removed successfully"); + + // Delete related PT CO Share data + if (!empty($pt_ids)) { + $this->myLogger->logme('error', " 12a. PROCESSING RELATED PT CO SHARE DATA"); + $pt_co_share_data = $this->PTCOShareDetailsModel->whereIn('pt_id', $pt_ids)->findAll(); + $this->myLogger->logme('error', " Found PT CO Share Records: " . count($pt_co_share_data ?? [])); + $this->myLogger->logme('error', " PT CO Share Data: " . json_encode($pt_co_share_data ?? [])); + + $is_deleted = $this->PTCOShareDetailsModel->whereIn('pt_id', $pt_ids)->delete(); + if ($is_deleted) { + $this->myLogger->logme('error', " ✓ PT CO Share data removed successfully"); + } else { + $this->myLogger->logme('error', " ✗ Failed to delete PT CO Share records"); + } + } else { + $this->myLogger->logme('error', " ℹ No Policy Transaction IDs available for PT CO Share deletion"); + } + } else { + $this->myLogger->logme('error', " ✗ Failed to delete Policy Transaction records"); + } + } else { + $this->myLogger->logme('error', " ℹ No Policy Transaction data found"); + } + + $this->myLogger->logme('error', "========================================"); + $this->myLogger->logme('error', "WIPE DEMO CLIENT FUNCTION COMPLETED"); + $this->myLogger->logme('error', "Client ID: " . $client_id . " - Successfully processed"); + $this->myLogger->logme('error', "========================================"); + + return $this->respond(['status' => true, 'message' => 'Demo client data wiped successfully'], 200); + } } diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 512122c6..97a71e4c 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -302,8 +302,9 @@ class EmployeeController extends AdminController //for TPA/insurer upload $data['events'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement']; //for inception upload - $data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrolment']; - + $data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement']; + // $data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrolment']; + $data['import_or_export'] = ['import' => 'Import', 'export' => 'Export']; $data['insurer_or_tpa'] = ['insurer' => 'Insurer', 'tpa' => 'TPA']; diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index 938c9099..2cc47520 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -1319,6 +1319,7 @@ class EmployeeServiceController extends AdminController //get file name $file_id = $params['file_id']; $file = $this->fileModel->find($file_id); + // dd($file); $file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name']; @@ -1330,6 +1331,7 @@ class EmployeeServiceController extends AdminController $excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']); // $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); + // dd($excel_data); unset($excel_data[0]); // kint::dump($excel_data); $endorsement_data = []; @@ -1379,10 +1381,14 @@ class EmployeeServiceController extends AdminController ->where('employee_polices.client_policy_id',$file['policy_id']) ->where('employees.emp_status !=','truncated') ->where('employees.is_active', 1) + ->where('employee_polices.status !=','truncated') + ->where('employee_polices.is_active', 1) ->first(); // $employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->first(); // dd($employee); + // kint::dump($employee); + if(is_array($employee) && count($employee)) { // dd($employee); @@ -1406,7 +1412,13 @@ class EmployeeServiceController extends AdminController if(!in_array($employee['id'],$endorsement_data))//make entry in endorsement firsttime only with checking that PK of emp exisintg in variable $endorsement_data { - $employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first(); + $employee_policy = $this->employeePolicyModel + ->where('employee_id',$employee['id']) + ->where('client_policy_id',$file['policy_id']) + ->where('status !=','truncated') + ->where('is_active', 1) + ->first(); + $data = ['emp_id' => $employee['id'],'name' => $employee['name'],'emp_status' => $employee['emp_status'],'emp_policy_id' => $employee_policy['id'],'emp_code' => $employee['emp_code'],'change_event' => $employee['change_event'],'date_of_exit' => $employee_policy['date_of_exit'],'reason_for_exit' => $employee_policy['reason_for_exit'],'status' => $employee_policy['status'],'claim_status' => $employee_policy['claim_status']]; $endorsement($data,$file,$row); $endorsement_data[] = $employee['id']; @@ -1447,7 +1459,7 @@ class EmployeeServiceController extends AdminController //set success msg to pull notifications $this->setPullNotification($this->getFileMetaDataByFileId($file_id,'success')); - return $endorsement_data; + return $endorsement_data; } diff --git a/app/Helpers/excel_import_export_helper.php b/app/Helpers/excel_import_export_helper.php index ad484ffe..9c72c973 100755 --- a/app/Helpers/excel_import_export_helper.php +++ b/app/Helpers/excel_import_export_helper.php @@ -664,12 +664,18 @@ if(!function_exists('generate_insurer_based_excel')){ $rowData = []; foreach ($excel_header_array as $header) { + $fieldName = $header['db_column_name']; + $defaultValue = isset($header['default_value']) ? $header['default_value'] : null; if ($fieldName === 'index') { $value = $serialNumber; } else { - $value = $row->$fieldName ?? ''; + if(empty($fieldName) && !empty($defaultValue)){ + $value = $defaultValue; + }else{ + $value = $row->$fieldName ?? ''; + } } $rowData[] = $value; diff --git a/app/Models/ClientModel.php b/app/Models/ClientModel.php index a09f75f1..e1407c2c 100755 --- a/app/Models/ClientModel.php +++ b/app/Models/ClientModel.php @@ -40,6 +40,7 @@ class ClientModel extends Model "reply_to", "mail_domain", "addon_subheading", + "parent_client_id", ]; diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index ec4b9222..e6b02543 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -1085,10 +1085,10 @@ class EmployeePolicyModel extends Model } $status_condition = "{$insurer_or_tpa}" === 'tpa' - ? "employee_polices.status = 'inactive' AND employees.emp_status = 'active'" + ? "employee_polices.status = 'active' AND employees.emp_status = 'active'" : "employee_polices.status = 'active' AND employees.emp_status = 'active'"; - $endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NOT NULL OR a.endorsement_id != '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')"; + $endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')"; $query = $this->db->query(" SELECT DISTINCT diff --git a/app/Views/UserList.php b/app/Views/UserList.php index be654b8d..b7de1d73 100755 --- a/app/Views/UserList.php +++ b/app/Views/UserList.php @@ -1,4 +1,4 @@ - --> + + +
@@ -96,7 +286,7 @@ table.dataTable tbody td { -
-
- +
+ @@ -198,6 +218,7 @@ + @@ -237,8 +258,7 @@ - \ No newline at end of file diff --git a/app/Views/insurer_basic_info.php b/app/Views/insurer_basic_info.php index 524f2604..88628771 100755 --- a/app/Views/insurer_basic_info.php +++ b/app/Views/insurer_basic_info.php @@ -89,7 +89,7 @@ input:checked + .slider:before { > - +
diff --git a/app/Views/insurer_export_templete.php b/app/Views/insurer_export_templete.php index 1ef280c2..5a1b93ce 100755 --- a/app/Views/insurer_export_templete.php +++ b/app/Views/insurer_export_templete.php @@ -80,7 +80,7 @@
- + @@ -92,7 +92,7 @@ - +
Insurer Policy S.NO Policy Type Event TypeImport/ExportUpload/Download Template Action
-
+ -
+