nhance/app/Views/client_info.php
2026-04-22 11:44:38 +05:30

359 lines
17 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<style>
#relationship_manager {
border-collapse: separate; /* important */
border-spacing: 20px 0; /* 20px horizontal, 0 vertical */
}
#client_info_modal .modal-body{
padding:20px 0px 10px 40px !important;
}
</style>
<script>
var pageHideMainNavTitle = true;
var pageTitle = 'Client Details - <?= $client['client_name'] ?> ( <?= $client['short_name'] ?> ) ';
var pageBackButton = '<a href="<?= base_url("client/list"); ?>" class="topbar-icon-btn" data-toggle="tooltip" data-placement="top" title="Back to Client List" aria-label="Back to Client List"><i class="ri-arrow-left-s-line"></i></a>';
if (typeof window.applyTopNavbarTitle === 'function') {
window.applyTopNavbarTitle();
}
</script>
<div class="row" id="client_info">
<div class="col-12">
<div class="card">
<div class="card-body">
<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;">
<!--
<span class="client_info_close fs-6" id="close_btn">
<i class="mdi mdi-chevron-left" style="font-size: 28px;cursor:pointer;"></i>
</span>
-->
<span>
<!--
Client Basic Info -
<strong> <?= $client['client_name'] ?> ( <?= $client['short_name'] ?> ) </strong>
-->
Client Basic Information
</span>
</h4>
</div>
<div class="col-6">
<div class="row">
<div class="col-6" style="position: relative;left: 455px;">
</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;">
<h2>Relationship Manager</h2>
<br>
<div class="row">
<table id="relationship_manager">
<thead>
<tr style="color:black;">
<th>Account Manager</th>
<th>Manager</th>
<th>Head</th>
</tr>
</thead>
<tbody>
<tr style="color:black;">
<td><?= implode(', ', $account_managers) ?></td>
<td><?= implode(', ', $managers) ?></td>
<td><?= implode(', ', $heads) ?></td>
</tr>
</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 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 data-custom-table-css="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> Enrolment 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="#client_info_modal">
<td><?= $value['branch_name'] ?></td>
<td><?= $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="px-2 py-1"
style="background-color: #F9F8CD; color: #000 !important; border-radius:10px !important; "
><?= $value['open_for_enrollment'] ?></span>
<?php } else if($value['open_for_enrollment'] == 'Closed') { ?>
<span
class="px-2 py-1"
style="background-color: #C2C2C2; color: #000 !important; border-radius:10px !important;"><?= $value['open_for_enrollment'] ?></span>
<?php } else { ?>
<span
style="background-color: #E26728; color: #000 !important; border-radius:10px !important;"
class="px-2 py-1"><?= $value['open_for_enrollment'] ?></span>
<?php } ?>
</td>
<td>
<?php if($value['policy_status'] == 'Active' ) { ?>
<span
style="background-color: #D1F8E7; color: #000 !important; border-radius:10px !important;"
class="px-2 py-1"><?= $value['policy_status'] ?></span>
<?php } else { ?>
<span
style="background-color: #BD0707; color: #000 !important; border-radius:10px !important;"
class="px-2 py-1 "><?= $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 data-custom-table-css="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>
</div>
</div>
<!-- Modal content for the Large example -->
<div class="modal fade" id="client_info_modal" 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);
console.log(terms.length);
console.log(JSON.stringify(terms));
// terms = JSON.parse(terms);
$('#modal_body').empty();
function createListItems(obj) {
if (obj.length == 0) {
const message = document.createElement('div');
message.textContent = 'Policy Terms Not Available';
message.style.display = 'flex';
message.style.justifyContent = 'center';
message.style.alignItems = 'center';
message.style.height = '100%'; // Adjust as necessary to fit the context
message.style.textAlign = 'center';
return message;
}
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' &&
key !== 'multiple_sum_insured' &&
key !== 'other_special_condition_label' &&
key !== 'other_special_condition_input'
) {
const listItem = document.createElement('li');
let formattedKey = key.replace(/_/g, ' ');
console.log('type', typeof obj[key])
// Strip HTML tags from values
if (typeof obj[key] === 'string') {
console.log('before', obj[key])
obj[key] = obj[key].replace(/<\/?[^>]+>/gi, '');
console.log('after', obj[key])
}
// Convert 0 and 1 to 'No' and 'Yes'
if (obj[key] == 0) {
obj[key] = 'No';
}
if (obj[key] == 1) {
obj[key] = 'Yes';
}
// Handle nested objects
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>