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();
$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';
}

View File

@ -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,

View File

@ -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,
@ -160,6 +165,7 @@ class PendingActionsController extends AdminController
')
->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('client_branch', 'client_branch.id = employees.client_branch_id', 'left')
->where([
'emp_endorsement.actions' => 'c',
'emp_endorsement.is_active' => 1,
@ -173,6 +179,8 @@ class PendingActionsController extends AdminController
$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');

View File

@ -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;
}
}

View File

@ -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']);

View File

@ -5,7 +5,7 @@
<div class="row" style="margin-bottom:1rem;">
<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>
</div>

View File

@ -51,7 +51,7 @@
<div class="form-group col-md-4">
<label for="kyc_docs">File<span
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 class="form-group col-md-4 align-self-end"> -->
<div class="form-group col-md-4" style="margin-top: 42px;">
@ -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', '<?= base_url('download-kyc-docs/') ?>' + 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: '<?= base_url("client/kyc/list/"); ?>' + '<?= isset($client['entity_type_id']) ? $client['entity_type_id'] : '' ?>',
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 = <?= isset($client_kyc) ? json_encode($client_kyc) : '[]' ?>;
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 += `
<tr id="kyc-${item.id}">
@ -289,6 +305,11 @@
});
$('#other_docs').append(table);
if(other_docs_count > 0){
$('#others').show()
$('#other_docs_table').show();
}
$.each(data, function(index, item) {
// console.log(item.kyc_doc_type_id);
@ -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', '<?= base_url('download-kyc-docs/') ?>' + 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 = `
<tr id="kyc-${item.id}">
<td>${item.other_docs_name}</td>
<td>${item.file_name}</td>
<td>
<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>
</tr>
`;
}
$('#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('<?php echo base_url('client/kyc/delete/');?>'+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('<?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){
$('#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>

View File

@ -2,8 +2,7 @@
<div class="row float-right" style="padding-bottom: 10px; position: relative;right: 13px;">
<button type="button" id="BtnAdd" class="btn btn-primary waves-effect waves-light btnAdd btn-sm"><span
class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy</button>
<button type="button" id="BtnAdd" class="btn btn-primary waves-effect waves-light btnAdd btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy</button>
</div>
<div class="table-responsive" id="table_list">
@ -30,9 +29,7 @@
<div class="card-body">
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
<button type="button" id="btnPolicyBack"
class="btn btn-primary waves-effect waves-light btn-sm btnBack btn-sm"><span class="fa fa-list"
aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
<button type="button" id="btnPolicyBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack btn-sm"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
</div>
<hr>
@ -42,15 +39,13 @@
<input type="hidden" name="PrimaryKey" id="policy_PrimaryKey" />
<input type="hidden" id="policy_form_action" />
<input type="hidden" name="policy_type_id" id="policy_type_id" />
<input type="hidden" name="client_id" id="client_id_policy"
value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
<input type="hidden" name="client_id" id="client_id_policy" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-4">
<label for="client_branch">Client Branch<span
class="text-danger">*</span></label>
<label for="client_branch">Client Branch<span class="text-danger">*</span></label>
<select class="form-control" id="client_branch" name="client_branch_id">
<option value="" selected>Select Client Branch</option>
</select>
@ -68,8 +63,7 @@
</div>
<div class="form-group col-md-4" id="base_policy_id" style="display: none;">
<label for="addon_policy">Base Policy<span id="base_danger"
class="text-danger">*</span></label>
<label for="addon_policy">Base Policy<span id="base_danger" class="text-danger">*</span></label>
<select class="form-control" id="base_policy" name="base_policy">
<option value="" selected>Select Base Policy</option>
</select>
@ -109,24 +103,19 @@
<div class="form-row" id="second" style="display: none;">
<div class="form-group col-md-3">
<label for="policy_no">Policy No<span class="text-danger">*</span></label>
<input value="" type="text" class="form-control" placeholder="Enter Policy Number "
name="policy_no" id="policy_no" required>
<input value="" type="text" class="form-control" placeholder="Enter Policy Number " name="policy_no" id="policy_no" required>
</div>
<div class="form-group col-md-3">
<label for="policy_start_date">Policy Start Date<span
class="text-danger">*</span></label>
<input value="" type="text" class="form-control" placeholder="Enter Start Date "
name="policy_start_date" id="start_date" required>
<label for="policy_start_date">Policy Start Date<span class="text-danger">*</span></label>
<input value="" type="text" class="form-control" placeholder="Enter Start Date " name="policy_start_date" id="start_date" required>
</div>
<div class="form-group col-md-3">
<label for="policy_end_date">Policy End Date<span class="text-danger">*</span></label>
<input value="" type="text" class="form-control" placeholder="Enter End Date "
name="policy_end_date" id="end_date" required>
<input value="" type="text" class="form-control" placeholder="Enter End Date " name="policy_end_date" id="end_date" required>
</div>
<div class="form-group col-md-3" id="policy_status_field">
<label for="policy_status">Policy Status</label>
<input value="" type="text" class="form-control" placeholder="Policy Status"
id="policy_status" readonly>
<input value="" type="text" class="form-control" placeholder="Policy Status" id="policy_status" readonly>
</div>
</div>
@ -146,10 +135,8 @@
</div>
<div class="form-group text-right m-b-0">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnSubmit">Submit</button>
<button type="button" class="btn btn-secondary waves-effect btnBack"
id="btnBack">Cancel</button>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
<button type="button" class="btn btn-secondary waves-effect btnBack" id="btnBack">Cancel</button>
</div>
</form>
</div>
@ -216,7 +203,7 @@ $(document).ready(function() {
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
// console.log('client_policy_data',data)
data.forEach(function(item) {
console.log(item.open_for_enrollment);
// console.log(item.open_for_enrollment);
var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
var subject = item.policy_type_name;
@ -326,6 +313,7 @@ $('.btnAdd').click(function() {
$('.btnBack').click(function() {
$('#policy_form')[0].reset();
$('#add_form').hide();
$('#table_list').show();
@ -339,6 +327,7 @@ $('.btnBack').click(function() {
$('#policy').html('<option value="" selected>Select Policy</option>');
$('#base_policy_id').hide();
$('#client_branch').val('').change();
})
@ -353,8 +342,8 @@ $("#policy_form").submit(function(event) {
var policyDataId = $('#policy').children('option:selected').attr('data-id');
var basePolicyDataId = $('#base_policy').children('option:selected').attr('data-id');
console.log('policyDataId', policyDataId);
console.log('basePolicyDataId', basePolicyDataId);
// console.log('policyDataId', policyDataId);
// console.log('basePolicyDataId', basePolicyDataId);
if (policy_PrimaryKey === '' && policy_client === '') {
toastr.error('Client is required', 'Error');
@ -530,7 +519,7 @@ $("#policy_form").submit(function(event) {
});
$(document).ready(function() {
/********* To get th POLICY base on Insurer *******/
/********* To get the POLICY base on Insurer *******/
$('#insurer').change(function() {
var id = $(this).val();
var parts = id.split('-');
@ -617,7 +606,7 @@ $(document).ready(function() {
var id = $(this).val();
var dataId = $(this).children('option:selected').attr('data-id');
console.log('id', id)
// console.log('id', id)
$('#policy_type_id').val(dataId);
if (dataId == 1) {
@ -642,19 +631,14 @@ $(document).ready(function() {
// }
// });
// if(dataId == 1){
// appendPolicyFormFields(1);
// }else if (dataId >= 1){
// appendPolicyFormFields(2);
// }
if ($('#policy_type').val() == 1) {
console.log('step 1')
// console.log('step 1')
if (dataId == 3) {
console.log('step 2')
// console.log('step 2')
var displayStatus = $('#base_policy_id').css('display');
$('#base_policy_id').show();
@ -662,7 +646,7 @@ $(document).ready(function() {
// $('#base_policy').prop('required', true);
if (displayStatus === 'none') {
console.log('step 2.1')
// console.log('step 2.1')
$('#base_policy').val('').change();
}
@ -671,7 +655,7 @@ $(document).ready(function() {
} else {
console.log('step 3')
// console.log('step 3')
var displayStatus = $('#base_policy_id').css('display');
$('#base_policy_id').hide();
@ -679,7 +663,7 @@ $(document).ready(function() {
// $('#base_policy').prop('required', false);
if (displayStatus === 'none') {
console.log('step 3.1')
// console.log('step 3.1')
$('#base_policy').val('').change();
}
@ -888,10 +872,6 @@ $('body').on('click', '.btnOpenEnroll', function() {
var policy_id = $(this).attr('id');
var client_id = $('#client_id_policy').val()
console.log('client_policy_id', client_policy_id)
console.log('policy_id', policy_id)
console.log('client_id', client_id)
if (client_policy_id) {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
@ -905,8 +885,6 @@ $('body').on('click', '.btnOpenEnroll', function() {
},
success: function(res) {
console.log(res.client_policy_data);
if (res) {
if (res.open_for_enrollment) {
var json_decode = JSON.parse(res.open_for_enrollment);
@ -977,147 +955,6 @@ $('body').on('click', '.btnOpenEnroll', function() {
});
function appendPolicyFormFields(policy_type, data = false) {
var html = '';
var container = document.getElementById('policy_fields');
if (policy_type == 2) {
$('#GMC').remove();
$('#GPA').remove();
html = `
<div id="GMC">
<div class="form-row">
<div class="form-group col-md-3">
<label for="earned_premium_date">Earned Premium Date<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? rearrangeDateFormat(data.earned_premium_date) : ''}" type="date" class="form-control" placeholder="Enter Earned Premium Date " name="earned_premium_date" id="earned_premium_date" required>
</div>
<div class="form-group col-md-3">
<label for="earned_premium_amount">Earned Premium<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.earned_premium_amount : ''}" type="text" class="form-control" placeholder="Enter Earned Premium " name="earned_premium_amount" id="earned_premium_amount" required>
</div>
<div class="form-group col-md-3">
<label for="claims_incurred_date">Claims Incurred Date<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? rearrangeDateFormat(data.claims_incurred_date) : ''}" type="date" class="form-control" placeholder="Enter Claims Incurred Date " name="claims_incurred_date" id="claims_incurred_date" required>
</div>
<div class="form-group col-md-3">
<label for="claims_incurred_amount">Claims Incurred<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.claims_incurred_amount : ''}" type="text" class="form-control" placeholder="Enter Claims Incurred " name="claims_incurred_amount" id="claims_incurred_amount" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="no_of_employees">No of Employees<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.no_of_employees : ''}" type="text" class="form-control" placeholder="Enter No of Employees" name="no_of_employees" id="no_of_employees" required>
</div>
<div class="form-group col-md-3">
<label for="no_of_lives">No of Lives<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.no_of_lives : ''}" type="text" class="form-control" placeholder="Enter No of Lives " name="no_of_lives" id="no_of_lives" required>
</div>
<div class="form-group col-md-3">
<label for="no_lives_at_inception">No Lives at Inception<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.no_lives_at_inception : ''}" type="text" class="form-control" placeholder="Enter No Lives at Inception " name="no_lives_at_inception" id="no_lives_at_inception" required>
</div>
</div>
<hr>
<div class="form-row">
<div class="form-group col-md-4">
<label for="premium_paid_at_inception">Premium paid at Inception<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium_paid_at_inception : ''}" type="text" class="form-control" placeholder="Enter Premium paid at Inception" name="premium_paid_at_inception" id="premium_paid_at_inception" required>
</div>
<div class="form-group col-md-4">
<label for="incurred_claims_ratio">Incurred Claims Ratio<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.incurred_claims_ratio : '0'}" type="text" class="form-control" placeholder="Enter Claims Ratio" name="incurred_claims_ratio" id="incurred_claims_ratio" readonly required>
</div>
<div class="form-group col-md-4">
<label for="policy_status">Policy Status<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.policy_status : ''}" type="text" class="form-control" placeholder="Enter Policy Status " name="policy_status" id="policy_status" required>
</div>
</div>
</div>`;
} else if (policy_type == 1) {
$('#GMC').remove();
$('#GPA').remove();
html = `
<div class="form-row" id="GPA">
<div class="form-group col-md-4">
<label for="no_of_employees">No of Employees<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.no_of_employees : ''}" type="text" class="form-control" placeholder="Enter No of Employees" name="no_of_employees" id="no_of_employees" required>
</div>
<div class="form-group col-md-4">
<label for="policy_status">Policy Status<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.policy_status : ''}" type="text" class="form-control" placeholder="Enter Policy Status " name="policy_status" id="policy_status" required>
</div>
<div class="form-group col-md-4">
<label for="claims_experience_for_last_3_years">Claims Experience for Last 3 Years<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.claims_experience_for_last_3_years : ''}" type="text" class="form-control" placeholder="Enter Claims Experience for Last 3 Years " name="claims_experience_for_last_3_years" id="claims_experience_for_last_3_years" required>
</div>
</div>`;
}
container.insertAdjacentHTML('beforeend', html);
if (policy_type == 2) {
//Configure Flatpicker for the earned_premium_date datepicker.
flatpickr("#earned_premium_date", {
dateFormat: "d-m-Y",
defaultDate: "today",
allowInput: false,
});
//Configure Flatpicker for the claims_incurred_date datepicker.
flatpickr("#claims_incurred_date", {
dateFormat: "d-m-Y",
defaultDate: "today",
allowInput: false
});
}
$('#earned_premium_amount').keyup(function() {
var PA = parseFloat($(this).val());
var CA = parseFloat($('#claims_incurred_amount').val());
// console.log('earned_premium_amount',PA)
// console.log('claims_incurred_amount',CA)
if (!isNaN(PA) && !isNaN(CA) && CA !== 0) {
var incurredClaimRatio = CA / PA;
// console.log(incurredClaimRatio)
$('#incurred_claims_ratio').val(incurredClaimRatio.toFixed(2));
} else {
$('#incurred_claims_ratio').val('0');
}
});
$('#claims_incurred_amount').keyup(function() {
var CA = $(this).val()
var PA = $('#earned_premium_amount').val()
// console.log('earned_premium_amount',PA)
// console.log('claims_incurred_amount',CA)
if (!isNaN(PA) && !isNaN(CA) && CA !== 0) {
var incurredClaimRatio = CA / PA;
// console.log(incurredClaimRatio)
$('#incurred_claims_ratio').val(incurredClaimRatio.toFixed(2));
} else {
$('#incurred_claims_ratio').val('0');
}
})
}
//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy'
function rearrangeDateFormat(inputDate) {
@ -1324,7 +1161,7 @@ function formatNumber(input, maxLength) {
function removeClientPolicy(element) {
console.log(element);
// console.log(element);
}
@ -1415,7 +1252,7 @@ function fetchClientPolicyList() {
var client_id = $('#client_id_policy').val()
var client_branch_id = $('#client_branch').val()
console.log('client_branch_id', client_branch_id)
// console.log('client_branch_id', client_branch_id)
$.ajax({
url: '<?= base_url("util/featch-client-policy-list/") ?>' + client_id,
@ -1437,7 +1274,7 @@ function fetchClientPolicyList() {
OptionsHTML += '<option value="" selected>Select Base Policy</option>';
$.each(res.data, function(index, item) {
console.log('item.client_branch_id', item.client_branch_id)
// console.log('item.client_branch_id', item.client_branch_id)
if (item.client_branch_id == client_branch_id) {
@ -1445,7 +1282,7 @@ function fetchClientPolicyList() {
if ($('#policy_type').val() == 1) {
if (item.policy_type_id == 1 || item.policy_type_id == 2) {
console.log('if 2')
// console.log('if 2')
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id +
'">' + item.name + '( ' + item.policy_type + ' )</option>';
@ -1481,13 +1318,13 @@ $(document).ready(function() {
var client_policy_id = $(this).val()
var policy_type = $('#policy_type').val()
console.log(client_policy_id);
// console.log(client_policy_id);
dataId = $('#policy').children('option:selected').attr('data-id');
console.log('dataId', dataId)
// console.log('dataId', dataId)
base_policy_data_id = $(this).children('option:selected').attr('data-id');
console.log('base_policy_data_id', base_policy_data_id);
// console.log('base_policy_data_id', base_policy_data_id);
var queryParams = {
client_policy_id: client_policy_id,
@ -1530,7 +1367,7 @@ $(document).ready(function() {
$policy_type_value = $('#policy_type').val();
$.each(res.policy, function(index, item) {
console.log(item);
// console.log(item);
policeOptionHTML += '<option data-id="' + item.policy_type_id +
'" value="' + item.id + '" ' + (res.data.policy_id === item
@ -1544,16 +1381,16 @@ $(document).ready(function() {
if (dataId == 3 || policy_type == 1) {
console.log('step 1')
// console.log('step 1')
setTimeout(function() {
console.log('step 2')
// console.log('step 2')
var $option = $('#policy').find('option[data-id="3"]');
if ($option.length > 0) {
console.log('step 3')
// console.log('step 3')
$option.prop('selected', true).change();
} else {
console.log('step 4');
// console.log('step 4');
toastr.warning(
'The insurer does not have a GMC-Parents policy.',
'Warning');
@ -1608,7 +1445,7 @@ function fetchClientBranch() {
$('.loader-mask').delay(350).fadeOut('slow');
console.log(res);
console.log(res.data.length);
// console.log(res.data.length);
if (res.data.length == 0) {
toastr.warning('The client does not have any branches.', 'warning');
@ -1629,6 +1466,8 @@ function fetchClientBranch() {
function appendClientBranch(data) {
$('#client_branch').empty();
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
@ -1643,11 +1482,9 @@ function appendClientBranch(data){
$(document).ready(function() {
$("#client_branch").on('change', function() {
console.log('fetchClientPolicyList change')
// console.log('fetchClientPolicyList change')
fetchClientPolicyList();
});
})
</script>

View File

@ -122,7 +122,7 @@ function fetchClientPolicies() {
$('#loader').show();
var apiURL = '<?php echo base_url();?>' + '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 = <?= isset($getData) ? $getData['policy_id'] : '0'?>;
console.log(PolicyID)
// console.log(PolicyID)
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.client_policy_id,
@ -263,14 +263,14 @@ $(document).ready(function() {
}));
var selectedClient = $(this).val();
console.log('selectedClient', selectedClient);
// console.log('selectedClient', selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData
var foundPolicies = clientPolicies.find(function(item) {
return item.id === selectedClient;
});
console.log(foundPolicies.branchs);
// console.log(foundPolicies.branchs);
appendBranch(foundPolicies.branchs);
});
});
@ -282,20 +282,24 @@ $(document).ready(function() {
var selectedClient = $(this).val();
console.log('selectedBranch', selectedClient);
console.log('clientPolicies', clientPoliciesWithBranch);
// console.log('selectedBranch', selectedClient);
// console.log('clientPolicies', clientPoliciesWithBranch);
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
console.log('item', item);
// console.log('item', item);
return item.branch_id === selectedClient;
});
if (foundPolicies) {
console.log('foundPolicies', foundPolicies);
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
appendPolicies(foundPolicies);
toastr.warning('No policies found for the selected client branch.');
} 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 branch_id = $('#branch_id').val();
console.log(client_id + '-' + policy_id);
// console.log(client_id + '-' + policy_id);
if (client_id == '0' || policy_id == '0') {
alert('Please select values in both dropdowns.');
return;
@ -331,7 +335,7 @@ function fetchEmpolyeeList(event) {
const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
console.log(apiURL);
// console.log(apiURL);
window.location.href = apiURL;

View File

@ -38,7 +38,7 @@ option:disabled {
<div class="form-group col-md-4">
<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>
</select>
</div>
@ -187,6 +187,7 @@ var clientPoliciesWithBranch = {
policies: []
};
var client_id_param = 0;
var client_branch_id_param = 0;
var client_policy_param = 0;
$(document).ready(function() {
@ -240,10 +241,10 @@ $(document).ready(function() {
// Create FormData object
var formData = new FormData($(this)[0]);
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').html(
'<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'
client_id_param = params.get('client_id');
client_policy_param = params.get('client_policy_id');
client_branch_id_param = params.get('client_branch_id');
inception_param = params.get('actions');
// console.log('client_id:', client_id_param);
@ -348,37 +350,55 @@ function fetchClientPolicies() {
"X-Requested-With": "XMLHttpRequest"
},
success: function(response) {
console.log(response);
// console.log(response);
// console.log(response.dataStatus);
// console.log(response.data);
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
try {
clientPolicies = (response.data)
console.log(clientPolicies);
// console.log(clientPolicies);
response.data.forEach(policy => {
console.log('policies', policy.policies);
// console.log('policies', policy.policies);
policy.policies.forEach(p => {
clientPoliciesWithBranch.policies.push(p);
});
});
console.log(clientPoliciesWithBranch);
// console.log(clientPoliciesWithBranch);
appendClients(clientPolicies);
//this function for reselect the policy
setTimeout(function() {
if (client_id_param != null ) {
var foundPolicies = clientPolicies.find(function(item) {
// console.log(typeof item.id)
return item.id == client_id_param;
});
appendPolicies(foundPolicies.policies);
appendBranch(foundPolicies.branchs);
}
}, 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) {
console.error('Error parsing API response data:', error);
@ -566,7 +586,7 @@ function appendBranch(data) {
value: item.id,
text: item.branch_name
});
if (client_policy_param == item.id) {
if (client_branch_id_param == item.id) {
option.attr('selected', true);
}
$('#branch_id').append(option);
@ -615,7 +635,7 @@ $(document).ready(function() {
var selectedClient = $(this).val();
console.log('selectedClient', selectedClient);
// console.log('selectedClient', selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData
@ -634,20 +654,23 @@ $(document).ready(function() {
$('#branch_id').on('change', function() {
var selectedClient = $(this).val();
console.log('selectedBranch', selectedClient);
console.log('clientPolicies', clientPoliciesWithBranch);
// console.log('selectedBranch', selectedClient);
// console.log('clientPolicies', clientPoliciesWithBranch);
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
console.log('item', item);
// console.log('item', item);
return item.branch_id === selectedClient;
});
if (foundPolicies) {
console.log('foundPolicies', foundPolicies);
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
appendPolicies(foundPolicies);
toastr.warning('No policies found for the selected client branch.');
} 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 !== "") {
try {
console.log(response.emp_count.length)
// console.log(response.emp_count.length)
if(response.emp_count > 0){
var select = document.getElementById("upload-action-type");
@ -933,7 +956,7 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 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);
return false;
}

View File

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

View File

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

View File

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

View File

@ -84,7 +84,7 @@
<div class="row" style="margin-bottom:1rem;">
<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 class="col-6" style="text-align: right; position: relative;top: 53px;">