diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index e113a8c0..0a21c731 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -1021,28 +1021,28 @@ class ClientController extends AdminController $policy_grid_id = $this->request->getPost('policy_grid_id'); $rack_rate_name = $this->request->getPost('rack_rate_name'); - $self = $this->request->getPost('self') ? 1 : 0; - $spouse = $this->request->getPost('spouse'); - $childrens = $this->request->getPost('childrens'); - $parents = $this->request->getPost('parents'); - $parents_in_law = $this->request->getPost('parents-in-law'); + $relation_data = [ + 'self' => $this->request->getPost('self'), + 'spouse' => $this->request->getPost('spouse'), + 'childrens' => $this->request->getPost('childrens'), + 'parents' => $this->request->getPost('parents'), + 'parents-in-law'=> $this->request->getPost('parents-in-law'), + ]; - if($policy_grid_id == 1 || $policy_grid_id == 2){ - $self = 1; - $spouse = 'NA'; - $childrens = 'NA'; - $parents = 'NA'; - $parents_in_law = 'NA'; + if ($policy_grid_id == 1 || $policy_grid_id == 2 || $policy_grid_id == 6 || $policy_grid_id == 7) { + $relation_data = [ + 'self' => 1, + 'spouse' => 'NA', + 'childrens' => 'NA', + 'parents' => 'NA', + 'parents-in-law'=> 'NA', + ]; } - $relation_data['self'] = $self; - $relation_data['spouse'] = $spouse; - $relation_data['childrens'] = $childrens; - $relation_data['parents'] = $parents; - $relation_data['parents-in-law'] = $parents_in_law; - + // Convert to JSON $jsonDataForRelation = json_encode($relation_data); + $si_or_bp = $this->request->getPost('si_or_bp'); $basic_multiplier = str_replace(',', '', $this->request->getPost('basic_multiplier')); $premium_multiplier = str_replace(',', '', $this->request->getPost('premium_multiplier')); diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 86baa139..1ca428b1 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -488,6 +488,9 @@ $('#policy_table tr').remove(); var policyTable = ''; + var role = res.data.role + delete res.data.role; + $.each(res.data, function(index, item) { var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc' @@ -543,9 +546,9 @@