CHANGE_ADD_THE WHO_CREATED_THE_CLAIM_BADGE

This commit is contained in:
VENKATESHWARAN 2026-04-20 10:41:04 +05:30
parent 225b4c08dd
commit 9509079bdf
3 changed files with 79 additions and 4 deletions

View File

@ -3723,6 +3723,7 @@ class EmployeeRestController extends AdminController
if (! empty($emp_ticket_data)) {
$received_relationship = $received_data['relationship'] ?? null;
unset($received_data['relationship']);
$fetchData = $emp_ticket_data[0];
@ -3750,8 +3751,8 @@ class EmployeeRestController extends AdminController
$fetchData = array_merge($fetchData, $received_data);
// $fetchData['relationship'] = strtolower($fetchData['relationship']) ?? $fetchData['relationship'];
$fetchData['relationship'] = isset($fetchData['relationship']) ? strtolower($fetchData['relationship']) : null;
// $fetchData['relationship'] = isset($fetchData['relationship']) ? strtolower($fetchData['relationship']) : null;
$fetchData['relationship'] = strtolower($received_relationship ?? $fetchData['relationship'] ?? '') ?: null;
$fetchData['created_by'] = $fetchData['emp_id'];
$fetchData['claim_created_by'] = "USER";

View File

@ -503,6 +503,7 @@ class TicketController extends BaseController
'tm.id',
'tm.ticket_type_id',
'tm.claim_status_id',
'tm.claim_created_by',
'tm.is_head_approved',
'tcs.claim_status AS status',
'tm.claim_number AS claim_no',
@ -640,6 +641,7 @@ class TicketController extends BaseController
'tcs.claim_status AS status',
'tm.claim_number AS claim_no',
'tm.claim_status_id',
'tm.claim_created_by',
'tm.is_head_approved',
'tm.tpa_id',
'tm.tpa_no',

View File

@ -30,6 +30,46 @@ table.dataTable tbody td {
color: #6c757d !important;
}
/* Claim source pill — text only, fixed width (DUMP_TPA); hidden when no value */
.claim-source-badge {
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 0 4px;
border-radius: 999px;
font-size: 0.52rem;
font-weight: 600;
line-height: 1.3;
white-space: nowrap;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
width: 8.75em;
min-width: 8.75em;
max-width: 8.75em;
}
.claim-source-badge--tpa {
background: #d1fae5;
color: #047857;
}
.claim-source-badge--user {
background: #dbeafe;
color: #1d4ed8;
}
.claim-source-badge--dump-tpa {
background: #ede9fe;
color: #6d28d9;
}
.claim-source-badge--dump {
background: #ffedd5;
color: #c2410c;
}
.claim-source-badge--crm {
background: #fce7f3;
color: #9d174d;
}
</style>
<style>
.table th:nth-child(1),
@ -170,7 +210,22 @@ table.dataTable tbody td {
<?php endif; ?>
</td>
<td><?php echo str_replace("Claim-", "", $ticket_type[$row['ticket_type_id']] ?? 'N/A'); ?></td>
<td><?php
$claimSrc = $row['claim_created_by'] ?? '';
$claimSrcClassMap = [
'TPA' => 'claim-source-badge--tpa',
'USER' => 'claim-source-badge--user',
'DUMP_TPA' => 'claim-source-badge--dump-tpa',
'DUMP' => 'claim-source-badge--dump',
'CRM' => 'claim-source-badge--crm',
];
$claimSrcClass = $claimSrcClassMap[$claimSrc] ?? null;
$policyTypeLabel = str_replace('Claim-', '', $ticket_type[$row['ticket_type_id']] ?? 'N/A');
echo esc($policyTypeLabel);
if ($claimSrcClass !== null) {
echo '<br><span class="claim-source-badge ' . esc($claimSrcClass, 'attr') . '">' . esc($claimSrc) . '</span>';
}
?></td>
<td><?php echo $row['claim_no'] ?: 'N/A' ; ?>
<?php if (!empty($row['ticket_created_date'])): ?>
<span class="text-custom-grey"><br><?= "Created at ".$row['ticket_created_date']; ?></span>
@ -297,6 +352,22 @@ function getClaimTypeLabel(row) {
return window.claimTypeMap[typeId][claimKey] || '';
}
function getClaimSourceBadgeHtml(claimCreatedBy) {
var map = {
'TPA': 'claim-source-badge--tpa',
'USER': 'claim-source-badge--user',
'DUMP_TPA': 'claim-source-badge--dump-tpa',
'DUMP': 'claim-source-badge--dump',
'CRM': 'claim-source-badge--crm'
};
var key = claimCreatedBy || '';
var cls = map[key];
if (!cls) {
return '';
}
return '<span class="claim-source-badge ' + cls + '">' + escapeHtml(key) + '</span>';
}
function getStatusDisplay(row) {
var status = row.status || '';
var claimStatusId = Number(row.claim_status_id || 0);
@ -342,6 +413,7 @@ 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 claimSourceBadge = getClaimSourceBadgeHtml(row.claim_created_by);
var modeOfIntimation = window.modeOfIntimateMap[row.mode_of_intimation] || '';
var priority = window.priorityTypeMap[row.priority || 0] || '';
@ -351,7 +423,7 @@ function buildTicketRowHtml(row) {
'<span class="status-tooltip">' + getStatusDisplay(row) + '</span>' +
statusUpdated +
'</td>' +
'<td>' + asText(policyType) + '</td>' +
'<td>' + asText(policyType) + (claimSourceBadge ? '<br>' + claimSourceBadge : '') + '</td>' +
'<td>' + asText(row.claim_no) + claimCreated + '</td>' +
'<td>' + asText(row.tpa_no) + '</td>' +
'<td>' + asText(row.emp_code) + '</td>' +