752 lines
29 KiB
HTML
752 lines
29 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Tracking\LiveTracking.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\LiveTracking.js</h1>
|
|
|
|
<div class="file">
|
|
<pre class="code prettyprint linenums">
|
|
/*================================================================================================================\
|
|
+
|
|
+ Project : GODATA-VECV
|
|
+ Filename : LiveTracking.js
|
|
+ Module Name : Tracking
|
|
+ Purpose : For live monitoring and 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, UserRole;
|
|
var counter = 0;
|
|
|
|
|
|
/*================================================Map Function=============================================*/
|
|
|
|
/**
|
|
* Load google map on page.
|
|
* @method initMap
|
|
* @param {String} id HTML element id where map is loaded.
|
|
* @for LiveTracking
|
|
*/
|
|
function initMap(id) {
|
|
var mapOptions = { mapPro: 'googleMap', mapDiv: document.getElementById(id), zoom: 10, centerLatitude: defaultLat, centerLongitude: defaultLng, mapType: 'ROADMAP' };
|
|
ccplMap = new vtsMap(mapOptions);
|
|
}
|
|
|
|
/**
|
|
* Function used to add/show multiple devices on map.
|
|
* @method addMultipleDeviceToMap
|
|
* @param {Object} jsonObject Required json object for adding device on map.
|
|
* @for LiveTracking
|
|
*/
|
|
function addMultipleDeviceToMap(jsonObject) {
|
|
//console.log(jsonObject);
|
|
if (ccplMap) { //console.log("add device");
|
|
ccplMap.addMultipleUnit(jsonObject);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Function used to remove all existing markers from map.
|
|
* @method removeAllUnit
|
|
* @for LiveTracking
|
|
*/
|
|
function removeAllUnit() { if (ccplMap) { ccplMap.removeAllUnit(); } }
|
|
|
|
/**
|
|
* Function used to remove a particular path from map based on a ID.
|
|
* @method removeUnit
|
|
* @param {String} unitID ID of a marker
|
|
* @for LiveTracking
|
|
*/
|
|
function removeUnit(unitID) { if (ccplMap) { ccplMap.removeUnit(unitID); } }
|
|
|
|
/**
|
|
* Function used to remove all existing path from map.
|
|
* @method showHiddenUnit
|
|
* @param {Object} unitOptions options for a marker
|
|
* @for LiveTracking
|
|
*/
|
|
function showHiddenUnit(unitOptions) { if (ccplMap) { ccplMap.showHiddenUnit(unitOptions); } }
|
|
|
|
|
|
/**
|
|
* Function used to move device from one location to another on map.
|
|
* @method moveUnitPoints
|
|
* @param {Object} jsonObject Required json object for adding device on map.
|
|
* @for LiveTracking
|
|
*/
|
|
function moveUnitPoints(jsonObject) {
|
|
// console.log(jsonObject);
|
|
if (ccplMap) { ccplMap.moveMultipleUnit(jsonObject, 10); }
|
|
}
|
|
|
|
/**
|
|
* Function used to set device location to center on map.
|
|
* @method setMapLocationCenter
|
|
* @param {String} id DeviceId
|
|
* @for LiveTracking
|
|
*/
|
|
function setMapLocationCenter(id) { if (ccplMap) { ccplMap.setUnitCenter(id); } }
|
|
|
|
/**
|
|
* Function used to dynamically update info window on map.
|
|
* @method updateInfoWindow
|
|
* @param {String} alias Device alias.
|
|
* @param {String} description Updated info description.
|
|
* @for LiveTracking
|
|
*/
|
|
function updateInfoWindow(alias, description) { if (ccplMap) { ccplMap.updateInfoWindow(alias, description); } }
|
|
/*================================================End=============================================*/
|
|
|
|
/*===============================================Device RESTful API===================================*/
|
|
/**
|
|
* Creating a Model for showing data on Live Tracking page. (Dynamic UI)
|
|
* @class LiveTracking
|
|
* @constructor
|
|
*/
|
|
function LiveTrackingModel() {
|
|
'use strict';
|
|
var self = this;
|
|
self.chosenEmployee = ko.observable();
|
|
self.userRole = ko.observable();
|
|
//ViewModel
|
|
self.OrganizationName = ko.observable();
|
|
self.DealerDealerName = ko.observable();
|
|
self.ServiceEngineerContactNumber = ko.observable();
|
|
self.ServiceEngineerId = ko.observable();
|
|
self.ServiceEngineerName = ko.observable();
|
|
self.ServiceEngineerImeiNumber = ko.observable();
|
|
self.IsConnected = ko.observable();
|
|
self.VanRegistrationNumber = ko.observable();
|
|
self.RegionId = ko.observable();
|
|
self.RegionName = ko.observable();
|
|
self.Message = ko.observable();
|
|
self.BatteryStatus = ko.observable();
|
|
self.GpsStatus = ko.observable();
|
|
self.IsCharging = ko.observable();
|
|
|
|
self.employees = ko.observableArray([]);
|
|
|
|
|
|
/**
|
|
* Function used to show device detail on page.
|
|
* @method showDeviceDetail
|
|
* @param {Object} employee Chosen device object.
|
|
* @for LiveTracking
|
|
*/
|
|
self.showEmployeeDetail = function (employee) {
|
|
self.chosenEmployee(employee).ServiceEngineerId(employee.ServiceEngineerId).ServiceEngineerName(employee.ServiceEngineerName).DealerDealerName(employee.DealerDealerName).ServiceEngineerContactNumber(employee.ServiceEngineerContactNumber).ServiceEngineerImeiNumber(employee.ServiceEngineerImeiNumber).VanRegistrationNumber(employee.VanRegistrationNumber).OrganizationName(employee.OrganizationName).Message(employee.Message);
|
|
updateInfoWindow(employee.ServiceEngineerDeviceAlias, $("#divDetails").html());
|
|
setMapLocationCenter(employee.ServiceEngineerDeviceAlias);
|
|
}
|
|
|
|
|
|
/**
|
|
* Function used to trigger row click event.
|
|
* @method triggerRow
|
|
* @param {String} currObj HTML element id.
|
|
* @for LiveTracking
|
|
*/
|
|
self.triggerRow = function (rowId) {
|
|
//console.log(rowId);
|
|
// Triggering click event when marker on map is clicked
|
|
$("#tableDevices tbody tr[id=" + rowId + "] td").trigger('click');
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* Getting all the employees list and populating the html on page.
|
|
* @method getAllEmployees
|
|
* @for LiveTracking
|
|
*/
|
|
self.getAllEmployees = function () {
|
|
$("#div_load").show(); // Showing loading
|
|
//console.log(counter);
|
|
SecurityToken = securityToken;
|
|
utcMinutes = parseInt(UtcMinutes, 10);
|
|
UserId = userId;
|
|
UserRole = userRole.toLowerCase();
|
|
self.userRole(UserRole);
|
|
|
|
//var dealerName = $("#input_dealers").val(),
|
|
//vanCity = $('#input_vanCities').val(),
|
|
//vanState = $('#input_vanStates').val();
|
|
|
|
var vanState = $("#stateCombobox").data("kendoComboBox").text();
|
|
var vanCity = $("#cityCombobox").data("kendoComboBox").text();
|
|
var dealerName = $("#dealerCombobox").data("kendoComboBox").text();
|
|
|
|
if (dealerName == '') {
|
|
dealerName = 'All';
|
|
//$("#input_dealers").val('All');
|
|
}
|
|
if (vanCity == '') {
|
|
vanCity = 'All';
|
|
//$("#input_vanCities").val('All');
|
|
}
|
|
if (vanState == '') {
|
|
vanState = 'All';
|
|
//$("#input_vanStates").val('All');
|
|
}
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: WCFRESTURL.GetUsersListWithCurrentTrackingData,
|
|
data: { Token: SecurityToken, UtcMinute: utcMinutes, UserId: UserId, DealerNameParam: dealerName, VanCityParam: vanCity, VanStateParam: vanState },
|
|
dataType: "json",
|
|
success: function (data) {
|
|
removeAllUnit();
|
|
|
|
if (data.ListUsers != null || data.status == 1) {
|
|
//console.log(data);
|
|
if (counter == 0) {
|
|
var jsonObject = [];
|
|
for (var index = 0; index < data.ListUsers.length; index++) {
|
|
jsonObject.push({
|
|
unitID: data.ListUsers[index].ServiceEngineerDeviceAlias,
|
|
unitName: data.ListUsers[index].ServiceEngineerName,
|
|
unitImage: markerImagePath,
|
|
unitLatitude: defaultLat,
|
|
unitLongitude: defaultLng + index,
|
|
transparentImage: markerTransImgPath,
|
|
unitDescription: "",
|
|
triggerInfo: function (id) { self.triggerRow(id); }
|
|
});
|
|
data.ListUsers[index].IsConnected = 0;
|
|
data.ListUsers[index].UserId = UserRole;
|
|
}
|
|
//console.log(jsonObject);
|
|
addMultipleDeviceToMap(jsonObject);
|
|
//var employeeList = self.employees();
|
|
//self.employees([]).employees(employeeList);
|
|
|
|
//self.employees([]).employees(data.ListUsers);
|
|
|
|
}
|
|
var finalEmployeeList = ko.utils.arrayFilter(data.ListUsers, function (item) {
|
|
return item.ServiceEngineerId != null;
|
|
});
|
|
self.employees(finalEmployeeList);
|
|
self.getUpdatedLocation(data.ListTracking);
|
|
}
|
|
else {
|
|
alert("No Data Available!");
|
|
}
|
|
},
|
|
complete: function () {
|
|
$('#nodata_msg').hide();
|
|
$('#divNoDataFound').hide();
|
|
if (UserRole == 'dealer') {
|
|
$('#batteryColumn').hide();
|
|
}
|
|
$("#div_load").hide(); // Hiding loading
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* Function used to check the connection of device and update device status accordingly.
|
|
* @method checkConnection
|
|
* @for LiveTracking
|
|
*/
|
|
self.checkConnection = function (deviceId, isConnected, logTime, BatteryStatus, GpsStatus, IsCharging) {
|
|
//console.log(deviceId, isConnected, logTime, BatteryStatus, GpsStatus, IsCharging);
|
|
// Setting the IsConnected Bit as boolean TRUE/FALSE.
|
|
var finalIsConnected = (isConnected == 'True') ? (finalIsConnected = true) : (finalIsConnected = false);
|
|
//console.log(deviceId + " : " + isConnected);
|
|
$.each(self.employees(), function (index, item) {
|
|
var resultItem = item;
|
|
if (item.ServiceEngineerDeviceAlias == deviceId) {
|
|
resultItem.IsConnected = finalIsConnected;
|
|
resultItem.Message = logTime;
|
|
resultItem.BatteryStatus = BatteryStatus;
|
|
resultItem.GpsStatus = GpsStatus;
|
|
resultItem.IsCharging = IsCharging;
|
|
|
|
// console.log(resultItem.IsConnected);
|
|
//console.log(self.employees());
|
|
self.employees()[index] = resultItem;
|
|
//console.log(resultItem);
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* Function used to sort the particular column asc/desc order
|
|
* @method sortJSON
|
|
* @for LiveTracking
|
|
*/
|
|
self.sortJSON = function (data, key, way) {
|
|
return data.sort(function (a, b) {
|
|
var x = a[key]; var y = b[key];
|
|
if (way === '123') { return ((x < y) ? -1 : ((x > y) ? 1 : 0)); }
|
|
if (way === '321') { return ((x > y) ? -1 : ((x < y) ? 1 : 0)); }
|
|
});
|
|
}
|
|
|
|
/**
|
|
* The function searches over the array by certain field value,
|
|
* and replaces occurences with the parameter provided.
|
|
*
|
|
* @param string field Name of the object field to compare
|
|
* @param string oldvalue Value to compare against
|
|
* @param string newvalue Value to replace mathes with
|
|
* @for LiveTracking
|
|
*/
|
|
self.replaceByValue = function (json, field, oldvalue, newvalue) {
|
|
for (var k = 0; k < json.length; ++k) {
|
|
if (oldvalue == json[k][field]) {
|
|
json[k][field] = newvalue;
|
|
}
|
|
}
|
|
return json;
|
|
}
|
|
|
|
|
|
/**
|
|
* Function used to get updated location of devices.
|
|
* @method getUpdatedLocation
|
|
* @for LiveTracking
|
|
*/
|
|
self.getUpdatedLocation = function (data) {
|
|
var jsonMapLocation = [];
|
|
$.each(data, function (index, item) {
|
|
jsonMapLocation.push({ unitID: item.DeviceAlias, unitLatitude: item.Latitude, unitLongitude: item.Longitude });
|
|
//BatteryStatus, GpsStatus, IsCharging
|
|
self.checkConnection(item.DeviceAlias, item.IsConnected, item.LogTime, item.BatteryStatus, item.GpsStatus, item.IsCharging);
|
|
})
|
|
var employeeList = self.employees();
|
|
|
|
var employeeList = self.sortJSON(employeeList, 'IsConnected', '321'); // 123 or 321
|
|
var employeeList = self.replaceByValue(employeeList, 'BatteryStatus', null, 0); // replacing 'null' values with '0'
|
|
|
|
self.employees([]).employees(employeeList);
|
|
|
|
//self.filterUsers();
|
|
//setTimeout(function () {
|
|
moveUnitPoints(jsonMapLocation);
|
|
//}, 2000)
|
|
}
|
|
|
|
|
|
|
|
//================== FILTERS Section Start =========================
|
|
/**
|
|
* To populate state combobox.
|
|
* @method loadStateChoices
|
|
* @for LiveTracking
|
|
*/
|
|
self.loadStateChoices = function () {
|
|
//$("#div_load").show(); // Showing loading
|
|
SecurityToken = securityToken;
|
|
utcMinutes = parseInt(UtcMinutes, 10);
|
|
UserId = userId;
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: WCFRESTURL.GetStateListIdWise,
|
|
data: { Token: SecurityToken, UtcMinutes: utcMinutes, UserId: UserId },
|
|
dataType: "json",
|
|
success: function (data) {
|
|
|
|
$("#stateCombobox").kendoComboBox({
|
|
dataTextField: "StateAlias",
|
|
dataValueField: "StateId",
|
|
filter: "contains",
|
|
dataSource: data,
|
|
//select: onSelect,
|
|
change: function () {
|
|
// loading cities according to state id
|
|
self.loadCityChoices($("#stateCombobox").val());
|
|
self.loadDealerChoices($("#stateCombobox").data("kendoComboBox").text(), $("#cityCombobox").data("kendoComboBox").text());
|
|
},
|
|
//close: onClose,
|
|
//open: onOpen,
|
|
//filtering: onFiltering,
|
|
//dataBound: onDataBound
|
|
});
|
|
|
|
},
|
|
complete: function () {
|
|
//$("#stateCombobox").data('kendoComboBox').select(0);
|
|
self.loadCityChoices($("#stateCombobox").val());
|
|
//$("#div_load").hide(); // Hiding loading
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* To populate city combobox.
|
|
* @method loadCityChoices
|
|
* @param {String} stateId id of state
|
|
* @for LiveTracking
|
|
*/
|
|
self.loadCityChoices = function (stateId) {
|
|
//$("#div_load").show(); // Showing loading
|
|
SecurityToken = securityToken;
|
|
utcMinutes = parseInt(UtcMinutes, 10);
|
|
UserId = userId;
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: WCFRESTURL.GetCityListStateIdWise,
|
|
data: { Token: SecurityToken, UtcMinutes: utcMinutes, UserId: UserId, StateId: stateId },
|
|
dataType: "json",
|
|
success: function (data) {
|
|
|
|
$("#cityCombobox").kendoComboBox({
|
|
dataTextField: "CityName",
|
|
dataValueField: "CityId",
|
|
filter: "contains",
|
|
dataSource: data,
|
|
//select: onSelect,
|
|
change: function () {
|
|
self.loadDealerChoices($("#stateCombobox").data("kendoComboBox").text(), $("#cityCombobox").data("kendoComboBox").text());
|
|
},
|
|
//close: onClose,
|
|
//open: onOpen,
|
|
//filtering: onFiltering,
|
|
//dataBound: onDataBound
|
|
});
|
|
|
|
},
|
|
complete: function () {
|
|
$("#cityCombobox").data("kendoComboBox").text('');
|
|
self.loadDealerChoices($("#stateCombobox").val(), $("#cityCombobox").val());
|
|
//$("#div_load").hide(); // Hiding loading
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* To populate city combobox.
|
|
* @method loadCityChoices
|
|
* @param {String} state state-name
|
|
* @param {String} city city-name
|
|
* @for LiveTracking
|
|
*/
|
|
self.loadDealerChoices = function (state, city) {
|
|
//$("#div_load").show(); // Showing loading
|
|
SecurityToken = securityToken;
|
|
utcMinutes = parseInt(UtcMinutes, 10);
|
|
UserId = userId;
|
|
|
|
//console.log(state + ' : ' + city);
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: WCFRESTURL.GetDealerStateCityWise,
|
|
data: { Token: SecurityToken, UtcMinutes: utcMinutes, UserId: UserId, DealerStateParam: state, DealerCityParam: city },
|
|
dataType: "json",
|
|
success: function (data) {
|
|
|
|
$("#dealerCombobox").kendoComboBox({
|
|
dataTextField: "DealerDealerName",
|
|
dataValueField: "DealerId",
|
|
filter: "contains",
|
|
dataSource: data,
|
|
//select: onSelect,
|
|
//change: onChange,
|
|
//close: onClose,
|
|
//open: onOpen,
|
|
//filtering: onFiltering,
|
|
//dataBound: onDataBound
|
|
});
|
|
|
|
},
|
|
complete: function () {
|
|
$("#dealerCombobox").data("kendoComboBox").text('');
|
|
$("#div_load").hide(); // Hiding loading
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
}
|
|
});
|
|
}
|
|
//================== FILTERS Section End =========================
|
|
|
|
|
|
// Set interval to get updated location of devices
|
|
setInterval(function () { self.getAllEmployees(); }, 1000 * 60 * 5);
|
|
|
|
// Populating Filters on page.
|
|
self.loadStateChoices();
|
|
//self.loadCityChoices($("#stateCombobox").val());
|
|
//self.loadDealerChoices($("#stateCombobox").val(), $("#cityCombobox").val());
|
|
|
|
}
|
|
|
|
|
|
/*=====================================================End============================================*/
|
|
|
|
/*============================================Device List Searching=========================================*/
|
|
/**
|
|
* Function used to trigger row click event.
|
|
* @method initSearch
|
|
* @param {String} keyCode Input key code.
|
|
* @param {String} sValue text to be search.
|
|
* @for LiveTracking
|
|
*/
|
|
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 LiveTracking
|
|
*/
|
|
$('#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>
|