CHANGE_UI_Issues - VADIVEL J 2025-09-24

This commit is contained in:
vadivelJ96 2025-09-24 10:08:30 +05:30
parent 81a58c5495
commit 5a707d9722
38 changed files with 4883 additions and 4911 deletions

View File

@ -1124,6 +1124,9 @@ class TicketController extends BaseController
// dd($data['ticket_data']); // dd($data['ticket_data']);
$data['ticket_type'] = $this->ticketType; $data['ticket_type'] = $this->ticketType;
$data['trigger_type'] = $this->triggerType; $data['trigger_type'] = $this->triggerType;
$data['page_name'] = "Claims";
return $this->loadLayout('ticket_mail_template', $data); return $this->loadLayout('ticket_mail_template', $data);
} }
@ -2190,6 +2193,8 @@ class TicketController extends BaseController
$data['viewer'] = !empty($empView) ? $empView : 0; $data['viewer'] = !empty($empView) ? $empView : 0;
// dd($data); // dd($data);
return view('ticket_feedback_form', $data); return view('ticket_feedback_form', $data);
}else{ }else{
@ -2220,7 +2225,7 @@ class TicketController extends BaseController
public function feedbackList(){ public function feedbackList(){
$data['feedback_data'] = $this->ticketMasterModel->select("ticket_master.*,clients.client_name")->join("clients","clients.id = ticket_master.client_id")->where("ticket_master.is_active",1)->where("ticket_master.feedback_json IS NOT NULL", null, false)->where("ticket_master.feedback_json !=", "")->findAll(); $data['feedback_data'] = $this->ticketMasterModel->select("ticket_master.*,clients.client_name")->join("clients","clients.id = ticket_master.client_id")->where("ticket_master.is_active",1)->where("ticket_master.feedback_json IS NOT NULL", null, false)->where("ticket_master.feedback_json !=", "")->findAll();
$data['page_name'] = "Claims";
// dd($data); // dd($data);
$this->loadLayout("ticket_feedback_list",$data); $this->loadLayout("ticket_feedback_list",$data);
} }

View File

@ -210,7 +210,7 @@
$(document).ready(function() { $(document).ready(function() {
$('#datatable-buttons').DataTable({ $('#datatable-buttons').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" + dom: "<'d-flex justify-content-between align-items-center'<'datatable-search'f><'datatable-buttons'B>>" +
"<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", "<'row'<'col-sm-5'i><'col-sm-7'p>>",
buttons: [{ buttons: [{

View File

@ -64,7 +64,7 @@
<div class="card-body"> <div class="card-body">
<div class="row" style="padding-bottom: 10px;"> <div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;"> <div class="col-6" style="align-self: center;">
<h2 style="position: relative;">Claim Dump Upload</h2> <h4 style="position: relative;">Claim Dump Upload</h4>
</div> </div>
</div> </div>

View File

@ -7,10 +7,6 @@
padding: 4px 4px !important; padding: 4px 4px !important;
} }
.col-12 {
max-width: 98% !important;
}
.dataTables_filter { .dataTables_filter {
position: absolute; position: absolute;
} }

View File

@ -7,9 +7,6 @@
padding: 4px 4px !important; padding: 4px 4px !important;
} }
.col-12 {
max-width: 98% !important;
}
.dataTables_filter { .dataTables_filter {
position: absolute; position: absolute;
@ -33,7 +30,8 @@
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th style="text-align: center;" colspan="8">OPEN</th> <th style="text-align: center;" colspan="8">OPEN</th>
<th style="text-align: center;" colspan="5" >CLEARED</th> &nbsp;
<th style="text-align: center;" colspan="7" >CLEARED</th>
</tr> </tr>
<tr> <tr>
<?php foreach ($column_order as $col_name): ?> <?php foreach ($column_order as $col_name): ?>

View File

@ -70,7 +70,7 @@
$(document).ready(function() { $(document).ready(function() {
$('#tickets-table').DataTable({ $('#tickets-table').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>", dom: "<'d-flex justify-content-between align-items-center'<'datatable-search'f><'datatable-buttons'B>>",
buttons: [{ buttons: [{
extend: 'csv', extend: 'csv',
text: 'CSV', text: 'CSV',

View File

@ -166,7 +166,8 @@ table.dataTable thead th {
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div> </div>
</div><!-- /.modal --> </div>
<!-- /.modal -->
<script> <script>
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
@ -296,9 +297,10 @@ table.dataTable thead th {
$(document).ready(function() $(document).ready(function()
{ {
$('#tickets-table').DataTable({ $('#tickets-table').DataTable({
dom: "<'row'<'col-sm-2'f><'col-sm-10 text-right'B>>" + dom: "<'d-flex justify-content-between align-items-center'<'datatable-search'f><'datatable-buttons'B>>" +
"<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", "<'row'<'col-sm-5'i><'col-sm-7'p>>",
buttons: [ buttons: [
{ {

View File

@ -47,10 +47,6 @@ body {
font-size: 14px; font-size: 14px;
} }
.container-fluid {
padding: 12px;
}
.user-card { .user-card {
background: white; background: white;
border-radius: 8px; border-radius: 8px;

View File

@ -11,12 +11,13 @@ option:disabled {
<div class="col-xl-12"> <div class="col-xl-12">
<div id="accordion1" class="mb-3"> <div id="accordion1" class="mb-3">
<div class="card mb-1"> <div class="card mb-1">
<h5 class="m-1"> <h4 class="m-1">
<span>Filters</span>
<a id="toggleIcon1" class="text-dark float-right" data-toggle="collapse" href="#collapseTwo" <a id="toggleIcon1" class="text-dark float-right" data-toggle="collapse" href="#collapseTwo"
aria-expanded="true"> aria-expanded="true">
<i id="icon1" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i> <i id="icon1" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a> </a>
</h5> </h4>
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion1"> <div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion1">
<div class="card-body"> <div class="card-body">
<!-- <div class="text-center"> --> <!-- <div class="text-center"> -->

View File

@ -14,7 +14,7 @@
} }
</style> </style>
<div class="container-fluid"> <div class="container-fluid-min">
<h2>Endorsement</h2> <h2>Endorsement</h2>
<div class="row"> <div class="row">
<div class="col-xl-12"> <div class="col-xl-12">
@ -590,7 +590,7 @@
$(document).ready(function() { $(document).ready(function() {
$('#tickets-table').DataTable({ $('#tickets-table').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" + dom: "<'d-flex justify-content-between align-items-center'<'datatable-search'f><'datatable-buttons'B>>" +
"<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", "<'row'<'col-sm-5'i><'col-sm-7'p>>",
buttons: [{ buttons: [{

View File

@ -98,7 +98,7 @@
</style> </style>
<div class="container-fluid"> <div class="container-fluid-min">
<h2>Enrollment</h2> <h2>Enrollment</h2>
<div class="row visa_status_count_view"> <div class="row visa_status_count_view">
<div class="col-12"> <div class="col-12">

View File

@ -461,7 +461,7 @@ $('body').on('click', '.reload', function() {
$(document).ready(function() { $(document).ready(function() {
$('#tickets-table').DataTable({ $('#tickets-table').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" + dom: "<'d-flex justify-content-between align-items-center'<'datatable-search'f><'datatable-buttons'B>>" +
"<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", "<'row'<'col-sm-5'i><'col-sm-7'p>>",
"buttons": [{ "buttons": [{

View File

@ -61,7 +61,7 @@
</style> </style>
<div class="container-fluid"> <div class="container-fluid-min">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">

View File

@ -10,11 +10,12 @@
<div class="col-xl-12"> <div class="col-xl-12">
<div id="accordion" class="mb-3"> <div id="accordion" class="mb-3">
<div class="card mb-1"> <div class="card mb-1">
<h5 class="m-1"> <h4 class="m-1">
<span>Filters</span>
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true"> <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> <i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a> </a>
</h5> </h4>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body"> <div class="card-body">
<!-- <div class="text-center"> --> <!-- <div class="text-center"> -->
@ -341,7 +342,7 @@
// for datatable // for datatable
$(document).ready(function() { $(document).ready(function() {
$('#hr_tickets_table').DataTable({ $('#hr_tickets_table').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" + dom: "<'d-flex justify-content-between align-items-center'<'datatable-search'f><'datatable-buttons'B>>" +
"<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", "<'row'<'col-sm-5'i><'col-sm-7'p>>",
"buttons": [{ "buttons": [{

View File

@ -58,8 +58,6 @@
<div class="col-12"> <div class="col-12">
<div class="card-body"> <div class="card-body">
<h3>Inception</h3>
<br>
<ul class="nav nav-pills navtab-bg"> <ul class="nav nav-pills navtab-bg">
<li class="nav-item d-flex justify-content-center align-items-center"> <li class="nav-item d-flex justify-content-center align-items-center">
<a href="#general-q-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-1 active-tab" id="general_tab"> <a href="#general-q-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-1 active-tab" id="general_tab">

View File

@ -1,6 +1,5 @@
<style> <style>
.custom-dropdown-menu {
.custom-dropdown-menu {
display: none; display: none;
position: absolute; position: absolute;
background-color: #ffffff !important; background-color: #ffffff !important;
@ -10,311 +9,312 @@
min-width: 10rem; min-width: 10rem;
z-index: 9999; z-index: 9999;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
} }
.custom-dropdown-menu .dropdown-item { .custom-dropdown-menu .dropdown-item {
display: block !important; display: block !important;
width: 100% !important; width: 100% !important;
padding: 0.5rem 1rem !important; padding: 0.5rem 1rem !important;
color: #212529 !important; color: #212529 !important;
text-decoration: none !important; text-decoration: none !important;
background-color: transparent !important; background-color: transparent !important;
} }
.custom-dropdown-menu .dropdown-item:hover { .custom-dropdown-menu .dropdown-item:hover {
background-color: #f8f9fa !important; background-color: #f8f9fa !important;
color: #16181b !important; color: #16181b !important;
cursor: pointer !important; cursor: pointer !important;
} }
.btn-color{ .btn-color {
background-color: rgba(52, 174, 178, 1); background-color: rgba(52, 174, 178, 1);
color: white; color: white;
border:1px solid rgba(52, 174, 178, 1); border: 1px solid rgba(52, 174, 178, 1);
} }
.btn-color:hover{ .btn-color:hover {
background-color: rgba(41, 139, 142, 1); background-color: rgba(41, 139, 142, 1);
color: white; color: white;
border:1px solid rgba(41, 139, 142, 1); border: 1px solid rgba(41, 139, 142, 1);
} }
</style> </style>
<div class="row" id="insurer_list">
<div class="container-fluid-min">
<div class="row" id="insurer_list">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-body maincard"> <div class="card-body maincard">
<!-- <div class="row" style="margin-bottom:1rem;"> <!-- <div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;"> <div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Insurers</h4> <h4 style="position: relative;">Insurers</h4>
</div> </div>
</div> --> </div> -->
<table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" <table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
id="tickets-table"> id="tickets-table">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th class="font-weight-medium">Name</th> <th class="font-weight-medium">Name</th>
<th class="font-weight-medium">Type</th> <th class="font-weight-medium">Type</th>
<th class="font-weight-medium">Action</th> <th class="font-weight-medium">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php if(is_array($insurerList)) {foreach($insurerList as $row){ ?> <?php if (is_array($insurerList)) {
<tr> foreach ($insurerList as $row) { ?>
<td><?php echo $row['name']; ?> ( <?php echo $row['short_name']; ?> ) </td> <tr>
<td><?php echo $row['type']; ?></td> <td><?php echo $row['name']; ?> ( <?php echo $row['short_name']; ?> ) </td>
<td> <td><?php echo $row['type']; ?></td>
<div class="btn-group dropdown"> <td>
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a> <div class="btn-group dropdown">
<div class="dropdown-menu dropdown-menu-right"> <a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<a class="dropdown-item" href="<?= base_url("master/insurer/list/"); ?><?= $row['id'];?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a> <div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removeInsurer(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a> <a class="dropdown-item" href="<?= base_url("master/insurer/list/"); ?><?= $row['id']; ?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
</div> <a class="dropdown-item" data-id="<?= $row['id']; ?>" onclick="removeInsurer(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
</div> </div>
</td> </div>
</tr> </td>
<?php }}?> </tr>
<?php }
} ?>
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
</div>
</div><!-- end col --> </div><!-- end col -->
</div>
</div> </div>
<!-- end row --> <!-- end row -->
<script> <script>
document.addEventListener("DOMContentLoaded", function() {
document.addEventListener("DOMContentLoaded", function () {
const table = document.getElementById("tickets-table"); const table = document.getElementById("tickets-table");
// Create custom dropdown // Create custom dropdown
function createCustomDropdown(row) { function createCustomDropdown(row) {
// Get the original dropdown items // Get the original dropdown items
const originalDropdown = row.querySelector('.dropdown-menu'); const originalDropdown = row.querySelector('.dropdown-menu');
if (!originalDropdown) return null; if (!originalDropdown) return null;
// Create new dropdown with proper background and spacing // Create new dropdown with proper background and spacing
const customDropdown = document.createElement('div'); const customDropdown = document.createElement('div');
customDropdown.className = 'custom-dropdown-menu'; customDropdown.className = 'custom-dropdown-menu';
// Copy inner content while maintaining icon alignment // Copy inner content while maintaining icon alignment
customDropdown.innerHTML = originalDropdown.innerHTML; customDropdown.innerHTML = originalDropdown.innerHTML;
return customDropdown; return customDropdown;
} }
let activeDropdown = null; let activeDropdown = null;
// Add click event listener to rows // Add click event listener to rows
table.querySelectorAll("tbody tr").forEach(row => { table.querySelectorAll("tbody tr").forEach(row => {
const customDropdown = createCustomDropdown(row); const customDropdown = createCustomDropdown(row);
if (!customDropdown) return; if (!customDropdown) return;
document.body.appendChild(customDropdown);
row.addEventListener("click", function(event) { document.body.appendChild(customDropdown);
// Ignore clicks on the action column
if (event.target.closest('td:last-child')) {
return;
}
// Hide any active dropdown row.addEventListener("click", function(event) {
if (activeDropdown) { // Ignore clicks on the action column
activeDropdown.style.display = 'none'; if (event.target.closest('td:last-child')) {
} return;
}
// Get click position // Hide any active dropdown
const rect = event.target.getBoundingClientRect(); if (activeDropdown) {
activeDropdown.style.display = 'none';
// Position the dropdown with some offset }
customDropdown.style.display = 'block';
customDropdown.style.position = 'fixed'; // Get click position
customDropdown.style.left = `${rect.left}px`; const rect = event.target.getBoundingClientRect();
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
// Position the dropdown with some offset
// Set as active dropdown customDropdown.style.display = 'block';
activeDropdown = customDropdown; customDropdown.style.position = 'fixed';
customDropdown.style.left = `${rect.left}px`;
event.stopPropagation(); customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
});
// Set as active dropdown
// Preserve click handlers and add auto-close activeDropdown = customDropdown;
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
item.addEventListener('click', function(e) { event.stopPropagation();
event.preventDefault(e); });
const onclickAttr = this.getAttribute('onclick');
if (onclickAttr) { // Preserve click handlers and add auto-close
eval(onclickAttr); customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
} item.addEventListener('click', function(e) {
event.preventDefault(e);
const href = this.getAttribute('href'); const onclickAttr = this.getAttribute('onclick');
if (href && href !== '#') { if (onclickAttr) {
window.location.href = href; eval(onclickAttr);
} }
// Close the dropdown after handling the click const href = this.getAttribute('href');
if (activeDropdown) { if (href && href !== '#') {
activeDropdown.style.display = 'none'; window.location.href = href;
activeDropdown = null; }
}
// Close the dropdown after handling the click
e.stopPropagation(); if (activeDropdown) {
}); activeDropdown.style.display = 'none';
activeDropdown = null;
}
e.stopPropagation();
}); });
});
}); });
// Close dropdown when clicking outside // Close dropdown when clicking outside
document.addEventListener("click", function() { document.addEventListener("click", function() {
if (activeDropdown) { if (activeDropdown) {
activeDropdown.style.display = 'none'; activeDropdown.style.display = 'none';
activeDropdown = null; activeDropdown = null;
} }
}); });
}); });
</script> </script>
<script> <script>
$(document).ready(function() {
$(document).ready(function(){ $('#tickets-table').DataTable({
dom: "<'d-flex justify-content-between align-items-center'<'datatable-search'f><'datatable-buttons'B>>" +
$('#tickets-table').DataTable({ "<'row'<'col-sm-12'tr>>" +
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>",
"<'row'<'col-sm-12'tr>>" + buttons: [{
"<'row'<'col-sm-5'i><'col-sm-7'p>>" , extend: 'csv',
buttons: [ text: 'CSV',
{ title: 'InsurerList',
extend: 'csv', exportOptions: {
text: 'CSV', columns: ':not(:last-child)'
title: 'InsurerList', }
exportOptions: {
columns: ':not(:last-child)'
}
},
{
text: 'ADD',
className: 'btn btn-color',
action: function () {
window.location.href = "<?= base_url("master/insurer/create"); ?>";
}
}
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
}, },
paging: true , {
text: 'ADD',
className: 'btn btn-color',
action: function() {
window.location.href = "<?= base_url("master/insurer/create"); ?>";
}
}
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true,
}); });
}) })
const btnExport = document.querySelector("#btnExport"); const btnExport = document.querySelector("#btnExport");
const tableElement = document.querySelector("#tickets-table"); const tableElement = document.querySelector("#tickets-table");
btnExport.addEventListener("click", () => { btnExport.addEventListener("click", () => {
const obj = new csvExport(tableElement); const obj = new csvExport(tableElement);
const csvData = obj.exportCsv(); const csvData = obj.exportCsv();
const blob = new Blob([csvData], { type: "text/csv" }); const blob = new Blob([csvData], {
const url = URL.createObjectURL(blob); type: "text/csv"
const a = document.createElement("a"); });
a.href = url; const url = URL.createObjectURL(blob);
a.download = "UserList.csv"; const a = document.createElement("a");
a.click(); a.href = url;
a.download = "UserList.csv";
a.click();
setTimeout(() => { setTimeout(() => {
URL.revokeObjectURL(url); URL.revokeObjectURL(url);
}, 500); }, 500);
}); });
class csvExport { class csvExport {
constructor(table, header = true) { constructor(table, header = true) {
this.table = table; this.table = table;
this.rows = Array.from(table.querySelectorAll("tr")); this.rows = Array.from(table.querySelectorAll("tr"));
if (!header && this.rows[0].querySelectorAll("th").length) { if (!header && this.rows[0].querySelectorAll("th").length) {
this.rows.shift(); this.rows.shift();
}
}
exportCsv() {
const lines = [];
const ncols = this._longestRow();
for (const row of this.rows) {
let line = "";
for (let i = 0; i < ncols - 1; i++) { // Exclude the last column
if (row.children[i] !== undefined) {
line += csvExport.safeData(row.children[i]);
}
line += i !== ncols - 2 ? "," : ""; // Adjusted for the last column exclusion
} }
lines.push(line);
} }
return lines.join("\n");
}
_longestRow() { exportCsv() {
return this.rows.reduce((length, row) => (row.childElementCount > length ? row.childElementCount : length), 0); const lines = [];
} const ncols = this._longestRow();
for (const row of this.rows) {
let line = "";
for (let i = 0; i < ncols - 1; i++) { // Exclude the last column
if (row.children[i] !== undefined) {
line += csvExport.safeData(row.children[i]);
}
line += i !== ncols - 2 ? "," : ""; // Adjusted for the last column exclusion
}
lines.push(line);
}
return lines.join("\n");
}
static safeData(td) { _longestRow() {
let data = td.textContent; return this.rows.reduce((length, row) => (row.childElementCount > length ? row.childElementCount : length), 0);
//Replace all double quote to two double quotes }
data = data.replace(/"/g, `""`);
//Replace , and \n to double quotes static safeData(td) {
data = /[",\n"]/.test(data) ? `"${data}"` : data; let data = td.textContent;
return data; //Replace all double quote to two double quotes
data = data.replace(/"/g, `""`);
//Replace , and \n to double quotes
data = /[",\n"]/.test(data) ? `"${data}"` : data;
return data;
}
} }
}
function removeInsurer(element) { function removeInsurer(element) {
Swal.fire({ Swal.fire({
title: "Are you sure?", title: "Are you sure?",
text: "You need to remove this insurer.", text: "You need to remove this insurer.",
icon: "info", icon: "info",
showCancelButton: true, showCancelButton: true,
confirmButtonColor: "#3085d6", confirmButtonColor: "#3085d6",
confirmButtonText: "Yes", confirmButtonText: "Yes",
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
var id = element.getAttribute('data-id'); var id = element.getAttribute('data-id');
var form_action = '<?= base_url("master/insurer/remove/") ?>' + id; var form_action = '<?= base_url("master/insurer/remove/") ?>' + id;
$.ajax({ $.ajax({
url: form_action, url: form_action,
type: "GET", type: "GET",
dataType: 'json', dataType: 'json',
processData: false, processData: false,
contentType: false, contentType: false,
success: function(res) { success: function(res) {
// console.log(res.status == true); // console.log(res.status == true);
if(res){ if (res) {
if (res.status == true) { if (res.status == true) {
toastr.success('Insurer removed successfully', 'success'); toastr.success('Insurer removed successfully', 'success');
location.reload(); location.reload();
} else { } else {
toastr.warning('Failed to remove insurer', 'warning'); toastr.warning('Failed to remove insurer', 'warning');
} }
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Failed to remove insurer', 'warning');
}
});
} }
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Failed to remove insurer', 'warning');
}
});
}
}); });
} }
</script> </script>

View File

@ -10,11 +10,12 @@
<div class="col-xl-12"> <div class="col-xl-12">
<div id="accordion" class="mb-3"> <div id="accordion" class="mb-3">
<div class="card mb-1"> <div class="card mb-1">
<h5 class="m-1"> <h4 class="m-1">
<span>Filters</span>
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true"> <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> <i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a> </a>
</h5> </h4>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body"> <div class="card-body">
<!-- <div class="text-center"> --> <!-- <div class="text-center"> -->

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,16 @@
<div class="col-xl-12"> <div class="col-xl-12">
<h4 class="ml-1 mb-3"> <span class="font-color-black">IRBA</span> </h4> <h4 class="ml-1 mb-3"> <span class="font-color-black">IRBA</span> </h4>
</div> </div>
<div class="col-xl-12" id="outstanding_filter"> <div class="container-fluid-min">
<div class="col-xl-12" id="outstanding_filter">
<div id="accordion" class="mb-3"> <div id="accordion" class="mb-3">
<label id="filterAccordion" class="m-1 d-flex justify-content-between align-items-center"> <label id="filterAccordion" class="m-1 d-flex justify-content-between align-items-center">
<span class="font-color-black">Filters</span> <h4>Filters</h4>
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" <a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
aria-expanded="true"> aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-up mr-1 text-primary" style="font-size: 28px;"></i> <i id="icon" class="mdi mdi-chevron-up mr-1 text-primary" style="font-size: 28px;"></i>
</a> </a>
</label> </label>
<div class="card mb-1"> <div class="card mb-1">
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
@ -19,8 +20,8 @@
<div class="form-group col-md-4" id="date_div"> <div class="form-group col-md-4" id="date_div">
<label>Date<span class="text-danger"></span></label> <label>Date<span class="text-danger"></span></label>
<div class="input-icon"> <div class="input-icon">
<input type="text" id="reportrange" class="form-control" readonly style="caret-color: transparent;"> <input type="text" id="reportrange" class="form-control" readonly style="caret-color: transparent;">
<i class="mdi mdi-calendar-blank-outline additional-icon"></i> <i class="mdi mdi-calendar-blank-outline additional-icon"></i>
</div> </div>
<input type="hidden" id="startDate" value=<?= $default_start ?>> <input type="hidden" id="startDate" value=<?= $default_start ?>>
<input type="hidden" id="endDate" value=<?= $default_end ?>> <input type="hidden" id="endDate" value=<?= $default_end ?>>
@ -63,6 +64,10 @@
</div> </div>
</div> </div>
<div id="report"></div> <div id="report"></div>
</div>
<script> <script>
$(function() { $(function() {
@ -81,7 +86,9 @@
$('#reportrange').daterangepicker({ $('#reportrange').daterangepicker({
startDate: start, startDate: start,
endDate: end, endDate: end,
locale: { format: 'DD-MM-YYYY' }, locale: {
format: 'DD-MM-YYYY'
},
ranges: { ranges: {
'Today': [moment(), moment()], 'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
@ -97,16 +104,16 @@
}); });
</script> </script>
<script> <script>
$('#category').on('click', function(){ $('#category').on('click', function() {
var choosed_option = $('#category').val(); var choosed_option = $('#category').val();
$("#report_type").val('0'); $("#report_type").val('0');
if (choosed_option == 'life' ){ if (choosed_option == 'life') {
$("#report_type option[value='insurer']").show(); $("#report_type option[value='insurer']").show();
$("#report_type option[value='bap']").hide(); $("#report_type option[value='bap']").hide();
$("#report_type option[value='bapClient']").hide(); $("#report_type option[value='bapClient']").hide();
$("#report_type option[value='bapInsurer']").hide(); $("#report_type option[value='bapInsurer']").hide();
$("#report_type option[value='client']").show(); $("#report_type option[value='client']").show();
} else if (choosed_option == 'nonLife') { } else if (choosed_option == 'nonLife') {
$("#report_type option[value='insurer']").show(); $("#report_type option[value='insurer']").show();
@ -139,11 +146,11 @@
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}else{ } else {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
let message = response.message; let message = response.message;
toastr.error(message,'ERROR'); toastr.error(message, 'ERROR');
} }

View File

@ -175,7 +175,7 @@
$(document).ready(function(){ $(document).ready(function(){
$('#tickets-table').DataTable({ $('#tickets-table').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" + dom: "<'d-flex justify-content-between align-items-center'<'datatable-search'f><'datatable-buttons'B>>" +
"<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>" , "<'row'<'col-sm-5'i><'col-sm-7'p>>" ,
buttons: [ buttons: [

View File

@ -129,6 +129,10 @@
} }
.container-fluid { .container-fluid {
padding: 0px 20px 0px 20px !important;
}
.container-fluid-top {
padding: 0px 40px 0px 40px !important; padding: 0px 40px 0px 40px !important;
} }
@ -1544,6 +1548,13 @@
pointer-events: none; /* prevents blocking typing */ pointer-events: none; /* prevents blocking typing */
} }
.datatable-search {
margin-right: auto;
}
.datatable-buttons {
margin-left: auto;
}
</style> </style>
@ -1992,4 +2003,4 @@
<div class="content"> <div class="content">
<!-- Start Content--> <!-- Start Content-->
<div class="container-fluid"> <div class="container-fluid-top">

View File

@ -1,370 +1,371 @@
<style> <style>
.col-12 { .col-12 {
max-width: 98% !important; max-width: 98% !important;
} }
</style> </style>
<div class="container-fluid-min">
<div class="row" id="lead_filter_div"> <div class="row" id="lead_filter_div">
<div class="col-12" style="margin-top: -12px;"> <div class="col-12" style="margin-top: -12px;">
<div id="accordion" class="mb-3"> <div id="accordion" class="mb-3">
<div class="card mb-1"> <div class="card mb-1">
<h5 class="m-1"> <h5 class="m-1">
<div class="row"> <div class="row">
<div class="col-md-6" style="position: relative;left: 17px;"> <div class="col-md-6" style="position: relative;left: 17px;">
<h4 style="text-align: left; margin-left:10px;">Filter</h4> <h4 style="text-align: left;">Filter</h4>
</div>
<div class="col-md-6">
<a style="text-align: right;" 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 class="col-md-6"> </h5>
<a style="text-align: right;" id="toggleIcon" class="text-dark float-right" <div id="collapseOne" class="collapse hide" aria-labelledby="headingOne" data-parent="#accordion">
data-toggle="collapse" href="#collapseOne" aria-expanded="true"> <div class="card-body">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" <div class="form-group">
style="font-size: 28px;"></i> <div class="form-row">
</a>
</div>
</div>
</h5>
<div id="collapseOne" class="collapse hide" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="filter_issuer_type"> Issuer Type <span <label for="filter_issuer_type"> Issuer Type <span
class="text-danger"></span></label> class="text-danger"></span></label>
<select class="form-control" id="filter_issuer_type" name="filter_issuer_type"> <select class="form-control" id="filter_issuer_type" name="filter_issuer_type">
<option value="0">Select</option> <option value="0">Select</option>
<?php <?php
if (isset($issuer) && count($issuer)) { if (isset($issuer) && count($issuer)) {
foreach ($issuer as $key => $value) { foreach ($issuer as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>"; echo "<option value='" . $key . "'>" . $value . "</option>";
} }
} }
?> ?>
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="filter_lead_type"> Lead Type <span class="text-danger"></span></label> <label for="filter_lead_type"> Lead Type <span class="text-danger"></span></label>
<select class="form-control" id="filter_lead_type" name="filter_lead_type"> <select class="form-control" id="filter_lead_type" name="filter_lead_type">
<option value="0">Select</option> <option value="0">Select</option>
<?php <?php
if (isset($lead_type) && count($lead_type)) { if (isset($lead_type) && count($lead_type)) {
foreach ($lead_type as $key => $value) { foreach ($lead_type as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>"; echo "<option value='" . $key . "'>" . $value . "</option>";
} }
} }
?> ?>
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="filter_client_type"> Client Type <span <label for="filter_client_type"> Client Type <span
class="text-danger"></span></label> class="text-danger"></span></label>
<select class="form-control" id="filter_client_type" name="filter_client_type"> <select class="form-control" id="filter_client_type" name="filter_client_type">
<option value="0">Select</option> <option value="0">Select</option>
<?php <?php
if (isset($client_type) && count($client_type)) { if (isset($client_type) && count($client_type)) {
foreach ($client_type as $key => $value) { foreach ($client_type as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>"; echo "<option value='" . $key . "'>" . $value . "</option>";
} }
} }
?> ?>
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="filter_policy_type"> Policy Type <span <label for="filter_policy_type"> Policy Type <span
class="text-danger"></span></label> class="text-danger"></span></label>
<select class="form-control" id="filter_policy_type" name="filter_policy_type"> <select class="form-control" id="filter_policy_type" name="filter_policy_type">
<option value="0">Select</option> <option value="0">Select</option>
<?php <?php
if (isset($policy_type) && count($policy_type)) { if (isset($policy_type) && count($policy_type)) {
foreach ($policy_type as $key => $value) { foreach ($policy_type as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>"; echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
} }
} }
?> ?>
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="filter_client_id">Client<span class="text-danger"></span></label> <label for="filter_client_id">Client<span class="text-danger"></span></label>
<select class="form-control" id="filter_client_id" name="filter_client_id"> <select class="form-control" id="filter_client_id" name="filter_client_id">
<option value="0">Select</option> <option value="0">Select</option>
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="filter_client_branch_id">Client Branch<span <label for="filter_client_branch_id">Client Branch<span
class="text-danger"></span></label> class="text-danger"></span></label>
<select class="form-control" id="filter_client_branch_id" <select class="form-control" id="filter_client_branch_id"
name="filter_client_branch_id"> name="filter_client_branch_id">
<option value="0">Select</option> <option value="0">Select</option>
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="filter_lead_status">Status<span class="text-danger"></span></label> <label for="filter_lead_status">Status<span class="text-danger"></span></label>
<select class="form-control" id="filter_lead_status" name="filter_lead_status"> <select class="form-control" id="filter_lead_status" name="filter_lead_status">
<option value="0">Select</option> <option value="0">Select</option>
<?php <?php
if (isset($lead_status) && count($lead_status)) { if (isset($lead_status) && count($lead_status)) {
foreach ($lead_status as $key => $value) { foreach ($lead_status as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>"; echo "<option value=" . $key . ">" . $value . "</option>";
} }
} }
?> ?>
</select> </select>
</div> </div>
<div class="form-group col-md-12 text-right m-b-0" style="margin-bottom: -15px;">
<a href="<?= base_url("/leads/list"); ?>" class="btn btn-secondary"
id="clear-filters">Clear</a>
<a class="btn btn-primary" id="get-emp-list"
onclick="fetchTicketListData();">Submit</a>
</div>
<div class="form-group col-md-12 text-right m-b-0" style="margin-bottom: -15px;">
<a href="<?= base_url("/leads/list"); ?>" class="btn btn-secondary"
id="clear-filters">Clear</a>
<a class="btn btn-primary" id="get-emp-list"
onclick="fetchTicketListData();">Submit</a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
</div> </div>
</div> </div>
<!-- end page title -->
<div id="lead_list_div">
<?php include('leads_list.php'); ?>
</div>
</div> </div>
<!-- end page title -->
<div id="lead_list_div">
<?php include('leads_list.php'); ?>
</div>
<script> <script>
var filter_client_list = []; var filter_client_list = [];
var filter_branch_list = []; var filter_branch_list = [];
$(document).ready(function() { $(document).ready(function() {
$('#filter_client_id').select2(); $('#filter_client_id').select2();
$('#filter_client_branch_id').select2(); $('#filter_client_branch_id').select2();
$('#filter_policy_type').select2(); $('#filter_policy_type').select2();
getfilterClientAndBranch() getfilterClientAndBranch()
});
$(document).ready(function() {
$('#filter_client_id').change(function() {
let client_id = $(this).val();
if (filter_branch_list != '') {
// console.log(branch_list[client_id]);
let data = filter_branch_list[client_id];
appendfilterBranch(data);
}
})
});
//----- AJAX FUNCTIONS --------------------------------------------------------------------------------
function fetchTicketListData() {
var issuer_type = $('#filter_issuer_type').val();
var lead_type = $('#filter_lead_type').val();
var policy_type = $('#filter_policy_type').val();
var client_type = $('#filter_client_type').val();
var status = $('#filter_lead_status').val();
var client_id = $('#filter_client_id').val();
var client_branch_id = $('#filter_client_branch_id').val();
var requestData = {
issuer: issuer_type,
lead_type: lead_type,
policy_type_id: policy_type,
client_type: client_type,
status: status,
client_id: client_id,
client_branch_id: client_branch_id,
};
console.log("requestData", requestData);
var url = '<?= base_url('/leads/list') ?>';
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
console.log('Filter Responce', response);
if (response.status == true) {
$('#lead_list_div').empty();
$('#lead_list_div').html(response.html);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
setTimeout(function(){
additionalDropdown();
}, 1000);
} else {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
let message = response.message;
toastr.error(message, 'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the data.', 'ERROR');
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}); });
}
//function for fetch client, branch $(document).ready(function() {
function getfilterClientAndBranch() { $('#filter_client_id').change(function() {
$.ajax({
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
type: "GET",
dataType: 'json',
success: function(res) {
console.log('getClientAndBranchAndPolicy', res); let client_id = $(this).val();
if (res.status == true) { if (filter_branch_list != '') {
filter_client_list = res.client_data; // console.log(branch_list[client_id]);
filter_branch_list = res.branch_data; let data = filter_branch_list[client_id];
appendfilterClients(res.client_data); appendfilterBranch(data);
} else {
console.log('No data found');
} }
}, })
error: function(xhr, status, error) { });
//----- AJAX FUNCTIONS --------------------------------------------------------------------------------
function fetchTicketListData() {
var issuer_type = $('#filter_issuer_type').val();
var lead_type = $('#filter_lead_type').val();
var policy_type = $('#filter_policy_type').val();
var client_type = $('#filter_client_type').val();
var status = $('#filter_lead_status').val();
var client_id = $('#filter_client_id').val();
var client_branch_id = $('#filter_client_branch_id').val();
var requestData = {
issuer: issuer_type,
lead_type: lead_type,
policy_type_id: policy_type,
client_type: client_type,
status: status,
client_id: client_id,
client_branch_id: client_branch_id,
};
console.log("requestData", requestData);
var url = '<?= base_url('/leads/list') ?>';
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
console.log('Filter Responce', response);
if (response.status == true) {
$('#lead_list_div').empty();
$('#lead_list_div').html(response.html);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
setTimeout(function() {
additionalDropdown();
}, 1000);
} else {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
let message = response.message;
toastr.error(message, 'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText); console.error(xhr.responseText);
console.error(status, error); toastr.error('An error occurred while fetching the data.', 'ERROR');
}
});
}
//----- END AJAX FUNCTIONS -------------------------------------------------------------------------------- $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
function appendfilterClients(data) {
$('#filter_client_id').empty();
$('#filter_client_id').append($('<option>', {
value: 0,
text: 'Select'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.client_name,
}); });
$('#filter_client_id').append(option);
});
}
function appendfilterBranch(data) {
$('#filter_client_branch_id').empty();
$('#filter_client_branch_id').append($('<option>', {
value: '',
text: 'Select'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.branch_name
});
$('#filter_client_branch_id').append(option);
});
}
// -----------------------------------------------------------------------------------------------------------
function additionalDropdown() {
const table = document.getElementById("tickets-table");
if (!table) return; // Prevent errors if the table is not found
let activeDropdown = null;
function handleDropdownClick(row, event) {
// Hide any active dropdown
if (activeDropdown) {
activeDropdown.style.display = 'none';
}
let customDropdown = row.customDropdown;
if (!customDropdown) {
const originalDropdown = row.querySelector('.dropdown-menu');
if (!originalDropdown) return;
customDropdown = document.createElement('div');
customDropdown.className = 'custom-dropdown-menu';
customDropdown.innerHTML = originalDropdown.innerHTML;
document.body.appendChild(customDropdown);
row.customDropdown = customDropdown;
// Preserve click handlers and add auto-close
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
item.addEventListener('click', function (e) {
const onclickAttr = this.getAttribute('onclick');
if (onclickAttr) eval(onclickAttr);
const href = this.getAttribute('href');
if (href && href !== '#') window.location.href = href;
customDropdown.style.display = 'none';
activeDropdown = null;
e.stopPropagation();
});
});
}
// Get click position
const rect = event.target.getBoundingClientRect();
// Position the dropdown
customDropdown.style.display = 'block';
customDropdown.style.position = 'fixed';
customDropdown.style.left = `${rect.left}px`;
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
activeDropdown = customDropdown;
event.stopPropagation();
} }
// Add click event listener to rows //function for fetch client, branch
table.querySelectorAll("tbody tr").forEach(row => { function getfilterClientAndBranch() {
row.addEventListener("click", function (event) { $.ajax({
if (!event.target.closest('td:last-child')) { url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
handleDropdownClick(row, event); type: "GET",
dataType: 'json',
success: function(res) {
console.log('getClientAndBranchAndPolicy', res);
if (res.status == true) {
filter_client_list = res.client_data;
filter_branch_list = res.branch_data;
appendfilterClients(res.client_data);
} else {
console.log('No data found');
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
} }
}); });
}); }
// Close dropdown when clicking outside //----- END AJAX FUNCTIONS --------------------------------------------------------------------------------
document.addEventListener("click", function () {
if (activeDropdown) {
activeDropdown.style.display = 'none'; function appendfilterClients(data) {
activeDropdown = null;
$('#filter_client_id').empty();
$('#filter_client_id').append($('<option>', {
value: 0,
text: 'Select'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.client_name,
});
$('#filter_client_id').append(option);
});
}
function appendfilterBranch(data) {
$('#filter_client_branch_id').empty();
$('#filter_client_branch_id').append($('<option>', {
value: '',
text: 'Select'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.branch_name
});
$('#filter_client_branch_id').append(option);
});
}
// -----------------------------------------------------------------------------------------------------------
function additionalDropdown() {
const table = document.getElementById("tickets-table");
if (!table) return; // Prevent errors if the table is not found
let activeDropdown = null;
function handleDropdownClick(row, event) {
// Hide any active dropdown
if (activeDropdown) {
activeDropdown.style.display = 'none';
}
let customDropdown = row.customDropdown;
if (!customDropdown) {
const originalDropdown = row.querySelector('.dropdown-menu');
if (!originalDropdown) return;
customDropdown = document.createElement('div');
customDropdown.className = 'custom-dropdown-menu';
customDropdown.innerHTML = originalDropdown.innerHTML;
document.body.appendChild(customDropdown);
row.customDropdown = customDropdown;
// Preserve click handlers and add auto-close
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
item.addEventListener('click', function(e) {
const onclickAttr = this.getAttribute('onclick');
if (onclickAttr) eval(onclickAttr);
const href = this.getAttribute('href');
if (href && href !== '#') window.location.href = href;
customDropdown.style.display = 'none';
activeDropdown = null;
e.stopPropagation();
});
});
}
// Get click position
const rect = event.target.getBoundingClientRect();
// Position the dropdown
customDropdown.style.display = 'block';
customDropdown.style.position = 'fixed';
customDropdown.style.left = `${rect.left}px`;
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
activeDropdown = customDropdown;
event.stopPropagation();
} }
});
}
// Add click event listener to rows
table.querySelectorAll("tbody tr").forEach(row => {
row.addEventListener("click", function(event) {
if (!event.target.closest('td:last-child')) {
handleDropdownClick(row, event);
}
});
});
// Close dropdown when clicking outside
document.addEventListener("click", function() {
if (activeDropdown) {
activeDropdown.style.display = 'none';
activeDropdown = null;
}
});
}
</script> </script>

View File

@ -62,7 +62,8 @@
border-radius: 6px; border-radius: 6px;
position: absolute; position: absolute;
z-index: 999; z-index: 999;
bottom: 125%; /* Show above icon */ bottom: 125%;
/* Show above icon */
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
font-size: 12px; font-size: 12px;
@ -73,7 +74,8 @@
.info-tooltip::after { .info-tooltip::after {
content: ""; content: "";
position: absolute; position: absolute;
top: 100%; /* Arrow below tooltip */ top: 100%;
/* Arrow below tooltip */
left: 50%; left: 50%;
margin-left: -5px; margin-left: -5px;
border-width: 5px; border-width: 5px;
@ -86,25 +88,29 @@
opacity: 1; opacity: 1;
} }
/* dont forgot it keep it safe card and card body space remover */ /* bcoz in design */ /* dont forgot it keep it safe card and card body space remover */
.card-body{ margin-top: 0px !important; } /* bcoz in design */
.card-body {
margin-top: 0px !important;
}
/* this css as per design so not declare in golbal */ /* bcoz in design */ /* this css as per design so not declare in golbal */
#collapseOne{ /* bcoz in design */
#collapseOne {
border: 1px solid #BFF3F5 !important; border: 1px solid #BFF3F5 !important;
border-radius: 10px !important; border-radius: 10px !important;
border-width: 1px !important; border-width: 1px !important;
} }
</style> </style>
<div class="row" id="leads_form"> <div class="container-fluid-min">
<div class="col-12"> <div class="row" id="leads_form">
<div class="card"> <div class="col-12">
<div class="card-body"> <div class="card">
<div class="row" style="margin-bottom:1rem;"> <div class="card-body">
<div class="row" style="margin-bottom:1rem;">
<!-- <div class="col-6" style="align-self: center;"> <!-- <div class="col-6" style="align-self: center;">
<h4 id="page_title" style="position: relative;">Add Lead</h4> <h4 id="page_title" style="position: relative;">Add Lead</h4>
</div> </div>
<div class="col-3" style="text-align: right; position: relative; left: 211px;"> <div class="col-3" style="text-align: right; position: relative; left: 211px;">
@ -114,93 +120,93 @@
<a href="<?= base_url('leads/list') ?>" type="button" id="btnAdd" <a href="<?= base_url('leads/list') ?>" type="button" id="btnAdd"
class="btn btn-primary waves-effect waves-light">Back</a> class="btn btn-primary waves-effect waves-light">Back</a>
</div> --> </div> -->
<h4 class="d-flex align-items-center" style="gap: 8px;"> <h4 class="d-flex align-items-center" style="gap: 8px;">
<a href="<?= base_url('leads/list') ?>" style="cursor: pointer;"> <a href="<?= base_url('leads/list') ?>" style="cursor: pointer;">
<i class="mdi mdi-chevron-left" style="font-size: 43px;"></i> <i class="mdi mdi-chevron-left" style="font-size: 43px;"></i>
</a> </a>
<span class="title-text" id="page_title" style="position: relative;">Add Lead</span> <span class="title-text" id="page_title" style="position: relative;">Add Lead</span>
</h4> </h4>
</div>
<form role="form" class="parsley-examples" method="post" id="leads_form_id"
enctype="multipart/form-data">
<input type="hidden" name="id" id="leads_primarykey">
<div class="card" id="collapseOne">
<div class="card-body">
<div class="form-row">
<div class="form-group col-md-4">
<label for="lead_type">Lead Type<span class="text-danger">*</span></label>
<select class="form-control" id="lead_type" name="lead_type" required>
<option value="">Select Lead Type</option>
<?php
if (isset($lead_type) && count($lead_type)) {
foreach ($lead_type as $key => $value) {
if ($key == 1) {
echo "<option value=" . $key . " selected>" . $value . "</option>";
} else {
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
}
?>
</select>
</div>
<div class="form-group col-md-4">
<label for="issuer">Issuer<span class="text-danger">*</span></label>
<select class="form-control" id="issuer" name="issuer" required>
<option value="">Select Issuer</option>
<?php
if (isset($issuer) && count($issuer)) {
foreach ($issuer as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
?>
</select>
</div>
</div>
</div>
</div> </div>
<form role="form" class="parsley-examples" method="post" id="leads_form_id"
enctype="multipart/form-data">
<!-- <hr> --> <!-- bcoz removed in design --> <input type="hidden" name="id" id="leads_primarykey">
<!-- client row --> <div class="card" id="collapseOne">
<div class="card" id="collapseOne"> <div class="card-body">
<div class="card-body"> <div class="form-row">
<div class="form-row">
<div class="form-group offset-md-10 col-md-2 freshFields" style="float:right;"> <div class="form-group col-md-4">
<label class="switch"> <label for="lead_type">Lead Type<span class="text-danger">*</span></label>
<input id="exixting_client" type="checkbox" name="exixting_client"> <select class="form-control" id="lead_type" name="lead_type" required>
<span class="slider round" style="height: 27px;"></span> <option value="">Select Lead Type</option>
</label> <?php
if (isset($lead_type) && count($lead_type)) {
foreach ($lead_type as $key => $value) {
if ($key == 1) {
echo "<option value=" . $key . " selected>" . $value . "</option>";
} else {
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
}
?>
</select>
</div>
<div class="form-group col-md-4">
<label for="issuer">Issuer<span class="text-danger">*</span></label>
<select class="form-control" id="issuer" name="issuer" required>
<option value="">Select Issuer</option>
<?php
if (isset($issuer) && count($issuer)) {
foreach ($issuer as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
?>
</select>
</div>
<label for="exixting_client" style="position: relative;top: 2px;">Existing Client</label>
</div> </div>
</div> </div>
<div class="form-row"> </div>
<!-- <hr> --> <!-- bcoz removed in design -->
<!-- client row -->
<div class="card" id="collapseOne">
<div class="card-body">
<div class="form-row">
<div class="form-group offset-md-10 col-md-2 freshFields" style="float:right;">
<label class="switch">
<input id="exixting_client" type="checkbox" name="exixting_client">
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="exixting_client" style="position: relative;top: 2px;">Existing Client</label>
</div>
<div class="form-group col-md-4 renewalFields" style="display: none;">
<label for="client_id">Client<span class="text-danger">*</span></label>
<select class="form-control" id="client_id" name="client_id">
<option value="">Select Client</option>
</select>
</div> </div>
<div class="form-row">
<div class="form-group col-md-4 renewalFields" style="display: none;"> <div class="form-group col-md-4 renewalFields" style="display: none;">
<label for="client_branch_id">Branch<span class="text-danger">*</span></label> <label for="client_id">Client<span class="text-danger">*</span></label>
<select class="form-control" id="client_branch_id" name="client_branch_id" <select class="form-control" id="client_id" name="client_id">
onchange="getBranchData(this,1)"> <option value="">Select Client</option>
<option value="">Select Branch</option> </select>
</select> </div>
</div>
<!-- <div class="form-group col-md-3 freshFields"> <div class="form-group col-md-4 renewalFields" style="display: none;">
<label for="client_branch_id">Branch<span class="text-danger">*</span></label>
<select class="form-control" id="client_branch_id" name="client_branch_id"
onchange="getBranchData(this,1)">
<option value="">Select Branch</option>
</select>
</div>
<!-- <div class="form-group col-md-3 freshFields">
<label for="client_type">Client Type<span class="text-danger">*</span></label> <label for="client_type">Client Type<span class="text-danger">*</span></label>
<select class="form-control" id="client_type" name="client_type" required> <select class="form-control" id="client_type" name="client_type" required>
<option value="">Select Client type</option> <option value="">Select Client type</option>
@ -214,33 +220,33 @@
</select> </select>
</div> --> </div> -->
<div class="form-group col-md-4 freshFields"> <div class="form-group col-md-4 freshFields">
<label for="entity_type_id">Entity Type<span class="text-danger">*</span></label> <label for="entity_type_id">Entity Type<span class="text-danger">*</span></label>
<select class="form-control" id="entity_type_id" name="entity_type_id" required> <select class="form-control" id="entity_type_id" name="entity_type_id" required>
<option value="" selected>Select Entity</option> <option value="" selected>Select Entity</option>
<?php <?php
if (isset($entity) && count($entity)) { if (isset($entity) && count($entity)) {
foreach ($entity as $key => $value) { foreach ($entity as $key => $value) {
echo "<option value=" . $value['id'] . ">" . $value['name'] . "</option>"; echo "<option value=" . $value['id'] . ">" . $value['name'] . "</option>";
}
} }
} ?>
?> </select>
</select> </div>
</div>
<div class="form-group col-md-4 freshFields"> <div class="form-group col-md-4 freshFields">
<label for="client_name">Client Name<span class="text-danger">*</span></label> <label for="client_name">Client Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="client_name" name="client_name" <input type="text" class="form-control" id="client_name" name="client_name"
placeholder="Enter Client Name" required> placeholder="Enter Client Name" required>
</div> </div>
<div class="form-group col-md-4 freshFields"> <div class="form-group col-md-4 freshFields">
<label for="client_short_name">Client Short Name<span class="text-danger">*</span></label> <label for="client_short_name">Client Short Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="client_short_name" name="client_short_name" <input type="text" class="form-control" id="client_short_name" name="client_short_name"
placeholder="Enter Client Short Name" onkeyup="validateInput(this, 'clients', 'short_name')" required> placeholder="Enter Client Short Name" onkeyup="validateInput(this, 'clients', 'short_name')" required>
</div> </div>
<!-- <div class="form-group col-md-3 renewalFields" style="display: none;"> <!-- <div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="source_policy_id"> Source Policy <span id="base_danger" <label for="source_policy_id"> Source Policy <span id="base_danger"
class="text-danger">*</span></label> class="text-danger">*</span></label>
<select class="form-control" id="source_policy_id" name="source_policy_id"> <select class="form-control" id="source_policy_id" name="source_policy_id">
@ -258,162 +264,165 @@
<input type="text" class="form-control" id="source_policy_end_date" name="source_policy_end_date" readonly> <input type="text" class="form-control" id="source_policy_end_date" name="source_policy_end_date" readonly>
</div> --> </div> -->
<!-- <div class="form-group col-md-3"> <!-- <div class="form-group col-md-3">
<label for="pan">PAN<span class="text-danger"></span></label> <label for="pan">PAN<span class="text-danger"></span></label>
<input type="text" class="form-control" id="pan" placeholder="Enter PAN Number" <input type="text" class="form-control" id="pan" placeholder="Enter PAN Number"
data-parsley-error-message="Invalid PAN Number. Example: ABCDE1234F" name="pan" data-parsley-error-message="Invalid PAN Number. Example: ABCDE1234F" name="pan"
data-parsley-trigger="change" data-parsley-pattern="^[A-Z]{5}[0-9]{4}[A-Z]$"> data-parsley-trigger="change" data-parsley-pattern="^[A-Z]{5}[0-9]{4}[A-Z]$">
</div> --> </div> -->
</div>
</div> </div>
</div> </div>
</div> <!-- end client row -->
<!-- end client row -->
<!-- <hr> --> <!-- bcoz removed in design --> <!-- <hr> --> <!-- bcoz removed in design -->
<!-- branch row--> <!-- branch row-->
<div class="card" id="collapseOne"> <div class="card" id="collapseOne">
<div class="card-body"> <div class="card-body">
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-4">
<label for="gst">GST<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="gst" placeholder="Enter GST Number"
data-parsley-error-message="Invalid GST Number. Example: 12ABCDE1234F5Z6" name="gst"
data-parsley-trigger="change"
data-parsley-pattern="^\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}[Z]{1}[A-Z\d]{1}$" required>
</div>
<div class="form-group col-md-4">
<label for="client_branch">Branch Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_name" name="branch_name"
placeholder="Enter Branch Name" required>
</div>
<div class="form-group col-md-4">
<label for="client_branch">Branch Code<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_code" name="branch_code"
placeholder="Enter Branch Code" required>
</div>
<div class="form-group col-md-4 renewalFields">
<label for="contact_person_summary">Contact Person</label>
<select class="form-control" name="contact_person_summary" id="contact_person_summary">
<option value="">Select a Contact</option>
</select>
</div>
<div class="form-group col-md-4 freshFields">
<label for="client_branch">Contact Person Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="contact_person_name" name="contact_person_name"
placeholder="Enter Contact Name" required>
</div>
<div class="form-group col-md-4">
<label for="contact_person_mobile">Contact Person Mobile<span
class="text-danger">*</span></label>
<input type="text" class="form-control" id="contact_person_mobile"
name="contact_person_mobile" placeholder="Enter Contact Mobile" required>
</div>
<div class="form-group col-md-4">
<label for="contact_person_email">Contact Person Email<span
class="text-danger">*</span></label>
<input type="text" class="form-control" id="contact_person_email"
name="contact_person_email" placeholder="Enter Contact Email" required>
</div>
<div class="form-group col-md-4">
<label for="gst">GST<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="gst" placeholder="Enter GST Number"
data-parsley-error-message="Invalid GST Number. Example: 12ABCDE1234F5Z6" name="gst"
data-parsley-trigger="change"
data-parsley-pattern="^\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}[Z]{1}[A-Z\d]{1}$" required>
</div> </div>
<div class="form-group col-md-4">
<label for="client_branch">Branch Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_name" name="branch_name"
placeholder="Enter Branch Name" required>
</div>
<div class="form-group col-md-4">
<label for="client_branch">Branch Code<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_code" name="branch_code"
placeholder="Enter Branch Code" required>
</div>
<div class="form-group col-md-4 renewalFields">
<label for="contact_person_summary">Contact Person</label>
<select class="form-control" name="contact_person_summary" id="contact_person_summary">
<option value="">Select a Contact</option>
</select>
</div>
<div class="form-group col-md-4 freshFields">
<label for="client_branch">Contact Person Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="contact_person_name" name="contact_person_name"
placeholder="Enter Contact Name" required>
</div>
<div class="form-group col-md-4">
<label for="contact_person_mobile">Contact Person Mobile<span
class="text-danger">*</span></label>
<input type="text" class="form-control" id="contact_person_mobile"
name="contact_person_mobile" placeholder="Enter Contact Mobile" required>
</div>
<div class="form-group col-md-4">
<label for="contact_person_email">Contact Person Email<span
class="text-danger">*</span></label>
<input type="text" class="form-control" id="contact_person_email"
name="contact_person_email" placeholder="Enter Contact Email" required>
</div>
</div> </div>
</div> </div>
</div>
<!-- policy row -->
<div class="card" id="collapseOne">
<div class="card-body">
<div id="dynamic-form-container"></div>
</div>
</div>
<!-- <hr> --> <!-- bcoz removed in design -->
<!-- other row -->
<div class="card" id="collapseOne">
<div class="card-body">
<div class="form-row">
<div class="form-group offset-md-9 col-md-3" style="float:right;">
<label class="switch">
<input id="is_insurer_auto_mail" type="checkbox" name="is_insurer_auto_mail">
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="is_insurer_auto_mail" style="position: relative;top: 2px;">Insurer Auto Mail</label>
</div>
<!-- policy row -->
<div class="card" id="collapseOne">
<div class="card-body">
<div id="dynamic-form-container"></div>
</div> </div>
<div class="form-row"> </div>
<!-- <hr> --> <!-- bcoz removed in design -->
<div class="form-group col-md-4"> <!-- other row -->
<label for="salse_person_id">Sales Person<span class="text-danger">*</span></label> <div class="card" id="collapseOne">
<select class="form-control" id="salse_person_id" name="salse_person_id" multiple required> <div class="card-body">
<option value="">Select Sales Person</option> <div class="form-row">
<?php if (isset($salse_team)) { ?>
<?php foreach ($salse_team as $value) { ?> <div class="form-group offset-md-9 col-md-3" style="float:right;">
<option value="<?= $value['id']; ?>"> <label class="switch">
<?= $value['first_name']; ?> <input id="is_insurer_auto_mail" type="checkbox" name="is_insurer_auto_mail">
</option> <span class="slider round" style="height: 27px;"></span>
</label>
<label for="is_insurer_auto_mail" style="position: relative;top: 2px;">Insurer Auto Mail</label>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="salse_person_id">Sales Person<span class="text-danger">*</span></label>
<select class="form-control" id="salse_person_id" name="salse_person_id" multiple required>
<option value="">Select Sales Person</option>
<?php if (isset($salse_team)) { ?>
<?php foreach ($salse_team as $value) { ?>
<option value="<?= $value['id']; ?>">
<?= $value['first_name']; ?>
</option>
<?php } ?>
<?php } ?> <?php } ?>
<?php } ?> </select>
</select> </div>
</div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="status"> Status <span id="base_danger" class="text-danger">*</span></label> <label for="status"> Status <span id="base_danger" class="text-danger">*</span></label>
<select class="form-control" id="lead_status" name="status" required> <select class="form-control" id="lead_status" name="status" required>
<option value="" selected>Select Status</option> <option value="" selected>Select Status</option>
<?php <?php
if (isset($lead_status) && count($lead_status)) { if (isset($lead_status) && count($lead_status)) {
foreach ($lead_status as $key => $value) { foreach ($lead_status as $key => $value) {
if ($key == 'queued') { if ($key == 'queued') {
echo "<option value=" . $key . " selected>" . $value . "</option>"; echo "<option value=" . $key . " selected>" . $value . "</option>";
} else { } else {
echo "<option value=" . $key . ">" . $value . "</option>"; echo "<option value=" . $key . ">" . $value . "</option>";
}
} }
} }
} ?>
?> </select>
</select>
</div>
<div class="form-group col-md-4">
<label for="">Next Reminder Date<span class="text-danger"></span></label>
<div class="input-icon">
<input type="text" class="form-control" id="next_reminder_date" name="next_reminder_date" placeholder="DD/MM/YYYY">
<i class="mdi mdi-calendar-blank-outline additional-icon"></i>
</div> </div>
</div>
</div> <div class="form-group col-md-4">
<div class="form-row"> <label for="">Next Reminder Date<span class="text-danger"></span></label>
<div class="form-group col-md-12"> <div class="input-icon">
<label for="notes">Remarks</label> <input type="text" class="form-control" id="next_reminder_date" name="next_reminder_date" placeholder="DD/MM/YYYY">
<textarea class="form-control" id="notes" name="notes" rows="4"></textarea> <i class="mdi mdi-calendar-blank-outline additional-icon"></i>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="notes">Remarks</label>
<textarea class="form-control" id="notes" name="notes" rows="4"></textarea>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="form-group text-right m-b-0" id="submitButton"> <div class="form-group text-right m-b-0" id="submitButton">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" <button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="lead_form_submit_btn" >Submit</button> id="lead_form_submit_btn">Submit</button>
</div> </div>
</form> </form>
</div>
</div> </div>
</div> </div>
</div> </div><!-- end form row -->
</div><!-- end form row -->
<?php include("newClientModal.php") ?>
</div>
<?php include("newClientModal.php") ?>
<script> <script>
@ -499,8 +508,8 @@
// } // }
} }
}); });
}else if (lead_type == 3) { } else if (lead_type == 3) {
if ($('#client_id option[value="add_client"]').length === 0) { if ($('#client_id option[value="add_client"]').length === 0) {
$('#client_id').prepend($('<option>', { $('#client_id').prepend($('<option>', {
value: 'add_client', value: 'add_client',
@ -508,43 +517,43 @@
})); }));
} }
$("#source_policy_id").removeAttr("required"); $("#source_policy_id").removeAttr("required");
$("#source_policy_id").closest("div") .find("label .text-danger").remove(); $("#source_policy_id").closest("div").find("label .text-danger").remove();
$("#source_policy_id").hide(); $("#source_policy_id").hide();
$('#source_policy_id').closest('.form-group').hide(); $('#source_policy_id').closest('.form-group').hide();
$("#source_policy_start_date").removeAttr("required"); $("#source_policy_start_date").removeAttr("required");
$("#source_policy_start_date").closest("div") .find("label .text-danger").remove(); $("#source_policy_start_date").closest("div").find("label .text-danger").remove();
$("#source_policy_start_date").hide(); $("#source_policy_start_date").hide();
$('#source_policy_start_date').closest('.form-group').hide(); $('#source_policy_start_date').closest('.form-group').hide();
$("#source_policy_end_date").removeAttr("required"); $("#source_policy_end_date").removeAttr("required");
$("#source_policy_end_date").closest("div") .find("label .text-danger").remove(); $("#source_policy_end_date").closest("div").find("label .text-danger").remove();
$("#source_policy_end_date").hide(); $("#source_policy_end_date").hide();
$('#source_policy_end_date').closest('.form-group').hide(); $('#source_policy_end_date').closest('.form-group').hide();
} else if (lead_type != 3) { } else if (lead_type != 3) {
$("#source_policy_id").prop("required",true); $("#source_policy_id").prop("required", true);
$("#source_policy_start_date").prop("required", true); $("#source_policy_start_date").prop("required", true);
$("#source_policy_end_date").prop("required", true); $("#source_policy_end_date").prop("required", true);
$("#source_policy_id").show(); $("#source_policy_id").show();
$("#source_policy_start_date").show(); $("#source_policy_start_date").show();
$("#source_policy_start_date").show(); $("#source_policy_start_date").show();
$('#source_policy_id').closest('.form-group').find('label').show(); $('#source_policy_id').closest('.form-group').find('label').show();
$('#source_policy_start_date').closest('.form-group').find('label').show(); $('#source_policy_start_date').closest('.form-group').find('label').show();
$('#source_policy_end_date').closest('.form-group').find('label').show(); $('#source_policy_end_date').closest('.form-group').find('label').show();
// Check if the asterisk doesn't already exist, then add it // Check if the asterisk doesn't already exist, then add it
let $label = $("#source_policy_id").closest("div") .find("label"); let $label = $("#source_policy_id").closest("div").find("label");
if ($label.find(".text-danger").length === 0) { if ($label.find(".text-danger").length === 0) {
$label.append(' <span class="text-danger">*</span>'); $label.append(' <span class="text-danger">*</span>');
} }
let $label2 = $("#source_policy_start_date").closest("div") .find("label"); let $label2 = $("#source_policy_start_date").closest("div").find("label");
if ($label2.find(".text-danger").length === 0) { if ($label2.find(".text-danger").length === 0) {
$label2.append(' <span class="text-danger">*</span>'); $label2.append(' <span class="text-danger">*</span>');
@ -563,7 +572,7 @@
} }
if(lead_type != 1){ if (lead_type != 1) {
dataIncrement = 1; dataIncrement = 1;
// updateRenewalFields(dataIncrement); // updateRenewalFields(dataIncrement);
@ -623,8 +632,8 @@
maxDate: "today" maxDate: "today"
}); });
}) })
//------------------------------ GET DATA ( EDIT, BRANCH, POLICY ) --------------------------------------------------------------------------- //------------------------------ GET DATA ( EDIT, BRANCH, POLICY ) ---------------------------------------------------------------------------
//view and edit Lead data function ( NOT IN USE DON'T DELETE ) //view and edit Lead data function ( NOT IN USE DON'T DELETE )
@ -700,7 +709,7 @@
let lead_type = $('#lead_type').val(); let lead_type = $('#lead_type').val();
var policyStartDate = $("#source_policy_start_date"); var policyStartDate = $("#source_policy_start_date");
if(lead_type == 3){ if (lead_type == 3) {
policyStartDate = $("#policy_start_date"); policyStartDate = $("#policy_start_date");
} }
console.log('Selected Dates:', selectedDates); console.log('Selected Dates:', selectedDates);
@ -801,7 +810,7 @@
//client branch data //client branch data
function getBranchData(input, inputType) { function getBranchData(input, inputType) {
if (inputType == 1 ) { if (inputType == 1) {
var client_branch_id = $(input).val(); var client_branch_id = $(input).val();
} else { } else {
client_branch_id = input; client_branch_id = input;
@ -826,11 +835,11 @@
$('#pan').val(res.data.pan); $('#pan').val(res.data.pan);
$('#branch_name').val(res.data.branch_name); $('#branch_name').val(res.data.branch_name);
$('#branch_code').val(res.data.branch_code); $('#branch_code').val(res.data.branch_code);
allContacts = res.contact; allContacts = res.contact;
$('#contact_person_summary').empty(); $('#contact_person_summary').empty();
$('#contact_person_summary').append($('<option>', { $('#contact_person_summary').append($('<option>', {
value: "", value: "",
text: "Select a Contact" text: "Select a Contact"
})); }));
res.contact.forEach((value, key) => { res.contact.forEach((value, key) => {
@ -845,8 +854,8 @@
text: display_value text: display_value
})); }));
} }
}); });
// $('#contact_person_name').val(res?.contact?.name || ''); // $('#contact_person_name').val(res?.contact?.name || '');
// $('#contact_person_mobile').val(res?.contact?.mobile || ''); // $('#contact_person_mobile').val(res?.contact?.mobile || '');
// $('#contact_person_email').val(res?.contact?.email || ''); // $('#contact_person_email').val(res?.contact?.email || '');
@ -911,7 +920,7 @@
console.log("res.data.source_policy_start_date", res.data.source_policy_start_date) console.log("res.data.source_policy_start_date", res.data.source_policy_start_date)
console.log("res.data.source_policy_end_date", res.data.source_policy_end_date) console.log("res.data.source_policy_end_date", res.data.source_policy_end_date)
$('#source_policy_start_date').val(res.data.source_policy_start_date); $('#source_policy_start_date').val(res.data.source_policy_start_date);
$('#source_policy_end_date').val(res.data.source_policy_end_date); $('#source_policy_end_date').val(res.data.source_policy_end_date);
@ -1024,7 +1033,7 @@
console.log(response.message, 'SUCCESS'); console.log(response.message, 'SUCCESS');
$('#appendArea_' + dataIncrement).append(response.data); $('#appendArea_' + dataIncrement).append(response.data);
console.log("Policy Type ID : ",policy_type_id); console.log("Policy Type ID : ", policy_type_id);
if (policy_type_id == 1 || policy_type_id == 6 || policy_type_id == 7) { if (policy_type_id == 1 || policy_type_id == 6 || policy_type_id == 7) {
let newId = 'appendAreaForClaim_' + dataIncrement; let newId = 'appendAreaForClaim_' + dataIncrement;
@ -1052,10 +1061,10 @@
$('.lifeClaimFields').show(); $('.lifeClaimFields').show();
} else { } else {
if(lead_type == 1){ if (lead_type == 1) {
updateRenewalFields(dataIncrement); updateRenewalFields(dataIncrement);
} }
// let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement; // let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
let incurred_claim_date_id = 'incurred_claim_date'; let incurred_claim_date_id = 'incurred_claim_date';
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, { var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
@ -1070,10 +1079,10 @@
console.log('Extracted increment:', increment); console.log('Extracted increment:', increment);
var policyStartDate = $("#source_policy_start_date"); var policyStartDate = $("#source_policy_start_date");
if(lead_type == 3){ if (lead_type == 3) {
policyStartDate = $("#policy_start_date"); policyStartDate = $("#policy_start_date");
} }
console.log('Selected Dates:', selectedDates); console.log('Selected Dates:', selectedDates);
console.log('policy start date instance', policyStartDate) console.log('policy start date instance', policyStartDate)
console.log('Policy Start Date:', policyStartDate.val()); console.log('Policy Start Date:', policyStartDate.val());
@ -1121,8 +1130,8 @@
newRow.className = 'form-row dynamic-form-row'; newRow.className = 'form-row dynamic-form-row';
if (increment > 1) { if (increment > 1) {
const hrElement = document.createElement('hr'); const hrElement = document.createElement('hr');
container.appendChild(hrElement); container.appendChild(hrElement);
} }
// Main div // Main div
@ -1458,8 +1467,8 @@
console.log('Lead Type:', lead_type); console.log('Lead Type:', lead_type);
let increment = input.id.split('_').pop(); // Extract increment let increment = input.id.split('_').pop(); // Extract increment
if(lead_type == 1){ if (lead_type == 1) {
return; return;
} }
let input_id = input.id; let input_id = input.id;
@ -1476,9 +1485,9 @@
policyStartDateInput = $('#source_policy_start_date'); policyStartDateInput = $('#source_policy_start_date');
console.log('Using Source Policy Start Date:', sourcePolicyDateVal); console.log('Using Source Policy Start Date:', sourcePolicyDateVal);
} else if (policyStartDateVal) { } else if (policyStartDateVal) {
if(input_id == "policy_start_date_1"){ if (input_id == "policy_start_date_1") {
policyStartDateInput = $('#policy_start_date_1'); policyStartDateInput = $('#policy_start_date_1');
}else{ } else {
policyStartDateInput = $('#policy_start_date'); policyStartDateInput = $('#policy_start_date');
} }
console.log('Using Policy Start Date:', policyStartDateVal); console.log('Using Policy Start Date:', policyStartDateVal);
@ -1522,7 +1531,7 @@
let annualised_claims = policy_run_days > 0 ? (incurred_claims / policy_run_days) * 365 : 0; let annualised_claims = policy_run_days > 0 ? (incurred_claims / policy_run_days) * 365 : 0;
// let annualised_claims_roundoff = annualised_claims.toFixed(2); // let annualised_claims_roundoff = annualised_claims.toFixed(2);
let annualised_claims_roundoff = Math.trunc(annualised_claims); let annualised_claims_roundoff = Math.trunc(annualised_claims);
console.log('Annualised Claims:', annualised_claims); console.log('Annualised Claims:', annualised_claims);
console.log('Annualised Claims (Rounded):', annualised_claims_roundoff); console.log('Annualised Claims (Rounded):', annualised_claims_roundoff);
@ -1531,9 +1540,9 @@
let premium_as_on_date = Number($('#premium_date').val()) || 0; let premium_as_on_date = Number($('#premium_date').val()) || 0;
console.log('Premium as on Date:', premium_as_on_date); console.log('Premium as on Date:', premium_as_on_date);
let incurred_claim_ratio = (incurred_claims > 0 && premium_as_on_date > 0) let incurred_claim_ratio = (incurred_claims > 0 && premium_as_on_date > 0) ?
? (incurred_claims / premium_as_on_date) * 100 (incurred_claims / premium_as_on_date) * 100 :
: 0; 0;
let incurred_claim_ratio_roundoff = isFinite(incurred_claim_ratio) ? incurred_claim_ratio.toFixed(2) : 0; let incurred_claim_ratio_roundoff = isFinite(incurred_claim_ratio) ? incurred_claim_ratio.toFixed(2) : 0;
console.log('Incurred Claim Ratio:', incurred_claim_ratio); console.log('Incurred Claim Ratio:', incurred_claim_ratio);
console.log('Incurred Claim Ratio (Rounded):', incurred_claim_ratio_roundoff); console.log('Incurred Claim Ratio (Rounded):', incurred_claim_ratio_roundoff);
@ -1541,8 +1550,8 @@
let earned_premium = premium_as_on_date > 0 ? (premium_as_on_date / 365) * policy_run_days : 0; let earned_premium = premium_as_on_date > 0 ? (premium_as_on_date / 365) * policy_run_days : 0;
// let earned_premium_roundoff = earned_premium.toFixed(2); // let earned_premium_roundoff = earned_premium.toFixed(2);
let earned_premium_roundoff = Math.trunc(earned_premium); let earned_premium_roundoff = Math.trunc(earned_premium);
console.log('Earned Premium:', earned_premium); console.log('Earned Premium:', earned_premium);
console.log('Earned Premium (Rounded):', earned_premium_roundoff); console.log('Earned Premium (Rounded):', earned_premium_roundoff);
$('#earned_premium').val(earned_premium_roundoff); $('#earned_premium').val(earned_premium_roundoff);
@ -1709,8 +1718,8 @@
$('#contact_person_summary').empty(); $('#contact_person_summary').empty();
$('#contact_person_summary').append($('<option>', { $('#contact_person_summary').append($('<option>', {
value: "", value: "",
text: "Select a Contact" text: "Select a Contact"
})); }));
$("#gst").val(""); $("#gst").val("");
@ -1737,8 +1746,8 @@
$("#client_branch_id").prop("selectedIndex", 0); $("#client_branch_id").prop("selectedIndex", 0);
$("#source_policy_id").empty(); $("#source_policy_id").empty();
$('#source_policy_id').append($('<option>', { $('#source_policy_id').append($('<option>', {
value: "", value: "",
text: "Select a Policy" text: "Select a Policy"
})); }));
$("#pan").val(""); $("#pan").val("");
@ -1768,7 +1777,7 @@
flatpickr("#" + incurred_claim_date_id, { flatpickr("#" + incurred_claim_date_id, {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
allowInput: false, allowInput: false,
onChange: function (selectedDates) { onChange: function(selectedDates) {
try { try {
let increment = this.input.id.split('_').pop(); let increment = this.input.id.split('_').pop();
let policyStartDate = $("#source_policy_start_date"); let policyStartDate = $("#source_policy_start_date");
@ -2053,7 +2062,7 @@
$('#source_policy_start_date').closest('.form-group').show(); $('#source_policy_start_date').closest('.form-group').show();
$('#source_policy_end_date').closest('.form-group').show(); $('#source_policy_end_date').closest('.form-group').show();
}else{ } else {
$('#source_policy_id').hide(); $('#source_policy_id').hide();
$('#source_policy_start_date').hide(); $('#source_policy_start_date').hide();
@ -2124,12 +2133,12 @@
}); });
} }
$('#exixting_client').change(function () { $('#exixting_client').change(function() {
$('#contact_person_summary').empty(); $('#contact_person_summary').empty();
$('#contact_person_summary').append($('<option>', { $('#contact_person_summary').append($('<option>', {
value: "", value: "",
text: "Select a Contact" text: "Select a Contact"
})); }));
$("#gst").val(""); $("#gst").val("");
@ -2202,6 +2211,4 @@
//----------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------
</script> </script>

View File

@ -1,43 +1,37 @@
<style> <style>
.table th, .table th,
.table td { .table td {
padding: 8px; padding: 8px;
} }
table.dataTable tbody td { table.dataTable tbody td {
padding: 4px 4px !important; padding: 4px 4px !important;
} }
.col-12 {
max-width: 98% !important; .dataTables_filter {
} position: absolute;
}
.dataTables_filter { .right-align-input {
position: absolute; text-align: right;
} }
.right-align-input { .center-align-input {
text-align: right; text-align: center;
} }
.center-align-input {
text-align: center;
}
</style> </style>
<div class="col-12"> <div class="container-fluid-min">
<h4 class="ml-1 mb-3"> <span class="font-color-black">Outstanding</span> </h4> <div class="col-12" id="outstanding_filter">
</div>
<div class="col-12" id="outstanding_filter">
<div id="accordion" class="mb-3"> <div id="accordion" class="mb-3">
<label id="filterAccordion" class="m-1 d-flex justify-content-between align-items-center"> <label id="filterAccordion" class="m-1 d-flex justify-content-between align-items-center">
<span class="font-color-black">Filters</span> <h4>Filters</h4>
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" <a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
aria-expanded="true"> aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-up mr-1 text-primary" style="font-size: 28px;"></i> <i id="icon" class="mdi mdi-chevron-up mr-1 text-primary" style="font-size: 28px;"></i>
</a> </a>
</label> </label>
<div class="card mb-1"> <div class="card mb-1">
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
@ -45,16 +39,16 @@ table.dataTable tbody td {
<div class="form-group"> <div class="form-group">
<div class="form-row"> <div class="form-row">
<!-- <div class="form-group col-md-3"> <!-- <div class="form-group col-md-3">
<label for="client_branch">Client<span class="text-danger"></span></label> <label for="client_branch">Client<span class="text-danger"></span></label>
<select class="form-control" id="client_id" name="client_id"> <select class="form-control" id="client_id" name="client_id">
<option value="0">Select Client</option> <option value="0">Select Client</option>
<?php <?php
if (isset($clients) && count($clients)) { if (isset($clients) && count($clients)) {
foreach ($clients as $key => $value) { foreach ($clients as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>"; echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
}
} }
}
?> ?>
</select> </select>
</div> --> </div> -->
@ -64,10 +58,10 @@ table.dataTable tbody td {
class="text-danger"></span></label> class="text-danger"></span></label>
<select class="form-control" id="insurer_id" name="insurer_id"> <select class="form-control" id="insurer_id" name="insurer_id">
<option value="0" selected>Select Insurer</option> <option value="0" selected>Select Insurer</option>
<?php if(isset($insurer) && count($insurer)){ ?> <?php if (isset($insurer) && count($insurer)) { ?>
<?php foreach ($insurer as $value) { ?> <?php foreach ($insurer as $value) { ?>
<option value="<?= $value['id']?>"><?= $value['name']?></option> <option value="<?= $value['id'] ?>"><?= $value['name'] ?></option>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
@ -77,10 +71,10 @@ table.dataTable tbody td {
class="text-danger"></span></label> class="text-danger"></span></label>
<select class="form-control" id="insurer_id" name="insurer_id"> <select class="form-control" id="insurer_id" name="insurer_id">
<option value="0" selected>Select Insurer Branch</option> <option value="0" selected>Select Insurer Branch</option>
<?php if(isset($insurer) && count($insurer)){ ?> <?php if (isset($insurer) && count($insurer)) { ?>
<?php foreach ($insurer as $value) { ?> <?php foreach ($insurer as $value) { ?>
<option value="<?= $value['id']?>"><?= $value['name']?></option> <option value="<?= $value['id'] ?>"><?= $value['name'] ?></option>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
@ -90,30 +84,30 @@ table.dataTable tbody td {
<select class="form-control" id="policy_type_id" name="policy_type_id"> <select class="form-control" id="policy_type_id" name="policy_type_id">
<option value="0">Select Policy Type</option> <option value="0">Select Policy Type</option>
<?php <?php
if (isset($policy_types) && count($policy_types)) { if (isset($policy_types) && count($policy_types)) {
foreach ($policy_types as $key => $value) { foreach ($policy_types as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>"; echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
}
} }
}
?> ?>
</select> </select>
</div> --> </div> -->
<!-- <div class="form-group col-md-3"> <!-- <div class="form-group col-md-3">
<label for="client_branch">Issuer<span class="text-danger">*</span></label> <label for="client_branch">Issuer<span class="text-danger">*</span></label>
<select class="form-control" id="issuer" name="issuer" required> <select class="form-control" id="issuer" name="issuer" required>
<option value="0">Select Issure</option> <option value="0">Select Issure</option>
<?php <?php
if (isset($issuer) && count($issuer)) { if (isset($issuer) && count($issuer)) {
foreach ($issuer as $key => $value) { foreach ($issuer as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>"; echo "<option value=" . $key . ">" . $value . "</option>";
}
} }
}
?> ?>
</select> </select>
</div> --> </div> -->
<!-- </div> <!-- </div>
<div class="form-row"> --> <div class="form-row"> -->
@ -123,11 +117,11 @@ table.dataTable tbody td {
onchange="hideDateField()"> onchange="hideDateField()">
<option value="0">Select Date Type</option> <option value="0">Select Date Type</option>
<?php <?php
if (isset($date_type) && count($date_type)) { if (isset($date_type) && count($date_type)) {
foreach ($date_type as $key => $value) { foreach ($date_type as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>"; echo "<option value='" . $key . "'>" . $value . "</option>";
}
} }
}
?> ?>
</select> </select>
</div> --> </div> -->
@ -135,7 +129,7 @@ table.dataTable tbody td {
<div class="form-group col-md-4" style="display: true;" id="date_div"> <div class="form-group col-md-4" style="display: true;" id="date_div">
<label>Statement Month<span class="text-danger"></span></label> <label>Statement Month<span class="text-danger"></span></label>
<div class="input-icon"> <div class="input-icon">
<input type="text" id="reportrange" class="form-control" readonly style="caret-color: transparent;"> <input type="text" id="reportrange" class="form-control" readonly style="caret-color: transparent;">
<i class="mdi mdi-calendar-blank-outline additional-icon"></i> <i class="mdi mdi-calendar-blank-outline additional-icon"></i>
</div> </div>
<!-- <!--
@ -164,319 +158,319 @@ table.dataTable tbody td {
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="col-12" id="outstanding_list">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Outstanding Report</h4>
</div>
<div class="col-12" id="outstanding_list">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Outstanding Report</h4>
</div> </div>
<div class="table-responsive">
</div> <table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
<div class="table-responsive"> <thead class="bg-light">
<table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light">
<tr>
<th>S.No</th>
<!-- <th>Client Name</th> -->
<th>Insurer</th>
<th>Insurer<br> Branch</th>
<th>Statement<br> Month</th>
<th>Statement<br> No</th>
<th>Invoice No</th>
<th>Invoice Status</th>
<th>Invoice Date</th>
<th>Invoice Amount</th>
<th>Realization <br>Amount</th>
<th>Outstanding <br>Amount</th>
</tr>
</thead>
<tbody>
<?php
// dd($outstanting_list);
if (isset($outstanting_list)) { ?>
<?php foreach($outstanting_list as $index => $row){ ?>
<tr> <tr>
<td><?= $index + 1 ?></td> <th>S.No</th>
<td><?php echo $row['short_name']; ?></td> <!-- <th>Client Name</th> -->
<td><?php echo $row['branch_name']; ?></td> <th>Insurer</th>
<td><?php echo change_date_format($row['month'],'Y-m-d','Y-m') ?></td> <th>Insurer<br> Branch</th>
<td><?php echo $row['stmt_sno']; ?></td> <th>Statement<br> Month</th>
<td><?php echo $row['invoice_no']; ?></td> <th>Statement<br> No</th>
<td class="center-align-input"><?php echo isset($row['invoice_status']) ? $row['invoice_status'] : ' - '; ?></td> <th>Invoice No</th>
<td><?php echo change_date_format($row['invoice_date'],'Y-m-d','d-M-Y'); ?></td> <th>Invoice Status</th>
<td class="right-align-input"><?php echo isset($row['invoice_amount']) ? $row['invoice_amount'] : '0.00'; ?></td> <th>Invoice Date</th>
<td class="right-align-input"><?php echo isset($row['total_paid']) ? $row['total_paid'] : '0.00'; ?></td> <th>Invoice Amount</th>
<td class="right-align-input"><?php echo isset($row['outstanding_amount']) ? $row['outstanding_amount'] : '0.00'; ?></td> <th>Realization <br>Amount</th>
<th>Outstanding <br>Amount</th>
</tr> </tr>
<?php } ?> </thead>
<?php } ?> <tbody>
</tbody> <?php
</table>
<div> // dd($outstanting_list);
if (isset($outstanting_list)) { ?>
<?php foreach ($outstanting_list as $index => $row) { ?>
<tr>
<td><?= $index + 1 ?></td>
<td><?php echo $row['short_name']; ?></td>
<td><?php echo $row['branch_name']; ?></td>
<td><?php echo change_date_format($row['month'], 'Y-m-d', 'Y-m') ?></td>
<td><?php echo $row['stmt_sno']; ?></td>
<td><?php echo $row['invoice_no']; ?></td>
<td class="center-align-input"><?php echo isset($row['invoice_status']) ? $row['invoice_status'] : ' - '; ?></td>
<td><?php echo change_date_format($row['invoice_date'], 'Y-m-d', 'd-M-Y'); ?></td>
<td class="right-align-input"><?php echo isset($row['invoice_amount']) ? $row['invoice_amount'] : '0.00'; ?></td>
<td class="right-align-input"><?php echo isset($row['total_paid']) ? $row['total_paid'] : '0.00'; ?></td>
<td class="right-align-input"><?php echo isset($row['outstanding_amount']) ? $row['outstanding_amount'] : '0.00'; ?></td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
<div>
</div>
</div> </div>
</div> </div><!-- end col -->
</div><!-- end col --> </div>
</div> </div>
</div> </div>
<script> <script>
$(document).ready(function () { $(document).ready(function() {
$('#collapseOne').on('show.bs.collapse', function () { $('#collapseOne').on('show.bs.collapse', function() {
// When open // When open
$('#icon').removeClass('mdi-chevron-down').addClass('mdi-chevron-up'); $('#icon').removeClass('mdi-chevron-down').addClass('mdi-chevron-up');
$('#filterAccordion').removeAttr("style"); // remove custom bg/border when open $('#filterAccordion').removeAttr("style"); // remove custom bg/border when open
});
$('#collapseOne').on('hide.bs.collapse', function () {
// When closed
$('#icon').removeClass('mdi-chevron-up').addClass('mdi-chevron-down');
// $('#filterAccordion').css({
// "background-color": "#F5FFFF",
// "border": "2px solid #F5FFFF",
// "border-radius": "10px",
// "box-shadow": "0px 4px 4px 0px #00000040"
// });
});
});
// Datatable document ready
$(document).ready(function() {
var ticketsTable = $('#scroll-horizontal-datatable');
if (ticketsTable.length) {
ticketsTable.DataTable({
scrollX: true,
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [
{
extend: 'collection',
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
className: 'btn app-btn-secondary ',
buttons: [{
extend: 'csv',
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
title: 'Policy-Tranction-BDS-List',
},
{
extend: 'excel',
text: '<i class="mdi mdi-file-excel " ></i><span class=" btn-custom"> EXCEL </span>',
title: 'Policy-Tranction-BDS-List',
customize: function(xlsx) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
var total = 0;
// Find cells in column AB (28th column in Excel)
$('row c[r^="AB"]', sheet).each(function() {
var value = parseFloat($('v', this)
.text()); // Get the value inside the cell
if (!isNaN(value)) {
total += value;
}
});
// Get the last row index and append the total row
var lastRow = $('row:last', sheet);
var rowIndex = parseInt(lastRow.attr('r')) +
2; // Find the next row index
var totalRow = '<row r="' + rowIndex + '">' +
'<c t="inlineStr" r="AA' + rowIndex +
'"><is><t>Total</t></is></c>' + // Insert "Total" in AA
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) +
'</v></c>' + // Insert sum in AB
'</row>';
// Append the new total row to the sheet
$(sheet).find('sheetData').append(totalRow);
}
}
]
}
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 25 // Set default number of rows per page (optional)
}); });
} else {
console.error("Table not found.");
}
});
$(document).ready(function() { $('#collapseOne').on('hide.bs.collapse', function() {
getURLParams() // When closed
$('#client_id').select2(); $('#icon').removeClass('mdi-chevron-up').addClass('mdi-chevron-down');
$('#insurer_id').select2(); // $('#filterAccordion').css({
$('#policy_type_id').select2(); // "background-color": "#F5FFFF",
}) // "border": "2px solid #F5FFFF",
// "border-radius": "10px",
function fetchEmpolyeeList(event) { // "box-shadow": "0px 4px 4px 0px #00000040"
event.preventDefault(); // Prevent default action // });
});
var start_date = $('#startDate').val();
var end_date = $('#endDate').val();
var client_id = $('#client_id').val();
var insurer_id = $('#insurer_id').val();
var policy_type_id = $('#policy_type_id').val();
var date_type = $('#date_type').val();
var issuer = $('#issuer').val();
console.log(start_date + '-' + end_date);
var queryParams = {
start_date: start_date,
end_date: end_date,
client_id: client_id,
insurer_id: insurer_id,
policy_type_id: policy_type_id,
date_type: date_type,
issuer: issuer,
};
const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
console.log(apiURL);
window.location.href = apiURL;
}
function objectToQueryString(obj) {
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
}
function getURLParams() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
const startDate = params.get('start_date') || 0; // Default to 0 if not found
const endDate = params.get('end_date') || 0; // Default to 0 if not found
const client_id = params.get('client_id') || 0; // Default to 0 if not found
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
const date_type = params.get('date_type') || 0; // Default to 0 if not found
const issuer = params.get('issuer') || 0; // Default to 0 if not found
hideDateField(date_type)
console.log('startDate', startDate)
console.log('endDate', endDate)
console.log('client_id', client_id)
console.log('insurer_id', insurer_id)
console.log('policy_type_id', policy_type_id)
console.log('date_type', date_type)
console.log('issuer', issuer)
// Log the values or use them as needed
console.log('Start Date:', startDate);
console.log('End Date:', endDate);
if (startDate != 0 && endDate != 0) {
setTimeout(function() {
$('#start_date').val(startDate)
$('#end_date').val(endDate)
$('#client_id').val(client_id).change()
$('#insurer_id').val(insurer_id).change()
$('#policy_type_id').val(policy_type_id).change()
$('#date_type').val(date_type)
$('#issuer').val(issuer)
}, 1000)
}
}
$(function() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
// Get start and end dates from URL parameters, or use default values
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
// Parse the dates to moment objects
var start = moment(startDateParam, 'DD-MM-YYYY');
var end = moment(endDateParam, 'DD-MM-YYYY');
// var start = moment().subtract(29, 'days');
// var end = moment();
function cb(start, end) {
// codeword : ***2***
// if you cross check means also uncomment "star1star" (***1***)
// $('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
$('#reportrange').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
$('#startDate').val(start.format('DD-MM-YYYY'));
$('#endDate').val(end.format('DD-MM-YYYY'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
// autoUpdateInput: false,
locale: {
format: 'DD-MM-YYYY' // 👈 force input format
},
ranges: {
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}
}, cb);
cb(start, end);
$('#clear-filters').on('click', function() {
// Reset all select dropdowns to the first option
$('#client_id').val('0').change();
$('#insurer_id').val('0').change();
$('#policy_type_id').val('0').change();
$('#date_type').val('0');
$('#issuer').val('0');
$('#date_div').hide()
// Reset the date range picker to default
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
$('#reportrange').data('daterangepicker').setEndDate(moment());
cb(start, end); // Update the displayed date range
}); });
}); // Datatable document ready
$(document).ready(function() {
function hideDateField(input = null) { var ticketsTable = $('#scroll-horizontal-datatable');
let val = $('#date_type').val();
if (input) { if (ticketsTable.length) {
val = input; ticketsTable.DataTable({
scrollX: true,
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [{
extend: 'collection',
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
className: 'btn app-btn-secondary ',
buttons: [{
extend: 'csv',
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
title: 'Policy-Tranction-BDS-List',
},
{
extend: 'excel',
text: '<i class="mdi mdi-file-excel " ></i><span class=" btn-custom"> EXCEL </span>',
title: 'Policy-Tranction-BDS-List',
customize: function(xlsx) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
var total = 0;
// Find cells in column AB (28th column in Excel)
$('row c[r^="AB"]', sheet).each(function() {
var value = parseFloat($('v', this)
.text()); // Get the value inside the cell
if (!isNaN(value)) {
total += value;
}
});
// Get the last row index and append the total row
var lastRow = $('row:last', sheet);
var rowIndex = parseInt(lastRow.attr('r')) +
2; // Find the next row index
var totalRow = '<row r="' + rowIndex + '">' +
'<c t="inlineStr" r="AA' + rowIndex +
'"><is><t>Total</t></is></c>' + // Insert "Total" in AA
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) +
'</v></c>' + // Insert sum in AB
'</row>';
// Append the new total row to the sheet
$(sheet).find('sheetData').append(totalRow);
}
}
]
}],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 25 // Set default number of rows per page (optional)
});
} else {
console.error("Table not found.");
}
});
$(document).ready(function() {
getURLParams()
$('#client_id').select2();
$('#insurer_id').select2();
$('#policy_type_id').select2();
})
function fetchEmpolyeeList(event) {
event.preventDefault(); // Prevent default action
var start_date = $('#startDate').val();
var end_date = $('#endDate').val();
var client_id = $('#client_id').val();
var insurer_id = $('#insurer_id').val();
var policy_type_id = $('#policy_type_id').val();
var date_type = $('#date_type').val();
var issuer = $('#issuer').val();
console.log(start_date + '-' + end_date);
var queryParams = {
start_date: start_date,
end_date: end_date,
client_id: client_id,
insurer_id: insurer_id,
policy_type_id: policy_type_id,
date_type: date_type,
issuer: issuer,
};
const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
console.log(apiURL);
window.location.href = apiURL;
} }
if (val != 0) { function objectToQueryString(obj) {
$('#date_div').show() return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
} else { }
$('#date_div').hide()
function getURLParams() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
const startDate = params.get('start_date') || 0; // Default to 0 if not found
const endDate = params.get('end_date') || 0; // Default to 0 if not found
const client_id = params.get('client_id') || 0; // Default to 0 if not found
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
const date_type = params.get('date_type') || 0; // Default to 0 if not found
const issuer = params.get('issuer') || 0; // Default to 0 if not found
hideDateField(date_type)
console.log('startDate', startDate)
console.log('endDate', endDate)
console.log('client_id', client_id)
console.log('insurer_id', insurer_id)
console.log('policy_type_id', policy_type_id)
console.log('date_type', date_type)
console.log('issuer', issuer)
// Log the values or use them as needed
console.log('Start Date:', startDate);
console.log('End Date:', endDate);
if (startDate != 0 && endDate != 0) {
setTimeout(function() {
$('#start_date').val(startDate)
$('#end_date').val(endDate)
$('#client_id').val(client_id).change()
$('#insurer_id').val(insurer_id).change()
$('#policy_type_id').val(policy_type_id).change()
$('#date_type').val(date_type)
$('#issuer').val(issuer)
}, 1000)
}
}
$(function() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
// Get start and end dates from URL parameters, or use default values
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
// Parse the dates to moment objects
var start = moment(startDateParam, 'DD-MM-YYYY');
var end = moment(endDateParam, 'DD-MM-YYYY');
// var start = moment().subtract(29, 'days');
// var end = moment();
function cb(start, end) {
// codeword : ***2***
// if you cross check means also uncomment "star1star" (***1***)
// $('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
$('#reportrange').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
$('#startDate').val(start.format('DD-MM-YYYY'));
$('#endDate').val(end.format('DD-MM-YYYY'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
// autoUpdateInput: false,
locale: {
format: 'DD-MM-YYYY' // 👈 force input format
},
ranges: {
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}
}, cb);
cb(start, end);
$('#clear-filters').on('click', function() {
// Reset all select dropdowns to the first option
$('#client_id').val('0').change();
$('#insurer_id').val('0').change();
$('#policy_type_id').val('0').change();
$('#date_type').val('0');
$('#issuer').val('0');
$('#date_div').hide()
// Reset the date range picker to default
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
$('#reportrange').data('daterangepicker').setEndDate(moment());
cb(start, end); // Update the displayed date range
});
});
function hideDateField(input = null) {
let val = $('#date_type').val();
if (input) {
val = input;
}
if (val != 0) {
$('#date_div').show()
} else {
$('#date_div').hide()
}
} }
}
function sendPolicyTransactionID(event, pt_id) { function sendPolicyTransactionID(event, pt_id) {
event.preventDefault(); // Prevent default action event.preventDefault(); // Prevent default action
console.log(pt_id); console.log(pt_id);
var queryParams = { var queryParams = {
pt_id: pt_id, pt_id: pt_id,
}; };
const queryString = objectToQueryString(queryParams); const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-policy-list').attr('href') + "?" + queryString; const apiURL = $('#get-policy-list').attr('href') + "?" + queryString;
console.log(apiURL); console.log(apiURL);
window.location.href = apiURL; window.location.href = apiURL;
} }
</script> </script>

File diff suppressed because it is too large Load Diff

View File

@ -144,9 +144,6 @@ table.dataTable tbody td {
} }
</style> </style>
<div class="col-12">
<h4 class="ml-1 mb-3"> <span class="font-color-black">Policy</span> </h4>
</div>
<div class="col-12" id="inception_filter"> <div class="col-12" id="inception_filter">
<div id="accordion" class="mb-3"> <div id="accordion" class="mb-3">
@ -271,7 +268,7 @@ table.dataTable tbody td {
<div class="card-body"> <div class="card-body">
<div class="row" style="margin-bottom:1rem;"> <div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;"> <div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Policy </h4> <h4 style="position: relative;">Policy List </h4>
</div> </div>
<div class="col-3" id="status_change" style="text-align: right; position: relative;top: 56px; left: 291px;"> <div class="col-3" id="status_change" style="text-align: right; position: relative;top: 56px; left: 291px;">

View File

@ -1,17 +1,17 @@
<style> <style>
.custom-dropdown-menu { .custom-dropdown-menu {
display: none; display: none;
position: fixed; position: fixed;
background-color: #ffffff !important; background-color: #ffffff !important;
border: 1px solid rgba(0,0,0,.15); border: 1px solid rgba(0, 0, 0, .15);
border-radius: 0.25rem; border-radius: 0.25rem;
padding: 0.5rem 0; padding: 0.5rem 0;
min-width: 10rem; min-width: 10rem;
z-index: 9999; z-index: 9999;
box-shadow: 0 0 10px rgba(0,0,0,0.1); box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
} }
.custom-dropdown-menu .dropdown-item { .custom-dropdown-menu .dropdown-item {
display: block !important; display: block !important;
width: 100% !important; width: 100% !important;
padding: 0.5rem 1rem !important; padding: 0.5rem 1rem !important;
@ -24,25 +24,25 @@
border: 0 !important; border: 0 !important;
text-decoration: none !important; text-decoration: none !important;
position: relative !important; position: relative !important;
} }
.custom-dropdown-menu .dropdown-item:hover { .custom-dropdown-menu .dropdown-item:hover {
background-color: #f8f9fa !important; background-color: #f8f9fa !important;
color: #16181b !important; color: #16181b !important;
cursor: pointer !important; cursor: pointer !important;
} }
.custom-dropdown-menu .dropdown-item i { .custom-dropdown-menu .dropdown-item i {
margin-right: 8px !important; margin-right: 8px !important;
vertical-align: middle !important; vertical-align: middle !important;
} }
.table tbody tr { .table tbody tr {
cursor: pointer; cursor: pointer;
} }
/* Ensure the dropdown menu has a solid background */ /* Ensure the dropdown menu has a solid background */
.custom-dropdown-menu::before { .custom-dropdown-menu::before {
content: ''; content: '';
position: absolute; position: absolute;
top: 0; top: 0;
@ -51,26 +51,28 @@
bottom: 0; bottom: 0;
background: #ffffff; background: #ffffff;
z-index: -1; z-index: -1;
} }
/* Add a subtle backdrop effect */ /* Add a subtle backdrop effect */
.custom-dropdown-menu::after { .custom-dropdown-menu::after {
content: ''; content: '';
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
background: rgba(0,0,0,0.05); background: rgba(0, 0, 0, 0.05);
z-index: -2; z-index: -2;
pointer-events: none; pointer-events: none;
} }
</style> </style>
<div class="row" id="policy_list">
<div class="container-fluid-min">
<div class="row" id="policy_list">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-body maincard"> <div class="card-body maincard">
<!-- <div class="row" style="margin-bottom:1rem;"> <!-- <div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;"> <div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Policy Type List</h4> <h4 style="position: relative;">Policy Type List</h4>
</div> </div>
@ -78,270 +80,270 @@
<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> <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>
</div> </div>
</div> --> </div> -->
<!-- <div class="row" style="margin-bottom:1rem;"> <!-- <div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;"> <div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Policy</h4> <h4 style="position: relative;">Policy</h4>
</div> </div>
</div> --> </div> -->
<table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" <table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
id="tickets-table"> id="tickets-table">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th class="font-weight-medium">Policy Type</th> <th class="font-weight-medium">Policy Type</th>
<th class="font-weight-medium">Policy Long Name</th> <th class="font-weight-medium">Policy Long Name</th>
<th class="font-weight-medium">BAP</th> <th class="font-weight-medium">BAP</th>
<th class="font-weight-medium">Category</th> <th class="font-weight-medium">Category</th>
<th class="font-weight-medium">BAP Category</th> <th class="font-weight-medium">BAP Category</th>
<th class="font-weight-medium">Action</th> <th class="font-weight-medium">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php if(is_array($policyList)) {foreach($policyList as $row){ ?> <?php if (is_array($policyList)) {
<tr> foreach ($policyList as $row) { ?>
<td><?php echo $row['policy_type']; ?> </td> <tr>
<td><?php echo $row['long_name']; ?> </td> <td><?php echo $row['policy_type']; ?> </td>
<td><?php echo $row['bap']; ?></td> <td><?php echo $row['long_name']; ?> </td>
<td><?php echo $row['allocg']; ?></td> <td><?php echo $row['bap']; ?></td>
<td><?php echo $row['alloci']; ?></td> <td><?php echo $row['allocg']; ?></td>
<td> <td><?php echo $row['alloci']; ?></td>
<div class="btn-group dropdown"> <td>
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a> <div class="btn-group dropdown">
<div class="dropdown-menu dropdown-menu-right"> <a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<a class="dropdown-item" href="<?= base_url("master/policy/list/"); ?><?= $row['id'];?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a> <div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removePolciyType(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a> <a class="dropdown-item" href="<?= base_url("master/policy/list/"); ?><?= $row['id']; ?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
</div> <a class="dropdown-item" data-id="<?= $row['id']; ?>" onclick="removePolciyType(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
</div> </div>
</td> </div>
</tr> </td>
<?php }}?> </tr>
<?php }
} ?>
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
</div>
</div><!-- end col --> </div><!-- end col -->
</div>
</div> </div>
<!-- end row --> <!-- end row -->
<script> <script>
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function() {
const table = document.getElementById("tickets-table"); const table = document.getElementById("tickets-table");
// Create custom dropdown // Create custom dropdown
function createCustomDropdown(row) { function createCustomDropdown(row) {
// Get the original dropdown items // Get the original dropdown items
const originalDropdown = row.querySelector('.dropdown-menu'); const originalDropdown = row.querySelector('.dropdown-menu');
if (!originalDropdown) return null; if (!originalDropdown) return null;
// Create new dropdown with proper background and spacing // Create new dropdown with proper background and spacing
const customDropdown = document.createElement('div'); const customDropdown = document.createElement('div');
customDropdown.className = 'custom-dropdown-menu'; customDropdown.className = 'custom-dropdown-menu';
// Copy inner content while maintaining icon alignment // Copy inner content while maintaining icon alignment
customDropdown.innerHTML = originalDropdown.innerHTML; customDropdown.innerHTML = originalDropdown.innerHTML;
return customDropdown; return customDropdown;
} }
let activeDropdown = null; let activeDropdown = null;
// Add click event listener to rows // Add click event listener to rows
table.querySelectorAll("tbody tr").forEach(row => { table.querySelectorAll("tbody tr").forEach(row => {
const customDropdown = createCustomDropdown(row); const customDropdown = createCustomDropdown(row);
if (!customDropdown) return; if (!customDropdown) return;
document.body.appendChild(customDropdown);
row.addEventListener("click", function(event) { document.body.appendChild(customDropdown);
// Ignore clicks on the action column
if (event.target.closest('td:last-child')) {
return;
}
// Hide any active dropdown row.addEventListener("click", function(event) {
if (activeDropdown) { // Ignore clicks on the action column
activeDropdown.style.display = 'none'; if (event.target.closest('td:last-child')) {
} return;
}
// Get click position // Hide any active dropdown
const rect = event.target.getBoundingClientRect(); if (activeDropdown) {
activeDropdown.style.display = 'none';
}
// Position the dropdown with some offset // Get click position
customDropdown.style.display = 'block'; const rect = event.target.getBoundingClientRect();
customDropdown.style.position = 'fixed';
customDropdown.style.left = `${rect.left}px`;
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
// Set as active dropdown // Position the dropdown with some offset
activeDropdown = customDropdown; customDropdown.style.display = 'block';
customDropdown.style.position = 'fixed';
customDropdown.style.left = `${rect.left}px`;
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
event.stopPropagation(); // Set as active dropdown
}); activeDropdown = customDropdown;
// Preserve click handlers event.stopPropagation();
customDropdown.querySelectorAll('.dropdown-item').forEach(item => { });
item.addEventListener('click', function(e) {
e.preventDefault(); // Preserve click handlers
const onclickAttr = this.getAttribute('onclick'); customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
if (onclickAttr) { item.addEventListener('click', function(e) {
eval(onclickAttr); e.preventDefault();
} const onclickAttr = this.getAttribute('onclick');
if (onclickAttr) {
const href = this.getAttribute('href'); eval(onclickAttr);
if (href && href !== '#') { }
window.location.href = href;
} const href = this.getAttribute('href');
if (href && href !== '#') {
e.stopPropagation(); window.location.href = href;
}); }
e.stopPropagation();
}); });
});
}); });
// Close dropdown when clicking outside // Close dropdown when clicking outside
document.addEventListener("click", function() { document.addEventListener("click", function() {
if (activeDropdown) { if (activeDropdown) {
activeDropdown.style.display = 'none'; activeDropdown.style.display = 'none';
activeDropdown = null; activeDropdown = null;
} }
}); });
}); });
</script> </script>
<script> <script>
$(document).ready(function() {
$(document).ready(function(){ $('#tickets-table').DataTable({
dom: "<'d-flex justify-content-between align-items-center'<'datatable-search'f><'datatable-buttons'B>>" +
$('#tickets-table').DataTable({ "<'row'<'col-sm-12'tr>>" +
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>",
"<'row'<'col-sm-12'tr>>" + buttons: [{
"<'row'<'col-sm-5'i><'col-sm-7'p>>" , extend: 'csv',
buttons: [ text: 'CSV',
{ title: 'PolicyTypeList',
extend: 'csv', exportOptions: {
text: 'CSV', columns: ':not(:last-child)'
title: 'PolicyTypeList', }
exportOptions: { }],
columns: ':not(:last-child)'
}
}
],
language: { language: {
search: "_INPUT_", search: "_INPUT_",
searchPlaceholder: "Search..." searchPlaceholder: "Search..."
}, },
paging: true , paging: true,
}); });
}) })
const btnExport = document.querySelector("#btnExport"); const btnExport = document.querySelector("#btnExport");
const tableElement = document.querySelector("#tickets-table"); const tableElement = document.querySelector("#tickets-table");
btnExport.addEventListener("click", () => { btnExport.addEventListener("click", () => {
const obj = new csvExport(tableElement); const obj = new csvExport(tableElement);
const csvData = obj.exportCsv(); const csvData = obj.exportCsv();
const blob = new Blob([csvData], { type: "text/csv" }); const blob = new Blob([csvData], {
const url = URL.createObjectURL(blob); type: "text/csv"
const a = document.createElement("a"); });
a.href = url; const url = URL.createObjectURL(blob);
a.download = "PolicyTypeList.csv"; const a = document.createElement("a");
a.click(); a.href = url;
a.download = "PolicyTypeList.csv";
a.click();
setTimeout(() => { setTimeout(() => {
URL.revokeObjectURL(url); URL.revokeObjectURL(url);
}, 500); }, 500);
}); });
class csvExport { class csvExport {
constructor(table, header = true) { constructor(table, header = true) {
this.table = table; this.table = table;
this.rows = Array.from(table.querySelectorAll("tr")); this.rows = Array.from(table.querySelectorAll("tr"));
if (!header && this.rows[0].querySelectorAll("th").length) { if (!header && this.rows[0].querySelectorAll("th").length) {
this.rows.shift(); this.rows.shift();
}
}
exportCsv() {
const lines = [];
const ncols = this._longestRow();
for (const row of this.rows) {
let line = "";
for (let i = 0; i < ncols - 1; i++) { // Exclude the last column
if (row.children[i] !== undefined) {
line += csvExport.safeData(row.children[i]);
}
line += i !== ncols - 2 ? "," : ""; // Adjusted for the last column exclusion
} }
lines.push(line);
} }
return lines.join("\n");
exportCsv() {
const lines = [];
const ncols = this._longestRow();
for (const row of this.rows) {
let line = "";
for (let i = 0; i < ncols - 1; i++) { // Exclude the last column
if (row.children[i] !== undefined) {
line += csvExport.safeData(row.children[i]);
}
line += i !== ncols - 2 ? "," : ""; // Adjusted for the last column exclusion
}
lines.push(line);
}
return lines.join("\n");
}
_longestRow() {
return this.rows.reduce((length, row) => (row.childElementCount > length ? row.childElementCount : length), 0);
}
static safeData(td) {
let data = td.textContent;
//Replace all double quote to two double quotes
data = data.replace(/"/g, `""`);
//Replace , and \n to double quotes
data = /[",\n"]/.test(data) ? `"${data}"` : data;
return data;
}
} }
_longestRow() {
return this.rows.reduce((length, row) => (row.childElementCount > length ? row.childElementCount : length), 0);
}
static safeData(td) { function removePolciyType(element) {
let data = td.textContent;
//Replace all double quote to two double quotes
data = data.replace(/"/g, `""`);
//Replace , and \n to double quotes
data = /[",\n"]/.test(data) ? `"${data}"` : data;
return data;
}
}
function removePolciyType(element) {
Swal.fire({ Swal.fire({
title: "Are you sure?", title: "Are you sure?",
text: "You need to remove this!", text: "You need to remove this!",
icon: "info", icon: "info",
showCancelButton: true, showCancelButton: true,
confirmButtonColor: "#3085d6", confirmButtonColor: "#3085d6",
confirmButtonText: "Yes", confirmButtonText: "Yes",
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
var id = element.getAttribute('data-id'); var id = element.getAttribute('data-id');
var form_action = '<?= base_url("master/policy/remove/") ?>' + id; var form_action = '<?= base_url("master/policy/remove/") ?>' + id;
$.ajax({ $.ajax({
url: form_action, url: form_action,
type: "GET", type: "GET",
dataType: 'json', dataType: 'json',
processData: false, processData: false,
contentType: false, contentType: false,
success: function(res) { success: function(res) {
// console.log(res.status == true); // console.log(res.status == true);
if(res){ if (res) {
if (res.status == true) { if (res.status == true) {
toastr.success('Policy type removed successfully', 'success'); toastr.success('Policy type removed successfully', 'success');
location.reload(); location.reload();
} else { } else {
toastr.warning('Failed to remove policy type', 'warning'); toastr.warning('Failed to remove policy type', 'warning');
} }
} }
}, },
error: function (xhr, status, error) { error: function(xhr, status, error) {
console.error(xhr.responseText); console.error(xhr.responseText);
console.error(status, error); console.error(status, error);
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Failed to remove policy type', 'warning'); toastr.warning('Failed to remove policy type', 'warning');
} }
}); });
} }
}); });
} }
</script> </script>

View File

@ -1,17 +1,14 @@
<div class="col-12"> <div class="container-fluid-min">
<h4 class="ml-1 mb-3"> <span class="font-color-black">Renewal Policy</span> </h4>
</div>
<div class="col-xl-12"> <div class="col-xl-12">
<div id="accordion" class="mb-3"> <div id="accordion" class="mb-3">
<label id="filterAccordion" class="m-1 d-flex justify-content-between align-items-center"> <label id="filterAccordion" class="m-1 d-flex justify-content-between align-items-center">
<span class="font-color-black">Filters</span> <h4>Filters</h4>
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" <a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
aria-expanded="true"> aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-up mr-1 text-primary" style="font-size: 28px;"></i> <i id="icon" class="mdi mdi-chevron-up mr-1 text-primary" style="font-size: 28px;"></i>
</a> </a>
</label> </label>
<div class="card mb-1"> <div class="card mb-1">
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body"> <div class="card-body">
<!-- <div class="text-center"> --> <!-- <div class="text-center"> -->
@ -24,8 +21,8 @@
<span></span> <i class="mdi mdi-menu-down"></i> <span></span> <i class="mdi mdi-menu-down"></i>
</div> --> </div> -->
<div class="input-icon"> <div class="input-icon">
<input type="text" id="reportrange" class="form-control" readonly style="caret-color: transparent;"> <input type="text" id="reportrange" class="form-control" readonly style="caret-color: transparent;">
<i class="mdi mdi-calendar-blank-outline additional-icon"></i> <i class="mdi mdi-calendar-blank-outline additional-icon"></i>
</div> </div>
<input type="hidden" id="startDate" value=<?= $default_start ?>> <input type="hidden" id="startDate" value=<?= $default_start ?>>
<input type="hidden" id="endDate" value=<?= $default_end ?>> <input type="hidden" id="endDate" value=<?= $default_end ?>>
@ -36,11 +33,11 @@
<select class="form-control" id="issuer" name="issuer"> <select class="form-control" id="issuer" name="issuer">
<option value="">Select Issuer</option> <option value="">Select Issuer</option>
<?php <?php
if (isset($issuer) && count($issuer)) { if (isset($issuer) && count($issuer)) {
foreach ($issuer as $key => $value) { foreach ($issuer as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>"; echo "<option value=" . $key . ">" . $value . "</option>";
}
} }
}
?> ?>
</select> </select>
</div> </div>
@ -78,168 +75,172 @@
</div> </div>
<div id="report"></div> <div id="report"></div>
</div>
<script> <script>
let client_list = []; let client_list = [];
$(document).ready(function() { $(document).ready(function() {
getClientAndBranchAndPolicy(); getClientAndBranchAndPolicy();
$('#client_id').select2(); $('#client_id').select2();
}) })
$(function() { $(function() {
var start = $('#startDate').val(); var start = $('#startDate').val();
var end = $('#endDate').val(); var end = $('#endDate').val();
var start = moment(start, 'DD/MM/YYYY'); var start = moment(start, 'DD/MM/YYYY');
var end = moment(end, 'DD/MM/YYYY'); var end = moment(end, 'DD/MM/YYYY');
function cb(start, end) { function cb(start, end) {
$('#reportrange').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY')); $('#reportrange').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
$('#startDate').val(start.format('DD-MM-YYYY')); $('#startDate').val(start.format('DD-MM-YYYY'));
$('#endDate').val(end.format('DD-MM-YYYY')); $('#endDate').val(end.format('DD-MM-YYYY'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
locale: { format: 'DD-MM-YYYY' },
ranges: {
'Today': [moment(), moment()],
'Next 7 Days': [moment(), moment().add(6, 'days')], // Next 7 Days
'Next 30 Days': [moment(), moment().add(29, 'days')], // Next 30 Days
'Next Month': [moment().add(1, 'month').startOf('month'), moment().add(1, 'month').endOf(
'month')], // Next Month
'Next Year': [moment().add(1, 'year').startOf('year'), moment().add(1, 'year').endOf(
'year')], // Next Year
'Current Year': [moment().startOf('year'), moment().endOf('year')] // Current Year
}
}, cb);
cb(start, end);
});
// ----------------------------------------------------------------------------------------------
function fetchReportPage() {
var fromDate = $('#startDate').val();
var toDate = $('#endDate').val();
var client_id = $('#client_id').val();
var client_type = $('#client_type').val();
var issuer = $('#issuer').val();
var requestData = {
fromDate: fromDate,
toDate: toDate,
client_id: client_id,
client_type: client_type,
issuer: issuer,
};
console.log(typeof fromDate);
var url = '<?= base_url('/bdsReport/renewal_report') ?>';
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
if (response.status == true) {
$('#report').html(response.html);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
} else {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
let message = response.message;
toastr.error(message, 'ERROR');
} }
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
locale: {
format: 'DD-MM-YYYY'
},
ranges: {
'Today': [moment(), moment()],
'Next 7 Days': [moment(), moment().add(6, 'days')], // Next 7 Days
'Next 30 Days': [moment(), moment().add(29, 'days')], // Next 30 Days
'Next Month': [moment().add(1, 'month').startOf('month'), moment().add(1, 'month').endOf(
'month')], // Next Month
'Next Year': [moment().add(1, 'year').startOf('year'), moment().add(1, 'year').endOf(
'year')], // Next Year
'Current Year': [moment().startOf('year'), moment().endOf('year')] // Current Year
}, function(xhr, status, error) { }
console.error('Error fetching data:', error); }, cb);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the report page.', 'ERROR');
$('.loader').fadeOut(); cb(start, end);
$('.loader-mask').delay(350).fadeOut('slow');
}); });
}
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
//get client , branch, policy data function fetchReportPage() {
function getClientAndBranchAndPolicy() {
$.ajax({ var fromDate = $('#startDate').val();
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>', var toDate = $('#endDate').val();
type: "GET", var client_id = $('#client_id').val();
dataType: 'json', var client_type = $('#client_type').val();
success: function(res) { var issuer = $('#issuer').val();
var requestData = {
fromDate: fromDate,
toDate: toDate,
client_id: client_id,
client_type: client_type,
issuer: issuer,
};
console.log(typeof fromDate);
var url = '<?= base_url('/bdsReport/renewal_report') ?>';
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
if (response.status == true) {
$('#report').html(response.html);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
console.log('getClientAndBranchAndPolicy', res);
if (res.status == true) {
client_list = res.client_data;
appendClients(res.client_data);
} else { } else {
console.log('No data found'); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
let message = response.message;
toastr.error(message, 'ERROR');
} }
},
error: function(xhr, status, error) {
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText); console.error(xhr.responseText);
console.error(status, error); toastr.error('An error occurred while fetching the report page.', 'ERROR');
}
});
}
//append the clients data $('.loader').fadeOut();
function appendClients(data) { $('.loader-mask').delay(350).fadeOut('slow');
$('#client_id').empty();
$('#client_id').append($('<option>', {
value: '0',
text: 'Select Client'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.client_name,
'data-name': item.client_name,
}); });
}
$('#client_id').append(option).select2(); // ----------------------------------------------------------------------------------------------
});
} //get client , branch, policy data
function getClientAndBranchAndPolicy() {
$.ajax({
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
type: "GET",
dataType: 'json',
success: function(res) {
$('#client_type').on('change', function() { console.log('getClientAndBranchAndPolicy', res);
if (res.status == true) {
var selectedClientType = $(this).val(); client_list = res.client_data;
appendClients(res.client_data);
// console.log('selectedClientType', selectedClientType); } else {
console.log('No data found');
// Clear and add default options for client }
$('#client_id').empty().append($('<option>', { },
value: '', error: function(xhr, status, error) {
text: 'Select Client' console.error(xhr.responseText);
})) console.error(status, error);
// Populate client options based on selected client type
if (selectedClientType) {
$.each(client_list, function(index, item) {
if (item.client_type == selectedClientType) {
var option = $('<option>', {
value: item.id,
text: item.client_name,
});
$('#client_id').append(option);
} }
}); });
}
//append the clients data
function appendClients(data) {
$('#client_id').empty();
$('#client_id').append($('<option>', {
value: '0',
text: 'Select Client'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.client_name,
'data-name': item.client_name,
});
$('#client_id').append(option).select2();
});
} }
// Initialize or refresh Select2 for both dropdowns $('#client_type').on('change', function() {
$('#client_id').select2();
}); var selectedClientType = $(this).val();
// console.log('selectedClientType', selectedClientType);
// Clear and add default options for client
$('#client_id').empty().append($('<option>', {
value: '',
text: 'Select Client'
}))
// Populate client options based on selected client type
if (selectedClientType) {
$.each(client_list, function(index, item) {
if (item.client_type == selectedClientType) {
var option = $('<option>', {
value: item.id,
text: item.client_name,
});
$('#client_id').append(option);
}
});
}
// Initialize or refresh Select2 for both dropdowns
$('#client_id').select2();
});
</script> </script>

View File

@ -1,20 +1,17 @@
<style> <style>
.col-12 {
max-width: 98% !important;
}
</style> </style>
<div class="container-fluid-min">
<div class="col-12" id="bds_filter"> <div class="col-12" id="bds_filter">
<div id="accordion" class="mb-3"> <div id="accordion" class="mb-3">
<label id="filterAccordion" class="m-1 d-flex justify-content-between align-items-center"> <label id="filterAccordion" class="m-1 d-flex justify-content-between align-items-center">
<span class="font-color-black">Filter</span> <span class="font-color-black">Filter</span>
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" <a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
aria-expanded="true"> aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-up mr-1 text-primary" style="font-size: 28px;"></i> <i id="icon" class="mdi mdi-chevron-up mr-1 text-primary" style="font-size: 28px;"></i>
</a> </a>
</label> </label>
<div class="card mb-1"> <div class="card mb-1">
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
@ -38,7 +35,7 @@
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="insurer_id"> Insurer <span id="base_danger" class="text-danger"></span></label> <label for="insurer_id"> Insurer <span id="base_danger" class="text-danger"></span></label>
<select class="form-control" id="insurer_id" name="insurer_id" onchange="getClientPolicyDataBasedOnClientAndInsuer()" > <select class="form-control" id="insurer_id" name="insurer_id" onchange="getClientPolicyDataBasedOnClientAndInsuer()">
<option value="0" selected>Select Insurer</option> <option value="0" selected>Select Insurer</option>
</select> </select>
</div> </div>
@ -55,18 +52,18 @@
<select class="form-control" id="policy_type_id" name="policy_type_id" onchange="getClientPolicyDataBasedOnClientAndInsuer()"> <select class="form-control" id="policy_type_id" name="policy_type_id" onchange="getClientPolicyDataBasedOnClientAndInsuer()">
<option value="0">Select Policy Type</option> <option value="0">Select Policy Type</option>
<?php <?php
if (isset($policy_types) && count($policy_types)) { if (isset($policy_types) && count($policy_types)) {
foreach ($policy_types as $key => $value) { foreach ($policy_types as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>"; echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
}
} }
}
?> ?>
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="client_policy_id"> Client Policy <span id="base_danger" class="text-danger"></span></label> <label for="client_policy_id"> Client Policy <span id="base_danger" class="text-danger"></span></label>
<select class="form-control" id="client_policy_id" name="client_policy_id" > <select class="form-control" id="client_policy_id" name="client_policy_id">
<option value="0" selected>Select client policy</option> <option value="0" selected>Select client policy</option>
</select> </select>
</div> </div>
@ -76,25 +73,25 @@
<select class="form-control" id="issuer" name="issuer" required> <select class="form-control" id="issuer" name="issuer" required>
<option value="0">Select Issure</option> <option value="0">Select Issure</option>
<?php <?php
if (isset($issuer) && count($issuer)) { if (isset($issuer) && count($issuer)) {
foreach ($issuer as $key => $value) { foreach ($issuer as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>"; echo "<option value=" . $key . ">" . $value . "</option>";
}
} }
}
?> ?>
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="user_id">Users<span class="text-danger"></span></label> <label for="user_id">Users<span class="text-danger"></span></label>
<select class="form-control" id="user_id" name="user_id" > <select class="form-control" id="user_id" name="user_id">
<option value="0">Select user</option> <option value="0">Select user</option>
<?php <?php
if (isset($users) && count($users)) { if (isset($users) && count($users)) {
foreach ($users as $key => $value) { foreach ($users as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['first_name'] . "</option>"; echo "<option value='" . $value['id'] . "'>" . $value['first_name'] . "</option>";
}
} }
}
?> ?>
</select> </select>
</div> </div>
@ -104,11 +101,11 @@
<select class="form-control" id="date_type" name="date_type" onchange="hideDateField(); changeTitle();"> <select class="form-control" id="date_type" name="date_type" onchange="hideDateField(); changeTitle();">
<option value="0">Select Date Type</option> <option value="0">Select Date Type</option>
<?php <?php
if (isset($date_type) && count($date_type)) { if (isset($date_type) && count($date_type)) {
foreach ($date_type as $key => $value) { foreach ($date_type as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>"; echo "<option value='" . $key . "'>" . $value . "</option>";
}
} }
}
?> ?>
</select> </select>
</div> </div>
@ -116,7 +113,7 @@
<div class="form-group col-md-3" style="display: none;" id="date_div"> <div class="form-group col-md-3" style="display: none;" id="date_div">
<label>Date<span class="text-danger"></span></label> <label>Date<span class="text-danger"></span></label>
<div class="input-icon"> <div class="input-icon">
<input type="text" id="reportrange" class="form-control" readonly style="caret-color: transparent;"> <input type="text" id="reportrange" class="form-control" readonly style="caret-color: transparent;">
<i class="mdi mdi-calendar-blank-outline additional-icon"></i> <i class="mdi mdi-calendar-blank-outline additional-icon"></i>
</div> </div>
<input type="hidden" id="startDate"> <input type="hidden" id="startDate">
@ -125,7 +122,7 @@
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;"> <div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
<a href="<?= base_url("/policy_tranction/report/list"); ?>" class="btn btn-secondary" id="clear-filters">Clear</a> <a href="<?= base_url("/policy_tranction/report/list"); ?>" class="btn btn-secondary" id="clear-filters">Clear</a>
<a href="<?= base_url("/policy_tranction/report/list"); ?>" class="btn btn-primary" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a> <a href="<?= base_url("/policy_tranction/report/list"); ?>" class="btn btn-primary" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
</div> </div>
</div> </div>
@ -142,429 +139,421 @@
</div> </div>
</div> </div>
</div> </div>
<!-- end page title --> <!-- end page title -->
<div id="file_list"> <div id="file_list">
<?php include('report_bds.php'); ?> <?php include('report_bds.php'); ?>
</div>
</div> </div>
<script> <script>
let client_list = [];
let client_list = []; let branch_list = [];
let branch_list = []; let policy_list = [];
let policy_list = []; let insurer_list = [];
let insurer_list = []; let insurer_branch_list = [];
let insurer_branch_list = [];
$(document).ready(function() {
$(document).ready(function() {
getClientAndBranchAndPolicy()
getClientAndBranchAndPolicy() getURLParams()
getURLParams() $('#client_id').select2();
$('#client_id').select2(); $('#client_branch_id').select2();
$('#client_branch_id').select2(); $('#insurer_id').select2();
$('#insurer_id').select2(); $('#insurer_branch_id').select2();
$('#insurer_branch_id').select2(); $('#policy_type_id').select2();
$('#policy_type_id').select2(); $('#client_policy_id').select2();
$('#client_policy_id').select2(); $('#user_id').select2();
$('#user_id').select2();
})
function fetchEmpolyeeList(event)
{
event.preventDefault(); // Prevent default action
var start_date = $('#startDate').val();
var end_date = $('#endDate').val();
var client_id = $('#client_id').val();
var insurer_id = $('#insurer_id').val();
var policy_type_id = $('#policy_type_id').val();
var date_type = $('#date_type').val();
var issuer = $('#issuer').val();
var client_branch_id = $('#client_branch_id').val();
var insurer_branch_id = $('#insurer_branch_id').val();
var client_policy_id = $('#client_policy_id').val();
var user_id = $('#user_id').val();
console.log(start_date + '-' + end_date);
var queryParams = {
start_date: start_date,
end_date: end_date,
client_id: client_id,
insurer_id: insurer_id,
policy_type_id: policy_type_id,
date_type: date_type,
issuer: issuer,
client_branch_id: client_branch_id,
insurer_branch_id: insurer_branch_id,
client_policy_id: client_policy_id,
user_id: user_id,
};
const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
console.log(apiURL);
window.location.href = apiURL;
}
function objectToQueryString(obj)
{
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
}
function getURLParams()
{
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
const startDate = params.get('start_date') || 0; // Default to 0 if not found
const endDate = params.get('end_date') || 0; // Default to 0 if not found
const client_id = params.get('client_id') || 0; // Default to 0 if not found
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
const date_type = params.get('date_type') || 0; // Default to 0 if not found
const issuer = params.get('issuer') || 0; // Default to 0 if not found
const client_branch_id = params.get('client_branch_id') || 0; // Default to 0 if not found
const insurer_branch_id = params.get('insurer_branch_id') || 0; // Default to 0 if not found
const client_policy_id = params.get('client_policy_id') || 0; // Default to 0 if not found
const user_id = params.get('user_id') || 0; // Default to 0 if not found
hideDateField(date_type)
console.log('startDate', startDate)
console.log('endDate', endDate)
console.log('client_id', client_id)
console.log('insurer_id', insurer_id)
console.log('policy_type_id', policy_type_id)
console.log('date_type', date_type)
console.log('issuer', issuer)
console.log('client_branch_id', client_branch_id)
console.log('insurer_branch_id', insurer_branch_id)
console.log('client_policy_id', client_policy_id)
console.log('user_id', user_id)
// Log the values or use them as needed
console.log('Start Date:', startDate);
console.log('End Date:', endDate);
if (startDate != 0 && endDate != 0) {
setTimeout(function(){
$('#start_date').val(startDate)
$('#end_date').val(endDate)
$('#client_id').val(client_id).select2()
$('#insurer_id').val(insurer_id).select2()
$('#user_id').val(user_id).select2()
$('#policy_type_id').val(policy_type_id).select2()
$('#date_type').val(date_type).trigger('change');
$('#issuer').val(issuer)
setTimeout(function(){
$('#client_branch_id').val(client_branch_id).select2()
$('#insurer_branch_id').val(insurer_branch_id).select2()
setTimeout(function(){
$('#client_policy_id').val(client_policy_id).select2();
}, 1000);
}, 2000)
},1000)
}
}
$(function() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
// Get start and end dates from URL parameters, or use default values
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
// Parse the dates to moment objects
var start = moment(startDateParam, 'DD-MM-YYYY');
var end = moment(endDateParam, 'DD-MM-YYYY');
// var start = moment().subtract(29, 'days');
// var end = moment();
function cb(start, end) {
$('#reportrange').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
$('#startDate').val(start.format('DD-MM-YYYY'));
$('#endDate').val(end.format('DD-MM-YYYY'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
locale: { format: 'DD-MM-YYYY' },
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}
}, cb);
cb(start, end);
$('#clear-filters').on('click', function() {
// Reset all select dropdowns to the first option
$('#client_id').val('0').change();
$('#insurer_id').val('0').change();
$('#policy_type_id').val('0').change();
$('#date_type').val('0');
$('#issuer').val('0');
$('#date_div').hide()
// Reset the date range picker to default
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
$('#reportrange').data('daterangepicker').setEndDate(moment());
cb(start, end); // Update the displayed date range
});
});
function hideDateField(input = null)
{
let val = $('#date_type').val();
if(input){
val = input;
}
if(val != 0){
$('#date_div').show()
}else{
$('#date_div').hide()
}
}
// -----------------------------------------------------------------------------------------------
//featch client, client branch, insurer, insurer branch and client policy list data
function getClientAndBranchAndPolicy()
{
$.ajax({
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
type: "GET",
dataType: 'json',
success: function(res) {
console.log('getClientAndBranchAndPolicy', res);
if(res.status == true){
client_list = res.client_data;
branch_list = res.branch_data;
policy_list = res.policy_data;
insurer_list = res.insurer_data;
insurer_branch_list = res.insurer_branch_data;
appendClients(res.client_data);
appendInsurer(res.insurer_data);
}else{
console.log('No data found');
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
}
});
}
//append clients for filter
function appendClients(data)
{
$('#client_id').empty();
$('#client_id').append($('<option>', {
value: '',
text: 'Select Client'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.client_name,
'data-cn': item.client_name,
'data-ct': item.client_type,
class: (item.client_type == 1) ? 'group' : (item.client_type == 2) ? 'individual' : ''
});
$('#client_id').append(option);
});
}
//append clients branch for filter
function appendBranch(data)
{
$('#client_branch_id').empty();
$('#client_branch_id').append($('<option>', {
value: '',
text: 'Select Branch'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.branch_name
});
$('#client_branch_id').append(option);
});
}
//append insurer for filter
function appendInsurer(data)
{
$('#insurer_id').empty();
$('#insurer_id').append($('<option>', {
value: '',
text: 'Select Insurer'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.name,
});
$('#insurer_id').append(option);
});
}
//append insurer branch for filter
function appendInsurerBranch(data)
{
$('#insurer_branch_id').empty();
$('#insurer_branch_id').append($('<option>', {
value: '',
text: 'Select Insurer Branch'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.branch_name
});
$('#insurer_branch_id').append(option);
});
}
//append client policy for filter
function appendPolicies(data)
{
// console.log('appendPolicies', data);
// console.log('appendPolicies', $('#client_policy_id'));
$('#client_policy_id').empty();
$('#client_policy_id').append($('<option>', {
value: '',
text: 'Select Policy',
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.policy_type + '-' + item.policy_no,
});
$('#client_policy_id').append(option);
});
}
// -------------------------------------------------------------------------------------------------
//client branch and insurer branch onchange document ready function
$(document).ready(function(){
$('#client_id').change(function(){
let client_id = $(this).val();
console.log('client_id', client_id);
if(branch_list != '') {
// console.log(branch_list[client_id]);
let data = branch_list[client_id];
appendBranch(data);
}
})
$('#insurer_id').change(function(){
let insurer_id = $(this).val();
console.log('insurer_id', insurer_id);
if(insurer_branch_list != '') {
// console.log(insurer_branch_list[insurer_id]);
let data = insurer_branch_list[insurer_id];
appendInsurerBranch(data);
}
}) })
}); function fetchEmpolyeeList(event) {
event.preventDefault(); // Prevent default action
//get policy list based on the client, client_branch, insurer, insurer_branch and policy type var start_date = $('#startDate').val();
function getClientPolicyDataBasedOnClientAndInsuer(){ var end_date = $('#endDate').val();
var client_id = $('#client_id').val();
var insurer_id = $('#insurer_id').val();
var policy_type_id = $('#policy_type_id').val();
var date_type = $('#date_type').val();
var issuer = $('#issuer').val();
var client_branch_id = $('#client_branch_id').val();
var insurer_branch_id = $('#insurer_branch_id').val();
var client_policy_id = $('#client_policy_id').val();
var user_id = $('#user_id').val();
let client_id = $('#client_id').val() ?? 0;
let client_branch_id = $('#client_branch_id').val() ?? 0;
let insurer_id = $('#insurer_id').val() ?? 0;
let insurer_branch_id = $('#insurer_branch_id').val() ?? 0;
let policy_type_id = $('#policy_type_id').val() ?? 0;
let url = '<?= base_url('util/getClientPolicyDataBasedOnClientAndInsuer/') ?>'; console.log(start_date + '-' + end_date);
let requestData = { var queryParams = {
client_id: client_id, start_date: start_date,
client_branch_id: client_branch_id, end_date: end_date,
insurer_id: insurer_id, client_id: client_id,
insurer_branch_id: insurer_branch_id, insurer_id: insurer_id,
policy_type_id: policy_type_id, policy_type_id: policy_type_id,
date_type: date_type,
issuer: issuer,
client_branch_id: client_branch_id,
insurer_branch_id: insurer_branch_id,
client_policy_id: client_policy_id,
user_id: user_id,
}; };
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) { const queryString = objectToQueryString(queryParams);
console.log('Data fetched successfully:', response); const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
console.log(apiURL);
if (response.status === true) { window.location.href = apiURL;
appendPolicies(response.data)
} else {
toastr.warning(response.message, 'WARNING');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
});
}
//for the change title
function changeTitle(input){
let val = $(input).val();
if(val == 'statement_month'){
$('#bds_title').text(' - Statement Month Wise List')
}else{
$('#bds_title').text(' - Policy Wise List')
} }
} function objectToQueryString(obj) {
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
}
function getURLParams() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
const startDate = params.get('start_date') || 0; // Default to 0 if not found
const endDate = params.get('end_date') || 0; // Default to 0 if not found
const client_id = params.get('client_id') || 0; // Default to 0 if not found
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
const date_type = params.get('date_type') || 0; // Default to 0 if not found
const issuer = params.get('issuer') || 0; // Default to 0 if not found
const client_branch_id = params.get('client_branch_id') || 0; // Default to 0 if not found
const insurer_branch_id = params.get('insurer_branch_id') || 0; // Default to 0 if not found
const client_policy_id = params.get('client_policy_id') || 0; // Default to 0 if not found
const user_id = params.get('user_id') || 0; // Default to 0 if not found
hideDateField(date_type)
console.log('startDate', startDate)
console.log('endDate', endDate)
console.log('client_id', client_id)
console.log('insurer_id', insurer_id)
console.log('policy_type_id', policy_type_id)
console.log('date_type', date_type)
console.log('issuer', issuer)
console.log('client_branch_id', client_branch_id)
console.log('insurer_branch_id', insurer_branch_id)
console.log('client_policy_id', client_policy_id)
console.log('user_id', user_id)
// Log the values or use them as needed
console.log('Start Date:', startDate);
console.log('End Date:', endDate);
if (startDate != 0 && endDate != 0) {
setTimeout(function() {
$('#start_date').val(startDate)
$('#end_date').val(endDate)
$('#client_id').val(client_id).select2()
$('#insurer_id').val(insurer_id).select2()
$('#user_id').val(user_id).select2()
$('#policy_type_id').val(policy_type_id).select2()
$('#date_type').val(date_type).trigger('change');
$('#issuer').val(issuer)
setTimeout(function() {
$('#client_branch_id').val(client_branch_id).select2()
$('#insurer_branch_id').val(insurer_branch_id).select2()
setTimeout(function() {
$('#client_policy_id').val(client_policy_id).select2();
}, 1000);
}, 2000)
}, 1000)
}
}
$(function() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
// Get start and end dates from URL parameters, or use default values
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
// Parse the dates to moment objects
var start = moment(startDateParam, 'DD-MM-YYYY');
var end = moment(endDateParam, 'DD-MM-YYYY');
// var start = moment().subtract(29, 'days');
// var end = moment();
function cb(start, end) {
$('#reportrange').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
$('#startDate').val(start.format('DD-MM-YYYY'));
$('#endDate').val(end.format('DD-MM-YYYY'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
locale: {
format: 'DD-MM-YYYY'
},
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}
}, cb);
cb(start, end);
$('#clear-filters').on('click', function() {
// Reset all select dropdowns to the first option
$('#client_id').val('0').change();
$('#insurer_id').val('0').change();
$('#policy_type_id').val('0').change();
$('#date_type').val('0');
$('#issuer').val('0');
$('#date_div').hide()
// Reset the date range picker to default
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
$('#reportrange').data('daterangepicker').setEndDate(moment());
cb(start, end); // Update the displayed date range
});
});
function hideDateField(input = null) {
let val = $('#date_type').val();
if (input) {
val = input;
}
if (val != 0) {
$('#date_div').show()
} else {
$('#date_div').hide()
}
}
// -----------------------------------------------------------------------------------------------
//featch client, client branch, insurer, insurer branch and client policy list data
function getClientAndBranchAndPolicy() {
$.ajax({
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
type: "GET",
dataType: 'json',
success: function(res) {
console.log('getClientAndBranchAndPolicy', res);
if (res.status == true) {
client_list = res.client_data;
branch_list = res.branch_data;
policy_list = res.policy_data;
insurer_list = res.insurer_data;
insurer_branch_list = res.insurer_branch_data;
appendClients(res.client_data);
appendInsurer(res.insurer_data);
} else {
console.log('No data found');
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
}
});
}
//append clients for filter
function appendClients(data) {
$('#client_id').empty();
$('#client_id').append($('<option>', {
value: '',
text: 'Select Client'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.client_name,
'data-cn': item.client_name,
'data-ct': item.client_type,
class: (item.client_type == 1) ? 'group' : (item.client_type == 2) ? 'individual' : ''
});
$('#client_id').append(option);
});
}
//append clients branch for filter
function appendBranch(data) {
$('#client_branch_id').empty();
$('#client_branch_id').append($('<option>', {
value: '',
text: 'Select Branch'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.branch_name
});
$('#client_branch_id').append(option);
});
}
//append insurer for filter
function appendInsurer(data) {
$('#insurer_id').empty();
$('#insurer_id').append($('<option>', {
value: '',
text: 'Select Insurer'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.name,
});
$('#insurer_id').append(option);
});
}
//append insurer branch for filter
function appendInsurerBranch(data) {
$('#insurer_branch_id').empty();
$('#insurer_branch_id').append($('<option>', {
value: '',
text: 'Select Insurer Branch'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.branch_name
});
$('#insurer_branch_id').append(option);
});
}
//append client policy for filter
function appendPolicies(data) {
// console.log('appendPolicies', data);
// console.log('appendPolicies', $('#client_policy_id'));
$('#client_policy_id').empty();
$('#client_policy_id').append($('<option>', {
value: '',
text: 'Select Policy',
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.policy_type + '-' + item.policy_no,
});
$('#client_policy_id').append(option);
});
}
// -------------------------------------------------------------------------------------------------
//client branch and insurer branch onchange document ready function
$(document).ready(function() {
$('#client_id').change(function() {
let client_id = $(this).val();
console.log('client_id', client_id);
if (branch_list != '') {
// console.log(branch_list[client_id]);
let data = branch_list[client_id];
appendBranch(data);
}
})
$('#insurer_id').change(function() {
let insurer_id = $(this).val();
console.log('insurer_id', insurer_id);
if (insurer_branch_list != '') {
// console.log(insurer_branch_list[insurer_id]);
let data = insurer_branch_list[insurer_id];
appendInsurerBranch(data);
}
})
});
//get policy list based on the client, client_branch, insurer, insurer_branch and policy type
function getClientPolicyDataBasedOnClientAndInsuer() {
let client_id = $('#client_id').val() ?? 0;
let client_branch_id = $('#client_branch_id').val() ?? 0;
let insurer_id = $('#insurer_id').val() ?? 0;
let insurer_branch_id = $('#insurer_branch_id').val() ?? 0;
let policy_type_id = $('#policy_type_id').val() ?? 0;
let url = '<?= base_url('util/getClientPolicyDataBasedOnClientAndInsuer/') ?>';
let requestData = {
client_id: client_id,
client_branch_id: client_branch_id,
insurer_id: insurer_id,
insurer_branch_id: insurer_branch_id,
policy_type_id: policy_type_id,
};
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
console.log('Data fetched successfully:', response);
if (response.status === true) {
appendPolicies(response.data)
} else {
toastr.warning(response.message, 'WARNING');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
});
}
//for the change title
function changeTitle(input) {
let val = $(input).val();
if (val == 'statement_month') {
$('#bds_title').text(' - Statement Month Wise List')
} else {
$('#bds_title').text(' - Policy Wise List')
}
}
</script> </script>

View File

@ -26,7 +26,7 @@
} }
</style> </style>
<div class="container-fluid"> <div class="container-fluid-min">
<h2>Retail Endorsement</h2> <h2>Retail Endorsement</h2>
<div class="row"> <div class="row">
<div class="col-xl-12"> <div class="col-xl-12">
@ -332,7 +332,7 @@
$(document).ready(function() { $(document).ready(function() {
$('#tickets-table').DataTable({ $('#tickets-table').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" + dom: "<'d-flex justify-content-between align-items-center'<'datatable-search'f><'datatable-buttons'B>>" +
"<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", "<'row'<'col-sm-5'i><'col-sm-7'p>>",
buttons: [{ buttons: [{

View File

@ -8,10 +8,7 @@
padding: 4px 4px !important; padding: 4px 4px !important;
} }
.col-12 {
max-width: 98% !important;
}
.dataTables_filter { .dataTables_filter {
position: absolute; position: absolute;

View File

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

View File

@ -28,445 +28,449 @@
font-size: 0.875rem; font-size: 0.875rem;
} }
</style> </style>
<div class="row">
<div class="col-12">
<div class="<?= !isset($ticket_data) ? "card" : "" ?>" style="margin-right: 23px;">
<div class="card-body">
<?php if (!isset($ticket_data)) { ?>
<!-- Header Section -->
<div class="row mb-3">
<div class="col-6 d-flex align-items-center">
<h4 class="mb-0">Claim GMC</h4>
</div>
<div class="col-6 text-right">
<a href="<?= base_url('ticket/list'); ?>" aria-label="Back to ticket list">
<i class="mdi mdi-arrow-left" style="font-size: 17px;"></i>
</a>
</div>
</div>
<?php } ?>
<form role="form" class="parsley-examples" method="post" id="ticket_form_data" onsubmit="submitClaimForm(event, this)" enctype="multipart/form-data">
<input type="hidden" id="ticket_type_id" name="ticket_type_id" value="1"> <div class="container-fluid-min">
<input type="hidden" id="ticket_master_id" name="ticket_master_id" value="<?= isset($ticket_data['id']) ? $ticket_data['id'] : '' ?>"> <div class="row">
<input type="hidden" id="is_head_approved" name="is_head_approved" value="<?= isset($ticket_data['is_head_approved']) ? $ticket_data['is_head_approved'] : '' ?>"> <div class="col-12">
<input type="hidden" id="extra_fields_array_for_validate" name="extra_fields_array_for_validate" value='<?= isset($extra_fields_array_for_validate) && !empty($extra_fields_array_for_validate) ? json_encode($extra_fields_array_for_validate) : "[]" ?>'> <div class="<?= !isset($ticket_data) ? "card" : "" ?>" >
<input type="hidden" id="head_rejection_reason" name="head_rejection_reason"> <div class="card-body">
<?php if (!isset($ticket_data)) { ?>
<!-- Header Section -->
<div id="accordion1" class="mb-3"> <div class="row mb-3">
<div class="card mb-1"> <div class="col-6 d-flex align-items-center">
<h4 class="m-1"> <h4 class="mb-0">Claim GMC</h4>
Employee details </div>
<a id="toggleIcon1" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true"> <div class="col-6 text-right">
<i id="icon1" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i> <a href="<?= base_url('ticket/list'); ?>" aria-label="Back to ticket list">
<i class="mdi mdi-arrow-left" style="font-size: 17px;"></i>
</a> </a>
</h4> </div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion1"> </div>
<div class="card-body"> <?php } ?>
<form role="form" class="parsley-examples" method="post" id="ticket_form_data" onsubmit="submitClaimForm(event, this)" enctype="multipart/form-data">
<!-- first_data_points --> <input type="hidden" id="ticket_type_id" name="ticket_type_id" value="1">
<div class="form-row"> <input type="hidden" id="ticket_master_id" name="ticket_master_id" value="<?= isset($ticket_data['id']) ? $ticket_data['id'] : '' ?>">
<input type="hidden" id="is_head_approved" name="is_head_approved" value="<?= isset($ticket_data['is_head_approved']) ? $ticket_data['is_head_approved'] : '' ?>">
<input type="hidden" id="extra_fields_array_for_validate" name="extra_fields_array_for_validate" value='<?= isset($extra_fields_array_for_validate) && !empty($extra_fields_array_for_validate) ? json_encode($extra_fields_array_for_validate) : "[]" ?>'>
<input type="hidden" id="head_rejection_reason" name="head_rejection_reason">
<div class="form-group col-md-3">
<label for="emp_code" class="label-font-size">Employee ID <span class="text-danger">*</span> &nbsp; &nbsp; <i class="mdi mdi-magnify text-danger"
aria-hidden="true" onclick="openFetchEmpDataodal(this)"></i> <span
class="text-danger"></span></label>
<input type="text" class="form-control" id="emp_code" placeholder="Enter Employee ID"
value="<?= isset($ticket_data['emp_code']) ? $ticket_data['emp_code'] : '' ?>"
name="emp_code" required>
</div>
<div class="form-group col-md-3"> <div id="accordion1" class="mb-3">
<label for="emp_name" class="label-font-size">Employee Name <span class="text-danger">*</span></label> <div class="card mb-1">
<input type=hidden id="emp_id" name="emp_id" value="<?= isset($ticket_data['emp_id']) ? $ticket_data['emp_id'] : '' ?>"> <h4 class="m-1">
<input type="text" class="form-control" id="emp_name" placeholder="Enter Employee Name" Employee details
value="<?= isset($ticket_data['emp_name']) ? $ticket_data['emp_name'] : '' ?>" <a id="toggleIcon1" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true">
name="emp_name" required> <i id="icon1" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</div> </a>
</h4>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion1">
<div class="card-body">
<div class="form-group col-md-3"> <!-- first_data_points -->
<label for="insured_name" class="label-font-size"> Insured Name <span class="text-danger">*</span></label> <div class="form-row">
<input type=hidden id="insured_emp_id" name="insured_emp_id" value="<?= isset($ticket_data['insured_emp_id']) ? $ticket_data['insured_emp_id'] : '' ?>">
<input class="form-control" id="insured_name" name="insured_name" value="<?= isset($ticket_data['insured_name']) ? $ticket_data['insured_name'] : '' ?>" required>
</div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="relationship" class="label-font-size"> Relationship <span class="text-danger">*</span></label> <label for="emp_code" class="label-font-size">Employee ID <span class="text-danger">*</span> &nbsp; &nbsp; <i class="mdi mdi-magnify text-danger"
<select class="form-control" id="relationship" name="relationship" required> aria-hidden="true" onclick="openFetchEmpDataodal(this)"></i> <span
<option value="">Select Relationship</option> class="text-danger"></span></label>
<?php <input type="text" class="form-control" id="emp_code" placeholder="Enter Employee ID"
if (isset($relationshipType) && count($relationshipType)) { value="<?= isset($ticket_data['emp_code']) ? $ticket_data['emp_code'] : '' ?>"
foreach ($relationshipType as $key => $value) { name="emp_code" required>
$selected = (isset($ticket_data) && $ticket_data['relationship'] == $key) ? 'selected' : ''; </div>
echo "<option value='$key' $selected>$value</option>";
<div class="form-group col-md-3">
<label for="emp_name" class="label-font-size">Employee Name <span class="text-danger">*</span></label>
<input type=hidden id="emp_id" name="emp_id" value="<?= isset($ticket_data['emp_id']) ? $ticket_data['emp_id'] : '' ?>">
<input type="text" class="form-control" id="emp_name" placeholder="Enter Employee Name"
value="<?= isset($ticket_data['emp_name']) ? $ticket_data['emp_name'] : '' ?>"
name="emp_name" required>
</div>
<div class="form-group col-md-3">
<label for="insured_name" class="label-font-size"> Insured Name <span class="text-danger">*</span></label>
<input type=hidden id="insured_emp_id" name="insured_emp_id" value="<?= isset($ticket_data['insured_emp_id']) ? $ticket_data['insured_emp_id'] : '' ?>">
<input class="form-control" id="insured_name" name="insured_name" value="<?= isset($ticket_data['insured_name']) ? $ticket_data['insured_name'] : '' ?>" required>
</div>
<div class="form-group col-md-3">
<label for="relationship" class="label-font-size"> Relationship <span class="text-danger">*</span></label>
<select class="form-control" id="relationship" name="relationship" required>
<option value="">Select Relationship</option>
<?php
if (isset($relationshipType) && count($relationshipType)) {
foreach ($relationshipType as $key => $value) {
$selected = (isset($ticket_data) && $ticket_data['relationship'] == $key) ? 'selected' : '';
echo "<option value='$key' $selected>$value</option>";
}
} }
} ?>
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="policy_no" class="label-font-size">Policy No <span class="text-danger"></span></label>
<input type="text" class="form-control" id="policy_no"
value="<?= isset($ticket_data['policy_no']) ? $ticket_data['policy_no'] : '' ?>"
name="policy_no" placeholder="Policy Number">
</div>
<div class="form-group col-md-3">
<label for="tpa_no" class="label-font-size">TPA ID <span class="text-danger"></span></label>
<input type="text" class="form-control" id="tpa_no" placeholder="Enter TPA ID"
value="<?= isset($ticket_data['tpa_no']) ? $ticket_data['tpa_no'] : '' ?>"
name="tpa_no">
</div>
<div class="form-group col-md-3">
<label for="emp_mobile" class="label-font-size">Employee Mobile No <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="emp_mobile" placeholder="Enter EMP Mobile"
value="<?= isset($ticket_data['emp_mobile']) ? $ticket_data['emp_mobile'] : '' ?>"
name="emp_mobile" required>
</div>
<div class="form-group col-md-3">
<label for="emp_mail" class="label-font-size">Employee Mail ID <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="emp_mail" placeholder="Enter EMP Mail"
value="<?= isset($ticket_data['emp_mail']) ? $ticket_data['emp_mail'] : '' ?>"
name="emp_mail" required>
</div>
<div class="form-group col-md-3">
<label for="emp_personal_mail" class="label-font-size">Employee Personal Mail ID</label>
<input type="text" class="form-control" id="emp_personal_mail" placeholder="Enter EMP Personal Mail"
value="<?= isset($ticket_data['emp_personal_mail']) ? $ticket_data['emp_personal_mail'] : '' ?>"
name="emp_personal_mail">
</div>
<div class="form-group col-md-3">
<label for="client_name" class="label-font-size">Corporate Name <span class="text-danger">*</span></label>
<input type="hidden" id="client_id" name="client_id" value="<?= isset($ticket_data['client_id']) ? $ticket_data['client_id'] : '' ?>">
<input type="text" class="form-control" id="client_name" placeholder="Client" value="<?= isset($ticket_data['client_name']) ? $ticket_data['client_name'] : '' ?>" readonly required>
</div>
<div class="form-group col-md-3">
<label for="insurer_id" class="label-font-size">Insurer <span class="text-danger">*</span></label>
<input type=hidden id="insurer_id" name="insurer_id" value="<?= isset($ticket_data['insurer_id']) ? $ticket_data['insurer_id'] : '' ?>">
<input type=text class="form-control" id="insurer_name" placeholder="Insurer" value="<?= isset($ticket_data['insurer_name']) ? $ticket_data['insurer_name'] : '' ?>" readonly required>
</div>
<input type="hidden" id="empIDHidden" onchange="getClientPolicy()">
<div class="col-md-3">
<div class="form-group">
<label class="label-font-size">Policy <span class="text-danger">*</span></label>
<select id="emp_client_policy" name="client_policy_id"
class="form-control custom-select" required onchange="setMinDateDOA(this.value); setInsurerAndTPAData(this)">
<?php if (!empty($ticket_data['client_policy_id'])) { ?>
<option value="<?= $ticket_data['client_policy_id'] ?>"><?= $ticket_data['client_policy_id_text'] ?></option>
<?php } else { ?>
<option value="">Policy</option>
<?php } ?>
</select> </select>
</div> </div>
</div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label class="label-font-size" for="tpa_name">TPA <span class="text-danger"></span></label> <label for="policy_no" class="label-font-size">Policy No <span class="text-danger"></span></label>
<input type=hidden id="tpa_id" name="tpa_id" value="<?= isset($ticket_data['tpa_id']) ? $ticket_data['tpa_id'] : '' ?>"> <input type="text" class="form-control" id="policy_no"
<input type=text class="form-control" id="tpa_name" placeholder="TPA" value="<?= isset($ticket_data['tpa_name']) ? $ticket_data['tpa_name'] : '' ?>" readonly> value="<?= isset($ticket_data['policy_no']) ? $ticket_data['policy_no'] : '' ?>"
</div> name="policy_no" placeholder="Policy Number">
</div>
<div class="form-group col-md-3">
<label for="tpa_no" class="label-font-size">TPA ID <span class="text-danger"></span></label>
<input type="text" class="form-control" id="tpa_no" placeholder="Enter TPA ID"
value="<?= isset($ticket_data['tpa_no']) ? $ticket_data['tpa_no'] : '' ?>"
name="tpa_no">
</div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label class="label-font-size" for="acm_id">Account Manager <span class="text-danger">*</span></label> <label for="emp_mobile" class="label-font-size">Employee Mobile No <span class="text-danger">*</span></label>
<select class="form-control" id="acm_id" name="acm_id" required> <input type="text" class="form-control" id="emp_mobile" placeholder="Enter EMP Mobile"
<!-- <option value="0">Select Account Manager</option> --> value="<?= isset($ticket_data['emp_mobile']) ? $ticket_data['emp_mobile'] : '' ?>"
<?php name="emp_mobile" required>
if (isset($acms) && count($acms)) { </div>
foreach ($acms as $key => $value) {
$selected = (isset($ticket_data) && $ticket_data['acm_id'] == $value['id']) ? 'selected' : ''; <div class="form-group col-md-3">
echo "<option value=" . $value['id'] . " $selected >" . $value['first_name'] . "</option>"; <label for="emp_mail" class="label-font-size">Employee Mail ID <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="emp_mail" placeholder="Enter EMP Mail"
value="<?= isset($ticket_data['emp_mail']) ? $ticket_data['emp_mail'] : '' ?>"
name="emp_mail" required>
</div>
<div class="form-group col-md-3">
<label for="emp_personal_mail" class="label-font-size">Employee Personal Mail ID</label>
<input type="text" class="form-control" id="emp_personal_mail" placeholder="Enter EMP Personal Mail"
value="<?= isset($ticket_data['emp_personal_mail']) ? $ticket_data['emp_personal_mail'] : '' ?>"
name="emp_personal_mail">
</div>
<div class="form-group col-md-3">
<label for="client_name" class="label-font-size">Corporate Name <span class="text-danger">*</span></label>
<input type="hidden" id="client_id" name="client_id" value="<?= isset($ticket_data['client_id']) ? $ticket_data['client_id'] : '' ?>">
<input type="text" class="form-control" id="client_name" placeholder="Client" value="<?= isset($ticket_data['client_name']) ? $ticket_data['client_name'] : '' ?>" readonly required>
</div>
<div class="form-group col-md-3">
<label for="insurer_id" class="label-font-size">Insurer <span class="text-danger">*</span></label>
<input type=hidden id="insurer_id" name="insurer_id" value="<?= isset($ticket_data['insurer_id']) ? $ticket_data['insurer_id'] : '' ?>">
<input type=text class="form-control" id="insurer_name" placeholder="Insurer" value="<?= isset($ticket_data['insurer_name']) ? $ticket_data['insurer_name'] : '' ?>" readonly required>
</div>
<input type="hidden" id="empIDHidden" onchange="getClientPolicy()">
<div class="col-md-3">
<div class="form-group">
<label class="label-font-size">Policy <span class="text-danger">*</span></label>
<select id="emp_client_policy" name="client_policy_id"
class="form-control custom-select" required onchange="setMinDateDOA(this.value); setInsurerAndTPAData(this)">
<?php if (!empty($ticket_data['client_policy_id'])) { ?>
<option value="<?= $ticket_data['client_policy_id'] ?>"><?= $ticket_data['client_policy_id_text'] ?></option>
<?php } else { ?>
<option value="">Policy</option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group col-md-3">
<label class="label-font-size" for="tpa_name">TPA <span class="text-danger"></span></label>
<input type=hidden id="tpa_id" name="tpa_id" value="<?= isset($ticket_data['tpa_id']) ? $ticket_data['tpa_id'] : '' ?>">
<input type=text class="form-control" id="tpa_name" placeholder="TPA" value="<?= isset($ticket_data['tpa_name']) ? $ticket_data['tpa_name'] : '' ?>" readonly>
</div>
<div class="form-group col-md-3">
<label class="label-font-size" for="acm_id">Account Manager <span class="text-danger">*</span></label>
<select class="form-control" id="acm_id" name="acm_id" required>
<!-- <option value="0">Select Account Manager</option> -->
<?php
if (isset($acms) && count($acms)) {
foreach ($acms as $key => $value) {
$selected = (isset($ticket_data) && $ticket_data['acm_id'] == $value['id']) ? 'selected' : '';
echo "<option value=" . $value['id'] . " $selected >" . $value['first_name'] . "</option>";
}
} }
} ?>
?> </select>
</select> </div>
</div>
</div>
<!-- end first_data_points -->
<!-- </div> -->
</div> </div>
<!-- end first_data_points -->
<!-- </div> -->
</div> </div>
</div> </div>
</div> </div>
</div>
<div id="accordion2" class="mb-3"> <div id="accordion2" class="mb-3">
<div class="card mb-1"> <div class="card mb-1">
<h4 class="m-1"> <h4 class="m-1">
Claim Details Claim Details
<i id="infoIcon" class="mdi mdi-information-outline info-icon" title="Click for more details" style="margin-left: 5px;"></i> <i id="infoIcon" class="mdi mdi-information-outline info-icon" title="Click for more details" style="margin-left: 5px;"></i>
<?= isset($ticket_data['claim_number']) && !empty($ticket_data['claim_number']) ? '( Claim No : ' . $ticket_data['claim_number'] . ' )' : '' ?> <?= isset($ticket_data['claim_number']) && !empty($ticket_data['claim_number']) ? '( Claim No : ' . $ticket_data['claim_number'] . ' )' : '' ?>
<a id="toggleIcon1" class="text-dark float-right" data-toggle="collapse" href="#collapseTwo" aria-expanded="true">
<i id="icon1" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</h4>
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion2">
<div class="card-body">
<!-- second_data_points -->
<div class="form-row">
<div class="form-group col-md-3">
<label class="label-font-size" for="claim_status">Status <span class="text-danger">*</span></label> <a id="toggleIcon1" class="text-dark float-right" data-toggle="collapse" href="#collapseTwo" aria-expanded="true">
<select class="form-control" id="claim_status_id" name="claim_status_id" required> <i id="icon1" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
<!-- <option value="0">Select status</option> --> </a>
<?php </h4>
if (isset($claim_status) && count($claim_status)) { <div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion2">
foreach ($claim_status as $key => $value) { <div class="card-body">
$selected = (isset($ticket_data) && $ticket_data['claim_status_id'] == $value['id']) ? 'selected' : ''; <!-- second_data_points -->
echo "<option value=" . $value['id'] . " $selected>" . $value['claim_status'] . "</option>"; <div class="form-row">
<div class="form-group col-md-3">
<label class="label-font-size" for="claim_status">Status <span class="text-danger">*</span></label>
<select class="form-control" id="claim_status_id" name="claim_status_id" required>
<!-- <option value="0">Select status</option> -->
<?php
if (isset($claim_status) && count($claim_status)) {
foreach ($claim_status as $key => $value) {
$selected = (isset($ticket_data) && $ticket_data['claim_status_id'] == $value['id']) ? 'selected' : '';
echo "<option value=" . $value['id'] . " $selected>" . $value['claim_status'] . "</option>";
}
} }
} ?>
?> </select>
</select> </div>
</div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label class="label-font-size" for="priority">Priority <span class="text-danger">*</span></label> <label class="label-font-size" for="priority">Priority <span class="text-danger">*</span></label>
<select class="form-control" id="priority" name="priority" required> <select class="form-control" id="priority" name="priority" required>
<!-- <option value="0">Select Priority</option> --> <!-- <option value="0">Select Priority</option> -->
<?php <?php
if (isset($priorityType) && count($priorityType)) { if (isset($priorityType) && count($priorityType)) {
foreach ($priorityType as $key => $value) { foreach ($priorityType as $key => $value) {
$selected = (isset($ticket_data) && $ticket_data['priority'] == $key) ? 'selected' : ''; $selected = (isset($ticket_data) && $ticket_data['priority'] == $key) ? 'selected' : '';
echo "<option value=" . $key . " $selected>" . $value . "</option>"; echo "<option value=" . $key . " $selected>" . $value . "</option>";
}
} }
} ?>
?> </select>
</select> </div>
</div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label class="label-font-size" for="mode_of_intimation"> Mode of Submission <span <label class="label-font-size" for="mode_of_intimation"> Mode of Submission <span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<select class="form-control" id="mode_of_intimation" name="mode_of_intimation" required> <select class="form-control" id="mode_of_intimation" name="mode_of_intimation" required>
<!-- <option value="0">Select Mode</option> --> <!-- <option value="0">Select Mode</option> -->
<?php <?php
if (isset($modeOFIntimate) && count($modeOFIntimate)) { if (isset($modeOFIntimate) && count($modeOFIntimate)) {
foreach ($modeOFIntimate as $key => $value) { foreach ($modeOFIntimate as $key => $value) {
$selected = (isset($ticket_data) && $ticket_data['mode_of_intimation'] == $key) ? 'selected' : ''; $selected = (isset($ticket_data) && $ticket_data['mode_of_intimation'] == $key) ? 'selected' : '';
echo "<option value='" . $key . "' $selected>" . $value . "</option>"; echo "<option value='" . $key . "' $selected>" . $value . "</option>";
}
} }
} ?>
?> </select>
</select> </div>
</div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label class="label-font-size" for="claim_type"> Claim Type <span class="text-danger">*</span></label> <label class="label-font-size" for="claim_type"> Claim Type <span class="text-danger">*</span></label>
<select class="form-control" id="claim_type" name="claim_type" required> <select class="form-control" id="claim_type" name="claim_type" required>
<!-- <option value="0">Select claim Type</option> --> <!-- <option value="0">Select claim Type</option> -->
<?php <?php
if (isset($claim_type) && count($claim_type)) { if (isset($claim_type) && count($claim_type)) {
foreach ($claim_type as $key => $value) { foreach ($claim_type as $key => $value) {
$selected = (isset($ticket_data) && $ticket_data['claim_type'] == $key) ? 'selected' : ''; $selected = (isset($ticket_data) && $ticket_data['claim_type'] == $key) ? 'selected' : '';
echo "<option value='" . $key . "' $selected>" . $value . "</option>"; echo "<option value='" . $key . "' $selected>" . $value . "</option>";
}
} }
} ?>
?> </select>
</select> </div>
</div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label class="label-font-size" for="hospital_name">Hospital Name <span class="text-danger">*</span></label> <label class="label-font-size" for="hospital_name">Hospital Name <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="hospital_name" <input type="text" class="form-control" id="hospital_name"
placeholder="Enter Hospital Name" placeholder="Enter Hospital Name"
value="<?= isset($ticket_data['hospital_name']) ? $ticket_data['hospital_name'] : '' ?>" value="<?= isset($ticket_data['hospital_name']) ? $ticket_data['hospital_name'] : '' ?>"
name="hospital_name" required> name="hospital_name" required>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label class="label-font-size" for="doa">DOA <span class="text-danger">*</span></label> <label class="label-font-size" for="doa">DOA <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="doa" placeholder="Enter DOA" <input type="text" class="form-control" id="doa" placeholder="Enter DOA"
value="<?= isset($ticket_data['doa']) ? $ticket_data['doa'] : '' ?>" value="<?= isset($ticket_data['doa']) ? $ticket_data['doa'] : '' ?>"
name="doa" required> name="doa" required>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label class="label-font-size" for="dod">DOD <span class="text-danger">*</span></label> <label class="label-font-size" for="dod">DOD <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="dod" placeholder="Enter DOD" <input type="text" class="form-control" id="dod" placeholder="Enter DOD"
value="<?= isset($ticket_data['dod']) ? $ticket_data['dod'] : '' ?>" name="dod" required> value="<?= isset($ticket_data['dod']) ? $ticket_data['dod'] : '' ?>" name="dod" required>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label class="label-font-size" for="claim_amount">Claim Amount <span class="text-danger">*</span></label> <label class="label-font-size" for="claim_amount">Claim Amount <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="claim_amount" <input type="text" class="form-control" id="claim_amount"
placeholder="Enter Claim Amount" placeholder="Enter Claim Amount"
value="<?= isset($ticket_data['claim_amount']) ? $ticket_data['claim_amount'] : '' ?>" value="<?= isset($ticket_data['claim_amount']) ? $ticket_data['claim_amount'] : '' ?>"
name="claim_amount" required> name="claim_amount" required>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label class="label-font-size" id="pod_no_label_1" for="pod_no">POD No with Courier Name <span id="pod_no_label_1_span" class="text-danger"></span></label> <label class="label-font-size" id="pod_no_label_1" for="pod_no">POD No with Courier Name <span id="pod_no_label_1_span" class="text-danger"></span></label>
<input type="text" class="form-control" id="pod_no" placeholder="Enter POD NO" <input type="text" class="form-control" id="pod_no" placeholder="Enter POD NO"
value="<?= isset($ticket_data['pod_no']) ? $ticket_data['pod_no'] : '' ?>" value="<?= isset($ticket_data['pod_no']) ? $ticket_data['pod_no'] : '' ?>"
name="pod_no"> name="pod_no">
</div> </div>
</div>
<!-- end second_data_points -->
</div> </div>
<!-- end second_data_points -->
</div> </div>
</div> </div>
</div> </div>
</div>
<div id="accordion3" class="mb-3"> <div id="accordion3" class="mb-3">
<div class="card mb-1"> <div class="card mb-1">
<h4 class="m-1"> <h4 class="m-1">
Additional Documents Additional Documents
<a id="toggleIcon1" class="text-dark float-right" data-toggle="collapse" href="#collapseThree" aria-expanded="true"> <a id="toggleIcon1" class="text-dark float-right" data-toggle="collapse" href="#collapseThree" aria-expanded="true">
<i id="icon1" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i> <i id="icon1" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a> </a>
</h4> </h4>
<div id="collapseThree" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion3"> <div id="collapseThree" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion3">
<div class="card-body"> <div class="card-body">
<!-- third_data_points --> <!-- third_data_points -->
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-3 up_cnu" style="display: none;"> <div class="form-group col-md-3 up_cnu" style="display: none;">
<label class="label-font-size" for="claim_number">Claim Number <span class="text-danger"></span></label> <label class="label-font-size" for="claim_number">Claim Number <span class="text-danger"></span></label>
<input type="text" class="form-control" id="claim_number" placeholder="Enter Claim NO" <input type="text" class="form-control" id="claim_number" placeholder="Enter Claim NO"
value="<?= isset($ticket_data['claim_number']) ? $ticket_data['claim_number'] : '' ?>" value="<?= isset($ticket_data['claim_number']) ? $ticket_data['claim_number'] : '' ?>"
name="claim_number"> name="claim_number">
</div> </div>
<div class="form-group col-md-3 up_cnu" style="display: none;"> <div class="form-group col-md-3 up_cnu" style="display: none;">
<label class="label-font-size" for="registration_date">Registration Date</label> <label class="label-font-size" for="registration_date">Registration Date</label>
<input type="text" class="form-control datepicker" id="registration_date" placeholder="Select Registration Date" <input type="text" class="form-control datepicker" id="registration_date" placeholder="Select Registration Date"
value="<?= isset($ticket_data['registration_date']) ? $ticket_data['registration_date'] : '' ?>" name="registration_date"> value="<?= isset($ticket_data['registration_date']) ? $ticket_data['registration_date'] : '' ?>" name="registration_date">
</div> </div>
<div class="form-group col-md-3 cda_ir" style="display: none;"> <div class="form-group col-md-3 cda_ir" style="display: none;">
<label class="label-font-size" for="raised_date">Raised Date</label> <label class="label-font-size" for="raised_date">Raised Date</label>
<input type="text" class="form-control datepicker" id="raised_date" placeholder="Select Raised Date" <input type="text" class="form-control datepicker" id="raised_date" placeholder="Select Raised Date"
value="<?= isset($ticket_data['raised_date']) ? $ticket_data['raised_date'] : '' ?>" name="raised_date"> value="<?= isset($ticket_data['raised_date']) ? $ticket_data['raised_date'] : '' ?>" name="raised_date">
</div> </div>
<div class="form-group col-md-3 up_qdr" style="display: none;"> <div class="form-group col-md-3 up_qdr" style="display: none;">
<label class="label-font-size" for="query_received_date">Query Received Date</label> <label class="label-font-size" for="query_received_date">Query Received Date</label>
<input type="text" class="form-control datepicker" id="query_received_date" placeholder="Select Query Received Date" <input type="text" class="form-control datepicker" id="query_received_date" placeholder="Select Query Received Date"
value="<?= isset($ticket_data['query_received_date']) ? $ticket_data['query_received_date'] : '' ?>" name="query_received_date"> value="<?= isset($ticket_data['query_received_date']) ? $ticket_data['query_received_date'] : '' ?>" name="query_received_date">
</div> </div>
<div class="form-group col-md-3 rejected" style="display: none;"> <div class="form-group col-md-3 rejected" style="display: none;">
<label class="label-font-size" for="denial_reason">Denial Reason</label> <label class="label-font-size" for="denial_reason">Denial Reason</label>
<input type="text" class="form-control" id="denial_reason" placeholder="Enter Denial Reason" <input type="text" class="form-control" id="denial_reason" placeholder="Enter Denial Reason"
value="<?= isset($ticket_data['denial_reason']) ? $ticket_data['denial_reason'] : '' ?>" name="denial_reason"> value="<?= isset($ticket_data['denial_reason']) ? $ticket_data['denial_reason'] : '' ?>" name="denial_reason">
</div> </div>
<div class="form-group col-md-3 rejected" style="display: none;"> <div class="form-group col-md-3 rejected" style="display: none;">
<label class="label-font-size" for="denial_date">Denial Date</label> <label class="label-font-size" for="denial_date">Denial Date</label>
<input type="text" class="form-control datepicker" id="denial_date" placeholder="Select Denial Date" <input type="text" class="form-control datepicker" id="denial_date" placeholder="Select Denial Date"
value="<?= isset($ticket_data['denial_date']) ? $ticket_data['denial_date'] : '' ?>" name="denial_date"> value="<?= isset($ticket_data['denial_date']) ? $ticket_data['denial_date'] : '' ?>" name="denial_date">
</div> </div>
<div class="form-group col-md-3 approved" style="display: none;"> <div class="form-group col-md-3 approved" style="display: none;">
<label class="label-font-size" for="approved_amount">Approved Amount</label> # <label class="label-font-size" for="approved_amount">Approved Amount</label> #
<input type="text" class="form-control" id="approved_amount" placeholder="Enter Approved Amount" <input type="text" class="form-control" id="approved_amount" placeholder="Enter Approved Amount"
value="<?= isset($ticket_data['approved_amount']) ? $ticket_data['approved_amount'] : '' ?>" name="approved_amount"> value="<?= isset($ticket_data['approved_amount']) ? $ticket_data['approved_amount'] : '' ?>" name="approved_amount">
</div> </div>
<div class="form-group col-md-3 approved" style="display: none;"> <div class="form-group col-md-3 approved" style="display: none;">
<label class="label-font-size" for="approved_date">Approved Date</label> <label class="label-font-size" for="approved_date">Approved Date</label>
<input type="text" class="form-control datepicker" id="approved_date" placeholder="Select Approved Date" <input type="text" class="form-control datepicker" id="approved_date" placeholder="Select Approved Date"
value="<?= isset($ticket_data['approved_date']) ? $ticket_data['approved_date'] : '' ?>" name="approved_date"> value="<?= isset($ticket_data['approved_date']) ? $ticket_data['approved_date'] : '' ?>" name="approved_date">
</div> </div>
<div class="form-group col-md-6 approved" style="display: none;"> <div class="form-group col-md-6 approved" style="display: none;">
<label class="label-font-size" for="approved_letter">Approved Letter</label> <label class="label-font-size" for="approved_letter">Approved Letter</label>
<input type="text" class="form-control" id="approved_letter" placeholder="Enter Approved Letter" <input type="text" class="form-control" id="approved_letter" placeholder="Enter Approved Letter"
value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter"> value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter">
</div> </div>
<div class="form-group col-md-6 approved" style="display: none;"> <div class="form-group col-md-6 approved" style="display: none;">
<label class="label-font-size" for="approved_description">Approved Description</label> <label class="label-font-size" for="approved_description">Approved Description</label>
<input type="text" class="form-control" id="approved_description" placeholder="Enter Approved Description" <input type="text" class="form-control" id="approved_description" placeholder="Enter Approved Description"
value="<?= isset($ticket_data['approved_description']) ? $ticket_data['approved_description'] : '' ?>" name="approved_description"> value="<?= isset($ticket_data['approved_description']) ? $ticket_data['approved_description'] : '' ?>" name="approved_description">
</div> </div>
<div class="form-group col-md-3 settled" style="display: none;"> <div class="form-group col-md-3 settled" style="display: none;">
<label class="label-font-size" for="utr_details">UTR Details</label> <label class="label-font-size" for="utr_details">UTR Details</label>
<input type="text" class="form-control" id="utr_details" placeholder="Enter UTR Details" <input type="text" class="form-control" id="utr_details" placeholder="Enter UTR Details"
value="<?= isset($ticket_data['utr_details']) ? $ticket_data['utr_details'] : '' ?>" name="utr_details"> value="<?= isset($ticket_data['utr_details']) ? $ticket_data['utr_details'] : '' ?>" name="utr_details">
</div> </div>
<div class="form-group col-md-3 settled" style="display: none;"> <div class="form-group col-md-3 settled" style="display: none;">
<label class="label-font-size" for="settled_date">Settled Date</label> <label class="label-font-size" for="settled_date">Settled Date</label>
<input type="text" class="form-control datepicker" id="settled_date" placeholder="Select Settled Date" <input type="text" class="form-control datepicker" id="settled_date" placeholder="Select Settled Date"
value="<?= isset($ticket_data['settled_date']) ? $ticket_data['settled_date'] : '' ?>" name="settled_date"> value="<?= isset($ticket_data['settled_date']) ? $ticket_data['settled_date'] : '' ?>" name="settled_date">
</div> </div>
<div class="form-group col-md-6 settled" style="display: none;"> <div class="form-group col-md-6 settled" style="display: none;">
<label class="label-font-size" for="settle_letter">Settle Letter</label> <label class="label-font-size" for="settle_letter">Settle Letter</label>
<input type="text" class="form-control" id="settle_letter" placeholder="Enter Settle Letter" <input type="text" class="form-control" id="settle_letter" placeholder="Enter Settle Letter"
value="<?= isset($ticket_data['settle_letter']) ? $ticket_data['settle_letter'] : '' ?>" name="settle_letter"> value="<?= isset($ticket_data['settle_letter']) ? $ticket_data['settle_letter'] : '' ?>" name="settle_letter">
</div> </div>
<div class="form-group col-md-3 payment" style="display: none;"> <div class="form-group col-md-3 payment" style="display: none;">
<label class="label-font-size" for="pay_initiate_date">Payment Initiate Date</label> <label class="label-font-size" for="pay_initiate_date">Payment Initiate Date</label>
<input type="text" class="form-control datepicker" id="pay_initiate_date" placeholder="Select Payment Initiate Date" <input type="text" class="form-control datepicker" id="pay_initiate_date" placeholder="Select Payment Initiate Date"
value="<?= isset($ticket_data['pay_initiate_date']) ? $ticket_data['pay_initiate_date'] : '' ?>" name="pay_initiate_date"> value="<?= isset($ticket_data['pay_initiate_date']) ? $ticket_data['pay_initiate_date'] : '' ?>" name="pay_initiate_date">
</div> </div>
<div class="form-group col-md-3 canceled" style="display: none;"> <div class="form-group col-md-3 canceled" style="display: none;">
<label class="label-font-size" for="cancel_remark">Cancel Remark</label> <label class="label-font-size" for="cancel_remark">Cancel Remark</label>
<textarea class="form-control" id="cancel_remark" rows="1" placeholder="Enter Cancel Remark" name="cancel_remark"><?= isset($ticket_data['cancel_remark']) ? $ticket_data['cancel_remark'] : '' ?></textarea> <textarea class="form-control" id="cancel_remark" rows="1" placeholder="Enter Cancel Remark" name="cancel_remark"><?= isset($ticket_data['cancel_remark']) ? $ticket_data['cancel_remark'] : '' ?></textarea>
</div> </div>
<div class="form-group col-md-3 returned" style="display: none;"> <div class="form-group col-md-3 returned" style="display: none;">
<label class="label-font-size" for="return_remark">Return Remark</label> <label class="label-font-size" for="return_remark">Return Remark</label>
<textarea class="form-control" id="return_remark" rows="1" placeholder="Enter Return Remark" name="return_remark"><?= isset($ticket_data['return_remark']) ? $ticket_data['return_remark'] : '' ?></textarea> <textarea class="form-control" id="return_remark" rows="1" placeholder="Enter Return Remark" name="return_remark"><?= isset($ticket_data['return_remark']) ? $ticket_data['return_remark'] : '' ?></textarea>
</div> </div>
<div class="form-group col-md-6 returned" style="display: none;"> <div class="form-group col-md-6 returned" style="display: none;">
<label class="label-font-size" for="awb_no_courier_name">Return AWB No with Courier Name</label> <label class="label-font-size" for="awb_no_courier_name">Return AWB No with Courier Name</label>
<input type="text" class="form-control" id="awb_no_courier_name" placeholder="eg : 0001/ST Courier" <input type="text" class="form-control" id="awb_no_courier_name" placeholder="eg : 0001/ST Courier"
value="<?= isset($ticket_data['awb_no_courier_name']) ? $ticket_data['awb_no_courier_name'] : '' ?>" name="awb_no_courier_name"> value="<?= isset($ticket_data['awb_no_courier_name']) ? $ticket_data['awb_no_courier_name'] : '' ?>" name="awb_no_courier_name">
</div> </div>
<div class="form-group col-md-3 non_id" style="display: none;"> <div class="form-group col-md-3 non_id" style="display: none;">
<label class="label-font-size" for="non_id_reason">Non ID Reason <span id="non_id_reason_lable_id" class="text-danger"></span></label> <label class="label-font-size" for="non_id_reason">Non ID Reason <span id="non_id_reason_lable_id" class="text-danger"></span></label>
<select class="form-control" id="non_id_reason" name="non_id_reason"> <select class="form-control" id="non_id_reason" name="non_id_reason">
<option value="">Select Reason</option> <option value="">Select Reason</option>
<?php <?php
if (isset($nonIDReason) && count($nonIDReason)) { if (isset($nonIDReason) && count($nonIDReason)) {
foreach ($nonIDReason as $key => $value) { foreach ($nonIDReason as $key => $value) {
$selected = (isset($ticket_data) && $ticket_data['non_id_reason'] == $key) ? 'selected' : ''; $selected = (isset($ticket_data) && $ticket_data['non_id_reason'] == $key) ? 'selected' : '';
echo "<option value='" . $key . "' $selected>" . $value . "</option>"; echo "<option value='" . $key . "' $selected>" . $value . "</option>";
}
} }
} ?>
?> </select>
</select> </div>
</div>
</div>
<!-- end third_data_points -->
</div> </div>
<!-- end third_data_points -->
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;"> <div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button> <button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
<?php if (get_role_id() == 5 && isset($ticket_data) && $ticket_data['claim_status_id'] == 8) { ?> <?php if (get_role_id() == 5 && isset($ticket_data) && $ticket_data['claim_status_id'] == 8) { ?>
<a class="btn btn-secondary waves-effect waves-light mr-1" onclick="showConfirmationModal(event)">Approve Claim Rejection</a> <a class="btn btn-secondary waves-effect waves-light mr-1" onclick="showConfirmationModal(event)">Approve Claim Rejection</a>
<?php } ?> <?php } ?>
<!-- <button type="button" class="btn btn-primary waves-effect waves-light mr-1" id="btnApprove" >Approve</button> --> <!-- <button type="button" class="btn btn-primary waves-effect waves-light mr-1" id="btnApprove" >Approve</button> -->
</div> </div>
</div>
</form>
</div> </div>
</form>
</div> </div>
</div> </div>
</div> </div>
<!-- Info Modal --> <!-- Info Modal -->
<div class="modal fade" id="moreInfoModal" tabindex="-1" role="dialog" aria-labelledby="fullWidthModalLabel" aria-hidden="true"> <div class="modal fade" id="moreInfoModal" tabindex="-1" role="dialog" aria-labelledby="fullWidthModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document"> <div class="modal-dialog modal-xl" role="document">
@ -1197,7 +1201,6 @@
$('#tpa_id').val(tap_id); $('#tpa_id').val(tap_id);
$('#tpa_name').val(tap_name); $('#tpa_name').val(tap_name);
} }
</script> </script>
<script> <script>
$("#infoIcon").click(function() { $("#infoIcon").click(function() {

View File

@ -8,10 +8,7 @@
padding: 4px 4px !important; padding: 4px 4px !important;
} }
.col-12 {
max-width: 98% !important;
}
.dataTables_filter { .dataTables_filter {
position: absolute; position: absolute;

View File

@ -1,69 +1,71 @@
<div class="row"> <div class="container-fluid-min">
<!-- <h3 class="ml-3">Claim Reports</h3> --> <div class="row">
<div class="col-xl-12"> <!-- <h3 class="ml-3">Claim Reports</h3> -->
<div id="accordion" class="mb-3"> <div class="col-xl-12">
<div class="card mb-1"> <div id="accordion" class="mb-3">
<h5 class="m-1"> <div class="card mb-1">
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" <h4 class="m-1">
aria-expanded="true"> <span>Filter</span>
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i> <a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
</a> aria-expanded="true">
</h5> <i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> </a>
<div class="card-body"> </h4>
<!-- <div class="text-center"> --> <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="form-row"> <div class="card-body">
<div class="form-group col-md-4" id="date_div"> <!-- <div class="text-center"> -->
<label>Date<span class="text-danger"></span></label> <div class="form-row">
<div id="reportrange" class="form-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%"> <div class="form-group col-md-4" id="date_div">
<i class="mdi mdi-calendar-blank"></i>&nbsp; <label>Date<span class="text-danger"></span></label>
<span></span> <i class="mdi mdi-menu-down"></i> <div id="reportrange" class="form-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
<i class="mdi mdi-calendar-blank"></i>&nbsp;
<span></span> <i class="mdi mdi-menu-down"></i>
</div>
<input type="hidden" id="startDate" value=<?= $default_start ?>>
<input type="hidden" id="endDate" value=<?= $default_end ?>>
</div> </div>
<input type="hidden" id="startDate" value=<?= $default_start ?>>
<input type="hidden" id="endDate" value=<?= $default_end ?>>
<div class="form-group col-md-4">
<label>Policy Type<span class="text-danger"> *</span></label> <br />
<select name="policy_type" class="form-control" id="policy_type" required>
<option value="">Select</option>
<?php foreach ($policy_type as $policy => $key) : ?>
<option value="<?= $policy ?>"><?= $key ?></option>
<?php endforeach ?>
</select>
</div>
<div class="form-group col-md-4">
<label>Report Type<span class="text-danger"> *</span></label> <br />
<select class="form-control" id="report_type" required>
<option value="0">Select</option>
<?php foreach ($report_type as $reports => $key) : ?>
<option value="<?= $reports ?>"><?= $key ?></option>
<?php endforeach ?>
</select>
</div>
</div> </div>
<div class="row justify-content-end">
<div class="col-auto">
<div class="form-group col-md-4"> <a href="#" class="btn btn-primary waves-effect waves-light submit-btn" id="get-report-page" onclick="fetchReportPage(event);">Submit</a>
<label>Policy Type<span class="text-danger"> *</span></label> <br /> </div>
<select name="policy_type" class="form-control" id="policy_type" required>
<option value="">Select</option>
<?php foreach ($policy_type as $policy => $key) : ?>
<option value="<?= $policy ?>"><?= $key ?></option>
<?php endforeach ?>
</select>
</div> </div>
<!-- </div> -->
<div class="form-group col-md-4">
<label>Report Type<span class="text-danger"> *</span></label> <br />
<select class="form-control" id="report_type" required>
<option value="0">Select</option>
<?php foreach ($report_type as $reports => $key) : ?>
<option value="<?= $reports ?>"><?= $key ?></option>
<?php endforeach ?>
</select>
</div>
</div> </div>
<div class="row justify-content-end">
<div class="col-auto">
<a href="#" class="btn btn-primary waves-effect waves-light submit-btn" id="get-report-page" onclick="fetchReportPage(event);">Submit</a>
</div>
</div>
<!-- </div> -->
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="row" id="report"></div>
</div> </div>
<div class="card mb-1">
<div id="report"></div>
</div>
<script> <script>
$(function() { $(function() {
@ -98,44 +100,43 @@
}); });
</script> </script>
<script> <script>
function fetchReportPage() {
function fetchReportPage() { var fromDate = $('#startDate').val();
var toDate = $('#endDate').val();
var policy_type = $('#policy_type').val();
var report_type = $('#report_type').val();
var requestData = {
fromDate: fromDate,
toDate: toDate,
policy_type: policy_type,
report_type: report_type
};
// console.log(requestData);
var url = '<?= base_url('/ticket/ticket_reports') ?>';
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
if (response.status == true) {
$('#report').html(response.html);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
} else {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
let message = response.message;
toastr.error(message, 'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the report page.', 'ERROR');
var fromDate = $('#startDate').val();
var toDate = $('#endDate').val();
var policy_type = $('#policy_type').val();
var report_type = $('#report_type').val();
var requestData = {
fromDate: fromDate,
toDate: toDate,
policy_type: policy_type,
report_type: report_type
};
// console.log(requestData);
var url = '<?= base_url('/ticket/ticket_reports') ?>';
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
if (response.status == true) {
$('#report').html(response.html);
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
});
}else{ }
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
let message = response.message;
toastr.error(message,'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the report page.', 'ERROR');
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
});
}
</script> </script>

View File

@ -5,249 +5,251 @@
} }
</style> </style>
<div class="row"> <div class="container-fluid-min">
<div class="col-12" style="margin-top: -12px;"> <div class="row">
<div id="accordion" class="mb-3"> <div class="col-12" style="margin-top: -12px;">
<div class="card mb-1"> <div id="accordion" class="mb-3">
<h2 class="m-3"> <div class="card mb-1">
Claim Filter <h4>
Filter
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" <a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
aria-expanded="true"> aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i> <i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a> </a>
</h2> </h4>
<div id="collapseOne" class="collapse hide" aria-labelledby="headingOne" data-parent="#accordion"> <div id="collapseOne" class="collapse hide" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body"> <div class="card-body">
<div class="form-group"> <div class="form-group">
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="ticket_type"> Claim Type <span class="text-danger"></span></label> <label for="ticket_type"> Claim Type <span class="text-danger"></span></label>
<select class="form-control" id="ticket_type" name="ticket_type"> <select class="form-control" id="ticket_type" name="ticket_type">
<option value="0">Select claim Type</option> <option value="0">Select claim Type</option>
<?php <?php
if (isset($ticket_type) && count($ticket_type)) { if (isset($ticket_type) && count($ticket_type)) {
foreach ($ticket_type as $key => $value) { foreach ($ticket_type as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>"; echo "<option value='" . $key . "'>" . $value . "</option>";
} }
} }
?> ?>
</select> </select>
</div> </div>
<!-- <div class="form-group col-md-3"> <!-- <div class="form-group col-md-3">
<label for="pod_no">POD No<span class="text-danger"></span></label> <label for="pod_no">POD No<span class="text-danger"></span></label>
<input type="text" class="form-control" id="pod_no" name="pod_no"> <input type="text" class="form-control" id="pod_no" name="pod_no">
</div> --> </div> -->
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="insurer_id">Insurer<span class="text-danger"></span></label> <label for="insurer_id">Insurer<span class="text-danger"></span></label>
<select class="form-control" id="insurer_id" name="insurer_id"> <select class="form-control" id="insurer_id" name="insurer_id">
<option value="0">Select Insurer</option> <option value="0">Select Insurer</option>
<?php <?php
if (isset($insurer_list) && count($insurer_list)) { if (isset($insurer_list) && count($insurer_list)) {
foreach ($insurer_list as $key => $value) { foreach ($insurer_list as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['name'] . "</option>"; echo "<option value='" . $value['id'] . "'>" . $value['name'] . "</option>";
} }
} }
?> ?>
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="tpa_id">TPA<span class="text-danger"></span></label> <label for="tpa_id">TPA<span class="text-danger"></span></label>
<select class="form-control" id="tpa_id" name="tpa_id"> <select class="form-control" id="tpa_id" name="tpa_id">
<option value="0">Select TPA</option> <option value="0">Select TPA</option>
<?php <?php
if (isset($tpa_list) && count($tpa_list)) { if (isset($tpa_list) && count($tpa_list)) {
foreach ($tpa_list as $key => $value) { foreach ($tpa_list as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['name'] . "</option>"; echo "<option value='" . $value['id'] . "'>" . $value['name'] . "</option>";
} }
} }
?> ?>
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="claim_no">Claim No<span class="text-danger"></span></label> <label for="claim_no">Claim No<span class="text-danger"></span></label>
<input type="text" class="form-control" id="claim_no" name="claim_no"> <input type="text" class="form-control" id="claim_no" name="claim_no">
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="client_id"> Corporate Name <span class="text-danger"></span></label> <label for="client_id"> Corporate Name <span class="text-danger"></span></label>
<select class="form-control" id="client_id" name="client_id"> <select class="form-control" id="client_id" name="client_id">
<option value="0">Select Corporate</option> <option value="0">Select Corporate</option>
<?php <?php
if (isset($client_list) && count($client_list)) { if (isset($client_list) && count($client_list)) {
foreach ($client_list as $key => $value) { foreach ($client_list as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>"; echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
} }
} }
?> ?>
</select> </select>
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="emp_code">Employee ID<span class="text-danger"></span></label> <label for="emp_code">Employee ID<span class="text-danger"></span></label>
<input type="text" class="form-control" id="emp_code" name="emp_code"> <input type="text" class="form-control" id="emp_code" name="emp_code">
</div> </div>
<!-- <div class="form-group col-md-3"> <!-- <div class="form-group col-md-3">
<label for="tpa_id">TPA ID<span class="text-danger"></span></label> <label for="tpa_id">TPA ID<span class="text-danger"></span></label>
<input type="text" class="form-control" id="tpa_id" name="tpa_id"> <input type="text" class="form-control" id="tpa_id" name="tpa_id">
</div> --> </div> -->
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="emp_mobile_no">Employee Mobile No<span <label for="emp_mobile_no">Employee Mobile No<span
class="text-danger"></span></label> class="text-danger"></span></label>
<input type="text" class="form-control" id="emp_mobile_no" name="emp_mobile_no"> <input type="text" class="form-control" id="emp_mobile_no" name="emp_mobile_no">
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="claim_status">Status<span class="text-danger"></span></label> <label for="claim_status">Status<span class="text-danger"></span></label>
<select class="form-control" id="claim_status" name="claim_status"> <select class="form-control" id="claim_status" name="claim_status">
<option value="0">Select status</option> <option value="0">Select status</option>
<?php /* <?php /*
if (isset($claim_status) && count($claim_status)) { if (isset($claim_status) && count($claim_status)) {
foreach ($claim_status as $key => $value) { foreach ($claim_status as $key => $value) {
echo "<option value=" . $value['id'] . ">" . $value['status'] . "</option>"; echo "<option value=" . $value['id'] . ">" . $value['status'] . "</option>";
} }
} }
*/ ?> */ ?>
</select> </select>
</div> </div>
<div class="form-group col-md-12 text-right m-b-0" style="margin-bottom: -15px;">
<a href="#" class="btn btn-secondary" id="clear-filters">Clear</a>
<a class="btn btn-primary" id="get-emp-list" onclick="fetchTicketListData();">Submit</a>
</div>
<div class="form-group col-md-12 text-right m-b-0" style="margin-bottom: -15px;">
<a href="#" class="btn btn-secondary" id="clear-filters">Clear</a>
<a class="btn btn-primary" id="get-emp-list" onclick="fetchTicketListData();">Submit</a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
</div> </div>
</div> </div>
<div class="row" id="ticket_list_div">
<?php include('ticket_list.php'); ?>
</div>
</div> </div>
<!-- end page title --> <!-- end page title -->
<div class="row" id="ticket_list_div">
<?php include('ticket_list.php'); ?>
</div>
<script> <script>
$(document).ready(function() {
$(document).ready(function() {
// Initialize select2 // Initialize select2
$('#client_id').select2(); $('#client_id').select2();
$('#claim_status').select2(); $('#claim_status').select2();
$('#insurer_id').select2(); $('#insurer_id').select2();
$('#tpa_id').select2(); $('#tpa_id').select2();
}); });
$('#ticket_type').on('change',function(){ $('#ticket_type').on('change', function() {
var ticket_type = $('#ticket_type').val(); var ticket_type = $('#ticket_type').val();
var claim_status = <?= json_encode($claim_status) ?>; var claim_status = <?= json_encode($claim_status) ?>;
$('#claim_status').empty(); $('#claim_status').empty();
$('#claim_status').append($('<option>', { $('#claim_status').append($('<option>', {
value: '', value: '',
text: 'Select Claim Status' text: 'Select Claim Status'
})); }));
// console.log('Claim Status:', claim_status); // console.log('Claim Status:', claim_status);
for (var i = 0;i<claim_status.length;i++){ for (var i = 0; i < claim_status.length; i++) {
if(claim_status[i]['ticket_type'] == ticket_type){ if (claim_status[i]['ticket_type'] == ticket_type) {
$('#claim_status').append($('<option>', { $('#claim_status').append($('<option>', {
value: claim_status[i]['id'], // Use 'id' as the value value: claim_status[i]['id'], // Use 'id' as the value
text: claim_status[i]['claim_status'] // Use 'claim_status' as the text text: claim_status[i]['claim_status'] // Use 'claim_status' as the text
})); }));
} }
} }
}) })
function fetchTicketListData() { function fetchTicketListData() {
var ticket_type = $('#ticket_type').val(); var ticket_type = $('#ticket_type').val();
var pod_no = $('#pod_no').val(); var pod_no = $('#pod_no').val();
var claim_no = $('#claim_no').val(); var claim_no = $('#claim_no').val();
var emp_code = $('#emp_code').val(); var emp_code = $('#emp_code').val();
var claim_status = $('#claim_status').val(); var claim_status = $('#claim_status').val();
var emp_mobile_no = $('#emp_mobile_no').val(); var emp_mobile_no = $('#emp_mobile_no').val();
var tpa_id = $('#tpa_id').val(); var tpa_id = $('#tpa_id').val();
var client_id = $('#client_id').val(); var client_id = $('#client_id').val();
var insurer_id = $('#insurer_id').val(); var insurer_id = $('#insurer_id').val();
var tpa_id = $('#tpa_id').val(); var tpa_id = $('#tpa_id').val();
var requestData = { var requestData = {
ticket_type_id: ticket_type, ticket_type_id: ticket_type,
pod_no: pod_no, pod_no: pod_no,
claim_number: claim_no, claim_number: claim_no,
emp_code: emp_code, emp_code: emp_code,
claim_status_id: claim_status, claim_status_id: claim_status,
emp_mobile: emp_mobile_no, emp_mobile: emp_mobile_no,
tpa_id: tpa_id, tpa_id: tpa_id,
client_id: client_id, client_id: client_id,
insurer_id: insurer_id, insurer_id: insurer_id,
tpa_id: tpa_id, tpa_id: tpa_id,
}; };
let filterData = requestData; let filterData = requestData;
localStorage.setItem('filterData', JSON.stringify(filterData)); localStorage.setItem('filterData', JSON.stringify(filterData));
console.log("requestData", requestData); console.log("requestData", requestData);
var url = '<?= base_url('/ticket/list') ?>'; var url = '<?= base_url('/ticket/list') ?>';
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) { sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
console.log('Filter Responce', response); console.log('Filter Responce', response);
if (response.status == true) {
$('#ticket_list_div').empty();
$('#ticket_list_div').html(response.html);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
} else {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
let message = response.message;
toastr.error(message, 'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the data.', 'ERROR');
if (response.status == true) {
$('#ticket_list_div').empty();
$('#ticket_list_div').html(response.html);
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
});
} else {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
let message = response.message;
toastr.error(message, 'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the data.', 'ERROR');
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
});
} }
</script> </script>
<script> <script>
$(document).ready(function(){ $(document).ready(function() {
let filterData = localStorage.getItem('filterData'); let filterData = localStorage.getItem('filterData');
filterData = filterData ? JSON.parse(filterData) : null; filterData = filterData ? JSON.parse(filterData) : null;
console.log('Filter Data', filterData); console.log('Filter Data', filterData);
if(filterData){ if (filterData) {
var url = '<?= base_url('/ticket/list') ?>'; var url = '<?= base_url('/ticket/list') ?>';
$('.loader').fadeIn(); $('.loader').fadeIn();
@ -255,29 +257,29 @@ function fetchTicketListData() {
sendAjaxRequestForGlobal(url, 'POST', filterData, function(response) { sendAjaxRequestForGlobal(url, 'POST', filterData, function(response) {
console.log('Filter Responce', response); console.log('Filter Responce', response);
if (response.status == true) {
$('#ticket_list_div').empty();
$('#ticket_list_div').html(response.html);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
} else {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
let message = response.message;
toastr.error(message, 'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the data.', 'ERROR');
if (response.status == true) {
$('#ticket_list_div').empty();
$('#ticket_list_div').html(response.html);
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
});
} else {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
let message = response.message;
toastr.error(message, 'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the data.', 'ERROR');
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
});
$('#ticket_type').val(filterData.ticket_type_id); $('#ticket_type').val(filterData.ticket_type_id);
$('#pod_no').val(filterData.pod_no); $('#pod_no').val(filterData.pod_no);
@ -295,9 +297,9 @@ function fetchTicketListData() {
</script> </script>
<script> <script>
$(document).on('click', '#clear-filters', function (e) { $(document).on('click', '#clear-filters', function(e) {
e.preventDefault(); // Stops the browser from following the link e.preventDefault(); // Stops the browser from following the link
console.log('Clear Filters Area'); console.log('Clear Filters Area');
@ -312,9 +314,7 @@ function fetchTicketListData() {
$('#tpa_id').val('0'); $('#tpa_id').val('0');
$('#client_id').val('0'); $('#client_id').val('0');
$('#insurer_id').val('0'); $('#insurer_id').val('0');
window.location.href = "<?= base_url("/ticket/list")?>";
});
window.location.href = "<?= base_url("/ticket/list") ?>";
});
</script> </script>

View File

@ -1,6 +1,5 @@
<style> <style>
.custom-dropdown-menu {
.custom-dropdown-menu {
display: none; display: none;
position: absolute; position: absolute;
background-color: #ffffff !important; background-color: #ffffff !important;
@ -10,310 +9,312 @@
min-width: 10rem; min-width: 10rem;
z-index: 9999; z-index: 9999;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
} }
.custom-dropdown-menu .dropdown-item { .custom-dropdown-menu .dropdown-item {
display: block !important; display: block !important;
width: 100% !important; width: 100% !important;
padding: 0.5rem 1rem !important; padding: 0.5rem 1rem !important;
color: #212529 !important; color: #212529 !important;
text-decoration: none !important; text-decoration: none !important;
background-color: transparent !important; background-color: transparent !important;
} }
.custom-dropdown-menu .dropdown-item:hover { .custom-dropdown-menu .dropdown-item:hover {
background-color: #f8f9fa !important; background-color: #f8f9fa !important;
color: #16181b !important; color: #16181b !important;
cursor: pointer !important; cursor: pointer !important;
} }
.btn-color{ .btn-color {
background-color: rgba(52, 174, 178, 1); background-color: rgba(52, 174, 178, 1);
color: white; color: white;
border:1px solid rgba(52, 174, 178, 1); border: 1px solid rgba(52, 174, 178, 1);
} }
.btn-color:hover{ .btn-color:hover {
background-color: rgba(41, 139, 142, 1); background-color: rgba(41, 139, 142, 1);
color: white; color: white;
border:1px solid rgba(41, 139, 142, 1); border: 1px solid rgba(41, 139, 142, 1);
} }
</style> </style>
<div class="row" id="tpa_list"> <div class="container-fluid-min">
<div class="row" id="tpa_list">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-body maincard"> <div class="card-body maincard">
<!-- <div class="row" style="margin-bottom:1rem;"> <!-- <div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;"> <div class="col-6" style="align-self: center;">
<h4 style="position: relative;">TPA</h4> <h4 style="position: relative;">TPA</h4>
</div> </div>
</div> --> </div> -->
<table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" <table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
id="tickets-table"> id="tickets-table">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th class="font-weight-medium">Name</th> <th class="font-weight-medium">Name</th>
<th class="font-weight-medium">Action</th> <th class="font-weight-medium">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php if(is_array($tpaList)) {foreach($tpaList as $row){ ?> <?php if (is_array($tpaList)) {
<tr> foreach ($tpaList as $row) { ?>
<td><?php echo $row['name']; ?> ( <?php echo $row['short_name']; ?> ) </td> <tr>
<td> <td><?php echo $row['name']; ?> ( <?php echo $row['short_name']; ?> ) </td>
<div class="btn-group dropdown"> <td>
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a> <div class="btn-group dropdown">
<div class="dropdown-menu dropdown-menu-right"> <a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<a class="dropdown-item" href="<?= base_url("master/tpa/list/"); ?><?= $row['id'];?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a> <div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removeTPA(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a> <a class="dropdown-item" href="<?= base_url("master/tpa/list/"); ?><?= $row['id']; ?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
</div> <a class="dropdown-item" data-id="<?= $row['id']; ?>" onclick="removeTPA(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
</div> </div>
</td> </div>
</tr> </td>
<?php }}?> </tr>
<?php }
} ?>
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
</div>
</div><!-- end col --> </div><!-- end col -->
</div>
</div> </div>
<!-- end row --> <!-- end row -->
<script> <script>
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function() {
const table = document.getElementById("tickets-table"); const table = document.getElementById("tickets-table");
// Create custom dropdown // Create custom dropdown
function createCustomDropdown(row) { function createCustomDropdown(row) {
// Get the original dropdown items // Get the original dropdown items
const originalDropdown = row.querySelector('.dropdown-menu'); const originalDropdown = row.querySelector('.dropdown-menu');
if (!originalDropdown) return null; if (!originalDropdown) return null;
// Create new dropdown with proper background and spacing // Create new dropdown with proper background and spacing
const customDropdown = document.createElement('div'); const customDropdown = document.createElement('div');
customDropdown.className = 'custom-dropdown-menu'; customDropdown.className = 'custom-dropdown-menu';
// Copy inner content while maintaining icon alignment // Copy inner content while maintaining icon alignment
customDropdown.innerHTML = originalDropdown.innerHTML; customDropdown.innerHTML = originalDropdown.innerHTML;
return customDropdown; return customDropdown;
} }
let activeDropdown = null; let activeDropdown = null;
// Add click event listener to rows // Add click event listener to rows
table.querySelectorAll("tbody tr").forEach(row => { table.querySelectorAll("tbody tr").forEach(row => {
const customDropdown = createCustomDropdown(row); const customDropdown = createCustomDropdown(row);
if (!customDropdown) return; if (!customDropdown) return;
document.body.appendChild(customDropdown);
row.addEventListener("click", function(event) { document.body.appendChild(customDropdown);
// Ignore clicks on the action column
if (event.target.closest('td:last-child')) {
return;
}
// Hide any active dropdown row.addEventListener("click", function(event) {
if (activeDropdown) { // Ignore clicks on the action column
activeDropdown.style.display = 'none'; if (event.target.closest('td:last-child')) {
} return;
}
// Get click position // Hide any active dropdown
const rect = event.target.getBoundingClientRect(); if (activeDropdown) {
activeDropdown.style.display = 'none';
// Position the dropdown with some offset }
customDropdown.style.display = 'block';
customDropdown.style.position = 'fixed'; // Get click position
customDropdown.style.left = `${rect.left}px`; const rect = event.target.getBoundingClientRect();
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
// Position the dropdown with some offset
// Set as active dropdown customDropdown.style.display = 'block';
activeDropdown = customDropdown; customDropdown.style.position = 'fixed';
customDropdown.style.left = `${rect.left}px`;
event.stopPropagation(); customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
});
// Set as active dropdown
// Preserve click handlers and add auto-close activeDropdown = customDropdown;
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
item.addEventListener('click', function(e) { event.stopPropagation();
e.preventDefault(); });
const onclickAttr = this.getAttribute('onclick');
if (onclickAttr) { // Preserve click handlers and add auto-close
eval(onclickAttr); customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
} item.addEventListener('click', function(e) {
e.preventDefault();
const href = this.getAttribute('href'); const onclickAttr = this.getAttribute('onclick');
if (href && href !== '#') { if (onclickAttr) {
window.location.href = href; eval(onclickAttr);
} }
// Close the dropdown after handling the click const href = this.getAttribute('href');
if (activeDropdown) { if (href && href !== '#') {
activeDropdown.style.display = 'none'; window.location.href = href;
activeDropdown = null; }
}
// Close the dropdown after handling the click
e.stopPropagation(); if (activeDropdown) {
}); activeDropdown.style.display = 'none';
activeDropdown = null;
}
e.stopPropagation();
}); });
});
}); });
// Close dropdown when clicking outside // Close dropdown when clicking outside
document.addEventListener("click", function() { document.addEventListener("click", function() {
if (activeDropdown) { if (activeDropdown) {
activeDropdown.style.display = 'none'; activeDropdown.style.display = 'none';
activeDropdown = null; activeDropdown = null;
} }
}); });
}); });
</script> </script>
<script> <script>
$(document).ready(function() {
$(document).ready(function(){ $('#tickets-table').DataTable({
dom: "<'d-flex justify-content-between align-items-center'<'datatable-search'f><'datatable-buttons'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
buttons: [{
extend: 'csv',
text: 'CSV',
title: 'TPAList',
exportOptions: {
columns: ':not(:last-child)'
}
},
{
text: 'ADD',
className: 'btn btn-color',
action: function() {
window.location.href = "<?= base_url("master/tpa/create"); ?>";
}
}
$('#tickets-table').DataTable({ ],
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>" ,
buttons: [
{
extend: 'csv',
text: 'CSV',
title: 'TPAList',
exportOptions: {
columns: ':not(:last-child)'
}
},
{
text: 'ADD',
className: 'btn btn-color',
action: function () {
window.location.href = "<?= base_url("master/tpa/create"); ?>";
}
}
],
language: { language: {
search: ` search: `
<div class="datatable-search-wrapper"> <div class="datatable-search-wrapper">
_INPUT_ _INPUT_
<i class="mdi mdi-magnify datatable-search-icon"></i> <i class="mdi mdi-magnify datatable-search-icon"></i>
</div>`, </div>`,
searchPlaceholder: "Search" searchPlaceholder: "Search"
}, },
paging: true , paging: true,
}); });
}) })
const btnExport = document.querySelector("#btnExport"); const btnExport = document.querySelector("#btnExport");
const tableElement = document.querySelector("#tickets-table"); const tableElement = document.querySelector("#tickets-table");
btnExport.addEventListener("click", () => { btnExport.addEventListener("click", () => {
const obj = new csvExport(tableElement); const obj = new csvExport(tableElement);
const csvData = obj.exportCsv(); const csvData = obj.exportCsv();
const blob = new Blob([csvData], { type: "text/csv" }); const blob = new Blob([csvData], {
const url = URL.createObjectURL(blob); type: "text/csv"
const a = document.createElement("a"); });
a.href = url; const url = URL.createObjectURL(blob);
a.download = "TPAList.csv"; const a = document.createElement("a");
a.click(); a.href = url;
a.download = "TPAList.csv";
a.click();
setTimeout(() => { setTimeout(() => {
URL.revokeObjectURL(url); URL.revokeObjectURL(url);
}, 500); }, 500);
}); });
class csvExport { class csvExport {
constructor(table, header = true) { constructor(table, header = true) {
this.table = table; this.table = table;
this.rows = Array.from(table.querySelectorAll("tr")); this.rows = Array.from(table.querySelectorAll("tr"));
if (!header && this.rows[0].querySelectorAll("th").length) { if (!header && this.rows[0].querySelectorAll("th").length) {
this.rows.shift(); this.rows.shift();
}
}
exportCsv() {
const lines = [];
const ncols = this._longestRow();
for (const row of this.rows) {
let line = "";
for (let i = 0; i < ncols - 1; i++) { // Exclude the last column
if (row.children[i] !== undefined) {
line += csvExport.safeData(row.children[i]);
}
line += i !== ncols - 2 ? "," : ""; // Adjusted for the last column exclusion
} }
lines.push(line);
} }
return lines.join("\n");
exportCsv() {
const lines = [];
const ncols = this._longestRow();
for (const row of this.rows) {
let line = "";
for (let i = 0; i < ncols - 1; i++) { // Exclude the last column
if (row.children[i] !== undefined) {
line += csvExport.safeData(row.children[i]);
}
line += i !== ncols - 2 ? "," : ""; // Adjusted for the last column exclusion
}
lines.push(line);
}
return lines.join("\n");
}
_longestRow() {
return this.rows.reduce((length, row) => (row.childElementCount > length ? row.childElementCount : length), 0);
}
static safeData(td) {
let data = td.textContent;
//Replace all double quote to two double quotes
data = data.replace(/"/g, `""`);
//Replace , and \n to double quotes
data = /[",\n"]/.test(data) ? `"${data}"` : data;
return data;
}
} }
_longestRow() {
return this.rows.reduce((length, row) => (row.childElementCount > length ? row.childElementCount : length), 0);
}
static safeData(td) { function removeTPA(element) {
let data = td.textContent;
//Replace all double quote to two double quotes
data = data.replace(/"/g, `""`);
//Replace , and \n to double quotes
data = /[",\n"]/.test(data) ? `"${data}"` : data;
return data;
}
}
Swal.fire({
title: "Are you sure?",
text: "You need to remove this TPA",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
function removeTPA(element) { if (result.isConfirmed) {
var id = element.getAttribute('data-id');
Swal.fire({ var form_action = '<?= base_url("master/tpa/remove/") ?>' + id;
title: "Are you sure?", $.ajax({
text: "You need to remove this TPA", url: form_action,
icon: "info", type: "GET",
showCancelButton: true, dataType: 'json',
confirmButtonColor: "#3085d6", processData: false,
confirmButtonText: "Yes", contentType: false,
}).then((result) => { success: function(res) {
// console.log(res.status == true);
if (result.isConfirmed) { if (res) {
var id = element.getAttribute('data-id'); if (res.status == true) {
var form_action = '<?= base_url("master/tpa/remove/") ?>' + id; toastr.success('TPA removed successfully', 'success');
$.ajax({ location.reload();
url: form_action, } else {
type: "GET", toastr.warning('Failed to remove TPA', 'warning');
dataType: 'json', }
processData: false,
contentType: false,
success: function(res) {
// console.log(res.status == true);
if(res){
if (res.status == true) {
toastr.success('TPA removed successfully', 'success');
location.reload();
} else {
toastr.warning('Failed to remove TPA', 'warning');
}
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Failed to remove TPA', 'warning');
}
});
} }
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Failed to remove TPA', 'warning');
}
}); });
}
});
} }
</script> </script>

File diff suppressed because it is too large Load Diff