{"version":3,"sources":["webpack:///./src/Admin/VATSTracking/VATSTracking.vue?9337","webpack:///./src/Admin/VATSTracking/TimeFrame.ts","webpack:///./src/Admin/VATSTracking/DateRange.ts","webpack:///./src/Admin/VATSTracking/VATSTracking.vue?066d","webpack:///./src/Admin/VATSTracking/VATSTracking.vue?96ab","webpack:///./src/Admin/VATSTracking/VATSTracking.vue","webpack:///./src/Admin/VATSTracking/VATSTracking.vue?953d"],"names":["render","_vm","this","_h","$createElement","_c","_self","directives","name","rawName","value","expression","staticClass","_v","_s","$t","attrs","on","onSelectedDeviceChanged","model","callback","$$v","selectedDevice","domProps","_l","device","deviceName","onSelectedTimeFrameChanged","selectedTimeFrame","timeframe","displayText","$event","onUpdateMap","isSelectableDate","onSelectedStartDateChanged","selectedStartDate","onSelectedEndDateChanged","selectedEndDate","onPrintCurrentPage","ref","markers","mapOptions","staticRenderFns","displayOrder","TimeFrame","AvailableTimeFrames","sort","x","y","Array","CurrentLocation","LastHour","Last2Hours","Last5Hours","Last10Hours","Last24Hours","DateRange","date1","date2","dates","valueOf","startDate","Date","Math","min","endDate","max","allDevicesDeviceId","DEFAULT_ICON","TRACKING_ICON_FIRST","TRACKING_ICON_DEFAULT","TRACKING_ICON_LAST","VATSTrackingAdmin","LocationBasedMixin","extend","components","VatsGoogleMap","Multiselect","data","trackedDevices","availableTimeFrames","computed","mounted","init","methods","getMapOptions","getTrackedDevices","setRunReportLink","getDateRange","trackedDevice","dateRange","link","document","getElementById","deviceID","isDevelopment","window","location","hostname","indexOf","reportUrl","start","formatDate","end","hrefUrl","Logger","Log","setAttribute","date","isNaN","getTime","padStart","maxLength","toString","replace","getFullYear","getDate","getMonth","getHours","getMinutes","getSeconds","locationChanged","Promise","zoom","mapTypeId","getLatLngForLocation","center","addHours","numHours","result","setHours","addSeconds","numSeconds","setSeconds","now","getMarkersFromDeviceTrackingData","trackingData","timestamp","map","position","lat","latitude","lng","longitude","localeString","$i18n","locale","Intl","DateTimeFormat","year","month","day","hour","minute","second","dateTimeString","format","title","opts","google","maps","Marker","getTrackingData","getMarkersFromTrackingDataCollection","setMapCenter","setPolylines","dataCollection","polylines","hasOwnProperty","deviceDataCollection","length","latLngArray","forEach","d","latLng","LatLng","push","p","Polyline","setPath","ex","$refs","clearPolylines","addPolylines","getMapCenterForMarkers","newCenter","setCenter","getPosition","undefined","mapCenter","print","setMarkerIcons","defaultIcon","firstIcon","lastIcon","iconsResult","setIcon","getAllDevicesCurrentLocation","getAllDeviceTrackingDataForTimeFrame","getSingleDeviceCurrentLocation","getSingleDeviceForTimeFrame","message","url","VatsAPI","get","getTrackingDataCollectionFromArray","config","params","collection","key","reduce","g","dtd","orderedValues","allDeviceMarkers","isCollectionTrackingDeviceMovement","currentDeviceMarkers","concat","allDevicesDeviceItem","latLongString","latLongArr","split","latLongObj","parseFloat","component"],"mappings":"yHAAA,IAAIA,EAAS,WAAa,IAAIC,EAAIC,KAASC,EAAGF,EAAIG,eAAmBC,EAAGJ,EAAIK,MAAMD,IAAIF,EAAG,OAAOE,EAAG,MAAM,CAACE,WAAW,CAAC,CAACC,KAAK,iBAAiBC,QAAQ,mBAAmBC,MAAOT,EAAW,QAAEU,WAAW,YAAYC,YAAY,aAAa,CAACP,EAAG,QAAQ,CAACA,EAAG,QAAQ,CAACA,EAAG,KAAK,CAACJ,EAAIY,GAAGZ,EAAIa,GAAGb,EAAIc,GAAG,wCAAwC,GAAGV,EAAG,QAAQ,CAACA,EAAG,QAAQ,CAACW,MAAM,CAAC,KAAO,MAAM,CAACX,EAAG,gBAAgB,CAACO,YAAY,eAAeK,GAAG,CAAC,OAAShB,EAAIiB,yBAAyBC,MAAM,CAACT,MAAOT,EAAkB,eAAEmB,SAAS,SAAUC,GAAMpB,EAAIqB,eAAeD,GAAKV,WAAW,mBAAmB,CAACN,EAAG,SAAS,CAACW,MAAM,CAAC,SAAW,IAAIO,SAAS,CAAC,MAAQ,OAAO,CAACtB,EAAIY,GAAG,qBAAqBZ,EAAIuB,GAAIvB,EAA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chunk-9a9cf396.dccf0ac6.js","sourcesContent":["var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:\"wait-indicator\",rawName:\"v-wait-indicator\",value:(_vm.loading),expression:\"loading\"}],staticClass:\"container\"},[_c('b-row',[_c('b-col',[_c('h4',[_vm._v(_vm._s(_vm.$t('admin.vatsTracking.pageHeader')))])])],1),_c('b-row',[_c('b-col',{attrs:{\"cols\":\"3\"}},[_c('b-form-select',{staticClass:\"form-control\",on:{\"change\":_vm.onSelectedDeviceChanged},model:{value:(_vm.selectedDevice),callback:function ($$v) {_vm.selectedDevice=$$v},expression:\"selectedDevice\"}},[_c('option',{attrs:{\"disabled\":\"\"},domProps:{\"value\":null}},[_vm._v(\"Select a device\")]),_vm._l((_vm.trackedDevices),function(device){return _c('option',{domProps:{\"value\":device}},[_vm._v(\"\\n \"+_vm._s(device.deviceName)+\"\\n \")])})],2)],1),_c('b-col',{attrs:{\"cols\":\"3\"}},[_c('b-form-select',{staticClass:\"form-control\",on:{\"change\":_vm.onSelectedTimeFrameChanged},model:{value:(_vm.selectedTimeFrame),callback:function ($$v) {_vm.selectedTimeFrame=$$v},expression:\"selectedTimeFrame\"}},[_c('option',{attrs:{\"disabled\":\"\"},domProps:{\"value\":null}},[_vm._v(\"Select a time frame\")]),_vm._l((_vm.availableTimeFrames),function(timeframe){return _c('option',{domProps:{\"value\":timeframe}},[_vm._v(\"\\n \"+_vm._s(timeframe.displayText)+\"\\n \")])})],2)],1),_c('b-col',{attrs:{\"cols\":\"2\"}},[_c('b-button',{attrs:{\"size\":\"sm\"},on:{\"click\":function($event){return _vm.onUpdateMap()}}},[_vm._v(\"Update Map\")])],1),_c('b-col',{attrs:{\"cols\":\"2\"}},[_c('a',{staticClass:\"btn btn-primary\",attrs:{\"id\":\"runReportLink\"}},[_vm._v(\"Run Report\")])])],1),_c('b-row',[_c('b-col',{attrs:{\"cols\":\"3\"}},[_c('b-form-datepicker',{attrs:{\"disabled\":!_vm.selectedTimeFrame || !_vm.selectedTimeFrame.isSelectableDate,\"value-as-date\":\"\"},on:{\"input\":_vm.onSelectedStartDateChanged},model:{value:(_vm.selectedStartDate),callback:function ($$v) {_vm.selectedStartDate=$$v},expression:\"selectedStartDate\"}})],1),_c('b-col',{attrs:{\"cols\":\"3\"}},[_c('b-form-datepicker',{attrs:{\"disabled\":!_vm.selectedTimeFrame || !_vm.selectedTimeFrame.isSelectableDate,\"value-as-date\":\"\"},on:{\"input\":_vm.onSelectedEndDateChanged},model:{value:(_vm.selectedEndDate),callback:function ($$v) {_vm.selectedEndDate=$$v},expression:\"selectedEndDate\"}})],1),_c('b-col',{attrs:{\"cols\":\"2\"}},[_c('b-button',{attrs:{\"size\":\"sm\"},on:{\"click\":function($event){return _vm.onPrintCurrentPage()}}},[_vm._v(\"Print Current Page\")])],1)],1),_c('b-row',[_c('b-col',{attrs:{\"cols\":\"12\"}},[_c('div',{staticClass:\"lot-area-map-container\"},[_c('VatsGoogleMap',{ref:\"map\",attrs:{\"markers\":_vm.markers,\"mapOptions\":_vm.mapOptions}})],1)])],1)],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","export class TimeFrame {\r\n public static AvailableTimeFrames: TimeFrame[] = new Array();\r\n\r\n public static CurrentLocation = new TimeFrame(1, 'Current Location');\r\n public static LastHour = new TimeFrame(2, 'Last Hour');\r\n public static Last2Hours = new TimeFrame(3, 'Last 2 Hours');\r\n public static Last5Hours = new TimeFrame(4, 'Last 5 Hours');\r\n public static Last10Hours = new TimeFrame(5, 'Last 10 Hours');\r\n public static Last24Hours = new TimeFrame(6, 'Last 24 Hours');\r\n // public static EnterADate = new TimeFrame(7, 'Enter a Date', true);\r\n public static DateRange = new TimeFrame(8, 'Date Range', true);\r\n\r\n public readonly displayOrder: number;\r\n public readonly displayText: string;\r\n public readonly isSelectableDate: boolean;\r\n\r\n constructor(displayOrder: number, displayText: string, isSelectableDate: boolean = false) {\r\n this.displayOrder = displayOrder;\r\n this.displayText = displayText;\r\n this.isSelectableDate = isSelectableDate;\r\n\r\n TimeFrame.AvailableTimeFrames =\r\n [...TimeFrame.AvailableTimeFrames, this]\r\n .sort((x, y) => x.displayOrder > y.displayOrder ? 1 : -1)\r\n ;\r\n }\r\n}\r\n","export class DateRange {\r\n public readonly startDate: Date;\r\n public readonly endDate: Date;\r\n\r\n constructor(date1: Date, date2: Date) {\r\n const dates: number[] = [date1.valueOf(), date2.valueOf()];\r\n this.startDate = new Date(Math.min(...dates));\r\n this.endDate = new Date(Math.max(...dates));\r\n }\r\n}\r\n","\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// tslint:disable:max-line-length\nimport LocationBasedMixin from '@/Shared/LocationBasedMixin';\nimport VatsAPI from '@/Shared/VatsAPI';\nimport VatsGoogleMap from '@/Shared/VatsGoogleMaps/VatsGoogleMap.vue';\nimport Multiselect from 'vue-multiselect';\nimport mixins from 'vue-typed-mixins';\nimport {mapGetters} from 'vuex';\nimport {TrackedDevice} from '@/Admin/VATSTracking/TrackedDevice';\nimport {DeviceTrackingData} from '@/Admin/VATSTracking/DeviceTrackingData';\nimport {TimeFrame} from '@/Admin/VATSTracking/TimeFrame';\nimport {AxiosRequestConfig} from 'axios';\nimport {Logger} from '@/Shared/Logger';\nimport {DateRange} from '@/Admin/VATSTracking/DateRange';\nimport {DeviceTrackingDataCollection} from '@/Admin/VATSTracking/DeviceTrackingDataCollection';\nimport LatLng = google.maps.LatLng;\nimport { getLocaleWithoutDialect } from '@/internationalization';\n\nconst allDevicesDeviceId: string = 'C190138C-AB2C-49EE-8C40-D2A48DA04754';\n\nconst DEFAULT_ICON: string = 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png';\nconst TRACKING_ICON_FIRST: string = 'https://maps.gstatic.com/mapfiles/ridefinder-images/mm_20_green.png';\nconst TRACKING_ICON_DEFAULT: string = 'https://maps.gstatic.com/mapfiles/ridefinder-images/mm_20_blue.png';\nconst TRACKING_ICON_LAST: string = 'https://maps.gstatic.com/mapfiles/ridefinder-images/mm_20_red.png';\n\nconst VATSTrackingAdmin = mixins(LocationBasedMixin).extend({\n components: {\n VatsGoogleMap,\n Multiselect\n },\n data() {\n return {\n mapOptions: {} as google.maps.MapOptions,\n markers: [] as google.maps.Marker[],\n\n trackedDevices: [] as TrackedDevice[],\n selectedDevice: (null as any) as TrackedDevice,\n selectedTimeFrame: (null as any) as TimeFrame,\n availableTimeFrames: [] as TimeFrame[],\n\n selectedStartDate: new Date(),\n selectedEndDate: new Date(),\n };\n },\n computed: {\n ...mapGetters('loaderModule', ['loading'])\n },\n async mounted() {\n await this.init();\n },\n methods: {\n // region \"Init methods\"\n\n async init() {\n this.mapOptions = await this.getMapOptions();\n this.trackedDevices = await this.getTrackedDevices();\n this.availableTimeFrames = TimeFrame.AvailableTimeFrames;\n\n this.selectedStartDate = new Date();\n this.selectedEndDate = new Date();\n\n // prefill the map with all devices, current location\n this.selectedDevice = this.trackedDevices[0];\n this.selectedTimeFrame = this.availableTimeFrames[0];\n\n // set the map markers, center the map on the markers, and draw polylines between the markers\n await this.onUpdateMap();\n\n // set the Run Report link for the default device and time frame\n this.setRunReportLink(this.selectedDevice, this.getDateRange(this.selectedTimeFrame));\n\n return;\n },\n\n setRunReportLink(trackedDevice: TrackedDevice, dateRange: DateRange) {\n\n const link: HTMLElement | null = document.getElementById('runReportLink'); // or grab it by tagname etc\n\n if (link === null) {\n return;\n }\n\n if (trackedDevice.deviceID === allDevicesDeviceId) {\n // the report generation logic is too naive to understand \"All\". It's looking for a device named \"All\".\n // if there really is a device named \"All\" we'll still be able to report on it because we're checking the device ID,\n // not the name.\n\n // \"Disable\" link by removing the href property\n link.setAttribute('href', '');\n return;\n }\n\n // https://localhost:44300/main/GPSGapReportExport.aspx\n // ?p1=5/1/2020 00:00:00\n // &p2=5/15/2020 23:59:59\n // &p3=AMM\n\n function formatDate(date: Date): string {\n if (isNaN(date.getTime())) {\n return '';\n }\n\n const padStart = (value: number, maxLength: number = 2): string => value.toString().padStart(maxLength, '0');\n\n return 'mm/dd/yyyy hh:ii:ss'\n .replace(/yyyy/g, padStart(date.getFullYear(), 4))\n .replace(/dd/g, padStart(date.getDate()))\n .replace(/mm/g, padStart(date.getMonth() + 1))\n .replace(/hh/g, padStart(date.getHours()))\n .replace(/ii/g, padStart(date.getMinutes()))\n .replace(/ss/g, padStart(date.getSeconds()));\n }\n\n const isDevelopment = (window.location.hostname).indexOf('localhost') > -1 ||\n (window.location.hostname).indexOf('development') > -1;\n\n const reportUrl = isDevelopment\n ? 'https://development.municipalcitationsolutions.com/main/GPSGapReportExport.aspx'\n : 'https://vats.municipalcitationsolutions.com/main/GPSGapReportExport.aspx';\n\n const start = formatDate(dateRange.startDate);\n const end = formatDate(dateRange.endDate);\n const deviceName = trackedDevice.deviceName;\n\n const hrefUrl = `${reportUrl}?p1=${start}&p2=${end}&p3=${deviceName}`;\n\n Logger.Log(hrefUrl);\n\n link.setAttribute('href', hrefUrl);\n },\n\n locationChanged() {\n this.init();\n },\n\n async getMapOptions(): Promise {\n const mapOptions: google.maps.MapOptions = {\n zoom: 14,\n mapTypeId: 'roadmap',\n center: await this.getLatLngForLocation()\n };\n return mapOptions;\n },\n\n // endregion \"Init methods\"\n\n // region \"Utility methods\"\n\n getDateRange(selectedTimeFrame: TimeFrame): DateRange {\n const addHours = (date: Date, numHours: number) => {\n let result = new Date(date);\n result = new Date(result.setHours(result.getHours() + numHours));\n return result;\n };\n const addSeconds = (date: Date, numSeconds: number) => {\n let result = new Date(date);\n result = new Date(result.setSeconds(result.getSeconds() + numSeconds));\n return result;\n };\n const getDate = (date: Date) => {\n return new Date(date.setHours(0, 0, 0, 0));\n };\n\n const now: Date = new Date();\n let startDate: Date;\n let endDate: Date;\n\n switch (selectedTimeFrame) {\n case TimeFrame.LastHour:\n return new DateRange(now, addHours(now, -1));\n case TimeFrame.Last2Hours:\n return new DateRange(now, addHours(now, -2));\n case TimeFrame.Last5Hours:\n return new DateRange(now, addHours(now, -5));\n case TimeFrame.Last10Hours:\n return new DateRange(now, addHours(now, -10));\n case TimeFrame.Last24Hours:\n return new DateRange(now, addHours(now, -24));\n case TimeFrame.DateRange:\n startDate = getDate(this.selectedStartDate);\n endDate = addSeconds(addHours(getDate(this.selectedEndDate), 24), -1);\n return new DateRange(startDate, endDate);\n default:\n startDate = getDate(now);\n endDate = addSeconds(addHours(startDate, 24), -1);\n return new DateRange(startDate, endDate);\n }\n },\n\n getMarkersFromDeviceTrackingData(trackingData: DeviceTrackingData[]): google.maps.Marker[] {\n const markers: google.maps.Marker[] = trackingData\n .sort((x, y) => x.timestamp > y.timestamp ? 1 : -1)\n .map(x => {\n const position: google.maps.ReadonlyLatLngLiteral = {\n lat: x.latitude,\n lng: x.longitude\n };\n\n // without specifying the h:m:s it was only giving me back the date.\n // also the value for fr-CA looks really weird to me.\n // en-US: \"Sep 9, 2019, 12:27:38 AM\"\n // fr-CA: \"9 sept. 2019 00 h 27 min 38 s\"\n // at least it's clear the formatter is doing something...\n const localeString = getLocaleWithoutDialect(this.$i18n.locale);\n const locale = new Intl.DateTimeFormat(localeString, {\n // https://devhints.io/wip/intl-datetime\n // https://kazupon.github.io/vue-i18n/guide/datetime.html\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric'\n });\n const dateTimeString: string = locale.format(x.timestamp);\n const title: string = `${x.deviceName}: ${dateTimeString}`;\n const opts = {position, title};\n return new google.maps.Marker(opts);\n });\n\n return markers;\n },\n\n // endregion \"Utility methods\"\n\n // region \"Tracking option events\"\n\n async onUpdateMap() {\n // set the map markers for the selected device and time frame\n const data: DeviceTrackingDataCollection = await this.getTrackingData(this.selectedDevice, this.selectedTimeFrame);\n\n this.markers = await this.getMarkersFromTrackingDataCollection(data);\n\n // center the map on the markers\n await this.setMapCenter(this.markers);\n\n // fill in the polylines between the markers\n // except the markers don't have time data on them, so we actually need one or more of:\n // DeviceTrackingData | DeviceTrackingData[] | DeviceTrackingDataCollection | undefined\n this.setPolylines(data);\n },\n\n setPolylines(dataCollection: DeviceTrackingDataCollection) {\n let polylines: google.maps.Polyline[] = [];\n\n try {\n // for each device in the collection,\n // create a single polyline from all its tracking data\n for (const deviceName in dataCollection) {\n if (!dataCollection.hasOwnProperty(deviceName)) {\n continue;\n }\n\n const deviceDataCollection = dataCollection[deviceName];\n\n if (deviceDataCollection.length < 2) {\n // no line unless there's a minimum of two points\n continue;\n }\n\n const latLngArray: google.maps.LatLng[] = [];\n\n deviceDataCollection\n // order by timestamp ascending\n .sort((x, y) => x.timestamp > y.timestamp ? 1 : -1)\n // populate the latlng array\n .forEach(d => {\n const latLng = new google.maps.LatLng(d.latitude, d.longitude);\n latLngArray.push(latLng);\n });\n\n const p = new google.maps.Polyline();\n p.setPath(latLngArray);\n polylines.push(p);\n }\n }\n catch (ex) {\n Logger.Log(ex);\n\n // if something goes wrong, just erase all the existing polylines\n polylines = [];\n }\n finally {\n const map = (this.$refs.map as any);\n map.clearPolylines();\n\n if (polylines.length > 0) {\n map.addPolylines(polylines);\n }\n }\n },\n\n async setMapCenter(markers: google.maps.Marker[]) {\n const newCenter = await this.getMapCenterForMarkers(markers);\n\n // i hate this so much. why can't i get a strong-typed \"VatsGoogleMap\" to work, leaving me to use \"any\"?\n (this.$refs.map as any).setCenter(newCenter);\n },\n\n async getMapCenterForMarkers(markers: google.maps.Marker[]): Promise {\n if (markers.length === 0) {\n // return default center if there are no markers\n return await this.getLatLngForLocation();\n }\n\n const lat: number | undefined = markers[0].getPosition()?.lat();\n const lng: number | undefined = markers[0].getPosition()?.lng();\n\n if (lat === undefined || lng === undefined) {\n // return default center if either coordinate is undefined\n return await this.getLatLngForLocation();\n }\n\n const mapCenter: google.maps.LatLngLiteral = {lat, lng};\n return mapCenter;\n },\n\n async onPrintCurrentPage() {\n window.print();\n },\n\n async onSelectedDeviceChanged() {\n this.setRunReportLink(this.selectedDevice, this.getDateRange(this.selectedTimeFrame));\n },\n\n async onSelectedTimeFrameChanged() {\n this.setRunReportLink(this.selectedDevice, this.getDateRange(this.selectedTimeFrame));\n },\n\n async onSelectedStartDateChanged(date: Date) {\n if (date > this.selectedEndDate) {\n this.selectedEndDate = date;\n }\n\n this.setRunReportLink(this.selectedDevice, this.getDateRange(this.selectedTimeFrame));\n },\n async onSelectedEndDateChanged(date: Date) {\n if (date < this.selectedStartDate) {\n this.selectedStartDate = date;\n }\n\n this.setRunReportLink(this.selectedDevice, this.getDateRange(this.selectedTimeFrame));\n },\n\n // endregion \"Tracking option events\"\n\n // region \"Get Tracking Data\"\n\n setMarkerIcons(markers: google.maps.Marker[], defaultIcon: string, firstIcon?: string | undefined, lastIcon?: string | undefined): google.maps.Marker[] {\n const iconsResult = markers.map(x => {\n x.setIcon(defaultIcon);\n return x;\n });\n\n if (firstIcon !== undefined && iconsResult.length >= 2) {\n iconsResult[0].setIcon(firstIcon);\n }\n\n if (lastIcon !== undefined && iconsResult.length >= 2) {\n iconsResult[iconsResult.length - 1].setIcon(lastIcon);\n }\n\n return iconsResult;\n },\n\n async getTrackingData(selectedDevice: TrackedDevice, selectedTimeFrame: TimeFrame): Promise {\n\n let result: DeviceTrackingDataCollection = {};\n\n if (!selectedDevice || !selectedTimeFrame) {\n return result;\n }\n\n try {\n if (selectedDevice.deviceID === allDevicesDeviceId) {\n if (selectedTimeFrame === TimeFrame.CurrentLocation) {\n result = await this.getAllDevicesCurrentLocation();\n } else {\n result = await this.getAllDeviceTrackingDataForTimeFrame(selectedTimeFrame);\n }\n } else {\n if (selectedTimeFrame === TimeFrame.CurrentLocation) {\n result = await this.getSingleDeviceCurrentLocation(selectedDevice);\n } else {\n result = await this.getSingleDeviceForTimeFrame(selectedDevice, selectedTimeFrame);\n }\n }\n } catch (e) {\n Logger.Log(e.message);\n result = {};\n }\n\n return result;\n },\n\n async getAllDevicesCurrentLocation(): Promise {\n const url = `/${this.location}/HandheldAdmin/GetTrackingDataForAll`;\n const trackingData: DeviceTrackingData[] =\n (await VatsAPI.get(url)).data\n .map(x => {\n x.timestamp = new Date(x.timestamp);\n return x;\n });\n return this.getTrackingDataCollectionFromArray(trackingData);\n },\n\n async getAllDeviceTrackingDataForTimeFrame(selectedTimeFrame: TimeFrame): Promise {\n const dateRange: DateRange = this.getDateRange(selectedTimeFrame);\n\n const url = `/${this.location}/HandheldAdmin/GetTrackingDataForAllForDateRange`;\n const config: AxiosRequestConfig = {params: {startDate: dateRange.startDate, endDate: dateRange.endDate}};\n const trackingData: DeviceTrackingData[] =\n (await VatsAPI.get(url, config)).data\n .map(x => {\n x.timestamp = new Date(x.timestamp);\n return x;\n });\n\n return this.getTrackingDataCollectionFromArray(trackingData);\n },\n\n async getSingleDeviceCurrentLocation(selectedDevice: TrackedDevice): Promise {\n const url: string = `/${this.location}/HandheldAdmin/GetTrackingDataForDevice`;\n const deviceName: string = selectedDevice.deviceName;\n const config: AxiosRequestConfig = {params: {deviceName}};\n const trackingData: DeviceTrackingData = (await VatsAPI.get(url, config)).data;\n trackingData.timestamp = new Date(trackingData.timestamp);\n return this.getTrackingDataCollectionFromArray([trackingData]);\n },\n\n async getSingleDeviceForTimeFrame(selectedDevice: TrackedDevice, selectedTimeFrame: TimeFrame): Promise {\n try {\n const dateRange: DateRange = this.getDateRange(selectedTimeFrame);\n\n const url: string = `/${this.location}/HandheldAdmin/GetTrackingData`;\n const config: AxiosRequestConfig = {\n params: {\n deviceName: selectedDevice.deviceName,\n startDate: dateRange.startDate,\n endDate: dateRange.endDate\n }\n };\n const trackingData: DeviceTrackingData[] =\n (await VatsAPI.get(url, config)).data\n .map(x => {\n x.timestamp = new Date(x.timestamp);\n return x;\n });\n\n const collection = await this.getTrackingDataCollectionFromArray(trackingData);\n\n return collection;\n } catch (ex) {\n Logger.Log(ex);\n return {};\n }\n },\n\n async getTrackingDataCollectionFromArray(data: DeviceTrackingData[]) {\n // group by deviceName\n const collection: DeviceTrackingDataCollection = data\n .reduce((g: DeviceTrackingDataCollection, dtd: DeviceTrackingData) => {\n g[dtd.deviceName] = g[dtd.deviceName] || []; // Check the value exists, if not assign a new array\n g[dtd.deviceName].push(dtd); // Push the new value to the array\n return g; // Very important! you need to return the value of g or it will become undefined on the next pass\n }, {});\n\n // order by date within each key\n for (const key in collection) {\n if (!collection.hasOwnProperty(key)) {\n continue;\n }\n\n const orderedValues = collection[key].sort((x, y) => x.timestamp > y.timestamp ? 1 : -1);\n\n collection[key] = orderedValues;\n }\n\n return collection;\n },\n\n async getMarkersFromTrackingDataCollection(dataCollection: DeviceTrackingDataCollection): Promise {\n let allDeviceMarkers: google.maps.Marker[] = [];\n\n let isCollectionTrackingDeviceMovement: boolean = false;\n for (const deviceName in dataCollection) {\n if (!dataCollection.hasOwnProperty(deviceName)) {\n continue;\n }\n\n if (dataCollection[deviceName].length > 1) {\n isCollectionTrackingDeviceMovement = true;\n break;\n }\n }\n\n for (const deviceName in dataCollection) {\n if (!dataCollection.hasOwnProperty(deviceName)) {\n continue;\n }\n\n // get the data for this device\n let data: DeviceTrackingData[] = dataCollection[deviceName];\n\n if (data.length === 0) {\n continue;\n }\n\n // order the data by timestamp (should already be sorted though)\n data = data.sort((x, y) => x.timestamp > y.timestamp ? 1 : -1);\n\n // get the markers\n let currentDeviceMarkers: google.maps.Marker[] = this.getMarkersFromDeviceTrackingData(data);\n\n // set the marker icons\n if (isCollectionTrackingDeviceMovement) {\n currentDeviceMarkers = this.setMarkerIcons(currentDeviceMarkers, TRACKING_ICON_DEFAULT, TRACKING_ICON_FIRST, TRACKING_ICON_LAST);\n }\n else {\n currentDeviceMarkers = this.setMarkerIcons(currentDeviceMarkers, DEFAULT_ICON);\n }\n\n // add the new markers to the collection\n allDeviceMarkers = allDeviceMarkers.concat(currentDeviceMarkers);\n }\n\n return allDeviceMarkers;\n },\n\n // endregion \"Get Tracking Data\"\n\n async getTrackedDevices(): Promise {\n const url = `/${this.location}/HandheldAdmin/GetTrackedDeviceList`;\n const trackedDevices = (await VatsAPI.get(url)).data;\n const allDevicesDeviceItem: TrackedDevice = {\n deviceName: 'All Devices',\n deviceID: allDevicesDeviceId\n };\n return [allDevicesDeviceItem, ...trackedDevices];\n },\n\n async getLatLngForLocation(): Promise {\n const url: string = `/${this.location}/LotMaintenance/GetLatLongForLocation`;\n const latLongString: string = (await VatsAPI.get(url)).data;\n const latLongArr: string[] = latLongString.split(',');\n const latLongObj: google.maps.LatLngLiteral = {\n lat: parseFloat(latLongArr[0]),\n lng: parseFloat(latLongArr[1])\n };\n return latLongObj;\n }\n }\n});\n\nexport default VATSTrackingAdmin;\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??ref--13-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./VATSTracking.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??ref--13-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./VATSTracking.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./VATSTracking.vue?vue&type=template&id=3bb44fd3&scoped=true&\"\nimport script from \"./VATSTracking.vue?vue&type=script&lang=ts&\"\nexport * from \"./VATSTracking.vue?vue&type=script&lang=ts&\"\nimport style0 from \"./VATSTracking.vue?vue&type=style&index=0&id=3bb44fd3&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"3bb44fd3\",\n null\n \n)\n\nexport default component.exports","import mod from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../node_modules/css-loader/index.js??ref--8-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./VATSTracking.vue?vue&type=style&index=0&id=3bb44fd3&lang=scss&scoped=true&\"; export default mod; export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../node_modules/css-loader/index.js??ref--8-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./VATSTracking.vue?vue&type=style&index=0&id=3bb44fd3&lang=scss&scoped=true&\""],"sourceRoot":""}