From 8e1ec7f150c9d766a7be9a40dbb71b48ddd40e1e Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Thu, 27 Nov 2025 10:23:14 +0530 Subject: [PATCH 001/110] FIX_Code Revert (After the user changes the status and clicks Submit, the collection of next-next status fields is displayed. These fields do not belong to the selected status, which confuses the user) --- app/Views/file_list.php | 22 +++++++++++++--------- app/Views/notification.php | 13 ++++++++++--- app/Views/ticket_form_gmc.php | 2 +- app/Views/vehicle_type_master_list.php | 2 +- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/app/Views/file_list.php b/app/Views/file_list.php index 2086aeef..5e2f79dc 100755 --- a/app/Views/file_list.php +++ b/app/Views/file_list.php @@ -10,6 +10,8 @@ .dataTables_length label {height: 21px !important;} +.column-header { margin-right: 10px; /* Adjust this value as needed */ } + @@ -22,18 +24,19 @@ +
- - - - - - - - - + + + + + + + + + @@ -115,6 +118,7 @@
S.No File name Client Client Branch Policy Event User/Time Status Action 
S.No
File name
Client
Client Branch
Policy
Event
User/Time
Status
Action
+
diff --git a/app/Views/notification.php b/app/Views/notification.php index ed1c2364..b346857a 100755 --- a/app/Views/notification.php +++ b/app/Views/notification.php @@ -428,7 +428,7 @@ Action - + @@ -1445,7 +1445,10 @@ if (template_name == 'member_welcome_mail') { container = document.getElementById('attachment_tbody'); } - else { + else if (template_name == 'member_common_mail') { + container = document.getElementById('attachment_tbody_common'); + } + else { container = document.getElementById('attachment_tbody_ecard'); } @@ -1512,7 +1515,11 @@ function removeHTMLInput(element) { if (template_name == 'member_welcome_mail') { const container = document.getElementById('attachment_tbody'); - } else { + } + else if (template_name == 'member_common_mail') { + container = document.getElementById('attachment_tbody_common'); + } + else { const container = document.getElementById('attachment_tbody_ecard'); } const rows = container.querySelectorAll('.dynamic-form-row'); diff --git a/app/Views/ticket_form_gmc.php b/app/Views/ticket_form_gmc.php index 7428ab32..dc28a793 100644 --- a/app/Views/ticket_form_gmc.php +++ b/app/Views/ticket_form_gmc.php @@ -566,11 +566,11 @@ allowInput: false }); + updateClaimStatusDisplay("") var extraFields = ; GlobelExtraFields = extraFields; console.log("extraFields", extraFields); claimStatusFieldChanges(extraFields); - updateClaimStatusDisplay("") }) diff --git a/app/Views/vehicle_type_master_list.php b/app/Views/vehicle_type_master_list.php index 3f4faa46..a2001b8c 100755 --- a/app/Views/vehicle_type_master_list.php +++ b/app/Views/vehicle_type_master_list.php @@ -97,7 +97,7 @@ // dom: "<'row'<'col-sm-7'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right // "<'row'<'col-sm-12'tr>>" + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector - dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + + dom: "<'row'<'col-sm-7'f><'col-sm-5 text-right'B>>" + "<'row'<'col-sm-12'tr>>" + "<'row align-items-center'<'col-5 text-start'i><'col-7 d-flex justify-content-end align-items-center'<'me-2'l>p>>", lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], From 79c22a7b42a44e28c90265b48a56030a71b9bc8f Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 27 Nov 2025 11:33:24 +0530 Subject: [PATCH 002/110] FIX_FAMILY_FLOATER --- app/Controllers/EmployeeServiceController.php | 10 ++-- app/Helpers/excel_util_helper.php | 57 ++++++++++++++++--- 2 files changed, 55 insertions(+), 12 deletions(-) diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index 28721878..fd2f4694 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -1385,8 +1385,8 @@ class EmployeeServiceController extends AdminController $existing_famility_details = transform_db_data_to_excel($existing_famility_details,$file); // Kint::dump($existing_famility_details); $family = array_merge($family,$existing_famility_details); - $family = data_group_by_family($family)[ $emp_id ];// reason to call this again is bring self to first index of the array - // dd($family); + $family = data_group_by_family($family, 'excel', 1)[ $emp_id ];// reason to call this again is bring self to first index of the array + // dd($family); $self = current(array_filter($family, fn($r) => strtolower($r[5] ?? '') === 'self')); $premium = (int)($self['temp']['rata_premimum'] ?? 0); foreach ($family as &$r) if (strtolower($r[5] ?? '') !== 'self') $r['self_rata_premium'] = $premium; @@ -1394,9 +1394,9 @@ class EmployeeServiceController extends AdminController // Kint::dump($family); $data = calculate_premium_new(family_data:$family,policy_terms: $policy_terms,slab_details : $slab_details,fileArr: $file, existing_units:$existing_units); - // if($file['action'] == 'dependent_addition') { - // $data = validatet_family_floter_rata_premium($data); - // } + if($file['action'] == 'dependent_addition') { + $data = validatet_family_floter_rata_premium($data); + } // dd($data); $employee_data_group_by_family[$emp_id] = $data; $this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]); diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index f3e97d0c..761d69bb 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -375,6 +375,10 @@ if (!function_exists('data_group_by_family')) { if ($data_source == 'excel') { if (!check_row_is_empty_or_null($row)) { + if(empty($action)){ + $row['data_from'] = "excel"; + } + // for this condition to avoid 5,00,000 to 500000 if($current_column_action == 'SI'){ $row[3] = removeNumberFormatting($row[3]); @@ -392,6 +396,8 @@ if (!function_exists('data_group_by_family')) { } else { $result[$row[1]][] = $row; } + + } } else if ($data_source = 'db') { if (strtolower($row['relationship']) == 'self' && isset($result[$row['emp_code']])) { @@ -1017,13 +1023,17 @@ if (!function_exists('transform_excel_data_to_db')) { $result['self_rata_premium'] = $memArr['self_rata_premium'] ?? 0; } + if(isset($memArr['data_from'])){ + $result['data_from'] = $memArr['data_from'] ?? 'excel'; + } + return $result; } } } -if (!function_exists('premium_calculation_manager')) { - function premium_calculation_manager($emp_data, $policy_terms, $slab_details, $default_si = null) +if (!function_exists('premium_calculation_manager_old')) { + function premium_calculation_manager_old($emp_data, $policy_terms, $slab_details, $default_si = null) { // dd($emp_data,$policy_terms,$slab_details,$default_si); @@ -1429,8 +1439,8 @@ if (!function_exists('premium_calculation_manager')) { } } -if (!function_exists('premium_calculation_manager_new')) { - function premium_calculation_manager_new($emp_data, $policy_terms, $slab_details, $default_si = null) +if (!function_exists('premium_calculation_manager')) { + function premium_calculation_manager($emp_data, $policy_terms, $slab_details, $default_si = null) { // dd($emp_data,$policy_terms,$slab_details,$default_si); @@ -2875,31 +2885,64 @@ if (!function_exists('is_valid_or_empty_email')) { if (!function_exists('validatet_family_floter_rata_premium')) { function validatet_family_floter_rata_premium($family){ + // print_rr($family); die; if (count($family) === 2) { return $family; // skip if only two members } + $excelCount = count(array_filter($family, fn($r) => ($r['data_from'] ?? '') === 'excel') ?? []); + $reset_family_premium = false; $dependentRataGiven = false; + if($excelCount == 1){ + + $selfPremium = 0; + $familyPremium = 0; + + foreach ($family as $row) { + + // Get self premium + if (isset($row['relationship']) && strtolower($row['relationship']) == 'self') { + $selfPremium = (float) ($row['policy_details']['rata_premimum'] ?? 0); + } + + // Sum the dependents premium + if (isset($row['relationship']) && strtolower($row['relationship']) !== 'self') + { + $familyPremium += (float) ($row['policy_details']['rata_premimum'] ?? 0); + } + } + + if($selfPremium > $familyPremium || $selfPremium == $familyPremium){ + $reset_family_premium = true; + } + } + foreach ($family as &$row) { // Skip if the member is self - if (strtolower($row['relationship']) == 'self') { + if (isset($row['relationship']) && strtolower($row['relationship']) == 'self') { continue; } // For dependents if (isset($row['temp']['premium_type']) && $row['temp']['premium_type'] == 1) { - if (!$dependentRataGiven) { + if (!$dependentRataGiven && isset($row['data_from']) && $row['data_from'] === 'excel') { // First eligible dependent keeps premium $dependentRataGiven = true; - } else { + } else if(isset($row['data_from']) && $row['data_from'] === 'excel'){ + $row['policy_details']['rata_premimum'] = 0; + $row['policy_details']['gst'] = 0; + } + + if($reset_family_premium == true && isset($row['data_from']) && $row['data_from'] === 'excel'){ $row['policy_details']['rata_premimum'] = 0; $row['policy_details']['gst'] = 0; } } + } return $family; From e853d027af6d745ad19464194aa669594e26fc13 Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Thu, 27 Nov 2025 12:03:58 +0530 Subject: [PATCH 003/110] FIX_The attachment option is currently missing. Please enable it.(First 4 only REF: SVR) --- app/Views/notification.php | 121 +++++++++++++++++++++++++++---------- 1 file changed, 89 insertions(+), 32 deletions(-) diff --git a/app/Views/notification.php b/app/Views/notification.php index b346857a..341871ec 100755 --- a/app/Views/notification.php +++ b/app/Views/notification.php @@ -421,7 +421,7 @@ - +
@@ -604,6 +604,18 @@ +
Attachments
+ + + + + + + + + +
AttachmentsAction
+
@@ -1439,8 +1451,8 @@ function addHTMLInput(data = null) { - console.log('addHTMLInput function called'); - console.log(template_name); + console.log(`:) addHTMLInput function called for ${template_name}`); // REF : PS + var container = ''; if (template_name == 'member_welcome_mail') { container = document.getElementById('attachment_tbody'); @@ -1448,6 +1460,9 @@ else if (template_name == 'member_common_mail') { container = document.getElementById('attachment_tbody_common'); } + else if (template_name == 'member_reminder_mail') { + container = document.getElementById('attachment_tbody_reminder'); + } else { container = document.getElementById('attachment_tbody_ecard'); } @@ -1472,20 +1487,39 @@ const newFormRow = document.createElement('tr'); newFormRow.className = 'dynamic-form-row'; - newFormRow.innerHTML = ` - -
-
-
- + // newFormRow.innerHTML = ` + // + // + //
+ //
+ // + //
+ //
+ // + //
+ //
+ // + // + // `; // DONT DELETE IT REF : VVJ + + newFormRow.innerHTML = ` +
+
+
+ +
+
+ +
-
- -
-
- - - `; + + `; // REF : PS container.appendChild(newFormRow); @@ -1493,21 +1527,38 @@ // If no data is passed, create a new empty row const newRow = document.createElement('tr'); newRow.className = 'dynamic-form-row'; + newRow.innerHTML = `
+
+
+ +
+
+ +
+
+
+ `; // REF : PS - newRow.innerHTML = ` - -
-
-
- -
-
- -
-
-
- - `; + // newRow.innerHTML = ` + // + //
+ //
+ //
+ // + //
+ //
+ // + //
+ //
+ //
+ // + // `; // DONT DELETE IT REF : VVJ container.appendChild(newRow); } } @@ -1519,6 +1570,9 @@ else if (template_name == 'member_common_mail') { container = document.getElementById('attachment_tbody_common'); } + else if (template_name == 'member_reminder_mail') { + container = document.getElementById('attachment_tbody_reminder'); + } else { const container = document.getElementById('attachment_tbody_ecard'); } @@ -1537,6 +1591,7 @@ // var template_name = template_name; var client_id = $('#general_PrimaryKey').val(); // console.log(client_id); + console.log(`:) Submitted for ${template_name}`); const formData = new FormData(form); formData.append('template_name', template_name); @@ -1771,7 +1826,7 @@ const validTemplates = [ "account_maneger_summary_mail", "member_reminder_mail","member_common_mail", "member_ecard_mail", "member_welcome_mail", "member_review_and_summary_mail", "client_hr_summary_mail" ]; - + console.log(`:) getMailTemplateData function called for ${template_name}`); // REF : PS if (!validTemplates.includes(template_name)) { console.error("Invalid template name:", template_name); return; @@ -1789,7 +1844,7 @@ type: "GET", dataType: 'json', success: function(res) { - console.log('get Mail Template Data', res); + console.log(':) getMailTemplateData Resp are', res); if (res) { // Set subject @@ -1840,6 +1895,8 @@ $('.testmail').toggle(!!res.id); $('#attachment_table').toggle(!!res.id); $('#attachment_table_ecard').toggle(!!res.id); + $('#attachment_table_common').toggle(!!res.id); + $('#attachment_table_reminder').toggle(!!res.id); $('.setid').attr('data-id', res.id || ''); if (template_name == "member_common_mail"){ $('#notification_temp_id').val(res.id); From 5dec08dba85cdfcc74d95b303a9f74549c60f460 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 27 Nov 2025 12:41:54 +0530 Subject: [PATCH 004/110] FIX_GET_VERIFIED_USER_DATA_OTP_EMPTY_HANDLE --- .../RestAuthenticationController.php | 77 ++++++++++--------- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index 761ceffa..8bd9962b 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -398,47 +398,54 @@ class RestAuthenticationController extends AdminController $otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null; $client_id = $this->request->getJSON()->client_id ?? null; - if (isset($mobile_number)) - { - // $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->where('emp_status !=', 'truncated')->where('is_active', 1)->first(); - $builder = $this->employeeModel - ->select('employees.*') - ->join('employee_polices', 'employees.id = employee_polices.employee_id') - ->where('employees.mobile', $mobile_number) - ->where('employees.relationship', 'Self') - ->where('employee_polices.is_active', 1) - ->whereIn('employee_polices.status', ['active', 'expired']) - ->where('employees.is_active', 1) - ->whereIn('employees.emp_status', ['active', 'expired']) - ->where('otp', $otp); + if(empty($otp)){ + return $this->respond(['status' => 'failed','code' => 400,'message' => 'OTP is required'], 200); + } - if (!empty($client_id)) { - $builder->where('employees.client_id', $client_id); - } + if (empty($mobile_number) && empty($email_id)) { + return $this->respond(['status' => 'failed','code' => 400,'message' => 'Mobile number or Email ID is required'], 200); + } - $employeeData = $builder->orderBy('employees.id', 'desc')->first(); + if (isset($mobile_number)) + { + // $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->where('emp_status !=', 'truncated')->where('is_active', 1)->first(); + $builder = $this->employeeModel + ->select('employees.*') + ->join('employee_polices', 'employees.id = employee_polices.employee_id') + ->where('employees.mobile', $mobile_number) + ->where('employees.relationship', 'Self') + ->where('employee_polices.is_active', 1) + ->whereIn('employee_polices.status', ['active', 'expired']) + ->where('employees.is_active', 1) + ->whereIn('employees.emp_status', ['active', 'expired']) + ->where('otp', $otp); - } else { - // $employeeData = $this->employeeModel->where('email_corporate', $email_id)->where('otp', $otp)->where('relationship', 'self')->where('emp_status !=', 'truncated')->where('is_active', 1)->first(); - $builder = $this->employeeModel - ->select('employees.*') - ->join('employee_polices', 'employees.id = employee_polices.employee_id') - ->where('employees.email_corporate', $email_id) - ->where('employees.relationship', 'Self') - ->where('employee_polices.is_active', 1) - ->whereIn('employee_polices.status', ['active', 'expired']) - ->where('employees.is_active', 1) - ->whereIn('employees.emp_status', ['active', 'expired']) - ->where('otp', $otp); + if (!empty($client_id)) { + $builder->where('employees.client_id', $client_id); + } - if (!empty($client_id)) { - $builder->where('employees.client_id', $client_id); - } + $employeeData = $builder->orderBy('employees.id', 'desc')->first(); - $employeeData = $builder->orderBy('employees.id', 'desc')->first(); - } + } else { + // $employeeData = $this->employeeModel->where('email_corporate', $email_id)->where('otp', $otp)->where('relationship', 'self')->where('emp_status !=', 'truncated')->where('is_active', 1)->first(); + $builder = $this->employeeModel + ->select('employees.*') + ->join('employee_polices', 'employees.id = employee_polices.employee_id') + ->where('employees.email_corporate', $email_id) + ->where('employees.relationship', 'Self') + ->where('employee_polices.is_active', 1) + ->whereIn('employee_polices.status', ['active', 'expired']) + ->where('employees.is_active', 1) + ->whereIn('employees.emp_status', ['active', 'expired']) + ->where('otp', $otp); + + if (!empty($client_id)) { + $builder->where('employees.client_id', $client_id); + } + + $employeeData = $builder->orderBy('employees.id', 'desc')->first(); + } - $lastQuery = $this->employeeModel->db->getLastQuery(); $this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: Last Executed Query: " . $lastQuery); $this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: employeeData: " . json_encode($employeeData ?? [])); From 148441ccf4de944e6a6ef074de36a9dd196b683c Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 27 Nov 2025 13:39:11 +0530 Subject: [PATCH 005/110] FIX_OTP --- 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 8bd9962b..4a4b7cbd 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -399,7 +399,7 @@ class RestAuthenticationController extends AdminController $client_id = $this->request->getJSON()->client_id ?? null; if(empty($otp)){ - return $this->respond(['status' => 'failed','code' => 400,'message' => 'OTP is required'], 200); + return $this->respond(['status' => 'OTP is required','code' => 400,'message' => 'OTP is required'], 200); } if (empty($mobile_number) && empty($email_id)) { From fa304196afe47f5cafe7f858a6b30d509a79dc07 Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Thu, 27 Nov 2025 17:54:11 +0530 Subject: [PATCH 006/110] FIX_Mail 3rd and 4th (In the client notification email feature, comma-separated emails currently send to the first address with others in CC. We need all emails sent as individual TO recipients so they cannot see each other's addresses.) --- app/Controllers/NotificationController.php | 46 ++-- app/Views/notification.php | 291 +++++++++++++-------- app/Views/ticket_form_gmc.php | 1 + 3 files changed, 213 insertions(+), 125 deletions(-) diff --git a/app/Controllers/NotificationController.php b/app/Controllers/NotificationController.php index 98067fa9..e288a7a0 100755 --- a/app/Controllers/NotificationController.php +++ b/app/Controllers/NotificationController.php @@ -217,40 +217,44 @@ class NotificationController extends AdminController } // This function for sent a mail for testing - public function sentTestMail($template_id, $test_mail) + // keep watching this + public function sentTestMail($template_id, $test_mail, $string_flag) { $notification_data = $this->notificationModel->where('id', $template_id)->first(); + + + if(empty($notification_data)) { + return $this->respond(['status' => false,'code' => 200, 'message' => 'Notification Template not enabled']); + } + $client_data = $this->clientModel->where('id', $notification_data['client_id'])->where('is_active', 1)->first(); - if(!empty($notification_data)){ - - $params = [ + $params = [ 'client_data' => $client_data, 'notification_data' => $notification_data, 'test_mail' => $test_mail - ]; + ]; - $testMailData = sendMailNotification::sendMailNotificationForTesting($notification_data['template_name'], $params); - // print_r($testMailData); die; - if (!empty($testMailData)) { + $testMailData = sendMailNotification::sendMailNotificationForTesting($notification_data['template_name'], $params); - $mail_send_return1 = MailHelper::send_email($testMailData); - $this->myLogger->logme("info", $mail_send_return1); - $this->myLogger->logme("info", $mail_send_return1); + if(empty($testMailData)) { + return $this->respond(['status' => false,'code' => 200, 'message' => 'Test Mail Data Does Not Exist']); + } - return $this->respond(['status' => true,'code' => 200, 'respond' => json_decode($mail_send_return1)]); - - }else{ - - return $this->respond(['status' => false,'code' => 200, 'message' => 'Test Mail Data Does Not Exist']); - } - }else{ - - return $this->respond(['status' => false,'code' => 200, 'message' => 'Notification Template not enabled']); + if($string_flag == "send"){ + $mail_send_return1 = MailHelper::send_email($testMailData); + $this->myLogger->logme("info", $mail_send_return1); + return $this->respond(['status' => true,'code' => 200, 'respond' => json_decode($mail_send_return1)]); + } + if($string_flag == "preview"){ + return $this->respond([ + 'status' => true, + 'code' => 200, + 'content' => $testMailData + ]); } } - public function sendCommonTestMail() diff --git a/app/Views/notification.php b/app/Views/notification.php index 341871ec..5248c2bf 100755 --- a/app/Views/notification.php +++ b/app/Views/notification.php @@ -342,7 +342,7 @@ - +