164 lines
5.6 KiB
JavaScript
164 lines
5.6 KiB
JavaScript
|
|
/*================================================================================================================\
|
|
+
|
|
+ Project : GoData-Eicher
|
|
+ Filename : reportTicketPending.js
|
|
+ Module Name : ReportModule
|
|
+ Purpose : For reporting on pending tickets
|
|
+ Coded By : Parul Gupta
|
|
+
|
|
+================================================================================================================*/
|
|
|
|
/**
|
|
* For reporting
|
|
* @module ReportModule
|
|
*/
|
|
|
|
/**
|
|
* This class contains functionality of Ticket report(Pending)
|
|
* @class PendingTicketReport
|
|
* @constructor
|
|
*/
|
|
|
|
//Global variables
|
|
var slaMetImagePath = "../../Content/css/images/icons/green_circle.png";
|
|
var slaNotMetImagePath = "../../Content/css/images/icons/red_circle.png";
|
|
var xhr_exportExport;
|
|
var temp_dataItemId, temp_dataItemRowIndex;
|
|
|
|
/**
|
|
* Function to get open tickets history
|
|
* @method getPendingTicketHistory
|
|
* @for PendingTicketReport
|
|
*/
|
|
function getPendingTicketHistory() {
|
|
var startDate, endDate;
|
|
var userID = userId;
|
|
//send ajax request
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "/Report/Report_TicketPending_Grid/",
|
|
data: { userId: userID },
|
|
success: function (data) {
|
|
$("#divGrid").html(data);
|
|
if (document.getElementById('PendingTicket') !== null) {
|
|
setTimeout(function () {
|
|
if ($("#PendingTicket .k-grid-content table tbody tr").length > 0) {
|
|
$('.excelIcon').hide();
|
|
} else {
|
|
$('.excelIcon').hide();
|
|
}
|
|
}, 1000);
|
|
} else {
|
|
$('.excelIcon').hide();
|
|
}
|
|
},
|
|
complete: function () {
|
|
},
|
|
error: function (data) {
|
|
console.log(data);
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Function call on row bound of close tickets table
|
|
* @method onRowBound
|
|
* @for PendingTicketReport
|
|
*/
|
|
function onRowBound(e) {
|
|
console.log(_userRole.toLowerCase().trim());
|
|
var grid = $("#PendingTicket").data('kendoGrid');
|
|
//if (_userRole.toLowerCase().trim() == 'cce' || _userRole.toLowerCase().trim() == 'cce_admin') {
|
|
$('.k-grid-EditTicketActivity').text("").removeClass("k-button k-button-icontext").html("<span class='k-icon k-edit'></span>").show();
|
|
$('.k-grid-DeleteTicket').text("").removeClass("k-button k-button-icontext").html("<span class='k-icon k-delete'></span>").show();
|
|
//} else {
|
|
// $('.k-grid-EditTicketActivity').hide();
|
|
// //$('#PendingTicket div.k-grid-header-wrap th:nth-child(4)').toggle();
|
|
// //$('#PendingTicket div.k-grid-content td:nth-child(4)').toggle();
|
|
//}
|
|
// called common file function to show title on mouse hover.
|
|
addTitleAttribute();
|
|
}
|
|
|
|
/**
|
|
* To get filter parameters and export report.
|
|
* @method exportReport
|
|
* @for PendingTicketReport
|
|
*/
|
|
function exportReport() {
|
|
var userID = userId;
|
|
// sending ajax request to export ICR Unique Users and Data Usage to Excel, and hadling its completion
|
|
if (xhr_exportExport && xhr_exportExport.readystate != 4) {
|
|
xhr_exportExport.abort();
|
|
}
|
|
xhr_exportExport = $.ajax({
|
|
type: "POST",
|
|
url: "/Report/Ticket_Close_Open_ExportToExcel/",
|
|
data: { UserId: userID, startDate: "", endDate: "", ticketStatus: "open" },
|
|
success: function (data) {
|
|
// making the generated Excel available for downloading.
|
|
window.location.href = data;
|
|
},
|
|
complete: function () {
|
|
},
|
|
error: function (data) {
|
|
console.log("Error in Export to Excel");
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Function call on edit button and redirect to ticket activity page to edit ticket activity
|
|
* @method editActivity
|
|
* @for PendingTicketReport
|
|
*/
|
|
function editActivity(e) {
|
|
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
|
|
var vRegNo = dataItem.VehicleRegisterNumber;
|
|
//window.location.href = "/Ticket/TicketAdministration?complaintNo=" + ticketid;
|
|
window.open("/Ticket/TicketAdministration?vRegistrationNo=" + vRegNo + "&TicketType=dummy");
|
|
}
|
|
|
|
|
|
function deleteTicket(e) {
|
|
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
|
|
var vRegNo = dataItem.VehicleRegisterNumber;
|
|
var _token = token;
|
|
jConfirm('Are you sure to delete this ticket?', 'Delete', function (result) {
|
|
//again check whether user input is true
|
|
if (result) {
|
|
//send ajax request to controller to delete connected dealer's entry.
|
|
$.ajax({
|
|
type: "POST",
|
|
url: WCFRESTURL.DeleteSavedTicket,
|
|
data: { VehicleRegistrationNumber: vRegNo, token: _token },
|
|
success: function (data) {
|
|
if (data.Status == "1") {
|
|
var grid = $("#PendingTicket").data("kendoGrid");
|
|
//grid.removeRow(grid.tbody.find("tr")[$(e.currentTarget).closest("tr").index()]);
|
|
//jAlert('Escalation deleted successfully!!', 'Message');
|
|
jAlert("Ticket has been deleted successfully!!", 'Message', function () {
|
|
getPendingTicketHistory();
|
|
});
|
|
}
|
|
else {
|
|
//alert box to show unsuccess deletion message
|
|
jAlert("Ticket deletion is failed!!", 'Message');
|
|
}
|
|
|
|
},
|
|
error: function (data) {
|
|
console.log(data);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
//============================= document ready function ===============================//
|
|
|
|
$(document).ready(function () {
|
|
$('.excelIcon').hide();
|
|
getPendingTicketHistory();
|
|
});
|