CHANGE_CLIENT_BRANCH_ID_ALL_PLACE_COMPLETE : RV

This commit is contained in:
VENKATESHWARAN 2024-05-24 18:16:06 +05:30
parent f286f2bb86
commit 180110287c
14 changed files with 1460 additions and 1501 deletions

View File

@ -578,6 +578,7 @@ class EmpDataServiceController extends BaseController
$file = $this->batchFileModel->where('id', $file_id)->first(); $file = $this->batchFileModel->where('id', $file_id)->first();
$client_id = $file['client_id']; $client_id = $file['client_id'];
$client_policy_id = $file['client_policy_id']; $client_policy_id = $file['client_policy_id'];
$client_branch_id = $file['client_branch_id'];
$batch_code = $file['batch_code']; $batch_code = $file['batch_code'];
@ -626,6 +627,7 @@ class EmpDataServiceController extends BaseController
->join('employees', 'employees.id = employee_polices.employee_id') ->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.client_policy_id', $client_policy_id) ->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_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} = ''") ->where("employee_polices.{$id} IS NULL OR employee_polices.{$id} = ''")
->findAll(); ->findAll();
@ -976,6 +978,7 @@ class EmpDataServiceController extends BaseController
$client_id = $file['client_id']; $client_id = $file['client_id'];
$client_policy_id = $file['client_policy_id']; $client_policy_id = $file['client_policy_id'];
$client_branch_id = $file['client_branch_id'];
$insurer_or_tpa = $file['insurer_or_tpa']; $insurer_or_tpa = $file['insurer_or_tpa'];
$status = $file['status']; $status = $file['status'];
$batch_code = $file['batch_code']; $batch_code = $file['batch_code'];
@ -1031,6 +1034,7 @@ class EmpDataServiceController extends BaseController
$query->join('employees', 'employees.id = employee_polices.employee_id'); $query->join('employees', 'employees.id = employee_polices.employee_id');
$query->where('employee_polices.client_policy_id', $client_policy_id); $query->where('employee_polices.client_policy_id', $client_policy_id);
$query->where('employees.client_id', $client_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.name', $name);
$query->where('employees.emp_code', $emp_code); $query->where('employees.emp_code', $emp_code);
if ($file['insurer_or_tpa'] == 'tpa') { if ($file['insurer_or_tpa'] == 'tpa') {
@ -1103,6 +1107,7 @@ class EmpDataServiceController extends BaseController
'employeeIds' => $emp_policy_ids, 'employeeIds' => $emp_policy_ids,
'client_id' => $client_id, 'client_id' => $client_id,
'client_policy_id' => $client_policy_id, 'client_policy_id' => $client_policy_id,
'client_branch_id' => $client_branch_id,
'count' => $emp_count, 'count' => $emp_count,
'event' => $file['event_type'], 'event' => $file['event_type'],
'policy_name' => $policy_name['policy_name'], 'policy_name' => $policy_name['policy_name'],
@ -1116,6 +1121,7 @@ class EmpDataServiceController extends BaseController
'employeeIds' => $emp_policy_ids, 'employeeIds' => $emp_policy_ids,
'client_id' => $client_id, 'client_id' => $client_id,
'client_policy_id' => $client_policy_id, 'client_policy_id' => $client_policy_id,
'client_branch_id' => $client_branch_id,
'count' => $emp_count, 'count' => $emp_count,
'event' => $file['event_type'], 'event' => $file['event_type'],
'policy_name' => $policy_name['policy_name'], 'policy_name' => $policy_name['policy_name'],
@ -1152,6 +1158,7 @@ class EmpDataServiceController extends BaseController
$client_id = $import_data['client_id']; $client_id = $import_data['client_id'];
$client_policy_id = $import_data['client_policy_id']; $client_policy_id = $import_data['client_policy_id'];
$client_branch_id = $import_data['client_branch_id'];
$file = $import_data['file']; $file = $import_data['file'];
$data = $this->readExcelToArray($file); $data = $this->readExcelToArray($file);
@ -1181,6 +1188,7 @@ class EmpDataServiceController extends BaseController
->join('employee_polices', 'employee_polices.employee_id = employees.id') ->join('employee_polices', 'employee_polices.employee_id = employees.id')
->where('employee_polices.client_policy_id', $client_policy_id) ->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_id) ->where('employees.client_id', $client_id)
->where('employees.client_branch_id', $client_branch_id)
->where('employee_polices.uhid', $uhid) ->where('employee_polices.uhid', $uhid)
->where('employees.emp_code', $emp_code) ->where('employees.emp_code', $emp_code)
->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")') ->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
@ -1211,10 +1219,6 @@ class EmpDataServiceController extends BaseController
return 2; return 2;
} }
// if($empty_emp_tpa_uh_ids != $count){
// return 3;
// }
if ($empty_id_count == 0) { if ($empty_id_count == 0) {
@ -1265,6 +1269,7 @@ class EmpDataServiceController extends BaseController
->join('employees', 'employees.id = employee_polices.employee_id') ->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.client_policy_id', $client_policy_id) ->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_id) ->where('employees.client_id', $client_id)
->where('employees.client_branch_id', $client_branch_id)
->where('employee_polices.uhid', $uhid) ->where('employee_polices.uhid', $uhid)
->where('employees.emp_code', $emp_code) ->where('employees.emp_code', $emp_code)
->where('employees.is_active', 1) ->where('employees.is_active', 1)
@ -1280,6 +1285,7 @@ class EmpDataServiceController extends BaseController
->join('employee_polices', 'employee_polices.employee_id = employees.id') ->join('employee_polices', 'employee_polices.employee_id = employees.id')
->where('employees.emp_code', $emp_code) ->where('employees.emp_code', $emp_code)
->where('employees.client_id', $client_id) ->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.client_policy_id', $client_policy_id)
->where('employee_polices.uhid', $uhid) ->where('employee_polices.uhid', $uhid)
->get() ->get()
@ -1319,6 +1325,7 @@ class EmpDataServiceController extends BaseController
$client_id = $import_data['client_id']; $client_id = $import_data['client_id'];
$client_policy_id = $import_data['client_policy_id']; $client_policy_id = $import_data['client_policy_id'];
$client_branch_id = $import_data['client_branch_id'];
$file = $import_data['file']; $file = $import_data['file'];
$data = $this->readExcelToArray($file); $data = $this->readExcelToArray($file);
@ -1352,6 +1359,7 @@ class EmpDataServiceController extends BaseController
->where('employees.emp_code', $emp_code) ->where('employees.emp_code', $emp_code)
->where('employees.name', $emp_name) ->where('employees.name', $emp_name)
->where('employees.client_id', $client_id) ->where('employees.client_id', $client_id)
->where('employees.client_branch_id', $client_branch_id)
->where('emp_endorsement.actions', 'si') ->where('emp_endorsement.actions', 'si')
->where('employee_polices.client_policy_id', $client_policy_id) ->where('employee_polices.client_policy_id', $client_policy_id)
->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_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.emp_code', $emp_code)
->where('employees.name', $emp_name) ->where('employees.name', $emp_name)
->where('employees.client_id', $client_id) ->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.client_policy_id', $client_policy_id)
->where('employee_polices.is_active', 1) ->where('employee_polices.is_active', 1)
->first(); ->first();
@ -1478,6 +1487,7 @@ class EmpDataServiceController extends BaseController
->join('employees', 'employees.id = employee_polices.employee_id') ->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.client_policy_id', $client_policy_id) ->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_id) ->where('employees.client_id', $client_id)
->where('employees.client_branch_id', $client_branch_id)
->where('employees.name', $emp_name) ->where('employees.name', $emp_name)
->where('employees.emp_code', $emp_code) ->where('employees.emp_code', $emp_code)
->where('employee_polices.is_active', 1) ->where('employee_polices.is_active', 1)
@ -1500,6 +1510,7 @@ class EmpDataServiceController extends BaseController
'employeeIds' => $employeeIds, 'employeeIds' => $employeeIds,
'client_id' => $client_id, 'client_id' => $client_id,
'client_policy_id' => $client_policy_id, 'client_policy_id' => $client_policy_id,
'client_branch_id' => $client_branch_id,
'count' => $count, 'count' => $count,
'event' => $import_data['event_type'], 'event' => $import_data['event_type'],
'policy_name' => $policy_name['policy_name'], 'policy_name' => $policy_name['policy_name'],
@ -1517,6 +1528,7 @@ class EmpDataServiceController extends BaseController
$client_id = $import_data['client_id']; $client_id = $import_data['client_id'];
$client_policy_id = $import_data['client_policy_id']; $client_policy_id = $import_data['client_policy_id'];
$client_branch_id = $import_data['client_branch_id'];
$file = $import_data['file']; $file = $import_data['file'];
@ -1554,6 +1566,7 @@ class EmpDataServiceController extends BaseController
->where('employees.emp_code', $emp_code) ->where('employees.emp_code', $emp_code)
->where('employees.name', $emp_name) ->where('employees.name', $emp_name)
->where('employees.client_id', $client_id) ->where('employees.client_id', $client_id)
->where('employees.client_branch_id', $client_branch_id)
->where('emp_endorsement.actions', 'd') ->where('emp_endorsement.actions', 'd')
->where('employee_polices.client_policy_id', $client_policy_id) ->where('employee_polices.client_policy_id', $client_policy_id)
->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_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') ->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.client_policy_id', $client_policy_id) ->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_id) ->where('employees.client_id', $client_id)
->where('employees.client_branch_id', $client_branch_id)
->where('employees.name', $emp_name) ->where('employees.name', $emp_name)
->where('employees.emp_code', $emp_code) ->where('employees.emp_code', $emp_code)
->where('employee_polices.is_active', 1) ->where('employee_polices.is_active', 1)
@ -1674,6 +1688,7 @@ class EmpDataServiceController extends BaseController
->join('employee_polices', 'employee_polices.employee_id = employees.id') ->join('employee_polices', 'employee_polices.employee_id = employees.id')
->where('emp_endorsement.emp_code', $emp_code) ->where('emp_endorsement.emp_code', $emp_code)
->where('employees.client_id', $client_id) ->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.client_policy_id', $client_policy_id)
->where('emp_endorsement.name', $emp_name) ->where('emp_endorsement.name', $emp_name)
->where('emp_endorsement.field_name', 'emp_status') ->where('emp_endorsement.field_name', 'emp_status')
@ -1712,6 +1727,7 @@ class EmpDataServiceController extends BaseController
$depositeData = [ $depositeData = [
'employeeIds' => $employeeIds, 'employeeIds' => $employeeIds,
'client_id' => $client_id, 'client_id' => $client_id,
'client_branch_id' => $client_branch_id,
'client_policy_id' => $client_policy_id, 'client_policy_id' => $client_policy_id,
'count' => $count, 'count' => $count,
'event' => $import_data['event_type'], 'event' => $import_data['event_type'],
@ -2239,9 +2255,10 @@ class EmpDataServiceController extends BaseController
public function getDataByFileId($file_id, $status = 'success'){ public function getDataByFileId($file_id, $status = 'success'){
$data = $this->batchFileModel $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('clients', 'clients.id = batch_files.client_id')
->join('client_policy', 'client_policy.id = batch_files.client_policy_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') ->join('policies', 'policies.id = client_policy.policy_id')
->where('batch_files.id', $file_id) ->where('batch_files.id', $file_id)
->first(); ->first();
@ -2249,12 +2266,12 @@ class EmpDataServiceController extends BaseController
if($status == 'success'){ 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'; $msg_title = 'File Upload Success';
}else if ($status == 'failure'){ }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'; $msg_title = 'File Upload Failure';
} }

View File

@ -369,8 +369,12 @@ class EmployeeController extends AdminController
$actions = $this->request->getPost('action_type'); $actions = $this->request->getPost('action_type');
$client_data = $this->clientModel->where('id', $client_id)->first(); $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(); $policy_name_and_branch_name = $this->clientPolicyModel->select('policies.name, client_branch.branch_code')
$file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $policy_name['name']); ->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 = [ $batch_data = [
'client_id' => $client_id, 'client_id' => $client_id,

View File

@ -95,17 +95,20 @@ class PendingActionsController extends AdminController
cp.policy_status, cp.policy_status,
cp.open_for_enrollment, cp.open_for_enrollment,
cp.inception_type, cp.inception_type,
cb.id as branch_id,
cb.branch_name,
COUNT(ep.id) AS employee_policy_count 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('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('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->join('policies', 'cp.policy_id = policies.id');
$builder->where('cp.is_active', 1); $builder->where('cp.is_active', 1);
$builder->where('cp.open_for_enrollment', 1); $builder->where('cp.open_for_enrollment', 1);
$builder->where('cp.is_addon', 1); $builder->where('cp.is_addon', 1);
$builder->where('cp.policy_status', 1); $builder->where('cp.policy_status', 1);
$builder->where('cp.inception_type', 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->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'); $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.client_name as client_name,
clients.id as client_id, clients.id as client_id,
client_branch.id as branch_id,
client_branch.branch_name,
emp_endorsement.id, emp_endorsement.id,
emp_endorsement.pk, emp_endorsement.pk,
emp_endorsement.endorsement_id, emp_endorsement.endorsement_id,
@ -159,20 +164,23 @@ class PendingActionsController extends AdminController
employees.name as ename employees.name as ename
') ')
->join('employees', 'emp_endorsement.pk = employees.id AND employees.is_active = 1 AND employees.emp_status = \'active\'') ->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') ->join('clients', 'employees.client_id = clients.id AND clients.is_active = 1', 'left')
->where([ ->join('client_branch', 'client_branch.id = employees.client_branch_id', 'left')
->where([
'emp_endorsement.actions' => 'c', 'emp_endorsement.actions' => 'c',
'emp_endorsement.is_active' => 1, 'emp_endorsement.is_active' => 1,
'emp_endorsement.status' => 'pending', 'emp_endorsement.status' => 'pending',
'emp_endorsement.endorsement_id' => null '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 // Main query builder
$builder = $this->db->table('clients'); $builder = $this->db->table('clients');
$builder->select(" $builder->select("
subquery.client_name, subquery.client_name,
subquery.client_id, subquery.client_id,
subquery.branch_name,
subquery.branch_id,
COUNT(subquery.id) AS subquery_count, COUNT(subquery.id) AS subquery_count,
($subQueryExport) AS batch_export_count, ($subQueryExport) AS batch_export_count,
($subQueryImport) AS batch_import_count ($subQueryImport) AS batch_import_count
@ -223,6 +231,8 @@ class PendingActionsController extends AdminController
->select(' ->select('
clients.client_name as client_name, clients.client_name as client_name,
clients.id as client_id, clients.id as client_id,
client_branch.id as branch_id,
client_branch.branch_name,
client_policy.id as client_policy_id, client_policy.id as client_policy_id,
policies.name as policy_name, policies.name as policy_name,
policies.id as pid, 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('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('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('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') ->join('policies', 'client_policy.policy_id = policies.id AND policies.is_active = 1')
->where([ ->where([
'emp_endorsement.actions' => 'si', 'emp_endorsement.actions' => 'si',
@ -256,6 +267,8 @@ class PendingActionsController extends AdminController
subquery.client_id, subquery.client_id,
subquery.client_policy_id, subquery.client_policy_id,
subquery.policy_name, subquery.policy_name,
subquery.branch_name,
subquery.branch_id,
COUNT(subquery.id) AS subquery_count, COUNT(subquery.id) AS subquery_count,
($subQueryExport) AS batch_export_count, ($subQueryExport) AS batch_export_count,
($subQueryImport) AS batch_import_count ($subQueryImport) AS batch_import_count
@ -304,8 +317,10 @@ class PendingActionsController extends AdminController
// Build the subquery // Build the subquery
$subqueryBuilder = $this->db->table('emp_endorsement') $subqueryBuilder = $this->db->table('emp_endorsement')
->select(' ->select('
clients.client_name as client_name,
clients.id as client_id, 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, client_policy.id as client_policy_id,
policies.name as policy_name, policies.name as policy_name,
policies.id as pid, policies.id as pid,
@ -317,10 +332,12 @@ class PendingActionsController extends AdminController
emp_endorsement.actions, emp_endorsement.actions,
emp_endorsement.name, emp_endorsement.name,
emp_endorsement.status 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('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('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('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') ->join('policies', 'client_policy.policy_id = policies.id AND policies.is_active = 1', 'left')
->where([ ->where([
'emp_endorsement.actions' => 'd', 'emp_endorsement.actions' => 'd',
@ -339,6 +356,8 @@ class PendingActionsController extends AdminController
subquery.client_id, subquery.client_id,
subquery.client_policy_id, subquery.client_policy_id,
subquery.policy_name, subquery.policy_name,
subquery.branch_name,
subquery.branch_id,
COUNT(subquery.id) AS subquery_count, COUNT(subquery.id) AS subquery_count,
($subQueryExport) AS batch_export_count, ($subQueryExport) AS batch_export_count,
($subQueryImport) AS batch_import_count ($subQueryImport) AS batch_import_count
@ -389,10 +408,12 @@ class PendingActionsController extends AdminController
->select('c.short_name') ->select('c.short_name')
->select('p.name as policy_name') ->select('p.name as policy_name')
->select('ep.uhid') ->select('ep.uhid')
->select('cb.branch_name, cb.id as branch_id')
->select("($subQueryExport) AS batch_export_count", false) ->select("($subQueryExport) AS batch_export_count", false)
->select("($subQueryImport) AS batch_import_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('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('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') ->join('policies p', 'p.id = cp.policy_id')
->where('ep.uhid IS NULL') ->where('ep.uhid IS NULL')
->where('ep.status', 'active') ->where('ep.status', 'active')
@ -439,13 +460,16 @@ class PendingActionsController extends AdminController
clients.short_name, clients.short_name,
clients.client_name, clients.client_name,
policies.name as policy_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("($subQueryExport) AS batch_export_count", false);
$builder->select("($subQueryImport) AS batch_import_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('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('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->join('policies', 'policies.id = client_policy.policy_id');
$builder->where('employee_polices.tpa_id', null); $builder->where('employee_polices.tpa_id', null);
$builder->where('employee_polices.uhid IS NOT NULL'); $builder->where('employee_polices.uhid IS NOT NULL');

View File

@ -359,7 +359,7 @@ if (!function_exists('read_excel_file_to_array')) {
if (! function_exists('generate_filename')) { 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 = ''; $evenTypeLabel = '';
if($event_type == 'inception'){ if($event_type == 'inception'){
@ -387,9 +387,10 @@ if (! function_exists('generate_filename')) {
$currentDateTime = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $currentDateTime = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$formattedDateTime = $currentDateTime->format('d-m-Y_H-i-s'); $formattedDateTime = $currentDateTime->format('d-m-Y_H-i-s');
$policy_name = str_replace(' ', '_', $policy_name); $policy_name = str_replace(' ', '_', $policy_name);
$branch_code = isset($branch_code) ? str_replace(' ', '_', $branch_code) : '_';
// Generate file name // 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; return $file_name;
} }
} }

View File

@ -120,6 +120,7 @@ class EmployeePolicyModel extends Model
public function getInceptionEmployeeDataForExportExcel($ref_data) public function getInceptionEmployeeDataForExportExcel($ref_data)
{ {
$client_policy_id = $ref_data['client_policy_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']; $insurer_or_tpa = $ref_data['insurer_or_tpa'];
$event = $ref_data['event_type']; $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 ) as batch_data ON employee_polices.id = batch_data.emp_policy_id
WHERE employee_polices.client_policy_id = '{$client_policy_id}' WHERE employee_polices.client_policy_id = '{$client_policy_id}'
AND (employee_polices.{$id} IS NULL OR employee_polices.{$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 // Get the result set
$query = $this->db->query($sql); $query = $this->db->query($sql);
@ -188,6 +190,7 @@ class EmployeePolicyModel extends Model
$client_id = $ref_data['client_id']; $client_id = $ref_data['client_id'];
$client_policy_id = $ref_data['client_policy_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']; $insurer_or_tpa = $ref_data['insurer_or_tpa'];
$sql = " $sql = "
@ -236,6 +239,7 @@ class EmployeePolicyModel extends Model
AND batch_data.bl IS NULL AND batch_data.bl IS NULL
AND employees.client_id = '{$client_id}' AND employees.client_id = '{$client_id}'
AND employee_polices.client_policy_id = '{$client_policy_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.actions = 'c'
AND (emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = '')"; 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_id = $ref_data['client_id'];
$client_policy_id = $ref_data['client_policy_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']; $insurer_or_tpa = $ref_data['insurer_or_tpa'];
$query = $this->db->query(" $query = $this->db->query("
@ -345,6 +350,7 @@ class EmployeePolicyModel extends Model
batch_data.bf IS NULL batch_data.bf IS NULL
AND batch_data.bl IS NULL AND batch_data.bl IS NULL
AND employee_polices.client_policy_id = '{$client_policy_id}' AND employee_polices.client_policy_id = '{$client_policy_id}'
AND employees.client_branch_id = '{$client_policy_id}'
AND employee_polices.is_active = '1' AND employee_polices.is_active = '1'
AND (a.endorsement_id IS NULL OR a.endorsement_id = '') AND (a.endorsement_id IS NULL OR a.endorsement_id = '')
AND a.field_name = 'si_enhancement_date' AND a.field_name = 'si_enhancement_date'
@ -362,10 +368,11 @@ class EmployeePolicyModel extends Model
$client_id = $ref_data['client_id']; $client_id = $ref_data['client_id'];
$client_policy_id = $ref_data['client_policy_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']; $insurer_or_tpa = $ref_data['insurer_or_tpa'];
$query = $this->db->query(" $query = $this->db->query("
SELECT SELECT DISTINCT
a.id as endorsement_primarykey, a.id as endorsement_primarykey,
employee_polices.id as primaryKey, employee_polices.id as primaryKey,
employees.name AS emp_name, employees.name AS emp_name,
@ -436,6 +443,7 @@ class EmployeePolicyModel extends Model
batch_data.bf IS NULL batch_data.bf IS NULL
AND batch_data.bl IS NULL AND batch_data.bl IS NULL
AND employee_polices.client_policy_id = {$client_policy_id} AND employee_polices.client_policy_id = {$client_policy_id}
AND employees.client_branch_id = {$client_branch_id}
AND employee_polices.is_active = 1 AND employee_polices.is_active = 1
AND (a.endorsement_id IS NULL OR a.endorsement_id = '') AND a.field_name = 'status' 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('employee_polices ep', 'ep.id = e.pk');
$query1->join('employees', 'employees.id = ep.employee_id'); $query1->join('employees', 'employees.id = ep.employee_id');
$query1->join('client_policy', 'client_policy.id = ep.client_policy_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('policies', 'policies.id = client_policy.policy_id');
$query1->join('insurers', 'insurers.id = policies.insurer_id'); $query1->join('insurers', 'insurers.id = policies.insurer_id');
$query1->whereIn('e.actions', ['c']); $query1->whereIn('e.actions', ['c']);
@ -645,6 +654,7 @@ class EmployeePolicyModel extends Model
$query2->join('employee_polices ep', 'ep.id = e.pk'); $query2->join('employee_polices ep', 'ep.id = e.pk');
$query2->join('employees', 'employees.id = ep.employee_id'); $query2->join('employees', 'employees.id = ep.employee_id');
$query2->join('client_policy', 'client_policy.id = ep.client_policy_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('policies', 'policies.id = client_policy.policy_id');
$query2->join('insurers', 'insurers.id = policies.insurer_id'); $query2->join('insurers', 'insurers.id = policies.insurer_id');
$query2->whereIn('e.actions', ['si', 'd']); $query2->whereIn('e.actions', ['si', 'd']);

View File

@ -5,7 +5,7 @@
<div class="row" style="margin-bottom:1rem;"> <div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;"> <div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Client Deposit - <h4 style="position: relative;">Client Deposit -
<?php echo $clientName[0]['client_name'];?></h4> <?php echo $clientName[0]['client_name'];?></h4>
</div> </div>

View File

@ -51,7 +51,7 @@
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="kyc_docs">File<span <label for="kyc_docs">File<span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<input class="form-control" type="file" name="file_name" multiple="true" id="kyc_docs_file" required> <input class="form-control" type="file" name="file_name" multiple="true" id="kyc_docs_file" required accept=".pdf, .jpeg, .jpg, .png">
</div> </div>
<!-- <div class="form-group col-md-4 align-self-end"> --> <!-- <div class="form-group col-md-4 align-self-end"> -->
<div class="form-group col-md-4" style="margin-top: 42px;"> <div class="form-group col-md-4" style="margin-top: 42px;">
@ -100,6 +100,7 @@
$(document).ready(function(){ $(document).ready(function(){
kycPrimaryKey = $('#kyc_PrimaryKey').val(); kycPrimaryKey = $('#kyc_PrimaryKey').val();
$('#others').hide() $('#others').hide()
$('#other_docs_table').hide(); $('#other_docs_table').hide();
@ -176,10 +177,10 @@
$('#name_'+item.kyc_doc_type_id).html(item.file_name); $('#name_'+item.kyc_doc_type_id).html(item.file_name);
$('#form_'+item.kyc_doc_type_id).hide(); $('#form_'+item.kyc_doc_type_id).hide();
console.log('step 1') // console.log('step 1')
if(item.file_name != null && item.file_name != ""){ 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).show();
$('#download_' + item.kyc_doc_type_id).attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name); $('#download_' + item.kyc_doc_type_id).attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name);
@ -187,14 +188,14 @@
} }
else{ else{
console.log('step 3') // console.log('step 3')
$('#download_'+item.kyc_doc_type_id).hide(); $('#download_'+item.kyc_doc_type_id).hide();
$('#download_' + item.kyc_doc_type_id).attr('href', '#'); $('#download_' + item.kyc_doc_type_id).attr('href', '#');
$('#delete_'+item.kyc_doc_type_id).hide(); $('#delete_'+item.kyc_doc_type_id).hide();
} }
console.log('step 4') // console.log('step 4')
}); });
@ -217,6 +218,9 @@
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
$.ajax({ $.ajax({
url: '<?= base_url("client/kyc/list/"); ?>' + '<?= isset($client['entity_type_id']) ? $client['entity_type_id'] : '' ?>', url: '<?= base_url("client/kyc/list/"); ?>' + '<?= isset($client['entity_type_id']) ? $client['entity_type_id'] : '' ?>',
type: "GET", type: "GET",
@ -224,6 +228,7 @@
processData: false, processData: false,
contentType: false, contentType: false,
success: function (res) { success: function (res) {
setTimeout(function() { setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
@ -270,9 +275,20 @@
var table = ''; var table = '';
var data = <?= isset($client_kyc) ? json_encode($client_kyc) : '[]' ?>; var data = <?= isset($client_kyc) ? json_encode($client_kyc) : '[]' ?>;
console.log(data) // console.log('other documents data', data)
$('#other_docs tr').remove(); $('#other_docs tr').remove();
var other_docs_count = 0;
$.each(data, function(index, item) { $.each(data, function(index, item) {
if(item.other_docs_name != ""){
other_docs_count++;
}
if(item.kyc_doc_type_id == '0'){ if(item.kyc_doc_type_id == '0'){
table += ` table += `
<tr id="kyc-${item.id}"> <tr id="kyc-${item.id}">
@ -288,6 +304,11 @@
} }
}); });
$('#other_docs').append(table); $('#other_docs').append(table);
if(other_docs_count > 0){
$('#others').show()
$('#other_docs_table').show();
}
$.each(data, function(index, item) { $.each(data, function(index, item) {
@ -299,19 +320,17 @@
$('#name_'+item.kyc_doc_type_id).html(item.file_name); $('#name_'+item.kyc_doc_type_id).html(item.file_name);
$('#form_'+item.kyc_doc_type_id).hide(); $('#form_'+item.kyc_doc_type_id).hide();
console.log('step 1') // console.log('step 1')
if(item.file_name != null && item.file_name != ""){ 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).show();
$('#download_' + item.kyc_doc_type_id).attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name); $('#download_' + item.kyc_doc_type_id).attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name);
$('#delete_'+item.kyc_doc_type_id).show(); $('#delete_'+item.kyc_doc_type_id).show();
} }
else{ else{
console.log('step 3') // console.log('step 3')
$('#download_'+item.kyc_doc_type_id).hide(); $('#download_'+item.kyc_doc_type_id).hide();
$('#download_' + item.kyc_doc_type_id).attr('href', '#'); $('#download_' + item.kyc_doc_type_id).attr('href', '#');
@ -319,7 +338,7 @@
} }
console.log('step 4') // console.log('step 4')
}, 1000); }, 1000);
@ -369,7 +388,7 @@
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}, 1000); }, 1000);
console.log(res); // console.log(res);
$('#kyc_form').trigger('reset'); $('#kyc_form').trigger('reset');
if(res){ if(res){
setTimeout(function() { setTimeout(function() {
@ -380,23 +399,36 @@
}, 500); }, 500);
} }
var other_docs_count = 0;
$('#other_docs tr').remove(); $('#other_docs tr').remove();
$.each(res.data, function(index, item) { $.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') { if (item.kyc_doc_type_id == '0') {
console.log("Appending item:", item); // console.log("Appending item:", item);
var rowHtml = ` var rowHtml = `
<tr id="kyc-${item.id}"> <tr id="kyc-${item.id}">
<td>${item.other_docs_name}</td> <td>${item.other_docs_name}</td>
<td>${item.file_name}</td> <td>${item.file_name}</td>
<td> <td>
<i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i> <i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
<a href = "<?= base_url('download-kyc-docs/') ?>${item.file_name}" data-id="${item.id}" class="fa fa-download" style="font-size:18px; display: none" download></a> <a href = "<?= base_url('download-kyc-docs/') ?>${item.file_name}" data-id="${item.id}" class="fa fa-download" style="font-size:18px;" download></a>
</td> </td>
</tr> </tr>
`; `;
} }
$('#other_docs').append(rowHtml); $('#other_docs').append(rowHtml);
if(other_docs_count > 0){
$('#others').show()
$('#other_docs_table').show();
}
}); });
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
@ -431,8 +463,8 @@
var kyc_id = $(this).attr('data-id'); var kyc_id = $(this).attr('data-id');
$.get('<?php echo base_url('client/kyc/delete/');?>'+kyc_id, function (data) { $.get('<?php echo base_url('client/kyc/delete/');?>'+kyc_id, function (data) {
console.log('kyc-'+ kyc_id) // console.log('kyc-'+ kyc_id)
console.log(data) // console.log(data)
if(data){ if(data){
$('#form_'+kyc_id).show(); $('#form_'+kyc_id).show();
$('#name_'+kyc_id).hide(); $('#name_'+kyc_id).hide();
@ -458,7 +490,7 @@
var kyc_id = $(this).attr('data-id'); var kyc_id = $(this).attr('data-id');
$.get('<?php echo base_url('util/kyc-other-docs-delete/');?>'+kyc_id, function (data) { $.get('<?php echo base_url('util/kyc-other-docs-delete/');?>'+kyc_id, function (data) {
console.log('kyc-'+ kyc_id) // console.log('kyc-'+ kyc_id)
if(data){ if(data){
$('#kyc-'+ kyc_id).remove(); $('#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;
}
</script> </script>

File diff suppressed because it is too large Load Diff

View File

@ -122,7 +122,7 @@ function fetchClientPolicies() {
$('#loader').show(); $('#loader').show();
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies'; var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
console.log('fetchClientPolicies'); console.log('fetchClientPolicies');
console.log(apiURL); // console.log(apiURL);
$.ajax({ $.ajax({
url: apiURL, url: apiURL,
method: 'GET', method: 'GET',
@ -139,20 +139,20 @@ function fetchClientPolicies() {
clientPolicies = (response.data); clientPolicies = (response.data);
response.data.forEach(policy => { response.data.forEach(policy => {
console.log('policies', policy.policies); // console.log('policies', policy.policies);
policy.policies.forEach(p => { policy.policies.forEach(p => {
clientPoliciesWithBranch.policies.push(p); clientPoliciesWithBranch.policies.push(p);
}); });
}); });
console.log('1',clientPolicies); // console.log('1',clientPolicies);
appendClients(clientPolicies); appendClients(clientPolicies);
//this function for reselect the policy //this function for reselect the policy
setTimeout(function() { setTimeout(function() {
if (client_id != 0 ) { if (client_id != 0 ) {
var foundPolicies = clientPolicies.find(function(item) { var foundPolicies = clientPolicies.find(function(item) {
console.log(typeof item.id) // console.log(typeof item.id)
return item.id == client_id; return item.id == client_id;
}); });
appendBranch(foundPolicies.branchs); appendBranch(foundPolicies.branchs);
@ -163,12 +163,12 @@ function fetchClientPolicies() {
if (client_branch_id != 0 ) { if (client_branch_id != 0 ) {
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) { var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
console.log('item', item); // console.log('item', item);
return item.branch_id === client_branch_id; return item.branch_id === client_branch_id;
}); });
if (foundPolicies) { if (foundPolicies) {
console.log('foundPolicies', foundPolicies); // console.log('foundPolicies', foundPolicies);
appendPolicies(foundPolicies); appendPolicies(foundPolicies);
} else { } else {
console.log('No policies found for the selected client'); console.log('No policies found for the selected client');
@ -239,7 +239,7 @@ function appendPolicies(data) {
})); }));
var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0'?>; var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0'?>;
console.log(PolicyID) // console.log(PolicyID)
$.each(data, function(index, item) { $.each(data, function(index, item) {
var option = $('<option>', { var option = $('<option>', {
value: item.client_policy_id, value: item.client_policy_id,
@ -263,14 +263,14 @@ $(document).ready(function() {
})); }));
var selectedClient = $(this).val(); var selectedClient = $(this).val();
console.log('selectedClient', selectedClient); // console.log('selectedClient', selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption); // $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData // Check if the selected option exists in apiData
var foundPolicies = clientPolicies.find(function(item) { var foundPolicies = clientPolicies.find(function(item) {
return item.id === selectedClient; return item.id === selectedClient;
}); });
console.log(foundPolicies.branchs); // console.log(foundPolicies.branchs);
appendBranch(foundPolicies.branchs); appendBranch(foundPolicies.branchs);
}); });
}); });
@ -282,20 +282,24 @@ $(document).ready(function() {
var selectedClient = $(this).val(); var selectedClient = $(this).val();
console.log('selectedBranch', selectedClient); // console.log('selectedBranch', selectedClient);
console.log('clientPolicies', clientPoliciesWithBranch); // console.log('clientPolicies', clientPoliciesWithBranch);
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) { var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
console.log('item', item); // console.log('item', item);
return item.branch_id === selectedClient; return item.branch_id === selectedClient;
}); });
if (foundPolicies) { if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
console.log('foundPolicies', foundPolicies);
appendPolicies(foundPolicies); appendPolicies(foundPolicies);
toastr.warning('No policies found for the selected client branch.');
} else { } else {
console.log('No policies found for the selected client');
// console.log('foundPolicies', foundPolicies);
appendPolicies(foundPolicies);
} }
}); });
@ -315,7 +319,7 @@ function fetchEmpolyeeList(event) {
var status = $('#status2').val(); var status = $('#status2').val();
var branch_id = $('#branch_id').val(); var branch_id = $('#branch_id').val();
console.log(client_id + '-' + policy_id); // console.log(client_id + '-' + policy_id);
if (client_id == '0' || policy_id == '0') { if (client_id == '0' || policy_id == '0') {
alert('Please select values in both dropdowns.'); alert('Please select values in both dropdowns.');
return; return;
@ -331,7 +335,7 @@ function fetchEmpolyeeList(event) {
const queryString = objectToQueryString(queryParams); const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString; const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
console.log(apiURL); // console.log(apiURL);
window.location.href = apiURL; window.location.href = apiURL;

View File

@ -38,7 +38,7 @@ option:disabled {
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label>Branch</label> <br /> <label>Branch</label> <br />
<select name="branch_id" class="form-control" id="branch_id" onchange="checkPolicyTermsAndRackRatesHasDefiend(event)"> <select name="branch_id" class="form-control" id="branch_id">
<option value="0">Select</option> <option value="0">Select</option>
</select> </select>
</div> </div>
@ -187,6 +187,7 @@ var clientPoliciesWithBranch = {
policies: [] policies: []
}; };
var client_id_param = 0; var client_id_param = 0;
var client_branch_id_param = 0;
var client_policy_param = 0; var client_policy_param = 0;
$(document).ready(function() { $(document).ready(function() {
@ -240,10 +241,10 @@ $(document).ready(function() {
// Create FormData object // Create FormData object
var formData = new FormData($(this)[0]); var formData = new FormData($(this)[0]);
for (var pair of formData.entries()) { for (var pair of formData.entries()) {
console.log(pair[0] + ', ' + pair[1]); // console.log(pair[0] + ', ' + pair[1]);
} }
console.log(formData); // console.log(formData);
$('#emp_form_submit_button').prop('disabled', true); $('#emp_form_submit_button').prop('disabled', true);
$('#emp_form_submit_button').html( $('#emp_form_submit_button').html(
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Loading...' '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Loading...'
@ -312,6 +313,7 @@ $(window).on("load", function() {
// Get the value of 'client_id' and 'client_policy_id' // Get the value of 'client_id' and 'client_policy_id'
client_id_param = params.get('client_id'); client_id_param = params.get('client_id');
client_policy_param = params.get('client_policy_id'); client_policy_param = params.get('client_policy_id');
client_branch_id_param = params.get('client_branch_id');
inception_param = params.get('actions'); inception_param = params.get('actions');
// console.log('client_id:', client_id_param); // console.log('client_id:', client_id_param);
@ -348,37 +350,55 @@ function fetchClientPolicies() {
"X-Requested-With": "XMLHttpRequest" "X-Requested-With": "XMLHttpRequest"
}, },
success: function(response) { success: function(response) {
console.log(response);
// console.log(response);
// console.log(response.dataStatus); // console.log(response.dataStatus);
// console.log(response.data); // console.log(response.data);
if (response.code === 200 && response.dataStatus === true && response.data !== "") { if (response.code === 200 && response.dataStatus === true && response.data !== "") {
try { try {
clientPolicies = (response.data) clientPolicies = (response.data)
console.log(clientPolicies); // console.log(clientPolicies);
response.data.forEach(policy => { response.data.forEach(policy => {
console.log('policies', policy.policies); // console.log('policies', policy.policies);
policy.policies.forEach(p => { policy.policies.forEach(p => {
clientPoliciesWithBranch.policies.push(p); clientPoliciesWithBranch.policies.push(p);
}); });
}); });
console.log(clientPoliciesWithBranch); // console.log(clientPoliciesWithBranch);
appendClients(clientPolicies); appendClients(clientPolicies);
//this function for reselect the policy
setTimeout(function() { setTimeout(function() {
if (client_id_param != null ) { if (client_id_param != null ) {
var foundPolicies = clientPolicies.find(function(item) { var foundPolicies = clientPolicies.find(function(item) {
// console.log(typeof item.id) // console.log(typeof item.id)
return item.id == client_id_param; return item.id == client_id_param;
}); });
appendPolicies(foundPolicies.policies); appendBranch(foundPolicies.branchs);
} }
}, 500); }, 500);
//end
setTimeout(function() {
if (client_branch_id_param != null ) {
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
// console.log('item', item);
return item.branch_id === client_branch_id_param;
});
if (foundPolicies) {
// console.log('foundPolicies', foundPolicies);
appendPolicies(foundPolicies);
} else {
console.log('No policies found for the selected client');
}
}
}, 500);
} catch (error) { } catch (error) {
console.error('Error parsing API response data:', error); console.error('Error parsing API response data:', error);
@ -566,7 +586,7 @@ function appendBranch(data) {
value: item.id, value: item.id,
text: item.branch_name text: item.branch_name
}); });
if (client_policy_param == item.id) { if (client_branch_id_param == item.id) {
option.attr('selected', true); option.attr('selected', true);
} }
$('#branch_id').append(option); $('#branch_id').append(option);
@ -615,7 +635,7 @@ $(document).ready(function() {
var selectedClient = $(this).val(); var selectedClient = $(this).val();
console.log('selectedClient', selectedClient); // console.log('selectedClient', selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption); // $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData // Check if the selected option exists in apiData
@ -634,20 +654,23 @@ $(document).ready(function() {
$('#branch_id').on('change', function() { $('#branch_id').on('change', function() {
var selectedClient = $(this).val(); var selectedClient = $(this).val();
console.log('selectedBranch', selectedClient); // console.log('selectedBranch', selectedClient);
console.log('clientPolicies', clientPoliciesWithBranch); // console.log('clientPolicies', clientPoliciesWithBranch);
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) { var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
console.log('item', item); // console.log('item', item);
return item.branch_id === selectedClient; return item.branch_id === selectedClient;
}); });
if (foundPolicies) { if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
console.log('foundPolicies', foundPolicies);
appendPolicies(foundPolicies); appendPolicies(foundPolicies);
toastr.warning('No policies found for the selected client branch.');
} else { } else {
console.log('No policies found for the selected client'); // console.log('foundPolicies', foundPolicies);
appendPolicies(foundPolicies);
} }
}); });
@ -834,7 +857,7 @@ $(document).ready(function() {
if (response.code === 200 && response.dataStatus === true && response.data !== "") { if (response.code === 200 && response.dataStatus === true && response.data !== "") {
try { try {
console.log(response.emp_count.length) // console.log(response.emp_count.length)
if(response.emp_count > 0){ if(response.emp_count > 0){
var select = document.getElementById("upload-action-type"); var select = document.getElementById("upload-action-type");
@ -933,7 +956,7 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}, 1000); }, 1000);
toastr.error('Something went wrong! Try Later', 'Error'); // toastr.error('Something went wrong! Try Later', 'Error');
console.error('Error fetching data from checkPolicyTermsAndRackRatesHasDefiend API:', error); console.error('Error fetching data from checkPolicyTermsAndRackRatesHasDefiend API:', error);
return false; return false;
} }

View File

@ -205,7 +205,7 @@
$('#loader').show(); $('#loader').show();
var apiURL = '<?php echo base_url(); ?>' + 'util/clients-with-policies'; var apiURL = '<?php echo base_url(); ?>' + 'util/clients-with-policies';
console.log('fetchClientPolicies'); console.log('fetchClientPolicies');
console.log(apiURL); // console.log(apiURL);
$.ajax({ $.ajax({
url: apiURL, url: apiURL,
method: 'GET', method: 'GET',
@ -223,19 +223,19 @@
response.data.forEach(policy => { response.data.forEach(policy => {
console.log('policies', policy.policies); // console.log('policies', policy.policies);
policy.policies.forEach(p => { policy.policies.forEach(p => {
clientPoliciesWithBranch.policies.push(p); clientPoliciesWithBranch.policies.push(p);
}); });
}); });
console.log(clientPolicies); // console.log(clientPolicies);
appendClients(clientPolicies); appendClients(clientPolicies);
setTimeout(function() { setTimeout(function() {
if (client_id) { if (client_id) {
var foundPolicies = clientPolicies.find(function(item) { var foundPolicies = clientPolicies.find(function(item) {
console.log(typeof item.id) // console.log(typeof item.id)
return item.id == client_id; return item.id == client_id;
}); });
appendBranch(foundPolicies.branchs); appendBranch(foundPolicies.branchs);
@ -246,12 +246,12 @@
if (client_branch_id) { if (client_branch_id) {
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) { var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
console.log('item', item); // console.log('item', item);
return item.branch_id === client_branch_id; return item.branch_id === client_branch_id;
}); });
if (foundPolicies) { if (foundPolicies) {
console.log('foundPolicies', foundPolicies); // console.log('foundPolicies', foundPolicies);
appendPolicies(foundPolicies); appendPolicies(foundPolicies);
} else { } else {
console.log('No policies found for the selected client'); console.log('No policies found for the selected client');
@ -322,7 +322,7 @@
})); }));
var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0' ?>; var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0' ?>;
console.log(PolicyID) // console.log(PolicyID)
$.each(data, function(index, item) { $.each(data, function(index, item) {
var option = $('<option>', { var option = $('<option>', {
value: item.client_policy_id, value: item.client_policy_id,
@ -346,14 +346,14 @@
})); }));
var selectedClient = $(this).val(); var selectedClient = $(this).val();
console.log(selectedClient); // console.log(selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption); // $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData // Check if the selected option exists in apiData
var foundPolicies = clientPolicies.find(function(item) { var foundPolicies = clientPolicies.find(function(item) {
return item.id === selectedClient; return item.id === selectedClient;
}); });
console.log(foundPolicies.branchs); // console.log(foundPolicies.branchs);
appendBranch(foundPolicies.branchs); appendBranch(foundPolicies.branchs);
}); });
@ -365,20 +365,24 @@
var selectedClient = $(this).val(); var selectedClient = $(this).val();
console.log('selectedBranch', selectedClient); // console.log('selectedBranch', selectedClient);
console.log('clientPolicies', clientPoliciesWithBranch); // console.log('clientPolicies', clientPoliciesWithBranch);
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) { var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
console.log('item', item); // console.log('item', item);
return item.branch_id === selectedClient; return item.branch_id === selectedClient;
}); });
if (foundPolicies) { if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
console.log('foundPolicies', foundPolicies);
appendPolicies(foundPolicies); appendPolicies(foundPolicies);
toastr.warning('No policies found for the selected client branch.');
} else { } else {
console.log('No policies found for the selected client');
// console.log('foundPolicies', foundPolicies);
appendPolicies(foundPolicies);
} }
}); });
@ -396,7 +400,7 @@
var policy_id = $('#policies').val(); var policy_id = $('#policies').val();
var status = $('#status1').val(); var status = $('#status1').val();
var branch_id = $('#branch_id').val(); var branch_id = $('#branch_id').val();
console.log(client_id + '-' + policy_id); // console.log(client_id + '-' + policy_id);
if (client_id == '0' || policy_id == '0') { if (client_id == '0' || policy_id == '0') {
alert('Please select values in both dropdowns.'); alert('Please select values in both dropdowns.');
return; return;
@ -411,7 +415,7 @@
const queryString = objectToQueryString(queryParams); const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString; const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
console.log(apiURL); // console.log(apiURL);
window.location.href = apiURL; window.location.href = apiURL;
} }
@ -425,7 +429,7 @@
$('.emp_data_model').click(function() { $('.emp_data_model').click(function() {
var myVal = $(this).data('id'); var myVal = $(this).data('id');
console.log(myVal); // console.log(myVal);
fetchEmpEndorsementData(myVal) fetchEmpEndorsementData(myVal)
}); });
@ -438,7 +442,7 @@
var apiURL = '<?php echo base_url(); ?>' + 'util/get-emp-endorsement/' + id; var apiURL = '<?php echo base_url(); ?>' + 'util/get-emp-endorsement/' + id;
console.log('fetchEmpEndorsementData'); console.log('fetchEmpEndorsementData');
console.log(apiURL); // console.log(apiURL);
$.ajax({ $.ajax({
url: apiURL, url: apiURL,
method: 'GET', method: 'GET',
@ -447,7 +451,7 @@
"X-Requested-With": "XMLHttpRequest" "X-Requested-With": "XMLHttpRequest"
}, },
success: function(response) { success: function(response) {
console.log(response); // console.log(response);
if (response.code === 200 && response.dataStatus === true) { if (response.code === 200 && response.dataStatus === true) {
try { try {
endorsementData = (response.data); endorsementData = (response.data);

View File

@ -25,14 +25,14 @@
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label>Branch</label> <br /> <label>Branch</label> <br />
<select name="client_branch_id" class="form-control" id="client_branch_id" onchange="checkPolicyTermsAndRackRatesHasDefiend(event)"> <select name="client_branch_id" class="form-control" id="client_branch_id" required>
<option value="0">Select</option> <option value="0">Select</option>
</select> </select>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label>Policy<span class="text-danger" id="policy_danger">*</span></label> <br /> <label>Policy<span class="text-danger" id="policy_danger">*</span></label> <br />
<select name="client_policy_id" class="form-control" id="policy" required> <select name="client_policy_id" class="form-control" id="policy" onchange="checkPolicyTermsAndRackRatesHasDefiend(event)" required>
<option value="">Select</option> <option value="">Select</option>
</select> </select>
</div> </div>
@ -140,6 +140,7 @@
}; };
var client_id_param2 = 0; var client_id_param2 = 0;
var client_branch_id_param2 = 0;
var client_policy_param2 = 0; var client_policy_param2 = 0;
$(document).ready(function() { $(document).ready(function() {
@ -173,7 +174,7 @@
// Create FormData object // Create FormData object
var formData = new FormData($(this)[0]); var formData = new FormData($(this)[0]);
for (var pair of formData.entries()) { for (var pair of formData.entries()) {
console.log(pair[0] + ', ' + pair[1]); // console.log(pair[0] + ', ' + pair[1]);
} }
$('.loader').fadeIn(); $('.loader').fadeIn();
@ -187,7 +188,7 @@
contentType: false, // Let jQuery handle the content type contentType: false, // Let jQuery handle the content type
success: function(response) { success: function(response) {
console.log(response); // console.log(response);
if (response.code === 200 && response.status === true) { if (response.code === 200 && response.status === true) {
$('.loader').fadeOut(); $('.loader').fadeOut();
@ -205,7 +206,7 @@
} else { } else {
console.error('Something went wrong!'); console.error('Something went wrong!');
toastr.error('Something went wrong! Try later', 'Error'); // toastr.error('Something went wrong! Try later', 'Error');
// window.location.reload(true); // window.location.reload(true);
} }
}, },
@ -215,7 +216,7 @@
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
$("#import_export_excel_form")[0].reset() $("#import_export_excel_form")[0].reset()
toastr.error('Something went wrong! Try later', 'Error'); // toastr.error('Something went wrong! Try later', 'Error');
// window.location.reload(true); // window.location.reload(true);
} }
}); });
@ -243,17 +244,18 @@
// Get the value of 'client_id' and 'client_policy_id' // Get the value of 'client_id' and 'client_policy_id'
client_id_param2 = params.get('client_id'); client_id_param2 = params.get('client_id');
client_policy_param2 = params.get('client_policy_id'); client_policy_param2 = params.get('client_policy_id');
client_branch_id_param2 = params.get('client_branch_id');
actions = params.get('actions'); actions = params.get('actions');
insurer_or_tpa = params.get('insurer_or_tpa'); insurer_or_tpa = params.get('insurer_or_tpa');
event = params.get('event'); event = params.get('event');
console.log('client_id2:', client_id_param2); // console.log('client_id2:', client_id_param2);
console.log('client_policy_id2:', client_policy_param2); // console.log('client_policy_id2:', client_policy_param2);
console.log('actions:', actions); // console.log('actions:', actions);
console.log('insurer_or_tpa:', insurer_or_tpa); // console.log('insurer_or_tpa:', insurer_or_tpa);
console.log('event:', event); // console.log('event:', event);
@ -264,7 +266,7 @@
$('#insurer_or_tpa').val(insurer_or_tpa).change() $('#insurer_or_tpa').val(insurer_or_tpa).change()
var selectedValue = actions; var selectedValue = actions;
console.log(selectedValue); // console.log(selectedValue);
if (selectedValue == '') { if (selectedValue == '') {
$('#import_excel_btn').hide(); $('#import_excel_btn').hide();
@ -304,11 +306,11 @@
if (response.code === 200 && response.dataStatus === true && response.data !== "") { if (response.code === 200 && response.dataStatus === true && response.data !== "") {
try { try {
clientPolicies = (response.data); clientPolicies = (response.data);
console.log(clientPolicies); // console.log(clientPolicies);
response.data.forEach(policy => { response.data.forEach(policy => {
console.log('policies', policy.policies); // console.log('policies', policy.policies);
policy.policies.forEach(p => { policy.policies.forEach(p => {
clientPoliciesWithBranch2.policies.push(p); clientPoliciesWithBranch2.policies.push(p);
}); });
@ -317,17 +319,33 @@
appendClients2(clientPolicies); appendClients2(clientPolicies);
//this function for reselect the policy
setTimeout(function() { setTimeout(function() {
if (client_id_param2 != null) { if (client_branch_id_param2 != null) {
var foundPolicies = clientPolicies.find(function(item) { var foundPolicies = clientPolicies.find(function(item) {
console.log(typeof item.id) // console.log(typeof item.id)
return item.id == client_id_param2; return item.id == client_id_param2;
}); });
appendPolicies2(foundPolicies.policies); appendBranch2(foundPolicies.branchs);
}
}, 500);
setTimeout(function() {
if (client_id_param2 != null) {
var foundPolicies = clientPoliciesWithBranch2.policies.filter(function(item) {
// console.log('item', item);
return item.branch_id === client_branch_id_param2;
});
if (foundPolicies) {
// console.log('foundPolicies', foundPolicies);
appendPolicies2(foundPolicies);
} else {
console.log('No policies found for the selected client');
}
} }
}, 500); }, 500);
//end
} catch (error) { } catch (error) {
console.error('Error parsing API response data:', error); console.error('Error parsing API response data:', error);
@ -335,7 +353,7 @@
} else if (response.code === 404 && response.dataStatus === false) { } else if (response.code === 404 && response.dataStatus === false) {
console.error('no data found', response); console.error('no data found', response);
} else { } else {
console.error('Something went wrong!'); // console.error('Something went wrong!');
} }
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
@ -349,7 +367,7 @@
function appendClients2(data) { function appendClients2(data) {
console.log('client_id_param2', client_id_param2) // console.log('client_id_param2', client_id_param2)
$.each(data, function(index, item) { $.each(data, function(index, item) {
var option = $('<option>', { var option = $('<option>', {
@ -366,7 +384,7 @@
function appendBranch2(data) { function appendBranch2(data) {
console.log(data) // console.log(data)
$('#client_branch_id').empty(); $('#client_branch_id').empty();
$('#client_branch_id').append($('<option>', { $('#client_branch_id').append($('<option>', {
@ -378,7 +396,7 @@
value: item.id, value: item.id,
text: item.branch_name text: item.branch_name
}); });
if (client_policy_param == item.id) { if (client_branch_id_param2 == item.id) {
option.attr('selected', true); option.attr('selected', true);
} }
$('#client_branch_id').append(option); $('#client_branch_id').append(option);
@ -417,14 +435,14 @@
})); }));
var selectedClient = $(this).val(); var selectedClient = $(this).val();
console.log(selectedClient); // console.log(selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption); // $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData // Check if the selected option exists in apiData
var foundPolicies = clientPolicies.find(function(item) { var foundPolicies = clientPolicies.find(function(item) {
return item.id === selectedClient; return item.id === selectedClient;
}); });
console.log(foundPolicies.branchs); // console.log(foundPolicies.branchs);
appendBranch2(foundPolicies.branchs); appendBranch2(foundPolicies.branchs);
}); });
@ -437,20 +455,25 @@
var selectedClient = $(this).val(); var selectedClient = $(this).val();
console.log('selectedBranch', selectedClient); // console.log('selectedBranch', selectedClient);
console.log('clientPolicies', clientPoliciesWithBranch2); // console.log('clientPolicies', clientPoliciesWithBranch2);
var foundPolicies = clientPoliciesWithBranch2.policies.filter(function(item) { var foundPolicies = clientPoliciesWithBranch2.policies.filter(function(item) {
console.log('item', item);
return item.branch_id === selectedClient; return item.branch_id === selectedClient;
}); });
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
if (foundPolicies) {
console.log('foundPolicies', foundPolicies);
appendPolicies2(foundPolicies); appendPolicies2(foundPolicies);
toastr.warning('No policies found for the selected client branch.');
} else { } else {
console.log('No policies found for the selected client');
// console.log('foundPolicies', foundPolicies);
appendPolicies2(foundPolicies);
} }
}); });
@ -466,7 +489,7 @@
var client_id = $('#client').val(); var client_id = $('#client').val();
var policy_id = $('#policy').val(); var policy_id = $('#policy').val();
console.log(client_id + '-' + policy_id); // console.log(client_id + '-' + policy_id);
if (client_id == '0' || policy_id == '0') { if (client_id == '0' || policy_id == '0') {
alert('Please select values in both dropdowns.'); alert('Please select values in both dropdowns.');
return; return;
@ -479,7 +502,7 @@
const queryString = objectToQueryString2(queryParams); const queryString = objectToQueryString2(queryParams);
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString; const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
console.log(apiURL); // console.log(apiURL);
window.location.href = apiURL; window.location.href = apiURL;
@ -491,7 +514,7 @@
$('#action_type').change(function() { $('#action_type').change(function() {
var selectedValue = $(this).val(); var selectedValue = $(this).val();
console.log(selectedValue); // console.log(selectedValue);
if (selectedValue == '') { if (selectedValue == '') {
$('#import_excel_btn').hide(); $('#import_excel_btn').hide();
@ -521,7 +544,7 @@
$('#event_type').change(function() { $('#event_type').change(function() {
var selectedVal = $(this).val(); var selectedVal = $(this).val();
console.log(selectedVal); // console.log(selectedVal);
if (selectedVal === 'correction') { if (selectedVal === 'correction') {
$('#policy').prop('required', false); $('#policy').prop('required', false);

View File

@ -291,7 +291,7 @@
fetchMessages(); fetchMessages();
setInterval(fetchMessages, 10000); // Fetch messages every minute setInterval(fetchMessages, 10000); // Fetch messages every ten seconds
}); });
$(document).ready(function() { $(document).ready(function() {
@ -325,6 +325,7 @@
var queryParams = { var queryParams = {
client_id: item.client_id, client_id: item.client_id,
client_policy_id: item.client_policy_id, client_policy_id: item.client_policy_id,
client_branch_id: item.branch_id,
actions: 'inception' actions: 'inception'
}; };
@ -339,7 +340,7 @@
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto'; var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
var toast_status_word = 'Info'; var toast_status_word = 'Info';
var toast_body_data = item.client_name + ' - ' + item.policy_name; var toast_body_data = item.client_name + ' - ' + item.branch_name + ' - ' + item.policy_name;
//console.log(toast_body_data); //console.log(toast_body_data);
@ -376,6 +377,7 @@
var queryParams = { var queryParams = {
client_id: item.client_id, client_id: item.client_id,
client_branch_id: item.branch_id,
event: 'correction', event: 'correction',
actions: 'export', actions: 'export',
insurer_or_tpa: 'tpa', insurer_or_tpa: 'tpa',
@ -399,7 +401,7 @@
title = 'Correction Import Pending'; title = 'Correction Import Pending';
} }
var toast_body_data = item.client_name; var toast_body_data = item.client_name + ' - ' + item.branch_name;
//console.log(toast_body_data); //console.log(toast_body_data);
var html = ` <li data-id="" data-url="${url}"> var html = ` <li data-id="" data-url="${url}">
@ -439,6 +441,7 @@
client_id: item.client_id, client_id: item.client_id,
client_policy_id: item.client_policy_id, client_policy_id: item.client_policy_id,
client_branch_id: item.branch_id,
event: 'deletion', event: 'deletion',
actions: 'export', actions: 'export',
insurer_or_tpa: 'tpa', insurer_or_tpa: 'tpa',
@ -462,7 +465,7 @@
title = 'Deletion Import Pending'; title = 'Deletion Import Pending';
} }
var toast_body_data = item.client_name + ' - ' + item.policy_name; var toast_body_data = item.client_name + ' - ' + item.branch_name + ' - ' + item.policy_name;
//console.log(toast_body_data); //console.log(toast_body_data);
var html = ` <li data-id="" data-url="${url}"> var html = ` <li data-id="" data-url="${url}">
@ -501,6 +504,7 @@
var queryParams = { var queryParams = {
client_id: item.client_id, client_id: item.client_id,
client_policy_id: item.client_policy_id, client_policy_id: item.client_policy_id,
client_branch_id: item.branch_id,
event: 'si_enhancement', event: 'si_enhancement',
actions: 'export', actions: 'export',
insurer_or_tpa: 'tpa', insurer_or_tpa: 'tpa',
@ -523,7 +527,7 @@
title = 'SI Enhancement Import Pending'; title = 'SI Enhancement Import Pending';
} }
var toast_body_data = item.client_name + ' - ' + item.policy_name; var toast_body_data = item.client_name + ' - ' + item.branch_name + ' - ' + item.policy_name;
//console.log(toast_body_data); //console.log(toast_body_data);
var html = ` <li data-id="" data-url="${url}"> var html = ` <li data-id="" data-url="${url}">
@ -562,6 +566,7 @@
var queryParams = { var queryParams = {
client_id: item.client_id, client_id: item.client_id,
client_policy_id: item.client_policy_id, client_policy_id: item.client_policy_id,
client_branch_id: item.branch_id,
event: 'inception', event: 'inception',
insurer_or_tpa: 'tpa', insurer_or_tpa: 'tpa',
actions: 'export', actions: 'export',
@ -584,7 +589,7 @@
title = 'TPA Import Pending'; title = 'TPA Import Pending';
} }
var toast_body_data = item.client_name + ' - ' + item.policy_name; var toast_body_data = item.client_name + ' - ' + item.branch_name + ' - ' + item.policy_name;
//console.log(toast_body_data); //console.log(toast_body_data);
var html = ` <li data-id="" data-url="${url}"> var html = ` <li data-id="" data-url="${url}">
@ -623,6 +628,7 @@
client_id: item.client_id, client_id: item.client_id,
client_policy_id: item.client_policy_id, client_policy_id: item.client_policy_id,
client_branch_id: item.branch_id,
event: 'inception', event: 'inception',
insurer_or_tpa: 'insurer', insurer_or_tpa: 'insurer',
actions: 'export', actions: 'export',
@ -644,7 +650,7 @@
title = 'Insurer Import Pending'; title = 'Insurer Import Pending';
} }
var toast_body_data = item.client_name + ' - ' + item.policy_name; var toast_body_data = item.client_name + ' - ' + item.branch_name + ' - ' + item.policy_name;
//console.log(toast_body_data); //console.log(toast_body_data);
var html = ` <li data-id="" data-url="${url}"> var html = ` <li data-id="" data-url="${url}">

View File

@ -84,7 +84,7 @@
<div class="row" style="margin-bottom:1rem;"> <div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;"> <div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Transaction Details</h4> <h4 style="position: relative;">Transaction Details</h4>
</div> </div>
<div class="col-6" style="text-align: right; position: relative;top: 53px;"> <div class="col-6" style="text-align: right; position: relative;top: 53px;">