FEAT_CLIENT_BASIC_INFO_PAGE : RV

This commit is contained in:
VENKATESHWARAN 2024-05-23 12:34:30 +05:30
parent dddc960142
commit 404ee3f03f
21 changed files with 1994 additions and 1100 deletions

View File

@ -234,6 +234,8 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
$routes->get("preview-card/(:any)", "EmployeeController::previewTemplate/$1");
$routes->get("export-import-error-list/(:any)", "EmployeeController::errorListExportImport/$1");
$routes->get("has_policy_config_completed/(:any)", "EmployeeController::hasPolicyConfigCompleted/$1");
$routes->get("get-client-branch/(:any)", "ClientController::getClientBranch/$1");
$routes->get("get-client-details/(:any)", "ClientController::getClientAllDetailsByUsingClientID/$1");
});
$routes->cli('cli/processjob', 'JobWorker::processJob');

View File

@ -98,12 +98,13 @@ class ClientController extends AdminController
public function index()
{
$this->myLogger->logme('error','Client list function called');
$headerData['page_name'] = 'Client List';
$data['clientList'] = $this->clientModel->getCreatedByUserName();
$data['client_rm'] = $this->clientRMModel->getAllClientRM();
// dd($data);
echo view('layout/header', $headerData);
echo view('client_list', $data);
echo view('layout/footer');
@ -584,6 +585,19 @@ class ClientController extends AdminController
$this->myLogger->logme('error','Client policy CREATE function called');
$policy_id = $this->request->getPost('policy_id');
$client_branch_id = $this->request->getPost('client_branch_id');
$policyCount = $this->clientPolicyModel
->where('policy_id', $policy_id)
->where('client_branch_id', $client_branch_id)
->countAllResult();
if($policyCount > 0 ){
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($this->request->getPost('client_id'));
return $this->respond(['status' => 'policy_exist','code' => 200,'data' => $clientPoliceData, 'method' => 'CERATE'], 200);
}
$insurerValue = (string) $this->request->getPost('insurer');
list($insurerBranchId, $insurerId) = explode('-', $insurerValue);
$client_id = $this->request->getPost('client_id');
@ -623,6 +637,7 @@ class ClientController extends AdminController
$data['base_policy'] = $this->request->getPost('base_policy');
$data['policy_status'] = 1;
$data['inception_type'] = $this->request->getPost('inception_type') ? 2 : 1;
$data['client_branch_id'] = $this->request->getPost('client_branch_id');
@ -717,6 +732,8 @@ class ClientController extends AdminController
$data['base_policy'] = $this->request->getPost('base_policy');
$data['policy_status'] = 1;
$data['inception_type'] = $this->request->getPost('inception_type') ? 2 : 1;
$data['client_branch_id'] = $this->request->getPost('client_branch_id');
$policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
@ -1707,4 +1724,330 @@ class ClientController extends AdminController
return "File not found.";
}
}
public function getClientBranch($client_id){
$branchs = $this->clientBranchModel
->select('*')
->where('client_id',$client_id)
->findAll();
return $this->respond(['status' => true,'code' => 200, 'data' => $branchs], 200);
}
public function getClientAllDetailsByUsingClientID($client_id)
{
$db = \Config\Database::connect();
$builder = $db->table('clients');
$builder->select('
policies.name as policy_name,
policy_type.policy_type,
insurers.name as insurer_name,
insurers.short_name as insurer_short_name,
tpa.name as tpa_name,
tpa.short_name as tpa_short_name,
client_policy.policy_terms,
DATE_FORMAT(client_policy.policy_start_date, "%d-%b-%Y") as policy_start_date,
DATE_FORMAT(client_policy.policy_end_date, "%d-%b-%Y") as policy_end_date,
CASE
WHEN client_policy.base_policy IS NULL THEN "Not Appear"
WHEN client_policy.base_policy = 0 THEN "Not Appear"
ELSE (SELECT policies.name
FROM client_policy AS base_client_policy
JOIN policies ON policies.id = base_client_policy.policy_id
WHERE base_client_policy.id = client_policy.base_policy)
END as base_policy_name,
CASE
WHEN client_policy.is_addon = 1 THEN "Base Policy"
WHEN client_policy.is_addon = 2 THEN "SI Topup"
WHEN client_policy.is_addon = 3 THEN "Dependent Addon"
ELSE "n/a"
END as is_addon,
CASE
WHEN client_policy.policy_status = 1 THEN "Active"
WHEN client_policy.policy_status = 0 THEN "Expired"
ELSE "n/a"
END as policy_status,
CASE
WHEN client_policy.inception_type = 1 THEN "File Upload"
WHEN client_policy.inception_type = 2 THEN "Enrollment"
ELSE "n/a"
END as inception_type,
CASE
WHEN client_policy.open_for_enrollment = 1 THEN "Open"
WHEN client_policy.open_for_enrollment = 0 THEN "Closed"
ELSE "n/a"
END as open_for_enrollment,
client_branch.branch_name
', false);
$builder->join('client_policy', 'client_policy.client_id = clients.id');
$builder->join('client_branch', 'client_policy.client_branch_id = client_branch.id');
$builder->join('policies', 'policies.id = client_policy.policy_id');
$builder->join('policy_type', 'policy_type.id = policies.policy_type_id');
$builder->join('insurers', 'insurers.id = client_policy.insurer_id');
$builder->join('tpa', 'tpa.id = client_policy.tpa_id');
$builder->where('clients.is_active', 1);
$builder->where('client_policy.is_active', 1);
$builder->where('policies.is_active', 1);
$builder->where('policy_type.is_active', 1);
$builder->where('client_policy.policy_status', 1);
$builder->where('clients.id', $client_id);
$query = $builder->get();
$client_policy = $query->getResultArray();
$gmc_keys = [
"sum_insured" => "Sum Insured",
"family_floater" => "Family Floater",
"family_floaters" => "Family Floaters",
"member_count" => "Elders Count:",
"other_member_min_age" => "Min Age:",
"other_member_max_age" => "Min Age:",
"waiverofpreexistingdiseases" => "Waiver of Pre-existing Diseases",
"9monthwaitingperiodwaived" => "9-month waiting Period waived",
"coverfromthedateofjoining" => "Cover from the date of Joining",
"waiverof1,2,3&4thyearexclusions" => "Waiver of 1, 2, 3 & 4th year Exclusions",
"waiverof30dayswaitingperiod" => "Waiver of 30 days waiting period",
"prehospitalizationcover" => "Pre Hospitalization Cover",
"congenitaldiseasesinternal" => "Congenital Diseases - Internal",
"copayzonewisecopay" => "Co-Pay/Zone wise Co Pay",
"bioabsorbablestenttoriclensmultifocallens" => "Bio absorbable stent / Toric lens/ Multi Focal lens",
"roomrentlimit" => "Room Rent Limit",
"proportionatedeductionclause" => "Proportionate Deduction Clause",
"nursingallowance" => "Nursing Allowance",
"ailmentcapping" => "Ailment capping",
"ambulancecharges" => "Ambulance Charges",
"airambulance" => "Air Ambulance",
"familytransportationbenefit" => "Family Transportation Benefit",
"reasonableandcustomarycharges" => "Reasonable and Customary Charges",
"daycaretreatment" => "Day Care Treatment",
"ayudhtreatmentcover" => "AYUSH treatment cover",
"armdcovered" => "ARMD Covered",
"suminsuredenhancement" => "Sum Insured enhancement",
"automaticsuminsuredreinstatement" => "Automatic Sum Insured reinstatement",
"additionalsicknessbenefit" => "Additional Sickness Benefit",
"lasiksurgery" => "Lasik Surgery",
"midterminclusion" => "Mid Term inclusion",
"capd" => "CAPD",
"organdonorexpenses" => "Organ donor expenses",
"moderntreatmentsasperirdai" => "Modern treatments as per IRDAI",
"Wellness" => "Wellness",
"days_of_discharge" => "Claim Intimation Clause",
"days_from_dod" => "Claim Submission",
"cataract" => "Cataract"
];
$gpa_keys = [
"sumInsured2" => "Sum Insured",
"totalSumInsured" => "Total Sum Assured",
"self" => "Self",
"self_min_age" => "Min Age",
"self_max_age" => "Max Age",
"accidentalDeathBenefit" => "Accidental Death Benefit",
"permanentTotalDisablement" => "Permanent Total Disablement",
"permanentPartialDisablement" => "Permanent Partial Disablement",
"temporaryTotalDisablementBenefit" => "Temporary Total Disablement benefit",
"accidentalHospitalizationExpenses" => "Accidental Hospitalization Expenses",
"childrenEducationWelfareFund" => "Children Education Welfare Fund",
"compassionateVisitExpenses" => "Compassionate Visit Expenses",
"compassionateVisitExpensesData" => "Compassionate Visit Expenses Data",
"brokenBoneExpenses" => "Broken Bone Expenses",
"brokenBoneExpensesData" => "Broken Bone Expenses Data",
"ambulanceCharges" => "Ambulance charges",
"ambulanceChargesData" => "Ambulance charges Data",
"burnExpenses" => "Burn Expenses",
"burnExpensesData" => "Burn Expenses Data",
"carriageOfDeadBody" => "Carriage of Dead Body",
"carriageOfDeadBodyData" => "Carriage of Dead Body Data",
"animalSnakeInsectBite" => "Animal/Snake/Insect bite",
"terrorism" => "Terrorism",
"worldwideCover" => "Worldwide Cover"
];
foreach ($client_policy as $key => $value) {
$policy_terms = json_decode($value['policy_terms'], true);
$mapping = $gmc_keys;
if ($value['policy_type'] == 'GPA') {
$mapping = $gpa_keys;
}
$client_policy[$key]['policy_terms'] = $this->transformArray($policy_terms, $mapping);
}
$data['client_policy'] = $client_policy;
$data['client_branch'] = $this->clientModel
->select('
client_branch.branch_name,
client_branch.branch_code,
client_branch.city,
level_contacts.name as hr_name,
level_contacts.designation,
level_contacts.mobile,
level_contacts.email
')
->join('client_branch', 'client_branch.client_id = clients.id')
->join('level_contacts', 'level_contacts.ref_id = client_branch.id')
->where('clients.is_active', 1)
->where('client_branch.is_active', 1)
->where('level_contacts.is_active', 1)
->where('level_contacts.contact_type', 'client')
->where('clients.id', $client_id)
->get()->getResultArray();
$data['client'] = $this->clientModel
->select('clients.*, states.state as state')
->join('states', 'states.id = clients.state')
->where('clients.id', $client_id)->first();
$client_rm = $this->clientRMModel
->select('client_rm.*, user_profiles.first_name as user_name')
->join('user_profiles', 'user_profiles.id = client_rm.user_id')
->where('client_id', $client_id)->get()->getResultArray();
$account_managers = [];
$managers = [];
$heads = [];
foreach ($client_rm as $key => $value) {
if ($value['level'] == 3) {
$account_managers[] = $value['user_name'];
} elseif ($value['level'] == 2) {
$managers[] = $value['user_name'];
} elseif ($value['level'] == 1) {
$heads[] = $value['user_name'];
}
}
$data['account_managers'] = $account_managers;
$data['managers'] = $managers;
$data['heads'] = $heads;
// dd($data);
//$this->loadLayout('client_info', $data);
$html = view('client_info', $data);
return $this->respond(['status' => true,'code' => 200, 'data' => $html], 200);
}
public function transformArray($data, $mapping) {
// dd($data);
$transformedData = [];
if (!is_array($data)) {
return json_encode($transformedData, JSON_PRETTY_PRINT);
}
foreach ($data as $key => $value) {
if ($key == 'family_floaters') {
$transformedData[$key] = $this->transformFamilyFloaters($value, $data);
}else if (array_key_exists($key, $mapping)) {
$transformedData[$mapping[$key]] = $value;
}else if($key == 'special_condition_label'){
foreach ($value as $key => $value) {
$transformedData[$value] = $data['special_condition_input'][$key];
}
}else if($key == 'gpa_special_condition_label'){
foreach ($value as $key => $value) {
$transformedData[$value] = $data['gpa_special_condition_input'][$key];
}
}else if($key == 'age_ratio'){
if(isset($data['sumInsured2'])){
$transformedData['Self'] = "(Min: " . $data['age_ratio']['self']['min'] . ", Max: " . $data['age_ratio']['self']['max'] . ")";
}
}else {
$transformedData[$key] = $value;
}
}
return json_encode($transformedData, JSON_PRETTY_PRINT);
}
public function transformFamilyFloaters($familyFloaters, $json) {
$result = [];
$min = $json['age_ratio']['self'];
$max = $json['age_ratio']['self'];
$spouse_min = $json['age_ratio']['spouse'];
$spouse_max = $json['age_ratio']['spouse'];
$child_min = $json['age_ratio']['child'];
$child_max = $json['age_ratio']['child'];
$elders_min = $json['age_ratio']['elders'];
$elders_max = $json['age_ratio']['elders'];
foreach ($familyFloaters as $key => $value) {
if ($value !== 0) {
switch ($key) {
case 'self':
$result[] = "Self (Min: {$min['min']}, Max: {$max['max']})";
break;
case 'spouse':
$result[] = "Spouse (Min: {$spouse_min['min']}, Max: {$spouse_max['max']})";
break;
case 'childrens':
$result[] = "Children(s) - $value (Min: {$child_min['min']}, Max: {$child_max['max']})";
break;
case 'parents':
$result[] = "Parent(s) - $value (Min: {$elders_min['min']}, Max: {$elders_max['max']})";
break;
case 'parents-in-law':
$result[] = "Parents-in-Law - $value (Min: {$elders_min['min']}, Max: {$elders_max['max']})";
break;
case 'either-parents-pil':
$result[] = "Either Parents Nor Parents-in-Law - $value (elders_min: {$elders_min['min']}, Max: {$elders_max['max']})";
break;
}
}
}
return implode(", ", $result);
}
}

View File

@ -41,7 +41,8 @@ class ClientPolicyModel extends Model
"Is_active",
"date_of_exit",
"reason_for_exit",
"policy_no"
"policy_no",
"client_branch_id"
];
public function getClientPolicyById($id){

View File

@ -42,7 +42,7 @@ table.dataTable tbody td {
<div class="card-body">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">User List</h4>
<h4 style="position: relative;">User List</h4>
</div>
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
<button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-target="#con-close-modal" data-placement="top" title="Add" data-trigger="hover">ADD</button>

View File

@ -8,12 +8,12 @@
}
</style>
<div class="col-12">
<div class="col-12" id="second_page">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Batch List</h4>
<h4 style="position: relative;">Batch List</h4>
</div>
</div>
@ -54,7 +54,7 @@
<td><?php echo $file['event_type'] ?></td>
<td><?php echo $file['insurer_or_tpa'] ?></td>
<td><?php echo $file['actions'] ?></td>
<td><?php echo $file['count'] ?></td>
<td><?php echo $file['count'] == null ? '-' : $file['count'] ?></td>
<td class="indian-number"><?php echo intval($file['amount']) ?></td>
<td class="reload" data-toggle="tooltip" data-placement="top" title="<?php echo date('d-M-Y H:i:a', strtotime($file['created_at'])) ?> by <?php echo get_username($file['created_by']) ?>">
@ -104,7 +104,8 @@
</div>
</div>
</div><!-- end col -->
</div>
</div>
<script>
$(document).ready(function() {

331
app/Views/client_info.php Normal file
View File

@ -0,0 +1,331 @@
<div id="client_info">
<div class="row">
<div class="col-12">
<div id="accordion" class="mb-3">
<div class="card">
<div class="row" style="padding-top: 20px;margin-bottom: 18px;">
<div class="col-6">
<h4 style="position: relative;left: 18px;top: 2px;">Client Basic Info</h4>
</div>
<div class="col-6">
<div class="row">
<div class="col-6" style="position: relative;left: 455px;">
<button id="close_btn" class="btn btn-primary waves-effect waves-light client_info_close">Close</button>
</div>
<div class="col-1 float-right" style="position: relative;left: 255px;">
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse"
href="#collapseOne" aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary"
style="font-size: 28px;"></i>
</a>
</div>
</div>
</div>
</div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body" style="position: relative;bottom: 25px;">
<div class="row" >
<div class="col-6">
<table>
<tr>
<td style="font-size: 18px;"> <strong> <?= $client['client_name'] ?> (
<?= $client['short_name'] ?> ) </strong></td>
</tr>
</table>
</div>
<div class="col-6">
<table>
<tr>
<td style="font-size: 18px;"> <strong> Relationship Manager </strong></td>
</tr>
</table>
</div>
</div>
<br>
<div class="row">
<div class="col-6">
<table>
<tr>
<td style="padding: 3px;"><label>Address :</label>
<?= $client['address1'] ?> <br> <?= $client['address2'] ?></td>
</tr>
<tr>
<td style="padding: 3px;"><?= $client['city'] ?>, <?= $client['state'] ?> -
<?= $client['pincode'] ?></td>
</tr>
</table>
</div>
<div class="col-6">
<table>
<tr>
<td style="padding: 3px;"><label> Account Manager :
</label> <?= implode(', ', $account_managers) ?></td>
</tr>
<tr>
<td style="padding: 3px;"><label> Manager :
</label> <?= implode(', ', $managers) ?></td>
</tr>
<tr>
<td style="padding: 3px;"><label> Head : </label>
<?= implode(', ', $heads) ?>
</td>
</tr>
</table>
</div>
</div>
<!-- end row-->
</div>
</div>
</div>
</div>
</div>
<div class="col-12">
<div id="accordion" class="mb-3">
<div class="card">
<div class="row" style="padding-top: 20px;margin-bottom: 18px;">
<div class="col-6">
<h4 style="position: relative;left: 18px;top: 2px;">Client Policies</h4>
</div>
<div class="col-6">
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseTwo"
aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary"
style="font-size: 28px;"></i>
</a>
</div>
</div>
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body" style="position: relative;bottom: 25px;">
<div class="row">
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100"
cellspacing="0">
<thead class="bg-light">
<tr>
<th class="font-weight-medium"><label> Branch Name </label></th>
<th class="font-weight-medium"><label> Policy Name </label></th>
<th class="font-weight-medium"><label> Insurer </label></th>
<th class="font-weight-medium"><label> TPA </label></th>
<th class="font-weight-medium"><label> Policy Validity </label></th>
<th class="font-weight-medium"><label> Enrollment Status </label></th>
<th class="font-weight-medium"><label> Policy Status </label></th>
</tr>
</thead>
<tbody>
<?php foreach ($client_policy as $key => $value) { ?>
<tr class="policy_terms"
data-id="<?= htmlspecialchars($value['policy_terms']) ?>"
data-toggle="modal" data-target="#bs-example-modal-lg">
<td><?= $value['branch_name'] ?></td>
<td><?= $value['policy_name'] ?> ( <?= $value['policy_type'] ?> )</td>
<td><?= $value['insurer_short_name'] ?></td>
<td><?= $value['tpa_short_name'] ?></td>
<td><?= $value['policy_start_date'] ?> / <?= $value['policy_end_date'] ?>
</td>
<td>
<?php if($value['open_for_enrollment'] == 'Open' ) { ?>
<span
class="badge badge-success"><?= $value['open_for_enrollment'] ?></span>
<?php } else if($value['open_for_enrollment'] == 'Closed') { ?>
<span
class="badge badge-warning"><?= $value['open_for_enrollment'] ?></span>
<?php } else { ?>
<span
class="badge badge-secondary"><?= $value['open_for_enrollment'] ?></span>
<?php } ?>
</td>
<td>
<?php if($value['policy_status'] == 'Active' ) { ?>
<span class="badge badge-success"><?= $value['policy_status'] ?></span>
<?php } else { ?>
<span class="badge badge-danger"><?= $value['policy_status'] ?></span>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<!-- end row -->
</div>
</div>
</div>
</div>
</div>
<div class="col-12">
<div id="accordion" class="mb-3">
<div class="card">
<div class="row" style="padding-top: 20px;margin-bottom: 18px;">
<div class="col-6">
<h4 style="position: relative;left: 18px;top: 2px;">Client Contacts</h4>
</div>
<div class="col-6">
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse"
href="#collapseThree" aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary"
style="font-size: 28px;"></i>
</a>
</div>
</div>
<div id="collapseThree" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body" style="position: relative;bottom: 25px;">
<div class="row">
<table id="tb1" class="table table-hover m-0 table-centered dt-responsive nowrap w-100"
cellspacing="0">
<thead class="bg-light">
<tr>
<th class="font-weight-medium"><label> HR Name </label></th>
<th class="font-weight-medium"><label> Mobile </label></th>
<th class="font-weight-medium"><label> Email </label></th>
<th class="font-weight-medium"><label> Branch Name </label></th>
</tr>
</thead>
<tbody>
<?php foreach ($client_branch as $key => $value) { ?>
<tr>
<td><?= $value['hr_name'] ?> ( <?= $value['designation'] ?> )</td>
<td><?= $value['mobile'] ?></td>
<td><?= $value['email'] ?></td>
<td><?= $value['branch_name'] ?> ( <?= $value['branch_code'] ?> )</td>
</tr>
<?php } ?>
</tbody>
</table>
</div> <!-- end row-->
</div>
</div>
</div>
</div>
<!-- end row -->
</div>
</div>
</div>
<!-- Modal content for the Large example -->
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static" style="padding-right: 15px">
<div class="modal-dialog modal-full-width">
<div class="modal-content">
<div class="modal-header" style="background: #02a8b5;">
<h4 class="modal-title" id="myLargeModalLabel">Policy Terms <span id="nameOfThePolicy"></span>
</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body" id="modal_body" >
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
$(document).ready(function() {
// $('#tb1').DataTable({
// paging: true,
// });
})
$(document).on('click', '.policy_terms', function() {
var terms = $(this).data('id');
console.log(terms);
// terms = JSON.parse(terms);
$('#modal_body').empty();
function createListItems(obj) {
const fragment = document.createDocumentFragment();
for (const key in obj) {
if (obj.hasOwnProperty(key) && obj[key] !== null && obj[key] !== '' && key !=
'family_floater' && key != 'gpa_special_condition_input' && key !=
'gpa_special_condition_label' && key != 'special_condition_label' && key !=
'special_condition_input' && key != 'age_ratio') {
const listItem = document.createElement('li');
var formattedKey = '';
formattedKey = key.replace(/_/g, ' ');
obj[key] = obj[key].replace(/<\/?[^>]+>/gi, '');
if (obj[key] == 0) {
obj[key] = 'No';
}
if (obj[key] == 1) {
obj[key] = 'Yes';
}
console.log(formattedKey)
if (key == 'burnExpenses' && obj[key] == 'Yes') {
listItem.innerHTML =
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong> ${obj['burnExpensesData']}`;
} else if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) {
listItem.innerHTML =
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong>`;
const nestedList = document.createElement('ul');
nestedList.appendChild(createListItems(obj[key]));
listItem.appendChild(nestedList);
} else {
listItem.innerHTML =
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong> ${Array.isArray(obj[key]) ? JSON.stringify(obj[key]) : obj[key]}`;
}
fragment.appendChild(listItem);
}
}
return fragment;
}
$('#modal_body').append(createListItems(terms));
});
</script>

View File

@ -7,6 +7,15 @@
table.dataTable tbody td {
padding: 4px 4px !important;
}
table.dataTable thead th {
padding: 4px 4px !important;
}
.col-12{
max-width: 98% !important;
}
</style>
<div class="row" id="client_list">
@ -15,9 +24,9 @@ table.dataTable tbody td {
<div class="card-body">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Client List</h4>
<h4 style="position: relative;">Client List</h4>
</div>
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
<div class="col-6" style="text-align: right; position: relative;top: 56px;">
<a href="<?= base_url("client/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
</div>
</div>
@ -33,8 +42,8 @@ table.dataTable tbody td {
<tbody>
<?php foreach($clientList as $row){ ?>
<tr>
<td><?php echo $row->client_name; ?> ( <?php echo $row->short_name; ?> ) </td>
<tr >
<td class="client_info" data-id="<?php echo $row->id; ?>"><?php echo $row->client_name; ?> ( <?php echo $row->short_name; ?> ) </td>
<td>
<?php $account_managers = ''; ?>
<?php foreach ($client_rm as $client): ?>
@ -66,10 +75,10 @@ table.dataTable tbody td {
</div>
<!-- end row -->
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> -->
<!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> -->
<!-- Include DataTables JS -->
<!-- <script src="https://cdn.datatables.net/1.11.6/js/jquery.dataTables.min.js"></script> -->
<div id="append_client_info"></div>
<script>
@ -96,7 +105,8 @@ table.dataTable tbody td {
// pagingType: 'full_numbers'
});
})
})
@ -136,4 +146,57 @@ table.dataTable tbody td {
}
$(document).on('click', '.client_info', function() {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var client_id = $(this).data('id')
$('#append_client_info').empty();
console.log(client_id);
console.log('client_info');
$('#client_info').show();
$('#client_list').hide();
$.ajax({
url: "<?= base_url('util/get-client-details/') ?>" + client_id,
type: "GET",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
console.log(res);
console.log(res.data.length);
$('#append_client_info').append(res.data);
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}
});
});
$(document).on('click', '.client_info_close', function() {
console.log('client_info_close');
$('#client_info').hide();
$('#client_list').show();
});
</script>

View File

@ -41,7 +41,7 @@ body {
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Client Onboarding <?php if(isset($client)) {echo ' - ' . $client['client_name']; } ?></h4>
<h4 style="position: relative;">Client Onboarding <?php if(isset($client)) {echo ' - ' . $client['client_name']; } ?></h4>
</div>
<div class="col-6" style="text-align: right;">
<a href="<?= base_url("client/list"); ?>"><i class="fas fa-arrow-left" style="font-size: 17px;"></i></a>

View File

@ -2,7 +2,8 @@
<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">
@ -29,7 +30,9 @@
<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>
@ -39,10 +42,21 @@
<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>
<select class="form-control" id="client_branch" name="client_branch_id">
<option value="" selected>Select Client Branch</option>
</select>
</div>
<div class="form-group col-md-4">
<label for="email"> Policy Type<span class="text-danger">*</span></label>
<select class="form-control" id="policy_type" name="is_addon" required>
@ -54,7 +68,8 @@
</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>
@ -94,19 +109,24 @@
<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>
@ -117,7 +137,8 @@
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="inception_type" style="position: relative;bottom: 5px;left: 10px;">Enable Employee Enrolment Process</label>
<label for="inception_type" style="position: relative;bottom: 5px;left: 10px;">Enable
Employee Enrolment Process</label>
</div>
<div id="policy_fields"></div>
@ -125,8 +146,10 @@
</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>
@ -140,18 +163,19 @@
<?php include('policy_gpa_terms.php'); ?>
<script>
var policy_PrimaryKey = $('#client_id_policy').val();
var policy_client = $('#policy_PrimaryKey').val();
var policy_PrimaryKey = $('#client_id_policy').val();
var policy_client = $('#policy_PrimaryKey').val();
$(document).ready(function() {
$(document).ready(function() {
// Initialize select2
$("#insurer").select2();
$("#policy").select2();
$("#tpa").select2();
$("#base_policy").select2();
});
$("#client_branch").select2();
});
$(document).ready(function() {
$(document).ready(function() {
$('#policy_status_field').hide()
@ -183,59 +207,10 @@
allowInput: false
});
$('#add_form').hide();
$('.btnBack').hide();
$('.btnAdd').click(function() {
fetchClientPolicyList()
$('#policy_form')[0].reset();
$('#add_form').show();
$('#table_list').hide();
$('.btnBack').show();
$('.btnAdd').hide();
$('#insurer').val('').change();
$('#tpa').val('').change();
$('#policy_no').val('').change();
$('#start_date').val('').change();
$('#end_date').val('').change();
$('#policy').html('<option value="" selected>Select Policy</option>').change();
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
$('#policy_status_field').hide()
$('#base_policy_id').hide();
$('#first').hide();
$('#second').hide();
$('#third').hide();
$('#base_policy_id').hide();
$('#base_policy').prop('required', false);
})
$('.btnBack').click(function() {
$('#policy_form')[0].reset();
$('#add_form').hide();
$('#table_list').show();
$('.btnBack').hide();
$('.btnAdd').show();
$('#insurer').val('').change();
$('#tpa').val('').change();
$('#policy_no').val('').change();
$('#start_date').val('').change();
$('#end_date').val('').change();
$('#policy').html('<option value="" selected>Select Policy</option>');
$('#base_policy_id').hide();
})
if (policy_PrimaryKey !== '') {
var policyTable = '';
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
@ -264,12 +239,15 @@
if (item.open_for_enrollment == 1) {
enrollmentStatus = '<a href="#" data-id="' + item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll" data-toggle="tooltip" data-placement="left" title="Click To Close Enrollment">Open</a>'
enrollmentStatus = '<a href="#" data-id="' + item.id + '" id="' + item.policy_id +
'" class="btnOpenEnroll" data-toggle="tooltip" data-placement="left" title="Click To Close Enrollment">Open</a>'
} else if (item.open_for_enrollment == 0) {
enrollmentStatus = '<a href="#" data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" data-id="' + item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
enrollmentStatus =
'<a href="#" data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" data-id="' +
item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
}
@ -315,8 +293,57 @@
});
/******** for form submit using AJAX *******/
$("#policy_form").submit(function(event) {
$('.btnAdd').click(function() {
// fetchClientPolicyList()
fetchClientBranch()
$('#policy_form')[0].reset();
$('#add_form').show();
$('#table_list').hide();
$('.btnBack').show();
$('.btnAdd').hide();
$('#insurer').val('').change();
$('#tpa').val('').change();
$('#policy_no').val('').change();
$('#start_date').val('').change();
$('#end_date').val('').change();
$('#policy').html('<option value="" selected>Select Policy</option>').change();
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
$('#policy_status_field').hide()
$('#base_policy_id').hide();
$('#first').hide();
$('#second').hide();
$('#third').hide();
$('#base_policy_id').hide();
$('#base_policy').prop('required', false);
})
$('.btnBack').click(function() {
$('#policy_form')[0].reset();
$('#add_form').hide();
$('#table_list').show();
$('.btnBack').hide();
$('.btnAdd').show();
$('#insurer').val('').change();
$('#tpa').val('').change();
$('#policy_no').val('').change();
$('#start_date').val('').change();
$('#end_date').val('').change();
$('#policy').html('<option value="" selected>Select Policy</option>');
$('#base_policy_id').hide();
$('#client_branch').val('').change();
})
/******** for form submit using AJAX *******/
$("#policy_form").submit(function(event) {
event.preventDefault();
@ -381,6 +408,11 @@
return;
}
if(res.staus === 'policy_exist'){
toastr.error('Policy already exist in the branch', 'Error');
}
if (res) {
setTimeout(function() {
@ -425,12 +457,18 @@
if (item.open_for_enrollment == 1) {
enrollmentStatus = '<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrollment" href="#" data-id="' + item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Open</a>'
enrollmentStatus =
'<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrollment" href="#" data-id="' +
item.id + '" id="' + item.policy_id +
'" class="btnOpenEnroll">Open</a>'
} else if (item.open_for_enrollment == 0) {
enrollmentStatus = '<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" href="#" data-id="' + item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
enrollmentStatus =
'<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" href="#" data-id="' +
item.id + '" id="' + item.policy_id +
'" class="btnOpenEnroll">Closed</a>'
}
@ -489,9 +527,9 @@
}
});
});
});
$(document).ready(function() {
$(document).ready(function() {
/********* To get th POLICY base on Insurer *******/
$('#insurer').change(function() {
var id = $(this).val();
@ -518,18 +556,22 @@
if (item.policy_type_id == 5) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
OptionsHTML += '<option data-id="' + item.policy_type_id +
'" value="' +
item.id +
'">' + item.name + '( ' + item.policy_type + ' )</option>';
'">' + item.name + '( ' + item.policy_type +
' )</option>';
}
} else {
if (item.policy_type_id == 5 || item.policy_type_id == 3) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
OptionsHTML += '<option data-id="' + item.policy_type_id +
'" value="' +
item.id +
'">' + item.name + '( ' + item.policy_type + ' )</option>';
'">' + item.name + '( ' + item.policy_type +
' )</option>';
}
}
@ -537,21 +579,25 @@
} else if ($policy_type_value == 2) {
if (item.policy_type_id == 4 || item.policy_type_id == 5) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
OptionsHTML += '<option data-id="' + item.policy_type_id +
'" value="' +
item.id +
'">' + item.name + '( ' + item.policy_type + ' )</option>';
}
} else if ($policy_type_value == 1) {
if (item.policy_type_id == 1 || item.policy_type_id == 2 || item.policy_type_id == 3) {
if (item.policy_type_id == 1 || item.policy_type_id == 2 || item
.policy_type_id == 3) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
OptionsHTML += '<option data-id="' + item.policy_type_id +
'" value="' +
item.id +
'">' + item.name + '( ' + item.policy_type + ' )</option>';
}
} else {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
OptionsHTML += '<option data-id="' + item.policy_type_id +
'" value="' +
item.id +
'">' + item.name + '( ' + item.policy_type + ' )</option>';
}
@ -563,9 +609,9 @@
console.error(status, error);
});
});
});
});
$(document).ready(function() {
$(document).ready(function() {
/********* set the Policy_Type_id for Form Submit *******/
$('#policy').change(function() {
@ -641,16 +687,19 @@
}
});
});
});
// get the client policy data for edit
$('body').on('click', '.btnPolicyEdit', function() {
// get the client policy data for edit
$('body').on('click', '.btnPolicyEdit', function() {
var policy_form_action = '';
var policy_id = $(this).attr('data-id');
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
fetchClientBranch()
$.ajax({
url: '<?= base_url("client/policy/list/") ?>' + policy_id,
type: "GET",
@ -687,6 +736,7 @@
// $('#policy').val(res.data.policy_id).change();
$('#policy_type').val(res.data.is_addon).change();
$('#base_policy').val(res.data.base_policy);
$('#client_branch').val(res.data.client_branch_id).change();
$('#policy_type_id').val(res.data.policy_type_id);
$('#policy_PrimaryKey').val(res.data.id);
@ -787,9 +837,16 @@
var OptionsHTML = '';
OptionsHTML += '<option value="" selected>Select Base Policy</option>';
$.each(res.client_policy_list, function(index, item) {
if(item.client_branch_id == res.data.client_branch_id){
OptionsHTML += '<option data-id="' + item.policy_type_id +
'" value="' + item.id + '" ' + (res.data.base_policy === item.id ?
'selected="selected"' : '') + '>' + item.name + '( ' + item.policy_type + ' )</option>';
'selected="selected"' : '') + '>' + item.name + '( ' + item
.policy_type + ' )</option>';
}
});
$('#base_policy').html(OptionsHTML);
@ -811,9 +868,9 @@
}, 1000);
}
});
});
});
$('body').on('click', '.btnOpenEnroll', function() {
$('body').on('click', '.btnOpenEnroll', function() {
Swal.fire({
title: "Are you sure?",
@ -860,7 +917,12 @@
$('.btnOpenEnroll').each(function(index, element) {
if ($(element).data('id') == client_policy_id) {
$(element).html('<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrollment" href="#" data-id="' + res.client_policy_data.id + '" id="' + res.client_policy_data.policy_id + '" class="btnOpenEnroll">Open</a>');
$(element).html(
'<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrollment" href="#" data-id="' +
res.client_policy_data.id +
'" id="' + res.client_policy_data
.policy_id +
'" class="btnOpenEnroll">Open</a>');
}
});
@ -868,7 +930,13 @@
$('.btnOpenEnroll').each(function(index, element) {
if ($(element).data('id') == client_policy_id) {
$(element).html('<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" href="#" data-id="' + res.client_policy_data.id + '" id="' + res.client_policy_data.policy_id + '" class="btnOpenEnroll">Closed</a>');
$(element).html(
'<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" href="#" data-id="' +
res.client_policy_data.id +
'" id="' + res.client_policy_data
.policy_id +
'" class="btnOpenEnroll">Closed</a>'
);
}
});
}
@ -906,10 +974,10 @@
});
});
});
function appendPolicyFormFields(policy_type, data = false) {
function appendPolicyFormFields(policy_type, data = false) {
var html = '';
var container = document.getElementById('policy_fields');
@ -1047,11 +1115,11 @@
})
}
}
//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy'
function rearrangeDateFormat(inputDate) {
//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy'
function rearrangeDateFormat(inputDate) {
if (inputDate !== null) {
var dateComponents = inputDate.split("-");
@ -1060,9 +1128,9 @@
} else {
return '00-00-0000';
}
}
}
function checkDateStatus(inputDate, bg = false) {
function checkDateStatus(inputDate, bg = false) {
var givenDate = new Date(inputDate);
var currentDate = new Date();
@ -1081,9 +1149,9 @@
}
}
}
}
const numberWords = {
const numberWords = {
0: "Zero",
1: "One",
2: "Two",
@ -1112,9 +1180,9 @@
70: "Seventy",
80: "Eighty",
90: "Ninety"
};
};
function convertNumberToWords(number) {
function convertNumberToWords(number) {
if (number === 0) {
return numberWords[number];
}
@ -1152,9 +1220,9 @@
}
}
return word.trim();
}
}
function convertCommaNumberToWords(input) {
function convertCommaNumberToWords(input) {
let number;
if (input instanceof HTMLElement) {
const inputValue = input.value;
@ -1170,17 +1238,17 @@
var convert_word_value = convertNumberToWords(number);
return convert_word_value;
}
}
function onlyNumbers(event) {
function onlyNumbers(event) {
var charcode;
charcode = event.which || event.keyCode;
if (charcode >= 48 && charcode <= 57) return true;
return false;
}
}
function formatNumber(input, maxLength) {
function formatNumber(input, maxLength) {
// console.log("input", input);
maxLength = 16;
@ -1252,15 +1320,15 @@
return;
// }
}
}
function removeClientPolicy(element) {
function removeClientPolicy(element) {
console.log(element);
}
}
$('#policy_type').change(function() {
$('#policy_type').change(function() {
$('#insurer').val('').change();
$('#tpa').val('').change();
@ -1339,12 +1407,15 @@
$('#base_policy_id').hide();
$('#base_policy').prop('required', false);
}
})
})
function fetchClientPolicyList() {
function fetchClientPolicyList() {
var client_id = $('#client_id_policy').val()
var client_branch_id = $('#client_branch').val()
console.log('client_branch_id', client_branch_id)
$.ajax({
url: '<?= base_url("util/featch-client-policy-list/") ?>' + client_id,
@ -1354,34 +1425,39 @@
console.log('one', res)
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
if (res.status === false) {
toastr.error(res.status);
return;
}
var OptionsHTML = '';
OptionsHTML += '<option value="" selected>Select Base Policy</option>';
$.each(res.data, function(index, item) {
if ($('#policy_type').val() == 1) {
console.log('item.client_branch_id', item.client_branch_id)
console.log('if')
if(item.client_branch_id == client_branch_id){
if ($('#policy_type').val() == 1) {
if (item.policy_type_id == 1 || item.policy_type_id == 2) {
console.log('if 2')
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id +
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id +
'">' + item.name + '( ' + item.policy_type + ' )</option>';
}
} else {
console.log('if')
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id +
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item
.id +
'">' + item.name + '( ' + item.policy_type + ' )</option>';
}
}
});
$('#base_policy').html(OptionsHTML);
},
@ -1396,10 +1472,10 @@
}
});
}
}
var dataId = 0;
$(document).ready(function() {
var dataId = 0;
$(document).ready(function() {
$('#base_policy').change(function() {
@ -1442,10 +1518,12 @@
$('.loader-mask').delay(350).fadeOut('slow');
}, 500);
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id).change();
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id)
.change();
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id).change();
$('#policy_no').val(res.data.policy_no).change();
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date)).change();
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date))
.change();
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date)).change();
var policeOptionHTML = '';
@ -1455,8 +1533,10 @@
console.log(item);
policeOptionHTML += '<option data-id="' + item.policy_type_id +
'" value="' + item.id + '" ' + (res.data.policy_id === item.id ?
'selected="selected"' : '') + '>' + item.name + '</option>';
'" value="' + item.id + '" ' + (res.data.policy_id === item
.id ?
'selected="selected"' : '') + '>' + item.name +
'</option>';
});
@ -1474,7 +1554,9 @@
$option.prop('selected', true).change();
} else {
console.log('step 4');
toastr.warning('The insurer does not have a GMC-Parents policy.', 'Warning');
toastr.warning(
'The insurer does not have a GMC-Parents policy.',
'Warning');
}
}, 1500);
}
@ -1492,9 +1574,80 @@
});
});
})
})
function objectToQueryString(obj) {
function objectToQueryString(obj) {
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
}
function fetchClientBranch() {
console.log('function called');
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var client_id = 0;
if ($('#client_id_policy').val() != "") {
client_id = $('#client_id_policy').val();
} else if ($('#policy_PrimaryKey').val() != "") {
client_id = $('#policy_PrimaryKey').val();
}
$.ajax({
url: "<?= base_url('util/get-client-branch/') ?>" + client_id,
type: "GET",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
console.log(res);
console.log(res.data.length);
if(res.data.length == 0){
toastr.warning('The client does not have any branches.', 'warning');
return ;
}
appendClientBranch(res.data)
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}
});
}
function appendClientBranch(data){
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.branch_name
});
$('#client_branch').append(option);
});
}
$(document).ready(function(){
$("#client_branch").on('change', function() {
console.log('fetchClientPolicyList change')
fetchClientPolicyList();
});
})
</script>

View File

@ -28,7 +28,7 @@
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Employees</h4>
<h4 style="position: relative;">Employees</h4>
</div>
</div>

View File

@ -80,7 +80,7 @@ table.dataTable tbody td {
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Endorsement List</h4>
<h4 style="position: relative;">Endorsement List</h4>
</div>
</div>

View File

@ -14,7 +14,7 @@
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Files</h4>
<h4 style="position: relative;">Files</h4>
</div>
</div>

View File

@ -4,7 +4,7 @@
<div class="card-body">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Insurer List</h4>
<h4 style="position: relative;">Insurer List</h4>
</div>
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
<a href="<?= base_url("master/insurer/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>

View File

@ -36,7 +36,7 @@ body {
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Insurer</h4>
<h4 style="position: relative;">Insurer</h4>
</div>
<div class="col-6" style="text-align: right;">
<a href="<?= base_url("master/insurer/list"); ?>" >

View File

@ -4,7 +4,7 @@
<div class="card-body">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">KYC List</h4>
<h4 style="position: relative;">KYC List</h4>
</div>
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
<a href="<?= base_url("master/kyc/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>

View File

@ -36,7 +36,7 @@ body {
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">KYC Entity Type</h4>
<h4 style="position: relative;">KYC Entity Type</h4>
</div>
<div class="col-6" style="text-align: right;">
<a href="<?= base_url("master/kyc/list"); ?>" ><i class="fas fa-arrow-left" style="font-size: 17px;"></i> </a>

View File

@ -295,7 +295,7 @@
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').fadeOut('slow');
}, 2000);
}, 1000);
});
</script>

View File

@ -4,7 +4,7 @@
<div class="card-body">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Policy Type List</h4>
<h4 style="position: relative;">Policy Type List</h4>
</div>
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
<a href="<?= base_url("master/policy/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>

View File

@ -36,7 +36,7 @@ body {
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Policy Type</h4>
<h4 style="position: relative;">Policy Type</h4>
</div>
<div class="col-6" style="text-align: right;">
<a href="<?= base_url("master/policy/list"); ?>"><i class="fas fa-arrow-left" style="font-size: 17px;"></i> </a>

View File

@ -4,7 +4,7 @@
<div class="card-body">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">TPA List</h4>
<h4 style="position: relative;">TPA List</h4>
</div>
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
<a href="<?= base_url("master/tpa/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>

View File

@ -36,7 +36,7 @@ body {
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">TPA</h4>
<h4 style="position: relative;">TPA</h4>
</div>
<div class="col-6" style="text-align: right;">
<a href="<?= base_url("master/tpa/list"); ?>"><i class="fas fa-arrow-left" style="font-size: 17px;"></i> </a>