EOS/Scripts/Home/VehicleGroupDashboard.js
Nidhi Bhargava f0c1ab20e1 code push
2025-09-04 16:25:07 +05:30

215 lines
7.5 KiB
JavaScript

/*================================================================================================================\
+
+ Project : GODATA-EICHER
+ Filename : DealerWiseDashboard.js
+ Module Name : Tile Dashboard Module
+ Purpose : To show Tile Dashboard KPIs between 2 dates.
+ Coded By : Pankaj Khandal
+
+================================================================================================================*/
/**
* To show Tile Dashboard KPIs between 2 dates.
* @module Dashboard
*/
/**
* To show Tile Dashboard KPIs between 2 dates.
* @class TileDashboard
* @constructor
*/
/**
* Global References: To store Ajax Request's XHR object.
* @for TileDashboard
*/
var xhr_refreshDashboard = null;
//
/**
* Global References: Setting countUp options (To change the gradient of tiles and slowly incresing the numbers on tiles)
* @for TileDashboard
*/
var options = {
useEasing: true, // toggle easing
useGrouping: true, // 1,000,000 vs 1000000
separator: '', // character to use as a separator
decimal: '.', // character to use as a decimal
};
var demo;
/**
* Global References: To store color-combinations to show gradient effect on tiles.
* @for TileDashboard
*/
var startingColor11 = 'rgb(47,128,227)', // dark blue color code
startingColor12 = 'rgb(109,192,254)', // light blue color code
endColor11 = 'rgb(200,36,27)', // red color code
endColor12 = 'rgb(254,112,69)', // red
startingColor21 = 'rgb(125,188,29)', // light green
startingColor22 = 'rgb(42,169,28)', // green
warningColor11 = 'rgb(249, 140, 29)',// yellow
warningColor21 = 'rgb(254, 180, 44)';// yellow
lightOcean = 'rgb(0, 171, 169)'; // light ocean
darkOcean = 'rgb(46, 98, 98)'; // dark ocean
lightBlue = 'rgb(66, 146, 234)'; // light blue
darkBlue = 'rgb(24, 57, 134)'; // dark blue
/**
* Convert HH:mm format to Minutes.
* @method convertToMin
* @param {String} time input timei in HH:mm format
* @for TileDashboard
*/
function convertToMin(time) {
var timeArray = time.split(":");
return parseInt(timeArray[0], 10) * 60 + parseInt(timeArray[1], 10);
}
/**
* To bind values on infra tile dashboard for selected circles.
* @method refreshDashboard
* @for TileDashboard
*/
function refreshDashboard() {
var randomValues = Math.floor(Math.random() * 6) + 1;
var RandomValuesDriver = randomValues;
var HIGHESTFUELCONSUMINGVEHICLE = ["Prateek Jain (RJ2044)", "parul (GJ15YY7342)", "Yogesh (RJ14UU1233)", "Rohant (RJ14UD2229)",
"smita (RJ12WW1111)", "ykhator (RJ56390)", "surbhi (RJ06012)"];
var DRIVERNAMES = ["nari - narri (NB12345)", "naresh - ram (NB12234)", "ram babu - Ram (RJ14982)",
"Anoop - Ankush (RJ05GV2022)", "Agarwal Amit - Ankit Soni (RJ0909)", "suraj jain- ramnaresh (RJ2222)",
"Sajan - samir (RG33AS3432)"
];
demo = new countUp("total_van", 0, parseInt(500, 10), 0, 0, options);
demo.start();
$("#total_van").text("423");
$("#textFor_total_van").text("No. of Vehicles");
demo = new countUp("response_within_2hrs", 0, parseInt(40, 10), 0, 0, options);
demo.start();
$("#response_within_2hrs").text("40");
$("#textFor_response_within_2hrs").text("Average Running (Km)");
demo = new countUp("average_response_time", 0, parseInt(698, 10), 0, 0, options);
demo.start();
$("#average_response_time").text("698");
$("#textFor_average_response_time").text("No. of Drivers");
demo = new countUp("least_response_time_row1", 0, parseInt(19, 10), 0, 0, options);
demo.start();
$("#least_response_time_row1").text("19");
$("#textFor_least_response_time_row1").text("Service Reminders");
// gradient-coloring the tile
var parentOfTarget = $('#least_response_time_row1').parent();
colorAnimationTheDiv(parentOfTarget, startingColor21, startingColor22, startingColor22, startingColor21, 2);
demo = new countUp("highest_response_time_row1", 0, parseInt(8, 10), 0, 0, options);
demo.start();
$("#highest_response_time_row1").text("8");
$("#textFor_highest_response_time_row1").text("Average Fuel Consumption (ltr/Day)");
// gradient-coloring the tile
var parentOfTarget = $('#highest_response_time_state_row1').parent();
colorAnimationTheDiv(parentOfTarget, startingColor21, startingColor22, lightOcean, darkOcean, 2);
//$("#least_response_time_row1").text("19");
//$("#textFor_least_response_time_row1").text("Service Reminders");
// gradient-coloring the tile
//var parentOfTarget = $('#least_response_time_row1').parent();
//colorAnimationTheDiv(parentOfTarget, startingColor21, startingColor22, darkOcean, lightOcean, 2);
$("#closur_within_24hrs").text("80");
$("#textFor_closur_within_24hrs").text("Maintenance Alerts");
// gradient-coloring the tile
var parentOfTarget = $('#closur_within_24hrs').parent();
colorAnimationTheDiv(parentOfTarget, startingColor21, startingColor22, darkBlue, lightBlue, 2);
$("#highest_response_time").text(HIGHESTFUELCONSUMINGVEHICLE[HIGHESTFUELCONSUMINGVEHICLE.length - randomValues]);
$("#textFor_highest_response_time").text("Highest Running Cost Vehicle");
// gradient-coloring the tile
var parentOfTarget = $('#highest_response_time').parent();
colorAnimationTheDiv(parentOfTarget, startingColor21, startingColor22, endColor11, endColor12, 2);
$("#least_response_time").text(HIGHESTFUELCONSUMINGVEHICLE[randomValues]);
$("#textFor_least_response_time").text("Highest Fuel Consuming Vehicle");
// gradient-coloring the tile
var parentOfTarget = $('#least_response_time').parent();
colorAnimationTheDiv(parentOfTarget, startingColor21, startingColor22, endColor11, endColor12, 2);
$("#least_response_time_row3").text(DRIVERNAMES[RandomValuesDriver]);
$("#textFor_least_response_time_row3").text("Best Driver");
// gradient-coloring the tile
var parentOfTarget = $('#least_response_time_row3').parent();
colorAnimationTheDiv(parentOfTarget, startingColor21, startingColor22, startingColor22, startingColor21, 2);
$("#highest_response_time_row3").text(DRIVERNAMES[DRIVERNAMES.length - RandomValuesDriver]);
$("#textFor_highest_response_time_row3").text("Worst Driver");
// gradient-coloring the tile
var parentOfTarget = $('#highest_response_time_row3').parent();
colorAnimationTheDiv(parentOfTarget, startingColor21, startingColor22, endColor11, endColor12, 2);
SecurityToken = securityToken;
utcMinutes = parseInt(UtcMinutes, 10);
//UserId = userId;
//UserId = $("#DealerId").data("kendoComboBox").value();
// Getting first and last date from a month
var startDate = $("#monthpickerFrom").val();
var endDate = $("#monthpickerTo").val();
}
/**
* To show Tile dashboard.
* @method showTileDashboard
* @for TileDashboard
*/
function showTileDashboard() {
refreshDashboard();
}
//==========================DOCUMNET READY=========================
/**
* To do some initial functionality on page when Document is ready.
* @event document.ready
* @for TileDashboard
*/
$(document).ready(function () {
// Loading Dashboard data.
showTileDashboard();
//Refresh Dashboard every-hour
setInterval("showTileDashboard()", 1000 * 60 * 60);
// for image cycle.
$('#defaultCube,#defaultCube1,#defaultCube2,#defaultCube3,#defaultCube4').cycle({
fx: 'slideY', // vertical scroll
speed: 1000, // speed to scroll the image
timeout: 20000// set your time b/w every image scrolldown effect
});
});
//==========================DOCUMNET READY END=======================