From 180110287c5119b4ae5b1174f17519cd8f562a75 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 24 May 2024 18:16:06 +0530 Subject: [PATCH] CHANGE_CLIENT_BRANCH_ID_ALL_PLACE_COMPLETE : RV --- app/Controllers/EmpDataServiceController.php | 31 +- app/Controllers/EmployeeController.php | 8 +- app/Controllers/PendingActionsController.php | 36 +- app/Helpers/excel_import_export_helper.php | 5 +- app/Models/EmployeePolicyModel.php | 14 +- app/Views/client_deposit_list.php | 2 +- app/Views/client_kyc.php | 96 +- app/Views/client_policy.php | 2509 ++++++++---------- app/Views/employee_list.php | 38 +- app/Views/employee_upload.php | 63 +- app/Views/endorsement_list.php | 44 +- app/Views/insurer_or_tpa_data.php | 93 +- app/Views/layout/footer.php | 20 +- app/Views/view_deposit.php | 2 +- 14 files changed, 1460 insertions(+), 1501 deletions(-) diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index 69f19725..9ece093c 100644 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -578,6 +578,7 @@ class EmpDataServiceController extends BaseController $file = $this->batchFileModel->where('id', $file_id)->first(); $client_id = $file['client_id']; $client_policy_id = $file['client_policy_id']; + $client_branch_id = $file['client_branch_id']; $batch_code = $file['batch_code']; @@ -626,6 +627,7 @@ class EmpDataServiceController extends BaseController ->join('employees', 'employees.id = employee_polices.employee_id') ->where('employee_polices.client_policy_id', $client_policy_id) ->where('employees.client_id', $client_id) + ->where('employees.client_branch_id', $client_branch_id) ->where("employee_polices.{$id} IS NULL OR employee_polices.{$id} = ''") ->findAll(); @@ -976,6 +978,7 @@ class EmpDataServiceController extends BaseController $client_id = $file['client_id']; $client_policy_id = $file['client_policy_id']; + $client_branch_id = $file['client_branch_id']; $insurer_or_tpa = $file['insurer_or_tpa']; $status = $file['status']; $batch_code = $file['batch_code']; @@ -1031,6 +1034,7 @@ class EmpDataServiceController extends BaseController $query->join('employees', 'employees.id = employee_polices.employee_id'); $query->where('employee_polices.client_policy_id', $client_policy_id); $query->where('employees.client_id', $client_id); + $query->where('employees.client_branch_id', $client_branch_id); $query->where('employees.name', $name); $query->where('employees.emp_code', $emp_code); if ($file['insurer_or_tpa'] == 'tpa') { @@ -1103,6 +1107,7 @@ class EmpDataServiceController extends BaseController 'employeeIds' => $emp_policy_ids, 'client_id' => $client_id, 'client_policy_id' => $client_policy_id, + 'client_branch_id' => $client_branch_id, 'count' => $emp_count, 'event' => $file['event_type'], 'policy_name' => $policy_name['policy_name'], @@ -1116,6 +1121,7 @@ class EmpDataServiceController extends BaseController 'employeeIds' => $emp_policy_ids, 'client_id' => $client_id, 'client_policy_id' => $client_policy_id, + 'client_branch_id' => $client_branch_id, 'count' => $emp_count, 'event' => $file['event_type'], 'policy_name' => $policy_name['policy_name'], @@ -1152,6 +1158,7 @@ class EmpDataServiceController extends BaseController $client_id = $import_data['client_id']; $client_policy_id = $import_data['client_policy_id']; + $client_branch_id = $import_data['client_branch_id']; $file = $import_data['file']; $data = $this->readExcelToArray($file); @@ -1181,6 +1188,7 @@ class EmpDataServiceController extends BaseController ->join('employee_polices', 'employee_polices.employee_id = employees.id') ->where('employee_polices.client_policy_id', $client_policy_id) ->where('employees.client_id', $client_id) + ->where('employees.client_branch_id', $client_branch_id) ->where('employee_polices.uhid', $uhid) ->where('employees.emp_code', $emp_code) ->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")') @@ -1211,10 +1219,6 @@ class EmpDataServiceController extends BaseController return 2; } - // if($empty_emp_tpa_uh_ids != $count){ - - // return 3; - // } if ($empty_id_count == 0) { @@ -1265,6 +1269,7 @@ class EmpDataServiceController extends BaseController ->join('employees', 'employees.id = employee_polices.employee_id') ->where('employee_polices.client_policy_id', $client_policy_id) ->where('employees.client_id', $client_id) + ->where('employees.client_branch_id', $client_branch_id) ->where('employee_polices.uhid', $uhid) ->where('employees.emp_code', $emp_code) ->where('employees.is_active', 1) @@ -1280,6 +1285,7 @@ class EmpDataServiceController extends BaseController ->join('employee_polices', 'employee_polices.employee_id = employees.id') ->where('employees.emp_code', $emp_code) ->where('employees.client_id', $client_id) + ->where('employees.client_branch_id', $client_branch_id) ->where('employee_polices.client_policy_id', $client_policy_id) ->where('employee_polices.uhid', $uhid) ->get() @@ -1319,6 +1325,7 @@ class EmpDataServiceController extends BaseController $client_id = $import_data['client_id']; $client_policy_id = $import_data['client_policy_id']; + $client_branch_id = $import_data['client_branch_id']; $file = $import_data['file']; $data = $this->readExcelToArray($file); @@ -1352,6 +1359,7 @@ class EmpDataServiceController extends BaseController ->where('employees.emp_code', $emp_code) ->where('employees.name', $emp_name) ->where('employees.client_id', $client_id) + ->where('employees.client_branch_id', $client_branch_id) ->where('emp_endorsement.actions', 'si') ->where('employee_polices.client_policy_id', $client_policy_id) ->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")') @@ -1449,6 +1457,7 @@ class EmpDataServiceController extends BaseController ->where('employees.emp_code', $emp_code) ->where('employees.name', $emp_name) ->where('employees.client_id', $client_id) + ->where('employees.client_branch_id', $client_branch_id) ->where('employee_polices.client_policy_id', $client_policy_id) ->where('employee_polices.is_active', 1) ->first(); @@ -1478,6 +1487,7 @@ class EmpDataServiceController extends BaseController ->join('employees', 'employees.id = employee_polices.employee_id') ->where('employee_polices.client_policy_id', $client_policy_id) ->where('employees.client_id', $client_id) + ->where('employees.client_branch_id', $client_branch_id) ->where('employees.name', $emp_name) ->where('employees.emp_code', $emp_code) ->where('employee_polices.is_active', 1) @@ -1500,6 +1510,7 @@ class EmpDataServiceController extends BaseController 'employeeIds' => $employeeIds, 'client_id' => $client_id, 'client_policy_id' => $client_policy_id, + 'client_branch_id' => $client_branch_id, 'count' => $count, 'event' => $import_data['event_type'], 'policy_name' => $policy_name['policy_name'], @@ -1517,6 +1528,7 @@ class EmpDataServiceController extends BaseController $client_id = $import_data['client_id']; $client_policy_id = $import_data['client_policy_id']; + $client_branch_id = $import_data['client_branch_id']; $file = $import_data['file']; @@ -1554,6 +1566,7 @@ class EmpDataServiceController extends BaseController ->where('employees.emp_code', $emp_code) ->where('employees.name', $emp_name) ->where('employees.client_id', $client_id) + ->where('employees.client_branch_id', $client_branch_id) ->where('emp_endorsement.actions', 'd') ->where('employee_polices.client_policy_id', $client_policy_id) ->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")') @@ -1644,6 +1657,7 @@ class EmpDataServiceController extends BaseController ->join('employees', 'employees.id = employee_polices.employee_id') ->where('employee_polices.client_policy_id', $client_policy_id) ->where('employees.client_id', $client_id) + ->where('employees.client_branch_id', $client_branch_id) ->where('employees.name', $emp_name) ->where('employees.emp_code', $emp_code) ->where('employee_polices.is_active', 1) @@ -1674,6 +1688,7 @@ class EmpDataServiceController extends BaseController ->join('employee_polices', 'employee_polices.employee_id = employees.id') ->where('emp_endorsement.emp_code', $emp_code) ->where('employees.client_id', $client_id) + ->where('employees.client_branch_id', $client_branch_id) ->where('employee_polices.client_policy_id', $client_policy_id) ->where('emp_endorsement.name', $emp_name) ->where('emp_endorsement.field_name', 'emp_status') @@ -1712,6 +1727,7 @@ class EmpDataServiceController extends BaseController $depositeData = [ 'employeeIds' => $employeeIds, 'client_id' => $client_id, + 'client_branch_id' => $client_branch_id, 'client_policy_id' => $client_policy_id, 'count' => $count, 'event' => $import_data['event_type'], @@ -2239,9 +2255,10 @@ class EmpDataServiceController extends BaseController public function getDataByFileId($file_id, $status = 'success'){ $data = $this->batchFileModel - ->select('batch_files.*, clients.client_name, clients.short_name, policies.name as policy_name') + ->select('batch_files.*, clients.client_name, clients.short_name, policies.name as policy_name, client_branch.branch_name') ->join('clients', 'clients.id = batch_files.client_id') ->join('client_policy', 'client_policy.id = batch_files.client_policy_id') + ->join('client_branch', 'client_branch.id = batch_files.client_branch_id') ->join('policies', 'policies.id = client_policy.policy_id') ->where('batch_files.id', $file_id) ->first(); @@ -2249,12 +2266,12 @@ class EmpDataServiceController extends BaseController if($status == 'success'){ - $msg_txt = $data['short_name'] . ' - ' . $data['policy_name'] . ' - ' . $data['event_type'] . ' - ' . $data['actions'] . ' - ' . $data['insurer_or_tpa']; + $msg_txt = $data['short_name'] . ' - ' . $data['branch_name'] . ' - ' . $data['policy_name'] . ' - ' . $data['event_type'] . ' - ' . $data['actions'] . ' - ' . $data['insurer_or_tpa']; $msg_title = 'File Upload Success'; }else if ($status == 'failure'){ - $msg_txt = $data['short_name'] . ' - ' . $data['policy_name'] . ' - ' . $data['event_type'] . ' - ' . $data['actions'] . ' - ' . $data['insurer_or_tpa']; + $msg_txt = $data['short_name'] . ' - ' . $data['branch_name'] . ' - ' . $data['policy_name'] . ' - ' . $data['event_type'] . ' - ' . $data['actions'] . ' - ' . $data['insurer_or_tpa']; $msg_title = 'File Upload Failure'; } diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 9e495ea9..51a5ef50 100644 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -369,8 +369,12 @@ class EmployeeController extends AdminController $actions = $this->request->getPost('action_type'); $client_data = $this->clientModel->where('id', $client_id)->first(); - $policy_name = $this->clientPolicyModel->select('policies.name')->join('policies', 'policies.id = client_policy.policy_id')->where('client_policy.id', $client_policy_id)->first(); - $file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $policy_name['name']); + $policy_name_and_branch_name = $this->clientPolicyModel->select('policies.name, client_branch.branch_code') + ->join('client_branch', 'client_branch.id = client_policy.client_branch_id') + ->join('policies', 'policies.id = client_policy.policy_id') + ->where('client_policy.id', $client_policy_id) + ->first(); + $file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $policy_name_and_branch_name['name'], $policy_name_and_branch_name['branch_code']); $batch_data = [ 'client_id' => $client_id, diff --git a/app/Controllers/PendingActionsController.php b/app/Controllers/PendingActionsController.php index 2e4bb8e8..c7764902 100644 --- a/app/Controllers/PendingActionsController.php +++ b/app/Controllers/PendingActionsController.php @@ -95,17 +95,20 @@ class PendingActionsController extends AdminController cp.policy_status, cp.open_for_enrollment, cp.inception_type, + cb.id as branch_id, + cb.branch_name, COUNT(ep.id) AS employee_policy_count '); $builder->join('employee_polices ep', 'cp.id = ep.client_policy_id AND ep.is_active = 1', 'left'); $builder->join('clients', 'cp.client_id = clients.id'); + $builder->join('client_branch cb', 'cb.id = cp.client_branch_id'); $builder->join('policies', 'cp.policy_id = policies.id'); $builder->where('cp.is_active', 1); $builder->where('cp.open_for_enrollment', 1); $builder->where('cp.is_addon', 1); $builder->where('cp.policy_status', 1); $builder->where('cp.inception_type', 1); - $builder->whereIn('cp.policy_type_id', [1, 2, 30]); + $builder->whereIn('cp.policy_type_id', [1, 2, 3]); $builder->groupBy('cp.id, cp.client_id, cp.policy_id, cp.policy_type_id, cp.is_addon, cp.policy_status, cp.open_for_enrollment'); $builder->having('employee_policy_count = 0 OR employee_policy_count IS NULL'); @@ -147,6 +150,8 @@ class PendingActionsController extends AdminController clients.client_name as client_name, clients.id as client_id, + client_branch.id as branch_id, + client_branch.branch_name, emp_endorsement.id, emp_endorsement.pk, emp_endorsement.endorsement_id, @@ -159,20 +164,23 @@ class PendingActionsController extends AdminController employees.name as ename ') ->join('employees', 'emp_endorsement.pk = employees.id AND employees.is_active = 1 AND employees.emp_status = \'active\'') - ->join('clients', 'employees.client_id = clients.id AND clients.is_active = 1', 'left') - ->where([ + ->join('clients', 'employees.client_id = clients.id AND clients.is_active = 1', 'left') + ->join('client_branch', 'client_branch.id = employees.client_branch_id', 'left') + ->where([ 'emp_endorsement.actions' => 'c', 'emp_endorsement.is_active' => 1, 'emp_endorsement.status' => 'pending', 'emp_endorsement.endorsement_id' => null ]) - ->groupBy('emp_endorsement.pk, emp_endorsement.emp_code, emp_endorsement.table_name, emp_endorsement.actions, emp_endorsement.name'); + ->groupBy('emp_endorsement.pk, emp_endorsement.emp_code, emp_endorsement.table_name, emp_endorsement.actions, emp_endorsement.name'); // Main query builder $builder = $this->db->table('clients'); $builder->select(" subquery.client_name, subquery.client_id, + subquery.branch_name, + subquery.branch_id, COUNT(subquery.id) AS subquery_count, ($subQueryExport) AS batch_export_count, ($subQueryImport) AS batch_import_count @@ -223,6 +231,8 @@ class PendingActionsController extends AdminController ->select(' clients.client_name as client_name, clients.id as client_id, + client_branch.id as branch_id, + client_branch.branch_name, client_policy.id as client_policy_id, policies.name as policy_name, policies.id as pid, @@ -239,6 +249,7 @@ class PendingActionsController extends AdminController ->join('employee_polices', 'emp_endorsement.pk = employee_polices.id AND employee_polices.is_active = 1 AND employee_polices.status = \'active\'') ->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1') ->join('clients', 'client_policy.client_id = clients.id AND clients.is_active = 1') + ->join('client_branch', 'client_branch.id = client_policy.client_branch_id') ->join('policies', 'client_policy.policy_id = policies.id AND policies.is_active = 1') ->where([ 'emp_endorsement.actions' => 'si', @@ -256,6 +267,8 @@ class PendingActionsController extends AdminController subquery.client_id, subquery.client_policy_id, subquery.policy_name, + subquery.branch_name, + subquery.branch_id, COUNT(subquery.id) AS subquery_count, ($subQueryExport) AS batch_export_count, ($subQueryImport) AS batch_import_count @@ -304,8 +317,10 @@ class PendingActionsController extends AdminController // Build the subquery $subqueryBuilder = $this->db->table('emp_endorsement') ->select(' - clients.client_name as client_name, clients.id as client_id, + clients.client_name as client_name, + client_branch.id as branch_id, + client_branch.branch_name, client_policy.id as client_policy_id, policies.name as policy_name, policies.id as pid, @@ -317,10 +332,12 @@ class PendingActionsController extends AdminController emp_endorsement.actions, emp_endorsement.name, emp_endorsement.status + ') ->join('employee_polices', 'emp_endorsement.pk = employee_polices.id AND employee_polices.is_active = 1 AND employee_polices.status = \'active\' AND emp_endorsement.table_name = \'employee_polices\'', 'left') ->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1', 'left') ->join('clients', 'client_policy.client_id = clients.id AND clients.is_active = 1', 'left') + ->join('client_branch', 'client_branch.id = client_policy.client_branch_id', 'left') ->join('policies', 'client_policy.policy_id = policies.id AND policies.is_active = 1', 'left') ->where([ 'emp_endorsement.actions' => 'd', @@ -339,6 +356,8 @@ class PendingActionsController extends AdminController subquery.client_id, subquery.client_policy_id, subquery.policy_name, + subquery.branch_name, + subquery.branch_id, COUNT(subquery.id) AS subquery_count, ($subQueryExport) AS batch_export_count, ($subQueryImport) AS batch_import_count @@ -389,10 +408,12 @@ class PendingActionsController extends AdminController ->select('c.short_name') ->select('p.name as policy_name') ->select('ep.uhid') + ->select('cb.branch_name, cb.id as branch_id') ->select("($subQueryExport) AS batch_export_count", false) ->select("($subQueryImport) AS batch_import_count", false) ->join('client_policy cp', 'ep.client_policy_id = cp.id AND cp.is_active = 1 AND cp.policy_status = 1') ->join('clients c', 'c.id = cp.client_id') + ->join('client_branch cb', 'cb.id = cp.client_branch_id') ->join('policies p', 'p.id = cp.policy_id') ->where('ep.uhid IS NULL') ->where('ep.status', 'active') @@ -439,13 +460,16 @@ class PendingActionsController extends AdminController clients.short_name, clients.client_name, policies.name as policy_name, - clients.id as client_id + clients.id as client_id, + client_branch.id as branch_id, + client_branch.branch_name '); $builder->select("($subQueryExport) AS batch_export_count", false); $builder->select("($subQueryImport) AS batch_import_count", false); $builder->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1'); $builder->join('clients', 'clients.id = client_policy.client_id'); + $builder->join('client_branch', 'client_branch.id = client_policy.client_branch_id'); $builder->join('policies', 'policies.id = client_policy.policy_id'); $builder->where('employee_polices.tpa_id', null); $builder->where('employee_polices.uhid IS NOT NULL'); diff --git a/app/Helpers/excel_import_export_helper.php b/app/Helpers/excel_import_export_helper.php index 5c29ce41..c7cec62d 100644 --- a/app/Helpers/excel_import_export_helper.php +++ b/app/Helpers/excel_import_export_helper.php @@ -359,7 +359,7 @@ if (!function_exists('read_excel_file_to_array')) { if (! function_exists('generate_filename')) { - function generate_filename($client_short_name, $event_type, $actions, $insurer_or_tpa, $policy_name) { + function generate_filename($client_short_name, $event_type, $actions, $insurer_or_tpa, $policy_name, $branch_code) { $evenTypeLabel = ''; if($event_type == 'inception'){ @@ -387,9 +387,10 @@ if (! function_exists('generate_filename')) { $currentDateTime = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $formattedDateTime = $currentDateTime->format('d-m-Y_H-i-s'); $policy_name = str_replace(' ', '_', $policy_name); + $branch_code = isset($branch_code) ? str_replace(' ', '_', $branch_code) : '_'; // Generate file name - $file_name = $client_short_name. '_' . $policy_name . '_' . $insurer_or_tpa_lable . $actions . $evenTypeLabel . '_' . $formattedDateTime . '.xlsx'; + $file_name = $client_short_name. '_' . $branch_code . '_' . $policy_name . '_' . $insurer_or_tpa_lable . $actions . $evenTypeLabel . '_' . $formattedDateTime . '.xlsx'; return $file_name; } } diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index b422ccfe..bccd442b 100644 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -120,6 +120,7 @@ class EmployeePolicyModel extends Model public function getInceptionEmployeeDataForExportExcel($ref_data) { $client_policy_id = $ref_data['client_policy_id']; + $client_branch_id = $ref_data['client_branch_id']; $insurer_or_tpa = $ref_data['insurer_or_tpa']; $event = $ref_data['event_type']; @@ -174,7 +175,8 @@ class EmployeePolicyModel extends Model ) as batch_data ON employee_polices.id = batch_data.emp_policy_id WHERE employee_polices.client_policy_id = '{$client_policy_id}' AND (employee_polices.{$id} IS NULL OR employee_polices.{$id} = '') - AND employee_polices.is_active = 1"; + AND employee_polices.is_active = 1 + AND employees.client_branch_id = '{$client_branch_id}'"; // Get the result set $query = $this->db->query($sql); @@ -188,6 +190,7 @@ class EmployeePolicyModel extends Model $client_id = $ref_data['client_id']; $client_policy_id = $ref_data['client_policy_id']; + $client_branch_id = $ref_data['client_branch_id']; $insurer_or_tpa = $ref_data['insurer_or_tpa']; $sql = " @@ -236,6 +239,7 @@ class EmployeePolicyModel extends Model AND batch_data.bl IS NULL AND employees.client_id = '{$client_id}' AND employee_polices.client_policy_id = '{$client_policy_id}' + AND employees.client_branch_id = '{$client_branch_id}' AND emp_endorsement.actions = 'c' AND (emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = '')"; @@ -255,6 +259,7 @@ class EmployeePolicyModel extends Model $client_id = $ref_data['client_id']; $client_policy_id = $ref_data['client_policy_id']; + $client_branch_id = $ref_data['client_branch_id']; $insurer_or_tpa = $ref_data['insurer_or_tpa']; $query = $this->db->query(" @@ -345,6 +350,7 @@ class EmployeePolicyModel extends Model batch_data.bf IS NULL AND batch_data.bl IS NULL AND employee_polices.client_policy_id = '{$client_policy_id}' + AND employees.client_branch_id = '{$client_policy_id}' AND employee_polices.is_active = '1' AND (a.endorsement_id IS NULL OR a.endorsement_id = '') AND a.field_name = 'si_enhancement_date' @@ -362,10 +368,11 @@ class EmployeePolicyModel extends Model $client_id = $ref_data['client_id']; $client_policy_id = $ref_data['client_policy_id']; + $client_branch_id = $ref_data['client_branch_id']; $insurer_or_tpa = $ref_data['insurer_or_tpa']; $query = $this->db->query(" - SELECT + SELECT DISTINCT a.id as endorsement_primarykey, employee_polices.id as primaryKey, employees.name AS emp_name, @@ -436,6 +443,7 @@ class EmployeePolicyModel extends Model batch_data.bf IS NULL AND batch_data.bl IS NULL AND employee_polices.client_policy_id = {$client_policy_id} + AND employees.client_branch_id = {$client_branch_id} AND employee_polices.is_active = 1 AND (a.endorsement_id IS NULL OR a.endorsement_id = '') AND a.field_name = 'status' "); @@ -613,6 +621,7 @@ class EmployeePolicyModel extends Model $query1->join('employee_polices ep', 'ep.id = e.pk'); $query1->join('employees', 'employees.id = ep.employee_id'); $query1->join('client_policy', 'client_policy.id = ep.client_policy_id'); + $query1->join('client_branch', 'client_branch.id = employees.client_branch_id'); $query1->join('policies', 'policies.id = client_policy.policy_id'); $query1->join('insurers', 'insurers.id = policies.insurer_id'); $query1->whereIn('e.actions', ['c']); @@ -645,6 +654,7 @@ class EmployeePolicyModel extends Model $query2->join('employee_polices ep', 'ep.id = e.pk'); $query2->join('employees', 'employees.id = ep.employee_id'); $query2->join('client_policy', 'client_policy.id = ep.client_policy_id'); + $query2->join('client_branch', 'client_branch.id = employees.client_branch_id'); $query2->join('policies', 'policies.id = client_policy.policy_id'); $query2->join('insurers', 'insurers.id = policies.insurer_id'); $query2->whereIn('e.actions', ['si', 'd']); diff --git a/app/Views/client_deposit_list.php b/app/Views/client_deposit_list.php index fb1adc40..bb261f17 100644 --- a/app/Views/client_deposit_list.php +++ b/app/Views/client_deposit_list.php @@ -5,7 +5,7 @@
-

Client Deposit - +

Client Deposit -

diff --git a/app/Views/client_kyc.php b/app/Views/client_kyc.php index f53b7c16..6893b31c 100644 --- a/app/Views/client_kyc.php +++ b/app/Views/client_kyc.php @@ -51,7 +51,7 @@
- +
@@ -100,6 +100,7 @@ $(document).ready(function(){ kycPrimaryKey = $('#kyc_PrimaryKey').val(); + $('#others').hide() $('#other_docs_table').hide(); @@ -176,10 +177,10 @@ $('#name_'+item.kyc_doc_type_id).html(item.file_name); $('#form_'+item.kyc_doc_type_id).hide(); - console.log('step 1') + // console.log('step 1') if(item.file_name != null && item.file_name != ""){ - console.log('step 2') + // console.log('step 2') $('#download_'+item.kyc_doc_type_id).show(); $('#download_' + item.kyc_doc_type_id).attr('href', '' + item.file_name); @@ -187,14 +188,14 @@ } else{ - console.log('step 3') + // console.log('step 3') $('#download_'+item.kyc_doc_type_id).hide(); $('#download_' + item.kyc_doc_type_id).attr('href', '#'); $('#delete_'+item.kyc_doc_type_id).hide(); } - console.log('step 4') + // console.log('step 4') }); @@ -217,6 +218,9 @@ $('.loader').fadeIn(); $('.loader-mask').fadeIn(); + + + $.ajax({ url: '' + '', type: "GET", @@ -224,6 +228,7 @@ processData: false, contentType: false, success: function (res) { + setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); @@ -270,9 +275,20 @@ var table = ''; var data = ; - console.log(data) + // console.log('other documents data', data) + + $('#other_docs tr').remove(); + + var other_docs_count = 0; + $.each(data, function(index, item) { + + if(item.other_docs_name != ""){ + + other_docs_count++; + } + if(item.kyc_doc_type_id == '0'){ table += ` @@ -288,6 +304,11 @@ } }); $('#other_docs').append(table); + + if(other_docs_count > 0){ + $('#others').show() + $('#other_docs_table').show(); + } $.each(data, function(index, item) { @@ -299,19 +320,17 @@ $('#name_'+item.kyc_doc_type_id).html(item.file_name); $('#form_'+item.kyc_doc_type_id).hide(); - console.log('step 1') + // console.log('step 1') if(item.file_name != null && item.file_name != ""){ - console.log('step 2') + // console.log('step 2') $('#download_'+item.kyc_doc_type_id).show(); $('#download_' + item.kyc_doc_type_id).attr('href', '' + item.file_name); $('#delete_'+item.kyc_doc_type_id).show(); - - } else{ - console.log('step 3') + // console.log('step 3') $('#download_'+item.kyc_doc_type_id).hide(); $('#download_' + item.kyc_doc_type_id).attr('href', '#'); @@ -319,7 +338,7 @@ } - console.log('step 4') + // console.log('step 4') }, 1000); @@ -369,7 +388,7 @@ $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); }, 1000); - console.log(res); + // console.log(res); $('#kyc_form').trigger('reset'); if(res){ setTimeout(function() { @@ -380,23 +399,36 @@ }, 500); } + var other_docs_count = 0; + $('#other_docs tr').remove(); $.each(res.data, function(index, item) { - console.log("Current item:", item); + + if(item.other_docs_name != ""){ + + other_docs_count++; + } + + // console.log("Current item:", item); if (item.kyc_doc_type_id == '0') { - console.log("Appending item:", item); + // console.log("Appending item:", item); var rowHtml = ` ${item.other_docs_name} ${item.file_name} - + `; } $('#other_docs').append(rowHtml); + + if(other_docs_count > 0){ + $('#others').show() + $('#other_docs_table').show(); + } }); }, error: function(xhr, status, error) { @@ -431,8 +463,8 @@ var kyc_id = $(this).attr('data-id'); $.get(''+kyc_id, function (data) { - console.log('kyc-'+ kyc_id) - console.log(data) + // console.log('kyc-'+ kyc_id) + // console.log(data) if(data){ $('#form_'+kyc_id).show(); $('#name_'+kyc_id).hide(); @@ -458,7 +490,7 @@ var kyc_id = $(this).attr('data-id'); $.get(''+kyc_id, function (data) { - console.log('kyc-'+ kyc_id) + // console.log('kyc-'+ kyc_id) if(data){ $('#kyc-'+ kyc_id).remove(); } @@ -468,30 +500,4 @@ }); - function validateForm() { - var isValid = true; - - - $('#kyc_form input, #kyc_form select').each(function() { - if ($(this).is('input[type="text"]') || $(this).is('select')) { - if ($.trim($(this).val()) == '') { - console.log('Please fill in all fields'); - isValid = false; - return false; - } - } - - if ($(this).is('input[type="file"]')) { - var fileInput = $(this)[0]; - if (fileInput.files.length === 0) { - console.log('Please select an image file'); - isValid = false; - return false; - } - } - }); - - return isValid; - } - \ No newline at end of file diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index bb6e8294..bb844432 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -2,8 +2,7 @@
- +
@@ -30,9 +29,7 @@
- +

@@ -42,34 +39,31 @@ - +
- +
- +
- - + +
@@ -99,8 +93,8 @@
@@ -109,24 +103,19 @@ @@ -146,10 +135,8 @@
- - + +
@@ -163,104 +150,104 @@ \ No newline at end of file diff --git a/app/Views/employee_list.php b/app/Views/employee_list.php index a9148742..479260a6 100644 --- a/app/Views/employee_list.php +++ b/app/Views/employee_list.php @@ -122,7 +122,7 @@ function fetchClientPolicies() { $('#loader').show(); var apiURL = '' + 'util/clients-with-policies'; console.log('fetchClientPolicies'); - console.log(apiURL); + // console.log(apiURL); $.ajax({ url: apiURL, method: 'GET', @@ -139,20 +139,20 @@ function fetchClientPolicies() { clientPolicies = (response.data); response.data.forEach(policy => { - console.log('policies', policy.policies); + // console.log('policies', policy.policies); policy.policies.forEach(p => { clientPoliciesWithBranch.policies.push(p); }); }); - console.log('1',clientPolicies); + // console.log('1',clientPolicies); appendClients(clientPolicies); //this function for reselect the policy setTimeout(function() { if (client_id != 0 ) { var foundPolicies = clientPolicies.find(function(item) { - console.log(typeof item.id) + // console.log(typeof item.id) return item.id == client_id; }); appendBranch(foundPolicies.branchs); @@ -163,12 +163,12 @@ function fetchClientPolicies() { if (client_branch_id != 0 ) { var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) { - console.log('item', item); + // console.log('item', item); return item.branch_id === client_branch_id; }); if (foundPolicies) { - console.log('foundPolicies', foundPolicies); + // console.log('foundPolicies', foundPolicies); appendPolicies(foundPolicies); } else { console.log('No policies found for the selected client'); @@ -239,7 +239,7 @@ function appendPolicies(data) { })); var PolicyID = ; - console.log(PolicyID) + // console.log(PolicyID) $.each(data, function(index, item) { var option = $('