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

507 lines
18 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Inventory\ShowDealerMap.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: Inventory\ShowDealerMap.js</h1>
<div class="file">
<pre class="code prettyprint linenums">
/**
* To Manage Fleet
* @module Inventory
*/
/**
* This class contains functions related to show device details and their state (Operational/Non-operational/Disabled/Archive/All&quot;)
* @class ShowDealerMap
* @constructor
*/
var ccplMap = null,
geoCoder,
defaultLat,
defaultLng,
marker;
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 markers = []; //array of source and destination markers
var vLatVal = &quot;&quot;;
var vLongVal = &quot;&quot;;
var marker1 = &quot;&quot;;
//========================================== map functionality ============================================//
/**
* Load google map on page.
* @method initMap
* @param {String} id HTML element id where map is loaded.
* @for TicketAdministration
*/
//function initMap(id) {
// var mapOptions = {
// center: new google.maps.LatLng(vLatVal, vLongVal),
// zoom: 12,
// mapTypeId: google.maps.MapTypeId.ROADMAP
// };
// //initialize map
// ccplMap = new google.maps.Map(document.getElementById(id), mapOptions);
// var marker = new google.maps.Marker({
// position: ccplMap.getCenter(),
// map: ccplMap,
// draggable: true,
// title: &#x27;Click to zoom&#x27;
// });
// var input = /** @type {HTMLInputElement} */(
// document.getElementById(&#x27;pac-input&#x27;));
// ccplMap.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
// var searchBox = new google.maps.places.SearchBox(
// /** @type {HTMLInputElement} */(input));
// google.maps.event.addListener(searchBox, &#x27;places_changed&#x27;, function () {
// var places = searchBox.getPlaces();
// if (places.length == 0) {
// return;
// }
// for (var i = 0, marker; marker = markers[i]; i++) {
// marker.setMap(null);
// }
// // For each place, get the icon, place name, and location.
// var bounds = new google.maps.LatLngBounds();
// google.maps.event.addListener(ccplMap, &#x27;bounds_changed&#x27;, function () {
// var bounds = ccplMap.getBounds();
// searchBox.setBounds(bounds);
// });
// ccplMap.fitBounds(bounds);
// var mapOptions = {
// center: bounds.getCenter(),
// zoom: 12,
// mapTypeId: google.maps.MapTypeId.ROADMAP
// };
// var input = /** @type {HTMLInputElement} */(
// document.getElementById(&#x27;pac-input&#x27;));
// ccplMap.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
// //initialize map
// ccplMap = new google.maps.Map(document.getElementById(&quot;divMapContainer&quot;), mapOptions);
// marker = new google.maps.Marker({
// position: ccplMap.getCenter(),
// map: ccplMap,
// draggable: true,
// title: &#x27;Click to zoom&#x27;
// });
// vLatVal = marker.position.lat();
// vLongVal = marker.position.lng();
// });
// google.maps.event.addListener(ccplMap, &#x27;click&#x27;, function (e) {
// window.setTimeout(function () {
// vLatVal = e.latLng.lat();
// vLongVal = e.latLng.lng();
// ccplMap.panTo(marker.getPosition());
// }, 3000);
// });
// google.maps.event.addListener(marker, &#x27;dragend&#x27;, function (e) {
// vLatVal = e.latLng.lat();
// vLongVal = e.latLng.lng();
// });
//}
/**
* This function is used to Get dealer Lat long and set it into Hidden field
* @method initMap
* @param {String} id Id Of Map
* @for ShowDealerMap
*/
function initMap(id) {
var markers = [];
ccplMap = new google.maps.Map(document.getElementById(id), {
mapTypeId: google.maps.MapTypeId.ROADMAP,
//center: new google.maps.LatLng(vLatVal, vLongVal),
zoom: 12
});
SetDefaultLatAndLong();
// Create the search box and link it to the UI element.
//var input = /** @type {HTMLInputElement} */(
// document.getElementById(&#x27;pac-input&#x27;));
//ccplMap.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
//var searchBox = new google.maps.places.SearchBox(
// /** @type {HTMLInputElement} */(input));
// Listen for the event fired when the user selects an item from the
// pick list. Retrieve the matching places for that item.
//google.maps.event.addListener(searchBox, &#x27;places_changed&#x27;, function () {
// var places = searchBox.getPlaces();
// if (places.length == 0) {
// return;
// }
// for (var i = 0, marker; marker = markers[i]; i++) {
// marker.setMap(null);
// }
// // For each place, get the icon, place name, and location.
// markers = [];
// var bounds = new google.maps.LatLngBounds();
// for (var i = 0, place; place = places[i]; i++) {
// var image = {
// url: place.icon,
// size: new google.maps.Size(71, 71),
// origin: new google.maps.Point(0, 0),
// anchor: new google.maps.Point(17, 34),
// scaledSize: new google.maps.Size(25, 25)
// };
// // Create a marker for each place.
// var marker = new google.maps.Marker({
// map: ccplMap,
// icon: image,
// title: place.name,
// position: place.geometry.location,
// draggable: true,
// });
// vLatVal = marker.position.lat();
// vLongVal = marker.position.lng();
// markers.push(marker);
// bounds.extend(place.geometry.location);
// }
// console.log(bounds);
// var ccplMap = new google.maps.Map(document.getElementById(id), {
// mapTypeId: google.maps.MapTypeId.ROADMAP,
// center: new google.maps.LatLng(vLatVal, vLongVal),
// zoom: 12
// });
// ccplMap.fitBounds(bounds);
// var ccplMap = new google.maps.Map(document.getElementById(id), {
// mapTypeId: google.maps.MapTypeId.ROADMAP,
// center: new google.maps.LatLng(vLatVal, vLongVal),
// zoom: 12
// });
// var marker = new google.maps.Marker({
// position: ccplMap.getCenter(),
// map: ccplMap,
// draggable: true,
// title: &#x27;Click to zoom&#x27;
// });
// //ccplMap.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
// google.maps.event.addListener(marker, &#x27;dragend&#x27;, function (e) {
// vLatVal = e.latLng.lat();
// vLongVal = e.latLng.lng();
// });
//});
// Bias the SearchBox results towards places that are within the bounds of the
// current map&#x27;s viewport.
//google.maps.event.addListener(ccplMap, &#x27;bounds_changed&#x27;, function () {
// var bounds = ccplMap.getBounds();
// searchBox.setBounds(bounds);
// console.log(bounds);
//});
}
/**
* This function is used to Get dealer Lat long and set it into Hidden field
* @method getDelearLatLong
* @for ShowDealerMap
*/
function getDelearLatLong() {
$(&quot;#hdnDealerDefaultLatitude&quot;).val(vLatVal);
$(&quot;#hdnDealerDefaultLongitude&quot;).val(vLongVal);
closeWindow(&quot;#divShowDealerLocation&quot;);
}
//==================================== end map functionality =============================================//
$(document).ready(function () {
setTimeout(function () {
initMap(&quot;divMapContainer&quot;);
}, 1000);
});
/**
* This function set marker object and Add Dragend Event in Maps
* @method getSetMarker
* @for ShowDealerMap
*/
function SetDefaultLatAndLong() {
var DealerState = $(&quot;#ddState option:selected&quot;).text();
var DealerCity = $(&quot;#ddCity option:selected&quot;).val();
var address = DealerState + &quot;,&quot; + DealerCity;
if ($(&quot;#hdnDealerDefaultLatitude&quot;).val() == &quot;&quot; || $(&quot;#hdnDealerDefaultLatitude&quot;).val() == &quot;0&quot;) {
setMapCenterToAddress(address);
}
else {
vLatVal = $(&quot;#hdnDealerDefaultLatitude&quot;).val();
vLongVal = $(&quot;#hdnDealerDefaultLongitude&quot;).val();
var dealerLatLong = new google.maps.LatLng(vLatVal, vLongVal);
ccplMap.setCenter(dealerLatLong);
getSetMarker();
}
}
/**
* This function set center and zoom of map when state or city change
* @method setMapCenterToAddress
* @param {String} address address to show on map
* @for ShowDealerMap
*/
function setMapCenterToAddress(address) {
geoCoder = new google.maps.Geocoder();
geoCoder.geocode({ &#x27;address&#x27;: address }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
ccplMap.setCenter(results[0].geometry.location);
defaultLat = results[0].geometry.location.lat();
defaultLng = results[0].geometry.location.lng();
vLatVal = defaultLat;
vLongVal = defaultLng;
$(&quot;#hdnDealerDefaultLatitude&quot;).val(vLatVal);
$(&quot;#hdnDealerDefaultLongitude&quot;).val(vLongVal);
getSetMarker();
}
});
}
/**
* This function set marker object and Add Dragend Event in Maps
* @method getSetMarker
* @for ShowDealerMap
*/
function getSetMarker() {
marker = new google.maps.Marker({
position: ccplMap.getCenter(),
map: ccplMap,
draggable: true,
title: &#x27;Click to zoom&#x27;
});
google.maps.event.addListener(marker, &#x27;dragend&#x27;, function (e) {
vLatVal = e.latLng.lat();
vLongVal = e.latLng.lng();
});
}
</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>