From 21310082a032c24a4b1ee5a216be878e4aabf01e Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Sat, 11 Oct 2025 15:32:27 +0530 Subject: [PATCH] CHANGE_EB_EXCEL_CHANGE : RV --- app/Controllers/LeadsController.php | 38 ++++-- app/Views/leads_form.php | 176 +++++++++++++++++++++++++--- app/Views/leads_form_handler.php | 1 - app/Views/rfq/gpa.php | 79 ++++++++++--- 4 files changed, 252 insertions(+), 42 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 40afde50..59608e7e 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -138,7 +138,10 @@ class LeadsController extends BaseController $this->cause_of_death = [ 'natural_death' => 'Natural Death', 'suicide' => 'Suicide', - 'accident' => 'Accident' + 'accident' => 'Accident', + 'cardiac_arrest' => 'Cardiac Arrest', + 'septic_shock' => 'Septic shock', + 'heart_attack' => 'Heart Attack', ]; $this->member_data_excel_columns = [ @@ -2408,8 +2411,11 @@ class LeadsController extends BaseController $row = 2; foreach ($claim_details['finyear'] as $record) { $col = 'A'; - foreach ($record as $value) { + foreach ($record as $array_key => $value) { $label = ucwords(str_replace('_', ' ', ($value ?? ""))); + if(in_array($array_key, ['sum_insured', 'claim_amount', 'settled'])){ + $label = formatIndianCurrency(intval($label)); + } $sheet->setCellValue($col . $row, $label); $col++; } @@ -2427,19 +2433,27 @@ class LeadsController extends BaseController } // Enable wrap text for all cells - $maxColLetter = chr(64 + count($headers)); // Last column letter - $sheet->getStyle("A2:{$maxColLetter}{$row}")->getAlignment()->setWrapText(true); + // $maxColLetter = chr(64 + count($headers)); // Last column letter + // $sheet->getStyle("A2:{$maxColLetter}{$row}")->getAlignment()->setWrapText(true); - // Optional: center vertically for neatness - $sheet->getStyle("A2:{$maxColLetter}{$row}")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER); + // // Optional: center vertically for neatness + // $sheet->getStyle("A2:{$maxColLetter}{$row}")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER); - // Optional: Make row height auto (helps when wrap text is on) - for ($i = 2; $i < $row; $i++) { - $sheet->getRowDimension($i)->setRowHeight(-1); - } + $maxColLetter = chr(64 + count($headers)); + $dataRange = "A1:{$maxColLetter}" . ($row - 1); - } - } + $sheet->getStyle($dataRange)->getAlignment() + ->setWrapText(true) + ->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER) + ->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER); + + // Optional: Make row height auto (helps when wrap text is on) + for ($i = 2; $i < $row; $i++) { + $sheet->getRowDimension($i)->setRowHeight(-1); + } + + } + } // Save to temporary location $uploadFilePath = WRITEPATH . 'tmp/' . $filename; diff --git a/app/Views/leads_form.php b/app/Views/leads_form.php index 12ef9a30..52902934 100644 --- a/app/Views/leads_form.php +++ b/app/Views/leads_form.php @@ -1862,6 +1862,7 @@ let claimData = []; $(".claim-row").each(function() { + let year = $(this).find("[name='first_year[]']").val(); let claimAmount = $(this).find("[name='first_claim_amount[]']").val(); let claimStatus = $(this).find("[name='first_claim_status[]']").val(); @@ -1869,13 +1870,22 @@ let causeOfDeath = $(this).find("[name='first_cause_of_death[]']").val(); let deathDate = $(this).find("[name='first_death_date[]']").val(); + let emp_id = $(this).find("[name='emp_id[]']").val(); + let emp_name = $(this).find("[name='emp_name[]']").val(); + let gender = $(this).find("[name='gender[]']").val(); + let designation = $(this).find("[name='designation[]']").val(); + let sum_insured = $(this).find("[name='sum_insured[]']").val(); + claimData.push({ "year": year, - "claim_amount": claimAmount, - "status": claimStatus, - "claim_type": claimType, + "emp_id": emp_id, + "emp_name": emp_name, + "gender": gender, + "designation": designation, + "sum_insured": sum_insured, + "death_date": deathDate, "cause_of_death": causeOfDeath, - "death_date": deathDate + "settled": claimAmount, }); }); @@ -1893,6 +1903,93 @@ //----------------------------------------------------------------------------------------------------------- + // do not remove this + // function appendThreeYearsClaims(count) { + + // // let count = $('#appendAreaForClaim').data('count'); + // console.log("count", count); + + // let policy_type_id = $('#policy_type_id_' + count).val() + // console.log('policy_type_id', policy_type_id); + + // console.log('claimIndex from parent', claimIndex); + // let increment = claimIndex; + + // let claimsFields = ` + //
+ + //
+ // + // + //
+ //
+ // + // + //
+ //
+ // + // + //
+ // + // + // + //
+ //
+ // x + // + + //
+ //
+ //
+ // `; + + // // Append new claim fields + // let referenceDiv = document.getElementById('appendAreaForClaim_' + count); + + // if (referenceDiv) { + // referenceDiv.insertAdjacentHTML('beforeend', claimsFields); + // } else { + // console.error('Element not found: appendAreaForClaim_' + count); + // } + + // // Increment claim index + // console.log("claim index " + claimIndex); + // claimIndex++; + // console.log("after claim index " + claimIndex); + + // if (policy_type_id == 1) { + // $('.gpaClaimFileds').show(); + // $('.lifeClaimFields').hide(); + // } else if (policy_type_id == 6 || policy_type_id == 7) { + // $('.gpaClaimFileds').hide(); + // $('.lifeClaimFields').show(); + // } + + // // Initialize Select2 for the newly added fields + // $("#first_year_" + increment).select2(); + // $("#claim_type_" + increment).select2(); + // $("#first_cause_of_death_" + increment).select2(); + + // toggleRequiredFields(); + // } + function appendThreeYearsClaims(count) { // let count = $('#appendAreaForClaim').data('count'); @@ -1916,15 +2013,46 @@ } ?> +
- - + +
+ +
- - + +
-