From 2ec49e3e7e7744cd470c6aa47d1461210b85286f Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 24 Jun 2026 16:53:33 +0530 Subject: [PATCH 1/3] FEAT_POLICY_TERMS_FOR_HR --- app/Controllers/EmployeeRestController.php | 21 +++++++++++++++++++ app/Views/layout/header.php | 2 +- ...y_transaction_inception_form_validation.js | 7 +++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index fcf7c9f6..fcd1fa55 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2264,6 +2264,7 @@ class EmployeeRestController extends AdminController client_policy.inception_type as inception_type, client_policy.policy_no as policy_no, client_policy.insurer_id as insurer_id, + client_policy.policy_terms, DATE_FORMAT(client_policy.policy_start_date, '%d-%m-%Y') AS policy_start_date, DATE_FORMAT(client_policy.policy_end_date, '%d-%m-%Y') AS policy_expiry_date, clients.client_logo as client_logo, @@ -2316,6 +2317,26 @@ class EmployeeRestController extends AdminController $value['is_ecard_bulk_download'] = 0; $value['is_ecard_bulk_download_for_employee'] = 0; + $terms = json_decode($value['policy_terms'], true) ?? []; + if ($value['policy_type_id'] == 1) { + $policyGroup = 'gpa'; + } elseif (in_array($value['policy_type_id'], [6, 7, 72])) { + $policyGroup = 'other'; + } else { + $policyGroup = 'gmc'; + } + $value['policy_terms'] = isset($terms['enrollment_display_key']) && ! empty($terms['enrollment_display_key']) + ? $terms['enrollment_display_key'] + : $this->policyTermsFiter($terms, $policyGroup); + + $sumInsuredLabel = in_array($value['policy_type_id'], [1, 6, 7]) ? 'Sum Assured' : 'Sum Insured'; + $sumInsuredValue = $terms['sum_insured'] ?? ($terms['sumInsured2'] ?? null); + if ($sumInsuredValue !== null && $sumInsuredValue !== '') { + if (! array_key_exists($sumInsuredLabel, $value['policy_terms'])) { + $value['policy_terms'] = array_merge([$sumInsuredLabel => $sumInsuredValue], $value['policy_terms']); + } + } + array_push($result, $value); } diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index 098229d9..25c51f36 100755 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -2218,7 +2218,7 @@ body[data-sidebar-size="condensed"] .footer {