diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 039f6f99..89069011 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -2726,7 +2726,9 @@ class ClientController extends AdminController $search_term = 'GMC'; } else if (preg_match($gpa_pattern, $subject) || $policy_type_id == 6 || $policy_type_id == 7) { $search_term = 'GPA'; - } else { + } else if($policy_type_id == 72){ + $search_term = 'GMC'; + }else { $search_term = ""; } @@ -2736,7 +2738,7 @@ class ClientController extends AdminController if ($search_term === 'GPA' || $policy_type_id == 6 || $policy_type_id == 7) { $premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll(); - } else if ($search_term === 'GMC') { + } else if ($search_term === 'GMC' || $policy_type_id == 72) { $premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll(); @@ -2766,7 +2768,7 @@ class ClientController extends AdminController // echo '
';
// echo $family_floater;
- if ($search_term === 'GMC') {
+ if ($search_term === 'GMC' || $policy_type_id == 72 ) {
// $resultss = [];
$resultss = $results;
@@ -3400,6 +3402,7 @@ class ClientController extends AdminController
[
'Status' => true,
'code' => 200,
+ 'policy_type_id' => $record['policy_type_id'],
'data' => $record['policy_terms'],
'policy_addon' => $record['is_addon'],
'emp_count_by_policy' => $emp_count_by_policy
@@ -4225,34 +4228,41 @@ class ClientController extends AdminController
$client_policy_id = $this->request->getPost("client_policy_id");
$policy_terms = $this->request->getPost("policy_terms");
$policy_terms = json_decode($policy_terms, true);
-
- $data = [];
-
- foreach ($policy_terms as $key => $value) {
-
- if (str_ends_with($key, '_display')) {
-
- $original_key = substr($key, 0, -8);
-
- $newKey = implode(' ', array_map('ucfirst', explode('_', $original_key)));
-
- $data['enrollment_display_key'][$newKey] = $policy_terms[$original_key] ?? " ";
- } else {
-
- $data[$key] = $value;
- }
- }
-
- if (!empty($data)) {
- $policy_terms['is_payable_employee']['self'] = 0;
- $policy_terms = json_encode($data);
- }
-
-
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
+ // print_r($policy_terms); die;
+
+ if(empty($policy_terms)){
+ return $this->respond(['status' => false, 'code' => 404, 'message' => 'Policy terms data could not be empty', 'formdata' => $this->request->getPost()], 200);
+ }
if ($record) {
+ $data = [];
+
+ foreach ($policy_terms as $key => $value) {
+
+ if (str_ends_with($key, '_display')) {
+
+ $original_key = substr($key, 0, -8);
+
+ $newKey = implode(' ', array_map('ucfirst', explode('_', $original_key)));
+
+ $data['enrollment_display_key'][$newKey] = $policy_terms[$original_key] ?? " ";
+ } else {
+
+ $data[$key] = $value;
+ }
+ }
+
+ if($record['policy_type_id'] == 72){
+ $data['enrollment_display_key'] = $this->otherPolicyTermsDisplayKeyConstruct($policy_terms);
+ }
+
+ if (!empty($data)) {
+ $policy_terms['is_payable_employee']['self'] = 0;
+ $policy_terms = json_encode($data);
+ }
+
$update = $this->clientPolicyModel->where('id', $client_policy_id)->set('policy_terms', $policy_terms)->update();
if ($update) {
@@ -4260,12 +4270,34 @@ class ClientController extends AdminController
} else {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update data', 'formdata' => $this->request->getPost()], 200);
}
+
} else {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to store data. The client policy does not exist', 'formdata' => $this->request->getPost()], 200);
}
}
+ public function otherPolicyTermsDisplayKeyConstruct($data)
+ {
+ $labels = $data['special_condition_label'] ?? [];
+ $values = $data['special_condition_input'] ?? [];
+
+ $special_conditions = [];
+
+ foreach ($labels as $i => $label) {
+ $value = $values[$i] ?? '';
+
+ // skip if label or value is empty
+ if (trim($label) === '' || trim($value) === '') {
+ continue;
+ }
+
+ $special_conditions[$label] = $value;
+ }
+
+ return $special_conditions;
+ }
+
public function checkPolicyType($policy_type_id, $client_branch_id, $client_id)
{
@@ -5971,8 +6003,8 @@ class ClientController extends AdminController
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
$empServiceController = new EmployeeServiceController();
- // $res = $empServiceController->excelFileFormatValidation(['file_id' => '1126']);
- // $res = $empServiceController->excelFileDataValidation(['file_id' => '865']);
+ // $res = $empServiceController->excelFileFormatValidation(['file_id' => '1248']);
+ // $res = $empServiceController->excelFileDataValidation(['file_id' => '1248']);
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1183]);
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1169]);
// $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]);
diff --git a/app/Views/other_policy_terms.php b/app/Views/other_policy_terms.php
index 16166973..5174a53c 100755
--- a/app/Views/other_policy_terms.php
+++ b/app/Views/other_policy_terms.php
@@ -72,6 +72,11 @@
margin-left: 30px;
width: 689px;
}
+
+ .other-speciial-condition{
+ margin-left: 150px;
+ width: 564px;
+ }
\ No newline at end of file
diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php
index 4db9f219..af786b4b 100755
--- a/app/Views/policy_grid.php
+++ b/app/Views/policy_grid.php
@@ -3522,7 +3522,7 @@ function hideShowPolicyPremium(policy_type_string, unique_id = null)
individual = $('#individual_' + unique_id);
}
- if (policy_type_string == 'GMC') {
+ if (policy_type_string == 'GMC' || policy_type_string == 'OPD') {
premium_type.show();
individual.prop('checked', true)
} else {