nhance/app/Views/client_info.php
2024-09-13 09:00:09 +05:30

352 lines
16 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.

<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 - <strong> <?= $client['client_name'] ?> (
<?= $client['short_name'] ?> ) </strong></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;"></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;"></td>
</tr>
<tr>
<td style="padding: 3px;"></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> 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="#bs-example-modal-lg">
<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="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);
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>