nhance/app/Views/leads_dash.php

312 lines
9.7 KiB
PHP

<style>
body{
margin-top:20px;
background:#FAFAFA;
}
.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;
}
</style>
<?php
$isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_team()) ? 'show active' : '';
?>
<div class="tab-pane fade <?= $isActive ?>" id="leads-dash-tab">
<div class="row">
<div class="col-md-4 col-xl-3 leadTypeTile">
<div class="card bg-c-Pelorous order-card" onclick="hide_and_show_tile(1,1)">
<div class="card-block">
<h6 class="m-b-20 font-15">Leads</h6>
<h2 class="text-right"><i class="mdi mdi-playlist-check f-left"></i><span><?= isset($lead_data)? $lead_data['total'] : 0 ?></span></h2>
<p class="m-b-1">&nbsp;<span class="f-right"></span></p>
<p class="m-b-1">&nbsp;<span class="f-right"></span></p>
</div>
</div>
</div>
<div class="col-md-4 col-xl-3 leadTypeTile">
<div class="card bg-c-Pelorous order-card" onclick="hide_and_show_tile(1,2)">
<div class="card-block">
<h6 class="m-b-20 font-15">BDS Renewals</h6>
<h2 class="text-right"><i class="mdi mdi-playlist-check f-left"></i><span><?= isset($bds_renewal) ? $bds_renewal['total'] : 0?></span></h2>
<p class="m-b-1">&nbsp;<span class="f-right"></span></p>
<p class="m-b-1">&nbsp;<span class="f-right"></span></p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="status_tile" style="padding-bottom: 10px;padding-left: 17px; ">
<a href="#" onclick="hide_and_show_tile(2)" ><i class="fas fa-arrow-left"></i> Back to Overview</a>
</div>
<div class="status_tile" style="padding-left: 30px;">
<a href="#" id="main_tile" >Current Tile : </a>
</div>
</div>
<div class="row">
<?php
$colorSetCount = count($colorShades); // Number of color sets
$shadeCount = count($colorShades[0]); // Number of shades per set
$index = 0;
foreach ($lead_data as $key => $value) : ?>
<?php
if ($key == "total"|| $key == "won" || substr($key, -4) === "_ids") { continue; } // Skip the total key
?>
<?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
$formattedStatus = strlen($key) < 5 ? strtoupper($key): ucwords(str_replace('_', ' ', $key));
$truncatedStatus = strlen($formattedStatus) > 20 ? substr($formattedStatus, 0, 15) . '...' : $formattedStatus;
$showTooltip = strlen($formattedStatus) > 20;
?>
<div class="col-md-2 col-xl-1 leadStatusTitle_1" style="display: none;">
<div class="card order-card" style="background: <?= $bgColor ?>;" onclick="linkRedirectForLeads('<?= esc(strtolower(str_replace(' ', '_', $key)), 'js') ?>','<?= $lead_data[$key . '_ids'] ?? '' ?>')">
<h2 class="text-center"><span><?= $value ?></span></h2>
<h6 class="m-b-20 font-15 text-center"
<?= $showTooltip ? 'data-toggle="tooltip" title="' . htmlspecialchars($formattedStatus, ENT_QUOTES, 'UTF-8') . '"' : '' ?>>
<?= $truncatedStatus ?>
</h6>
</div>
</div>
<?php endforeach ?>
</div>
<div class="row">
<?php
$colorSetCount = count($colorShades); // Number of color sets
$shadeCount = count($colorShades[0]); // Number of shades per set
$index = 0;
foreach ($bds_renewal as $key => $value) : ?>
<?php
if ($key == "total" || substr($key, -4) === "_ids"){ continue; } // Skip the total key
?>
<?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
$formattedStatus = strlen($key) < 5 ? strtoupper($key): ucwords(str_replace('_', ' ', $key));
$truncatedStatus = strlen($formattedStatus) > 20 ? substr($formattedStatus, 0, 15) . '...' : $formattedStatus;
$showTooltip = strlen($formattedStatus) > 20;
?>
<div class="col-md-2 col-xl-1 leadStatusTitle_2" style="display: none;">
<div class="card order-card" style="background: <?= $bgColor ?>;" onclick="linkRedirectForPolicy('<?= isset($bds_renewal[$key . '_ids']) ? str_replace(' ', '_', $bds_renewal[$key . '_ids']) : '' ?>')">
<h2 class="text-center"><span><?= $value ?></span></h2>
<h6 class="m-b-20 font-15 text-center"
<?= $showTooltip ? 'data-toggle="tooltip" title="' . htmlspecialchars($formattedStatus, ENT_QUOTES, 'UTF-8') . '"' : '' ?>>
<?= $truncatedStatus ?>
</h6>
</div>
</div>
<?php endforeach ?>
</div>
</div>
<script>
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
$(".status_tile").hide();
});
function hide_and_show_tile(type,leadType = null) {
if (type == 1) {
$('.leadTypeTile').hide();
$('.status_tile').show();
} else {
$('.leadTypeTile').show();
$('.leadStatusTitle_1').hide();
$('.leadStatusTitle_2').hide();
$(".status_tile").hide();
}
if (type == 1 && leadType != null && leadType == 1){
$('.leadStatusTitle_1').show();
$('#main_tile').text("Viewing Details For : Leads");
}
if (type == 1 && leadType != null && leadType == 2){
$('.leadStatusTitle_2').show();
$("#main_tile").text("Viewing Details For : BDS Renewals");
}
}
function linkRedirectForPolicy(ids){
var url = "<?= base_url("policy_tranction/inception/list") ?>";
var data = {
ids : ids,
is_dashboard : 1
}
redirectWithPost(url,data, "POST");
}
function linkRedirectForLeads(status,ids){
var url = "<?= base_url("leads/list") ?>";
var data = {
ids : ids,
is_dashboard : 1
}
redirectWithPost(url,data, "POST");
}
function redirectWithPost(url, data = {}, method = "GET") {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
const form = document.createElement('form');
form.method = method;
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>