From ec5ae2349764eb56040e2365f07b7a0460bee8f5 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 13 Jun 2024 17:41:23 +0530 Subject: [PATCH] FEAT_OTHER_POLICY_TERMS : RV --- app/Config/Routes.php | 1 + app/Controllers/ClientController.php | 24 ++ app/Views/client_policy.php | 33 +- app/Views/other_policy_terms.php | 593 +++++++++++++++++++++++++++ app/Views/policy_gmc_terms.php | 60 +-- app/Views/policy_gpa_terms.php | 2 +- 6 files changed, 667 insertions(+), 46 deletions(-) create mode 100644 app/Views/other_policy_terms.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 34426123..f8e0756c 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -114,6 +114,7 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) { $routes->group("terms", ["filter" => "authMVC"], function ($routes) { $routes->post("gpa_create", "ClientController::policyGPATerms"); $routes->post("edit", "ClientController::editClientPolicyPremium"); + $routes->post("other_terms", "ClientController::otherPolicyTermsFormSubmit"); }); }); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 2dbe4d60..d6b271f7 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -2157,4 +2157,28 @@ class ClientController extends AdminController } + public function otherPolicyTermsFormSubmit() + { + + $client_policy_id = $this->request->getPost("client_policy_id"); + $policy_terms = $this->request->getPost("policy_terms"); + + $record = $this->clientPolicyModel->where('id', $client_policy_id)->first(); + + if ($record) { + + $update = $this->clientPolicyModel->where('id', $client_policy_id)->set('policy_terms', $policy_terms)->update(); + + if ($update) { + return $this->respond(['status' => true, 'code' => 200, 'message' => 'Data updated successfully', 'client_policy_id' => $client_policy_id], 200); + } 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); + } + } + + } \ No newline at end of file diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 00cb1960..9ccb3996 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -157,6 +157,7 @@ + + + + \ No newline at end of file diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php index 2b710321..3893ee7f 100644 --- a/app/Views/policy_gmc_terms.php +++ b/app/Views/policy_gmc_terms.php @@ -615,7 +615,7 @@ // $('input[name="family_floater"]').change(function() { - // console.log($(this).val()); + // //console.log($(this).val()); // if ($(this).val() == '1') { // var element = $(this).parent().next()[0]; // $(element).css("display", "block"); @@ -631,7 +631,7 @@ $('input[name="ayudhtreatmentcover"]').change(function() { - console.log($(this).val()); + ////console.log($(this).val()); if ($(this).val() == '1') { var element = $(this).parent().parent().next()[0]; @@ -645,7 +645,7 @@ $('input[name="cataract"]').change(function() { - console.log($(this).val()); + //console.log($(this).val()); if ($(this).val() == '1') { var element = $(this).parent().parent().next()[0]; @@ -715,7 +715,7 @@ } if (!isValid) { - console.log('Form is Empty', 'Warning'); + //console.log('Form is Empty', 'Warning'); return; } @@ -751,7 +751,7 @@ setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - console.log('Something Wrong!', 'warning'); + //console.log('Something Wrong!', 'warning'); }, 1000); } }); @@ -773,14 +773,14 @@ $('body').on('click', '.btnPolicyMaster', function() { var client_policy_id = $(this).data('id'); - console.log('gmc_client_policy_id :', client_policy_id); + //console.log('gmc_client_policy_id :', client_policy_id); $('#gmc_client_policy_id').val(client_policy_id) $('.removeDom').remove(); var gmc_policy_type_id = $(this).attr('id'); - // console.log(gmc_policy_type_id) + // //console.log(gmc_policy_type_id) if (gmc_policy_type_id == 'GMC') { @@ -798,10 +798,10 @@ client_policy_id: client_policy_id }, success: function(response) { - console.log('response', response); + //console.log('response', response); - // console.log('count', response.count); + // //console.log('count', response.count); setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); @@ -809,18 +809,18 @@ $('#nameOfThePolicyInGMC').html(' - ' + response.policy_name.name); $('gmc_emp_count').val(response.count); - // console.log('count--1', response.count); + // //console.log('count--1', response.count); // $('emp_count').val(response.count) // if (response && response.hasOwnProperty('count')) { // if (response.count === false) { - // console.log('count -- 2', response.count); - // console.log(document.getElementById('btnGridSubmit1')) + // //console.log('count -- 2', response.count); + // //console.log(document.getElementById('btnGridSubmit1')) // $("#btnGridSubmit1").hide(); // $("#myButtonSpecialCondition").hide(); // } else { // $("#btnGridSubmit1").show(); // $("#myButtonSpecialCondition").show(); - // console.log('count -- ', response.count); + // //console.log('count -- ', response.count); // } // } else { // console.error('Response object does not have a "count" property or is invalid.'); @@ -849,13 +849,13 @@ } } - console.log('key', key) + //console.log('key', key) let elements = document.getElementsByName(`${key}[]`); - console.log(elements) + //console.log(elements) if (elements) { elements.forEach((element, index) => { - console.log() + //console.log() if(jsonObject[key][index] == undefined){ element.value = " "; }else{ @@ -869,8 +869,8 @@ let checkboxes = document.querySelectorAll(`input[name="${key}[]"]`); if (jsonObject[key]) { - console.log(jsonObject[key]); - // console.log(jsonObject[key]); + //console.log(jsonObject[key]); + // //console.log(jsonObject[key]); if (jsonObject[key].childrens) { $('#children').val(jsonObject[key].childrens); } @@ -998,7 +998,7 @@ pTag.innerHTML = jsonObject[key]; // Add your new content inside the

tag } } - // console.log(jsonObject[key]); + // //console.log(jsonObject[key]); } else { if(jsonObject[key] == undefined){ @@ -1047,8 +1047,8 @@ $('.spouse-age').css('display','none'); } - console.log("child "); - console.log($('#children').val()); + //console.log("child "); + //console.log($('#children').val()); if($('#children').val() != 0){ $('.child-age').css('display',''); @@ -1087,7 +1087,7 @@ setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - console.log('Something Wrong!', 'warning'); + //console.log('Something Wrong!', 'warning'); }, 1000); } }); @@ -1109,8 +1109,8 @@ $('.spouse-age').css('display','none'); } - console.log("child "); - console.log($('#children').val()); + //console.log("child "); + //console.log($('#children').val()); if($('#children').val() != 0){ $('.child-age').css('display',''); @@ -1179,7 +1179,7 @@