Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
vadivelJ96 2025-08-16 12:48:14 +05:30
commit 15d8e2299d
6 changed files with 496 additions and 182 deletions

View File

@ -2080,95 +2080,102 @@ class LeadsController extends BaseController
if (!$lead_data) { if (!$lead_data) {
return ['status' => 'failed', 'message' => 'Lead data not found']; 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 try{
if (!file_exists($file_name_with_path)) { if ($lead_data['file_name']) {
//file not found update status and reason // $file_name_with_path = WRITEPATH . "/uploads/lead_files/NonPrintableCharacters.xlsx";
$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'];
}
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path); //check physical file
if (!file_exists($file_name_with_path)) {
//get members data //file not found update status and reason
$members_sheet = $spreadsheet->getSheet(0); $message = "Lead Physcial file not found";
$highestRowAndColumn = $members_sheet->getHighestRowAndColumn(); // echo $message;
// dd($highestRowAndColumn); $this->myLogger->logme('error', ($message . ' for file ' . $file_name_with_path));
$uncleaned_members = $members_sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); return ['status' => 'failed', 'message' => 'no physical file'];
$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(); $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
return ['status' => 'fail', 'message' => $e->getMessage()];
//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)); }catch(Exception $e){
return ['status' => 'failed', 'message' => 'no file found']; $this->myLogger->logme("error", "Exception: " . $e->getMessage() . " --- Line: " . $e->getLine() . " --- Trace: " . $e->getTraceAsString());
return ['status' => 'fail', 'error' => "File not found / Wrong file"];
} }
} }

View File

@ -35,6 +35,7 @@ use App\Models\COShareStmtDetailsModel;
use App\Models\BdsPlacementModel; use App\Models\BdsPlacementModel;
use Kint\Kint; use Kint\Kint;
use App\Helpers\MailHelper; use App\Helpers\MailHelper;
use App\Helpers\ExcelSanitizeHelper;
use Exception; use Exception;
class PolicyTransactionController extends BaseController class PolicyTransactionController extends BaseController
@ -2270,6 +2271,7 @@ class PolicyTransactionController extends BaseController
// dd($highestRowAndColumn); // dd($highestRowAndColumn);
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
unset($excel_data[0]); unset($excel_data[0]);
$excel_data = ExcelSanitizeHelper::sanitizeArrayData($excel_data);
// Kint::dump($excel_data);die(); // Kint::dump($excel_data);die();
//get no of line items and update in DB //get no of line items and update in DB
$line_items = 0; $line_items = 0;
@ -2384,6 +2386,7 @@ class PolicyTransactionController extends BaseController
// dd($highestRowAndColumn); // dd($highestRowAndColumn);
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
unset($excel_data[0]); unset($excel_data[0]);
$excel_data = ExcelSanitizeHelper::sanitizeArrayData($excel_data);
// dd($excel_data); // dd($excel_data);
//get no of line items and update in DB //get no of line items and update in DB
$line_items = count($excel_data); $line_items = count($excel_data);

View File

@ -95,6 +95,7 @@ class TicketController extends BaseController
4 => "Smart Service Desk", 4 => "Smart Service Desk",
5 => "Direct to TPA" 5 => "Direct to TPA"
]; ];
$this->claimType = [ $this->claimType = [
1 => [ 1 => [
1 => "Main Hospitalization", 1 => "Main Hospitalization",
@ -829,11 +830,25 @@ class TicketController extends BaseController
$data['ticket_data'] = $ticket_data; $data['ticket_data'] = $ticket_data;
$data['acms'] = $this->employeeModel->getAcmUsingClientID($ticket_data['client_id']); $data['acms'] = $this->employeeModel->getAcmUsingClientID($ticket_data['client_id']);
$raw_json = $this->ticketMasterModel->getPolicyTermsJson($ticket_id) ; // do not remove this
// $raw_json = $this->ticketMasterModel->getPolicyTermsJson($ticket_id) ;
$decoded_top = json_decode($raw_json ?? "", true) ?? []; // $decoded_top = json_decode($raw_json ?? "", true) ?? [];
$data['policy_terms'] = $this->recursive_json_decode($decoded_top); // $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); return $this->loadLayout('ticket_edit_onbording', $data);
} }
@ -2232,7 +2247,8 @@ class TicketController extends BaseController
} }
} }
public function recursive_json_decode($input) { public function recursive_json_decode($input)
{
if (is_string($input)) { if (is_string($input)) {
$decoded = json_decode($input, true); $decoded = json_decode($input, true);
if (json_last_error() === JSON_ERROR_NONE) { if (json_last_error() === JSON_ERROR_NONE) {
@ -2251,6 +2267,182 @@ class TicketController extends BaseController
return $input; 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' => '<b>Self</b>',
// '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' => '<b style="color : #000;">Self</b>',
'spouse' => '<b style="color : #000;">Spouse</b>',
'childrens' => '<b style="color : #000;">Childrens</b>',
'parents' => '<b style="color : #000;">Parents</b>',
'parents-in-law' => '<b style="color : #000;">Parents-in-law</b>',
'either-parents-pil' => '<b style="color : #000;">Either Parents/PIL</b>',
'elders_count' => '<b style="color : #000;">Total Elders Count</b>'
];
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[] = "<b style='color : #000;'>" . ucfirst($person) . "</b> - <b> Min </b>: {$age['min']}, <b> Max </b> : {$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[] = "<b style='color : #000;'>" . ucfirst($person) . "</b> : " . ($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(isset($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('/(?<!^)[A-Z]/', ' $0', $key); // camelCase → space
$label = ucwords(str_replace('_', ' ', $label)); // snake_case → space & capitalize
// echo "2";
}
$result[$label] = $value == 1 ? "Yes" : ($value == 0 ? "No" : $value);
}
// return count($result);
// return $data;
return $result;
}

View File

@ -2242,18 +2242,19 @@
// Start the interval // Start the interval
function startAutoSubmit(attrId) { function startAutoSubmit(attrId) {
if (!submitInterval) { // if (!submitInterval) {
submitInterval = setInterval(function() { // submitInterval = setInterval(function() {
if(attrId == "GMC"){ // if(attrId == "GMC"){
autoSaveGmcTerms(); // autoSaveGmcTerms();
}else if(attrId == "GPA"){ // }else if(attrId == "GPA"){
autoSaveGpaTerms(); // autoSaveGpaTerms();
}else if(attrId == "OTHERS"){ // }else if(attrId == "OTHERS"){
autoSaveOtherTerms(); // autoSaveOtherTerms();
} // }
}, 20000); // }, 20000);
console.log("Auto-submit started."); // console.log("Auto-submit started.");
} // }
console.log("Auto-submit Disabled.");
} }
// Stop the interval // Stop the interval

View File

@ -1,97 +1,208 @@
<br> <!-- <br>
<p style="color:black;"> <p style="color:black;">
<b>Policy Terms</b> <b>Policy Terms</b>
</p> </p>
<br> <br>
<?php <?php
// ✅ Format keys: underscores to spaces, each word capitalized // // ✅ Format keys: underscores to spaces, each word capitalized
function readable_key($key) { // function readable_key($key) {
$key = str_replace('_', ' ', $key); // $key = str_replace('_', ' ', $key);
return ucwords($key); // return ucwords($key);
} // }
// ✅ Format values: 0 = NO, 1 = YES, >1 = number as-is // // ✅ Format values: 0 = NO, 1 = YES, >1 = number as-is
function format_value($value) { // function format_value($value) {
if (is_numeric($value)) { // if (is_numeric($value)) {
if ($value == 0) return 'No'; // if ($value == 0) return 'No';
if ($value == 1) return 'Yes'; // if ($value == 1) return 'Yes';
} // }
return $value; // return $value;
} // }
// ✅ Recursively render nested keyvalue pairs // // ✅ Recursively render nested keyvalue pairs
function nestedKeyValuePair($data) { // function nestedKeyValuePair($data) {
$output = ''; // $output = '';
foreach ($data as $key => $value) { // foreach ($data as $key => $value) {
$label = readable_key($key); // $label = readable_key($key);
$output .= "<span style='color:black;'> : <b>$label</b>"; // $output .= "<span style='color:black;'> : <b>$label</b>";
if (is_array($value)) { // if (is_array($value)) {
$output .= "<span style='margin-left: 10px;'>" . nestedKeyValuePair($value) . "</span>"; // $output .= "<span style='margin-left: 10px;'>" . nestedKeyValuePair($value) . "</span>";
} else { // } else {
$formattedValue = format_value($value); // $formattedValue = format_value($value);
$output .= " : " . htmlspecialchars($formattedValue) ; // $output .= " : " . htmlspecialchars($formattedValue) ;
} // }
$output .= "</span>"; // $output .= "</span>";
// }
// return $output;
// }
// if (isset($policy_terms['policy_terms']) && is_array($policy_terms['policy_terms'])) {
// // ✅ Merge multiple_sum_insured with sum_insured
// if (
// isset($policy_terms['policy_terms']['multiple_sum_insured']) &&
// is_array($policy_terms['policy_terms']['multiple_sum_insured'])
// ) {
// $sum_insured_values = implode(' , ', $policy_terms['policy_terms']['multiple_sum_insured']);
// $original_sum = isset($policy_terms['policy_terms']['sum_insured'])
// ? $policy_terms['policy_terms']['sum_insured']
// : '';
// $policy_terms['policy_terms']['sum_insured'] = $original_sum . " , " . $sum_insured_values;
// unset($policy_terms['policy_terms']['multiple_sum_insured']);
// }
// // ✅ Display each policy term
// foreach ($policy_terms['policy_terms'] as $key => $value) {
// if ($key === "age_ratio" || $key === "enrollment_display_key") {
// continue; // Skip excluded keys
// }
// // Normalize specific raw keys (if needed)
// if ($key === 'waiverof30dayswaitingperiod') {
// $key = 'Waiver_of_30_days_waiting_period';
// }
// if ($key === 'suminsuredenhancement') {
// $key = 'sum_insured_enhancement';
// }
// // Readable label
// $label = readable_key($key);
// $nesetedValues = "";
// ?>
// <div class="row">
// <div class="form-group col-3">
// <p style="color:black;"><b><?php //echo htmlspecialchars($label); ?>:</b></p>
// </div>
// <div class="form-group col-6">
// <?php
// if (is_array($value)) {
// $nesetedValues .= nestedKeyValuePair($value) .",";
// echo "$nesetedValues";
// } else {
// $formattedValue = format_value($value);
// echo "<p style='color:black;'>: " . htmlspecialchars($formattedValue) . "</p>";
// }
// ?>
// </div>
// </div>
// <?php
// }
// }
?> -->
<style>
.policy-terms-container {
border: 1px solid #ddd;
border-radius: 8px;
background-color: #fafafa;
padding: 20px;
max-width: 1200px;
margin: 20px auto;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
} }
return $output; .policy-row {
} display: flex;
border-bottom: 1px solid #eee;
if (isset($policy_terms['policy_terms']) && is_array($policy_terms['policy_terms'])) { padding: 12px 0;
align-items: center;
// ✅ Merge multiple_sum_insured with sum_insured
if (
isset($policy_terms['policy_terms']['multiple_sum_insured']) &&
is_array($policy_terms['policy_terms']['multiple_sum_insured'])
) {
$sum_insured_values = implode(' , ', $policy_terms['policy_terms']['multiple_sum_insured']);
$original_sum = isset($policy_terms['policy_terms']['sum_insured'])
? $policy_terms['policy_terms']['sum_insured']
: '';
$policy_terms['policy_terms']['sum_insured'] = $original_sum . " , " . $sum_insured_values;
unset($policy_terms['policy_terms']['multiple_sum_insured']);
} }
// ✅ Display each policy term .policy-row:last-child {
foreach ($policy_terms['policy_terms'] as $key => $value) { border-bottom: none;
if ($key === "age_ratio" || $key === "enrollment_display_key") { }
continue; // Skip excluded keys
}
// Normalize specific raw keys (if needed) .policy-label {
if ($key === 'waiverof30dayswaitingperiod') { flex: 0 0 40%;
$key = 'Waiver_of_30_days_waiting_period'; padding-right: 20px;
} }
if ($key === 'suminsuredenhancement') {
$key = 'sum_insured_enhancement';
}
// Readable label .policy-label label {
$label = readable_key($key); font-weight: 600;
$nesetedValues = ""; color: #333;
?> font-size: 14px;
<div class="row"> margin: 0;
<div class="form-group col-3"> text-transform: capitalize;
<p style="color:black;"><b><?php echo htmlspecialchars($label); ?>:</b></p> }
</div>
<div class="form-group col-6"> .policy-value {
<?php flex: 1;
if (is_array($value)) { padding-left: 20px;
$nesetedValues .= nestedKeyValuePair($value) .","; border-left: 1px solid #eee;
echo "$nesetedValues"; }
} else { .policy-value span {
$formattedValue = format_value($value); color: #555;
echo "<p style='color:black;'>: " . htmlspecialchars($formattedValue) . "</p>"; font-size: 14px;
} line-height: 1.4;
?> }
.no-terms-container {
border: 1px solid #ddd;
border-radius: 8px;
background-color: #f9f9f9;
padding: 40px;
text-align: center;
max-width: 800px;
margin: 20px auto;
}
.no-terms-message span {
color: #666;
font-size: 16px;
font-style: italic;
}
/* Responsive design */
@media (max-width: 768px) {
.policy-row {
flex-direction: column;
align-items: flex-start;
}
.policy-label {
flex: none;
padding-right: 0;
padding-bottom: 8px;
width: 100%;
}
.policy-value {
flex: none;
padding-left: 0;
border-left: none;
border-top: 1px solid #eee;
padding-top: 8px;
width: 100%;
}
}
</style>
<?php if(isset($policy_terms)) { ?>
<div class="policy-terms-container">
<?php foreach($policy_terms as $key => $value){ ?>
<div class="policy-row">
<div class="policy-label">
<label><?= htmlspecialchars($key) ?></label>
</div>
<div class="policy-value">
<span><?= $value ?></span>
</div>
</div> </div>
<?php } ?>
</div>
<?php } else { ?>
<div class="no-terms-container">
<div class="no-terms-message">
<span>No Terms Found</span>
</div> </div>
<?php </div>
} <?php } ?>
}
?>

View File

@ -293,7 +293,7 @@
onclick="checkTheTableDataChanged(3)">Send Insurer Mail</button> onclick="checkTheTableDataChanged(3)">Send Insurer Mail</button>
<?php } ?> <?php } ?>
<button id="submitPlacement" class="btn btn-primary" onclick="checkTheTableDataChanged(6)">Placement</button> <button id="submitPlacement" class="btn btn-primary" onclick="checkTheTableDataChanged(6)">Placement</button>
<button id="viewDemography" class="btn btn-primary" onclick="viewDemography()">view Demography</button> <button id="viewDemography" class="btn btn-primary" onclick="viewDemography()">Demography</button>
<input type="hidden" id="lead_id" name="lead_id" value="<?= isset($lead_id) ? $lead_id : '' ?>"> <input type="hidden" id="lead_id" name="lead_id" value="<?= isset($lead_id) ? $lead_id : '' ?>">
<input type="hidden" id="rfq_primaryKey" name="rfq_primaryKey" value="<?= isset($rfq_data['id']) ? $rfq_data['id'] : '' ?>"> <input type="hidden" id="rfq_primaryKey" name="rfq_primaryKey" value="<?= isset($rfq_data['id']) ? $rfq_data['id'] : '' ?>">
<input type="hidden" id="qcr_count" value="<?= isset($qcr_count) ? $qcr_count : 0 ?>"> <input type="hidden" id="qcr_count" value="<?= isset($qcr_count) ? $qcr_count : 0 ?>">
@ -706,7 +706,7 @@
if(isset($demogrphy_html_data) && !empty($demogrphy_html_data)){ if(isset($demogrphy_html_data) && !empty($demogrphy_html_data)){
echo $demogrphy_html_data; echo $demogrphy_html_data;
}else{ }else{
echo "<p style='text-align: center; color: #6c757d; font-style: italic;'>No Demography Data Found</p>"; echo "<p style='text-align: center; color: #6c757d; font-style: italic;'>No Demography Data Found or Wrong File</p>";
} }
?> ?>
</div> </div>