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

509 lines
20 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Tracking\HistoryTracking.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: Tracking\HistoryTracking.js</h1>
<div class="file">
<pre class="code prettyprint linenums">
/*================================================================================================================\
+
+ Project : GoData-ECom Express
+ Filename : HistoryTracking.js
+ Module Name : Tracking
+ Purpose : For history tracking of users in outside field using GPS locator.
+ Coded By : Jitendra Tiwari &amp; Pankaj Khandal
+
+================================================================================================================*/
/**
* For live monitoring and history tracking of users in outside field using GPS locator.
* @module TrackingModule
*/
// Global variables
var ccplMap = null, markerImagePath = &quot;../../Scripts/map_api/icons/red_blank.png&quot;, markerTransImgPath = &quot;../../Scripts/map_api/icons/red_blink.gif&quot;, defaultLat = 26.912285124827, defaultLng = 75.7873203125;
var SecurityToken, utcMinutes, UserId;
/*================================================Map Function=============================================*/
/**
* Load google map on page.
* @method initMap
* @for HistoryTracking
*/
function initMap() {
var mapOptions = { mapPro: &#x27;googleMap&#x27;, mapDiv: document.getElementById(&quot;divMapContainer&quot;), zoom: 12, centerLatitude: 26.912285124827, centerLongitude: 75.7873203125, mapType: &#x27;ROADMAP&#x27; }
ccplMap = new vtsMap(mapOptions);
}
/**
* Function used to set map location to center.
* @method setMapLocation
* @param {String} lat Latitude
* @param {String} lng Longitude
* @for HistoryTracking
*/
function setMapLocation(lat, lng) { if (ccplMap) { ccplMap.moveMap(lat, lng); } }
/**
* Function used to remove all existing path from map.
* @method removeAllPath
* @for HistoryTracking
*/
function removeAllPath() { if (ccplMap) { ccplMap.removeAllUnitPath(); } }
/**
* Function used to draw path on map.
* @method setMapPath
* @param {Object} jsonObject Required json object for drawing path on map.
* @for HistoryTracking
*/
function setMapPath(jsonObject) {
//console.log(jsonObject);
if (ccplMap) {
ccplMap.drawMultipleUnitPath(jsonObject);
}
}
//function infoOpen(currObj) {
// var currRow = $(currObj);
// if (ccplMap &amp;&amp; currObj) {
// currRow.parent().find(&#x27;.activeRow&#x27;).removeClass(&#x27;activeRow&#x27;);
// currRow.addClass(&#x27;activeRow&#x27;);
// var jsonObj = { latitude: currRow.attr(&#x27;lat&#x27;), longitude: currRow.attr(&#x27;lng&#x27;), recordTime: currRow.attr(&#x27;time&#x27;), distance: currRow.attr(&#x27;dist&#x27;) };
// ccplMap.infoOpen(jsonObj);
// }
//}
/*===================================================End=====================================================*/
/*===============================================Device RESTful API===================================*/
/**
* Creating a Model for showing data on Live Tracking page. (Dynamic UI)
* @class HistoryTracking
* @constructor
*/
function HistoryTrackingModel() {
&#x27;use strict&#x27;;
var self = this;
self.chosenEmployee = ko.observable();
//ViewModel
self.ServiceEngineerContactNumber = ko.observable();
self.ServiceEngineerId = ko.observable();
self.ServiceEngineerName = ko.observable();
self.VanRegistrationNumber = ko.observable();
self.IsConnected = ko.observable();
self.VanId = ko.observable();
self.VanCity = ko.observable();
self.ServiceEngineerImeiNumber = ko.observable();
self.RegionId = ko.observable();
self.OrganizationName = ko.observable();
self.RegionName = ko.observable();
self.employees = ko.observableArray([]);
//self.securityToken = ko.observable();
/**
* Getting all the employees list and populating the html on page.
* @method getAllEmployees
* @for HistoryTracking
*/
self.getAllEmployees = function () {
//console.log(&quot;1&quot;);
SecurityToken = securityToken;
utcMinutes = UtcMinutes;
UserId = userId;
$.ajax({
type: &quot;POST&quot;,
//url: &quot;http://192.168.1.97:666/Api/Tracking?Tracking=tt&quot;,
url: WCFRESTURL.GetUsersListWithCurrentTrackingData,
data: { Token: SecurityToken, UtcMinute: utcMinutes, UserId: UserId, DealerNameParam: &#x27;All&#x27;, VanCityParam: &#x27;All&#x27;, VanStateParam: &#x27;All&#x27; },
dataType: &quot;json&quot;,
success: function (data) {
// console.log(data);
if (data.status == 1) {
var finalEmployeeList = ko.utils.arrayFilter(data.ListUsers, function (item) {
return item.ServiceEngineerId != null;
});
self.employees(finalEmployeeList);
$(&quot;#tableDevices tbody tr td:first&quot;).trigger(&#x27;click&#x27;);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert(textStatus);
}
});
}
/**
* Function used to show device detail on page.
* @method showDeviceDetail
* @param {Object} employee Chosen device object.
* @for HistoryTracking
*/
self.showEmployeeDetail = function (employee) {
self.chosenEmployee(employee).ServiceEngineerId(employee.ServiceEngineerId).ServiceEngineerName(employee.ServiceEngineerName).VanCity(employee.VanCity).ServiceEngineerContactNumber(employee.ServiceEngineerContactNumber).VanRegistrationNumber(employee.VanRegistrationNumber).VanId(employee.VanId).ServiceEngineerImeiNumber(employee.ServiceEngineerImeiNumber).OrganizationName(employee.OrganizationName);
//.EmployeeAddress(employee.EmployeeAddress).EmailId(employee.EmailId);
var date = $(&quot;#txtDate&quot;).val();
var startTime = $(&quot;#txtStartTime&quot;).val();
var endTime = $(&quot;#txtEndTime&quot;).val();
var splitDate = date.split(&quot; &quot;);
var year = splitDate[2];
var month = splitDate[1];
var day = splitDate[0];
var dateTo = $(&quot;#txtDateTo&quot;).val();
var splitDateTo = dateTo.split(&quot; &quot;);
var yearTo = splitDateTo[2];
var monthTo = splitDateTo[1];
var dayTo = splitDateTo[0];
var FromDate, EndDate;
FromDate = day + &quot;-&quot; + month + &quot;-&quot; + year + &quot; &quot; + startTime;
EndDate = dayTo + &quot;-&quot; + monthTo + &quot;-&quot; + yearTo + &quot; &quot; + endTime;
//console.log(FromDate, EndDate);
removeAllPath();
var currtime = getCurrentTime();
//console.log(FromDate, EndDate);
$.ajax({
type: &quot;POST&quot;,
url: WCFRESTURL.GetTrackingHistoryUserWise,
data: { Token: SecurityToken, UtcMinute: utcMinutes, DeviceAlias: employee.ServiceEngineerDeviceAlias, FromDate: FromDate, ToDate: EndDate },
dataType: &#x27;json&#x27;,
success: function (data) {
if (data) {
for (var count = 0; count &lt; data.length; count++) {
//data.color = &quot;&quot;;
data[count].destinationImage = &quot;../../Scripts/map_api/icons/red_d.png&quot;;
data[count].imgCircle = &quot;../../Scripts/map_api/icons/red_circle.png&quot;;
data[count].sourceImage = &quot;../../Scripts/map_api/icons/red_s.png&quot;;
}
// console.log(data);
setMapPath(data);
}
},
error: function (data) {
console.log(&quot;error&quot;);
}
});
}
/**
* Function used to show device history on map.
* @method showEmployeeHistory
* @for HistoryTracking
*/
self.showEmployeeHistory = function () {
var devId = $(&quot;.activeListTr&quot;).attr(&#x27;id&#x27;);
var date = $(&quot;#txtDate&quot;).val();
var startTime = $(&quot;#txtStartTime&quot;).val();
var endTime = $(&quot;#txtEndTime&quot;).val();
var splitDate = date.split(&quot; &quot;);
var year = splitDate[2];
var month = splitDate[1];
var day = splitDate[0];
var dateTo = $(&quot;#txtDateTo&quot;).val();
var splitDateTo = dateTo.split(&quot; &quot;);
var yearTo = splitDateTo[2];
var monthTo = splitDateTo[1];
var dayTo = splitDateTo[0];
var FromDate, EndDate;
FromDate = day + &quot;-&quot; + month + &quot;-&quot; + year + &quot; &quot; + startTime;
EndDate = dayTo + &quot;-&quot; + monthTo + &quot;-&quot; + yearTo + &quot; &quot; + endTime;
//console.log(FromDate, EndDate);
removeAllPath();
var currtime = getCurrentTime();
$.ajax({
type: &quot;POST&quot;,
url: WCFRESTURL.GetTrackingHistoryUserWise,
data: { Token: SecurityToken, UtcMinute: utcMinutes, DeviceAlias: self.chosenEmployee().ServiceEngineerDeviceAlias, FromDate: FromDate, ToDate: EndDate },
dataType: &#x27;json&#x27;,
success: function (data) {
//console.log(data);
if (data) {
var dataLength = data.length;
for (var count = 0; count &lt; dataLength; count++) {
//data[count].color = $.getJSON(&quot;/Tracking/GetPathColorCode/&quot;, { index: dataLength }, function (data) { if (data.success) { data.result; } });
data[count].destinationImage = &quot;../../Scripts/map_api/icons/red_d.png&quot;;
data[count].imgCircle = &quot;../../Scripts/map_api/icons/red_circle.png&quot;;
data[count].sourceImage = &quot;../../Scripts/map_api/icons/red_s.png&quot;;
}
//console.log(data);
setMapPath(data);
}
},
error: function (data) {
console.log(&quot;error&quot;);
}
});
}
// Load all devices.
self.getAllEmployees();
}
/*=====================================================End============================================*/
/*============================================Device Searching=========================================*/
/**
* Function used to trigger row click event.
* @method initSearch
* @param {String} keyCode Input key code.
* @param {String} sValue text to be search.
* @for HistoryTracking
*/
function initSearch(keyCode, sValue) {
var $rows = $(&#x27;#tableDevices tbody tr&#x27;);
var jThis;
if (keyCode != 8 &amp;&amp; keyCode != 46) {
$rows.each(function () {
jThis = $(this);
if (jThis.is(&#x27;:visible&#x27;)) {
var oLabel = jThis.find(&#x27;label&#x27;).text();
if (oLabel.length &gt; 0) {
if (oLabel.toLowerCase().indexOf(sValue.toLowerCase()) &gt;= 0) {
jThis.show();
} else {
jThis.hide();
}
}
}
});
}
else {
$rows.each(function () {
jThis = $(this);
var oLabel = jThis.find(&#x27;label&#x27;).text();
if (oLabel.length &gt; 0) {
if (oLabel.toLowerCase().indexOf(sValue.toLowerCase()) &gt;= 0) {
jThis.show();
} else {
jThis.hide();
}
}
});
}
}
/**
* Bind textbox keyup event for searching.
* @event keyup
* @for HistoryTracking
*/
$(&#x27;#txtSearch&#x27;).keyup(function (event) {
var sValue = $.trim($(this).val());
initSearch(event.keyCode, sValue);
}).keydown(function () { }).focus(function () { $(this).select(); });
/*=================================================End=================================================*/
</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>