diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 973a5d3c..70abe646 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -497,11 +497,13 @@ class EmployeeRestController extends AdminController try { $file = $this->request->getFile('file'); $client_id = $this->request->getPost('client_id'); - // $client_id = $this->request->getJSON('client_id'); $policy_id = $this->request->getPost('policy_id'); - $employee_id = $this->request->getPost('employee_id'); - // $policy_id = $this->request->getJSON('policy_id'); + $token = $this->request->headers()['Auth']->getValue(); + $decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true); + + // get the employee id from token + $employee_id = $decodedPayload['id']; $client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->first(); @@ -586,18 +588,18 @@ class EmployeeRestController extends AdminController } $dataToInsert = []; $basic_cover_si= []; - if ($extra[9]) { - $new_array = []; - for ($i=0; $i < count($extra[9]); $i++) { - if ($sum_insured_amount_for_check_employee_2 != $extra[9][$i] || $sum_insured_amount_for_check_employee_1 != $extra[9][$i]) { - $new_array[] = $i+1; - } - } - if (count($new_array) > 0) { - $count =count($new_array); - return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "$count Employee Sum Insured is Not Match.. " , 'data' => $new_array], 200); - } - } + // if ($extra[9]) { + // $new_array = []; + // for ($i=0; $i < count($extra[9]); $i++) { + // if ($sum_insured_amount_for_check_employee_2 != $extra[9][$i] || $sum_insured_amount_for_check_employee_1 != $extra[9][$i]) { + // $new_array[] = $i+1; + // } + // } + // if (count($new_array) > 0) { + // $count =count($new_array); + // return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "$count Employee Sum Insured is Not Match.. " , 'data' => $new_array], 200); + // } + // } foreach ($extra['0'] as $index => $id) { $relation =''; if ($extra['5'][$index] === 'Mother' || $extra['5'][$index] === 'Father') { diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php index 2ebafcc9..01bc2a2c 100644 --- a/app/Models/ClientPolicyModel.php +++ b/app/Models/ClientPolicyModel.php @@ -61,12 +61,14 @@ class ClientPolicyModel extends Model } public function getClientPolicyByClientId($client_id){ + return $this->db->table('client_policy') ->select('client_policy.*') ->select('insurers.name as insurer_name, insurers.short_name as insurer_short') ->select('tpa.name as tpa_name, tpa.short_name as tpa_short') - ->select('policies.name as policy_name') + ->select('policies.name as policy_name, policies.policy_type_id') + ->select('policy_type.policy_type as policy_type_name') ->select('insurer_branch.branch_name as insurer_branch_name, insurer_branch.branch_code as insurer_branch_code') ->select('tpa_branch.branch_name as tpa_branch_name, tpa_branch.branch_code as tpa_branch_code') ->join('insurers', 'insurers.id = client_policy.insurer_id') @@ -74,10 +76,13 @@ class ClientPolicyModel extends Model ->join('tpa', 'tpa.id = client_policy.tpa_id') ->join('tpa_branch', 'client_policy.tpa_branch_id = tpa_branch.id') ->join('policies', 'policies.id = client_policy.policy_id') + ->join('policy_type', 'policy_type.id = policies.policy_type_id') ->where('client_policy.client_id', $client_id) ->get() ->getResult(); + + } public function getPolicyPremium($policy_id){ diff --git a/app/Views/client_basic_info.php b/app/Views/client_basic_info.php index 9d562f2b..3f08c20a 100644 --- a/app/Views/client_basic_info.php +++ b/app/Views/client_basic_info.php @@ -105,13 +105,11 @@ input:checked + .slider:before {
- +
- +
diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 9018586c..a4e893ab 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -194,12 +194,15 @@ if (policy_PrimaryKey !== '') { var policyTable = ''; var data = ; - data.forEach(function(item) { + // console.log("----------------------------"); + + // console.log(item); + policyTable += ` ${item.insurer_short} - ${item.insurer_branch_name} - ${item.policy_name} + ${item.policy_name} (${item.policy_type_name}) ${item.tpa_short} - ${item.tpa_branch_code} ${rearrangeDateFormat(item.policy_start_date)} - ${rearrangeDateFormat(item.policy_end_date)} ${checkDateStatus(item.policy_end_date, 1)} diff --git a/app/Views/employee_list.php b/app/Views/employee_list.php index db60f466..db203bcd 100644 --- a/app/Views/employee_list.php +++ b/app/Views/employee_list.php @@ -75,7 +75,7 @@ table.dataTable tbody td { Name/code Policy name - Insurar name + Insurer name TPA ID UHID ID Policy status diff --git a/app/Views/endorsement_list.php b/app/Views/endorsement_list.php new file mode 100644 index 00000000..75e5509c --- /dev/null +++ b/app/Views/endorsement_list.php @@ -0,0 +1,259 @@ + + +
+
+
+
+
+ + + +
+
+
+ +
+
+
+
+ +
+
+
+
+
+ +
+
+
+ + +
+
+
+
+
+
+ + + +
+
+
+
+
+
+

Endorsement List

+
+ +
+ + + + + + + + + + + + + + + + + $employee) { ?> + + + + + + + + + + + + + + + + +
SNOName/codePolicy nameInsurar nameTPA IDUHID IDPolicy statusPremiumAction
( )active + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/app/Views/kyc_docs.php b/app/Views/kyc_docs.php index 0ec33c05..6567df7c 100644 --- a/app/Views/kyc_docs.php +++ b/app/Views/kyc_docs.php @@ -324,6 +324,7 @@ $(document).ready(function () { function removeKYCDocs(element) { + var kyc_docs_id_for_reload = $('#kyc_type_id').val(); var id = element.getAttribute('data-id'); var form_action = '' + id; $.ajax({ @@ -338,7 +339,8 @@ $(document).ready(function () { if (res.status == true) { toastr.success('Remove Done!', 'success'); - location.reload(); + // location.reload(); + window.location.href = '' + kyc_docs_id_for_reload; } else { toastr.warning('Remove Not Done!', 'warning'); diff --git a/app/Views/policies.php b/app/Views/policies.php index 83560c37..6ae8f361 100644 --- a/app/Views/policies.php +++ b/app/Views/policies.php @@ -340,57 +340,58 @@ $(document).ready(function () { function loadPoliciesList() { var base_url = ''; - var insurer_branch_action = base_url + policy_type_PrimaryKey; + var insurer_branch_action = base_url + policy_type_PrimaryKey; - if ($('#policy_type_id').val() != '') { - - $('.loader').fadeIn(); - $('.loader-mask').fadeIn(); - $.ajax({ - url: insurer_branch_action, - type: 'GET', - success: function(response) { + if ($('#policy_type_id').val() != '') { + + $('.loader').fadeIn(); + $('.loader-mask').fadeIn(); + $.ajax({ + url: insurer_branch_action, + type: 'GET', + success: function(response) { - console.log("response", response); + console.log("response", response); - setTimeout(function() { - $('.loader').fadeOut(); - $('.loader-mask').delay(350).fadeOut('slow'); - }, 1000); - var branchTable = ''; - $.each(response.policies, function(index, item) { - console.log(item); - branchTable += ` - - ${item.insurer.name} - ${item.policy.name} - - - - - - `; - }); - $('#policies_list').append(branchTable); - }, - error: function(xhr, status, error) { - console.error(xhr.responseText); - console.error(status, error); + setTimeout(function() { + $('.loader').fadeOut(); + $('.loader-mask').delay(350).fadeOut('slow'); + }, 1000); + var branchTable = ''; + $.each(response.policies, function(index, item) { + console.log(item); + branchTable += ` + + ${item.insurer.name} + ${item.policy.name} + + + + + + `; + }); + $('#policies_list').append(branchTable); + }, + error: function(xhr, status, error) { + console.error(xhr.responseText); + console.error(status, error); - setTimeout(function() { - $('.loader').fadeOut(); - $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); - }, 1000); - } - }); - } + setTimeout(function() { + $('.loader').fadeOut(); + $('.loader-mask').delay(350).fadeOut('slow'); + toastr.warning('Something Wrong!', 'warning'); + }, 1000); + } + }); + } } }); function removePolicies(element) { + var policy_id_for_reload = $('#policy_type_id').val() var id = element.getAttribute('data-id'); var form_action = '' + id; $.ajax({ @@ -407,7 +408,8 @@ function removePolicies(element) { // $('#branch_table').empty(); - location.reload(); + // location.reload(); + window.location.href = '' + policy_id_for_reload; } else { toastr.warning('Remove Not Done!', 'warning'); diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index e905c2b3..321823d4 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -3,17 +3,17 @@ # This template allows you to validate your PHP application. # The workflow allows running tests and code linting on the default branch. -image: composer:2.0 +image: php:8.2-cli pipelines: default: - - parallel: - - step: - name: Test - script: - - apt-get update - - apt-get -qq install git-ftp - - git ftp push -u $FTP_USERNAME -p $FTP_PASSWORD $FTP_URL - caches: - - composer \ No newline at end of file + - step: + name: Initialize and Deploy using Git FTP + script: + - apt-get update + - apt-get -qq install git-ftp + - git ftp init -u $FTP_USERNAME -p $FTP_PASSWORD $FTP_URL + - git ftp push -u $FTP_USERNAME -p $FTP_PASSWORD $FTP_URL + caches: + - composer diff --git a/public/assets/api.yaml b/public/assets/api.yaml index 4d3e8f7e..d8159bab 100644 --- a/public/assets/api.yaml +++ b/public/assets/api.yaml @@ -175,9 +175,6 @@ paths: policy_id: type: integer description: policy_id - employee_id: - type: integer - description: employee_id file: type: string format: binary