From 00001a732d7854317d6ea206399fb0ef9b0d916a Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 17 Mar 2026 10:29:49 +0530 Subject: [PATCH 01/24] FIX_BENIFITS_LOGIN_ISSUE --- app/Controllers/RestAuthenticationController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index 02bf50f..aecf3a0 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -1329,7 +1329,7 @@ class RestAuthenticationController extends AdminController $this->myLogger->logme("error", "REST-AUTH-CONTROLLER - checkMpin: Mpin - Exist"); log_message('error', ' '); log_message('error', '************************ PRE END ********************************'); - return $this->respond(['status' => 'success','code' => 200,'data' => "", 'message' => "Mpin - exist" , 'Mpin' =>$employeeData["mpin"], 'is_mpin_skipped' => $employeeData['is_mpin_skipped'] ?? 0, 'is_biometric_enabled' => $employeeData['is_biometric_enabled'] ?? 0 ],200); + return $this->respond(['status' => 'success','code' => 200,'data' => "", 'message' => "Mpin - exist" , 'Mpin' =>$employeeData["mpin"], 'is_mpin_skipped' => $employeeData['is_mpin_skipped'] ?? '0', 'is_biometric_enabled' => $employeeData['is_biometric_enabled'] ?? '0' ],200); } else { $this->myLogger->logme("error", "REST-AUTH-CONTROLLER - checkMpin: Mpin - not found in PRE so call the thirdpartapi to the POST to check the MPIN"); log_message('error', ' '); From 843cea9ceeb2a6f28ce5e4bcffb00eec69c59137 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 18 Mar 2026 19:53:06 +0530 Subject: [PATCH 02/24] FIX_LIVE_ISSUES --- app/Models/EmployeePolicyModel.php | 43 +++++++++++++++++++++--------- app/Views/employee_data_list.php | 9 ++++--- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 92c2905..d61d75a 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -140,22 +140,41 @@ class EmployeePolicyModel extends Model '(SELECT old_value FROM auditing_history WHERE pk = emp.id AND field_name = "gender" AND table_name = "employees" ORDER BY id ASC LIMIT 1) AS gender_first_old', '(SELECT new_value FROM auditing_history WHERE pk = emp.id AND field_name = "gender" AND table_name = "employees" ORDER BY id DESC LIMIT 1) AS gender_last_new', - '(CASE - WHEN emp.relationship = "Self" - THEN (SELECT COUNT(id) FROM employees WHERE emp_code = emp.emp_code AND is_active = 0 AND emp_status != "truncated") + "(CASE + WHEN emp.relationship = 'Self' + THEN ( + SELECT IF(COUNT(e.id) > 0, + CONCAT( + COUNT(e.id), + ' people removed ( ', + GROUP_CONCAT(CONCAT(e.name, ' - ', e.relationship) SEPARATOR ', '), + ' )' + ), + NULL) + FROM employees e + JOIN employee_polices ep ON e.id = ep.employee_id + WHERE e.emp_code = emp.emp_code + AND e.is_active = 0 + AND e.emp_status != 'truncated' + AND ep.client_policy_id = employee_polices.client_policy_id + ) ELSE NULL - END) AS removed_count', + END) AS removed_summary", - '(CASE - WHEN emp.relationship != "Self" AND emp.created_at != ( - SELECT created_at - FROM employees - WHERE emp_code = emp.emp_code AND relationship = "Self" AND is_active = 1 - LIMIT 1 + "(CASE + WHEN emp.relationship != 'Self' AND DATE(emp.created_at) > ( + SELECT DATE(MIN(e_sub.created_at)) + FROM employees e_sub + JOIN employee_polices ep ON e_sub.id = ep.employee_id + WHERE e_sub.emp_code = emp.emp_code + AND e_sub.relationship = 'Self' + AND e_sub.is_active = 1 + AND ep.client_policy_id = employee_polices.client_policy_id ) - THEN "Newly Added" + THEN 'Newly Added' ELSE NULL - END) AS newly_added', + END) AS newly_added", + $status_query ], false) ->join('employees emp', 'employee_polices.employee_id = emp.id') diff --git a/app/Views/employee_data_list.php b/app/Views/employee_data_list.php index c8f094b..65915de 100755 --- a/app/Views/employee_data_list.php +++ b/app/Views/employee_data_list.php @@ -212,10 +212,13 @@ if(!empty($employee['newly_added'])){ echo "

" . $employee['newly_added'] . "

"; } - if(!empty($employee['removed_count'])){ - echo "

" . $employee['removed_count'] . " People removed

"; + // if(!empty($employee['removed_count'])){ + // echo "

" . $employee['removed_count'] . " People removed

"; + // } + if(!empty($employee['removed_summary'])){ + echo "

" . $employee['removed_summary'] . "

"; } - if(empty($employee['name_first_old']) && empty($employee['dob_first_old']) && empty($employee['gender_first_old']) && empty($employee['removed_count'] ) && empty($employee['newly_added'] )){ + if(empty($employee['name_first_old']) && empty($employee['dob_first_old']) && empty($employee['gender_first_old']) && empty($employee['removed_summary'] ) && empty($employee['newly_added'] )){ echo " - "; } ?> From b47c8c594e5a73745450cf2955159e7460cf5454 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 19 Mar 2026 09:59:04 +0530 Subject: [PATCH 03/24] FIX_ISSUE --- app/Views/employee_data_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Views/employee_data_list.php b/app/Views/employee_data_list.php index 65915de..80436a2 100755 --- a/app/Views/employee_data_list.php +++ b/app/Views/employee_data_list.php @@ -847,7 +847,7 @@ function downloadInception(){ empName: empName }, success: function(response) { - if (response.status === 'Success') { + if (response.status === 'success') { $('', { href: response.downloadUrl, download: '', From dbd6167382902c78a64daf3db4b4b810f1d6905e Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 19 Mar 2026 18:17:29 +0530 Subject: [PATCH 04/24] FIX_LIVE_ISSUES --- app/Models/EmployeePolicyModel.php | 9 +++++---- app/Views/file_list.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index d61d75a..1149174 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -162,14 +162,15 @@ class EmployeePolicyModel extends Model END) AS removed_summary", "(CASE - WHEN emp.relationship != 'Self' AND DATE(emp.created_at) > ( - SELECT DATE(MIN(e_sub.created_at)) + WHEN emp.relationship != 'Self' + AND emp.created_at > ( + SELECT MIN(e_sub.created_at) FROM employees e_sub - JOIN employee_polices ep ON e_sub.id = ep.employee_id + INNER JOIN employee_polices ep_sub ON e_sub.id = ep_sub.employee_id WHERE e_sub.emp_code = emp.emp_code AND e_sub.relationship = 'Self' AND e_sub.is_active = 1 - AND ep.client_policy_id = employee_polices.client_policy_id + AND ep_sub.client_policy_id = employee_polices.client_policy_id ) THEN 'Newly Added' ELSE NULL diff --git a/app/Views/file_list.php b/app/Views/file_list.php index 993ebe6..4e9588c 100755 --- a/app/Views/file_list.php +++ b/app/Views/file_list.php @@ -128,7 +128,7 @@ ">Download View - + Truncate From 7aa4e8fb9857f83896b61f6a9fcca8ec6123b5ba Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 20 Mar 2026 11:39:12 +0530 Subject: [PATCH 05/24] CHANGE_EMP_ADD_OR_REMOVE --- app/Controllers/EmployeeRestController.php | 3 +- app/Models/EmployeeModel.php | 1 + app/Models/EmployeePolicyModel.php | 34 ++++++++++++---------- app/Views/employee_data_list.php | 6 ++-- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 8541d19..302a569 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -284,6 +284,7 @@ class EmployeeRestController extends AdminController $item->gender = $this->GenderMap($item->relationship , $item->emp_code); $item->dob = $this->convertDateFormatYMD($item->dob); $item->emp_status = 'draft'; + $item->is_dependent_modified = 1; $item->band = $this->getSelfBand($item->emp_code,$item->client_id,$item->client_branch_id); // dd($item); $employee = $this->employeeModel->insert($item); @@ -564,7 +565,7 @@ class EmployeeRestController extends AdminController $this->employeeModel->where('id', $this->request->getGet('id') ) ->where('is_active', 1 ) - ->set(['emp_status' => 'truncated', 'is_active' => 0]) + ->set(['emp_status' => 'truncated', 'is_active' => 0, 'is_dependent_modified' => 0]) ->update(); } diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index c5bd85b..d6dfa27 100755 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -46,6 +46,7 @@ class EmployeeModel extends Model "is_mpin_skipped", "is_biometric_enabled", "password", + "is_dependent_modified", ]; // Callbacks diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 1149174..dafe21c 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -154,27 +154,29 @@ class EmployeePolicyModel extends Model FROM employees e JOIN employee_polices ep ON e.id = ep.employee_id WHERE e.emp_code = emp.emp_code - AND e.is_active = 0 - AND e.emp_status != 'truncated' + AND (e.is_dependent_modified = 0 OR (e.is_active = 0 AND e.emp_status != 'truncated')) AND ep.client_policy_id = employee_polices.client_policy_id ) ELSE NULL END) AS removed_summary", - "(CASE - WHEN emp.relationship != 'Self' - AND emp.created_at > ( - SELECT MIN(e_sub.created_at) - FROM employees e_sub - INNER JOIN employee_polices ep_sub ON e_sub.id = ep_sub.employee_id - WHERE e_sub.emp_code = emp.emp_code - AND e_sub.relationship = 'Self' - AND e_sub.is_active = 1 - AND ep_sub.client_policy_id = employee_polices.client_policy_id - ) - THEN 'Newly Added' - ELSE NULL - END) AS newly_added", + "(IF(COALESCE(emp.is_dependent_modified, 0) = 1, 'Newly Added, ', + CASE + WHEN emp.relationship != 'Self' + AND emp.created_by = ( + SELECT e_sub.id + FROM employees e_sub + INNER JOIN employee_polices ep_sub ON e_sub.id = ep_sub.employee_id + WHERE e_sub.emp_code = emp.emp_code + AND e_sub.relationship = 'Self' + AND e_sub.is_active = 1 + AND ep_sub.client_policy_id = employee_polices.client_policy_id + LIMIT 1 + ) + THEN 'Newly Added, ' + ELSE NULL + END + )) AS newly_added", $status_query ], false) diff --git a/app/Views/employee_data_list.php b/app/Views/employee_data_list.php index 80436a2..7659250 100755 --- a/app/Views/employee_data_list.php +++ b/app/Views/employee_data_list.php @@ -200,6 +200,9 @@ " . $employee['newly_added'] . "

"; + } if(!empty($employee['name_first_old']) ){ echo "

Name : " . $employee['name_first_old'] . ' => ' . $employee['name_last_new'] . "

"; } @@ -209,9 +212,6 @@ if(!empty($employee['gender_first_old'])){ echo "

Gender : " . $employee['gender_first_old'] . ' => ' . $employee['gender_last_new'] . "

"; } - if(!empty($employee['newly_added'])){ - echo "

" . $employee['newly_added'] . "

"; - } // if(!empty($employee['removed_count'])){ // echo "

" . $employee['removed_count'] . " People removed

"; // } From b5e983904953a1b2c33e324ffb2a8da1174a27c8 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 25 Mar 2026 12:56:54 +0530 Subject: [PATCH 06/24] FIX_NEWLY_ADD --- app/Config/Acl.php | 10 +++++----- app/Models/EmployeePolicyModel.php | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/Config/Acl.php b/app/Config/Acl.php index 1fbea05..2dc7b69 100644 --- a/app/Config/Acl.php +++ b/app/Config/Acl.php @@ -14,8 +14,8 @@ class Acl '#^/loginPos#' => ['public' => true], '#^/getVerifyPosMobileNo#' => ['public' => true], '#^/getVerifiedPosUserData#' => ['public' => true], - '#^/swagger#' => ['roles' => [ADMIN_ROLE_ID]], - '#^/fedeploy#' => ['roles' => [ADMIN_ROLE_ID]], + '#^/swagger#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]], + '#^/fedeploy#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]], // ===================== PUBLIC DOWNLOADS / FORMS ===================== '#^/download-#' => ['public' => true], @@ -59,13 +59,13 @@ class Acl // ===================== LOGS ===================== '#^/logs#' => [ - 'roles' => [ADMIN_ROLE_ID], + 'roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID], 'teams' => [] ], // ===================== INTERNAL TEST ===================== '#^/test#' => [ - 'roles' => [ADMIN_ROLE_ID], + 'roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID], 'teams' => [] ], @@ -78,7 +78,7 @@ class Acl // ===================== DEFAULT DENY (ZERO TRUST) ===================== '#^/#' => [ - 'roles' => [ADMIN_ROLE_ID], + 'roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID], 'teams' => [] ], ]; diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index dafe21c..9ee48ef 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -163,17 +163,19 @@ class EmployeePolicyModel extends Model "(IF(COALESCE(emp.is_dependent_modified, 0) = 1, 'Newly Added, ', CASE WHEN emp.relationship != 'Self' + AND emp.file_id IS NULL AND emp.created_by = ( SELECT e_sub.id FROM employees e_sub - INNER JOIN employee_polices ep_sub ON e_sub.id = ep_sub.employee_id + JOIN employee_polices ep_sub ON e_sub.id = ep_sub.employee_id WHERE e_sub.emp_code = emp.emp_code AND e_sub.relationship = 'Self' AND e_sub.is_active = 1 AND ep_sub.client_policy_id = employee_polices.client_policy_id LIMIT 1 ) - THEN 'Newly Added, ' + + THEN 'Newly Added ' ELSE NULL END )) AS newly_added", From fbbe6f791ecc2a469acd738d6dd9fcba3723f5a2 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 27 Mar 2026 14:21:50 +0530 Subject: [PATCH 07/24] FIX_ISSUE --- app/Views/file_list.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Views/file_list.php b/app/Views/file_list.php index 4e9588c..dbbef80 100755 --- a/app/Views/file_list.php +++ b/app/Views/file_list.php @@ -476,7 +476,14 @@ $('#uploadForm').submit(function() { console.error("Request failed:", status, error); toastr.error('Something went wrong! Try later', 'Error'); $('#uploadForm')[0].reset(); - window.location.reload(true); + }, + complete: function() { + + console.log("Request finished. Reloading in 2 seconds..."); + + setTimeout(function() { + window.location.reload(); + }, 2000); } }); }) From 76a41264e8590b89c2745b9a85b5e9dc509d78f2 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 27 Mar 2026 17:40:43 +0530 Subject: [PATCH 08/24] FIX_DUPLICATE_EMP_CODE_CHECK --- app/Controllers/EmployeeServiceController.php | 17 ++- app/Helpers/excel_util_helper.php | 12 ++ app/Views/file_list.php | 104 +++++++++--------- 3 files changed, 78 insertions(+), 55 deletions(-) diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index 69c1d0f..3dbf417 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -116,7 +116,9 @@ class EmployeeServiceController extends AdminController 'is_mandatory' => true, 'data_type' => 'str', 'format' => null, - 'allowed_values' => null + 'allowed_values' => null, + 'custom' => 'check_emp_code_duplicate', + 'params' => ['self_data', 'row'] ], 'name_of_emp_dep' => [ 'col_idx' => 2, @@ -797,6 +799,19 @@ class EmployeeServiceController extends AdminController $existing_mobilenos = $this->employeePolicyModel->getExisitingMobileNos(client_policy_id: $file['policy_id']); //get existing units in the current branch $existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'],client_branch_id: $file['client_branch_id']); + + $self_data = $this->employeeModel + ->select('employees.id, employees.name, employees.emp_code') + ->join('employee_polices ep', 'employees.id = ep.employee_id') + ->where('employees.is_active', 1) + ->where('ep.is_active', 1) + ->whereIn('emp_status', ['draft', 'enrolled']) + ->whereIn('status', ['draft', 'enrolled']) + ->where('LOWER(relationship)', 'self') + ->where('client_id', $file['client_id']) + ->findAll(); + + // dd($excel_data); foreach ($excel_data as $row_key => $row) { diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index a6b6222..c1f6159 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -2369,5 +2369,17 @@ if(!function_exists('modify_si_for_the_family')) // --------AUTO SI Functions End--------------------------------------------------------------------------------------- +if(!function_exists('check_emp_code_duplicate')) +{ + function check_emp_code_duplicate($data, $row) + { + foreach ($data as $member) { + if(strtolower($row[5]) == 'self' && $member['emp_code'] == trim($row[1])) { + return array('status' => false,'error' => "This employee code already exist for this client"); + } + } + return array('status' => true,'error' => ""); + } +} diff --git a/app/Views/file_list.php b/app/Views/file_list.php index dbbef80..1e765aa 100755 --- a/app/Views/file_list.php +++ b/app/Views/file_list.php @@ -166,31 +166,37 @@ - + + + \ No newline at end of file diff --git a/public/2026-04-08.md b/public/2026-04-08.md new file mode 100644 index 0000000..9e5b16a --- /dev/null +++ b/public/2026-04-08.md @@ -0,0 +1,27 @@ +# Daily progress — 2026-04-08 + +## Policy Terms UI (policy type 72) — `other_policy_terms.php` + +- Reworked Sum Insured row: label column alignment, `input-group` with teal **+** button, amount-in-words as small italic muted text. +- Reworked Family Floater section: removed light-cyan panel; indented member grid under the value column to match target layout. +- Added column layout with **Min Age:** / **Max Age:** underline inputs and **Is Payable by employee:** checkboxes for Self, Spouse, Children; elders row when “Other Members” is not None. +- Renamed Other Members block to **Select Other Members:** with full-width dropdown; elder min/max ages and elder payable checkbox shown only when a non-None option is selected. +- `elder_member_count` moved to hidden input; sync on dropdown change and init. +- Fixed invalid form HTML (form closing order). +- AJAX: load `is_payable_employee` from saved terms; fix children count `0` not applying to dropdown; default `family_floaters_others` to None when no parent rule matches. +- Added `initPolicy72FamilyFloaterUi`, `syncPolicy72ElderMemberCount`, `togglePolicy72OtherMembersAgeRow` and delegated change handler. + +## Alignment fix (reference: `public/img/Pasted image.png`) + +- Replaced flex “rows” with a single **CSS Grid** (`.policy-72-ff-grid`): fixed-width column 1 (`248px`) for Self/Spouse/Children controls so **Min Age** / **Max Age** / **Is Payable** line up vertically across rows. +- **Other members** age row uses a **spacer cell** in column 1 plus `display: contents` on the wrapper when visible, so elder Min/Max/Payable align with the same columns as above (no longer shifted left). +- Toggle for that row now uses class **`policy-72-other-ages-open`** instead of jQuery `.show()/.hide()` so grid placement stays correct. +- Narrow viewports: horizontal scroll on `.policy-72-family-grid` with `min-width` on the grid to preserve alignment. + +## Backend — `ClientController.php` + +- Policy type 72: `is_payable_employee` now read from POST checkboxes (`is_payable_employee_for_self`, `_spouse`, `_child`, `_elders`) instead of hardcoded zeros. + +## Process / repo hygiene + +- Established daily progress log in `public/` as `YYYY-MM-DD.md` (append same file for the calendar day; do not create duplicate dated files). diff --git a/public/policy_type_72_alignment_plan.md b/public/policy_type_72_alignment_plan.md new file mode 100644 index 0000000..3d27392 --- /dev/null +++ b/public/policy_type_72_alignment_plan.md @@ -0,0 +1,124 @@ +# Policy Type 72 Alignment Plan (Match Policy Type 4) + +## Objective +Handle `policy_type_id = 72` exactly like `policy_type_id = 4` in client policy add/edit behavior, and ensure terms + rack-rate are handled through the Other Policy Terms flow. + +## Scope +- `app/Controllers/ClientController.php` +- `app/Views/client_policy.php` +- Related UI terms/rack-rate triggers that currently branch by policy type IDs. + +## Task List + +### 1) Baseline Mapping and Safe-Change Preparation +- Identify every conditional in controller/view where `4` or `[4,5]` controls add-on type, policy form behavior, payable defaults, terms enrichment, or rack-rate/terms routing. +- Confirm whether any places currently treat `72` as a standalone flow (if yes, mark for de-duplication to avoid divergence). +- Keep existing behavior for all other policy types unchanged. + +### 2) Client Policy Add/Edit Logic (Controller) +- In create/edit paths where `is_addon` is set: + - Extend conditions from `($policy_type_id == 4 || $policy_type_id == 5)` to include `72` where the intent is SI top-up style behavior (same as type `4`). +- Validate resulting `is_addon` value for `72` matches the existing value used for `4`. +- Verify base-policy dependency logic remains consistent with type `4` handling. + +### 3) Client Policy Add/Edit UI Behavior (View) +- Update policy-type change handlers so `72` follows the same UI branch currently used by `4`: + - show/hide sections (`#first`, `#second`, `#third`) + - base policy visibility/required flags + - insurer/TPA visual state logic +- Update edit-form population branches where `res.data.policy_type_id == '4' || '5'` to include `'72'`. +- Ensure warning/notification behavior remains intentional (only where currently tied to type `5` should remain type `5` unless business asks otherwise). + +### 4) Terms and Rack-Rate Routing to Other Policy Terms +- Confirm terms action (`btnPolicyMaster`) and rack-rate action (`btnPolicyModel`) for type `72` route through the same "other policy terms" flow used for non-GMC/GPA special cases, as requested. +- Where logic checks `[4,5]` for terms data preparation, include `72` if that block is the one used by type `4`. +- Validate that no GMC/GPA-specific terms template or transformation is incorrectly applied to type `72`. + +### 5) Policy Terms Normalization/Export Consistency (Controller) +- In policy terms normalization blocks using `[2,3,4,5]` and `[4,5]`, include `72` where type `4` behavior is intended: + - `is_payable_employee` default structure + - waiting period / maternity / ICU / infertility / enrollment display key defaults +- Confirm output payload shape for type `72` matches type `4`. + +### 6) Regression Checks +- Add Policy: create with type `72`, verify same required fields and UI transitions as type `4`. +- Edit Policy: open existing type `72` record and verify form prefill + section visibility parity with type `4`. +- Terms: open Terms for type `72`; confirm it goes to Other Policy Terms and saves/reloads correctly. +- Rack Rate: open Rack Rate for type `72`; confirm it follows the intended non-special routing and data persists. +- Sanity-check that type `4` behavior is unchanged and type `5` behavior is not accidentally altered. + +### 7) QA Notes / Acceptance Criteria +- `72` and `4` produce identical behavior for client policy add/edit and related controller flags. +- `72` terms/rack-rate are handled via Other Policy Terms path. +- No regressions for policy types `1,2,3,5,6,7`. +- Existing policies continue to load and edit without UI/runtime errors. + +## Suggested Implementation Order +1. Update controller create/edit `is_addon` branches. +2. Update view add/edit conditionals for form behavior. +3. Update controller terms-normalization arrays/branches. +4. Validate terms/rack-rate routing for type `72`. +5. Execute regression checklist and document outcomes. + +## Phase 2: Replicate `nhance` Policy Terms Process for Type 72 + +### Reference Baseline +- Source behavior to mirror: + - `/var/www/html/nhance/app/Controllers/ClientController.php` + - `/var/www/html/nhance/app/Views/other_policy_terms.php` +- Target implementation files in this project: + - `app/Controllers/ClientController.php` + - `app/Views/other_policy_terms.php` (or equivalent included terms view if path differs in this repo) + +### Split Task Plan + +#### A) Gap Analysis Split +- Compare type `72` flow in source vs target for: + - terms open (`btnPolicyMaster` -> `getterms`) + - terms save (`client/terms/other_terms`) + - dynamic form render (`appendPolicyTermsHTML(72)`) + - display-key reconstruction (`processOtherEnrollmentDisplayKey`, backend display map build) +- Prepare a field matrix for type `72` keys: + - base keys (`sum_insured`, `multiple_sum_insured`, `family_floater`, `family_floaters`, `age_ratio`) + - OPD keys (`mode_of_serviceability`, `eligibility`, `total_sum_insured_limit`, etc.) + - special condition arrays and display checkboxes + +#### B) View Parity Split (`other_policy_terms.php`) +- Ensure terms launcher logic for type `72` uses the Other Policy Terms screen (same as source behavior). +- Ensure type `72` template block exists inside `appendPolicyTermsHTML(policy_type)` with the exact field set from source. +- Ensure type `72` post-family container behavior is kept (`append_html_for_other_policy_terms_72_after_family`) where applicable. +- Ensure existing JSON bind logic restores: + - family floater radio/select + ages + - OPD fields + - enrollment display checkbox state +- Keep non-72 behavior unchanged (including generic >5 flow). + +#### C) Controller Save/Load Parity Split (`ClientController.php`) +- In `other_terms` save flow: + - apply type `72` mapping for family structure + age ratio and OPD fields + - construct enrollment display payload exactly as reference process + - retain special condition arrays and dynamic key handling +- In `getterms`/list response flow: + - ensure persisted `policy_terms` JSON for `72` returns all expected keys for view hydration +- In post-save normalization: + - apply `is_payable_employee` default structure for `72` as per source behavior + +#### D) Integration Split (Client Policy Page + Terms Trigger) +- Verify `btnPolicyMaster` sends `data-typeid="72"` and opens Other Policy Terms path. +- Verify rack-rate remains in Other Policy Terms-driven behavior for type `72` and does not route to GMC/GPA-specific modals. +- Confirm required UI clears/reset logic does not wipe 72-only DOM containers incorrectly. + +#### E) Validation Split +- Create a new type `72` policy, open terms, fill all 72 fields, save, reopen, and verify persistence. +- Edit existing type `72` policy terms and verify: + - dynamic additional SI rows persist + - family floater and age ranges rehydrate correctly + - display-key checkboxes match saved state +- Regression check type `4` path remains unchanged. + +### Acceptance Criteria for This Split +- Type `72` policy terms in this repo behave the same as the referenced `nhance` controller/view flow. +- Data shape for stored `policy_terms` (including `enrollment_display_key`) is compatible with existing rendering/export in this repo. +- No regression in other policy types or terms screens. + + From d53c298788ebe0a80acb26ea8ee00bc5f5c71137 Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 8 Apr 2026 12:30:17 +0530 Subject: [PATCH 13/24] FIX_ISSUE --- app/Controllers/EmployeeRestController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index b33bdfd..85b0f64 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2622,7 +2622,7 @@ class EmployeeRestController extends AdminController //array_push($PolicyData, $responce); - }else if($array['is_addon'] == 2 && $array['policy_type_id'] == 4)//Topup policy + }else if(($array['is_addon'] == 2 && $array['policy_type_id'] == 4) || ($array['is_addon'] == 2 && $array['policy_type_id'] == 72))//Topup policy { From 375f2353cda6b6c828dff3a0d24870f45c4bd37e Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 8 Apr 2026 12:32:43 +0530 Subject: [PATCH 14/24] FIX_CLACULATE_PREMIUM --- app/Controllers/EmployeeRestController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 85b0f64..8fe79a3 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2935,7 +2935,7 @@ class EmployeeRestController extends AdminController //get policy slab rates $slab_details = $this->policesModel->getPolicySlabRatesForEmpOnboard($client_policy_id, $client_id); - print_r($slab_details);die(); + // print_r($slab_details);die(); $existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id, client_policy_id: $client_policy_id, emp_code: $emp_code, emp_status: ['draft', 'enrolled'], policy_status: ['draft', 'enrolled']); // kint::dump($existing_famility_decalculatePremiumtails); From 04546877dce5871943729acc8502c8d16f916b58 Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 8 Apr 2026 15:00:59 +0530 Subject: [PATCH 15/24] FIX_API_KEY_FOR_OPD --- app/Controllers/EmployeeRestController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 8fe79a3..40f95ad 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2681,7 +2681,7 @@ class EmployeeRestController extends AdminController - if($this->request->getGet('policy') == 'GMC-SI-TOPUP'){ + if($this->request->getGet('policy') == 'GMC-SI-TOPUP' || $this->request->getGet('policy') == 'GMC-OPD'){ return $this->respond(['status' => 'success','code' => 200,'data' => ['gmc_si_topup'=>$responce]], 200); } From ca849e2d33357be2a6626050fd98e2bb0754cfbc Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 8 Apr 2026 15:44:58 +0530 Subject: [PATCH 16/24] FIX_OPD_POLICY_TERMS_ALIGNMENT_ISSUE --- app/Views/other_policy_terms.php | 345 ++++++++++++++++++------------- 1 file changed, 204 insertions(+), 141 deletions(-) diff --git a/app/Views/other_policy_terms.php b/app/Views/other_policy_terms.php index 22c092f..5b2d307 100755 --- a/app/Views/other_policy_terms.php +++ b/app/Views/other_policy_terms.php @@ -23,6 +23,14 @@ max-width: 440px; } +#OtherPolicyTermsForm #familyFloaterDiv_others .form-check-inline .form-check-input { + margin-right: 4px; +} + +#OtherPolicyTermsForm #familyFloaterDiv_others .form-check-inline .form-check-label { + margin-right: 14px; +} + .btn-si-add-teal { background-color: #00a8b5; border: 1px solid #00a8b5; @@ -45,63 +53,60 @@ -webkit-overflow-scrolling: touch; } -/* Fixed columns so Min/Max Age and Payable align across Self / Spouse / Children / Other ages */ -.policy-72-ff-grid { - display: grid; - grid-template-columns: 248px 148px 148px minmax(200px, 1fr); - column-gap: 20px; - row-gap: 14px; - align-items: center; - min-width: 680px; +.policy-72-ff-table { + width: 100%; + min-width: 860px; } -.policy-72-ff-grid .ff-cell.ff-member { +.policy-72-ff-table td { + vertical-align: middle; + padding: 5px 6px; +} + +.policy-72-ff-table .ff-member-label-col { + width: 11%; +} + +.policy-72-ff-table .ff-member-control-col { + width: 11%; +} + +.policy-72-ff-table .ff-elders-col { + width: 22%; +} + +.policy-72-ff-table .ff-min-col { + width: 23%; +} + +.policy-72-ff-table .ff-max-col { + width: 23%; +} + +.policy-72-ff-table .ff-pay-label-col { + width: 20%; +} + +.policy-72-ff-table .ff-pay-check-col { + width: 12%; +} + +.policy-72-ff-table .ff-age-wrap { + display: flex; + align-items: center; + gap: 6px; +} + +.policy-72-ff-table .ff-elders-wrap { display: flex; align-items: center; gap: 8px; - min-width: 0; } -.policy-72-ff-grid .ff-cell.ff-member-children .ff-children-select { - flex: 1; - min-width: 0; - max-width: 110px; - width: auto; -} - -.policy-72-ff-grid .ff-cell.ff-min, -.policy-72-ff-grid .ff-cell.ff-max { - display: flex; +.policy-72-ff-table .ff-pay-wrap { + display: inline-flex; align-items: center; gap: 6px; - justify-self: start; -} - -.policy-72-ff-grid .ff-cell.ff-pay { - display: flex; - align-items: center; - justify-content: flex-end; - gap: 10px; - justify-self: stretch; - text-align: right; -} - -.policy-72-ff-grid .ff-cell.ff-other-top { - grid-column: 1 / -1; - display: flex; - flex-direction: column; - align-items: stretch; - gap: 6px; - min-width: 0; -} - -.policy-72-ff-grid .ff-other-select { - width: 100%; - max-width: 100%; -} - -.policy-72-ff-grid .ff-grid-spacer { - min-height: 1px; } .policy-72-other-members-age-row { @@ -109,20 +114,31 @@ } .policy-72-other-members-age-row.policy-72-other-ages-open { - display: contents; + display: table-row; } -.policy-72-ff-grid .ff-field-label { +.policy-72-ff-table .ff-field-label { white-space: nowrap; font-size: 0.9rem; color: #212529; } -.policy-72-ff-grid .ff-age-input { - width: 64px; +.policy-72-ff-table .ff-pay-wrap .ff-field-label { + white-space: nowrap; + font-size: 12px; + line-height: 1.2; +} + +.policy-72-ff-table .ff-age-input { + width: 68px; min-width: 48px; } +.policy-72-ff-table .ff-elders-count-input { + width: 64px; + background: #d3d3d3; +} + .button-like { display: inline-block; padding: 8px 15px; @@ -242,92 +258,138 @@ label {