From e190a4d4e4420aaca2e497e868fa4183d34cd289 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 27 May 2025 21:14:05 +0530 Subject: [PATCH 01/27] FIX_ISSUE : RV --- app/Config/Routes.php | 4 +- app/Controllers/ClientController.php | 6 +- app/Controllers/EmployeeRestController.php | 20 ++++- app/Controllers/LeadsController.php | 91 +++++++++++++++------- app/Models/ClientPolicyModel.php | 1 + app/Views/leads_form_handler.php | 8 +- app/Views/view_rfq.php | 23 ++++-- app/Views/view_rfq_non_eb.php | 4 +- 8 files changed, 115 insertions(+), 42 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index f11f6451..73fe07a4 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -332,7 +332,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) { $routes->get("send_manual_ecard/(:any)", "DashboardController::sendManualEcard/$1"); $routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1"); $routes->get("get_client_branch_data/(:any)", "ClientController::get_client_branch_data/$1"); - $routes->get("getLevelContects", "LeadsControllerg::getLevelContects"); + $routes->get("getLevelContects", "LeadsController::getLevelContects"); $routes->get("get_emp_master_data_for_update/(:any)", "EmployeeController::get_emp_master_data_for_update/$1"); $routes->get("send_mail_for_individual_employee_ecard/(:any)", "EmployeeController::send_mail_for_individual_employee_ecard/$1"); $routes->post("update_emp_data", "EmployeeController::update_emp_data"); @@ -524,6 +524,8 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { $routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy"); $routes->get("getFEContent", "EmployeeRestController::getFEContent"); $routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage"); + $routes->get("getWellnessURL", "EmployeeRestController::getWellnessURL"); + // $routes->post('postDataForTicket',"EmployeeRestController::postDataForTicket"); }); $routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy"); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 98528212..de6ccae8 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -687,6 +687,7 @@ class ClientController extends AdminController $CD_Account_Number = $this->CDMasterModel ->where('client_id', $client_id) ->where('insurer_id', $insurer_id) + ->where('is_active', 1) ->first(); // Prepare the array with data $date = \DateTime::createFromFormat('d/m/Y', $record_date); @@ -2092,7 +2093,7 @@ class ClientController extends AdminController ->findAll(); $client_policy_list = $this->clientPolicyModel->getPolicyTypeForPolicyBinding($client_id); - $cd_data = $this->CDMasterModel->where('client_id', $client_id)->where('insurer_id', $insurer_id)->findAll(); + $cd_data = $this->CDMasterModel->where('client_id', $client_id)->where('insurer_id', $insurer_id)->where('is_active', 1)->findAll(); // $client_policy_data['policy_end_date'] = date('d/m/Y', strtotime($client_policy_data['policy_end_date'])); $fromDate = new \DateTime($client_policy_data['policy_end_date']); $fromDate->modify('+1 year'); @@ -3882,6 +3883,7 @@ class ClientController extends AdminController $cdmData = $this->CDMasterModel ->where('client_id', $client) ->where('insurer_id', $insurer) + ->where('is_active', 1) ->findAll(); if ($cdmData) { @@ -4720,7 +4722,7 @@ class ClientController extends AdminController // $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live // $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //for live // $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 1205]); //for live - $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 214]); //for live + // $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 214]); //for live // $result = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data); // print_rr($result); die; diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 3feb5558..711366a3 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -1100,7 +1100,7 @@ class EmployeeRestController extends AdminController $keysToRemove = ["removable_keys"]; // Retrieve employee policy data by passing the employee primary key $empPolicy = $this->employeeModel->getEmployeePolicy($id); -// dd($empPolicy); + // dd($empPolicy); // Retrieve employee and dependents data by passing the employee code $employeeData = $this->employeeModel->where('emp_code',$emp_code) ->where('client_id',$client_id) @@ -3323,4 +3323,22 @@ class EmployeeRestController extends AdminController return $this->response->setJSON(['ticket_data' => $ticket_data])->setStatusCode(200); } + public function getWellnessUrl() + { + $url = "https://aam.mohfw.gov.in/home/login"; + + if (!empty($url)) { + return $this->respond([ + 'status' => 'success', + 'data' => $url + ], 200); + } else { + return $this->respond([ + 'status' => 'failed', + 'message' => 'No link found' + ], 200); + } + } + + } \ No newline at end of file diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 1c124a37..ee2b7cf4 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -724,6 +724,9 @@ class LeadsController extends BaseController $data['mail_content'] = $this->transformMailContent($lead_data, $mail_content, $data['page_name']); $data['subject'] = $this->transformMailContent($lead_data, $subject, $data['page_name']); + + $data['placement_mail_content'] = $this->transformMailContent($lead_data, $mail_content, 'Placement'); + $data['placement_subject'] = $this->transformMailContent($lead_data, $subject, 'Placement'); $data['multi_file_data'] = $this->leadFilesModel->where('lead_id', $id)->where('is_active', 1)->findAll() ?? null; $installment_data['installments'] = $this->leadInstallmentPaymentDetails->where('lead_id', $id)->where('is_active', 1)->findAll() ?? null; @@ -1199,13 +1202,14 @@ class LeadsController extends BaseController public function constructExcelToSaveTemp($lead_id, $type, $propsal_and_insurer = null) { $rfq_data = $this->RFQModel->getRFQTableDataWithLeadIDAndType($lead_id, $type); + $is_placement = false; // dd($rfq_data, $lead_id, $type, $propsal_and_insurer); // print_r($propsal_and_insurer); die; if ($rfq_data['lead_type'] == 1) { - if ($rfq_data['policy_type_id'] == 2) { + if (in_array($rfq_data['policy_type_id'], [2,3,4,5])) { $lead_data = [ 'Insured' => $rfq_data['client_name'], 'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "", @@ -1217,7 +1221,7 @@ class LeadsController extends BaseController 'Period of Insurance ' => !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", // 'Policy Run Days' => $rfq_data['policy_run_days'], ]; - } else if ($rfq_data['policy_type_id'] == 1) { + } else if (in_array( $rfq_data['policy_type_id'], [1, 6, 7])) { $lead_data = [ 'Insured' => $rfq_data['client_name'], 'No of Employees at Inception' => $rfq_data['incept_emp_count'], @@ -1228,7 +1232,7 @@ class LeadsController extends BaseController } } else { - if ($rfq_data['policy_type_id'] == 2) { + if (in_array($rfq_data['policy_type_id'], [2,3,4,5])) { $lead_data = [ 'Insured' => $rfq_data['client_name'], @@ -1256,7 +1260,7 @@ class LeadsController extends BaseController 'Incurred Claims Ratio' => $rfq_data['incurred_claims_ratio'], 'Earned Claims Ratio' => $rfq_data['earned_claims_ratio'], ]; - } else if ($rfq_data['policy_type_id'] == 1) { + } else if (in_array( $rfq_data['policy_type_id'], [1, 6, 7])) { $lead_data = [ 'Insured' => $rfq_data['client_name'], 'No of Employees at Renewal' => $rfq_data['renewal_emp_count'], @@ -1279,6 +1283,7 @@ class LeadsController extends BaseController if ($propsal_and_insurer !== null) { list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2); $data = $this->transformProposelData($data, $proposal_key, $insurer_key); + $is_placement = true; } } else if ($type == 1) { $sheetName = 'RFQ'; @@ -1382,7 +1387,11 @@ class LeadsController extends BaseController ], ]); $subheader_count = array_sum(array_map(fn($header) => count($header['subHeaders']), $data['table_data']['headers'])); - $subheader_count = $subheader_count - 2; + + if($is_placement == false){ + $subheader_count = $subheader_count - 2; + } + $headerCount = count($data['table_data']['headers']); $lastColumn = Coordinate::stringFromColumnIndex($subheader_count); // dd( $headerCount, $lastColumn); @@ -1428,7 +1437,11 @@ class LeadsController extends BaseController $subHeaderCount = count($header['subHeaders']); // Number of subheaders for this parent header // Set parent header value - $sheet->setCellValue("{$startColumn}{$rowNumber}", $header['parentHeader']); + if($is_placement == true && !in_array($header['parentHeader'] , ['Particulars', 'S.No.'])){ + $sheet->setCellValue("{$startColumn}{$rowNumber}", "Terms"); + }else{ + $sheet->setCellValue("{$startColumn}{$rowNumber}", $header['parentHeader']); + } $sheet->getStyle("{$startColumn}{$rowNumber}")->applyFromArray([ 'font' => ['bold' => true], 'alignment' => [ @@ -1448,7 +1461,7 @@ class LeadsController extends BaseController // Add subheaders foreach ($header['subHeaders'] as $subHeader) { - if($type == 2){ + if($type == 2 && $is_placement == false){ $sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader); } @@ -1458,13 +1471,16 @@ class LeadsController extends BaseController $sheet->getColumnDimension('A')->setWidth(10); } - $sheet->getStyle("{$columnLetter}{$subHeaderRow}")->applyFromArray([ - 'font' => ['bold' => true], - 'alignment' => [ - 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, - 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, - ], - ]); + if($is_placement == false){ + $sheet->getStyle("{$columnLetter}{$subHeaderRow}")->applyFromArray([ + 'font' => ['bold' => true], + 'alignment' => [ + 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, + 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, + ], + ]); + } + $columnLetter++; // Move to the next column for subheaders } } @@ -1485,7 +1501,12 @@ class LeadsController extends BaseController $sheet->getRowDimension($rowNumber)->setRowHeight(25); // Header row height $sheet->getRowDimension($subHeaderRow)->setRowHeight(20); // Subheader row height - $rowNumber = $subHeaderRow + 2; + if($is_placement == true){ + $rowNumber = $subHeaderRow; + }else{ + $rowNumber = $subHeaderRow + 2; + } + // dd($rowNumber); $column_data = $data['table_data']['data']; $serial_no = 1; $maxColumnWidths = []; @@ -1521,7 +1542,7 @@ class LeadsController extends BaseController ], ]); - + //premium data if ($type == 2) { $rowNumber += 2; @@ -1558,9 +1579,14 @@ class LeadsController extends BaseController $rowNumber++; } - $prevColumn3 = $this->getPreviousColumn($columnLetter, 2); + if($is_placement == true){ + $prevColumn3 = $this->getPreviousColumn($columnLetter); + }else{ + $prevColumn3 = $this->getPreviousColumn($columnLetter, 2); + } $premiumRange = "B" . ($rowNumber - 4) . ":" . "{$prevColumn3}" . ($rowNumber - 1); // dd($premiumRange); + $sheet->getStyle($premiumRange)->applyFromArray([ 'borders' => [ 'allBorders' => [ @@ -1575,7 +1601,11 @@ class LeadsController extends BaseController //set imgage and align the row and column // Kint::dump($columnLetter); if($type == 2){ - $columnLetter_img = $this->getPreviousColumn($columnLetter, 2); + if($is_placement == true){ + $columnLetter_img = $this->getPreviousColumn($columnLetter); + }else{ + $columnLetter_img = $this->getPreviousColumn($columnLetter, 2); + } }else{ $columnLetter_img = $this->getPreviousColumn($columnLetter); } @@ -1667,7 +1697,7 @@ class LeadsController extends BaseController // Set filename - $string = ($type == 2) ? 'QCR' : 'RFQ'; + $string = ($type == 2) ? ( $is_placement == true ? 'Placement' : 'QCR') : 'RFQ'; $current_year = date('Y'); $next_year = $current_year + 1; $policy_year = "$current_year-$next_year"; @@ -2490,7 +2520,7 @@ class LeadsController extends BaseController $headerData[] = [ 'parentHeader' => $header['parentHeader'], 'subHeaders' => [ - 'Quote Asked', // Default value + // 'Quote Asked', // Default value $subHeader // Matched insurer key ] ]; @@ -2526,15 +2556,16 @@ class LeadsController extends BaseController ]; } - // Include Proposal with Quote Asked by default - if ($item['parentth'] === $proposel && $item['subth'] === "Quote Asked") { - $result['data'][] = [ - "parentth" => $item['parentth'], - "subth" => $item['subth'], - "value" => $item['value'], - "input_value" => $item['input_value'] - ]; - } + // Include Proposal with Quote Asked by default + /* For proposel do not remove it */ + // if ($item['parentth'] === $proposel && $item['subth'] === "Quote Asked") { + // $result['data'][] = [ + // "parentth" => $item['parentth'], + // "subth" => $item['subth'], + // "value" => $item['value'], + // "input_value" => $item['input_value'] + // ]; + // } // Example of including matching specific proposals and insurers if ($item['parentth'] === $proposel && $item['subth'] === $insurer) { @@ -2555,7 +2586,7 @@ class LeadsController extends BaseController foreach ($data['premium_data']['data'] as $key => $value) { if ($key === $proposel) { - $premiumData[$key]['Quote Asked'] = $value['Quote Asked']; + // $premiumData[$key]['Quote Asked'] = $value['Quote Asked']; $premiumData[$key][$insurer] = $value[$insurer]; } } diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php index d456c311..e1f97747 100755 --- a/app/Models/ClientPolicyModel.php +++ b/app/Models/ClientPolicyModel.php @@ -180,6 +180,7 @@ class ClientPolicyModel extends Model ->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') + ->where('cd_master.is_active', 1) ->groupBy('client_policy.insurer_id') ->groupBy('client_policy.client_id', $id) // Group by insurer_id ->get() diff --git a/app/Views/leads_form_handler.php b/app/Views/leads_form_handler.php index cc06b807..09a630e8 100644 --- a/app/Views/leads_form_handler.php +++ b/app/Views/leads_form_handler.php @@ -874,6 +874,7 @@ if (isset($selected_lead_type)) { let lead_type = data.lead_type || null; waitForDropdownValue('#client_id', data.client_id || '', () => { + if (lead_type == 3) { // Add "+ Add Client" option if not already present if ($('#client_id option[value="add_client"]').length === 0) { @@ -888,7 +889,12 @@ if (isset($selected_lead_type)) { $("#source_policy_id").closest("div").find("label .text-danger").remove(); } else { - $("#source_policy_id").prop("required", true); + + if(lead_type == 2){ + $("#source_policy_id").prop("required", true); + }else{ + $("#source_policy_id").prop("required", false); + } // Add asterisk if not present let $label = $("#source_policy_id").closest("div").find("label"); diff --git a/app/Views/view_rfq.php b/app/Views/view_rfq.php index e42d2e2b..6afdc460 100644 --- a/app/Views/view_rfq.php +++ b/app/Views/view_rfq.php @@ -588,7 +588,7 @@
- " placeholder="Enter Subject"> + " placeholder="Enter Subject">
@@ -596,7 +596,7 @@
- +
@@ -861,12 +861,25 @@ @@ -395,11 +451,11 @@ function specialConditionForOthers(count = 0) { var appendElement = `
- +
`; console.log($(this)); $('.other_special_condition').each(function() { @@ -465,208 +521,208 @@ function appendPolicyTermsHTML(policy_type) { var termsHTML = "" $('#append_html_for_other_policy_terms').empty(); - if (policy_type == 7) { + // if (policy_type == 7) { - termsHTML = ` + // termsHTML = ` -
+ //
-
-
- -
-
- -
-
- -
-
-
-
-
-
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
+ // + //
+ //
+ //
+ //
+ //
+ //
+ //
-
+ //
-
-
- -
-
- -
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
-
-
- -
-
- -
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
-
-
- -
-
- -
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
-
-
- -
-
- -
-
-
-
-
-
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
+ //
+ //
+ //
+ //
+ //
-
-
- -
-
- -
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
-
-
- -
-
- -
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
-
-
- -
-
- -
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
-
-
- -
-
- -
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
-
-
- -
-
- -
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
-
+ //
- ` + // ` - } else if (policy_type == 6) { + // } else if (policy_type == 6) { - termsHTML = ` + // termsHTML = ` -
+ //
-
-
- -
-
- -
-
- -
-
-
-
-
-
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
+ // + //
+ //
+ //
+ //
+ //
+ //
+ //
-
+ //
-
-
- -
-
- -
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
-
-
- -
-
- -
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
-
-
- -
-
- -
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
-
-
- -
-
- -
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
-
-
- -
-
- -
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
-
-
- -
-
- -
-
+ //
+ //
+ // + //
+ //
+ // + //
+ //
-
+ //
- ` - } + // ` + // } $('#append_html_for_other_policy_terms').append(termsHTML); } @@ -699,4 +755,13 @@ function appendOtherSIAddMore(data = null) { addMoreContainer.insertAdjacentHTML('beforeend', html); } + +function beautifyString(str) { + return str + .split('_') // Split the string by underscores + .map(word => + word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() // Capitalize each word + ) + .join(' '); // Join with spaces instead of underscores +} \ No newline at end of file diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php index 68ae324d..04f29286 100755 --- a/app/Views/policy_gmc_terms.php +++ b/app/Views/policy_gmc_terms.php @@ -1,75 +1,75 @@ @@ -158,7 +158,7 @@ label {
Min Age:
@@ -326,10 +326,10 @@ label {
- +
- +
@@ -405,10 +405,10 @@ label { id="9monthwaitingperiodwaived_display" class="unchecked" checked>
- +
- +
@@ -418,7 +418,7 @@ label { id="maternitycoverage_display" class="unchecked" checked>
- +
@@ -431,7 +431,7 @@ label { id="twindelivery_display" class="unchecked" checked>
- +
@@ -457,7 +457,7 @@ label { id="preandpostnatal_display" class="unchecked" checked>
- +
@@ -483,7 +483,7 @@ label { id="babyday1cover_display" class="unchecked" checked>
- +
@@ -496,7 +496,7 @@ label { id="coverfromthedateofjoining_display" class="unchecked" checked>
- +
- +
- +
- +
@@ -564,7 +564,7 @@ label { id="congenitaldiseasesexternal_display" class="unchecked" checked>
- +
- +
@@ -617,7 +617,7 @@ label { id="proportionatedeductionclause_display" class="unchecked" checked>
- +
@@ -643,7 +643,7 @@ label { id="ailment_capping_details_display" class="unchecked" checked>
- +
@@ -656,7 +656,7 @@ label { id="corporatebuffer_display" class="unchecked" checked>
- +
@@ -683,7 +683,7 @@ label { id="ambulancecharges_display" class="unchecked" checked>
- +
@@ -696,7 +696,7 @@ label { id="airambulance_display" class="unchecked" checked>
- +
@@ -735,7 +735,7 @@ label { id="lasiksurgery_display" class="unchecked" checked>
- +
@@ -744,14 +744,14 @@ label {
- +
- +
@@ -761,7 +761,7 @@ label { id="moderntreatmentsasperirdai_display" class="unchecked" checked>
- +
- +
@@ -801,7 +801,7 @@ label { id="days_from_dod_display" class="unchecked" checked>
- +
@@ -817,7 +817,7 @@ label {
- +
@@ -849,7 +849,7 @@ label {
- +
@@ -880,584 +880,191 @@ label { + + + + + + + + + - - - - - - - - - \ No newline at end of file diff --git a/app/Views/policy_gpa_terms.php b/app/Views/policy_gpa_terms.php index 3ad9d2be..0424063f 100755 --- a/app/Views/policy_gpa_terms.php +++ b/app/Views/policy_gpa_terms.php @@ -784,6 +784,7 @@ $('body').on('click', '.btnPolicyMaster', function() { .next()[0]; $(element).css("display", ""); } + disableUnwantedTermsforGPA(jsonObject); Object.keys(jsonObject).forEach(function(key) { @@ -853,6 +854,34 @@ $('body').on('click', '.btnPolicyMaster', function() { \ No newline at end of file diff --git a/app/Views/rfq/blu.php b/app/Views/rfq/blu.php index c1dccbcb..09f7a164 100644 --- a/app/Views/rfq/blu.php +++ b/app/Views/rfq/blu.php @@ -11,11 +11,11 @@
> - +
> - +
diff --git a/app/Views/rfq/bsu.php b/app/Views/rfq/bsu.php index c1dccbcb..09f7a164 100644 --- a/app/Views/rfq/bsu.php +++ b/app/Views/rfq/bsu.php @@ -11,11 +11,11 @@
> - +
> - +
diff --git a/app/Views/rfq/burglary.php b/app/Views/rfq/burglary.php index c1dccbcb..09f7a164 100644 --- a/app/Views/rfq/burglary.php +++ b/app/Views/rfq/burglary.php @@ -11,11 +11,11 @@
> - +
> - +
diff --git a/app/Views/ticket_list.php b/app/Views/ticket_list.php index d3408054..b81836f1 100644 --- a/app/Views/ticket_list.php +++ b/app/Views/ticket_list.php @@ -297,11 +297,12 @@ $(document).ready(function() { function viewTicket(ticket_id){ - $('.loader').fadeIn(); - $('.loader-mask').fadeIn(); + // $('.loader').fadeIn(); + // $('.loader-mask').fadeIn(); + + let url = '' + ticket_id; + window.open(url, '_blank'); - let url = '' + ticket_id - window.location.href = url } diff --git a/app/Views/view_rfq_non_eb.php b/app/Views/view_rfq_non_eb.php index 183a1bb1..aa289999 100644 --- a/app/Views/view_rfq_non_eb.php +++ b/app/Views/view_rfq_non_eb.php @@ -295,6 +295,7 @@ " /> +
@@ -629,6 +630,27 @@ myModal = new bootstrap.Modal(document.getElementById('policyRegisterModel')); // monitorTableChanges(); }); + + $(document).ready(function () { + + console.log("Document ready"); + + let lead_status = ''; + console.log('Lead status retrieved:', lead_status); + + if (lead_status != "won") { + console.log("Lead status is not 'won', setting interval for submitData"); + + setInterval(function () { + console.log("Calling submitData(1) at 20-second interval"); + saveRFQ(true); + }, 20000); + } else { + console.log("Lead status is 'won', submitData will not be called"); + } + }); + + var tableCount = 0; const policies = ; // // console.log('policies', policies); @@ -2473,10 +2495,7 @@ table_type: "new", table_id: `${policyName}_summary_` + locationIndex, table_editable: true, - table_name: "Risk Location " + locationIndex + "- " + - storedData.locations[i].policyRisk['occupancy'] + "- " + - storedData.locations[i].policyRisk['address1'] + " " + - storedData.locations[i].policyRisk['address2'], + table_name: "Risk Location " + locationIndex, table_row_contents: rowContents }); } @@ -2548,17 +2567,17 @@ return null; // If canceled, return null } - function saveRFQ() { + function saveRFQ(isAutoSave = false) { // alert("Function Called"); isSaved = true; // // console.log("save button clicked"); leadJson = tablesToJson(); - // // console.log("json from function ", leadJson); + console.log("json from function ", leadJson); var policyJson = localStorage.getItem("policyData") ?? null; - saveRFQTODB(leadJson, policyJson); + saveRFQTODB(leadJson, policyJson, isAutoSave); } - function saveRFQTODB(tableJSON, policyJson) { + function saveRFQTODB(tableJSON, policyJson,isAutoSave = false) { let submit_type = "RFQ" if(rfq_or_qcr == 2){submit_type = 'QCR'} @@ -2570,9 +2589,20 @@ registration_json: policyJson } + let rfq_primaryKey = $('#rfq_primaryKey').val(); + + if (isAutoSave) { + formData['rfq_primaryKey'] = rfq_primaryKey; + } + var url = ''; - $('.loader').fadeIn(); - $('.loader-mask').fadeIn(); + + if (!isAutoSave) { + + $('.loader').fadeIn(); + $('.loader-mask').fadeIn(); + } + $.ajax({ url: url, @@ -2583,24 +2613,27 @@ console.log('RFQ NON EB FORM SUBMIT RESPONSE : ', response); if (response.status == true) { - localStorage.removeItem('policyData'); - toastr.success(response.message, "Success"); - // // console.log(rfq_data.length); - $('.actionBtns').show(); - if (rfq_or_qcr == 2) { - $("#openQCR").hide(); + if (!isAutoSave) { + + localStorage.removeItem('policyData'); + + $('.actionBtns').show(); + if (rfq_or_qcr == 2) { + $("#openQCR").hide(); + } } - // window.location.reload(); } else { toastr.error(response.message, "Error"); $('.actionBtns').hide(); } - $('.loader').fadeOut(); - $('.loader-mask').delay(350).fadeOut('slow'); - window.location.reload(); + if (!isAutoSave) { + $('.loader').fadeOut(); + $('.loader-mask').delay(350).fadeOut('slow'); + window.location.reload(); + } }, error: function(xhr, status, error) { $('.loader').fadeOut(); From 4005e951c319ec9e1c7e6ff7815ee3acfbf3dd9c Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 28 May 2025 17:36:50 +0530 Subject: [PATCH 04/27] FIX_LEAD_CALCULATION : RV --- app/Views/leads_form.php | 23 ++++++++++++++++--- .../policy_transaction_inception_form.php | 8 +++---- app/Views/rfq/gmc.php | 6 ++--- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/app/Views/leads_form.php b/app/Views/leads_form.php index 23209757..92d4435f 100644 --- a/app/Views/leads_form.php +++ b/app/Views/leads_form.php @@ -544,7 +544,11 @@ let increment = this.input.id.split('_').pop(); console.log('Extracted increment:', increment); + let lead_type = $('#lead_type').val(); var policyStartDate = $("#source_policy_start_date"); + if(lead_type == 3){ + policyStartDate = $("#policy_start_date"); + } console.log('Selected Dates:', selectedDates); console.log('policy start date instance', policyStartDate) console.log('Policy Start Date:', policyStartDate.val()); @@ -909,6 +913,10 @@ console.log('Extracted increment:', increment); var policyStartDate = $("#source_policy_start_date"); + if(lead_type == 3){ + policyStartDate = $("#policy_start_date"); + } + console.log('Selected Dates:', selectedDates); console.log('policy start date instance', policyStartDate) console.log('Policy Start Date:', policyStartDate.val()); @@ -1155,8 +1163,11 @@ console.log('calculatePolicyRunDays function called'); console.log('increment', increment); - + let lead_type = $('#lead_type').val(); var policyStartDate = $("#source_policy_start_date"); + if(lead_type == 3){ + policyStartDate = $("#policy_start_date"); + } var policyStartDate = flatpickr.parseDate(policyStartDate.val(), "d/m/Y"); var incurredClaimDate = flatpickr.parseDate($("#incurred_claim_date_" + increment).val(), "d/m/Y"); @@ -1207,8 +1218,14 @@ // Prevent division by zero in incurred claim ratio calculation let premium_as_on_date = Number($('#premium_date_' + increment).val()) || 0; - let incurred_claim_ratio = annualised_claims > 0 ? annualised_claims / premium_as_on_date : 0; - let incurred_claim_ratio_roundoff = Math.round(incurred_claim_ratio); + let incurred_claim_ratio = (annualised_claims > 0 && premium_as_on_date > 0) + ? (annualised_claims / premium_as_on_date) + : 0; + + let incurred_claim_ratio_roundoff = isFinite(incurred_claim_ratio) + ? Math.round(incurred_claim_ratio) + : 0; + console.log('incurred_claim_ratio', incurred_claim_ratio_roundoff); $('#incurred_claims_ratio_' + increment).val(incurred_claim_ratio_roundoff); diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php index ad4f430c..93cc234d 100644 --- a/app/Views/policy_transaction_inception_form.php +++ b/app/Views/policy_transaction_inception_form.php @@ -3854,15 +3854,15 @@ $('#policy_no').change(function(){ if(res.status == true){ $('#ct_type').val(1); - $('#client_policy_id').val(res.data.client_policy_id); + $('#client_policy_id').val(res.data.id); $('#policy_start_date').val(res.data.policy_start_date); $('#policy_end_date').val(res.data.policy_end_date); $('#tpa').val(res.data.tpa_branch_id+'-'+res.data.tpa_id).select2(); }else{ $('#ct_type').val(2); - $('#client_policy_id').val(); - $('#policy_start_date').val(); - $('#policy_end_date').val(); + $('#client_policy_id').val(''); + $('#policy_start_date').val(''); + $('#policy_end_date').val(''); $('#tpa').val('').select2(); console.log(res.message, 'warning'); } diff --git a/app/Views/rfq/gmc.php b/app/Views/rfq/gmc.php index 884428b3..9700a144 100644 --- a/app/Views/rfq/gmc.php +++ b/app/Views/rfq/gmc.php @@ -30,7 +30,7 @@