509 lines
20 KiB
HTML
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 & Pankaj Khandal
|
|
+
|
|
+================================================================================================================*/
|
|
|
|
|
|
|
|
/**
|
|
* For live monitoring and history tracking of users in outside field using GPS locator.
|
|
* @module TrackingModule
|
|
*/
|
|
|
|
// Global variables
|
|
var ccplMap = null, markerImagePath = "../../Scripts/map_api/icons/red_blank.png", markerTransImgPath = "../../Scripts/map_api/icons/red_blink.gif", 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: 'googleMap', mapDiv: document.getElementById("divMapContainer"), zoom: 12, centerLatitude: 26.912285124827, centerLongitude: 75.7873203125, mapType: 'ROADMAP' }
|
|
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 && currObj) {
|
|
// currRow.parent().find('.activeRow').removeClass('activeRow');
|
|
// currRow.addClass('activeRow');
|
|
// var jsonObj = { latitude: currRow.attr('lat'), longitude: currRow.attr('lng'), recordTime: currRow.attr('time'), distance: currRow.attr('dist') };
|
|
// ccplMap.infoOpen(jsonObj);
|
|
// }
|
|
//}
|
|
|
|
/*===================================================End=====================================================*/
|
|
|
|
/*===============================================Device RESTful API===================================*/
|
|
/**
|
|
* Creating a Model for showing data on Live Tracking page. (Dynamic UI)
|
|
* @class HistoryTracking
|
|
* @constructor
|
|
*/
|
|
function HistoryTrackingModel() {
|
|
'use strict';
|
|
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("1");
|
|
SecurityToken = securityToken;
|
|
utcMinutes = UtcMinutes;
|
|
UserId = userId;
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
//url: "http://192.168.1.97:666/Api/Tracking?Tracking=tt",
|
|
url: WCFRESTURL.GetUsersListWithCurrentTrackingData,
|
|
data: { Token: SecurityToken, UtcMinute: utcMinutes, UserId: UserId, DealerNameParam: 'All', VanCityParam: 'All', VanStateParam: 'All' },
|
|
dataType: "json",
|
|
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);
|
|
$("#tableDevices tbody tr td:first").trigger('click');
|
|
}
|
|
},
|
|
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 = $("#txtDate").val();
|
|
var startTime = $("#txtStartTime").val();
|
|
var endTime = $("#txtEndTime").val();
|
|
|
|
var splitDate = date.split(" ");
|
|
var year = splitDate[2];
|
|
var month = splitDate[1];
|
|
var day = splitDate[0];
|
|
|
|
var dateTo = $("#txtDateTo").val();
|
|
var splitDateTo = dateTo.split(" ");
|
|
var yearTo = splitDateTo[2];
|
|
var monthTo = splitDateTo[1];
|
|
var dayTo = splitDateTo[0];
|
|
|
|
var FromDate, EndDate;
|
|
FromDate = day + "-" + month + "-" + year + " " + startTime;
|
|
EndDate = dayTo + "-" + monthTo + "-" + yearTo + " " + endTime;
|
|
//console.log(FromDate, EndDate);
|
|
removeAllPath();
|
|
var currtime = getCurrentTime();
|
|
//console.log(FromDate, EndDate);
|
|
$.ajax({
|
|
type: "POST",
|
|
url: WCFRESTURL.GetTrackingHistoryUserWise,
|
|
data: { Token: SecurityToken, UtcMinute: utcMinutes, DeviceAlias: employee.ServiceEngineerDeviceAlias, FromDate: FromDate, ToDate: EndDate },
|
|
dataType: 'json',
|
|
success: function (data) {
|
|
|
|
if (data) {
|
|
for (var count = 0; count < data.length; count++) {
|
|
//data.color = "";
|
|
data[count].destinationImage = "../../Scripts/map_api/icons/red_d.png";
|
|
data[count].imgCircle = "../../Scripts/map_api/icons/red_circle.png";
|
|
data[count].sourceImage = "../../Scripts/map_api/icons/red_s.png";
|
|
}
|
|
|
|
// console.log(data);
|
|
setMapPath(data);
|
|
}
|
|
},
|
|
error: function (data) {
|
|
console.log("error");
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Function used to show device history on map.
|
|
* @method showEmployeeHistory
|
|
* @for HistoryTracking
|
|
*/
|
|
self.showEmployeeHistory = function () {
|
|
var devId = $(".activeListTr").attr('id');
|
|
var date = $("#txtDate").val();
|
|
var startTime = $("#txtStartTime").val();
|
|
var endTime = $("#txtEndTime").val();
|
|
|
|
var splitDate = date.split(" ");
|
|
var year = splitDate[2];
|
|
var month = splitDate[1];
|
|
var day = splitDate[0];
|
|
|
|
var dateTo = $("#txtDateTo").val();
|
|
var splitDateTo = dateTo.split(" ");
|
|
var yearTo = splitDateTo[2];
|
|
var monthTo = splitDateTo[1];
|
|
var dayTo = splitDateTo[0];
|
|
|
|
var FromDate, EndDate;
|
|
FromDate = day + "-" + month + "-" + year + " " + startTime;
|
|
EndDate = dayTo + "-" + monthTo + "-" + yearTo + " " + endTime;
|
|
//console.log(FromDate, EndDate);
|
|
|
|
removeAllPath();
|
|
var currtime = getCurrentTime();
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: WCFRESTURL.GetTrackingHistoryUserWise,
|
|
data: { Token: SecurityToken, UtcMinute: utcMinutes, DeviceAlias: self.chosenEmployee().ServiceEngineerDeviceAlias, FromDate: FromDate, ToDate: EndDate },
|
|
dataType: 'json',
|
|
success: function (data) {
|
|
//console.log(data);
|
|
if (data) {
|
|
var dataLength = data.length;
|
|
for (var count = 0; count < dataLength; count++) {
|
|
//data[count].color = $.getJSON("/Tracking/GetPathColorCode/", { index: dataLength }, function (data) { if (data.success) { data.result; } });
|
|
data[count].destinationImage = "../../Scripts/map_api/icons/red_d.png";
|
|
data[count].imgCircle = "../../Scripts/map_api/icons/red_circle.png";
|
|
data[count].sourceImage = "../../Scripts/map_api/icons/red_s.png";
|
|
}
|
|
|
|
//console.log(data);
|
|
setMapPath(data);
|
|
}
|
|
},
|
|
error: function (data) {
|
|
console.log("error");
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
// 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 = $('#tableDevices tbody tr');
|
|
var jThis;
|
|
if (keyCode != 8 && keyCode != 46) {
|
|
$rows.each(function () {
|
|
jThis = $(this);
|
|
if (jThis.is(':visible')) {
|
|
var oLabel = jThis.find('label').text();
|
|
if (oLabel.length > 0) {
|
|
if (oLabel.toLowerCase().indexOf(sValue.toLowerCase()) >= 0) {
|
|
jThis.show();
|
|
} else {
|
|
jThis.hide();
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
else {
|
|
$rows.each(function () {
|
|
jThis = $(this);
|
|
var oLabel = jThis.find('label').text();
|
|
if (oLabel.length > 0) {
|
|
if (oLabel.toLowerCase().indexOf(sValue.toLowerCase()) >= 0) {
|
|
jThis.show();
|
|
} else {
|
|
jThis.hide();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
/**
|
|
* Bind textbox keyup event for searching.
|
|
* @event keyup
|
|
* @for HistoryTracking
|
|
*/
|
|
$('#txtSearch').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>
|