1617 lines
58 KiB
JavaScript
1617 lines
58 KiB
JavaScript
/*================================================================================================================\
|
|
+
|
|
+ Project : GoData-Eicher
|
|
+ Filename : reportTicketDetails.js
|
|
+ Module Name : Report
|
|
+ Purpose : For ticket details
|
|
+ Coded By : Parul Gupta
|
|
+
|
|
+================================================================================================================*/
|
|
|
|
|
|
/**
|
|
* For reporting
|
|
* @module ReportModule
|
|
*/
|
|
|
|
|
|
/**
|
|
* This class contains functionality of details of a ticket in Ticket report(Open & Close)
|
|
* @class Report
|
|
* @constructor
|
|
*/
|
|
|
|
|
|
//Global variables
|
|
var ccplMap = null,
|
|
geoCoder,
|
|
defaultLat = 26.912285124827,
|
|
defaultLng = 75.7873203125;
|
|
|
|
var displayDisplay = ""; //route direction display
|
|
//var routeDirectionsService = new google.maps.DirectionsService(); //direction google map api
|
|
|
|
//initialize markers
|
|
var sourceMarker = '/Scripts/map_api/icons/red_s.png'; //marker for source
|
|
var destinationMarker = '/Scripts/map_api/icons/red_d.png'; //marker for destination
|
|
var currentLocationMarker = '../../Scripts/map_api/icons/green_circle.png'; //marker for current location
|
|
|
|
var ticketDetailsMarkerArray = []; //array of source and destination markers
|
|
var countKamExpand = 0;
|
|
|
|
var countVehiceHealthExpand=0;
|
|
var countDriverExpand = 0; //count no. of expand driver details
|
|
var countOwnerExpand = 0; //count no. of expand owner details
|
|
var countVehicleExpand = 0; //count no. of expand vehicle details
|
|
var countEscalationMembersExpand = 0; //count no. of expand escalation member details
|
|
|
|
//========================================== map functionality ============================================//
|
|
|
|
/**
|
|
* Load google map on page.
|
|
* @method initMap
|
|
* @param {String} id HTML element id where map is loaded.
|
|
* @for Report
|
|
*/
|
|
function initMap(id) {
|
|
|
|
//var mapOptions = {
|
|
// center: new google.maps.LatLng(defaultLat, defaultLng),
|
|
// zoom: 12,
|
|
// mapTypeId: google.maps.MapTypeId.ROADMAP
|
|
//};
|
|
|
|
////initialize map
|
|
//ccplMap = new google.maps.Map(document.getElementById(id), mapOptions);
|
|
|
|
////initialize geo coder to get address from lat lng
|
|
//geoCoder = new google.maps.Geocoder();
|
|
}
|
|
|
|
//==================================== end map functionality =============================================//
|
|
|
|
|
|
//======================================== onclick functionality ==========================================//
|
|
|
|
/**
|
|
* Function call on click of Route label to show map
|
|
* @method onclickLabelRoute
|
|
* @for Report
|
|
*/
|
|
function onclickLabelRoute() {
|
|
var lastDate = new Date();
|
|
lastDate.setDate(lastDate.getDate() - 1);//any date you want
|
|
//alert(lastDate);
|
|
var y = new Date();
|
|
$("#monthpickerFrom").kendoDatePicker({
|
|
value: lastDate,
|
|
format: "dd MMM yyyy"
|
|
});
|
|
$("#monthpickerTo").kendoDatePicker({
|
|
value: y,
|
|
format: "dd MMM yyyy"
|
|
});
|
|
//on click of label route
|
|
$("#labelRoute").click(function () {
|
|
|
|
//console.log("label route");
|
|
// add selected class
|
|
$('#labelActivity').removeClass("toolBtnActive");
|
|
$('#labelRoute').addClass("toolBtnActive");
|
|
$('#labelFeedback').removeClass("toolBtnActive");
|
|
$('#labelDTCData').removeClass("toolBtnActive");
|
|
$("#divDTCDta").hide();
|
|
$("#divMapContainer").show();
|
|
$("#divActivity").hide();
|
|
$("#divFeedback").hide();
|
|
|
|
var ticketStatus = document.getElementById('tableTicketHistory').getAttribute('data-ticketStatus'),
|
|
ticketAssignedTo = $('#ticketAssignedToHidden').val(),
|
|
ticketStatusId = $('#ticketStatusHidden').val();
|
|
|
|
console.log(ticketAssignedTo, ticketStatusId);
|
|
_assignedVanDealerLatLng = $("#AssignedVanDealerLat").val() + "," + $("#AssignedVanDealerLng").val();
|
|
_breakdownLocationLatLng = $("#BreakdownLat").val() + "," + $("#BreakdownLng").val();
|
|
|
|
if ((ticketStatus == 'open') && (ticketAssignedTo.toLowerCase().trim() == "van") && ($("#Device_Alias").val() != null && $("#Device_Alias").val() != "")) {
|
|
// alert("hi")
|
|
getTrackingHistory($("#Device_Alias").val(), $("#CreationTime").val());
|
|
} else {
|
|
//alert("else")
|
|
//_assignedVanDealerLatLng = new google.maps.LatLng($("#AssignedVanDealerLat").val(), $("#AssignedVanDealerLng").val());
|
|
|
|
getVanBreakdownLocation(_assignedVanDealerLatLng, _breakdownLocationLatLng, sourceMarker);
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Function call on click of Activity label to show ticket activity
|
|
* @method onclickLabelActivity
|
|
* @for Report
|
|
*/
|
|
function onclickLabelActivity() {
|
|
|
|
//on click of label Activitys
|
|
$("#labelActivity").click(function () {
|
|
//console.log("activity");
|
|
// add selected class
|
|
$('#labelRoute').removeClass("toolBtnActive");
|
|
$('#labelActivity').addClass("toolBtnActive");
|
|
$('#labelFeedback').removeClass("toolBtnActive");
|
|
$('#labelDTCData').removeClass("toolBtnActive");
|
|
$("#divDTCDta").hide();
|
|
$("#divActivity").show();
|
|
$("#divActivity").addClass("withtoolbar");
|
|
$("#divMapContainer").hide();
|
|
$("#divFeedback").hide();
|
|
|
|
var ticketId = $("#tableTicketHistory > tbody > tr")[0].id;
|
|
|
|
var ticketStatus = document.getElementById(ticketId).getAttribute('data-ticketStatus');
|
|
if (ticketStatus.toLowerCase() == 'closed' || ticketStatus.toLowerCase() == 'opportunity lost') {
|
|
ticketStatus = 'close';
|
|
} else { ticketStatus = 'open'; }
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "/Report/Ticket_GetOpencloseTicketActivities/",
|
|
data: { ticketId: ticketId, ticketStatus: ticketStatus },
|
|
success: function (data) {
|
|
if (data) {
|
|
$("#divActivity").html('');
|
|
$("#divActivity").html(data);
|
|
getPaymentDetailscount(ticketId);
|
|
//getdtccount(ticketId);
|
|
getdtccountbyticketid(ticketId);
|
|
}
|
|
},
|
|
error: function () { }
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Function call on click of Route label to show map
|
|
* @method onclickLabelRoute
|
|
* @for TicketAdministration
|
|
*/
|
|
function onclickLabelFeedback() {
|
|
|
|
//on click of label route
|
|
$("#labelFeedback").click(function () {
|
|
|
|
var selectTicketId;
|
|
var ticketCreationTime, isMoreThan24Hrs, isFeedBackDetails;
|
|
|
|
// add selected class
|
|
$('#labelActivity').removeClass("toolBtnActive");
|
|
$('#labelRoute').removeClass("toolBtnActive");
|
|
$('#labelFeedback').addClass("toolBtnActive");
|
|
$('#labelDTCData').removeClass("toolBtnActive");
|
|
$("#divDTCDta").hide();
|
|
$("#divFeedback").show();
|
|
$("#divFeedback").addClass("withtoolbar");
|
|
$("#divMapContainer").hide();
|
|
$("#divActivity").css('display', 'none');
|
|
|
|
showFeedback();
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* Function call on click of feedback label to show feedback form
|
|
* @method showFeedback
|
|
* @for TicketAdministration
|
|
*/
|
|
function showFeedback() {
|
|
var selectTicketId;
|
|
var ticketCreationTime, isMoreThan24Hrs, isFeedBackDetails;
|
|
selectTicketId = $("#tableTicketHistory > tbody > tr")[0].id;
|
|
|
|
if ($("#tableTicketHistory > tbody > tr")[0] != undefined) {
|
|
selectTicketId = $("#tableTicketHistory > tbody > tr")[0].id;
|
|
|
|
ticketCreationTime = document.getElementById(selectTicketId).getAttribute('data-ticketCreationTime');
|
|
isMoreThan24Hrs = parseFloat(document.getElementById(selectTicketId).getAttribute('data-reason24Hrs'), 10);
|
|
//isFeedBackDetails = document.getElementById(selectTicketId).getAttribute('data-isFeedback');
|
|
}
|
|
//console.log(selectTicketId);
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "/Report/Ticket_Feedback/",
|
|
data: { selectTicketId: selectTicketId, ticketCreationTime: ticketCreationTime, isMoreThan24Hrs: isMoreThan24Hrs },
|
|
success: function (data) {
|
|
if (data) {
|
|
$("#divFeedback").html(data);
|
|
getPaymentDetailscount(selectTicketId);
|
|
//getdtccount(selectTicketId);
|
|
c
|
|
}
|
|
},
|
|
error: function (data) {
|
|
console.log(data);
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Function to draw path between source van and destination breakdown vehicle
|
|
* @method getVanBreakdownLocation
|
|
* @param {String} vanDealerLocation The location of source van / dealer
|
|
* @param {String} breakdownLocation The location of vehicle's breakdown
|
|
* @for Report
|
|
*/
|
|
function getVanBreakdownLocation(vanDealerLocation, breakdownLocation, markerImgSrc) {
|
|
drawStaticMap_MarkersPath("staticMapImgUrl","600","450",vanDealerLocation, breakdownLocation);
|
|
//$("#staticMapImgUrl").attr("src", "");
|
|
//$("#staticMapImgUrl").attr("src", "https://maps.googleapis.com/maps/api/staticmap?markers=icon:" + window.location.origin + sourceMarker + "|" +
|
|
// vanDealerLocation + "&markers=icon:" + window.location.origin + destinationMarker + "|" + breakdownLocation +
|
|
// "&path="+ vanDealerLocation+ "|"+breakdownLocation+
|
|
// "&size=600x400&key=" + MAP_KEY)
|
|
|
|
|
|
|
|
////Get address of the Lat Long click clicked
|
|
//getReverseGeoCode(vanDealerLocation, function (data) {
|
|
// //Here we got the address of the point clicked. Update this value to the form textbox.
|
|
// var title = data;
|
|
// //create marker at position
|
|
// createMarkerVanDealer(vanDealerLocation, markerImgSrc, title);
|
|
// //Get address of the Lat Long click clicked
|
|
// getReverseGeoCode(breakdownLocation, function (data) {
|
|
// //Here we got the address of the point clicked. Update this value to the form textbox.
|
|
// var title = data;
|
|
// //create marker at position
|
|
// createMarkerVanDealer(breakdownLocation, destinationMarker, title);
|
|
|
|
// var _bounds = new google.maps.LatLngBounds();
|
|
// //console.log(ticketDetailsMarkerArray);
|
|
// for (var count = 0; count < ticketDetailsMarkerArray.length; count++) {
|
|
|
|
// _bounds.extend(ticketDetailsMarkerArray[count].position);
|
|
|
|
// }
|
|
// ccplMap.fitBounds(_bounds);
|
|
|
|
// //calculate route
|
|
// drawRoute(vanDealerLocation, breakdownLocation, ccplMap);
|
|
// });
|
|
|
|
//});
|
|
}
|
|
|
|
|
|
//====================================== draw path functionality =====================================//
|
|
|
|
/**
|
|
* Function to draw markers on position of van / dealer
|
|
* @method createMarkerVanDealer
|
|
* @param {String} position The location of source van / dealer
|
|
* @param {String} icon The icon of marker
|
|
* @param {String} title The title of marker
|
|
* @for Report
|
|
*/
|
|
function createMarkerVanDealer(position, icon, title) {
|
|
//console.log(position);
|
|
|
|
////create a google marker with the given param
|
|
//var vanDealerMarker = new google.maps.Marker({
|
|
// position: position,
|
|
// //draggable:true,
|
|
// map: ccplMap,
|
|
// icon: icon,
|
|
// title: title
|
|
//});
|
|
|
|
////push marker to marksArray
|
|
//ticketDetailsMarkerArray.push(vanDealerMarker);
|
|
//console.log(ticketDetailsMarkerArray);
|
|
}
|
|
|
|
/**
|
|
* This fn calculates and draws the Route for the Ticket selected in the Ticket List using Google Direction API
|
|
* @method drawRoute
|
|
* @param {String} startLatLng The lat lng of origin
|
|
* @param {String} endLatLng The lat lng of destination
|
|
* @param {String} mapID The id of map
|
|
* @for Report
|
|
*/
|
|
function drawRoute(startLatLng, endLatLng, mapID) {
|
|
//var merkerIcon;
|
|
//if (displayDisplay) {
|
|
|
|
// //Remove direction display
|
|
// displayDisplay.setMap(null);
|
|
//}
|
|
|
|
//var rendererOptions = {
|
|
// map: mapID,
|
|
// suppressMarkers: true,
|
|
// polylineOptions: { strokeColor: "#1b3f94" }
|
|
//}
|
|
//displayDisplay = new google.maps.DirectionsRenderer(rendererOptions);
|
|
|
|
////if (tick.vehicle_latitude && tick.vehicle_longitude) {
|
|
////Make request obj to Direction Service API with starting and end LatLng
|
|
//var request = {
|
|
// origin: startLatLng,
|
|
// destination: endLatLng,
|
|
// travelMode: google.maps.TravelMode.DRIVING
|
|
//};
|
|
////call Direction Service API with the reuqest obj
|
|
//routeDirectionsService.route(request, function (response, status) {
|
|
// //console.log(status);
|
|
// //if status was a success
|
|
// if (status == google.maps.DirectionsStatus.OK) {
|
|
|
|
// displayDisplay.setOptions({ preserveViewport: true });
|
|
// //set Direction to the response
|
|
// displayDisplay.setDirections(response);
|
|
|
|
// var leg = response.routes[0].legs[0];
|
|
|
|
// }
|
|
//});
|
|
}
|
|
|
|
//====================================== end of draw path============================================//
|
|
|
|
//======================================================================GeoCoding Functions=============================================================================//
|
|
/**
|
|
* This function reverses the Lat Lng to Get the Approxmiate Address using the Google GeoCoding. Callback the result
|
|
* @method getReverseGeoCode
|
|
* @param {String} latLng The lat lng of origin
|
|
* @param {String} callback The callback function
|
|
* @for Report
|
|
*/
|
|
function getReverseGeoCode(latLng, callback) {
|
|
|
|
//// Get google map LatLng object with the latLng in params
|
|
//var latlng = new google.maps.LatLng(latLng.lat(), latLng.lng());
|
|
|
|
////Use google geocode library to get results
|
|
//geoCoder.geocode({ 'latLng': latlng }, function (results, status) {
|
|
// //If status is Ok
|
|
// if (status == google.maps.GeocoderStatus.OK) {
|
|
// //Find most intensive search result and callback it
|
|
// if (results[0]) {
|
|
// callback(results[0].formatted_address);
|
|
// //Else callback no result found
|
|
// } else {
|
|
// callback('No results found');
|
|
// }
|
|
// }
|
|
// else { callback('NA'); }
|
|
// return 'NA';
|
|
//});
|
|
}
|
|
|
|
|
|
//====================================== end of GeoCoding Functions============================================//
|
|
|
|
|
|
|
|
/**
|
|
* Function call to Get tracking list device alias wise for open ticket report
|
|
* @method getTrackingHistory
|
|
* @param {String} deviceAlias device alias of van whom to ticket is assigned
|
|
* @param {String} creationTime ticket creation time
|
|
* @for Report
|
|
*/
|
|
function getTrackingHistory(deviceAlias, creationTime) {
|
|
|
|
|
|
// $("#staticMapImgUrl").attr("src", "");
|
|
|
|
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "/Report/Report_GetTrackingHistoryDeviceAliasWise/",
|
|
data: { deviceAlias: deviceAlias, creationTime: creationTime },
|
|
success: function (data) {
|
|
//console.log(data.list);
|
|
if (data.success == true) {
|
|
if (data.list.length !== null && data.list.length > 0) {
|
|
|
|
var listCount = data.list.length;
|
|
|
|
// _currentLocationLatLng = new google.maps.LatLng(data.list[listCount - 1].lat, data.list[listCount - 1].lng);
|
|
_currentLocationLatLng = data.list[listCount - 1].lat+","+ data.list[listCount - 1].lng;
|
|
//getReverseGeoCode(_currentLocationLatLng, function (data) {
|
|
// //Here we got the address of the point clicked. Update this value to the form textbox.
|
|
// var title = data;
|
|
// //create marker at position
|
|
// createMarkerVanDealer(_assignedVanDealerLatLng, sourceMarker, title);
|
|
//});
|
|
|
|
//console.log(_assignedVanDealerLatLng);
|
|
// drawPolylines(data.list);
|
|
// getVanBreakdownLocation(_currentLocationLatLng, _breakdownLocationLatLng, currentLocationMarker);
|
|
|
|
drawStaticMap_MarkersPath("staticMapImgUrl","600","450",_currentLocationLatLng, _breakdownLocationLatLng)
|
|
|
|
// $("#staticMapImgUrl").attr("src", "https://maps.googleapis.com/maps/api/staticmap?markers=icon:" + window.location.origin + sourceMarker + "|" +
|
|
// _currentLocationLatLng + "&markers=icon:" + window.location.origin + destinationMarker + "|" + _breakdownLocationLatLng +
|
|
// "&path=" + _currentLocationLatLng + "|" + _breakdownLocationLatLng +
|
|
//"&size=600x400&key=" + MAP_KEY)
|
|
|
|
} else {
|
|
drawStaticMap_MarkersPath("staticMapImgUrl","600","450",_assignedVanDealerLatLng, _breakdownLocationLatLng)
|
|
|
|
// $("#staticMapImgUrl").attr("src", "https://maps.googleapis.com/maps/api/staticmap?markers=icon:" + window.location.origin + sourceMarker + "|" +
|
|
//_assignedVanDealerLatLng + "&markers=icon:" + window.location.origin + destinationMarker + "|" + _breakdownLocationLatLng +
|
|
//"&path=" + _assignedVanDealerLatLng + "|" + _breakdownLocationLatLng +
|
|
//"&size=600x400&key=" + MAP_KEY)
|
|
//_assignedVanDealerLatLng = new google.maps.LatLng($("#AssignedVanDealerLat").val(), $("#AssignedVanDealerLng").val());
|
|
// getVanBreakdownLocation(_assignedVanDealerLatLng, _breakdownLocationLatLng, sourceMarker);
|
|
}
|
|
}
|
|
},
|
|
error: function (data) {
|
|
console.log(data);
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* Function call to draw tracking path
|
|
* @method drawPolylines
|
|
* @param {Json} coordinates lat lng array
|
|
* @for Report
|
|
*/
|
|
function drawPolylines(coordinates) {
|
|
//var polyline = new google.maps.Polyline({
|
|
// path: coordinates,
|
|
// geodesic: true,
|
|
// strokeColor: '#FF0000',
|
|
// strokeOpacity: 1.0,
|
|
// strokeWeight: 2
|
|
//});
|
|
//polyline.setMap(ccplMap);
|
|
//return polyline;
|
|
}
|
|
|
|
|
|
/**
|
|
* Function call on expanding data of kendo panelbar
|
|
* @method onExpand
|
|
* @for Report
|
|
*/
|
|
function onExpand(e) {
|
|
//Get expand div id
|
|
var expandDivId = e.item.id;
|
|
//Get customer contact no.
|
|
var customerContactNo = $("#CustomerContactNo").val();
|
|
//Get vehicle registration no.
|
|
var vRegNo = $("#VehicleRegistrationNo").val();
|
|
|
|
var selectTicketId = $("#tableTicketHistory > tbody > tr")[0].id;
|
|
|
|
// var selectTicketstatus = window.location.href.indexOf("Open") ;//document.getElementById(selectTicketId).getAttribute('data-ticketstatus');
|
|
|
|
|
|
var tstatus="open";
|
|
if (window.location.href.indexOf("Open") > -1) {
|
|
tstatus="open";
|
|
}
|
|
else{
|
|
tstatus="close";
|
|
}
|
|
var apiUrl = "";
|
|
apiUrl = url + "Api/TicketDetails?ownerinfo=yes&ticketid=" + selectTicketId + "&Token=teramatrix&openclose=" + tstatus + "";
|
|
//On expand of driver details div
|
|
if ((expandDivId.toLowerCase()).indexOf('driver') !== -1) {
|
|
if (countDriverExpand == 0) {
|
|
$("#tableDriverDetails").css('visibility', 'hidden');
|
|
$("#loadingDriverDetails").show();
|
|
countDriverExpand = countDriverExpand + 1;
|
|
//call web api to get driver details
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: apiUrl,
|
|
success: function (data) {
|
|
$("#customerName").text(data.DriverName);
|
|
$("#customerContactNo").text(data.DriverNumber);
|
|
|
|
},
|
|
complete: function () {
|
|
|
|
$("#tableDriverDetails").css('visibility', 'visible');
|
|
$("#loadingDriverDetails").hide();
|
|
// alert(isconnected);
|
|
},
|
|
error: function (data) {
|
|
alert(data);// alert(isconnected);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
if ((expandDivId.toLowerCase()).indexOf('kam') !== -1) {
|
|
if (countKamExpand == 0) {
|
|
$("#tableKamDetails").css('visibility', 'hidden');
|
|
$("#loadingKamDetails").show();
|
|
countKamExpand = countKamExpand + 1;
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: apiUrl,
|
|
success: function (data) {
|
|
console.log(data);
|
|
if (data.KamName == null) {
|
|
data.KamName = '-';
|
|
}
|
|
else {
|
|
}
|
|
if (data.KamNo == null) {
|
|
data.KamNo = '-';
|
|
}
|
|
else {
|
|
}
|
|
if (data.FleetManagerName == null) {
|
|
data.FleetManagerName = '-';
|
|
}
|
|
else {
|
|
} if (data.FleetManagerNo == null) {
|
|
data.FleetManagerNo = '-';
|
|
}
|
|
else {
|
|
}
|
|
$("#kamName").text(data.KamName);
|
|
|
|
$("#KamNo").text(data.KamNo);
|
|
$("#fleetName").text(data.FleetManagerName);
|
|
$("#FleetNo").text(data.FleetManagerNo);
|
|
|
|
},
|
|
complete: function () {
|
|
|
|
$("#tableKamDetails").css('visibility', 'visible');
|
|
$("#loadingKamDetails").hide();
|
|
|
|
},
|
|
error: function (data) {
|
|
alert(data);
|
|
}
|
|
});
|
|
|
|
}
|
|
}
|
|
|
|
if ((expandDivId.toLowerCase()).indexOf('batteryvoltage') !== -1) {
|
|
//$("#batteryVoltage").text('10');
|
|
console.log(countVehiceHealthExpand);
|
|
if (countVehiceHealthExpand == 0) {
|
|
if (countVehiceHealthExpand == 0) {
|
|
// alert(data.BatteryVoltage);
|
|
|
|
$("#tableVehicleHealthDetails").css('visibility', 'hidden');
|
|
$("#loadingvehicleHealthDetails").show();
|
|
countVehiceHealthExpand = countVehiceHealthExpand + 1;
|
|
$.ajax({
|
|
type: "POST",
|
|
url: apiUrl,
|
|
success: function (data) {
|
|
alert(data.fuelLevelInPer);
|
|
if (data.fuelLevelInPer == null) {
|
|
data.fuelLevelInPer = '-';
|
|
}
|
|
if (data.defLevelInLtr == null) {
|
|
data.defLevelInLtr = '-';
|
|
}
|
|
if (data.fuelLevelInLtr == null) {
|
|
data.fuelLevelInLtr = '-';
|
|
|
|
}
|
|
if (data.BatteryVoltage == null) {
|
|
data.BatteryVoltage = '-';
|
|
}
|
|
$("#fuelLevelInLtr").text(data.fuelLevelInLtr);
|
|
$("#defLevelInLtr").text(data.defLevelInLtr);
|
|
$("#fuelLevelInPer").text(data.fuelLevelInPer);
|
|
|
|
|
|
$("#batteryVoltage").text(data.BatteryVoltage);
|
|
|
|
|
|
},
|
|
complete: function () {
|
|
|
|
$("#tableVehicleHealthDetails").css('visibility', 'visible');
|
|
$("#loadingvehicleHealthDetails").hide();
|
|
|
|
},
|
|
error: function (data) {
|
|
alert(data);
|
|
}
|
|
});
|
|
|
|
}
|
|
}
|
|
}
|
|
//On expand of owner details div
|
|
else if ((expandDivId.toLowerCase()).indexOf('owner') !== -1) {
|
|
if (countOwnerExpand == 0) {
|
|
$("#tableOwnerDetails").css('visibility', 'hidden');
|
|
$("#loadingOwnerDetails").show();
|
|
countOwnerExpand = countOwnerExpand + 1;
|
|
//call web api to get owner details
|
|
$.ajax({
|
|
type: "POST",
|
|
url: apiUrl,
|
|
success: function (data) {
|
|
if(data.CustomerAlias == null){
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "/Ticket/Ticket_GetOpencloseTicketOwnerDetails/",
|
|
data: { VRegistrationNo: vRegNo },
|
|
success: function (data) {
|
|
console.log(data.list);
|
|
if (data.list.length > 0) {
|
|
for (var count = 0; count < data.list.length; count++) {
|
|
$("#ownerName").text(data.list[count].CustomerCustomerName);
|
|
$("#ownerContact").text(data.list[count].CustomerMobileNumber1);
|
|
if(data.list[count].CustomerState == null){
|
|
data.list[count].CustomerState ="-";
|
|
}
|
|
$("#ownerState").text(data.list[count].CustomerState);
|
|
if(data.list[count].CustomerType == null){
|
|
data.list[count].CustomerType ="-";
|
|
}
|
|
$("#customer_type").text(data.list[count].CustomerType);
|
|
if(data.list[count].Id == null){
|
|
data.list[count].Id ="-";
|
|
}
|
|
$("#customer_id").text(data.list[count].Id);//added on 15-01-2021
|
|
}
|
|
}
|
|
},
|
|
complete: function () {
|
|
$("#tableOwnerDetails").css('visibility', 'visible');
|
|
$("#loadingOwnerDetails").hide();
|
|
},
|
|
error: function (data) {
|
|
}
|
|
});
|
|
}
|
|
else{
|
|
$("#ownerName").text(data.CustomerAlias);
|
|
$("#ownerContact").text(data.CustomerMobileNumber1);
|
|
if(data.CustomerAddress == null || data.CustomerAddress ==""){
|
|
data.CustomerAddress ="";
|
|
}
|
|
$("#ownerState").text(data.CustomerAddress);
|
|
$("#customertype").text(data.CustomerType);
|
|
if(data.CustomerId == null || data.CustomerId ==""){
|
|
data.CustomerId ="";
|
|
}
|
|
$("#customer_id").text(data.CustomerId);//added on 15-01-2021
|
|
}
|
|
},
|
|
complete: function () {
|
|
|
|
$("#tableOwnerDetails").css('visibility', 'visible');
|
|
$("#loadingOwnerDetails").hide();
|
|
},
|
|
error: function (data) {
|
|
alert(data);// alert(isconnected);
|
|
}
|
|
});
|
|
|
|
}
|
|
}
|
|
else if ((expandDivId.toLowerCase()).indexOf('vehicle') !== -1) {
|
|
if (countVehicleExpand == 0) {
|
|
$("#tableVehicleDetails").css('visibility', 'hidden');
|
|
$("#loadingVehicleDetails").show();
|
|
countVehicleExpand = countVehicleExpand + 1;
|
|
//call web api to get vehicle details
|
|
//var apiUrl = "";
|
|
//apiUrl = url + "Api/TicketDetails?ownerinfo=yes&ticketid=TICKETID-275399&Token=teramatrix&openclose=open";
|
|
$.ajax({
|
|
type: "POST",
|
|
url: apiUrl,
|
|
success: function (data) {
|
|
//alert(data.VehicleInstallationDate);
|
|
$("#vehicleRegistration").text(data.RegistrationNumber);
|
|
$("#vehicleModelNo").text(data.vehicleModelTaggingName);
|
|
if(data.VehicleModelNumber == null){
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "/Ticket/Ticket_GetOpencloseTicketVehicleDetails/",
|
|
data: { VRegistrationNo: vRegNo },
|
|
success: function (data) {
|
|
//console.log(data.list, data.vehicleModelTagging);
|
|
if (data.list.length > 0) {
|
|
for (var count = 0; count < data.list.length; count++) {
|
|
$("#vehicleRegistration").text(data.list[count].RegistrationNo);
|
|
$("#vehicleModelNo").text(data.vehicleModelTaggingName);
|
|
$("#vehicleType").text(data.list[count].VehicleType);
|
|
$("#lblVehicleEmissionNorms").text("-");
|
|
$("#vehicleProductVariant").text("-");
|
|
$("#lblVehicleAMc").text("-");
|
|
$("#trtype").hide();
|
|
$("#trdate").hide();
|
|
$("#lblVehicleextendedWarranty").text("-");
|
|
$("#lblvehicleWarranty").text("-");
|
|
$("#lblVehicleextendedeWarrantyenddate").text("-");
|
|
data.list[count].VehicleInstallationDate == null ? $("#vehicleInstallationDate").text('-') : $("#vehicleInstallationDate").text(data.list[count].VehicleInstallationDate);
|
|
}
|
|
$("#vehicleProductVariant").text("-");
|
|
|
|
$("#lblVehicleSalesDate").text("-");
|
|
$("#vehicleType").text("-");
|
|
}
|
|
},
|
|
complete: function () {
|
|
$("#tableVehicleDetails").css('visibility', 'visible');
|
|
$("#loadingVehicleDetails").hide();
|
|
},
|
|
error: function (data) {
|
|
}
|
|
});
|
|
}
|
|
else{
|
|
$("#vehicleType").text(data.VehicleType);
|
|
if(data.VehicleInstallationDate == null || data.VehicleInstallationDate ==""){
|
|
data.VehicleInstallationDate ="-";
|
|
}
|
|
if( data.VehicleInstallationDate=="1/1/0001"){
|
|
data.VehicleInstallationDate ="-";
|
|
}
|
|
$("#vehicleInstallationDate").text(data.VehicleInstallationDate);
|
|
$("#vehicleProductVariant").text(data.ProductVariant);
|
|
$("#vehicleModelNo").text(data.VehicleModelNumber);
|
|
$("#vehiclechassisnumber").text(data.VehicleNumberPlate);
|
|
|
|
if (data.VehicleEmissionNorms == "" || data.VehicleEmissionNorms == null)
|
|
{
|
|
|
|
data.VehicleEmissionNorms = "-";
|
|
}
|
|
|
|
$("#lblVehicleEmissionNorms").text(data.VehicleEmissionNorms);
|
|
|
|
$("#lblVehicleSalesDate").text(data.VehicleInstallationDate);
|
|
|
|
if (data.VehicleAMC == "No" || data.VehicleAMC == "no" )
|
|
{
|
|
|
|
// $("#trtype").hide();
|
|
// $("#trdate").hide();
|
|
|
|
}
|
|
if (data.VehicleAMC == "" || data.VehicleAMC == null)
|
|
{
|
|
data.VehicleAMC = "-";
|
|
data.VehicleAMCDate = "-";
|
|
data.VehicleAMCType = "-";
|
|
// $("#trtype").hide();
|
|
// $("#trdate").hide();
|
|
}
|
|
else{
|
|
data.VehicleAMC=data.VehicleAMC.toUpperCase();
|
|
}
|
|
|
|
$("#lblVehicleAMc").text(data.VehicleAMC);
|
|
|
|
|
|
if (data.VehicleWarranty == "" || data.VehicleWarranty == null)
|
|
{
|
|
data.VehicleWarranty="-";
|
|
}
|
|
else{
|
|
data.VehicleWarranty=data.VehicleWarranty.toUpperCase()
|
|
}
|
|
|
|
$("#lblvehicleWarranty").text(data.VehicleWarranty);
|
|
|
|
|
|
|
|
if (data.VehicleEmissionNorms == "" || data.VehicleEmissionNorms == null)
|
|
{
|
|
|
|
data.VehicleEmissionNorms = "-";
|
|
}
|
|
|
|
$("#lblVehicleEmissionNorms").text(data.VehicleEmissionNorms);
|
|
|
|
if(data.VehicleSalesDate == null || data.VehicleSalesDate ==""){
|
|
data.VehicleSalesDate ="-";
|
|
}
|
|
if( data.VehicleSalesDate =="1/1/0001"){
|
|
data.VehicleSalesDate ="-";
|
|
}
|
|
$("#lblVehicleSalesDate").text(data.VehicleInstallationDate);
|
|
$("#vehicleProductVariant").text(data.ProductVariant);
|
|
$("#vehicleModelNo").text(data.VehicleModelNumber);
|
|
$("#vehiclechassisnumber").text(data.VehicleNumberPlate);
|
|
|
|
if (data.VehicleAMC == "No" || data.VehicleAMC == "no" || data.VehicleAMC == "NO")
|
|
{
|
|
|
|
$("#trtype").hide();
|
|
$("#trdate").hide();
|
|
|
|
}
|
|
if (data.VehicleAMC == "" || data.VehicleAMC == null)
|
|
{
|
|
data.VehicleAMC = "-";
|
|
data.VehicleAMCDate = "-";
|
|
data.VehicleAMCType = "-";
|
|
$("#trtype").hide();
|
|
$("#trdate").hide();
|
|
}
|
|
else{
|
|
data.VehicleAMC=data.VehicleAMC.toUpperCase();
|
|
}
|
|
|
|
$("#lblVehicleAMc").text(data.VehicleAMC);
|
|
|
|
$("#lblVehicleAMC").text(data.VehicleAMC);
|
|
$("#lblVehicledate").text(data.VehicleAMCDate);
|
|
$("#lblVehicleType").text(data.VehicleAMCType);
|
|
if (data.ExtendedWarranty == null || data.ExtendedWarranty =="")
|
|
{
|
|
data.ExtendedWarranty ="-";
|
|
data.WarrantyEndDate ="-";
|
|
|
|
}
|
|
else{
|
|
if (data.ExtendedWarranty == "Active" || data.ExtendedWarranty == "ACTIVE")
|
|
{
|
|
data.ExtendedWarranty = "YES";
|
|
|
|
}
|
|
else{
|
|
data.ExtendedWarranty = "NO";
|
|
data.WarrantyEndDate ="-";
|
|
}
|
|
}
|
|
$("#lblVehicleextendedWarranty").text(data.ExtendedWarranty);
|
|
$("#lblVehicleextendedeWarrantyenddate").text(data.WarrantyEndDate);
|
|
}
|
|
},
|
|
complete: function () {
|
|
$("#tableVehicleDetails").css('visibility', 'visible');
|
|
$("#loadingVehicleDetails").hide();
|
|
},
|
|
error: function (data) {
|
|
alert(data);// alert(isconnected);
|
|
}
|
|
});
|
|
|
|
}
|
|
}
|
|
|
|
//On expand of escalation members details div
|
|
/* else if ((expandDivId.toLowerCase()).indexOf('escalation') !== -1) {
|
|
if (countEscalationMembersExpand == 0) {
|
|
var dealer_id = $("#DealerID").val();
|
|
var vehicle_tagging = $("#VehicleTagging").val();
|
|
//console.log(dealer_id, vehicle_tagging);
|
|
//$("#tableEscalationMembersDetails").css('visibility', 'hidden');
|
|
$("#loadingEscalationMembersDetails").show();
|
|
countEscalationMembersExpand = countEscalationMembersExpand + 1;
|
|
//call web api to get vehicle details
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "/Report/Ticket_GetOpencloseTicketEscalationMembersDetails/",
|
|
data: { dealer_id: dealer_id, vehicle_tagging: vehicle_tagging },
|
|
success: function (data) {
|
|
if (data) {
|
|
$("#divEscalationMembersDetails").html(data);
|
|
$("#tableEscalationMembersDetails").css('visibility', 'hidden');
|
|
}
|
|
},
|
|
complete: function () {
|
|
$("#tableEscalationMembersDetails").css('visibility', 'visible');
|
|
$("#loadingEscalationMembersDetails").hide();
|
|
},
|
|
error: function (data) {
|
|
}
|
|
});
|
|
}
|
|
}*/
|
|
else if ((expandDivId.toLowerCase()).indexOf('escalation') !== -1) {
|
|
if (countEscalationMembersExpand == 0) {
|
|
var dealer_id = $("#DealerID").val();
|
|
var vehicle_tagging = $("#VehicleTagging").val();
|
|
var htmlmaangerdata = "";
|
|
// alert(dealer_id, vehicle_tagging+'aaa');
|
|
var pvariant="CNG";
|
|
//$("#tableEscalationMembersDetails").css('visibility', 'hidden');
|
|
$("#loadingEscalationMembersDetails").show();
|
|
countEscalationMembersExpand = countEscalationMembersExpand + 1;
|
|
$.ajax({
|
|
type: "POST",
|
|
url: apiUrl,
|
|
success: function (data) {
|
|
|
|
|
|
if (data.ProductVariant == null) {
|
|
|
|
}
|
|
else {
|
|
pvariant = data.ProductVariant;
|
|
}
|
|
|
|
}
|
|
});
|
|
|
|
// alert(dealer_id, vehicle_tagging+'aaa'+pvariant);
|
|
setTimeout(function () {
|
|
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: url + "Api/Ticket?operation=getescalationlevels",
|
|
data: { DelerId: dealer_id, token: "teramatrix", VehicleType: vehicle_tagging, ProductVariant: pvariant },
|
|
|
|
success: function (data) {
|
|
htmlmaangerdata += "<table id=\"tableEscalationMembersDetails\" cellpadding=\"0\" cellspacing=\"0\">";
|
|
htmlmaangerdata += "<thead class=\"StructureTD\"> <tr><th class=\"tableCelllabel\" style=\"background: none !important; color: black;\"> <span class=\"\">ManagerLevel</span></th>";
|
|
htmlmaangerdata += "<th class=\"tableCelllabel\" style=\"background: none !important; color: black;\"><span class=\"\">ManagerName</span></th>";
|
|
htmlmaangerdata += "<th class=\"tableCelllabel\" style=\"background: none !important; color: black;\"><span class=\"\">ManagerPhoneNo</span></th></tr> </thead>";
|
|
htmlmaangerdata += "<tbody class=\"StructureTD\" id=\"tescalationmanager\">";
|
|
if (data.EscalationLevelList.length > 0) {
|
|
for (var count = 0; count < data.EscalationLevelList.length; count++) {
|
|
//alert(data.EscalationLevelList[count].ManagerName);
|
|
htmlmaangerdata += "<tr><td class=\"tableCellinfo\" style=\"width: 30 % !important; background: none!important;\">" + data.EscalationLevelList[count].ManagerLevel + "</td>";
|
|
htmlmaangerdata += "<td class=\"tableCellinfo\" style=\"width: 30 % !important; background: none!important;\">" + data.EscalationLevelList[count].ManagerName + "</td>";
|
|
htmlmaangerdata += "<td class=\"tableCellinfo\" style=\"width: 30 % !important; background: none!important;\">" + data.EscalationLevelList[count].ManagerPhoneNo + "</td ></tr > ";
|
|
|
|
|
|
}
|
|
htmlmaangerdata += "</tbody></table >";
|
|
|
|
$("#divEscalationMembersDetails").html(htmlmaangerdata);
|
|
|
|
}
|
|
//if (data) {
|
|
// $("#divEscalationMembersDetails").html(data);
|
|
// $("#tableEscalationMembersDetails").css('visibility', 'hidden');
|
|
//}
|
|
},
|
|
complete: function () {
|
|
$("#tableEscalationMembersDetails").css('visibility', 'visible');
|
|
$("#loadingEscalationMembersDetails").hide();
|
|
},
|
|
error: function (data) {
|
|
}
|
|
});
|
|
}, 1000);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
* Function call on edit button and redirect to ticket feedback page to edit feedback
|
|
* @method editTicketFeedback
|
|
* @for Report
|
|
*/
|
|
function editTicketFeedback($this) {
|
|
var ticketid = document.getElementById($this.id).getAttribute('data-TicketId');
|
|
//window.location.href = "/Ticket/TicketAdministration?complaintNo=" + ticketid;
|
|
window.open("/Ticket/TicketAdministration?complaintNo=" + ticketid + "&feedback=yes");
|
|
}
|
|
|
|
/**
|
|
* Function call on edit button and redirect to ticket activity page to edit ticket activity
|
|
* @method editTicketActivity
|
|
* @for Report
|
|
*/
|
|
function editTicketActivity($this) {
|
|
var ticketid = document.getElementById($this.id).getAttribute('data-TicketId');
|
|
//window.location.href = "/Ticket/TicketAdministration?complaintNo=" + ticketid;
|
|
window.open("/Ticket/TicketAdministration?complaintNo=" + ticketid);
|
|
|
|
}
|
|
|
|
function exportDtcReportCSV() {
|
|
|
|
$("#overlay").show();
|
|
var strdevicetype = $('#hdndtcdevicetype').val();
|
|
//var chassisno = "MC2BCPRF0KH062819";
|
|
var chassisno = $("#vehiclechassisnumber").html()
|
|
var startdate = $("#monthpickerFrom").val();
|
|
var enddate = $("#monthpickerTo").val();
|
|
|
|
if (strdevicetype == "volvo") {
|
|
var apiUrl = url + "Api/DTCData?devicetype=" + strdevicetype + "&chassisnumber=" + chassisno + "&startdate=" + startdate + "&enddate=" + enddate + "";
|
|
$.ajax({
|
|
url: apiUrl,
|
|
type: 'POST',
|
|
dataType: 'json',
|
|
success: function (data, textStatus, xhr) {
|
|
window.location.href = data;
|
|
$("#overlay").hide();
|
|
},
|
|
error: function (xhr, textStatus, errorThrown) {
|
|
console.log('Error in Operation');
|
|
}
|
|
});
|
|
}
|
|
else {
|
|
var apiUrlwebco = url + "Api/DTCData?devicetype=" + strdevicetype + "&chassisnumber=" + chassisno + "&startdate=" + startdate + "&enddate=" + enddate + "&iswabco=true";
|
|
$.ajax({
|
|
url: apiUrlwebco,
|
|
type: 'post',
|
|
dataType: 'json',
|
|
success: function (data, textStatus, xhr) {
|
|
window.location.href = data;
|
|
$("#overlay").hide();
|
|
},
|
|
error: function (xhr, textStatus, errorThrown) {
|
|
console.log('Error in Operation');
|
|
}
|
|
});
|
|
}
|
|
}
|
|
//======================== document ready function ================//
|
|
var _assignedVanDealerLatLng = '', _breakdownLocationLatLng = '', _currentLocationLatLng = '';
|
|
$(document).ready(function () {
|
|
$("#loadingTicketDetails").hide();
|
|
$("#loadingDriverDetails").hide();
|
|
$("#loadingOwnerDetails").hide();
|
|
$("#loadingVehicleDetails").hide();
|
|
$("#loadingVanDetails").hide();
|
|
$("#loadingDealerDetails").hide();
|
|
|
|
//_assignedVanDealerLatLng = new google.maps.LatLng($("#AssignedVanDealerLat").val(), $("#AssignedVanDealerLng").val());
|
|
//_breakdownLocationLatLng = new google.maps.LatLng($("#BreakdownLat").val(), $("#BreakdownLng").val());
|
|
//_currentLocationLatLng = new google.maps.LatLng($("#CurrentLat").val(), $("#CurrentLong").val());
|
|
_assignedVanDealerLatLng = "";
|
|
_breakdownLocationLatLng = "";
|
|
_currentLocationLatLng = "";
|
|
if (window.location.href.indexOf("Open") > -1) {
|
|
var VRegistrationNo = $("#VehicleRegistrationNo").val();
|
|
var apiUrl = url + "Api/Activity?chassisno=chassis®no=" + VRegistrationNo;
|
|
$.ajax({
|
|
type: "GET",
|
|
url: apiUrl,
|
|
success: function (data) {
|
|
|
|
$("#vehiclechassisnumber").html(data);
|
|
// chassisno = data;
|
|
},
|
|
complete: function () {
|
|
|
|
},
|
|
error: function (data) {
|
|
// console.log(data);
|
|
}
|
|
});
|
|
}
|
|
if (document.getElementById('tableTicketHistory').getAttribute('data-ticketStatus') == 'close') {
|
|
$("#listFeedback").show();
|
|
} else { $("#listFeedback").hide(); }
|
|
|
|
setTimeout(function () {
|
|
// initMap("divMapContainer");
|
|
setTimeout(function () {
|
|
if (document.getElementById('tableTicketHistory').getAttribute('data-ticketStatus') == 'close') {
|
|
|
|
$("#labelFeedback").trigger("click");
|
|
} else { $("#labelActivity").trigger("click"); }
|
|
}, 500);
|
|
|
|
}, 1000);
|
|
|
|
});
|
|
|
|
|
|
//---------------------------- added on 23-12-2020 (end)----------------------------------
|
|
|
|
function getdtccount(ticketId) {
|
|
var userrole = $("#UserRole").val();
|
|
|
|
if (userrole == 'CCE') {
|
|
}
|
|
else{
|
|
var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
|
];
|
|
var date = new Date();
|
|
var day = date.getDate();
|
|
var month = monthNames[date.getMonth()-1]
|
|
var year = date.getFullYear();
|
|
var stDate = day + "-" + month + "-" + year;
|
|
var vehicel_status = "";
|
|
var enddate = $("#monthpickerTo").val();
|
|
//$('#lidtcdata').hide();
|
|
$.ajax({
|
|
type: "Post",
|
|
url: url + "Api/DTCData?ticketId=" + ticketId + "&startdate="+stDate+"&enddate="+enddate,
|
|
dataType: "json",
|
|
success: function (data) {
|
|
// alert(data);
|
|
var splits = data.split(",");
|
|
var dtccount = splits[0];
|
|
var chassisnumber = splits[1];
|
|
vehicel_status = splits[2];
|
|
|
|
$('#lblDTCCount').html("(" + dtccount + ")");
|
|
$('#labelDTCData').css("background-color", "#ee2e22").css("color", "#fff");
|
|
$("#hdnchassisno").val(chassisnumber);
|
|
},
|
|
complete: function () {
|
|
|
|
if(vehicel_status.toLowerCase() =="connected")
|
|
{
|
|
setTimeout(function () {GetDtcData(); }, 2000);
|
|
}
|
|
else{
|
|
$('#lidtcdata').hide();
|
|
}
|
|
|
|
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function getdtccountbyticketid(ticketId) {
|
|
|
|
console.log(ticketId);
|
|
var userrole = $("#UserRole").val().toLowerCase();
|
|
console.log('userRole');
|
|
console.log('userRole');
|
|
//alert(userRole + ticketId);
|
|
// if (userRole = "Superadmin" ) {
|
|
console.log('userRole');
|
|
var apiUrl = url + "Api/DTCData?DtcCount=yes&ticketId=yes&startdate=no";
|
|
$.ajax({
|
|
url: apiUrl,
|
|
type: 'Post',
|
|
dataType: 'json',
|
|
data: { TicketIdAlias: ticketId },
|
|
|
|
dataType: 'json',
|
|
success: function (data) {
|
|
//alert(data);
|
|
console.log(data);
|
|
$('#lblDTCCountSuperAdmin').html("(" + data + ")");
|
|
$('#labelDTCData').css("background-color", "#ee2e22").css("color", "#fff");
|
|
//$("#hdnchassisno").val(chassisnumber);
|
|
$('#lidtcdata').show();
|
|
// $('#lblDTCCountSuperAdmin').val(data);
|
|
}
|
|
|
|
});
|
|
//}
|
|
}
|
|
|
|
|
|
function DTCReportBYId(ticketid) {
|
|
$("#overlay").show(); $("#tbldtcdata").html('');
|
|
$('#divDTCDta').show();
|
|
$('#labelRoute').removeClass("toolBtnActive");
|
|
$('#labelFeedback').removeClass("toolBtnActive");
|
|
//divDTCDta$('#labelActivity').removeClass("toolBtnActive");
|
|
$('#labelDTCData').addClass("toolBtnActive");
|
|
$("#divDTCDta").css('display', 'inline-block');
|
|
$("#divDTCDta").addClass("withtoolbar");
|
|
$("#divFeedback").hide();
|
|
|
|
ticketid = $("#hdnticketAlias").val();
|
|
console.log('userRole');
|
|
var htmldtcdata = "";
|
|
var apiUrl = url + "Api/DTCData?ticketId=yes&startdate=no";
|
|
console.log(ticketid);
|
|
// var apiUrl = url + "Report/ConsolidatedReport?currtime=638539904591341514&reassigntickets=yes";
|
|
$.ajax({
|
|
url: apiUrl,
|
|
type: 'Post',
|
|
dataType: 'json',
|
|
data: { TicketIdAlias: ticketid},
|
|
|
|
dataType: 'json',
|
|
success: function (data, textStatus, xhr) {
|
|
|
|
for (keyVar in data) {
|
|
if (data.hasOwnProperty(keyVar)) {
|
|
|
|
htmldtcdata += "<tr><td>" + data[keyVar].DTC_CODE + "</td>";
|
|
htmldtcdata += "<td>" + data[keyVar].DTC_Description + "</td>";
|
|
htmldtcdata += "<td>" + data[keyVar].Occurence_count + "</td>";
|
|
htmldtcdata += "<td>" + data[keyVar].DTC_Occurance_Date + "</td>";
|
|
htmldtcdata += "<td>" + data[keyVar].status + "</td></tr>";
|
|
|
|
}
|
|
}
|
|
|
|
//$("#tblwabco").show();
|
|
if (htmldtcdata == '') {
|
|
|
|
$("#dvError").html('"No DTC Data available for this Vehicle of selected Dates"');
|
|
}
|
|
else {
|
|
|
|
$("#tblwabco").show();
|
|
|
|
$("#tbldtcdata").append(htmldtcdata);
|
|
$("#divDTCDta").show();
|
|
$("#tblvolvo").hide();
|
|
|
|
}
|
|
}
|
|
});
|
|
|
|
}
|
|
function onclickLabelDtcData() {
|
|
//GetDtcData();
|
|
$('#dateTable').show();
|
|
$('#divDTCDta').show();
|
|
$('#labelRoute').removeClass("toolBtnActive");
|
|
$('#labelFeedback').removeClass("toolBtnActive");
|
|
//divDTCDta$('#labelActivity').removeClass("toolBtnActive");
|
|
$('#labelDTCData').addClass("toolBtnActive");
|
|
$("#divDTCDta").css('display', 'inline-block');
|
|
$("#divDTCDta").addClass("withtoolbar");
|
|
$("#divFeedback").hide();
|
|
var ticketid = $("#tableTicketHistory > tbody > tr")[0].id;
|
|
DTCReportBYId(ticketid)
|
|
|
|
}
|
|
//on click of label Activities
|
|
function GetDtcData(){
|
|
var x = new Date();
|
|
x.setDate(x.getDate());
|
|
x.setMonth(x.getMonth() - 1);
|
|
var lastDate = new Date();
|
|
lastDate.setDate(lastDate.getDate() - 1);//any date you want
|
|
// alert(lastDate);
|
|
var y = new Date();
|
|
$("#monthpickerFrom").kendoDatePicker({
|
|
|
|
min: x,
|
|
max: y,
|
|
format: "dd MMM yyyy"
|
|
});
|
|
$("#monthpickerTo").kendoDatePicker({
|
|
|
|
min: x,
|
|
max: y,
|
|
format: "dd MMM yyyy"
|
|
});
|
|
|
|
$("#dvError").html('');
|
|
$("#tbldtcdata").html('');
|
|
//$('#dateTable').show();
|
|
var htmldtcdata = "";
|
|
// $('#labelRoute').removeClass("toolBtnActive");
|
|
// $('#labelFeedback').removeClass("toolBtnActive");
|
|
// // $('#labelActivity').removeClass("toolBtnActive");
|
|
// $('#labelDTCData').addClass("toolBtnActive");
|
|
//var chassisno = "MC2BCPRF0KH062819";//
|
|
// var chassisno = $("#vehiclechassisnumber").html();
|
|
var chassisno = $("#hdnchassisno").val();// $("#vehiclechassisnumber").html();
|
|
|
|
var startdate = $("#monthpickerFrom").val();
|
|
var enddate = $("#monthpickerTo").val();
|
|
var apiUrl = url + "Api/DTCData?dtcDta=" + chassisno + "";
|
|
|
|
$.ajax({
|
|
url: apiUrl,
|
|
type: 'GET',
|
|
dataType: 'json',
|
|
success: function (data, textStatus, xhr) {
|
|
|
|
$('#hdndtcdevicetype').val(data);
|
|
if (data == "volvo") {
|
|
var apiUrl = url + "Api/DTCData?devicetype=" + data + "&chassisnumber=" + chassisno + "&startdate=" + startdate + "&enddate=" + enddate + "";
|
|
$.ajax({
|
|
url: apiUrl,
|
|
type: 'GET',
|
|
dataType: 'json',
|
|
success: function (data, textStatus, xhr) {
|
|
|
|
for (keyVar in data) {
|
|
if (data.hasOwnProperty(keyVar)) {
|
|
// htmldtcdata += "<tr><td>" + data[keyVar].chassisid + "</td>";
|
|
// htmldtcdata += "<td>" + data[keyVar].emissionNorms + "</td>";
|
|
// htmldtcdata += "<td>" + data[keyVar].segment + "</td>";
|
|
//htmldtcdata += "<td>" + data[keyVar].engineNo + "</td>";
|
|
// htmldtcdata += "<td>" + data[keyVar].model + "</td>";
|
|
// htmldtcdata += "<td>" + data[keyVar].chassisid + "</td>";
|
|
htmldtcdata += "<tr><td>" + data[keyVar].dtccode + "</td>";
|
|
// htmldtcdata += "<td>" + data[keyVar].dtcStatus + "</td>";
|
|
htmldtcdata += "<td>" + data[keyVar].description + "</td>";
|
|
htmldtcdata += "<td>" + data[keyVar].occuranceCount + "</td>";
|
|
htmldtcdata += "<td>" + data[keyVar].firstFailureTime + "</td>";
|
|
htmldtcdata += "<td>" + data[keyVar].lastFailureTime + "</td>";
|
|
htmldtcdata += "<td>" + data[keyVar].dtcStatus + "</td></tr>";
|
|
// htmldtcdata += "<td>" + data[keyVar].mainSoftware + "</td>";
|
|
// htmldtcdata += "<td>" + data[keyVar].packetDateTime + "</td></tr>";
|
|
}
|
|
|
|
}
|
|
if (htmldtcdata == '') {
|
|
|
|
$("#dvError").html('"No DTC Data available for this Vehicle of selected Dates"');
|
|
}
|
|
else {
|
|
$("#tblvolvo").show();
|
|
$("#tblwabco").hide();
|
|
//console.log(htmldtcdata);
|
|
$("#tbldtcdata").append(htmldtcdata);
|
|
}
|
|
|
|
|
|
},
|
|
error: function (xhr, textStatus, errorThrown) {
|
|
|
|
$("#dvError").html('Please try again later');
|
|
}
|
|
});
|
|
}
|
|
else {
|
|
|
|
var apiUrlwebco = url + "Api/DTCData?devicetype=" + data + "&chassisnumber=" + chassisno + "&startdate=" + startdate + "&enddate=" + enddate + "&iswabco=true";
|
|
|
|
$.ajax({
|
|
url: apiUrlwebco,
|
|
type: 'GET',
|
|
dataType: 'json',
|
|
success: function (data, textStatus, xhr) {
|
|
|
|
for (keyVar in data) {
|
|
if (data.hasOwnProperty(keyVar)) {
|
|
// htmldtcdata += "<tr><td>" + data[keyVar].chassisNo + "</td>";
|
|
// htmldtcdata += "<td>" + data[keyVar].emissionNorms + "</td>";
|
|
// htmldtcdata += "<td>" + data[keyVar].segment + "</td>";
|
|
//htmldtcdata += "<td>" + data[keyVar].engineNo + "</td>";
|
|
// htmldtcdata += "<td>" + data[keyVar].model + "</td>";
|
|
// htmldtcdata += "<td>" + data[keyVar].chassisid + "</td>";
|
|
// htmldtcdata += "<td>" + data[keyVar].deviceID + "</td>";
|
|
// htmldtcdata += "<td>" + data[keyVar].occuranceCount + "</td>";
|
|
// htmldtcdata += "<td>" + data[keyVar].spn + "</td>";
|
|
htmldtcdata += "<tr><td>" + data[keyVar].dtccode + "</td>";
|
|
htmldtcdata += "<td>" + data[keyVar].description + "</td>";
|
|
htmldtcdata += "<td>" + data[keyVar].occuranceCount + "</td>";
|
|
htmldtcdata += "<td>" + data[keyVar].dtcOccuranceDate + "</td>";
|
|
/// htmldtcdata += "<td>" + data[keyVar].caseNumber + "</td>";
|
|
htmldtcdata += "<td>" + data[keyVar].dtcStatus + "</td></tr>";
|
|
// htmldtcdata += "<td>" + data[keyVar].packetDateTime + "</td></tr>";
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (htmldtcdata == '') {
|
|
|
|
$("#dvError").html('"No DTC Data available for this Vehicle of selected Dates"');
|
|
}
|
|
else {
|
|
$("#tblvolvo").hide();
|
|
$("#tblwabco").show();
|
|
//console.log(htmldtcdata);
|
|
$("#tbldtcdata").append(htmldtcdata);
|
|
}
|
|
|
|
},
|
|
error: function (xhr, textStatus, errorThrown) {
|
|
|
|
$("#dvError").html('Please try again later');
|
|
}
|
|
});
|
|
}
|
|
},
|
|
error: function (xhr, textStatus, errorThrown) {
|
|
$("#dvError").html('Please try again later');
|
|
}
|
|
});
|
|
|
|
|
|
// $("#divDTCDta").css('display', 'inline-block');
|
|
|
|
// $("#divDTCDta").addClass("withtoolbar");
|
|
|
|
// $("#divFeedback").hide();
|
|
|
|
}
|
|
|
|
function dateconvert(dateval) {
|
|
|
|
var d = new Date(dateval);
|
|
var day = d.getDate();
|
|
var month = d.getMonth() + 1;
|
|
var year = d.getFullYear();
|
|
if (month == 1 || month == 01) {
|
|
month = "Jan";
|
|
|
|
}
|
|
if (month == 2 || month == 02) {
|
|
month = "Feb";
|
|
|
|
}
|
|
if (month == 3 || month == 03) {
|
|
month = "Mar";
|
|
|
|
}
|
|
|
|
if (month == 4 || month == 04) {
|
|
month = "Apr";
|
|
|
|
}
|
|
if (month == 5 || month == 05) {
|
|
month = "May";
|
|
|
|
}
|
|
if (month == 6 || month == 06) {
|
|
month = "Jun";
|
|
|
|
}
|
|
if (month == 7 || month == 07) {
|
|
month = "Jul";
|
|
|
|
}
|
|
if (month == 8 || month == 08) {
|
|
month = "Aug";
|
|
|
|
}
|
|
if (month == 9 || month == 09) {
|
|
month = "Sep";
|
|
|
|
}
|
|
if (month == 10) {
|
|
month = "Oct";
|
|
|
|
}
|
|
if (month == 11) {
|
|
month = "Nov";
|
|
|
|
}
|
|
if (month == 12) {
|
|
month = "Dec";
|
|
|
|
}
|
|
if (day < 10) {
|
|
day = "0" + day;
|
|
}
|
|
if (month < 10) {
|
|
month = "0" + month;
|
|
}
|
|
var date = day + " " + month + " " + year;
|
|
|
|
return date
|
|
}
|
|
function getPaymentDetailscount(ticketId) {
|
|
//alert(ticketId);
|
|
tidval = ticketId;
|
|
$('#listpaymentdetais').show(); sumpayment = 0; rowcount = 0;
|
|
var apiUrl = url + "Api/PaymentDetails?getDetails=yes";
|
|
$.ajax({
|
|
url: apiUrl,
|
|
type: 'POST',
|
|
data: { Token: "teramatrix", TicketId: ticketId },
|
|
success: function (data) {
|
|
|
|
if (data) {
|
|
|
|
for (var counter = 0; counter < data.length; counter++) {
|
|
sumpayment += Number(data[counter].Amount);
|
|
rowcount = rowcount + 1;
|
|
}
|
|
}
|
|
|
|
if (sumpayment == 0) {
|
|
$("#spncount").html(rowcount);
|
|
$('#listpaymentdetais').hide();
|
|
// $('#btndownload').hide();
|
|
}
|
|
else {
|
|
$("#spncount").html(rowcount);
|
|
// $('#btndownload').show();
|
|
|
|
}
|
|
// var usrrole = $("#UserRole").val();
|
|
// if( usrrole
|
|
// if (sumpayment == 0) {
|
|
// $("#spncount").html(rowcount)
|
|
|
|
|
|
// // $('#listpaymentdetais').hide();
|
|
// }
|
|
// else {
|
|
// // alert(rowcount);
|
|
// $("#spncount").html(rowcount);
|
|
|
|
// }
|
|
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
var tidval = "";
|
|
var ticketid_aliasPayment="";
|
|
function getPaymentDetails() {
|
|
sum = 0;
|
|
$('#divAddPaymentDeatils').hide();
|
|
$('#labelActivity').removeClass("toolBtnActive");
|
|
$('#labelRoute').removeClass("toolBtnActive");
|
|
$('#labelFeedback').removeClass("toolBtnActive");
|
|
$('#labelpayment').addClass("toolBtnActive");
|
|
$("#tblpaymentdata").html('');
|
|
$('#divPaymentDeatils').show();
|
|
$('#divActivity').hide();
|
|
|
|
$("#tblpayment").show();
|
|
$("#dvError").html('');
|
|
var ticketStatus = document.getElementById(tidval).getAttribute('data-ticketStatus');
|
|
// alert(ticketStatus);
|
|
var htmldtcdata = "";
|
|
var payment_date = "";
|
|
|
|
var apiUrl = url + "Api/PaymentDetails?getDetails=yes";
|
|
$.ajax({
|
|
url: apiUrl,
|
|
type: 'POST',
|
|
data: { Token: "teramatrix", TicketId: tidval },
|
|
success: function (data) {
|
|
|
|
if (data) {
|
|
|
|
for (var counter = 0; counter < data.length; counter++) {
|
|
// alert(data[counter].TimeAlias);
|
|
htmldtcdata += "<tr class=\"trData\"><td>" + data[counter].DateAlias + "</td>";
|
|
htmldtcdata += "<td>" + data[counter].TimeAlias + "</td>";
|
|
htmldtcdata += "<td>" + data[counter].CustomerName + "</td>";
|
|
htmldtcdata += "<td>" + data[counter].CustomerMobileNumber + "</td>";
|
|
htmldtcdata += "<td>" + data[counter].Amount + "</td>";
|
|
htmldtcdata += "<td>" + data[counter].ModeOfPayment + "</td>";
|
|
htmldtcdata += "<td>" + data[counter].remarks + "</td>";
|
|
htmldtcdata += "<td>" + data[counter].Created_By_type + "</td></tr>";
|
|
ticketid_aliasPayment = data[counter].TicketId_Alias;
|
|
if (data[counter].remarks == null) {
|
|
data[counter].remarks = "-";
|
|
}
|
|
|
|
sum += Number(data[counter].Amount);
|
|
//payment_date=data[counter].payment_date;
|
|
|
|
}
|
|
if(ticketStatus.toLowerCase()=='closed'){
|
|
$("#divFeedback").hide();
|
|
|
|
|
|
$("#tblpayment").show();
|
|
}
|
|
else{
|
|
$("#tblpayment").show();
|
|
}
|
|
getPaymentDetailscount(tidval);
|
|
// alert(sum);
|
|
$("#spnamount").html(sum);
|
|
$("#spntid").html(ticketid_aliasPayment);
|
|
|
|
}
|
|
|
|
|
|
if (htmldtcdata == '') {
|
|
|
|
$("#tblpayment").hide();
|
|
$("#dvError").html('"No payment details available for this ticket"');
|
|
}
|
|
else {
|
|
$("#tblpaymentdata").append(htmldtcdata);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
|