/*================================================================================================================\ + + Project : GODATA-EICHER + Filename : Dashboard.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() { DashboardType = dashboardType; alert(WCFRESTURL.GetTopDealer + 'cc'); if (DashboardType == "all") { UserId = userId; } else { UserId = $("#DealerId").data("kendoComboBox").value();; } SecurityToken = securityToken; utcMinutes = parseInt(UtcMinutes, 10); // Getting first and last date from a month var startDate = "";// $("#monthpickerFrom").val(); var endDate = "";// $("#monthpickerTo").val(); //startDate = startDate.replace(/-/g, " "); //endDate = endDate.replace(/-/g, " "); //var date1 = new Date(startDate); //var date2 = new Date(endDate); //var timeDiff = Math.abs(date2.getTime() - date1.getTime()); //var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)); // alert(WCFRESTURL.GetNewGlobalDashboard); // Sending the Ajax Request for showing the dashboard values and handling its completion. if (xhr_refreshDashboard && xhr_refreshDashboard.readystate != 4) { xhr_refreshDashboard.abort(); } xhr_refreshDashboard = $.ajax({ type: "POST", url: WCFRESTURL.GetNewGlobalDashboard, data: { Token: SecurityToken, UtcMinutes: utcMinutes, UserId: UserId, FromDate: startDate + ' 00:00:00', ToDate: endDate + ' 23:59:59' }, dataType: "json", success: function (model) { loadTopDealers(); // alert(model.TABsFreeCount); $('#tdOpenTickets').html(model.OpenTicket); $('#tdOpenTicket24hours').html(model.OpenTicket24hours); $('#tdTABFreeCount').html(model.TABsFreeCount); $('#tdAverageResolutionTime').html(model.AverageResolutionTime); $('#tdAverageVanReachTime').html(model.AverageVanReachTime); $('#tdSLA1hrs').html(model.SLA1hrs); $('#tdSLA2hrs').html(model.SLA2hrs); $('#tdSLA3hrs').html(model.SLA3hrs); $('#tdSLAMoreThan3hrs').html(model.SLAMoreThan3hrs); $('#tdSLA12hrs').html(model.SLA12hrs); $('#tdSLA16hrs').html(model.SLA16hrs); $('#tdSLA18hrs').html(model.SLA18hrs); $('#tdSLAMoreThan18hrs').html(model.SLAMoreThan18hrs); $('#tdTABsBusyCount').html(model.TABsBusyCount); $('#tdTABsOfflineMorethan7Days').html(model.TABsOfflineMorethan7Days); $('#tdNewTicketCount').html(model.NewTicketCount); $('#tdAssignedTicketCount').html(model.AssignedTicketCount); $('#tdInprogressTicketCount').html(model.InprogressTicketCount); $('#tdClosedTicketCount').html(model.ClosedTicketCount); $('#tdDeclinedTicketCount').html(model.DeclinedTicketCount); $('#tdActiveCount').html(model.ActiveCount); $('#tdBreakDownTickets').html(model.BreakDownTickets); $('#tdCSat').html(model.CSat); }, complete: function () { }, error: function (data) { console.log("Error"); } }); } function loadTopDealers() { // utcMinutes = parseInt(UtcMinutes, 10); //UserId = userId; alert(WCFRESTURL.GetDealerList) DashboardType = dashboardType; // alert(WCFRESTURL.GetNewGlobalDashboard); if (DashboardType == "all") { UserId = userId; } else { UserId = $("#DealerId").data("kendoComboBox").value();; } SecurityToken = securityToken; utcMinutes = parseInt(UtcMinutes, 10); // Getting first and last date from a month var startDate = "";// $("#monthpickerFrom").val(); var endDate = "";// $("#monthpickerTo").val(); //startDate = startDate.replace(/-/g, " "); //endDate = endDate.replace(/-/g, " "); //var date1 = new Date(startDate); //var date2 = new Date(endDate); //var timeDiff = Math.abs(date2.getTime() - date1.getTime()); //var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)); //alert(WCFRESTURL.GetNewGlobalDashboard); // Sending the Ajax Request for showing the dashboard values and handling its completion. if (xhr_refreshDashboard && xhr_refreshDashboard.readystate != 4) { xhr_refreshDashboard.abort(); } xhr_refreshDashboard = $.ajax({ type: "POST", url: WCFRESTURL.GetDealerList, data: { Token: SecurityToken, UtcMinutes: utcMinutes, UserId: UserId, FromDate: startDate + ' 00:00:00', ToDate: endDate + ' 23:59:59' }, dataType: "json", success: function (model) { }, complete: function () { //$("#stateCombobox").data('kendoComboBox').select(0); }, error: function (jqXHR, textStatus, errorThrown) { } }); } /** * To show Tile dashboard. * @method showTileDashboard * @for TileDashboard */ function showTileDashboard() { // alert('dfsd'); 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=======================