nhance/app/Views/layout/footer.php

1000 lines
46 KiB
PHP
Executable File

</div> <!-- container -->
</div> <!-- content -->
<?php include(__DIR__ . '/../ticket_type_modal.php'); ?>
<!-- Footer Start -->
<div style="display: block;">
<footer class="footer">
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<script>
document.write(new Date().getFullYear())
</script> &copy; NHANCE
</div>
<!-- <div class="col-md-6">
<div class="text-md-right footer-links d-none d-sm-block">
<a href="javascript:void(0);">About Us</a>
<a href="javascript:void(0);">Help</a>
<a href="javascript:void(0);">Contact Us</a>
</div>
</div> -->
</div>
</div>
</footer>
</div>
<!-- end Footer -->
</div>
<!-- ============================================================== -->
<!-- End Page content -->
<!-- ============================================================== -->
</div>
<!-- END wrapper -->
<!-- Right Sidebar -->
<div class="right-bar">
<div class="h-100">
<!-- Notifications Header -->
<h6 class="font-weight-medium px-3 m-0 py-2 font-13 text-uppercase bg-light fixed-header">
<i class="mdi mdi-message-text-outline font-22"></i>
<span class="header-title">Notification</span>
</h6>
<div class="scrollable-content">
<ul class="list-unstyled" id="messages-list">
<!-- Notifications list items go here -->
</ul>
</div>
<!-- Pending Action Header -->
<h6 class="font-weight-medium px-3 m-0 py-2 font-13 bg-light fixed-header">
<i class="mdi mdi-format-list-checks font-22"></i>
<span class="header-title">TO DOs</span>
</h6>
<div class="scrollable-content">
<ul class="list-unstyled" id="messages-list-2">
<!-- Pending action list items go here -->
</ul>
</div>
</div> <!-- end simplebar -->
</div>
<!-- /Right-bar -->
<!-- Right bar overlay-->
<div class="rightbar-overlay"></div>
<!-- Vendor js -->
<script src="<?= base_url() . "public"; ?>/assets/js/vendor.min.js"></script>
<!-- KNOB JS -->
<script src="<?= base_url() . "public"; ?>/assets/libs/jquery-knob/jquery.knob.min.js"></script>
<!-- Apex js-->
<script src="<?= base_url() . "public"; ?>/assets/libs/apexcharts/apexcharts.min.js"></script>
<!-- third party js -->
<script src="<?= base_url() . "public"; ?>/assets/libs/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/libs/datatables.net-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/libs/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/libs/datatables.net-responsive-bs4/js/responsive.bootstrap4.min.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/libs/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/libs/datatables.net-buttons-bs4/js/buttons.bootstrap4.min.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/libs/datatables.net-buttons/js/buttons.html5.min.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/libs/datatables.net-buttons/js/buttons.flash.min.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/libs/datatables.net-buttons/js/buttons.print.min.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/libs/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/libs/datatables.net-select/js/dataTables.select.min.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/libs/pdfmake/build/pdfmake.min.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/libs/pdfmake/build/vfs_fonts.js"></script>
<!-- third party js ends -->
<script src="<?= base_url() . "public"; ?>/assets/libs/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/libs/moment/min/moment.min.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/libs/bootstrap-daterangepicker/daterangepicker.js"></script>
<!-- Datatables init -->
<!-- <script src="<?= base_url() . "public"; ?>/assets/js/pages/datatables.init.js"></script> -->
<script src="<?= base_url() . "public"; ?>/assets/js/pages/tickets.init.js"></script>
<!-- Plugins js-->
<script src="<?= base_url() . "public"; ?>/assets/libs/admin-resources/jquery.vectormap/jquery-jvectormap-1.2.2.min.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/libs/admin-resources/jquery.vectormap/maps/jquery-jvectormap-us-merc-en.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/libs/parsleyjs/parsley.min.js"></script>
<!-- Dashboard init-->
<script src="<?= base_url() . "public"; ?>/assets/js/pages/dashboard-analytics.init.js"></script>
<!-- Validation init js-->
<script src="<?= base_url() . "public"; ?>/assets/js/pages/form-validation.init.js"></script>
<!-- App js -->
<script src="<?= base_url() . "public"; ?>/assets/js/app.min.js"></script>
<!-- Sweet Alert CDN -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap-multiselect@1.1.0/dist/js/bootstrap-multiselect.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.13/css/bootstrap-multiselect.css" />
<script src="https://cdn.jsdelivr.net/npm/toastr@2.1.4/toastr.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/toastr@2.1.4/build/toastr.min.css" rel="stylesheet">
<!-- flatpicker datepicker -->
<link href="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/flatpickr.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/flatpickr.min.js"></script>
<!-- bootstrap datepicker -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.10.0/js/bootstrap-datepicker.min.js"></script> -->
<script src="<?= base_url() . "public"; ?>/assets/js/pages/jquery.xeditable.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/js/form-xeditable.init.js"></script>
<script src="<?= base_url() . "public"; ?>/assets/js/bootstrap-editable.min.js"></script>
<!-- Jodit Js -->
<script src="<?= base_url() . "public"; ?>/assets/js/jodit.min.js"></script>
<!-- select2 -->
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<script src="https://cdn.datatables.net/plug-ins/2.0.8/sorting/scientific.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.7.1/jszip.min.js"></script>
<script>
toastr.options = {
"timeOut": 5000,
"closeButton": true,
};
</script>
<script>
var pullNotificationCount = 0;
var pendingActionCount = 0;
$(document).ready(function() {
function fetchMessages() {
$.ajax({
url: '<?= base_url('dashboard/get-notification') ?>',
method: 'GET',
success: function(response) {
// console.log('responce', response)
if(response.status == false){
$('#notification_count').html('0')
console.log('The session is not set correctly. ')
return;
}
let messagesList = $('#messages-list');
messagesList.empty();
var html = "";
pullNotificationCount = response.message.length
localStorage.setItem('pullNotificationCount', pullNotificationCount)
response.message.forEach(message => {
// if (!message.is_read) {
// unreadCount++;
// }
var jasonDecodeData = JSON.parse(message.message_text)
var toast_body_css = 'background : #bfd7eb !important;';
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
var toast_status_word = 'Success';
if (jasonDecodeData.msg_status == 'failure') {
toast_body_css = 'background : #fdcfcf !important;';
toast_head_css = 'background-color : rgb(235 105 105 / 85%) !important; color :#000; border-bottom: 0;';
toast_icon = 'mdi mdi-information mr-auto'
toast_status_word = 'Failure';
} else if (jasonDecodeData.msg_status == 'success') {
toast_body_css = 'background : #bfd7eb !important;';
toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto'
toast_status_word = 'Success';
}
var html = ` <li data-id="${message.id}" data-url="${jasonDecodeData.action_url != undefined && jasonDecodeData.action_url != "" ? jasonDecodeData.action_url : 'dashboard/view'}">
<div class="p-3">
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
<div class="toast-header " style="${toast_head_css}" >
<strong class="${toast_icon}"> ${toast_status_word}</strong>
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="toast-body" style="${toast_body_css}">
<strong>${jasonDecodeData.msg_title ? jasonDecodeData.msg_title : ''}</strong> <br><br>
<small style="position: relative;bottom: 8px;">${jasonDecodeData.message_text}</small>
<div class="toast-footer">
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 25px;position: relative;top: 2px;">${jasonDecodeData.action_url != undefined && jasonDecodeData.action_url != "" ? 'see more' : ''}</small></a>
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;">${formatDate(message.created_at)}</small>
</div>
</div>
</div>
</div>
</li>`
messagesList.append(html);
$(function() {
$('[data-toggle="tooltip"]').tooltip();
});
});
},
error: function(xhr, status, error) {
console.error(xhr.responseText); // Log the error response
}
});
let PNCount = parseInt(localStorage.getItem('pullNotificationCount'));
let PACount = parseInt(localStorage.getItem('pendingActionCount'));
totalcount = PNCount + PACount
$('#notification_count').html(totalcount);
}
function acknowledgeMessage(messageId) {
$.ajax({
url: '<?= base_url('dashboard/acknowledge-notification/') ?>' + messageId,
method: 'GET',
success: function(response) {
fetchMessages();
},
error: function(xhr, status, error) {
console.error(xhr.responseText); // Log the error response
}
});
}
$('#messages-list').on('click', 'li', function(event) {
//console.log('messages-list click li')
if ($(event.target).closest('.rm_msg').length > 0) {
//console.log('.rm_msg')
let messageId = $(this).data('id');
let url = $(this).data('url');
acknowledgeMessage(messageId);
$(this).delay(300).fadeOut('slow', function() {
$(this).remove();
});
} else if ($(event.target).closest('.redirect_page').length > 0) {
//console.log('redirect_page')
let messageId = $(this).data('id');
let url = $(this).data('url');
//console.log('url : ', url)
acknowledgeMessage(messageId);
window.location.href = '<?= base_url() ?>' + url;
}
});
// fetchMessages();
// setInterval(fetchMessages, 60000); // Fetch messages every sixty seconds
});
$(document).ready(function() {
function fetchPendingAction() {
$.ajax({
url: '<?= base_url('dashboard/get-pending-action') ?>',
method: 'GET',
success: function(response) {
console.log(response);
if (response.length == 0) {
pendingActionCount = 0;
localStorage.setItem('pendingActionCount', pendingActionCount);
}
for (let key in response) {
// console.log(response[key].length)
// console.log('type', typeof response[key].length)
// console.log('key', response[key])
if(response[key].length != 'undefined' && response[key].length != undefined)
{
pendingActionCount = pendingActionCount + response[key].length;
}
}
console.log(pendingActionCount);
let messagesList = $('#messages-list-2');
messagesList.empty();
if (response.inception) {
$.each(response.inception, function(index, item) {
var queryParams = {
client_id: item.client_id,
client_policy_id: item.client_policy_id,
client_branch_id: item.branch_id,
actions: 'inception'
};
const queryString = objectToQueryString(queryParams);
var url = 'employee/upload?' + queryString
////console.log(url)
var toast_body_css = 'background : #bfd7eb !important;';
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
var toast_status_word = 'Info';
if (!item.branch_name.toLowerCase().includes('branch')) {
//console.log(item.branch_name)
item.branch_name += ' branch';
}
////console.log(item.branch_name);
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
////console.log(toast_body_data);
var html = ` <li data-id="" data-url="${url}">
<div class="p-3">
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
<div class="toast-header " style="${toast_head_css}" >
<strong class="${toast_icon}"> ${toast_status_word}</strong>
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="toast-body" style="${toast_body_css}">
<strong>Inception Pending</strong><br><br>
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
<div class="toast-footer">
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
</div>
</div>
</div>
</div>
</li>`
messagesList.append(html);
});
} else {
console.log('response.inception is undefined or null');
}
if (response.correction) {
$.each(response.correction, function(index, item) {
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
var queryParams = {
client_id: item.client_id,
client_branch_id: item.branch_id,
event: 'correction',
actions: 'export',
insurer_or_tpa: 'tpa',
};
const queryString = objectToQueryString(queryParams);
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
////console.log(url)
var toast_body_css = 'background : #bfd7eb !important;';
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
var toast_status_word = 'Info';
var title = 'Correction Pending';
if (!item.branch_name.toLowerCase().includes('branch')) {
//console.log(item.branch_name)
item.branch_name += ' branch';
}
////console.log(item.branch_name);
// if (item.batch_export_count > 0) {
// title = 'Correction Import Pending';
// }
var toast_body_data = item.client_name + ' - ' + item.branch_name;
////console.log(toast_body_data);
var html = ` <li data-id="" data-url="${url}">
<div class="p-3">
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
<div class="toast-header " style="${toast_head_css}" >
<strong class="${toast_icon}"> ${toast_status_word}</strong>
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="toast-body" style="${toast_body_css}">
<strong>${title}</strong><br><br>
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
<div class="toast-footer">
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
</div>
</div>
</div>
</div>
</li>`
messagesList.append(html);
}
});
}else{
console.log('response.correction is undefined or null');
}
if (response.deletion) {
$.each(response.deletion, function(index, item) {
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
var queryParams = {
client_id: item.client_id,
client_policy_id: item.client_policy_id,
client_branch_id: item.branch_id,
event: 'deletion',
actions: 'export',
insurer_or_tpa: 'tpa',
};
const queryString = objectToQueryString(queryParams);
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
////console.log(url)
var toast_body_css = 'background : #bfd7eb !important;';
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
var toast_status_word = 'Info';
var title = 'Deletion Pending';
if (!item.branch_name.toLowerCase().includes('branch')) {
//console.log(item.branch_name)
item.branch_name += ' branch';
}
////console.log(item.branch_name);
// if (item.batch_export_count > 0) {
// title = 'Deletion Import Pending';
// }
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
////console.log(toast_body_data);
var html = ` <li data-id="" data-url="${url}">
<div class="p-3">
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
<div class="toast-header " style="${toast_head_css}" >
<strong class="${toast_icon}"> ${toast_status_word}</strong>
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="toast-body" style="${toast_body_css}">
<strong>${title}</strong><br><br>
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
<div class="toast-footer">
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
</div>
</div>
</div>
</div>
</li>`
messagesList.append(html);
}
});
}else{
console.log('response.deletion is undefined or null');
}
if (response.si_enhancement) {
$.each(response.si_enhancement, function(index, item) {
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
var queryParams = {
client_id: item.client_id,
client_policy_id: item.client_policy_id,
client_branch_id: item.branch_id,
event: 'si_enhancement',
actions: 'export',
insurer_or_tpa: 'tpa',
};
const queryString = objectToQueryString(queryParams);
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
////console.log(url)
var toast_body_css = 'background : #bfd7eb !important;';
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
var toast_status_word = 'Info';
var title = 'SI Enhancement Pending';
if (!item.branch_name.toLowerCase().includes('branch')) {
//console.log(item.branch_name)
item.branch_name += ' branch';
}
////console.log(item.branch_name);
// if (item.batch_export_count > 0) {
// title = 'SI Enhancement Import Pending';
// }
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
////console.log(toast_body_data);
var html = ` <li data-id="" data-url="${url}">
<div class="p-3">
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
<div class="toast-header " style="${toast_head_css}" >
<strong class="${toast_icon}"> ${toast_status_word}</strong>
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="toast-body" style="${toast_body_css}">
<strong>${title}</strong><br><br>
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
<div class="toast-footer">
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
</div>
</div>
</div>
</div>
</li>`
messagesList.append(html);
}
});
}else{
console.log('response.si_enhancement is undefined or null');
}
if (response.tpa) {
$.each(response.tpa, function(index, item) {
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
var queryParams = {
client_id: item.client_id,
client_policy_id: item.client_policy_id,
client_branch_id: item.branch_id,
event: 'inception',
insurer_or_tpa: 'tpa',
actions: 'export',
};
const queryString = objectToQueryString(queryParams);
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
////console.log(url)
var toast_body_css = 'background : #bfd7eb !important;';
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
var toast_status_word = 'Info';
var title = 'TPA Pending';
if (!item.branch_name.toLowerCase().includes('branch')) {
//console.log(item.branch_name)
item.branch_name += ' branch';
}
////console.log(item.branch_name);
// if (item.batch_export_count > 0) {
// title = 'TPA Import Pending';
// }
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
////console.log(toast_body_data);
var html = ` <li data-id="" data-url="${url}">
<div class="p-3">
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
<div class="toast-header " style="${toast_head_css}" >
<strong class="${toast_icon}"> ${toast_status_word}</strong>
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="toast-body" style="${toast_body_css}">
<strong>${title}</strong><br><br>
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
<div class="toast-footer">
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
</div>
</div>
</div>
</div>
</li>`
messagesList.append(html);
}
});
}else{
console.log('response.tpa is undefined or null');
}
if (response.uhid) {
$.each(response.uhid, function(index, item) {
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
var queryParams = {
client_id: item.client_id,
client_policy_id: item.client_policy_id,
client_branch_id: item.branch_id,
event: 'inception',
insurer_or_tpa: 'insurer',
actions: 'export',
};
const queryString = objectToQueryString(queryParams);
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
//console.log(url)
var toast_body_css = 'background : #bfd7eb !important;';
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
var toast_status_word = 'Info';
var title = 'Insurer Pending';
if (!item.branch_name.toLowerCase().includes('branch')) {
//console.log(item.branch_name)
item.branch_name += ' branch';
}
////console.log(item.branch_name);
// if (item.batch_export_count > 0) {
// title = 'Insurer Import Pending';
// }
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
////console.log(toast_body_data);
var html = ` <li data-id="" data-url="${url}">
<div class="p-3">
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
<div class="toast-header " style="${toast_head_css}" >
<strong class="${toast_icon}"> ${toast_status_word}</strong>
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="toast-body" style="${toast_body_css}">
<strong>${title}</strong><br><br>
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
<div class="toast-footer">
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
</div>
</div>
</div>
</div>
</li>`
messagesList.append(html);
}
});
}else{
console.log('response.uhid is undefined or null');
}
localStorage.setItem('pendingActionCount', pendingActionCount)
},
error: function(xhr, status, error) {
console.error(xhr.responseText); // Log the error response
}
});
}
fetchPendingAction()
$('#messages-list-2').on('click', 'li', function(event) {
//console.log('messages-list-2 click li')
if ($(event.target).closest('.rm_msg').length > 0) {
//console.log('.rm_msg')
$(this).delay(300).fadeOut('slow', function() {
$(this).remove();
});
} else if ($(event.target).closest('.redirect_page').length > 0) {
//console.log('redirect_page')
let url = $(this).data('url');
//console.log('url : ', url);
window.location.href = '<?= base_url() ?>' + url;
}
});
})
function objectToQueryString(obj) {
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
}
</script>
<script>
function formatDate(dateString)
{
// Parse the input date string
let date = new Date(dateString);
// Define months array
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
// Extract day, month, year, hours, and minutes
let day = date.getDate();
let month = months[date.getMonth()];
let year = date.getFullYear();
let hours = date.getHours();
let minutes = date.getMinutes();
// Convert hours to 12-hour format
let period = hours >= 12 ? 'pm' : 'am';
hours = hours % 12;
hours = hours ? hours : 12; // Handle midnight (0 hours)
// Format the time string
let timeString = ('0' + hours).slice(-2) + ':' + ('0' + minutes).slice(-2) + ' ' + period;
// Format the date string
let formattedDate = day + '-' + month + '-' + year + ' ' + timeString;
return formattedDate;
}
function printCurrentTime()
{
var now = new Date();
var hours = now.getHours().toString().padStart(2, '0');
var minutes = now.getMinutes().toString().padStart(2, '0');
var seconds = now.getSeconds().toString().padStart(2, '0');
var currentTime = hours + ':' + minutes + ':' + seconds;
// console.log("Current Time:", currentTime);
return currentTime;
}
</script>
<script>
function checkDuplicateTableFieldValue(tableName, fieldName, value, callback) {
$.ajax({
url: '<?= base_url('util/checkDuplicateTableFieldValue') ?>', // Adjust this to your endpoint in CodeIgniter
type: 'POST',
data: {
table: tableName,
field: fieldName,
value: value
},
dataType: 'json',
success: function(response) {
if (typeof callback === 'function') {
callback(response.isDuplicate); // Pass the result to the callback
}
},
error: function(xhr, status, error) {
console.error('AJAX Error:', error);
}
});
}
function sendAjaxRequestForGlobal(url, method, data = {}, successCallback = null, errorCallback = null) {
$.ajax({
url: url,
method: method,
data: data,
dataType: 'json', // Expected response type
success: function(response) {
// If a success callback is provided, call it with the response
if (successCallback) {
successCallback(response);
}
},
error: function(xhr, status, error) {
// Handle errors if provided error callback
if (errorCallback) {
errorCallback(xhr, status, error);
} else {
console.error('AJAX Error:', error);
}
}
});
}
function confirmActionSweertAlert(message = "Are you sure?", confirmText = "Yes, Proceed!", cancelText = "Cancel", icon = "warning") {
return Swal.fire({
title: message,
icon: icon,
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: confirmText,
cancelButtonText: cancelText
}).then((result) => {
return result.isConfirmed; // Returns true if confirmed, false otherwise
});
}
</script>
<script>
function restoreDashboardHistoryIfNeeded() {
const dashboardHistoryString = localStorage.getItem('dashboardHistory');
if (!dashboardHistoryString) {
console.log("dashboardHistory not found");
return;
}
const dashboardHistory = JSON.parse(dashboardHistoryString);
if (window.location.href === dashboardHistory.dashboard_url) {
const tabSelector = dashboardHistory.tab;
if (tabSelector) {
const tabElement = document.querySelector(`a[href="${tabSelector}"]`);
if (tabElement) {
tabElement.click();
}
}
const functionName = dashboardHistory.function_name;
const params = dashboardHistory.tile_params;
if (functionName && typeof window[functionName] === 'function') {
if(params.majorType == 0 && params.minorType == 0){
window[functionName]();
}else{
window[functionName](params.majorType, params.minorType);
}
}
console.log("inside location match");
}
}
// Run on popstate (back/forward buttons)
window.addEventListener('popstate', restoreDashboardHistoryIfNeeded);
// Run on page load (refresh)
window.addEventListener('DOMContentLoaded', () => {
// slight delay ensures DOM/tab loads completely
setTimeout(restoreDashboardHistoryIfNeeded, 100);
});
</script>
<script>
$(document).ready(function() {
$('.img-inactive').on('click', function() {
$('.img-c').addClass('img-inactive');
$(this).removeClass('.img-inactive');
$(this).addClass('.img-active');
});
});
</script>
</body>
</html>