From d76e999c93b98d25dc165ef3fdb32b3ab0951e63 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Sat, 3 May 2025 17:35:15 +0530 Subject: [PATCH 1/6] FIX_DEPENDENT_ADD_ERROR --- app/Controllers/EmployeeServiceController.php | 16 +++- app/Controllers/LeadsController.php | 1 + app/Helpers/excel_util_helper.php | 28 ++++++- app/Views/leads_non_eb.php | 34 ++++---- app/Views/policyRegisterModel.php | 81 +++++++++++++------ app/Views/rfq/burglary.php | 28 +++++++ app/Views/rfq/money.php | 4 +- app/Views/view_rfq_non_eb.php | 42 +++++----- 8 files changed, 161 insertions(+), 73 deletions(-) create mode 100644 app/Views/rfq/burglary.php diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index 035fbd37..9917796f 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -1035,6 +1035,14 @@ class EmployeeServiceController extends AdminController // kint::dump($family); $family = data_group_by_family($family)[ $emp_id ];// reason to call this again bring self to first index of the array } + $firstNonTemp = null; + + foreach ($family as $fam) { + if (!isset($fam['temp'])) { + $firstNonTemp = $fam; + break; + } + } // kint::dump($family);//die(); //check name dup within a family @@ -1070,7 +1078,7 @@ class EmployeeServiceController extends AdminController if(!count($self_details)) { array_push($result['error_summary'],14); // Self not found - $result['error_data'][ $family[0][0] ]['sno']['error'][] = "Self not found in Database"; + $result['error_data'][ $firstNonTemp[0] ]['sno']['error'][] = "Self not found in Database"; } } @@ -1078,7 +1086,7 @@ class EmployeeServiceController extends AdminController if($file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'inception'|| $file['action'] == 'missed_inception' || $file['action'] == 'enrollment') { $res = check_dependent_conflict($family,$policy_terms,$file['action'],$is_lgbtq); - // dd($res); + // Kint::dump($res); if(!$res['status']) { foreach($res['error_data'] as $key => $value) @@ -1091,7 +1099,7 @@ class EmployeeServiceController extends AdminController //check dup with empid and name with db $res = name_and_empid_check_in_db($family,$file); - // dd($res); + // Kint::dump($res['del']); // echo '
'; // print_r($res); if(count($res['del'])) @@ -1113,7 +1121,7 @@ class EmployeeServiceController extends AdminController }// end of foreach }// end of if current action I,DA,A - // return $result; + // return $result; // die(); if(isset($result['error_summary']) && count($result['error_summary'])) { diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 79ca3591..3e430d76 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -3077,6 +3077,7 @@ class LeadsController extends BaseController 3 => 'rfq/gmc', 4 => 'rfq/gmc', 5 => 'rfq/gmc', + 17=> 'rfq/burglary', 22 => 'rfq/car', 23 => 'rfq/cpm', 24 => 'rfq/cyber_crime', diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index c13ab491..d2e30828 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -440,8 +440,20 @@ if (!function_exists('name_dup_check_within_family')) foreach ($family_data as $rkey => $row) { if(in_array($row[2],$temp)) - { - array_push($result,$row[0]); + { + // Kint::dump($row); + $emp_code = $row[1]; + $tempFam = null; + foreach ($family_data as $family) { + if ($family[1] == $emp_code &&!isset($family['temp'])) { + $tempFam = $family; + break; // Stop at the first match + } + } + // Kint::dump($tempFam); + // die(); + + array_push($result,$tempFam[0]); } else { @@ -449,7 +461,7 @@ if (!function_exists('name_dup_check_within_family')) } } - + // dd($result); return $result; } } @@ -519,7 +531,15 @@ if (!function_exists('name_and_empid_check_in_db')) } if(($current_action == 'inception' || $current_action == 'dependent_addition' || $current_action == 'addition' || $current_action == 'enrollment') && count($res)) { - array_push($result['i'],$row[0]); + $emp_code = $row[1]; + $tempFam = null; + foreach ($family_data as $family) { + if ($family[1] == $emp_code &&!isset($family['temp'])) { + $tempFam = $family; + break; // Stop at the first match + } + } + array_push($result['i'],$tempFam[0]); } } diff --git a/app/Views/leads_non_eb.php b/app/Views/leads_non_eb.php index fef3f394..ea8761d4 100644 --- a/app/Views/leads_non_eb.php +++ b/app/Views/leads_non_eb.php @@ -242,33 +242,33 @@ hr.solid { -
+ + -
+
diff --git a/app/Views/policyRegisterModel.php b/app/Views/policyRegisterModel.php index 4e2419d9..4eb2c08f 100644 --- a/app/Views/policyRegisterModel.php +++ b/app/Views/policyRegisterModel.php @@ -166,7 +166,21 @@ + + + + + + + + + + + + + +
@@ -358,7 +372,7 @@ $("#policyRiskSplitUpForm").submit(function(event) { event.preventDefault(); - + var isValid = $('#policyRiskSplitUpForm').parsley().validate(); // console.log('isValid', isValid); @@ -403,25 +417,25 @@ let rawMaterial = [...document.querySelectorAll('[id^="rawMaterial_"]')].map(el => Number(el.value) || 0); let findMaterial = [...document.querySelectorAll('[id^="finishedStock_"]')].map(el => Number(el.value) || 0); - totalSI = InProcess.reduce((acc, val) => acc + val, 0) + - rawMaterial.reduce((acc, val) => acc + val, 0) + - findMaterial.reduce((acc, val) => acc + val, 0); + totalSI = InProcess.reduce((acc, val) => acc + val, 0) + + rawMaterial.reduce((acc, val) => acc + val, 0) + + findMaterial.reduce((acc, val) => acc + val, 0); let allowedSI = Number($("#policySI").val()) || 0; - if (totalSI > allowedSI) { + if (totalSI != allowedSI) { toastr.error("Sum Insured Exceeds Allowed Limit", "ERROR"); - return false; + return false; } // console.log("Total SI: ", totalSI); - }else{ + } else { let InProcess = [...document.querySelectorAll('[id^="stockInProcess_"]')].map(el => Number(el.value) || 0); let rawMaterial = [...document.querySelectorAll('[id^="rawMaterial_"]')].map(el => Number(el.value) || 0); let findMaterial = [...document.querySelectorAll('[id^="finishedStock_"]')].map(el => Number(el.value) || 0); - totalSI = InProcess.reduce((acc, val) => acc + val, 0) + - rawMaterial.reduce((acc, val) => acc + val, 0) + - findMaterial.reduce((acc, val) => acc + val, 0); + totalSI = InProcess.reduce((acc, val) => acc + val, 0) + + rawMaterial.reduce((acc, val) => acc + val, 0) + + findMaterial.reduce((acc, val) => acc + val, 0); } } @@ -465,6 +479,7 @@ // console.log("Grouped Data as Objects: ", policyRiskSplitUpData); savePolicyDataLocal(); + }); @@ -678,7 +693,7 @@
- +
@@ -790,11 +805,11 @@
- +
- + > + +
+
+ > + +
+
+ > + +
+ + + +
+ + +
+ + diff --git a/app/Views/rfq/money.php b/app/Views/rfq/money.php index bf8c1bca..e010d772 100644 --- a/app/Views/rfq/money.php +++ b/app/Views/rfq/money.php @@ -2,7 +2,7 @@
-
+
diff --git a/app/Views/view_rfq_non_eb.php b/app/Views/view_rfq_non_eb.php index 364f2d34..fc6193a6 100644 --- a/app/Views/view_rfq_non_eb.php +++ b/app/Views/view_rfq_non_eb.php @@ -536,7 +536,7 @@ // alert(rollover_or_renewal); var policyConfig = { - 1: ['Quote asked'] + 1: ['Sum Insured'] }; let myModal; @@ -634,7 +634,7 @@ let proposalCount = 1; // // console.log("Proposal count changed", proposalCount); let quotesConfig = { - 1: ['Quote asked'] + 1: ['Sum Insured'] }; // Stores quote columns for each proposal @@ -1002,8 +1002,8 @@ proposalCount++; // // console.log("proposal count after ", proposalCount); - quotesConfig[proposalCount] = ['Quote asked']; - policyConfig[proposalCount] = ['Quote asked']; + quotesConfig[proposalCount] = ['Sum Insured']; + policyConfig[proposalCount] = ['Sum Insured']; const tables = document.querySelectorAll('table'); let increaseBy = 150; increaseTableWidth(increaseBy); @@ -1037,7 +1037,7 @@ // Add new quote sub-header const newQuoteHeader = document.createElement('th'); - newQuoteHeader.textContent = 'Quote asked'; + newQuoteHeader.textContent = 'Sum Insured'; newQuoteHeader.style.backgroundColor = randomColor; headerRow2.insertBefore(newQuoteHeader, headerRow2.querySelector('th:last-child')); @@ -1593,7 +1593,7 @@ - ${Object.entries(quotesConfig).flatMap(([proposal, codes]) => codes.map(code => ` - + ${code} - - + + + +
@@ -579,11 +579,12 @@ policyRiskAddress = groupedData; console.log("Grouped Data as Objects: ", policyRiskAddress); - if (productSelectionData.singleProduct == 'on') { - savePolicyDataLocal(); - } else { + // if (productSelectionData.singleProduct == 'on') { + // savePolicyDataLocal(); + // } else { riskSplitup(); - } + // } + }); $("#policyDetailsForm").submit(function(event) { @@ -652,6 +653,14 @@ hideAndShowBurglary(); }) + }else{ + // alert("you got ir"); + policyRiskAddress.forEach(function() { + // console.log("increment count is ", increment2) + addHTMLInputForRiskSplitUP(); + validatePolicyBasedOnProductSelection(); + hideAndShowBurglary(); + }) } } else { if (contianertoCheck.innerHTML == "") { @@ -713,23 +722,23 @@
- +
-
+
- +
- +
- +
- +

@@ -872,7 +881,7 @@
- +
@@ -920,26 +929,13 @@ `; - // newRow2.innerHTML += ` - //
- //
- // - //
- //
- //
- //
- // - //
- //
- - // `; - container.appendChild(newRow); // container.appendChild(newRow2); const selectElement = document.getElementById(`select_location_${increment}`); selectElement.innerHTML = ""; for (let i = 1; i <= policyDetailsData.location_no; i++) { + console.log("location no : ", policyDetailsData.location_no); const option = document.createElement('option'); option.value = `Location ${i}`; option.textContent = `Location ${i}`; @@ -957,37 +953,33 @@ }); - $(document).on('click', '.duplicate-btn', function() { - - - // console.log("button is clicked"); - // console.log("increment cout ", increment); - + $(document).on('click', '.duplicate-btn', function () { if (policyDetailsData.location_no >= increment) { const $rowToClone = $(this).closest('.form-row'); + // Destroy Select2 for the current and previous occupancy fields + $(`#occupancy_${increment}`).select2('destroy'); + $(`#occupancy_${increment - 1}`).select2('destroy'); + // Clone the row const $clone = $rowToClone.clone(); - $clone.find('.select2-hidden-accessible').each(function() { + // Clean up select2 artifacts from the clone + $clone.find('.select2-hidden-accessible').each(function () { $(this).select2('destroy'); }); - $clone.find('.select2-container').remove(); - // Increment the counter - - - // Update all IDs and reset values in the clone - $clone.find('[id]').each(function() { + // Update all IDs in the clone + $clone.find('[id]').each(function () { const oldId = $(this).attr('id'); const newId = oldId.replace(/_(\d+)$/, `_${increment}`); $(this).attr('id', newId); }); - // Update labels to match new IDs - $clone.find('label').each(function() { + // Update all labels + $clone.find('label').each(function () { const oldFor = $(this).attr('for'); if (oldFor) { const newFor = oldFor.replace(/_(\d+)$/, `_${increment}`); @@ -998,18 +990,35 @@ // Insert the cloned row after the original $clone.insertAfter($rowToClone); - let selectedLocation = $(`#select_location_${increment}`).val(); - $(`#select_location_${increment} option[value="${selectedLocation}"]`).remove(); - $(`#occupancy_${increment}`).select2(); + // Refill and update the select_location dropdown + const selectElement = document.getElementById(`select_location_${increment}`); + selectElement.innerHTML = ""; + for (let i = 1; i <= policyDetailsData.location_no; i++) { + const option = document.createElement('option'); + option.value = `Location ${i}`; + option.textContent = `Location ${i}`; + selectElement.appendChild(option); + } + + for (let i = 1;i; var contact_email = ""; var panNo = ; + var buisnessType = ; // console.log("client_type : ".client_type); if (lead_data) { // lead_data = JSON.parse(lead_data); @@ -1407,11 +1420,15 @@ } } + $("#client_type").val(client_type).trigger("change"); $("#insured_name").val(clientName); $("#address1").val(lead_data.address); + $("#pin_code").val(lead_data.pincode); $("#mobile").val(mobile); $("#email").val(contact_email); + console.log("buisness type : ", buisnessType); + $("#type_of_buisness").val(buisnessType); // var policy_type = lead_data.policy_type_id; } } @@ -1544,23 +1561,26 @@ } - function hideShowBasement(incrementFromBasement) { - let isBasement = $(`#isBasement_${incrementFromBasement}`).is(":checked"); + function hideShowBasement(element) { + let elementID = element.id; + let increment = elementID.split("_").pop(); + + let isBasement = $(`#isBasement_${increment}`).is(":checked"); // Get the label associated with the input - let label = $(`label[for='basementSI_${incrementFromBasement}']`); + let label = $(`label[for='basementSI_${increment}']`); if (isBasement) { - $(`#basementSI_${incrementFromBasement}`).parent().show(); - $(`#basementSI_${incrementFromBasement}`).prop("required", "required"); + $(`#basementSI_${increment}`).parent().show(); + $(`#basementSI_${increment}`).prop("required", "required"); // Add * if not already there if (label.find(".text-danger").length === 0) { label.append('*'); } } else { - $(`#basementSI_${incrementFromBasement}`).parent().hide(); - $(`#basementSI_${incrementFromBasement}`).removeAttr("required"); + $(`#basementSI_${increment}`).parent().hide(); + $(`#basementSI_${increment}`).removeAttr("required"); // Remove * if exists label.find(".text-danger").remove(); diff --git a/app/Views/rfq/attachment_files.php b/app/Views/rfq/attachment_files.php index 711fbe84..1b77cfb6 100644 --- a/app/Views/rfq/attachment_files.php +++ b/app/Views/rfq/attachment_files.php @@ -4,7 +4,7 @@
- + diff --git a/app/Views/rfq/blu.php b/app/Views/rfq/blu.php index 93a1f048..c1dccbcb 100644 --- a/app/Views/rfq/blu.php +++ b/app/Views/rfq/blu.php @@ -20,7 +20,11 @@
-
+
+ + +
+
diff --git a/app/Views/rfq/bsu.php b/app/Views/rfq/bsu.php index 93a1f048..c1dccbcb 100644 --- a/app/Views/rfq/bsu.php +++ b/app/Views/rfq/bsu.php @@ -20,7 +20,11 @@
-
+
+ + +
+
diff --git a/app/Views/rfq/burglary.php b/app/Views/rfq/burglary.php index 93a1f048..c1dccbcb 100644 --- a/app/Views/rfq/burglary.php +++ b/app/Views/rfq/burglary.php @@ -20,7 +20,11 @@
-
+
+ + +
+
diff --git a/app/Views/rfq/car.php b/app/Views/rfq/car.php index 7dfc106b..f179e081 100644 --- a/app/Views/rfq/car.php +++ b/app/Views/rfq/car.php @@ -68,7 +68,11 @@
-
+
+ + +
+
diff --git a/app/Views/rfq/cgl.php b/app/Views/rfq/cgl.php index d007dd7d..9468b8d5 100644 --- a/app/Views/rfq/cgl.php +++ b/app/Views/rfq/cgl.php @@ -81,7 +81,11 @@
-
+
+ + +
+
diff --git a/app/Views/rfq/cpm.php b/app/Views/rfq/cpm.php index 532554f2..ac3a5341 100644 --- a/app/Views/rfq/cpm.php +++ b/app/Views/rfq/cpm.php @@ -68,7 +68,11 @@
-
+
+ + +
+
diff --git a/app/Views/rfq/cyber_crime.php b/app/Views/rfq/cyber_crime.php index 5cc31107..27fcac5a 100644 --- a/app/Views/rfq/cyber_crime.php +++ b/app/Views/rfq/cyber_crime.php @@ -14,7 +14,11 @@
-
+
+ + +
+
diff --git a/app/Views/rfq/do.php b/app/Views/rfq/do.php index e9c4e4a8..01efd463 100644 --- a/app/Views/rfq/do.php +++ b/app/Views/rfq/do.php @@ -35,7 +35,11 @@
-
+
+ + +
+
diff --git a/app/Views/rfq/eo.php b/app/Views/rfq/eo.php index 85da140a..8832716e 100644 --- a/app/Views/rfq/eo.php +++ b/app/Views/rfq/eo.php @@ -35,7 +35,11 @@
-
+
+ + +
+
diff --git a/app/Views/rfq/marine.php b/app/Views/rfq/marine.php index a4d68fba..528b6e7b 100644 --- a/app/Views/rfq/marine.php +++ b/app/Views/rfq/marine.php @@ -178,7 +178,11 @@
-
+
+ + +
+
diff --git a/app/Views/rfq/money.php b/app/Views/rfq/money.php index e010d772..59c6ea89 100644 --- a/app/Views/rfq/money.php +++ b/app/Views/rfq/money.php @@ -67,7 +67,11 @@
-
+
+ + +
+
diff --git a/app/Views/rfq/office.php b/app/Views/rfq/office.php index 237bfd29..b958a131 100644 --- a/app/Views/rfq/office.php +++ b/app/Views/rfq/office.php @@ -27,6 +27,10 @@
+
+ + +
diff --git a/app/Views/rfq/sfsp.php b/app/Views/rfq/sfsp.php index f17ee676..54f39441 100644 --- a/app/Views/rfq/sfsp.php +++ b/app/Views/rfq/sfsp.php @@ -35,7 +35,11 @@
-
+
+ + +
+
diff --git a/app/Views/rfq/wc.php b/app/Views/rfq/wc.php index cd374464..150eae7b 100644 --- a/app/Views/rfq/wc.php +++ b/app/Views/rfq/wc.php @@ -33,7 +33,11 @@
-
+
+ + +
+
diff --git a/app/Views/view_rfq_non_eb.php b/app/Views/view_rfq_non_eb.php index fc6193a6..e0abbc8c 100644 --- a/app/Views/view_rfq_non_eb.php +++ b/app/Views/view_rfq_non_eb.php @@ -516,10 +516,13 @@
\ No newline at end of file From fcb650288acb2d8e3736ca95221021eceafc3ce3 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Wed, 7 May 2025 12:35:25 +0530 Subject: [PATCH 4/6] FIX_DROPDOWN_WIDTH_NONEB_SRI --- app/Views/policyRegisterModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Views/policyRegisterModel.php b/app/Views/policyRegisterModel.php index fc5170e3..f9b1ee91 100644 --- a/app/Views/policyRegisterModel.php +++ b/app/Views/policyRegisterModel.php @@ -858,7 +858,7 @@
-
+
> - +
Date: Wed, 7 May 2025 17:12:35 +0530 Subject: [PATCH 6/6] FIX_MIXED_INCEPTION : RV --- app/Controllers/EmpDataServiceController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index d13676aa..19d57a7d 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -949,6 +949,9 @@ class EmpDataServiceController extends BaseController $export_data['event_type'] = 'correction'; $correctionData = $this->employeePolicyModel->getCorrectionEmployeesDataForExportExcel($export_data); + }else if($value == "missed_inception"){ + $export_data['event_type'] = 'missed_inception'; + $additionData = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data); } }