EOS/Scripts/out/files/Report_reportTicketDetails.js.html
Nidhi Bhargava f0c1ab20e1 code push
2025-09-04 16:25:07 +05:30

680 lines
26 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Report\reportTicketDetails.js</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
<script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<h1><img src="../assets/css/logo.png" title=""></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: </em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="../classes/CallFeedbackRating.html">CallFeedbackRating</a></li>
<li><a href="../classes/CloseTicketReport.html">CloseTicketReport</a></li>
<li><a href="../classes/ConsolidatedReport.html">ConsolidatedReport</a></li>
<li><a href="../classes/CustomerReport.html">CustomerReport</a></li>
<li><a href="../classes/DealerWiseCallDetails.html">DealerWiseCallDetails</a></li>
<li><a href="../classes/DeclinedCalls.html">DeclinedCalls</a></li>
<li><a href="../classes/DropDownData.html">DropDownData</a></li>
<li><a href="../classes/EicherPromise.html">EicherPromise</a></li>
<li><a href="../classes/EosCallCount.html">EosCallCount</a></li>
<li><a href="../classes/GeoAnalysis.html">GeoAnalysis</a></li>
<li><a href="../classes/HdBusLmdContrCallFeedbackRatingibution.html">HdBusLmdContrCallFeedbackRatingibution</a></li>
<li><a href="../classes/HdBusLmdContribution.html">HdBusLmdContribution</a></li>
<li><a href="../classes/HistoryTracking.html">HistoryTracking</a></li>
<li><a href="../classes/LiveTracking.html">LiveTracking</a></li>
<li><a href="../classes/ManageEscalation.html">ManageEscalation</a></li>
<li><a href="../classes/ManageFleet.html">ManageFleet</a></li>
<li><a href="../classes/ManageFleet_Detail.html">ManageFleet_Detail</a></li>
<li><a href="../classes/ManageFleet_details.html">ManageFleet_details</a></li>
<li><a href="../classes/ManageOwner.html">ManageOwner</a></li>
<li><a href="../classes/ManageReason.html">ManageReason</a></li>
<li><a href="../classes/ManageVechile.html">ManageVechile</a></li>
<li><a href="../classes/ManageVehicle.html">ManageVehicle</a></li>
<li><a href="../classes/NonVecvUserManagement.html">NonVecvUserManagement</a></li>
<li><a href="../classes/Notifications.html">Notifications</a></li>
<li><a href="../classes/OpenTicketReport.html">OpenTicketReport</a></li>
<li><a href="../classes/OrganizationChart.html">OrganizationChart</a></li>
<li><a href="../classes/PositioningTool.html">PositioningTool</a></li>
<li><a href="../classes/PositioningTool_Report.html">PositioningTool_Report</a></li>
<li><a href="../classes/ReasonForClosure.html">ReasonForClosure</a></li>
<li><a href="../classes/Report.html">Report</a></li>
<li><a href="../classes/ShowDealerMap.html">ShowDealerMap</a></li>
<li><a href="../classes/TicketAdministration.html">TicketAdministration</a></li>
<li><a href="../classes/TicketAdministration_FullDetail.html">TicketAdministration_FullDetail</a></li>
<li><a href="../classes/TicketFeedback.html">TicketFeedback</a></li>
<li><a href="../classes/TicketForDealer.html">TicketForDealer</a></li>
<li><a href="../classes/TicketForDealer_FullDetails.html">TicketForDealer_FullDetails</a></li>
<li><a href="../classes/TicketReassign.html">TicketReassign</a></li>
<li><a href="../classes/TileDashboard.html">TileDashboard</a></li>
<li><a href="../classes/TimeSlotClosure.html">TimeSlotClosure</a></li>
<li><a href="../classes/TollFreeAndOpportunityLoss.html">TollFreeAndOpportunityLoss</a></li>
<li><a href="../classes/VanCoverageDesigner.html">VanCoverageDesigner</a></li>
<li><a href="../classes/VecvUserManagement.html">VecvUserManagement</a></li>
</ul>
<ul id="api-modules" class="apis modules">
<li><a href="../modules/Dashboard.html">Dashboard</a></li>
<li><a href="../modules/DropDownData.html">DropDownData</a></li>
<li><a href="../modules/Geo.html">Geo</a></li>
<li><a href="../modules/Inventory.html">Inventory</a></li>
<li><a href="../modules/Notifications.html">Notifications</a></li>
<li><a href="../modules/ReportModule.html">ReportModule</a></li>
<li><a href="../modules/Ticket.html">Ticket</a></li>
<li><a href="../modules/TrackingModule.html">TrackingModule</a></li>
<li><a href="../modules/UserManagement.html">UserManagement</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1 class="file-heading">File: Report\reportTicketDetails.js</h1>
<div class="file">
<pre class="code prettyprint linenums">
/*================================================================================================================\
+
+ 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 &amp; Close)
* @class Report
* @constructor
*/
//Global variables
var ccplMap = null,
geoCoder,
defaultLat = 26.912285124827,
defaultLng = 75.7873203125;
var displayDisplay = &quot;&quot;; //route direction display
var routeDirectionsService = new google.maps.DirectionsService(); //direction google map api
//initialize markers
var sourceMarker = &#x27;../../Scripts/map_api/icons/red_s.png&#x27;; //marker for source
var destinationMarker = &#x27;../../Scripts/map_api/icons/red_d.png&#x27;; //marker for destination
var ticketDetailsMarkerArray = []; //array of source and destination markers
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
//========================================== 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() {
//on click of label route
$(&quot;#labelRoute&quot;).click(function () {
//console.log(&quot;label route&quot;);
// add selected class
$(&#x27;#labelActivity&#x27;).removeClass(&quot;toolBtnActive&quot;);
$(&#x27;#labelRoute&#x27;).addClass(&quot;toolBtnActive&quot;);
$(&#x27;#labelFeedback&#x27;).removeClass(&quot;toolBtnActive&quot;);
$(&quot;#divMapContainer&quot;).show();
$(&quot;#divActivity&quot;).hide();
$(&quot;#divFeedback&quot;).hide();
});
}
/**
* Function call on click of Activity label to show ticket activity
* @method onclickLabelActivity
* @for Report
*/
function onclickLabelActivity() {
//on click of label Activitys
$(&quot;#labelActivity&quot;).click(function () {
console.log(&quot;activity&quot;);
// add selected class
$(&#x27;#labelRoute&#x27;).removeClass(&quot;toolBtnActive&quot;);
$(&#x27;#labelActivity&#x27;).addClass(&quot;toolBtnActive&quot;);
$(&#x27;#labelFeedback&#x27;).removeClass(&quot;toolBtnActive&quot;);
$(&quot;#divActivity&quot;).show();
$(&quot;#divActivity&quot;).addClass(&quot;withtoolbar&quot;);
$(&quot;#divMapContainer&quot;).hide();
$(&quot;#divFeedback&quot;).hide();
var ticketId = $(&quot;#tableTicketHistory &gt; tbody &gt; tr&quot;)[0].id;
var ticketStatus = document.getElementById(ticketId).getAttribute(&#x27;data-ticketStatus&#x27;);
if (ticketStatus.toLowerCase() == &#x27;closed&#x27; || ticketStatus.toLowerCase() == &#x27;opportunity lost&#x27;) {
ticketStatus = &#x27;close&#x27;;
} else { ticketStatus = &#x27;open&#x27;; }
$.ajax({
type: &quot;POST&quot;,
url: &quot;/Report/Ticket_GetOpencloseTicketActivities/&quot;,
data: { ticketId: ticketId, ticketStatus: ticketStatus },
success: function (data) {
if (data) {
$(&quot;#divActivity&quot;).html(&#x27;&#x27;);
$(&quot;#divActivity&quot;).html(data);
}
},
error: function () { }
});
});
}
/**
* Function call on click of Route label to show map
* @method onclickLabelRoute
* @for TicketAdministration
*/
function onclickLabelFeedback() {
//on click of label route
$(&quot;#labelFeedback&quot;).click(function () {
var selectTicketId;
var ticketCreationTime, isMoreThan24Hrs, isFeedBackDetails;
// add selected class
$(&#x27;#labelActivity&#x27;).removeClass(&quot;toolBtnActive&quot;);
$(&#x27;#labelRoute&#x27;).removeClass(&quot;toolBtnActive&quot;);
$(&#x27;#labelFeedback&#x27;).addClass(&quot;toolBtnActive&quot;);
$(&quot;#divFeedback&quot;).show();
$(&quot;#divFeedback&quot;).addClass(&quot;withtoolbar&quot;);
$(&quot;#divMapContainer&quot;).hide();
$(&quot;#divActivity&quot;).css(&#x27;display&#x27;, &#x27;none&#x27;);
showFeedback();
});
}
/**
* Function call on click of feedback label to show feedback form
* @method showFeedback
* @for TicketAdministration
*/
function showFeedback() {
var selectTicketId;
var ticketCreationTime, isMoreThan24Hrs, isFeedBackDetails;
if ($(&quot;#tableTicketHistory &gt; tbody &gt; tr&quot;)[0] != undefined) {
selectTicketId = $(&quot;#tableTicketHistory &gt; tbody &gt; tr&quot;)[0].id;
ticketCreationTime = document.getElementById(selectTicketId).getAttribute(&#x27;data-ticketCreationTime&#x27;);
isMoreThan24Hrs = document.getElementById(selectTicketId).getAttribute(&#x27;data-reason24Hrs&#x27;);
//isFeedBackDetails = document.getElementById(selectTicketId).getAttribute(&#x27;data-isFeedback&#x27;);
}
console.log(selectTicketId);
$.ajax({
type: &quot;POST&quot;,
url: &quot;/Report/Ticket_Feedback/&quot;,
data: { selectTicketId: selectTicketId, ticketCreationTime: ticketCreationTime, isMoreThan24Hrs: isMoreThan24Hrs },
success: function (data) {
if (data) {
$(&quot;#divFeedback&quot;).html(data);
}
},
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&#x27;s breakdown
* @for Report
*/
function getVanBreakdownLocation(vanDealerLocation, breakdownLocation) {
//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, sourceMarker, 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 &lt; 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: &quot;#1b3f94&quot; }
}
displayDisplay = new google.maps.DirectionsRenderer(rendererOptions);
//if (tick.vehicle_latitude &amp;&amp; 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({ &#x27;latLng&#x27;: 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(&#x27;No results found&#x27;);
}
}
//return false
return false;
});
}
//====================================== end of GeoCoding Functions============================================//
/**
* 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 = $(&quot;#CustomerContactNo&quot;).val();
//Get vehicle registration no.
var vRegNo = $(&quot;#VehicleRegistrationNo&quot;).val();
//On expand of driver details div
if ((expandDivId.toLowerCase()).indexOf(&#x27;driver&#x27;) !== -1) {
if (countDriverExpand == 0) {
$(&quot;#tableDriverDetails&quot;).css(&#x27;visibility&#x27;, &#x27;hidden&#x27;);
$(&quot;#loadingDriverDetails&quot;).show();
countDriverExpand = countDriverExpand + 1;
//call web api to get driver details
$.ajax({
type: &quot;POST&quot;,
url: &quot;/Report/Ticket_GetOpencloseTicketDriverDetails/&quot;,
data: { CustomerContactNo: customerContactNo, VRegistrationNo: vRegNo },
success: function (data) {
//console.log(data.list[0].CustomerName);
if (data.list.length &gt; 0) {
for (var count = 0; count &lt; data.list.length; count++) {
$(&quot;#customerName&quot;).text(data.list[count].CustomerName);
$(&quot;#customerContactNo&quot;).text(data.list[count].CustomerMobile1);
}
}
},
complete: function () {
$(&quot;#tableDriverDetails&quot;).css(&#x27;visibility&#x27;, &#x27;visible&#x27;);
$(&quot;#loadingDriverDetails&quot;).hide();
},
error: function (data) {
}
});
}
}
//On expand of owner details div
else if ((expandDivId.toLowerCase()).indexOf(&#x27;owner&#x27;) !== -1) {
if (countOwnerExpand == 0) {
$(&quot;#tableOwnerDetails&quot;).css(&#x27;visibility&#x27;, &#x27;hidden&#x27;);
$(&quot;#loadingOwnerDetails&quot;).show();
countOwnerExpand = countOwnerExpand + 1;
//call web api to get owner details
$.ajax({
type: &quot;POST&quot;,
url: &quot;/Report/Ticket_GetOpencloseTicketOwnerDetails/&quot;,
data: { VRegistrationNo: vRegNo },
success: function (data) {
console.log(data.list);
if (data.list.length &gt; 0) {
for (var count = 0; count &lt; data.list.length; count++) {
$(&quot;#ownerName&quot;).text(data.list[count].CustomerCustomerName);
$(&quot;#ownerContact&quot;).text(data.list[count].CustomerMobileNumber1);
$(&quot;#ownerState&quot;).text(data.list[count].CustomerState);
}
}
},
complete: function () {
$(&quot;#tableOwnerDetails&quot;).css(&#x27;visibility&#x27;, &#x27;visible&#x27;);
$(&quot;#loadingOwnerDetails&quot;).hide();
},
error: function (data) {
}
});
}
}
//On expand of vehicle details div
else if ((expandDivId.toLowerCase()).indexOf(&#x27;vehicle&#x27;) !== -1) {
if (countVehicleExpand == 0) {
$(&quot;#tableVehicleDetails&quot;).css(&#x27;visibility&#x27;, &#x27;hidden&#x27;);
$(&quot;#loadingVehicleDetails&quot;).show();
countVehicleExpand = countVehicleExpand + 1;
//call web api to get vehicle details
$.ajax({
type: &quot;POST&quot;,
url: &quot;/Report/Ticket_GetOpencloseTicketVehicleDetails/&quot;,
data: { VRegistrationNo: vRegNo },
success: function (data) {
console.log(data.list, data.vehicleModelTagging);
if (data.list.length &gt; 0) {
for (var count = 0; count &lt; data.list.length; count++) {
$(&quot;#vehicleRegistration&quot;).text(data.list[count].RegistrationNo);
$(&quot;#vehicleModelNo&quot;).text(data.list[count].ModelNumber);
data.list[count].VehicleInstallationDate == null ? $(&quot;#vehicleInstallationDate&quot;).text(&#x27;&#x27;) : $(&quot;#vehicleInstallationDate&quot;).text(data.list[count].VehicleInstallationDate);
}
$(&quot;#vehicleProductVariant&quot;).text(data.vehicleModelTagging);
}
},
complete: function () {
$(&quot;#tableVehicleDetails&quot;).css(&#x27;visibility&#x27;, &#x27;visible&#x27;);
$(&quot;#loadingVehicleDetails&quot;).hide();
},
error: function (data) {
}
});
}
}
}
//======================== document ready function ================//
$(document).ready(function () {
$(&quot;#loadingTicketDetails&quot;).hide();
$(&quot;#loadingDriverDetails&quot;).hide();
$(&quot;#loadingOwnerDetails&quot;).hide();
$(&quot;#loadingVehicleDetails&quot;).hide();
$(&quot;#loadingVanDetails&quot;).hide();
$(&quot;#loadingDealerDetails&quot;).hide();
if (document.getElementById(&#x27;tableTicketHistory&#x27;).getAttribute(&#x27;data-ticketStatus&#x27;) == &#x27;close&#x27;) {
$(&quot;#listFeedback&quot;).show();
} else { $(&quot;#listFeedback&quot;).hide(); }
setTimeout(function () {
$(&quot;#labelRoute&quot;).trigger(&quot;click&quot;);
initMap(&quot;divMapContainer&quot;);
getVanBreakdownLocation(assignedVanDealerLatLng, _breakdownLocationLatLng);
}, 1000);
var assignedVanDealerLatLng = new google.maps.LatLng($(&quot;#AssignedVanDealerLat&quot;).val(), $(&quot;#AssignedVanDealerLng&quot;).val());
var _breakdownLocationLatLng = new google.maps.LatLng($(&quot;#BreakdownLat&quot;).val(), $(&quot;#BreakdownLng&quot;).val());
});
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>