123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
- var Bizgaze;
- (function (Bizgaze) {
- let Apps;
- (function (Apps) {
- let Routes;
- (function (Routes) {
- let Map;
- (function (Map) {
- class TripLocationViewer extends Unibase.Platform.Core.BaseComponent {
- cssFiles() {
- return [];
- }
- jsFiles() {
- return ['apps/crm/employees/managers/gpslocationmanager.js'];
- }
- html(id, containerid) {
- let html = `<div class="modal-header pa-10 text-dark"><strong>Trip GPS Location</strong></div><div data-simplebar class="modal-body simple-scrollbar"><div id="tripGpsLocationMap" class="h-600p"></div></div><div class="modal-footer pa-10"><a href="javascript:;" class="btn btn-outline-danger btn-sm mr-auto" id="closeMapBtn"> Close</a></div>`;
- return html;
- }
- load(id, containerid, callback) {
- const instance = this;
- $('#closeMapBtn').click(function () {
- instance.navigationHelper.closePopUp();
- });
- }
- getgpslocations(userid, tripgroupid, tracktime) {
- if (userid != 0 || tripgroupid != 0) {
- this.fileCacheHelper.loadJsFile('apps/crm/employees/managers/gpslocationmanager.js', function () {
- return __awaiter(this, void 0, void 0, function* () {
- var lat_lng = new Array();
- var latlngbounds = new google.maps.LatLngBounds();
- var infoWindow = new google.maps.InfoWindow();
- var markPoints = [];
- var addressobj = new Array();
- debugger;
- if (userid != 0) {
- const userLocations = yield Bizgaze.Apps.Crm.Employees.Managers.GpsLocationmanager.Instance().getuserlocationsbyuseridanddatetime(userid, tracktime);
- if (userLocations.result.length) {
- markPoints['users'] = userLocations.result;
- }
- if (tripgroupid != 0) {
- const customerLocations = yield Bizgaze.Apps.Crm.Employees.Managers.GpsLocationmanager.Instance().GetCustomerLocationsByTripGroupId(tripgroupid);
- if (customerLocations.result.length) {
- markPoints['customers'] = customerLocations.result;
- }
- }
- var infoWindow = new google.maps.InfoWindow({
- pixelOffset: new google.maps.Size(0, -5)
- });
- var mapOptions = {
- center: new google.maps.LatLng(0, 0),
- zoom: 1,
- mapTypeId: google.maps.MapTypeId.ROADMAP
- };
- var map = new google.maps.Map(document.getElementById('tripGpsLocationMap'), mapOptions);
- for (const contact in markPoints) {
- debugger;
- const isUser = contact === 'users';
- for (let i = 0; i <= markPoints[contact].length - 1; i++) {
- var data = markPoints[contact][i];
- const latitude = isUser ? data.Latitude : data.latitude;
- const longitude = isUser ? data.Longitude : data.longitude;
- var myLatlng = new google.maps.LatLng(latitude, longitude);
- if (isUser) {
- lat_lng.push(myLatlng);
- }
- var icon = data.color;
- var lineSymbol = {
- path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW
- };
- icon = "https://maps.google.com/mapfiles/ms/icons/" + icon + ".png";
- var marker;
- if (isUser) {
- marker = new google.maps.Marker({
- position: myLatlng,
- map: map,
- draggable: false,
- title: data.Address,
- label: {
- fontSize: '12px', fontWeight: '200', text: '.',
- }
- });
- }
- else {
- marker = new google.maps.Marker({
- position: myLatlng,
- map: map,
- draggable: false,
- title: data.address,
- label: {
- fontSize: '12px', fontWeight: '200', text: '.',
- }
- });
- }
- google.maps.event.addListener(marker, 'mouseout', function (c) {
- infoWindow.close();
- });
- marker.setIcon({
- path: google.maps.SymbolPath.CIRCLE,
- fillOpacity: 1,
- fillColor: isUser ? 'red' : 'Orange',
- strokeOpacity: 1,
- strokeWeight: 1,
- strokeColor: '#333',
- scale: 6,
- scaledSize: new google.maps.Size(65, 80),
- });
- var poly = new google.maps.Polyline({
- map: map, strokeColor: '#FF0000', geodesic: true, strokeOpacity: 1.0,
- strokeWeight: 2, path: lat_lng
- });
- marker.setMap(map);
- latlngbounds.extend(marker.position);
- map.fitBounds(latlngbounds);
- }
- }
- }
- });
- });
- }
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new TripLocationViewer();
- }
- return this.instance;
- }
- }
- Map.TripLocationViewer = TripLocationViewer;
- })(Map = Routes.Map || (Routes.Map = {}));
- })(Routes = Apps.Routes || (Apps.Routes = {}));
- })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
- })(Bizgaze || (Bizgaze = {}));
|