From d39b2ca2d3d7472cc1850712baba22cc0b80efdd Mon Sep 17 00:00:00 2001 From: velz Date: Mon, 11 Aug 2025 15:13:49 +0530 Subject: [PATCH 01/18] FIX_CHATBOT --- .../Chatbot/EcardDownloadConversation.php | 16 +- app/Views/chatbot.php | 160 ++++++++++++------ 2 files changed, 123 insertions(+), 53 deletions(-) diff --git a/app/Controllers/Chatbot/EcardDownloadConversation.php b/app/Controllers/Chatbot/EcardDownloadConversation.php index 1f303c13..a0a644a0 100644 --- a/app/Controllers/Chatbot/EcardDownloadConversation.php +++ b/app/Controllers/Chatbot/EcardDownloadConversation.php @@ -10,8 +10,11 @@ use App\Helpers\ChatbotHelper; class EcardDownloadConversation extends Conversation { + protected $buttonsData = []; public function run() { + $this->bot->types(); + sleep(0.5); $this->showEcardMenu(); } @@ -22,6 +25,7 @@ class EcardDownloadConversation extends Conversation $chat_session_info = get_chatbot_session_info(); $policy_list = ChatbotHelper::getListOfPolicies($chat_session_info); $buttons = []; + $question = 'Choose Policy to Download Ecard:'; // log_message('error', ('policy_list : ' . json_encode($policy_list))); @@ -34,20 +38,24 @@ class EcardDownloadConversation extends Conversation // Button::create("🔹 $policy['policy_name']")->value("$policy['emp_policy_id']"), // Button::create("◀️ Go Back")->value("go_back"), // ]); - $buttons[] = Button::create("🔹 {$policy['policy_name']}")->value($policy['emp_policy_id'].'#'.$policy['rand_string']); + $this->buttonsData[$policy['emp_policy_id'].'#'.$policy['rand_string']] = ['response_text' => "🔹 {$policy['policy_name']}"] ; + $buttons[] = Button::create("{$policy['policy_name']}")->value($policy['emp_policy_id'].'#'.$policy['rand_string']); } } else { $question = 'No policy found'; } + $this->buttonsData['go_back'] = ['response_text' => '◀️ Go Back'] ; $buttons = array_merge($buttons,[Button::create("◀️ Go Back")->value("go_back")]); $question = Question::create($question) ->addButtons($buttons); - - $this->bot->ask($question, function ($answer) { + $temp = $this->buttonsData; + $this->bot->ask($question, function ($answer) use ($temp) { + log_message('error', 'showEcardMenu answer received'); + log_message('error', ($answer)); $selectedOption = $answer->getText(); - $this->say("You have selected {$selectedOption}"); + $this->say("You have selected {$temp[$selectedOption]['response_text']}"); switch ($answer->getValue()) { case "go_back": $this->bot->startConversation(new MainMenuConversation()); diff --git a/app/Views/chatbot.php b/app/Views/chatbot.php index b6e09688..39bb88c4 100644 --- a/app/Views/chatbot.php +++ b/app/Views/chatbot.php @@ -2,7 +2,7 @@ - + Insurance ChatBot @@ -12,8 +12,8 @@ margin: 0; } - body { - background-color: rgba(0, 0, 0, 0.3); /* 30% transparent black */ + /* body { + background-color: rgba(0, 0, 0, 0.3); display: flex; justify-content: center; align-items: center; @@ -31,15 +31,72 @@ 50% { color: green; } 75% { color: blue; } 100% { color: violet; } - } + }*/ + + + + -

Loading...

- - + + +
+
+ + Loading... + +
+
+ + + + + + \ No newline at end of file From 080d5fbea75aa53c32a3fe233b22395c42672c14 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Mon, 11 Aug 2025 18:31:18 +0530 Subject: [PATCH 02/18] CHANGE_CLAIMS_PAGE_LIST_IN_SAME_PAGE - VADIVEL J 2025-08-11 --- app/Views/ticket_search.php | 88 ++++++++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) diff --git a/app/Views/ticket_search.php b/app/Views/ticket_search.php index 1efb07c1..7594a910 100644 --- a/app/Views/ticket_search.php +++ b/app/Views/ticket_search.php @@ -125,7 +125,7 @@ @@ -204,11 +204,15 @@ function fetchTicketListData() { tpa_id: tpa_id, }; + let filterData = requestData; + localStorage.setItem('filterData', JSON.stringify(filterData)); + console.log("requestData", requestData); var url = ''; $('.loader').fadeIn(); $('.loader-mask').fadeIn(); + sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) { console.log('Filter Responce', response); @@ -234,6 +238,88 @@ function fetchTicketListData() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); }); + + } + + + + + \ No newline at end of file From 290f93615ef2585f2edff5854de637690cc49028 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 13 Aug 2025 13:56:04 +0530 Subject: [PATCH 03/18] CHANGE_LEAD_AND_RFQ_EB_CHANGES : RV --- app/Config/Routes.php | 1 + app/Controllers/LeadsController.php | 178 ++++++++++++++++++++++++-- app/Models/PolicyTransactionModel.php | 114 ++++++++++++----- app/Views/rfq/gpa.php | 4 +- 4 files changed, 247 insertions(+), 50 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index b26c46c4..0e9afd4a 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -578,6 +578,7 @@ $routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) { $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) { $routes->match( ['get', 'post'], 'list','TicketController::ticketList'); $routes->get('feedback-list','TicketController::feedbackList'); + $routes->match(['get', 'post'], 'claim-upload','TicketController::claimDumpUpload'); $routes->get('remove','TicketController::removeTicket'); $routes->get('new/(:any)','TicketController::ticket_form/$1'); $routes->post('create','TicketController::createTicket'); diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index b1db3311..9d7a4b2f 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -961,7 +961,7 @@ class LeadsController extends BaseController } - private function reorderProposalsByInsurerTotal(array $data): array + public function reorderProposalsByInsurerTotal(array $data): array { if (!isset($data['premium_data']['data'])) return $data; @@ -973,7 +973,7 @@ class LeadsController extends BaseController foreach ($original as $key => $value) { // Match only keys that look like 'Proposal X' - if (preg_match('/^(Proposal\s+\d+|Existing Renewal|Existing Rollover)$/', $key)) { + if (preg_match('/^(Proposal\s+\d+|Existing Renewal|Existing Rollover)$/', $key)) { // Get the insurer entry (not 'Quote Asked') foreach ($value as $subKey => $subVal) { if ($subKey !== 'Quote Asked' && isset($subVal['Total'])) { @@ -994,6 +994,18 @@ class LeadsController extends BaseController } } + foreach ($proposals as $proposalKey => &$proposal) { + $quoteAsked = $proposal['Quote Asked']; // Keep Quote Asked separately + unset($proposal['Quote Asked']); + + uasort($proposal, function ($a, $b) { + return $a['Total'] <=> $b['Total']; // Ascending by Total + }); + + // Add Quote Asked back at the top + $proposal = array_merge(['Quote Asked' => $quoteAsked], $proposal); + } + // Sort proposals by their insurer's total uasort($proposals, function ($a, $b) { $totalA = 0; @@ -1028,9 +1040,48 @@ class LeadsController extends BaseController return $data; } + $porposalData = $data['premium_data']['data']; $premiumProposals = array_keys($data['premium_data']['data']); $filteredProposals = []; + //Reorder the Insurer based on the Premium data insurer + foreach ($porposalData as $key => $value) { + + if(in_array($key, ['Particulars', ""])){ + continue; + } + + // Ensure the premium data is an array and not empty + if (!is_array($value) || empty($value)) { + continue; + } + + // Step 1: Get the premium display_name order (excluding "Quote Asked") + $premiumOrder = array_keys(array_diff_key($value, ["Quote Asked" => ""])); + + // Skip if no valid order found + if (empty($premiumOrder)) { + continue; + } + + // usort($data['proposal_data']['over_all_column_data'][$key]['insurers'], function($a, $b) use ($premiumOrder) { + // return array_search($a['display_name'], $premiumOrder) - array_search($b['display_name'], $premiumOrder); + // }); + + // Step 2: Reorder proposal insurers based on premium order + usort($data['proposal_data']['over_all_column_data'][$key]['insurers'], function($a, $b) use ($premiumOrder) { + $posA = array_search($a['display_name'] ?? '', $premiumOrder); + $posB = array_search($b['display_name'] ?? '', $premiumOrder); + + // If not found, push to the end + $posA = $posA === false ? PHP_INT_MAX : $posA; + $posB = $posB === false ? PHP_INT_MAX : $posB; + + return $posA - $posB; + }); + + } + // Collect proposal keys that match the pattern "Proposal X" foreach ($premiumProposals as $key) { if (preg_match('/^(Proposal\s+\d+|Existing Renewal|Existing Rollover)$/', $key) && isset($data['proposal_data']['over_all_column_data'][$key])) { @@ -1068,6 +1119,32 @@ class LeadsController extends BaseController } } + //Reorder the SubHeader of the Proposel + foreach ($sortedProposalOrder as $proposalKey => $proposalData) { + // Skip if insurers or subHeaders are missing + if ( + !isset($proposalData['insurers']) || + !is_array($proposalData['insurers']) || + !isset($proposalHeaders[$proposalKey]['subHeaders']) || + !is_array($proposalHeaders[$proposalKey]['subHeaders']) + ) { + continue; + } + + // Keep "Quote Asked" fixed at index 0 + $newSubHeaders = ["Quote Asked"]; + + // Add insurers in the sorted order + foreach ($proposalData['insurers'] as $insurer) { + if(in_array($insurer['display_name'], $proposalHeaders[$proposalKey]['subHeaders'])){ + $newSubHeaders[] = $insurer['display_name']; + } + } + + // Replace the subHeaders in the header array + $proposalHeaders[$proposalKey]['subHeaders'] = $newSubHeaders; + } + // dd($staticHeaders, $proposalHeaders, $sortedProposalOrder); // Step 2: Reorder headers @@ -1088,10 +1165,9 @@ class LeadsController extends BaseController } unset($value); - + //merge the all headers $reorderedHeaders = array_merge($staticHeaders, $reorderedHeaders, $actionHeader); - - + // Step 3: Reorder each row's `data` by matching parentth foreach ($dataRows as $dataRowIndex => &$row) { $staticData = []; @@ -1137,6 +1213,12 @@ class LeadsController extends BaseController } unset($value); + //Reorder the Row Data based on the Insurer + $reorderedProposalData = $this->reorderProposalRowData($reorderedProposalData, $proposalHeaders); + + + // print_rr($reorderedProposalData); die; + $row['data'] = array_merge($staticData, $reorderedProposalData, $actionData); } @@ -1151,6 +1233,45 @@ class LeadsController extends BaseController return $data; } + private function reorderProposalRowData(array $proposalRowData, array $proposalHeaderData): array + { + $newRowData = []; + + // Group rows by parentth + $groupedRows = []; + foreach ($proposalRowData as $row) { + if (!isset($row['parentth'])) { + continue; // skip invalid rows + } + $groupedRows[$row['parentth']][] = $row; + } + + // Reorder each group's rows based on header subHeaders + foreach ($proposalHeaderData as $proposalKey => $headerInfo) { + if ( + !isset($groupedRows[$proposalKey]) || + !isset($headerInfo['subHeaders']) || + !is_array($headerInfo['subHeaders']) + ) { + continue; + } + + $order = $headerInfo['subHeaders']; + $rows = $groupedRows[$proposalKey]; + + // Sort whole rows according to subth position in $order + usort($rows, function ($a, $b) use ($order) { + return array_search($a['subth'], $order) - array_search($b['subth'], $order); + }); + + // Append sorted rows to final array + $newRowData = array_merge($newRowData, $rows); + } + + return $newRowData; + } + + private function renumberProposalKeys(array $input): array { $result = []; @@ -1284,7 +1405,7 @@ class LeadsController extends BaseController $lead_data = [ 'Insured' => $rfq_data['client_name'], 'No of Employees at Inception' => $rfq_data['incept_emp_count'], - 'Total Sum Insured at Inception ' => $rfq_data['total_si_at_incept'], + // 'Total Sum Insured at Inception ' => $rfq_data['total_si_at_incept'], 'Policy Period' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d-m-Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d-m-Y', strtotime($rfq_data['policy_end_date'])) : "To be decided", // 'Insurer' => $rfq_data['insurer_name'] ?? " - ", // 'TPA' => $rfq_data['tpa_name'] ?? " - ", @@ -1455,7 +1576,20 @@ class LeadsController extends BaseController ], ], ]); - $subheader_count = array_sum(array_map(fn($header) => count($header['subHeaders']), $data['table_data']['headers'])); + + if($type == 2){ + $subheader_count = array_sum( + array_map( + fn($header) => count(array_filter( + $header['subHeaders'], + fn($sub) => $sub !== "Quote Asked" + )), + $data['table_data']['headers'] + ) + ); + }else{ + $subheader_count = array_sum(array_map(fn($header) => count($header['subHeaders']), $data['table_data']['headers'])); + } if ($is_placement == false) { $subheader_count = $subheader_count - 2; @@ -1525,7 +1659,15 @@ class LeadsController extends BaseController } $startColumn = $columnLetter; // Start of the current header range - $subHeaderCount = count($header['subHeaders']); // Number of subheaders for this parent header + if($type == 2){ + $subHeaderCount = count(array_filter($header['subHeaders'], function($subHeader) { + return $subHeader !== "Quote Asked"; + })); + }else{ + $subHeaderCount = count($header['subHeaders']); // Number of subheaders for this parent header + } + + // Set parent header value if ($is_placement == true && !in_array($header['parentHeader'], ['Particulars', 'S.No.'])) { $sheet->setCellValue("{$startColumn}{$rowNumber}", "Terms"); @@ -1558,6 +1700,10 @@ class LeadsController extends BaseController // Add subheaders foreach ($header['subHeaders'] as $subHeader) { + if($type == 2 && in_array($subHeader, ['Quote Asked'])){ + continue; + } + if ($type == 2 && $is_placement == false) { $sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader); } @@ -1625,6 +1771,10 @@ class LeadsController extends BaseController continue; } + if($type == 2 && in_array($cellData['subth'], ['Quote Asked'])){ + continue; + } + if ($cellData['parentth'] == 'Sno') { $sheet->setCellValue("{$columnLetter}{$rowNumber}", $serial_no); } else { @@ -1651,7 +1801,7 @@ class LeadsController extends BaseController //premium data if ($type == 2) { - if($is_placement == true){$columnLetterForPremium = "B";}else{$columnLetterForPremium = "C";} + if($is_placement == true){$columnLetterForPremium = "B";}else{$columnLetterForPremium = "B";} $rowNumber += 2; // Add premium data @@ -1665,20 +1815,20 @@ class LeadsController extends BaseController // $gstAmt = [$labelArray[1]]; // $total = [$labelArray[2]]; - if($is_placement == true){ + // if($is_placement == true){ $premium[] = $labelArray[0]; $gstAmt[] = $labelArray[1]; $total[] = $labelArray[2]; - } + // } foreach ($premiumData as $proposal => $insurers) { if ($proposal != 'Particulars') { foreach ($insurers as $insurer => $values) { if($insurer == 'Quote Asked'){ - $premium[] = count($insurers ?? []) > 1 ? $labelArray[0] : ""; + // $premium[] = count($insurers ?? []) > 1 ? $labelArray[0] : ""; // $gst[] = ""; - $gstAmt[] = count($insurers ?? []) > 1 ? $labelArray[1] : ""; - $total[] = count($insurers ?? []) > 1 ? $labelArray[2] : ""; + // $gstAmt[] = count($insurers ?? []) > 1 ? $labelArray[1] : ""; + // $total[] = count($insurers ?? []) > 1 ? $labelArray[2] : ""; }else{ $premium[] = formatIndianCurrency($values[$labelArray[0]]); // $gst[] = $values[$labelArray[1]]; diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php index ba9b2fcd..c1249a7d 100644 --- a/app/Models/PolicyTransactionModel.php +++ b/app/Models/PolicyTransactionModel.php @@ -767,11 +767,17 @@ class PolicyTransactionModel extends Model ) AS unbilled_amt, created_user.first_name as user_name, CASE - WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no` - WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no` - ELSE `policy_transaction`.`policy_no` -- Default fallback - END AS `policy_no` - + WHEN pt_co_share_details.co_share_type IN (0, 1) + THEN policy_transaction.policy_no + WHEN pt_co_share_details.co_share_type > 1 + THEN CASE + WHEN pt_co_share_details.follower_policy_no IS NULL + OR pt_co_share_details.follower_policy_no = '' + THEN policy_transaction.policy_no + ELSE pt_co_share_details.follower_policy_no + END + ELSE policy_transaction.policy_no + END AS policy_no ") ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left') // ->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left') @@ -993,10 +999,17 @@ class PolicyTransactionModel extends Model DATE_FORMAT(policy_transaction.created_at, '%d %b %Y %h:%i %p') AS created_at, user_profiles.first_name as user_name, CASE - WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no` - WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no` - ELSE `policy_transaction`.`policy_no` -- Default fallback - END AS `policy_no` + WHEN pt_co_share_details.co_share_type IN (0, 1) + THEN policy_transaction.policy_no + WHEN pt_co_share_details.co_share_type > 1 + THEN CASE + WHEN pt_co_share_details.follower_policy_no IS NULL + OR pt_co_share_details.follower_policy_no = '' + THEN policy_transaction.policy_no + ELSE pt_co_share_details.follower_policy_no + END + ELSE policy_transaction.policy_no + END AS policy_no ") ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left') ->join('clients', 'clients.id = policy_transaction.client_id', 'left') @@ -1068,7 +1081,7 @@ class PolicyTransactionModel extends Model { // dd($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status); $builder = $this->db->table('policy_transaction') - ->select(' + ->select(" policy_transaction.*, clients.short_name as client_short_name, clients.client_code, @@ -1077,11 +1090,18 @@ class PolicyTransactionModel extends Model insurers.short_name AS insurer_short_name, policy_type.policy_type , CASE - WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no` - WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no` - ELSE `policy_transaction`.`policy_no` -- Default fallback - END AS `policy_no` - ') + WHEN pt_co_share_details.co_share_type IN (0, 1) + THEN policy_transaction.policy_no + WHEN pt_co_share_details.co_share_type > 1 + THEN CASE + WHEN pt_co_share_details.follower_policy_no IS NULL + OR pt_co_share_details.follower_policy_no = '' + THEN policy_transaction.policy_no + ELSE pt_co_share_details.follower_policy_no + END + ELSE policy_transaction.policy_no + END AS policy_no + ") ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left') ->join('clients', 'policy_transaction.client_id = clients.id', 'left') ->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left') @@ -1245,12 +1265,17 @@ class PolicyTransactionModel extends Model 2 ) AS variance_amt, CASE - WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no` - WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no` - ELSE `policy_transaction`.`policy_no` -- Default fallback - END AS `policy_no` - - + WHEN pt_co_share_details.co_share_type IN (0, 1) + THEN policy_transaction.policy_no + WHEN pt_co_share_details.co_share_type > 1 + THEN CASE + WHEN pt_co_share_details.follower_policy_no IS NULL + OR pt_co_share_details.follower_policy_no = '' + THEN policy_transaction.policy_no + ELSE pt_co_share_details.follower_policy_no + END + ELSE policy_transaction.policy_no + END AS policy_no ") ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left') ->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left') @@ -1348,10 +1373,17 @@ class PolicyTransactionModel extends Model 'pt_co_share_details.tep_amt', 'policy_transaction.status', 'CASE - WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no` - WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no` - ELSE `policy_transaction`.`policy_no` -- Default fallback - END AS `policy_no`' + WHEN pt_co_share_details.co_share_type IN (0, 1) + THEN policy_transaction.policy_no + WHEN pt_co_share_details.co_share_type > 1 + THEN CASE + WHEN pt_co_share_details.follower_policy_no IS NULL + OR pt_co_share_details.follower_policy_no = "" + THEN policy_transaction.policy_no + ELSE pt_co_share_details.follower_policy_no + END + ELSE policy_transaction.policy_no + END AS policy_no' ]) ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left') ->join('clients', 'clients.id = policy_transaction.client_id', 'left') @@ -1443,10 +1475,17 @@ class PolicyTransactionModel extends Model pt_co_share_details.variance, policy_transaction.status, CASE - WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no` - WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no` - ELSE `policy_transaction`.`policy_no` -- Default fallback - END AS `policy_no` + WHEN pt_co_share_details.co_share_type IN (0, 1) + THEN policy_transaction.policy_no + WHEN pt_co_share_details.co_share_type > 1 + THEN CASE + WHEN pt_co_share_details.follower_policy_no IS NULL + OR pt_co_share_details.follower_policy_no = '' + THEN policy_transaction.policy_no + ELSE pt_co_share_details.follower_policy_no + END + ELSE policy_transaction.policy_no + END AS policy_no ") ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left') ->join('clients', 'clients.id = policy_transaction.client_id', 'left') @@ -1554,11 +1593,18 @@ class PolicyTransactionModel extends Model AND inv_payment_details.is_active = 1 ), 2) AS outstanding_amount, - CASE - WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no` - WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no` - ELSE `policy_transaction`.`policy_no` -- Default fallback - END AS `policy_no` + CASE + WHEN pt_co_share_details.co_share_type IN (0, 1) + THEN policy_transaction.policy_no + WHEN pt_co_share_details.co_share_type > 1 + THEN CASE + WHEN pt_co_share_details.follower_policy_no IS NULL + OR pt_co_share_details.follower_policy_no = '' + THEN policy_transaction.policy_no + ELSE pt_co_share_details.follower_policy_no + END + ELSE policy_transaction.policy_no + END AS policy_no ") ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left') ->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left') diff --git a/app/Views/rfq/gpa.php b/app/Views/rfq/gpa.php index f02f24a6..a8cd08fc 100644 --- a/app/Views/rfq/gpa.php +++ b/app/Views/rfq/gpa.php @@ -8,8 +8,8 @@
- - + +
From 2008919454e346cd589f1b66f1547d40c9214c62 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 13 Aug 2025 17:00:27 +0530 Subject: [PATCH 04/18] FEAT_VIEW_DEMOGRAPHY : RV --- app/Controllers/LeadsController.php | 64 +++++++++++++++++++++++++++-- app/Views/view_rfq.php | 36 ++++++++++++++++ 2 files changed, 97 insertions(+), 3 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 9d7a4b2f..2daa6305 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -773,7 +773,7 @@ class LeadsController extends BaseController // dd($data); if ($data['lead_data']['lead_form_type'] == 1) { - + $data['demogrphy_html_data'] = $this->generateDemographyDataTable(['lead_id' => $id]); $this->loadLayout('view_rfq.php', $data); } else if ($data['lead_data']['lead_form_type'] == 2) { @@ -1271,7 +1271,6 @@ class LeadsController extends BaseController return $newRowData; } - private function renumberProposalKeys(array $input): array { $result = []; @@ -2062,7 +2061,7 @@ class LeadsController extends BaseController return true; } - public function calculateMembersDemography($params) + public function calculateMembersDemography($params, $returnType = null) { $lead_id = $params['lead_id']; $lead_data = $this->leadsModel->find($lead_id); @@ -2115,12 +2114,20 @@ class LeadsController extends BaseController $this->myLogger->logme('error', ($message . $file_name_with_path)); return ['status' => 'failed', 'message' => $message]; } + try { $classifiers = $this->getDemographyData($members, $age_band_data, $members_heading, $available_col, $col_index); } catch (Exception $e) { return ['status' => 'fail', 'message' => $e->getMessage()]; } + //for this to view the demography in the RFQ and QCR page to using internal + if($returnType == "internal"){ + return ['data' => $classifiers]; + // print_rr($classifiers); die; + } + + try { $result = $this->generateClassifierSpreadsheet($classifiers, WRITEPATH . 'uploads/lead_files/'); if ($result['success']) { @@ -4818,4 +4825,55 @@ class LeadsController extends BaseController return []; } + + + public function generateDemographyDataTable($param) + { + $returnData = $this->calculateMembersDemography($param, "internal"); + + $html = ""; + + if (isset($returnData['data'])) { + + $data = $returnData['data']; + foreach ($data as $category => $records) { + // Extract all column headers (age groups) dynamically + $allColumns = []; + foreach ($records as $person => $ages) { + $allColumns = array_merge($allColumns, array_keys($ages)); + } + $allColumns = array_unique($allColumns); + $allColumns = array_values($allColumns); // reset index + + $category = ucfirst($category); + + // Start table with clean styling + $html .= "

{$category}

"; + $html .= ""; + + // Table header with light background + $html .= ""; + $html .= ""; + foreach ($allColumns as $col) { + $html .= ""; + } + $html .= ""; + + // Table rows with clean styling + foreach ($records as $relation => $ages) { + $html .= ""; + $html .= ""; + foreach ($allColumns as $col) { + $value = isset($ages[$col]) ? $ages[$col] : "-"; + $html .= ""; + } + $html .= ""; + } + + $html .= "
Relation{$col}
{$relation}{$value}
"; + } + } + + return $html; + } } diff --git a/app/Views/view_rfq.php b/app/Views/view_rfq.php index b6ed108b..f00350cb 100644 --- a/app/Views/view_rfq.php +++ b/app/Views/view_rfq.php @@ -258,6 +258,11 @@ opacity: 1; } + .demographyTable .table th, + .demographyTable .table td { + padding: 4px 4px !important; + } +
@@ -288,6 +293,7 @@ onclick="checkTheTableDataChanged(3)">Send Insurer Mail + @@ -685,6 +691,30 @@
+ + + From 5e7f67f56cd93446e7ae6ae25344086776c41854 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 13 Aug 2025 18:06:29 +0530 Subject: [PATCH 05/18] FIX_RFQ_EXCEL : RV --- app/Controllers/LeadsController.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 2daa6305..4d7e2170 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -44,6 +44,8 @@ use Google\Service\FactCheckTools\Resource\Claims; use GPBMetadata\Google\Type\Datetime; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; +use function PHPSTORM_META\type; + class LeadsController extends BaseController { use ResponseTrait; @@ -1617,7 +1619,8 @@ class LeadsController extends BaseController if ($type == 2) { $subHeaderRow = $rowNumber + 1; } else { - $subHeaderRow = $rowNumber_for_remove_quote_asked; + // $subHeaderRow = $rowNumber_for_remove_quote_asked; + $subHeaderRow = $rowNumber + 1; } $columnLetter = 'A'; @@ -1638,6 +1641,13 @@ class LeadsController extends BaseController if (!in_array($header['parentHeader'], ['Item Key', 'Action', 'Sno', 'Particulars'])) { $header_actual_count++; + + //Quote asked not showed in the QCR excel so some proposel has only one Quote Asked, So that case avoid the proposel name + $subHeaderCount = count($header['subHeaders'] ?? []) ?? 0; + if($subHeaderCount <= 1 && $type == 2 && $is_placement == false){ + // print_rr($header); + continue; + } } if ($header['parentHeader'] === 'Sno') { @@ -1666,7 +1676,6 @@ class LeadsController extends BaseController $subHeaderCount = count($header['subHeaders']); // Number of subheaders for this parent header } - // Set parent header value if ($is_placement == true && !in_array($header['parentHeader'], ['Particulars', 'S.No.'])) { $sheet->setCellValue("{$startColumn}{$rowNumber}", "Terms"); @@ -1680,6 +1689,7 @@ class LeadsController extends BaseController $sheet->setCellValue("{$startColumn}{$rowNumber}", "Proposal Terms " . $headerIndex); } } + $sheet->getStyle("{$startColumn}{$rowNumber}")->applyFromArray([ 'font' => ['bold' => true], 'alignment' => [ @@ -1703,7 +1713,7 @@ class LeadsController extends BaseController continue; } - if ($type == 2 && $is_placement == false) { + if ($is_placement == false) { $sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader); } @@ -1728,7 +1738,7 @@ class LeadsController extends BaseController $length++; } } - + if($header_actual_count == 1 && $type == 1){ $sheet->getColumnDimension('B')->setWidth(80); }else{ From 2c75657d5a4eefe987442a9f020737a29f2d8927 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Wed, 13 Aug 2025 18:36:47 +0530 Subject: [PATCH 06/18] CHANGE_Vidal_api_and_ticketing_system_scaffold - VADIVEL J 2025-08-13 --- app/Config/Routes.php | 13 +- .../ThzControllerCleaner.php | 67 ++++++ app/Controllers/ThzController.php | 168 ++++++++++++++ app/Controllers/VidalApiController.php | 214 ++++++++++++++++++ app/Models/ThzMasterModel.php | 42 ++++ app/Models/ThzMasterNotesModel.php | 78 +++++++ 6 files changed, 581 insertions(+), 1 deletion(-) create mode 100644 app/ControllerCleaners/ThzControllerCleaner.php create mode 100644 app/Controllers/ThzController.php create mode 100644 app/Controllers/VidalApiController.php create mode 100644 app/Models/ThzMasterModel.php create mode 100644 app/Models/ThzMasterNotesModel.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index e3685dd8..22e812fc 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -614,7 +614,7 @@ $routes->post("retrieveWebhookDataClaim","ClientWebHooksController::pullData_cla -//Third party Api Call +//Third party ICICILombard Api Call $routes->get('generateAuthToken','ICICILombardController::generateAuthToken'); $routes->get('createEnrollmentBatch','ICICILombardController::createEnrollmentBatch'); @@ -623,3 +623,14 @@ $routes->get('fetchUHIDDetails','ICICILombardController::fetchUHIDDetails'); $routes->get('testTracelog','TestBusinessController::a'); $routes->get("claimView", "EmployeeRestController::claimView"); + +//Third party Vidal Api Call + +$routes->post('hospitalNetwork','VidalApiController::hospitalNetwork'); +$routes->post('eCardService','VidalApiController::eCardService'); +$routes->post('claimStatusCheck','VidalApiController::claimStatusCheck'); +$routes->post('newClaim','VidalApiController::newClaim'); +$routes->post('enrollment','VidalApiController::enrollment'); + + +$routes->post("ticketCreation", "ThzController::ticketCreation"); \ No newline at end of file diff --git a/app/ControllerCleaners/ThzControllerCleaner.php b/app/ControllerCleaners/ThzControllerCleaner.php new file mode 100644 index 00000000..5208921c --- /dev/null +++ b/app/ControllerCleaners/ThzControllerCleaner.php @@ -0,0 +1,67 @@ +thzMasterModel = new ThzMasterModel(); + $this->thzMasterNotesModel = new ThzMasterNotesModel(); + } + + public function index() + { + // + } + + public function ticketCreation($data){ + + if(empty($data)){ + return false; + } + + $cleanedData = $data; + + return $cleanedData; + + + } + + public function ticketList($data){ + + if(empty($data)){ + return false; + } + + $cleanedData = $data; + + return $cleanedData; + + } + + public function ticketConversation($data){ + + if(empty($data)){ + return false; + } + + $cleanedData = $data; + + return $cleanedData; + + } + + + +} diff --git a/app/Controllers/ThzController.php b/app/Controllers/ThzController.php new file mode 100644 index 00000000..590e8f78 --- /dev/null +++ b/app/Controllers/ThzController.php @@ -0,0 +1,168 @@ +thzMasterModel = new ThzMasterModel(); + $this->thzMasterNotesModel = new ThzMasterNotesModel(); + $this->thzControllerCleaner = new ThzControllerCleaner(); + } + + public function index() + { + // + } + + public function ticketCreation(){ + + $data = $this->request->getJSON(true); + + $cleanedData = $this->thzControllerCleaner->ticketCreation($data); + + if ($cleanedData === false) { + return $this->response->setJSON((['status' => 'error', 'message' => 'Invalid data given'])); + } + + $result = $this->thzMasterModel->insert($cleanedData); + + return $this->response->setJSON((['status' => 'success', 'message' => 'Ticket created successfully'])); + + } + + public function ticketList(){ + + $data = $this->request->getJson(true); + + $cleanedData = $this->thzControllerCleaner->ticketList($data); + + if( $cleanedData === false ) { + return $this->response->setJSON((['status' => 'error', 'message' => 'Invalid data given'])); + } + + $id = $cleanedData['id'] ?? null; + + if (empty($id)) { + $result = $this->thzMasterModel->findAll(); + } + + $result = $this->thzMasterModel->where('id',$id)->findAll(); + + if(empty($result)){ + return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found'])); + } + + return $this->response->setJSON((['status' => 'success', 'data' => $result])); + + } + + public function ticketConversationSave(){ + + $data = $this->request->getJson(true); + + $cleanedData = $this->thzControllerCleaner->ticketList($data); + + if( $cleanedData === false ) { + return $this->response->setJSON((['status' => 'error', 'message' => 'Invalid data given'])); + } + + $result = $this->thzMasterNotesModel->insert($data); + + if(empty($result)){ + return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found'])); + } + + return $this->response->setJSON((['status' => 'success', 'data' => $result])); + + + } + + public function ticketListForUser(){ + + $data = $this->request->getJson(true); + + $cleanedData = $this->thzControllerCleaner->ticketList($data); + + if( $cleanedData === false ) { + return $this->response->setJSON((['status' => 'error', 'message' => 'Invalid data given'])); + } + + $result = $this->thzMasterNotesModel->insert($data); + + if(empty($result)){ + return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found'])); + } + + return $this->response->setJSON((['status' => 'success', 'data' => $result])); + + } + + public function conversationListForUserPerTicket(){ + + $data = $this->request->getJson(true); + + $cleanedData = $this->thzControllerCleaner->ticketList($data); + + if( $cleanedData === false ) { + return $this->response->setJSON((['status' => 'error', 'message' => 'Invalid data given'])); + } + + $thz_id = $cleanedData['thz_id'] ?? null; + + $result = $this->thzMasterNotesModel->conversationListForUserPerTicket($thz_id); + + if(empty($result)){ + return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found'])); + } + + return $this->response->setJSON((['status' => 'success', 'data' => $result])); + + } + + public function ticketListForAssignedStaff(){ + + } + + public function conversationListForAssignedStaffPerTicket(){ + + } + + + + + + /************************************************** PRIVATE FUNCTIONS ********************************************************/ + + + private function checkGeneralUserOrEmployee($data){ + + if($data['empcode']){ + return $data['empcode']; + } elseif ($data['mobile']) { + return $data['mobile']; + } elseif ($data['email']) { + return $data['email']; + } else { + return null; + } + + } + + + +} diff --git a/app/Controllers/VidalApiController.php b/app/Controllers/VidalApiController.php new file mode 100644 index 00000000..259e9841 --- /dev/null +++ b/app/Controllers/VidalApiController.php @@ -0,0 +1,214 @@ +request->getJSON(true); + + + helper('api'); + + $url = ''. getenv('VIDAL_API_BASE_URL').'/hospitalnetwork'; + $method = 'POST'; + + $headers = [ + 'Content-Type: application/json', + 'Authorization:'. getenv('VIDAL_API_KEY').'', + 'username:'. getenv('VIDAL_API_USERNAME').'', + 'password:'. getenv('VIDAL_API_PASSWORD').'', + 'policynumber:'. $postData['policyNo'] ?? '', + ]; + + + + $body = []; + + $response = call_third_party_api($url, $method, $headers, $body); + + + if($response['status'] != true){ + return $this->response->setJSON([ + 'status' => false, + 'message' => 'Token generation failed.', + 'data' => $response + ]); + } + + return $this->response->setJSON($response); + + } + + public function eCardService(){ + + $postData = $this->request->getJSON(true); + + helper('api'); + + $url = ''. getenv('VIDAL_API_BASE_URL').'/ecardservice'; + $method = 'POST'; + + + $headers = [ + 'Content-Type: application/json', + 'Authorization:'.getenv('VIDAL_API_KEY').'', + 'username:' .getenv('VIDAL_API_USERNAME').'', + 'password:' .getenv('VIDAL_API_PASSWORD').'', + 'PolicyNo:' .$postData['PolicyNo'] ?? '', + 'enrollmentNo:' .$postData['enrollmentNo'] ?? '', + ]; + + $body = [ + ]; + + $response = call_third_party_api($url, $method, $headers, $body); + + if($response['status'] != true){ + return $this->response->setJSON([ + 'status' => false, + 'message' => 'Token generation failed.', + 'data' => $response + ]); + } + + return $this->response->setJSON($response); + + } + + public function claimStatusCheck(){ + + $postData = $this->request->getJSON(true); + + helper('api'); + + $url = ''. getenv('VIDAL_API_BASE_URL').'/claimpreauthservice'; + $method = 'POST'; + + $headers = [ + 'Content-Type: application/json', + 'Authorization:' .getenv('VIDAL_API_KEY').'', + 'username:' .getenv('VIDAL_API_USERNAME').'', + 'password:' .getenv('VIDAL_API_PASSWORD').'', + 'PolicyNo:' .$postData['policyNo'] ?? '', + 'enrollmentNo:' .$postData['enrollmentNo'] ?? '', + 'empNo:' .$postData['empNo'] ?? '', + 'startdate:' .$postData['startdate'] ?? '', + 'enddate:' .$postData['enddate'] ?? '', + 'tpaclaimNo:' .$postData['tpaclaimNo'] ?? '' + ]; + + $body = []; + + $response = call_third_party_api($url, $method, $headers, $body); + + if($response['status'] != true){ + return $this->response->setJSON([ + 'status' => false, + 'message' => 'Token generation failed.', + 'data' => $response + ]); + } + + return $this->response->setJSON($response); + + } + + public function newClaim(){ + + $postData = $this->request->getPost(); + + helper('api'); + + $url = ''. getenv('VIDAL_API_BASE_URL').'/submitClaim'; + $method = 'POST'; + + $headers = [ + 'Content-Type: multipart/form-data', + 'Authorization:' .getenv('VIDAL_API_KEY').'', + ]; + + $body = [ + 'username:' .getenv('VIDAL_API_USERNAME').'', + 'password:' .getenv('VIDAL_API_PASSWORD').'', + 'PolicyNo:' .$postData['policyNo'] ?? '', + 'enrollmentId:' .$postData['enrollmentId'] ?? '', + 'typeOfClaim:' .$postData['typeOfClaim'] ?? '', + 'claimSubType:' .$postData['claimSubType'] ?? '', + 'requestedAmount:' .$postData['requestedAmount'] ?? '', + 'ailmentType:' .$postData['ailmentType'] ?? '', + 'admissionDate:' .$postData['admissionDate'] ?? '', + 'dischargeDate:' .$postData['dischargeDate'] ?? '', + 'hospitalName:' .$postData['hospitalName'] ?? '', + 'empanelmentNo:' .$postData['empanelmentNo'] ?? '', + 'documentType:' .$postData['documentType'] ?? '', + 'ailmentName:' .$postData['ailmentName'] ?? '', + 'hospitalAddress:' .$postData['hospitalAddress'] ?? '', + 'hospitalState:' .$postData['hospitalState'] ?? '', + 'hospitalCity:' .$postData['hospitalCity'] ?? '', + 'hospitalPinCode:' .$postData['hospitalPinCode'] ?? '', + 'hospitalPhoneNo:' .$postData['hospitalPhoneNo'] ?? '' + ]; + + $response = call_third_party_api($url, $method, $headers, $body); + + if($response['status'] != true){ + return $this->response->setJSON([ + 'status' => false, + 'message' => 'Token generation failed.', + 'data' => $response + ]); + } + + return $this->response->setJSON($response); + + } + + + public function enrollment(){ + + $postData = $this->request->getJSON(true); + + helper('api'); + + $url = ''. getenv('VIDAL_API_BASE_URL').'/enrollmendataservice'; + $method = 'POST'; + + $headers = [ + 'Content-Type: application/json', + 'Authorization:'. getenv('VIDAL_API_KEY').'', + 'username:' . getenv('VIDAL_API_USERNAME').'', + 'password:' . getenv('VIDAL_API_PASSWORD').'', + 'policyNo:' .$postData['policyNo'] ?? '', + 'startindex:' .$postData['startindex'] ?? '', + 'endindex:' .$postData['endindex'] ?? '' + ]; + + $body = [ + ]; + + $response = call_third_party_api($url, $method, $headers, $body); + + + if($response['status'] != true){ + return $this->response->setJSON([ + 'status' => false, + 'message' => 'Token generation failed.', + 'data' => $response + ]); + } + + return $this->response->setJSON($response); + } + + +} diff --git a/app/Models/ThzMasterModel.php b/app/Models/ThzMasterModel.php new file mode 100644 index 00000000..410a84ba --- /dev/null +++ b/app/Models/ThzMasterModel.php @@ -0,0 +1,42 @@ + $thz_id ]; + + $result = $this->db->query($sql,$binds)->getResultArray() ; + + return $result; + + } + + +} From 898508781d18e92d4b0df6f834f77b7a81467844 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 14 Aug 2025 09:34:48 +0530 Subject: [PATCH 07/18] FIX_LIVE_ISSUE : RV --- .../PolicyTransactionController.php | 3 +++ app/Views/client_policy.php | 25 ++++++++++--------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index dddedd54..d6bc5167 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -35,6 +35,7 @@ use App\Models\COShareStmtDetailsModel; use App\Models\BdsPlacementModel; use Kint\Kint; use App\Helpers\MailHelper; +use App\Helpers\ExcelSanitizeHelper; use Exception; class PolicyTransactionController extends BaseController @@ -2270,6 +2271,7 @@ class PolicyTransactionController extends BaseController // dd($highestRowAndColumn); $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); unset($excel_data[0]); + $excel_data = ExcelSanitizeHelper::sanitizeArrayData($excel_data); // Kint::dump($excel_data);die(); //get no of line items and update in DB $line_items = 0; @@ -2384,6 +2386,7 @@ class PolicyTransactionController extends BaseController // dd($highestRowAndColumn); $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); unset($excel_data[0]); + $excel_data = ExcelSanitizeHelper::sanitizeArrayData($excel_data); // dd($excel_data); //get no of line items and update in DB $line_items = count($excel_data); diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 3e5d15f0..8dfdcce8 100755 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -2242,18 +2242,19 @@ // Start the interval function startAutoSubmit(attrId) { - if (!submitInterval) { - submitInterval = setInterval(function() { - if(attrId == "GMC"){ - autoSaveGmcTerms(); - }else if(attrId == "GPA"){ - autoSaveGpaTerms(); - }else if(attrId == "OTHERS"){ - autoSaveOtherTerms(); - } - }, 20000); - console.log("Auto-submit started."); - } + // if (!submitInterval) { + // submitInterval = setInterval(function() { + // if(attrId == "GMC"){ + // autoSaveGmcTerms(); + // }else if(attrId == "GPA"){ + // autoSaveGpaTerms(); + // }else if(attrId == "OTHERS"){ + // autoSaveOtherTerms(); + // } + // }, 20000); + // console.log("Auto-submit started."); + // } + console.log("Auto-submit Disabled."); } // Stop the interval From 9834fc4e7fbaaaa92db04ffb941b087bca893b5e Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 14 Aug 2025 10:34:25 +0530 Subject: [PATCH 08/18] FIX : RV --- app/Controllers/TicketController.php | 201 +++++++++++++++++++- app/Views/view_policy_terms.php | 267 +++++++++++++++++++-------- 2 files changed, 385 insertions(+), 83 deletions(-) diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 5e119628..95a4bbe2 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -829,11 +829,25 @@ class TicketController extends BaseController $data['ticket_data'] = $ticket_data; $data['acms'] = $this->employeeModel->getAcmUsingClientID($ticket_data['client_id']); - $raw_json = $this->ticketMasterModel->getPolicyTermsJson($ticket_id) ; - - $decoded_top = json_decode($raw_json ?? "", true) ?? []; - $data['policy_terms'] = $this->recursive_json_decode($decoded_top); + // do not remove this + // $raw_json = $this->ticketMasterModel->getPolicyTermsJson($ticket_id) ; + // $decoded_top = json_decode($raw_json ?? "", true) ?? []; + // $data['policy_terms'] = $this->recursive_json_decode($decoded_top); + + $policy_data = $this->ticketMasterModel + ->select('client_policy.policy_terms') + ->join('client_policy', 'ticket_master.client_policy_id = client_policy.id') + ->where('client_policy.is_active', 1) + ->where('ticket_master.is_active', 1) + ->where('ticket_master.id', $ticket_id) + ->first(); + + if(isset($policy_data['policy_terms']) && !empty($policy_data['policy_terms'])){ + $terms = json_decode($policy_data['policy_terms'], true); + $data['policy_terms'] = $this->convertTermsToDisplay($terms); + // print_rr($data); die; + } return $this->loadLayout('ticket_edit_onbording', $data); } @@ -2232,7 +2246,8 @@ class TicketController extends BaseController } } - public function recursive_json_decode($input) { + public function recursive_json_decode($input) + { if (is_string($input)) { $decoded = json_decode($input, true); if (json_last_error() === JSON_ERROR_NONE) { @@ -2251,6 +2266,182 @@ class TicketController extends BaseController return $input; } + function convertTermsToDisplay(array $data) + { + $result = []; + + $LableKeys = [ + "sum_insured" => "Sum Insured", + "family_floater" => "Family Floater", + "family_floaters" => "Family Floater Details", + "age_ratio" => "Age Ratio", + "is_payable_employee" => "Payable by Employee", + "waiverofpreexistingdiseases" => "Waivers of Pre Existing Diseases", + "waiverof1,2,3&4thyearexclusions" => "Waivers of 1, 2, 3 & 4th Year Exclusions", + "waiverof30dayswaitingperiod" => "Waivers of 30 Days Waiting Period", + "waiver_of_90_days_waiting_period" => "Waiver of 90 Days Waiting Period", + "waiver_of_other_waiting_periods" => "Waiver of Other Waiting Periods", + "maternity_benefit" => "Maternity Benefit", + "9monthwaitingperiodwaived" => "9 Month Waiting Period Waived", + "maternitycoverage" => "Maternity Coverage", + "twindelivery" => "Twin Delivery", + "well_baby_well_mother_expenses" => "Well Baby & Well Mother Expenses", + "preandpostnatal" => "Pre and Post Natal", + "infertility_treatment_coverage" => "Infertility Treatment Coverage", + "babyday1cover" => "Baby Day 1 Cover", + "coverfromthedateofjoining" => "Cover from the Date of Joining", + "mid_term_addition_of_new_born_newly_wedded_spouse" => "Mid Term Addition of New Born / Newly Wedded Spouse", + "prehospitalizationcover" => "Pre Hospitalization Cover", + "posthospitalizationcover" => "Post Hospitalization Cover", + "congenitaldiseasesinternal" => "Congenital Diseases - Internal", + "congenitaldiseasesexternal" => "Congenital Diseases - External", + "copayzonewisecopay" => "Co-Pay (Zone Wise)", + "roomrentlimit" => "Room Rent Limit", + "icu_limit" => "ICU Limit", + "proportionatedeductionclause" => "Proportionate Deduction Clause", + "ailmentcapping" => "Ailment Capping", + "ailment_capping_details" => "Ailment Capping Details", + "corporatebuffer" => "Corporate Buffer", + "non_admissible_contingency_corporate_buffer" => "Non-Admissible Contingency Corporate Buffer", + "ambulancecharges" => "Ambulance Charges", + "airambulance" => "Air Ambulance", + "reasonableandcustomarycharges" => "Reasonable and Customary Charges", + "daycaretreatment" => "Day Care Treatment", + "lasiksurgery" => "Lasik Surgery", + "ayudhtreatmentcover" => "Ayudh Treatment Cover", + "moderntreatmentsasperirdai" => "Modern Treatments as per IRDAI", + "opd_treatment" => "OPD Treatment", + "days_of_discharge" => "Days of Discharge", + "days_from_dod" => "Days from Date of Discharge", + "terrorism" => "Terrorism Cover", + "widower_cover" => "Widower Cover", + "breavement_cover" => "Breavement Cover", + "suminsuredenhancement" => "Sum Insured Enhancement", + "special_condition_label" => "Special Condition Label", + "special_condition_input" => "Special Condition Input" + ]; + + // // 1. Family Floaters + // $floatersMap = [ + // 'self' => 'Self', + // 'spouse' => 'Spouse', + // 'childrens' => 'Childrens', + // 'parents' => 'Parents', + // 'parents-in-law' => 'Parents-in-law', + // 'either-parents-pil' => 'Either Parents/PIL', + // 'elders_count' => 'Elders' + // ]; + + // 1. Family Floaters + $floatersMap = [ + 'self' => 'Self', + 'spouse' => 'Spouse', + 'childrens' => 'Childrens', + 'parents' => 'Parents', + 'parents-in-law' => 'Parents-in-law', + 'either-parents-pil' => 'Either Parents/PIL', + 'elders_count' => 'Total Elders Count' + ]; + + if(isset($data['family_floaters'])){ + $floatersOutput = []; + foreach ($floatersMap as $key => $label) { + if (isset($data['family_floaters'][$key])) { + $val = $data['family_floaters'][$key]; + $floatersOutput[] = "$label : " . ($val > 0 ? $val : 'No'); + } + } + $data['family_floaters'] = implode(', ', $floatersOutput); + } + + // 2. Age Ratio + if (!empty($data['age_ratio'])) { + $ageOutput = []; + foreach ($data['age_ratio'] as $person => $age) { + if (isset($age['min']) && isset($age['max'])) { + // $ageOutput[] = ucfirst($person) . " - Min : {$age['min']}, Max : {$age['max']}"; + $ageOutput[] = "" . ucfirst($person) . " - Min : {$age['min']}, Max : {$age['max']}"; + } + } + $data['age_ratio'] = implode(', ', $ageOutput); + } + + // 3. Is Payable Employee + if (!empty($data['is_payable_employee'])) { + $payableOutput = []; + foreach ($data['is_payable_employee'] as $person => $status) { + // $payableOutput[] = ucfirst($person) . " : " . ($status ? 'Yes' : 'No'); + $payableOutput[] = "" . ucfirst($person) . " : " . ($status ? 'Yes' : 'No'); + } + $data['is_payable_employee'] = implode(', ', $payableOutput); + } + + // 4. Remove the Enrollment display key + if(isset($data['enrollment_display_key'])){ + unset($data['enrollment_display_key']); + } + + // 5. Merge the Sum Insured value if the multiple sum insured exists + if(isset($data['multiple_sum_insured'])){ + if($data['sumInsured2']){ + $data['sumInsured2'] = $data['sumInsured2'] . ", " . implode(", ", $data['multiple_sum_insured']); + }else{ + $data['sum_insured'] = $data['sum_insured'] . ", " . implode(", ", $data['multiple_sum_insured']); + } + unset($data['multiple_sum_insured']); + } + + // 6. Add the special condition to key value pair + + if(!empty($data['special_condition_label'])){ + foreach ($data['special_condition_label'] as $key => $value) { + if($value != "" && $value != null) { + $data[$value] = $data['special_condition_input'][$key]; + } + } + }//GMC + + if(!empty($data['gpa_special_condition_label'])){ + foreach ($data['gpa_special_condition_label'] as $key => $value) { + if($value != "" && $value != null) { + $data[$value] = $data['gpa_special_condition_input'][$key]; + } + } + }//GPA + + // 7. Remove the special condition keys + unset($data['special_condition_label']); + unset($data['special_condition_input']); + unset($data['gpa_special_condition_label']); + unset($data['gpa_special_condition_input']); + + if(isset($data['sumInsured2'])){ + $firstItem = ["Sum Insured" => $data['sumInsured2']]; + unset($data['sumInsured2']); + $data = $firstItem + $data; + } + + // 8. Change the key name to lable name + $result = []; + foreach ($data as $key => $value) { + + // $label = isset($LableKeys[$key]) ? $LableKeys[$key] : $key; + if (isset($LableKeys[$key])) { + $label = $LableKeys[$key]; + // echo "1"; + } else { + // Handle camelCase first, then snake_case + $label = preg_replace('/(? + + + + + +
+ $value){ ?> +
+
+ +
+
+ +
+ +
+ +
+
+ No Terms Found
- +
+ + + From 03e90088988732cbf2744486d7ad0595812f7455 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 14 Aug 2025 11:51:06 +0530 Subject: [PATCH 09/18] FIX_VIEW_TERS : RV --- app/Controllers/TicketController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 95a4bbe2..4c344c28 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -95,6 +95,7 @@ class TicketController extends BaseController 4 => "Smart Service Desk", 5 => "Direct to TPA" ]; + $this->claimType = [ 1 => [ 1 => "Main Hospitalization", @@ -2383,7 +2384,7 @@ class TicketController extends BaseController // 5. Merge the Sum Insured value if the multiple sum insured exists if(isset($data['multiple_sum_insured'])){ - if($data['sumInsured2']){ + if(isset($data['sumInsured2'])){ $data['sumInsured2'] = $data['sumInsured2'] . ", " . implode(", ", $data['multiple_sum_insured']); }else{ $data['sum_insured'] = $data['sum_insured'] . ", " . implode(", ", $data['multiple_sum_insured']); From b3361766fea082772a913fcce107326834959235 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 14 Aug 2025 12:37:35 +0530 Subject: [PATCH 10/18] FIX_LEAD_VIEW_DEMO : RV --- app/Controllers/LeadsController.php | 177 +++++++++++++++------------- app/Views/view_rfq.php | 2 +- 2 files changed, 93 insertions(+), 86 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 4d7e2170..fc4a4e86 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -2080,95 +2080,102 @@ class LeadsController extends BaseController if (!$lead_data) { return ['status' => 'failed', 'message' => 'Lead data not found']; } - if ($lead_data['file_name']) { - // $file_name_with_path = WRITEPATH . "/uploads/lead_files/NonPrintableCharacters.xlsx"; - //check physical file - if (!file_exists($file_name_with_path)) { - //file not found update status and reason - $message = "Lead Physcial file not found"; - // echo $message; - $this->myLogger->logme('error', ($message . ' for file ' . $file_name_with_path)); - return ['status' => 'failed', 'message' => 'no physical file']; - } + try{ + if ($lead_data['file_name']) { + // $file_name_with_path = WRITEPATH . "/uploads/lead_files/NonPrintableCharacters.xlsx"; - $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path); - - //get members data - $members_sheet = $spreadsheet->getSheet(0); - $highestRowAndColumn = $members_sheet->getHighestRowAndColumn(); - // dd($highestRowAndColumn); - $uncleaned_members = $members_sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); - $members = ExcelSanitizeHelper::sanitizeArrayData($uncleaned_members); - //get age band data - $age_band_sheet = $spreadsheet->getSheet(1); - $highestRowAndColumn = $age_band_sheet->getHighestRowAndColumn(); - $age_band_data = $age_band_sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); - - - //check age or dob column - $members_heading = $members[0]; - $available_col = null; - $col_index = null; - - if (in_array('age', array_map('strtolower', $members_heading))) { - $available_col = 'age'; - $col_index = array_search('age', array_map('strtolower', $members_heading)); - } elseif (in_array('dob', array_map('strtolower', $members_heading))) { - $available_col = 'dob'; - $col_index = array_search('dob', array_map('strtolower', $members_heading)); - } - - if ($available_col == null) { - $message = 'No DOB or Age column '; - $this->myLogger->logme('error', ($message . $file_name_with_path)); - return ['status' => 'failed', 'message' => $message]; - } - - try { - $classifiers = $this->getDemographyData($members, $age_band_data, $members_heading, $available_col, $col_index); - } catch (Exception $e) { - return ['status' => 'fail', 'message' => $e->getMessage()]; - } - - //for this to view the demography in the RFQ and QCR page to using internal - if($returnType == "internal"){ - return ['data' => $classifiers]; - // print_rr($classifiers); die; - } - - - try { - $result = $this->generateClassifierSpreadsheet($classifiers, WRITEPATH . 'uploads/lead_files/'); - if ($result['success']) { - $this->myLogger->logme('error', "Spreadsheet generated successfully!"); - - echo "Location: " . $result['fullpath'] . "\n"; - echo "Filename: " . $result['filename'] . "\n"; - $filePaths = [ - ['file_path' => WRITEPATH . 'uploads/lead_files/' . $lead_data['file_name'], 'sheets' => [0, 1]], - ['file_path' => WRITEPATH . '/uploads/lead_files/' . $result['filename'], 'sheets' => []], - ]; - $outputPath = WRITEPATH . 'uploads/lead_files/' . $lead_data['file_name']; - $result_merge = ExcelMergeHelper::mergeExcelFiles($filePaths, $outputPath); - if ($result_merge) { - // Call the delete function after the file is successfully created - $deleteResponse = $this->deleteGeneratedFile($result['fullpath']); - - // Add delete message to response - $response['deleteMessage'] = $deleteResponse['message']; - return ['status' => 'success', 'message' => 'Member_Data Merged Suceesfully']; - } - } else { - echo "Error generating spreadsheet: " . $result['error']; + //check physical file + if (!file_exists($file_name_with_path)) { + //file not found update status and reason + $message = "Lead Physcial file not found"; + // echo $message; + $this->myLogger->logme('error', ($message . ' for file ' . $file_name_with_path)); + return ['status' => 'failed', 'message' => 'no physical file']; } - } catch (Exception $e) { - echo "Error: " . $e->getMessage(); - return ['status' => 'fail', 'message' => $e->getMessage()]; + + $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path); + + //get members data + $members_sheet = $spreadsheet->getSheet(0); + $highestRowAndColumn = $members_sheet->getHighestRowAndColumn(); + // dd($highestRowAndColumn); + $uncleaned_members = $members_sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); + $members = ExcelSanitizeHelper::sanitizeArrayData($uncleaned_members); + //get age band data + $age_band_sheet = $spreadsheet->getSheet(1); + $highestRowAndColumn = $age_band_sheet->getHighestRowAndColumn(); + $age_band_data = $age_band_sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); + + + //check age or dob column + $members_heading = $members[0]; + $available_col = null; + $col_index = null; + + if (in_array('age', array_map('strtolower', $members_heading))) { + $available_col = 'age'; + $col_index = array_search('age', array_map('strtolower', $members_heading)); + } elseif (in_array('dob', array_map('strtolower', $members_heading))) { + $available_col = 'dob'; + $col_index = array_search('dob', array_map('strtolower', $members_heading)); + } + + if ($available_col == null) { + $message = 'No DOB or Age column '; + $this->myLogger->logme('error', ($message . $file_name_with_path)); + return ['status' => 'failed', 'message' => $message]; + } + + try { + $classifiers = $this->getDemographyData($members, $age_band_data, $members_heading, $available_col, $col_index); + } catch (Exception $e) { + return ['status' => 'fail', 'message' => $e->getMessage()]; + } + + //for this to view the demography in the RFQ and QCR page to using internal + if($returnType == "internal"){ + return ['data' => $classifiers]; + // print_rr($classifiers); die; + } + + + try { + $result = $this->generateClassifierSpreadsheet($classifiers, WRITEPATH . 'uploads/lead_files/'); + if ($result['success']) { + $this->myLogger->logme('error', "Spreadsheet generated successfully!"); + + echo "Location: " . $result['fullpath'] . "\n"; + echo "Filename: " . $result['filename'] . "\n"; + $filePaths = [ + ['file_path' => WRITEPATH . 'uploads/lead_files/' . $lead_data['file_name'], 'sheets' => [0, 1]], + ['file_path' => WRITEPATH . '/uploads/lead_files/' . $result['filename'], 'sheets' => []], + ]; + $outputPath = WRITEPATH . 'uploads/lead_files/' . $lead_data['file_name']; + $result_merge = ExcelMergeHelper::mergeExcelFiles($filePaths, $outputPath); + if ($result_merge) { + // Call the delete function after the file is successfully created + $deleteResponse = $this->deleteGeneratedFile($result['fullpath']); + + // Add delete message to response + $response['deleteMessage'] = $deleteResponse['message']; + return ['status' => 'success', 'message' => 'Member_Data Merged Suceesfully']; + } + } else { + echo "Error generating spreadsheet: " . $result['error']; + } + } catch (Exception $e) { + echo "Error: " . $e->getMessage(); + return ['status' => 'fail', 'message' => $e->getMessage()]; + } + } else { + $this->myLogger->logme('error', (' no file found ' . $file_name_with_path)); + return ['status' => 'failed', 'message' => 'no file found']; } - } else { - $this->myLogger->logme('error', (' no file found ' . $file_name_with_path)); - return ['status' => 'failed', 'message' => 'no file found']; + + }catch(Exception $e){ + $this->myLogger->logme("error", "Exception: " . $e->getMessage() . " --- Line: " . $e->getLine() . " --- Trace: " . $e->getTraceAsString()); + return ['status' => 'fail', 'error' => "File not found / Wrong file"]; } } diff --git a/app/Views/view_rfq.php b/app/Views/view_rfq.php index f00350cb..58e0fc03 100644 --- a/app/Views/view_rfq.php +++ b/app/Views/view_rfq.php @@ -706,7 +706,7 @@ if(isset($demogrphy_html_data) && !empty($demogrphy_html_data)){ echo $demogrphy_html_data; }else{ - echo "

No Demography Data Found

"; + echo "

No Demography Data Found or Wrong File

"; } ?> From 1240eef35ced3da910ea7dd836427cf7cddedefb Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 14 Aug 2025 14:34:29 +0530 Subject: [PATCH 11/18] CHNAGE_DEMOGRAPHY : RV --- app/Views/view_rfq.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Views/view_rfq.php b/app/Views/view_rfq.php index 58e0fc03..9e906235 100644 --- a/app/Views/view_rfq.php +++ b/app/Views/view_rfq.php @@ -293,7 +293,7 @@ onclick="checkTheTableDataChanged(3)">Send Insurer Mail - + From b933a02561b2898234c9ebc68cf550f810b62dc7 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Sat, 16 Aug 2025 12:47:49 +0530 Subject: [PATCH 12/18] CHANGE DASHBOARD THEME NEW - VADIVEL J 2025-08-16 --- app/Config/Routes.php | 5 +- app/Controllers/ThzController.php | 75 +- app/Models/ThzMasterNotesModel.php | 4 +- app/Views/DashBoard.php | 157 ++- app/Views/bds_dash.php | 132 ++- app/Views/claims_dash.php | 157 ++- app/Views/endorsement_dash.php | 290 +++-- app/Views/layout/footer.php | 84 +- app/Views/layout/footer_old.php | 936 +++++++++++++++ app/Views/layout/header.php | 1023 ++++++++--------- app/Views/layout/header_old.php | 899 +++++++++++++++ app/Views/leads_dash.php | 255 ++-- app/Views/ticket_search.php | 3 +- public/assets/images/active_bds.png | Bin 0 -> 537 bytes public/assets/images/active_claims.png | Bin 0 -> 1361 bytes .../images/active_leads_and_bds_renewal.png | Bin 0 -> 1196 bytes .../assets/images/active_pending_actions.png | Bin 0 -> 826 bytes public/assets/images/inactive_bds.png | Bin 0 -> 664 bytes public/assets/images/inactive_claims.png | Bin 0 -> 1426 bytes .../images/inactive_leads_and_bds_renewal.png | Bin 0 -> 1869 bytes .../images/inactive_pending_actions.png | Bin 0 -> 775 bytes 21 files changed, 3129 insertions(+), 891 deletions(-) create mode 100644 app/Views/layout/footer_old.php create mode 100644 app/Views/layout/header_old.php create mode 100644 public/assets/images/active_bds.png create mode 100644 public/assets/images/active_claims.png create mode 100644 public/assets/images/active_leads_and_bds_renewal.png create mode 100644 public/assets/images/active_pending_actions.png create mode 100644 public/assets/images/inactive_bds.png create mode 100644 public/assets/images/inactive_claims.png create mode 100644 public/assets/images/inactive_leads_and_bds_renewal.png create mode 100644 public/assets/images/inactive_pending_actions.png diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 2377fc38..1cb35d79 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -634,4 +634,7 @@ $routes->post('newClaim','VidalApiController::newClaim'); $routes->post('enrollment','VidalApiController::enrollment'); -$routes->post("ticketCreation", "ThzController::ticketCreation"); \ No newline at end of file +$routes->post("ticketCreation", "ThzController::ticketCreation"); +$routes->post("ticketList", "ThzController::ticketList"); +$routes->post("ticketConversationSave", "ThzController::ticketConversationSave"); +$routes->post("conversationListPerTicket", "ThzController::conversationListPerTicket"); \ No newline at end of file diff --git a/app/Controllers/ThzController.php b/app/Controllers/ThzController.php index 590e8f78..6613cb6b 100644 --- a/app/Controllers/ThzController.php +++ b/app/Controllers/ThzController.php @@ -33,13 +33,7 @@ class ThzController extends BaseController $data = $this->request->getJSON(true); - $cleanedData = $this->thzControllerCleaner->ticketCreation($data); - - if ($cleanedData === false) { - return $this->response->setJSON((['status' => 'error', 'message' => 'Invalid data given'])); - } - - $result = $this->thzMasterModel->insert($cleanedData); + $result = $this->thzMasterModel->insert($data); return $this->response->setJSON((['status' => 'success', 'message' => 'Ticket created successfully'])); @@ -49,20 +43,17 @@ class ThzController extends BaseController $data = $this->request->getJson(true); - $cleanedData = $this->thzControllerCleaner->ticketList($data); + $id = $data['id'] ?? null; - if( $cleanedData === false ) { - return $this->response->setJSON((['status' => 'error', 'message' => 'Invalid data given'])); + if ( isset($id) && !empty($id) ) { + //Find Specific Ticket per id + $mobile = $data['mobile'] ?? null; + $result = $this->thzMasterModel->where('mobile',$mobile)->findAll(); + }else{ + // Find all the Ticket For the Manager who can see all the Tickets + $result = $this->thzMasterModel->findAll(); } - $id = $cleanedData['id'] ?? null; - - if (empty($id)) { - $result = $this->thzMasterModel->findAll(); - } - - $result = $this->thzMasterModel->where('id',$id)->findAll(); - if(empty($result)){ return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found'])); } @@ -71,16 +62,11 @@ class ThzController extends BaseController } + public function ticketConversationSave(){ $data = $this->request->getJson(true); - $cleanedData = $this->thzControllerCleaner->ticketList($data); - - if( $cleanedData === false ) { - return $this->response->setJSON((['status' => 'error', 'message' => 'Invalid data given'])); - } - $result = $this->thzMasterNotesModel->insert($data); if(empty($result)){ @@ -92,17 +78,13 @@ class ThzController extends BaseController } - public function ticketListForUser(){ + public function conversationListPerTicket(){ $data = $this->request->getJson(true); - $cleanedData = $this->thzControllerCleaner->ticketList($data); + $thz_id = $data['thz_id'] ?? null; - if( $cleanedData === false ) { - return $this->response->setJSON((['status' => 'error', 'message' => 'Invalid data given'])); - } - - $result = $this->thzMasterNotesModel->insert($data); + $result = $this->thzMasterNotesModel->conversationListPerTicket($thz_id); if(empty($result)){ return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found'])); @@ -112,37 +94,6 @@ class ThzController extends BaseController } - public function conversationListForUserPerTicket(){ - - $data = $this->request->getJson(true); - - $cleanedData = $this->thzControllerCleaner->ticketList($data); - - if( $cleanedData === false ) { - return $this->response->setJSON((['status' => 'error', 'message' => 'Invalid data given'])); - } - - $thz_id = $cleanedData['thz_id'] ?? null; - - $result = $this->thzMasterNotesModel->conversationListForUserPerTicket($thz_id); - - if(empty($result)){ - return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found'])); - } - - return $this->response->setJSON((['status' => 'success', 'data' => $result])); - - } - - public function ticketListForAssignedStaff(){ - - } - - public function conversationListForAssignedStaffPerTicket(){ - - } - - diff --git a/app/Models/ThzMasterNotesModel.php b/app/Models/ThzMasterNotesModel.php index 2072c094..cd02a52c 100644 --- a/app/Models/ThzMasterNotesModel.php +++ b/app/Models/ThzMasterNotesModel.php @@ -40,7 +40,7 @@ class ThzMasterNotesModel extends Model protected $beforeDelete = []; protected $afterDelete = []; - public function conversationListForUserPerTicket($thz_id){ + public function conversationListPerTicket($thz_id){ if(empty($thz_id)){ @@ -50,6 +50,7 @@ class ThzMasterNotesModel extends Model $sql = "SELECT + thz_master.*, thz_master_notes.id, thz_master_notes.thz_id, thz_master_notes.notes, @@ -60,6 +61,7 @@ class ThzMasterNotesModel extends Model thz_master_notes Join thz_master ON thz_master.thz_id = :thz_id: + WHERE thz_master_notes.thz_id = :thz_id: ORDER BY diff --git a/app/Views/DashBoard.php b/app/Views/DashBoard.php index 08e08855..b0cefc4e 100755 --- a/app/Views/DashBoard.php +++ b/app/Views/DashBoard.php @@ -171,79 +171,109 @@ margin: 0 5px 10px!important; } + .nav-link{ + color:black !important; + background-color: #D4F5F6 !important; + font-size: small; + padding:8px; + border-radius: 10px !important; + } + .nav-link.active-tab { + color: white !important; + background-color: #00999E !important; + font-size: small; + padding:8px; + border-radius: 10px !important; + + } + .tab-content-styles{ + background-color:#F4F4F4; + margin-right:20px; + border-radius:25px!important; + min-height: 70vh !important; + } + + +

Dashboard

+
-
-
-
-
-
-
- -
+
-
+
+
+ @@ -257,7 +287,6 @@ - + +
+ + + + + +
+
+
+
+ © NHANCE +
+ +
+
+
+ + +
+ + + + + + +
+ + + +
+
+ +
+ + Notification +
+
+
    + +
+
+ + +
+ + TO DOs +
+
+
    + +
+
+
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index 6ac2e4ee..0b311aee 100755 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -327,6 +327,136 @@ } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ /assets/images/nhance-loader-fast.gif" height="40" width="40" alt="Loading..."> +
+
+ + + +
+ + + + + + +
+ + + + +
+ + + +
+ + +
+ + + + + + +
+
+ + +
\ No newline at end of file diff --git a/app/Views/leads_dash.php b/app/Views/leads_dash.php index 6effa135..b6b24fc4 100644 --- a/app/Views/leads_dash.php +++ b/app/Views/leads_dash.php @@ -1,8 +1,4 @@
-
-
-
-
Leads
-

-

-

 

-

 

+
+
+
+
+

Leads

+

+

+
Lead Tracker
+
-
-
-
-
-
BDS Renewals
-

-

-

 

-

 

+
+
+
+

BDS Renewals

+

+ +

+
Renewal Tracker
+
+
-
+
@@ -164,88 +196,102 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID, user_
- + $value) : ?> + + $value) : ?> - - + 20 ? substr($formattedStatus, 0, 15) . '...' : $formattedStatus; + $showTooltip = strlen($formattedStatus) > 20; + ?> + +
- - $value) : ?> +
- - 20 ? substr($formattedStatus, 0, 15) . '...' : $formattedStatus; - $showTooltip = strlen($formattedStatus) > 20; - ?> - + + // Get the background color for the current tile + $bgColor = $colorShades[$colorSetIndex][$shadeIndex]; + ?> + 20 ? substr($formattedStatus, 0, 15) . '...' : $formattedStatus; + $showTooltip = strlen($formattedStatus) > 20; + ?> + + + +
+ + diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index 0b311aee..59150e0f 100755 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -64,6 +64,9 @@ + + + + + + + @@ -504,8 +531,8 @@
  • - - + + Dashboard
  • @@ -513,8 +540,8 @@
  • - - + /assets/images/clients_sb.png" alt="Logo" height="24"> Clients @@ -524,8 +551,8 @@
  • - - + /assets/images/action_on_policies_sb.png" alt="Logo" height="20"> Action on Policies @@ -556,7 +583,7 @@
  • - + /assets/images/masters_sb.png" alt="Logo" height="20"> Masters @@ -608,7 +635,7 @@
  • - + /assets/images/claims_sb.png" alt="Logo" height="20"> Claims @@ -638,7 +665,7 @@
  • - + /assets/images/leads_sb.png" alt="Logo" height="20"> Leads @@ -649,7 +676,7 @@
  • - + /assets/images/policy_transactions_sb.png" alt="Logo" height="20"> Policy Transactions @@ -798,7 +825,7 @@
  • - + /assets/images/app_content_mng_sb.png" alt="Logo" height="20"> App Content Mgmt @@ -816,7 +843,7 @@
  • - " class="waves-effect" target="_blank" rel="noopener noreferrer"> + " class="waves-effect img-inactive-not-working" target="_blank" rel="noopener noreferrer"> /assets/images/user_manual_sb.png" alt="Logo" height="20"> User Manual @@ -883,6 +910,7 @@
  • +
    diff --git a/app/Views/lead_filter.php b/app/Views/lead_filter.php index 441b363b..86938097 100644 --- a/app/Views/lead_filter.php +++ b/app/Views/lead_filter.php @@ -11,7 +11,7 @@
    -

    Lead Filter

    +

    Lead Filter

    Date: Sat, 16 Aug 2025 18:55:49 +0530 Subject: [PATCH 17/18] CHANGE DASHBOARD THEME NEW - VADIVEL J 2025-08-16 --- app/Config/Routes.php | 4 +- app/Controllers/ThzController.php | 102 +++++++++++++++++++++-------- app/Models/ThzMasterNotesModel.php | 2 +- 3 files changed, 79 insertions(+), 29 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 1cb35d79..dee21c88 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -634,7 +634,7 @@ $routes->post('newClaim','VidalApiController::newClaim'); $routes->post('enrollment','VidalApiController::enrollment'); -$routes->post("ticketCreation", "ThzController::ticketCreation"); +$routes->post("ticketSave", "ThzController::ticketSave"); $routes->post("ticketList", "ThzController::ticketList"); $routes->post("ticketConversationSave", "ThzController::ticketConversationSave"); -$routes->post("conversationListPerTicket", "ThzController::conversationListPerTicket"); \ No newline at end of file +$routes->post("ticketConversationList", "ThzController::ticketConversationList"); \ No newline at end of file diff --git a/app/Controllers/ThzController.php b/app/Controllers/ThzController.php index 6613cb6b..be2d0f5f 100644 --- a/app/Controllers/ThzController.php +++ b/app/Controllers/ThzController.php @@ -29,43 +29,67 @@ class ThzController extends BaseController // } - public function ticketCreation(){ + public function ticketSave(){ $data = $this->request->getJSON(true); - $result = $this->thzMasterModel->insert($data); + if (!empty($data['thz_id'])) { + $data['updated_by'] = get_session_userid(); + $ticket_id = $data['thz_id']; + $text = "update"; + + $result = $this->thzMasterModel->where('thz_id', $ticket_id)->set($data)->update(); + } else { + $data['created_by'] = get_session_userid(); + $text = "create"; + + $result = $this->thzMasterModel->insert($data); + } + + return $this->response->setJSON(([ 'status' => $result ? 'success' : 'error' , + 'message' => $result ? "Ticket {$text}d successfully" : "Unable to {$text} ticket. Please try again." ])); + + - return $this->response->setJSON((['status' => 'success', 'message' => 'Ticket created successfully'])); } + - public function ticketList(){ + public function ticketList() + { - $data = $this->request->getJson(true); - - $id = $data['id'] ?? null; - - if ( isset($id) && !empty($id) ) { - //Find Specific Ticket per id - $mobile = $data['mobile'] ?? null; - $result = $this->thzMasterModel->where('mobile',$mobile)->findAll(); - }else{ - // Find all the Ticket For the Manager who can see all the Tickets - $result = $this->thzMasterModel->findAll(); - } - - if(empty($result)){ - return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found'])); - } - - return $this->response->setJSON((['status' => 'success', 'data' => $result])); + $returnType = strtolower($this->request->getGet('return_type') ?? 'api'); + $data = $this->request->getJSON(true); + + $tickets = $this->fetchTicketsBasedOnrole($data); + + + + if ($returnType === 'api') { + if (empty($tickets)) { + return $this->response->setJSON([ 'status' => 'error','message' => 'No tickets found',])->setStatusCode(404); + } + }else{ + + $data['page_name'] = "Ticket List"; + $data['ticket_data'] = $tickets; + $data['assigner'] = $this->userModel->where('is_active', 1)->findAll(); + return $this->loadLayout('ticket_list_web', $data); + } + + + + return $this->response->setJSON([ + 'status' => 'success', + 'data' => $tickets, + ]); } public function ticketConversationSave(){ - $data = $this->request->getJson(true); + $data = $this->request->getJSON(true); $result = $this->thzMasterNotesModel->insert($data); @@ -78,13 +102,13 @@ class ThzController extends BaseController } - public function conversationListPerTicket(){ + public function ticketConversationList(){ - $data = $this->request->getJson(true); + $data = $this->request->getJSON(true); $thz_id = $data['thz_id'] ?? null; - $result = $this->thzMasterNotesModel->conversationListPerTicket($thz_id); + $result = $this->thzMasterNotesModel->ticketConversationList($thz_id); if(empty($result)){ return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found'])); @@ -114,6 +138,32 @@ class ThzController extends BaseController } + private function fetchTicketsBasedOnrole(array $data): array + { + $id = $data['thz_id'] ?? null; + $assign_to = $data['assign_to'] ?? null; + $mobile = $data['mobile'] ?? null; + + if (!empty($assign_to)) { + // Tickets assigned to a staff + return $this->thzMasterModel + ->where('assign_to', $assign_to) + ->findAll(); + } + + if (!empty($id) && !empty($mobile)) { + // Specific ticket by ID and mobile + return $this->thzMasterModel + ->where('thz_id', $id) + ->where('mobile', $mobile) + ->findAll(); + } + + // All tickets (e.g., for managers) + return $this->thzMasterModel->findAll(); + } + } + diff --git a/app/Models/ThzMasterNotesModel.php b/app/Models/ThzMasterNotesModel.php index cd02a52c..769b505d 100644 --- a/app/Models/ThzMasterNotesModel.php +++ b/app/Models/ThzMasterNotesModel.php @@ -40,7 +40,7 @@ class ThzMasterNotesModel extends Model protected $beforeDelete = []; protected $afterDelete = []; - public function conversationListPerTicket($thz_id){ + public function ticketConversationList($thz_id){ if(empty($thz_id)){ From 5b2299210dea4937a561c2bb085b677c16ab32a2 Mon Sep 17 00:00:00 2001 From: velz Date: Sat, 16 Aug 2025 18:57:52 +0530 Subject: [PATCH 18/18] FIX_CHATBOT_BG_IMG_HEIGHT --- app/Views/chatbot.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Views/chatbot.php b/app/Views/chatbot.php index 89812c6a..4b374423 100644 --- a/app/Views/chatbot.php +++ b/app/Views/chatbot.php @@ -262,9 +262,9 @@ function setupMessageObserver() { const chatElements = doc.querySelectorAll("#messageArea .chat, #messageArea ol.chat, ol.chat"); chatElements.forEach(element => { if (element) { - element.style.setProperty("height", 95 + "vh", "important"); - element.style.setProperty("max-height", 95 + "vh", "important"); - element.style.setProperty("min-height", 95 + "vh", "important"); + element.style.setProperty("height", 85 + "vh", "important"); + element.style.setProperty("max-height", 85 + "vh", "important"); + element.style.setProperty("min-height", 85 + "vh", "important"); element.style.setProperty("transition", "height 0.3s ease", "important"); console.log('Direct style applied to:', element); } @@ -417,9 +417,9 @@ function setupMessageObserver() { const chatElements = doc.querySelectorAll("#messageArea .chat, #messageArea ol.chat, ol.chat"); chatElements.forEach(element => { if (element) { - element.style.setProperty("height", 95 + "vh", "important"); - element.style.setProperty("max-height", 95 + "vh", "important"); - element.style.setProperty("min-height", 95 + "vh", "important"); + element.style.setProperty("height", 85 + "vh", "important"); + element.style.setProperty("max-height", 85 + "vh", "important"); + element.style.setProperty("min-height", 85 + "vh", "important"); } });