MERGE_UAT_FIXES
This commit is contained in:
commit
9af08779fb
@ -450,9 +450,10 @@ class TicketController extends BaseController
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$data['ticket_data'] = $this->ticketSearch();
|
$data['ticket_data'] = $this->ticketSearch();
|
||||||
// print_r($data['ticket_data']);die;
|
return $this->respond([
|
||||||
$html = view('ticket_list', $data);
|
'status' => true,
|
||||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
'rows' => $data['ticket_data'] ?? [],
|
||||||
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -268,18 +268,173 @@ table.dataTable tbody td {
|
|||||||
<!-------------------------------------------------------------------------------------------------->
|
<!-------------------------------------------------------------------------------------------------->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
window.ticketTableInstance = window.ticketTableInstance || null;
|
||||||
|
window.ticketTableIsDeleteEnabled = <?= in_array(get_role_id(), [1,2,5]) ? 'true' : 'false'; ?>;
|
||||||
|
window.ticketTypeMap = <?= json_encode($ticket_type ?? []); ?>;
|
||||||
|
window.priorityTypeMap = <?= json_encode($priorityType ?? []); ?>;
|
||||||
|
window.modeOfIntimateMap = <?= json_encode($modeOFIntimate ?? []); ?>;
|
||||||
|
window.claimTypeMap = <?= json_encode($claimType ?? []); ?>;
|
||||||
|
|
||||||
|
function escapeHtml(value) {
|
||||||
|
if (value === null || value === undefined) return '';
|
||||||
|
return String(value)
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/'/g, ''');
|
||||||
|
}
|
||||||
|
|
||||||
|
function asText(value) {
|
||||||
|
if (value === null || value === undefined || value === '') return 'N/A';
|
||||||
|
return escapeHtml(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getClaimTypeLabel(row) {
|
||||||
|
var typeId = Number(row.ticket_type_id || 0);
|
||||||
|
var claimKey = row.claim_type || '';
|
||||||
|
if (!window.claimTypeMap[typeId]) return '';
|
||||||
|
return window.claimTypeMap[typeId][claimKey] || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStatusDisplay(row) {
|
||||||
|
var status = row.status || '';
|
||||||
|
var claimStatusId = Number(row.claim_status_id || 0);
|
||||||
|
var approved = Number(row.is_head_approved);
|
||||||
|
var statusesWithIcon = [8, 23, 33, 43];
|
||||||
|
|
||||||
|
if (statusesWithIcon.indexOf(claimStatusId) !== -1) {
|
||||||
|
if (approved === 0) return escapeHtml(status) + ' <i class="fa fa-exclamation-triangle" style="color:#cece00;" aria-hidden="true"></i>';
|
||||||
|
if (approved === 1) return escapeHtml(status) + ' <i class="mdi mdi-check-circle" style="color:green;" aria-hidden="true"></i>';
|
||||||
|
if (approved === 2) return escapeHtml(status) + ' <i class="mdi mdi-close-circle-outline" style="color:red;" aria-hidden="true"></i>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return escapeHtml(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStatusTooltip(row) {
|
||||||
|
var status = row.status || '';
|
||||||
|
if (Number(row.claim_status_id) === 8) {
|
||||||
|
if (Number(row.is_head_approved) === 0) return 'Waiting for approvel';
|
||||||
|
if (Number(row.is_head_approved) === 1) return 'Rejection approved';
|
||||||
|
if (Number(row.is_head_approved) === 2) return 'Rejection not approved';
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getActionCell(row) {
|
||||||
|
if (!window.ticketTableIsDeleteEnabled) return '';
|
||||||
|
var id = escapeHtml(row.id || '');
|
||||||
|
return '' +
|
||||||
|
'<td>' +
|
||||||
|
' <div class="btn-group dropdown">' +
|
||||||
|
' <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="dropdown-menu dropdown-menu-right">' +
|
||||||
|
' <a class="dropdown-item delete" data-id="' + id + '" onclick="removeClaim(this, \'' + id + '\')">' +
|
||||||
|
' <i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete' +
|
||||||
|
' </a>' +
|
||||||
|
' </div>' +
|
||||||
|
' </div>' +
|
||||||
|
'</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildTicketRowHtml(row) {
|
||||||
|
var statusUpdated = row.ticket_updated_date ? '<span class="text-custom-grey"><br>Updated at ' + escapeHtml(row.ticket_updated_date) + '</span>' : '';
|
||||||
|
var claimCreated = row.ticket_created_date ? '<span class="text-custom-grey"><br>Created at ' + escapeHtml(row.ticket_created_date) + '</span>' : '';
|
||||||
|
var policyType = (window.ticketTypeMap[row.ticket_type_id] || '').replace('Claim-', '');
|
||||||
|
var modeOfIntimation = window.modeOfIntimateMap[row.mode_of_intimation] || '';
|
||||||
|
var priority = window.priorityTypeMap[row.priority || 0] || '';
|
||||||
|
|
||||||
|
return '' +
|
||||||
|
'<tr data-id="' + escapeHtml(row.id) + '" style="cursor: pointer;">' +
|
||||||
|
'<td data-toggle="tooltip" data-placement="top" title="' + escapeHtml(getStatusTooltip(row)) + '">' +
|
||||||
|
'<span class="status-tooltip">' + getStatusDisplay(row) + '</span>' +
|
||||||
|
statusUpdated +
|
||||||
|
'</td>' +
|
||||||
|
'<td>' + asText(policyType) + '</td>' +
|
||||||
|
'<td>' + asText(row.claim_no) + claimCreated + '</td>' +
|
||||||
|
'<td>' + asText(row.tpa_no) + '</td>' +
|
||||||
|
'<td>' + asText(row.emp_code) + '</td>' +
|
||||||
|
'<td>' + asText(row.emp_name) + '</td>' +
|
||||||
|
'<td>' + asText(row.insured_name) + '</td>' +
|
||||||
|
'<td>' + asText(row.short_name) + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.acm_name || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.insurer_name || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.tpa_name || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.policy_no || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(priority) + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.relationship || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.emp_mobile || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.emp_mail || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.emp_personal_mail || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(modeOfIntimation) + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(getClaimTypeLabel(row)) + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.hospital_name || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.doa || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.dod || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.claim_amount || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.pod_no || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.date_of_join || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.date_of_incep || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.dob || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.date_of_accident || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.date_of_death || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.date_of_intimat || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.si_amt || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.raised_date || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.registration_date || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.query_received_date || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.denial_date || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.approved_date || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.settled_date || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.denial_reason || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.approved_letter || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.approved_amount || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.utr_details || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.settle_letter || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.return_remark || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.cancel_remark || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.awb_no_courier_name || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.non_id_reason || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.pay_initiate_date || '') + '</td>' +
|
||||||
|
'<td style="display: none;">' + escapeHtml(row.approved_description || '') + '</td>' +
|
||||||
|
'<td>' + escapeHtml(row.tat || '') + '</td>' +
|
||||||
|
getActionCell(row) +
|
||||||
|
'</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyTicketRows(rows) {
|
||||||
|
var table = $('#scroll-horizontal-datatable');
|
||||||
|
var tbody = table.find('tbody');
|
||||||
|
var html = '';
|
||||||
|
|
||||||
|
(rows || []).forEach(function (row) {
|
||||||
|
html += buildTicketRowHtml(row);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (window.ticketTableInstance) {
|
||||||
|
window.ticketTableInstance.clear();
|
||||||
|
tbody.html(html);
|
||||||
|
window.ticketTableInstance.rows.add(tbody.find('tr')).draw();
|
||||||
|
} else {
|
||||||
|
tbody.html(html);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
}
|
||||||
|
|
||||||
|
window.updateTicketTableRows = applyTicketRows;
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Datatable document ready
|
// Datatable document ready
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||||
|
|
||||||
if (ticketsTable.length) {
|
if (ticketsTable.length && !window.ticketTableInstance) {
|
||||||
|
window.ticketTableInstance = ticketsTable.DataTable({
|
||||||
ticketsTable.DataTable({
|
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
// dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
// dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||||
// "<'row'<'col-sm-12'tr>>" +
|
// "<'row'<'col-sm-12'tr>>" +
|
||||||
@ -364,8 +519,8 @@ $(document).ready(function() {
|
|||||||
pageLength: 10, // Set default number of rows per page (optional)
|
pageLength: 10, // Set default number of rows per page (optional)
|
||||||
ordering: false,
|
ordering: false,
|
||||||
});
|
});
|
||||||
} else {
|
} else if (!ticketsTable.length) {
|
||||||
console.error("Table atet found.");
|
console.error("Table not found.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -287,8 +287,9 @@
|
|||||||
console.log('Filter Responce', response);
|
console.log('Filter Responce', response);
|
||||||
|
|
||||||
if (response.status == true) {
|
if (response.status == true) {
|
||||||
$('#ticket_list_div').empty();
|
if (typeof window.updateTicketTableRows === 'function') {
|
||||||
$('#ticket_list_div').html(response.html);
|
window.updateTicketTableRows(response.rows || []);
|
||||||
|
}
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
@ -331,8 +332,9 @@
|
|||||||
console.log('Filter Responce', response);
|
console.log('Filter Responce', response);
|
||||||
|
|
||||||
if (response.status == true) {
|
if (response.status == true) {
|
||||||
$('#ticket_list_div').empty();
|
if (typeof window.updateTicketTableRows === 'function') {
|
||||||
$('#ticket_list_div').html(response.html);
|
window.updateTicketTableRows(response.rows || []);
|
||||||
|
}
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user