nhance/app/Views/claims_dash.php
2025-08-19 17:31:38 +05:30

395 lines
12 KiB
PHP

<style>
.order-card {
color: #fff;
}
.bg-c-blue {
background: linear-gradient(45deg, #4099ff, #73b4ff);
}
.bg-c-green {
background: linear-gradient(45deg, #2ed8b6, #59e0c5);
}
.bg-c-yellow {
background: linear-gradient(45deg, #FFB64D, #ffcb80);
}
.bg-c-pink {
background: linear-gradient(45deg, #FF5370, #ff869a);
}
.bg-c-red {
background: linear-gradient(45deg, #FF4E50, #F9D423);
}
.bg-c-purple {
background: linear-gradient(45deg, #9D50BB, #6E48AA);
}
.bg-c-orange {
background: linear-gradient(45deg, #F2994A, #F2C94C);
}
.bg-c-teal {
background: linear-gradient(45deg, #1ABC9C, #16A085);
}
.bg-c-cyan {
background: linear-gradient(45deg, #00C9FF, #92FE9D);
}
.bg-c-lime {
background: linear-gradient(45deg, #A8E063, #56AB2F);
}
.bg-c-indigo {
background: linear-gradient(45deg, #3F51B5, #5A55AE);
}
.bg-c-Pelorous {
background: linear-gradient(45deg, #00d6db, #00a8b5);
}
.bg-c-Pelorous2 {
background: linear-gradient(45deg, #02a8b5, #017f8b);
}
.bg-c-Pelorous3 {
background: linear-gradient(45deg, #098895, #046063);
}
.bg-c-Grenadier {
background: linear-gradient(45deg, #ff9d37, #ff7a10);
}
.bg-c-Grenadier2 {
background: linear-gradient(45deg, #ff8010, #ff4c00);
}
.bg-c-Grenadier3 {
background: linear-gradient(45deg, #f06306, #cc4b05);
}
.bg-c-SilverChalice {
background: linear-gradient(45deg, #a3a8a8, #8f9494);
}
.bg-c-SilverChalice2 {
background: linear-gradient(45deg, #7e8484, #686e6e);
}
.bg-c-SilverChalice3 {
background: linear-gradient(45deg, #5c6363, #434949);
}
.card {
border-radius: 5px;
-webkit-box-shadow: 0 1px 2.94px 0.06px rgba(4, 26, 55, 0.16);
box-shadow: 0 1px 2.94px 0.06px rgba(4, 26, 55, 0.16);
border: none;
margin-bottom: 30px;
-webkit-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
.card .card-block {
padding-top: 10px;
padding-bottom: 10px;
padding-left: 25px;
padding-right: 25px;
}
.order-card i {
font-size: 26px;
}
.f-left {
float: left;
}
.f-right {
float: right;
}
.m-b-1 {
margin-top: 0;
margin-bottom: 5px;
}
.inside-tab-content-div{
display:flex;
justify-content:flex-start !important;
flex-flow: row wrap;
}
.claimTypeTile{
margin-left:20px;
}
.claimStatusTitle{margin-left:20px;}
.dash-card{
background-color:#F4FBFB !important;
border-radius:25px;
border:2px solid #09B9BF;
box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.1), 0px 4px 8px rgba(0, 0, 0, 0.2);
min-width: 300px;
max-width: 300px;
}
#claims-dash-tab{
padding-right: 20px;
}
.span-color{
color:#09B9BF !important;
}
</style>
<?php
$isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team()) ? 'active show' : '';
?>
<div class="tab-pane fade <?= $isActive ?>" id="claims-dash-tab">
<div class="row">
<div class="col inside-tab-content-div">
<div class="claimTypeTile">
<div class="card dash-card" onclick="hideAndShowTile(1,1)">
<div class="card-block">
<h4 class="mb-3">GMC</h4>
<h2 ><span class="span-color"><?= isset($claim_data[1]['total']) ? $claim_data[1]['total'] : '0' ?></span></h2>
<h6><span class="text-danger">All GMC Records</span></h6>
</div>
</div>
</div>
<div class=" claimTypeTile">
<div class="card dash-card" onclick="hideAndShowTile(1,2)">
<div class="card-block">
<h4 class="mb-3">GPA</h4>
<h2 ><span class="span-color"><?= isset($claim_data[2]['total']) ? $claim_data[2]['total'] : '0' ?></span></h2>
<h6><span class="text-danger">All GPA Records</span></h6>
</div>
</div>
</div>
<div class=" claimTypeTile">
<div class="card dash-card" onclick="hideAndShowTile(1,3)">
<div class="card-block">
<h4 class="mb-3">EDLI</h4>
<h2 ><span class="span-color"><?= isset($claim_data[3]['total']) ? $claim_data[3]['total'] : '0' ?></span></h2>
<h6><span class="text-danger">All EDLI Records</span></h6>
</div>
</div>
</div>
<div class=" claimTypeTile">
<div class="card dash-card" onclick="hideAndShowTile(1,4)">
<div class="card-block">
<h4 class="mb-3">GTLI</h4>
<h2 ><span class="span-color"><?= isset($claim_data[4]['total']) ? $claim_data[4]['total'] : '0' ?></span></h2>
<h6><span class="text-danger">All GTLI Records</span></h6>
</div>
</div>
</div>
</div>
</div>
<div class="row d-flex align-items-center">
<div class="goBack" style="padding-left: 25px;">
<a href="#" onclick="hideAndShowTile('2')" ><b><i class="mdi mdi-chevron-left mdi-36px"></i></b> </a>
</div>
<div class="goBack" style="display: none;padding-left: 15px;">
<a href="#" id="current_tile">Current Tile : </a>
</div>
</div>
<br>
<div class="row">
<div class="col inside-tab-content-div">
<?php
$colorSetCount = count($colorShades); // Number of color sets
$shadeCount = count($colorShades[0]); // Number of shades per set
$index = 0;
?>
<?php foreach ($claim_data as $ticketTypeId => $statuses) : ?>
<?php
// Initialize color set and shade indexes
$colorSetIndex = floor($index / $shadeCount) % $colorSetCount; // Reset color set after each set
$shadeIndex = $index % $shadeCount; // Cycle through shades within the set
// Get the background color for the current tile
$bgColor = $colorShades[$colorSetIndex][$shadeIndex];
?>
<?php foreach ($statuses as $status => $count) : ?>
<?php
// Skip metadata fields
if ($status === 'ticket_type_id'|| $status == "approved"|| $status == "settled"|| $status == "closed" || $status === 'total' || substr($status, -4) === "_ids") {
continue;
}
?>
<?php
$formattedStatus = strlen($status) < 5 ? strtoupper($status): ucwords(str_replace('_', ' ', $status));
$truncatedStatus = strlen($formattedStatus) > 20 ? substr($formattedStatus, 0, 15) . '...' : $formattedStatus;
$showTooltip = strlen($formattedStatus) > 20;
?>
<?php
$formattedStatus = explode('-',$formattedStatus);
?>
<div class="claimStatusTitle claimStatusTitle_<?=$ticketTypeId?>" style="display: none;">
<div class="card dash-card" onclick="linkRedirectForClaims(<?= $ticketTypeId ?>, '<?= $status ?>','<?= $statuses[$status . '_ids'] ?? '' ?>')">
<div class="card-block">
<h5 class="text-right <?= isset($formattedStatus[1]) ? 'mt-1 mb-0':''?>">
<span class="f-left" style="word-break: break-word; white-space: normal;">
<?= htmlspecialchars($formattedStatus[0], ENT_QUOTES, 'UTF-8') ?>
</span>
<span class="span-color"><?= $count ?></span>
<p class="text-left mt-1 mb-0" style="font-size: x-small !important;"><?= htmlspecialchars($formattedStatus[1]??'', ENT_QUOTES, 'UTF-8') ?></p>
</h5>
</div>
</div>
</div>
<?php endforeach; ?>
<?php endforeach; ?>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$('.goBack').hide();
$('[class*="claimStatusTitle_"]').hide();
});
function hideAndShowTile(type, claimType = null) {
let dashboardHistoryString = localStorage.getItem('dashboardHistory');
if (dashboardHistoryString){
let dashboardHistory = JSON.parse(dashboardHistoryString);
dashboardHistory['tile_params'] = { majorType: type, minorType: claimType };
dashboardHistory['function_name'] = 'hideAndShowTile';
localStorage.setItem('dashboardHistory', JSON.stringify(dashboardHistory));
}
if (type == 1) {
$('.claimTypeTile').hide();
$(".goBack").show();
} else {
$('.claimTypeTile').show();
$('.goBack').hide();
$('[class*="claimStatusTitle_"]').hide();
}
if (type == 1 && claimType != null) {
if ($('.claimStatusTitle_' + claimType).length > 0) {
console.log("Element exists!");
} else {
console.log("Element does NOT exist!");
}
$('.claimTypeTile').hide();
$('.claimStatusTitle_'+claimType).show();
if (claimType == 1) {
$('#current_tile').text(" GMC");
} else if (claimType == 2) {
$('#current_tile').text(" GPA");
} else if (claimType == 3) {
$('#current_tile').text(" EDLI");
} else if (claimType == 4) {
$('#current_tile').text(" GTLI");
}
}
}
function linkRedirectForClaims(ticketTypeId, status,ids) {
// $('.loader').fadeIn();
// $('.loader-mask').fadeIn();
// $.ajax({
// url: "<?= base_url("/dashboard/prepareClaimSearchData") ?>",
// type: "POST",
// data: {
// ticketTypeId: ticketTypeId,
// status: status
// },
// success: function(response) {
// // Handle the response from the server
// if (response.status === 'success') {
// // Redirect to the claims list page with the selected filters
// console.log("response", response);
// // alert(JSON.stringify(response));
// data = response.data;
// data.is_dashboard = 1;
// redirectWithPost("<?= base_url("ticket/list") ?>", data);
// } else {
// // Handle error case
// console.log('Error: ' + response.message);
// }
// },
// error: function(xhr, status, error) {
// // Handle AJAX error
// console.error('AJAX Error:', error);
// // alert('An error occurred while processing your request.');
// }
// })
data = {
is_dashboard: 1,
ids : ids
}
redirectWithPost2("<?= base_url("ticket/list") ?>", data);
}
function redirectWithPost2(url, data = {}) {
const form = document.createElement('form');
form.method = 'POST';
form.action = url;
for (const key in data) {
if (data.hasOwnProperty(key)) {
const input = document.createElement('input');
input.type = 'hidden';
input.name = key;
input.value = data[key];
form.appendChild(input);
}
}
document.body.appendChild(form);
form.submit();
}
</script>