1(self["webpackChunkheliot_fleet_v4"]=self["webpackChunkheliot_fleet_v4"]||[]).push([[141],{5914:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return K}});var s=function(){return i(54793)},o=i.cw(function(e,t){var s=i.p+"img/driver-ic.51bca1ca.svg";e.exports=s}),n=i.cw(function(e,t){var s=i.p+"img/fast.eb6f7c5a.svg";e.exports=s}),a=function(){return i(48134)},r=function(){return i(95103)},l=function(){var e=this,t=e._self._c;return t("defaultLayout",[t("historyLayout",{on:{setCenterPath:e.setCenterPath}},[t("div",{staticClass:"google-map-toolbar"},[t("div",{staticClass:"toggle-geofence-button",on:{click:e.toggleGeofence}},[t("a-checkbox",{attrs:{checked:e.showGeofence}}),e._v(" "+e._s(e.$t("history.geofence"))+" ")],1),t("div",{staticClass:"toggle-direction-button",on:{click:e.toggleDirection}},[t("a-checkbox",{attrs:{checked:e.showDirection}}),e._v(" "+e._s(e.$t("history.direction"))+" ")],1),t("div",{staticClass:"toggle-pto-button",on:{click:e.togglePTO}},[t("a-checkbox",{attrs:{checked:e.showPTO}}),e._v(" pto ")],1)]),e.showGeofence?t("div",{staticClass:"all-position-container"},[t("h4",[e._v(e._s(e.allPositionTitle))]),e._l(e.positionList,function(i,s){return t("div",{key:`${s}`,staticClass:"position"},[t("a-badge",{attrs:{count:s+1,numberStyle:{backgroundColor:"#444444",fontSize:"1.2rem"}}}),e._v(" "+e._s(`${i.lat}, ${i.lng}`)+" ")],1)})],2):e._e(),!0===e.gmapDisplay?t("GmapMap",{key:"mapInHistoryPage",ref:"HistoryGoogleMap",style:{width:"100%",height:`calc(100% - ${e.displayPlaybackDrawer?89:0}px)`},attrs:{gestureHandling:"greedy",center:{lat:13.7460067,lng:100.5440535},zoom:this.mapZoom,"map-type-id":"roadmap",options:{zoomControl:!0,mapTypeControl:!0,scaleControl:!1,streetViewControl:!0,rotateControl:!1,fullscreenControl:!1,disableDefaultUi:!0,zoomControlOptions:{position:3},streetViewControlOptions:{position:3},clickableIcons:!0}},on:{drag:e.startDragMap,bounds_changed:e.startDragMap,idle:e.endDragMap,zoom_changed:e.zoomLevelChange}},[e._l(e.paths.marker,function(i){return[[t("gmap-custom-marker",{key:`driver-icon-${i.timestamp}`,attrs:{marker:{lat:i.lat,lng:i.lng},alignment:"center"}},[t("a-popover",[t("template",{slot:"content"},[e._v(" "+e._s(e.displayDriverName(i.licenseNo,i.driverName,e.getDriverNameByLicenseNo(i.licenseNo)))+" ")]),t("img",{staticClass:"driver-ic",style:`background-color:${i.color}`,attrs:{src:o()}})],2)],1)]]}),e.showDirection?[e._l(e.positionsDirection,function(i,s){return[!1===e.mapMoving&&e.directionShowLevel(s)&&e.directionIsInBound(i.latitude/1e7,i.longitude/1e7)?[t("gmap-custom-marker",{key:`direction-icon-${i.timestamp}`,attrs:{marker:{lat:i.latitude/1e7,lng:i.longitude/1e7},alignment:"center"}},[t("a-icon",{class:["direction-arrow",i.engineStatus],style:{transform:e.getDirectionClass(i.angle)},attrs:{type:"caret-up"}})],1)]:e._e()]})]:e._e(),e.showPTO?[e._l(e.tripTable,function(i){return[!0===e.gmapDisplay&&!1===e.mapMoving&&1===i.pto1&&e.directionIsInBound(i.latitude/1e7,i.longitude/1e7)?[t("gmap-custom-marker",{key:"pto-icon"+i.timestamp,attrs:{marker:{lat:i.latitude/1e7,lng:i.longitude/1e7},alignment:"center"}},[t("div",{staticClass:"pto-status"},[e._v("PTO1")])])]:e._e()]})]:e._e(),e.selectedPosition&&!0===e.gmapDisplay&&!1===e.mapMoving&&!1===e.isDragging?[t("gmap-custom-marker",{attrs:{marker:{lat:e.selectedPosition?e.selectedPosition.latitude/1e7:0,lng:e.selectedPosition?e.selectedPosition.longitude/1e7:0},offsetX:-20,offsetY:-20}},[t("img",{class:["device-marker","vehicle-status",e.getFilterClass(e.selectedPosition?e.selectedPosition.engineStatus:"ENGINE_STOP")],style:{transform:e.getDirectionClass(e.selectedPosition?e.selectedPosition.angle:0)},attrs:{src:r()}})])]:e._e(),!0===e.showGeofence&&!1===e.mapMoving&&e.mapZoom>=16?[e._l(e.geofencesCircle,function(i,s){return t("GmapCircle",{key:`geofence-circle-${s}`,attrs:{center:i.Positions[0],radius:i.radius,visible:e.showGeofence,options:{fillColor:"#00c246",fillOpacity:.3,strokeColor:"#00c246",strokeOpacity:.8}}})}),e._l(e.geofencesPolygon,function(i,s){return t("GmapPolygon",{key:`geofence-polygon-${s}`,attrs:{path:i.Positions,visible:e.showGeofence,options:{fillColor:"#00c246",fillOpacity:.3,strokeColor:"#00c246",strokeOpacity:.8}}})}),e._l(e.geofencesList,function(i,s){return t("gmap-custom-marker",{directives:[{name:"show",rawName:"v-show",value:e.showGeofence,expression:"showGeofence"}],key:`geofence-name-${s}`,attrs:{marker:i.Positions[0],alignment:"center"}},[t("div",{directives:[{name:"show",rawName:"v-show",value:e.showGeofence,expression:"showGeofence"}],staticClass:"geofence-name"},[e._v(" "+e._s(i.name)+" ")])])})]:e._e(),!0===e.showGeofence&&!1===e.mapMoving&&e.mapZoom<16?e._l(e.geofencesList,function(i,s){return t("gmap-marker",{key:s,attrs:{position:{lat:parseFloat(i.Positions[0].lat),lng:parseFloat(i.Positions[0].lng)},clickable:!0,draggable:!1},on:{mouseover:function(t){e.showByIndex=s},mouseout:function(t){e.showByIndex=null},click:function(t){return e.setCenterPathGeofence(i)}}},[t("gmap-info-window",{attrs:{opened:e.showByIndex===s}},[e._v(" "+e._s(e.$t("history.station"))+" "+e._s(i.name)+" ")])],1)}
1):e._e()],2):e._e()],1),t("a-modal",{attrs:{visible:e.createGeofenceModalVisible,"confirm-loading":e.saveGeofenceLoading},on:{ok:e.createGeofenceSubmit,cancel:e.cancelCreateGeofence}},[t("h2",[e._v(e._s(e.$t("history.createGeofenceFromPosition")))]),t("a-form",{attrs:{layout:"inline",form:e.form}},[t("a-row",[t("a-col",{attrs:{span:24}},[t("a-input",{attrs:{placeholder:e.$t("history.geofenceName"),maxLength:30},model:{value:e.geofenceName,callback:function(t){e.geofenceName=t},expression:"geofenceName"}})],1)],1),t("a-row",{staticStyle:{"margin-top":"10px"}},[t("a-col",{attrs:{span:24}},[t("a-input",{attrs:{type:"number","addon-before":e.$t("history.radius"),"addon-after":e.$t("history.meters"),min:10,max:500,step:10},model:{value:e.geofenceRadius,callback:function(t){e.geofenceRadius=t},expression:"geofenceRadius"}})],1)],1)],1)],1),e.showGeofence?t("a-drawer",{attrs:{placement:"bottom",closable:!1,mask:!1,visible:!0,maskClosable:!0,height:190,wrapClassName:"add-geofence-drawer",destroyOnClose:!0}},[t("div",[t("div",{staticClass:"add-position"},[t("a-row",{attrs:{type:"flex",justify:"space-around",align:"top",gutter:16}},[t("a-col",{attrs:{span:12}},[t("h2",[e._v(e._s(e.$t("history.createGeofence")))])]),t("a-col",{staticStyle:{"text-align":"right"},attrs:{span:12}},[t("a-radio-group",{staticStyle:{"margin-right":"30px"},attrs:{defaultValue:"circle",buttonStyle:"solid",readOnly:!0},on:{change:e.resetPositionList},model:{value:e.geofenceType,callback:function(t){e.geofenceType=t},expression:"geofenceType"}},[t("a-radio-button",{attrs:{value:"circle"}},[e._v(e._s(e.$t("history.circle")))]),t("a-radio-button",{attrs:{value:"polygon"}},[e._v(e._s(e.$t("history.polygon")))])],1)],1),t("a-col",{attrs:{span:10}},[t("a-row",[t("a-col",{attrs:{span:24}},[t("a-input",{staticStyle:{"margin-top":"10px"},attrs:{placeholder:e.$t("history.geofenceName")},model:{value:e.geofenceName,callback:function(t){e.geofenceName=t},expression:"geofenceName"}})],1)],1),t("a-row",[t("a-col",{attrs:{span:24}},["circle"==e.geofenceType?t("a-input",{staticStyle:{"margin-top":"10px"},attrs:{placeholder:e.$t("history.radius"),suffix:e.$t("history.meters"),readOnly:!0,size:"small"},model:{value:e.geofenceRadius,callback:function(t){e.geofenceRadius=t},expression:"geofenceRadius"}}):e._e()],1),t("a-col",{attrs:{span:24}},[t("div",{staticStyle:{"margin-top":"8px","text-align":"left"}},[t("a-button",{staticStyle:{"margin-right":"10px"},attrs:{type:"default","html-type":"submit"},on:{click:e.resetPositionList}},[e._v(e._s(e.$t("history.reset")))]),t("a-button",{staticStyle:{"margin-bottom":"10px"},attrs:{type:"primary","html-type":"submit",disabled:!e.validateGeofence,loading:e.saveGeofenceLoading},on:{click:e.saveGeofence}},[e._v(e._s(e.$t("history.saveGeofence")))])],1)])],1)],1),t("a-col",{staticStyle:{"text-align":"right"},attrs:{span:14}},[t("div",{directives:[{name:"show",rawName:"v-show",value:e.showAddPosition&&"circle"==e.geofenceType,expression:"showAddPosition && geofenceType == 'circle'"}],staticClass:"add-position-container"},[t("h4",[e._v(e._s(e.addPositionTitle))]),t("a-input",{attrs:{size:"small",readOnly:!0,placeholder:e.$t("history.latitude")},model:{value:e.clickedLat,callback:function(t){e.clickedLat=t},expression:"clickedLat"}}),t("a-input",{attrs:{size:"small",readOnly:!0,placeholder:e.$t("history.longitude")},model:{value:e.clickedLng,callback:function(t){e.clickedLng=t},expression:"clickedLng"}})],1)])],1)],1)])]):e._e()],1)},c=[],d=(i(44114),i(18111),i(7588),i(61701),i(62849)),p=i(95353),h=i(17711),g=i(36684),u=i(379),m=i(40028),y=i.n(m),f=i(65045),v=function(){var e=this,t=e._self._c;return t("div",{staticClass:"history-wrapper"},[e.isMobileDevice?e._e():t("div",{class:["drawer-slider",e.showHistoryDrawer?"in":"out"],style:{left:`${e.drawerSliderPosition}px`},on:{click:function(t){return e.setShowHistoryDrawer(!e.showHistoryDrawer)}}},[t("a-icon",{staticStyle:{color:"white"},attrs:{type:e.showHistoryDrawer?"left":"right"}})],1),t("div",{style:{backgroundColor:"#FAFAFA",width:`${e.drawerWrapperWidth}px`,height:"100vh",padding:e.showHistoryDrawer?"16px 20px":"0px 0px",overflowY:e.showHistoryDrawer?"scroll":void 0,overflowX:e.showHistoryDrawer?void 0:"hidden"}},[t("h4",{staticStyle:{"font-weight":"200"}},[e._v(e._s(e.$t("history.searchHistory")))]),t("div",{style:{display:"flex",columnGap:"10
1px",rowGap:"5px",alignItems:"center",justifyContent:"start",alignItems:"start",marginTop:"5px",flexDirection:e.isMobileDevice?"column":"row"}},[t("a-select",{staticStyle:{width:"280px","border-radius":"30px"},attrs:{showSearch:"",placeholder:e.$t("history.selectVehicle"),optionFilterProp:"children",filterOption:e.filterOption},on:{change:e.onChangeVehicle}},e._l(e.vehicles,function(i,s){return t("a-select-option",{key:`${i.id}-${s}`,attrs:{value:i.id}},[e._v(" "+e._s(i.plate_number)+" - "+e._s(i.name)+" ")])}),1),t("a-range-picker",{style:{width:e.isMobileDevice?"280px":"360px",display:"inline-block"},attrs:{allowClear:!0,placeholder:[e.$t("history.start"),e.$t("history.end")],disabled:!e.selectedVehicle,format:"D MMM YYYY HH:mm",showTime:{defaultValue:e.dateRange}},on:{change:e.onDateChange},model:{value:e.dateRange,callback:function(t){e.dateRange=t},expression:"dateRange"}})],1),t("div",{staticClass:"drawer-action"},[t("a-button",{style:{width:e.isMobileDevice?"100px":"280px"},attrs:{md:16,type:"primary",loading:e.searchLoading,disabled:e.disabledSearchButton},on:{click:e.search}},[e._v(" "+e._s(e.$t("history.search"))+" ")])],1),e.positions.length>0?t("listResultPosition"):e._e()],1),t("div",{staticClass:"content-wrapper"},[e._t("default"),e.displayPlaybackDrawer?[t("playbackDrawer")]:e._e()],2)])},w=[],b=(i(20116),i(26489)),k=i(69026),_=function(){var e=this,t=e._self._c;return t("div",{staticClass:"trips",attrs:{tabindex:"0"},on:{keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:e.onPressDown.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:e.onPressUp.apply(null,arguments)}]}},[t("div",{style:e.isMobileDevice?"width: 360px;":"width: 675px;"},[e.positions.length>0?t("div",[t("a-row",{staticClass:"card-info info-engine",staticStyle:{position:"relative"}},[t("a-col",{attrs:{span:24}},[t("a-descriptions",{attrs:{size:"small",title:"",column:3}},[t("a-descriptions-item",{attrs:{label:"",span:"3"}},[t("span",{staticStyle:{"font-weight":"300","font-size":"1.1rem"}},[t("icon-font",{staticStyle:{"padding-right":"5px"},attrs:{type:"icon-Calendar"}}),e._v(" "+e._s(e.positions.length>0&&`${e.formatDate(e.positions[0].timestamp)} ${e.$t("history.to")} ${e.formatDate(e.positions[e.positions.length-1].timestamp)}`)+" ")],1)]),t("a-descriptions-item",{attrs:{label:""}}
1,[t("icon-font",{staticStyle:{"padding-right":"5px"},attrs:{type:"icon-Iconmaterial-access-time"}}),e._v(" "+e._s(e.positions.length>0&&e.formatDuration(1e3*e.positions[e.positions.length-1].timestamp,1e3*e.positions[0].timestamp))+" "+e._s(e.$t("history.hrsMinsSecs"))+" ")],1),t("a-descriptions-item",{attrs:{label:""}},[t("icon-font",{staticStyle:{"padding-right":"5px"},attrs:{type:"icon-Iconawesome-route"}}),e._v(" "+e._s(e.positions.length>0&&e.getODODistance(this.selectedVehicle.odo_canbus_enable||this.selectedVehicle.canbus_truck_enabled,e.positions))+" "+e._s(e.$t("history.km"))+" ")],1),t("a-descriptions-item",{attrs:{label:""}},[t("icon-font",{staticStyle:{"padding-right":"5px"},attrs:{type:"icon-Iconawesome-tachometer-alt"}}),e._v(" "+e._s(e.$t("history.average"))+" "+e._s(e.positions&&e.tripAvgSpeed)+" "+e._s(e.$t("history.kmh"))+" ")],1),t("a-descriptions-item",{attrs:{label:"",span:"2"}},[t("icon-font",{staticStyle:{"padding-right":"5px"},attrs:{type:"icon-location1"}}),e._v(" "+e._s(e.positions&&e.positions[0]&&e.displayAddress(e.positions[0].location,!1))+" "+e._s(e.$t("history.to"))+" "+e._s(e.positions&&e.positions[e.positions.length-1]&&e.displayAddress(e.positions[e.positions.length-1].location,!1))+" ")],1),t("a-descriptions-item",{attrs:{label:""}}
1,[t("img",{staticStyle:{"margin-left":"-4px","margin-right":"4px","object-fit":"cover"},attrs:{src:n(),width:"19",height:"19"}}),e._v(" "+e._s(e.$t("history.maxSpeed"))+" "),t("span",{style:{color:e.displayMaxSpeed().color}},[e._v(" "+e._s(e.positions&&e.displayMaxSpeed().value)+" "+e._s(e.$t("history.kmh"))+" ")])]),t("a-descriptions-item",{attrs:{label:"",span:"2"}},[t("icon-font",{staticStyle:{"padding-right":"5px"},attrs:{type:"icon-drivers-license"}}),e._v(" "+e._s(e.mcr_license_no?e.displayDriverName(e.mcr_license_no,e.mcr_driver_name,e.getDriverNameByLicenseNo(e.mcr_license_no)):e.$t("history.noCardSwipeData"))+" ")],1)],1)],1),t("div",{staticStyle:{position:"absolute",right:"0",bottom:"0"}},[t("a-button",{attrs:{loading:e.reportLoading},on:{click:e.downloadTripReport}},[t("icon-font",{staticStyle:{"padding-right":"5px"},attrs:{type:"icon-Excel"}}),e._v(e._s(e.$t("history.downloadReport"))+" ")],1)],1)],1),t("div",[t("ve-table",{ref:"tableRef",staticClass:"trip-table-row",staticStyle:{"margin-top":"15px"},attrs:{"scroll-width":e.getWithByColEnabled(),columns:e.isMobileDevice?e.columnsMobile:e.columns,"table-data":e.tripTableWrapper(),"max-height":"calc(100vh - 320px)","virtual-scroll-option":e.virtualScrollOption,"event-custom-option":e.eventCustomOption,"expand-option":e.expandOption,rowStyleOption:e.rowStyleOption,cellSelectionOption:e.cellSelectionOption,rowKeyFieldName:"key"}})],1)],1):e._e()])])},P=[],S=i(25979),x=i(67182),D=i(43959),$={components:{IconFont:S.rP},data(){const e=this.$createElement;return{mcr_license_no:"",mcr_driver_name:"",cellSelectionOption:{enable:!1},rowStyleOption:{clickHighlight:!0,hoverHighlight:!0},virtualScrollOption:{enable:!0,minRowHeight:25},eventCustomOption:{bodyRowEvents:({row:e})=>({click:()=>this.tripTableRowClick(e)})},expandOption:{render:({row:t})=>e("div",{style:"background-color:#f5f7fa; padding:5%;margin:0"},[e("div",{class:"expandable-row"},[e("div",[this.$t("history.location"),":"])," ",t.location]),(this.setting.columnPTODisplay||void 0===this.setting.columnPTODisplay)&&e("div",{class:"expandable-row"},[e("div",["PTO: "]),e("div",[e("span",{class:`${this.getPTOStatusClass(t["pto1"])} pto-status`},["P1"]),e("span",{class:`${this.getPTOStatusClass(t["pto2"])} pto-status`},["P2"]),e("span",{class:`${this.getPTOStatusClass(t["pto3"])} pto-status`},["P3"])])]),(this.setting.columnTempDisplay||void 0===this.setting.columnTempDisplay)&&e("div",{class:"expandable-row"},[e("div",["TEMP:"]),t["temp"]]),(this.setting.columnTemp2Display||void 0===this.setting.columnTempDisplay)&&e("div",{class:"expandable-row"},[e("div",["TEMP2: "])," ",t["temp2"]]),this.setting.columnDriverDisplay&&e("div",{class:"expandable-row"},[e("div",[this.$t("history.driver"),":"]),""!==t.licenseNo?this.displayDriverName(t.licenseNo,t.driverName,this.getDriverNameByLicenseNo(t.licenseNo)):"-"]),this.setting.columnCardStatusDisplay&&e("div",{class:"expandable-row"},[e("div",[this.$t("history.cardSwipe"),":"]),t["cardStatus"]||"-"])])},columns:[],columnsMobile:[]}},computed:{...(0,p.aH)({reportLoading:e=>e.loading.reportLoading,positions(e){if(this.mcr_license_no="",e.position.positions.length>0){let t;for(t=e.position.positions.length-1;t>0;t--){const i=e.position.positions[t].mcr_license_no;if(i&&"null"!=i&&""!=i){this.mcr_license_no=e.position.positions[t].mcr_license_no;break}}for(t=e.position.positions.length-1;t>0;t--){const i=e.position.positions[t].mcr_driver_name;if(i&&"null"!=i&&""!=i){this.mcr_driver_name=e.position.positions[t].mcr_driver_name;break}}}return e.position.positions},selectedPositionIndex:e=>e.history.selectedPositionIndex,selectedVehicle:e=>e.history.selectedVehicle,selectedGroup:e=>e.authen.selectedGroup,setting:e=>e.authen.setting,drivers:e=>e.driver.drivers,geofences:e=>e.geofence.geofences}),...(0,p.L8)({tripAvgSpeed:"position/avgSpeed",tripMaxSpeed:"position/maxSpeed",tripTable:"position/tripTable",driverByLicenseNo:"driver/driverByLicenseNo",vehicleByIMEI:"vehicle/vehicleByIMEI"}),isMobileDevice(){return b.isMobile},selectedRowTable(){return this.selectedPositionIndex>=0?this.tripTable[Math.floor(this.selectedPositionIndex)]:void 0}},async mounted(){const e=this.$createElement;this.drivers.length<=0&&await this.getAllDrivers([this.selectedGroup.id]),this.geofences.length<=0&&await this.getAllGeofences([this.selectedGroup.id]),this.columnsMobile=[{field:"",key:"a",align:"center",width:30,type:"exp
1and",operationColumn:!0},{field:"key",key:"index",title:this.$t("history.rowNo"),align:"center",width:40},{title:this.$t("history.time"),field:"timestamp",key:"timestamp",fixed:"left"},{title:this.$t("history.status"),field:"engineStatus",key:"engineStatus",renderBodyCell:({row:t,column:i})=>{let s=t[i.field],o=`${s} engine-status`;return e("div",{class:o},["OVER_SPEED"==s?this.$t("history.overspeed"):t["engineStatusTranslated"]])}},{title:this.$t("history.kmh"),field:"speed",key:"speed"}],this.columns=[{field:"key",key:"index",title:this.$t("history.rowNo"),align:"center",width:24,operationColumn:!0,fixed:"left"},{title:this.$t("history.time"),field:"timestamp",key:"timestamp",width:95,fixed:"left"},{title:this.$t("history.status"),field:"engineStatus",key:"engineStatus",width:50,fixed:"left",renderBodyCell:({row:t,column:i})=>{let s=t[i.field],o=`${s} engine-status`;return e("div",{class:o},["OVER_SPEED"==s?this.$t("history.overspeed"):t["engineStatusTranslated"]])}},{title:this.$t("history.kmh"),field:"speed",key:"speed",width:34,fixed:"left",renderBodyCell:({row:e,column:t})=>parseInt(e[t.field]).toFixed(0)},{title:this.$t("history.location"),field:"location",key:"location",width:140},{title:"",field:"gmap",key:"gmap",width:40,renderBodyCell:({row:t})=>e("span",{class:"google-map-link"},[e("a",{attrs:{href:`http://maps.google.com/maps?q=loc:${t.latitude/1e7},${t.longitude/1e7}`,target:"_blank"}},[e("a-icon",{attrs:{type:"google"}})," Map"])])}],(void 0===this.setting.columnPTODisplay||this.setting.columnPTODisplay)&&this.columns.push({title:"PTO",field:"pto",key:"pto",width:60,renderBodyCell:({row:t})=>e("div",[e("span",{class:`${this.getPTOStatusClass(t["pto1"])} pto-status`},["P1"]),e("span",{class:`${this.getPTOStatusClass(t["pto2"])} pto-status`},["P2"]),e("span",{class:`${this.getPTOStatusClass(t["pto3"])} pto-status`},["P3"])])}),(void 0===this.setting.columnTempDisplay||this.setting.columnTempDisplay)&&this.columns.push({title:"TEMP",field:"temp",key:"temp",width:30}),void 0===this.setting.columnTemp2Display|this.setting.columnTemp2Display&&this.columns.push({title:"TEMP2",field:"temp2",key:"temp2",width:30}),this.columns.push({title:this.$t("history.distance"),field:"accOdometer",key:"accOdometer",width:50}),this.setting.columnDriverDisplay&&this.columns.push({title:this.$t("history.driver"),field:"driver",key:"driver",width:170,renderBodyCell:({row:t})=>e("div",[""!==t.licenseNo?this.displayDriverName(t.licenseNo,t.driverName,this.getDriverNameByLicenseNo(t.licenseNo)):"-"])}),this.setting.columnCardStatusDisplay&&this.columns.push({title:this.$t("history.cardSwipe"),field:"cardStatus",key:"cardStatus",width:50}),this.setting.columnCanbusDisplay&&(this.columns.push({title:"Coolant",field:"coolant",key:"coolant",width:30}),this.columns.push({title:"FuelRate",field:"fuelrate",key:"fuelrate",width:35}),this.columns.push({title:"EngineHr",field:"enginehour",key:"enginehour",width:35}),this.columns.push({title:"RPM",field:"enginespeed",key:"enginespeed",width:30}),this.columns.push({title:"FuelUsed",field:"fuelused",key:"fuelused",width:35}),this.columns.push({title:"Pedal",field:"pedalposition",key:"pedalposition",width:30}))},watch:{selectedRowTable(e){e?(this.$refs["tableRef"].setHighlightRow({rowKey:e.key}),this.$refs["tableRef"].scrollToRowKey({rowKey:e.key})):this.$refs["tableRef"].setHighlightRow({rowKey:0})}},methods:{...(0,p.i0)({setReportLoading:"loading/setReportLoading",getAllDrivers:"driver/getAllDrivers",getAllGeofences:"geofence/getAllGeofences",setSelectedPositionIndex:"history/setSelectedPositionIndex",setPlaybackValueByTimestamp:"history/setPlaybackValueByTimestamp"}),getWithByColEnabled(){if(this.isMobileDevice)return 355;{let e=520;return void 0!==this.setting.columnDriverDisplay&&this.setting.columnDriverDisplay&&(e+=190),(this.setting.columnPTODisplay||void 0===this.setting.columnPTODisplay)&&(e+=150),void 0!==this.setting.columnCanbusDisplay&&this.setting.columnCanbusDisplay&&(e+=480),this.setting.columnDetailedLocationDisplay&&(e+=300),e}},getODODistance(e,t){return(0,x.Gx)(e,t)},getDriverNameByLicenseNo(e){return this.driverByLicenseNo(e)},tripTableWrapper(){let e=JSON.parse(JSON.stringify(this.tripTable));if(void 0===this.setting.columnCanbusDisplay||this.setting.columnCanbusDisplay){const t=parseFloat(this.selectedVehicle.device.imei),i=this.vehicleByIMEI(t);for(const s in e)e[s]["coolant"]=(0,f.VK)(i,e[s].io),e[s]["fuelrate"]=(0,f.HY)(i,e[s].io),e[s]["enginehour"]=(0,f.n7)(i,e[s].io),e[s]["enginespeed"]=(0,f.wI)(i,e[s].io),e[s]["fuelused"]=(0,f.AD)(i,e[s].io),e[s]["pedalposition"]=(0,f.EJ)(i,e[s].io)}for(const t in e){const i=e[t].location;e[t].location=this.displayAddress(i,!0)}return e},formatDate(e){return(0,k.A)(1e3*e).format("D MMM YYYY HH:mm:ss")},formatDuration(e,t){const i=k.A.duration((0,k.A)(e).diff((0,k.A)(t)));return`${i.get("hours")}:${i.get("minutes")}:${i.get("seconds")}`},getPTOStatusClass(e){return 1==e?"ON":"OFF"},async tripTableRowClick(e){this.$gtag.event("history_vehicle-position_displayed");const t=this.tripTable.findIndex(t=>t.key===e.key);this.setSelectedPositionIndex(t),this.setPlaybackValueByTimestamp(this.positions[t].timestamp)},displayDriverName(e,t,i){const s={device:{position:{mcr_driver_name:t,mcr_license_no:e}}};return(0,f.EX)(!0,s,i)},async downloadTripReport(){this.$gtag.event("history_report-download_clicked"),this.setReportLoading(!0),await D.Ay.positionReport([{plate:this.selectedVehicle.plate_number,odo_canbus_offset:this.selectedVehicle.odo_canbus_offset,canbus_fuel_enable:this.selectedVehicle.canbus_fuel_enable,canbus_truck_enabled:this.selectedVehicle.canbus_truck_enabled,odo_canbus_enable:this.selectedVehicle.odo_canbus_enable,imei:this.selectedVehicle.device?parseFloat(this.selectedVehicle.device.imei):""}],[parseFloat(this.selectedVehicle.device.imei)],(0,k.A)(1e3*this.positions[0].timestamp).unix(),(0,k.A)(1e3*this.positions[this.positions.length-1].timestamp).unix(),0,this.geofences),this.setReportLoading(!1)},onPressUp(){if(this.selectedPositionIndex>0){const e=this.selectedPositionIndex-1;this.setSelectedPositionIndex(e),this.setPlaybackValueByTimestamp(this.positions[e].timestamp)}},onPressDown(){let e=0;this.selectedPositionIndex<this.tripTable.length-1?(e=this.selectedPositionIndex+1,this.setSelectedPositionIndex(e)):this.setSelectedPositionIndex(e),this.setPlaybackValueByTimestamp(this.positions[e].timestamp)},displayAddress(e,t){let i="";return i=e.geofenceName&&""!==e.geofenceName?e.geofenceName:t&&this.setting.columnDetailedLocationDisplay?e.detailedAddress:e.address,i&&""!==i?i:"-"},displayMaxSpeed(){let e="";return"overspeed_limit"in this.selectedVehicle&&this.tripMaxSpeed>=this.selectedVehicle.overspeed_limit&&(e="violet"),{color:e,value:this.tripMaxSpeed||"0.00"}}}},C=$,M=i(81656),T=(0,M.A)(C,_,P,!1,null,"5f6cd606",null),L=T.exports,G=function(){var e=this,t=e._self._c;
1return t("div",{staticClass:"drawer-wrapper"},[t("div",{staticClass:"playback-controller"},[t("img",{staticStyle:{cursor:"pointer"},attrs:{src:i(97783)(`./playback_${e.isPlay?"stop":"play"}.svg`),width:"32",height:"32"},on:{click:e.onClickPlay}}),t("img",{staticStyle:{cursor:"pointer"},attrs:{src:a(),width:"32",height:"32"},on:{click:e.onClickClear}})]),t("div",{ref:"container",staticClass:"playback-container",on:{mouseup:e.stopDragging,mouseleave:e.stopDragging,mousemove:e.drag}},[t("div",{staticClass:"time-indicator-triangle",style:{left:`calc(${e.currentX}px - 7px)`,top:"0px"},on:{mousedown:e.startDragging}}),t("div",{ref:"timeIndicator",staticClass:"time-indicator",style:{left:`${e.currentX}px`,top:"0px"},on:{mousedown:e.startDragging}}),e._l(e.graphs,function(i,s){return[t("div",{key:`pos_${s}`,style:{position:"absolute",height:"100%",borderRadius:"4px",width:`${e.getStatusBarWidth(i.start,i.stop)}px`,left:`${e.getStatusBarStartPoint(i.start)}px`,backgroundColor:e.getGraphColorByStatus(i.status)}})]})],2)])},O=[];function I(e,t){let i=-1;if(!e||0===e.length)return i;for(let s=0;s<e.length;s++){const o=e[s],n=o.timestamp-t;if(!(n<=0))break;i=s}return i}function N({initialX:e,initialY:t,currentX:i,currentY:s}){return Math.abs((s-t)/(i-e))}let R=null;var B={name:"playbackDrawer",data(){return{containerSize:0,xOffset:0,currentX:0,graphs:[],xAxis:[],isPlay:!1}},watch:{playbackValue(e){this.currentX=e>-1?e:0}
1,containerSize(){const e=this.mSlope,t=this.getMSlope();this.setPlaybackValue(e*this.playbackValue/t),this.setMSlope(t)},showHistoryDrawer(){this.calculateContainerSize()},mSlope(){this.calculateGraphMapping()},positions(){this.setMSlope(this.getMSlope())}},computed:{...(0,p.aH)({initialTimestamp:e=>e.history.initialTimestamp,mSlope:e=>e.history.mSlope,playbackValue:e=>e.history.playbackValue,isDragging:e=>e.history.isDragging,showHistoryDrawer:e=>e.history.showHistoryDrawer,selectedPositionIndex:e=>e.history.selectedPositionIndex,positions:e=>e.position.positions})},mounted(){window.addEventListener("resize",this.calculateContainerSize),this.calculateContainerSize(),this.setMSlope(this.getMSlope())},beforeDestroy(){window.removeEventListener("resize",this.calculateContainerSize)},methods:{...(0,p.i0)({setIsDragging:"history/setIsDragging",setSelectedPositionIndex:"history/setSelectedPositionIndex",setMSlope:"history/setMSlope",setPlaybackValue:"history/setPlaybackValue"}),getTimeString(e){return k.A.unix(e).format("D MMM YYYY HH:mm:ss")},getGraphColorByStatus(e){return"OVER_SPEED"===e?"violet":"ENGINE_STOP"===e?"#f5223e":"ENGINE_IDLE"===e?"#faad14":"#00c246"},calculateContainerSize(){const e=this.$refs.container.getBoundingClientRect(),t=this.$refs.timeIndicator.getBoundingClientRect();this.containerSize=Math.round(e.width-t.width)},calculateGraphInfo(e){const t=[];let i,s;return e.forEach((o,n)=>{let a=o.engineStatus;0===n?(i=a,s=o.timestamp):a!==i&&(t.push({start:s,stop:o.timestamp,status:i}),i=a,s=o.timestamp),n===e.length-1&&t.push({start:s,stop:o.timestamp,status:i})}),Array.from(t)},calculateGraphMapping(){this.xAxis=Array.from(new Array(this.containerSize+1),(e,t)=>{const i=this.mSlope*t+this.initialTimestamp;return[i,I(this.positions,i)]}),this.graphs=this.calculateGraphInfo(this.positions)},getMSlope(){const e=this.positions[this.positions.length-1].timestamp;return N({initialX:0,currentX:this.containerSize,initialY:this.initialTimestamp,currentY:e})},getStatusBarWidth(e,t){return t/this.mSlope-e/this.mSlope},getStatusBarStartPoint(e){return(e-this.initialTimestamp)/this.mSlope},startDragging(e){this.xOffset=e.clientX-this.currentX,this.setIsDragging(!0)},drag(e){if(this.isDragging){e.preventDefault(),this.currentX=e.clientX-this.xOffset;const t=this.$refs.container.getBoundingClientRect(),i=this.$refs.timeIndicator.getBoundingClientRect();this.currentX=Math.max(0,Math.min(this.currentX,t.width-i.width))}},stopDragging(){this.setIsDragging(!1),this.setPlaybackValue(this.currentX);const e=this.xAxis[Math.floor(this.currentX)];if(e){const t=e[1];this.setSelectedPositionIndex(t)}},onClickPlay(){R?(clearInterval(R),R=null):R=setInterval(()=>{this.setPlaybackValue(this.playbackValue+3);const e=this.xAxis[Math.floor(this.playbackValue)];if(e){const t=e[1];this.setSelectedPositionIndex(t)}},1e3),this.isPlay=!this.isPlay},onClickClear(){R&&(clearInterval(R),R=null),this.isPlay=!1,this.setPlaybackValue(-1)}}},V=B,A=(0,M.A)(V,G,O,!1,null,"a9ca0d44",null),E=A.exports,H=i(19619),F={components:{playbackDrawer:E,listResultPosition:L},data(){return{dateRange:[(0,k.A)().hour(0).minute(0).second(0).millisecond(0),(0,k.A)().hour(23).minute(59).second(59).millisecond(999)],searchLoading:!1}},computed:{...(0,p.aH)({isDragging:e=>e.history.isDragging,showHistoryDrawer:e=>e.history.showHistoryDrawer,selectedVehicle:e=>e.history.selectedVehicle,positions:e=>e.position.positions,selectedGroup:e=>e.authen.selectedGroup}),...(0,p.L8)({vehicles:"vehicle/vehicles"}),isMobileDevice(){return b.isMobile},drawerWrapperWidth(){return this.showHistoryDrawer?this.isMobileDevice?405:720:0},drawerSliderPosition(){if(this.drawerWrapperWidth>0){const e=26;return this.drawerWrapperWidth-e}return 0},displayPlaybackDrawer(){return this.positions.length>0},disabledSearchButton(){return!this.selectedVehicle}},methods:{...(0,p.i0)({setPositions:"position/setPositions",setShowHistoryDrawer:"history/setShowHistoryDrawer",setSelectedVehicle:"history/setSelectedVehicle",setInitialTimestamp:"history/setInitialTimestamp",setPlaybackValue:"history/setPlaybackValue",resetPlaybackState:"history/resetPlaybackState"}),filterOption(e,t){return t.componentOptions.children[0].text.toLowerCase().indexOf(e.toLowerCase())>=0},onDateChange(e){this.dateRange&&this.dateRange.length>0&&this.dateRange[0].unix()==this.dateRange[1].unix()&&this.dateRange[0].subtract(1,"d").unix(),this.dateRange=e},onChangeVehicle(e){const t=this.vehicles.find(t=>
1t.id===e);this.setSelectedVehicle(t)},async search(){this.searchLoading=!0,this.$gtag.event("history_search_clicked");const e=await(0,H.OY)({imei:this.selectedVehicle.device.imei,start:this.dateRange[0].unix(),stop:this.dateRange[1].unix(),customergroup:this.selectedGroup.id,overspeed:this.selectedVehicle.overspeed_limit});await this.resetPlaybackState(),e&&e.length>0?(await this.setInitialTimestamp(e[0].timestamp),await this.setPositions(e),this.$emit("setCenterPath")):(await this.setPositions([]),this.$message.warning(this.$t("history.positionNotFound"),5)),this.searchLoading=!1}}},Y=F,z=(0,M.A)(Y,v,w,!1,null,"803ff0fc",null),W=z.exports;const X=s();var j={name:"history",components:{defaultLayout:d.A,"gmap-custom-marker":g.A,historyLayout:W},data(){return{measureToolIsEnable:!1,showByIndex:null,selectedShape:null,drawingManager:null,positionList:[],clickedLat:"",clickedLng:"",geofenceType:"circle",geofenceName:"",geofenceRadius:200,boundRect:[],showBoundryGeofence:!1,mapMoving:!1,mapZoom:12,path2:[{lat:1.33,lng:103.75},{lat:1.43,lng:103.85}],createGeofenceModalVisible:!1,form:this.$form.createForm(this,{name:"createGeofenceForm"}),showGeofence:!1,showDirection:!1,showPTO:!1,geofencesCircle:[],geofencesPolygon:[],geofencesList:[],gmapDisplay:!0,gmapRoutelines:[],measureTool:null}},computed:{...(0,p.aH)({google:u.gmapApi,selectedGroup:e=>e.authen.selectedGroup,user:e=>e.authen.user,saveGeofenceLoading:e=>e.loading.saveGeofenceLoading,positions:e=>e.position.positions,geofenceData:e=>e.geofence.geofences,isDragging:e=>e.history.isDragging,selectedPositionIndex:e=>e.history.selectedPositionIndex}),...(0,p.L8)({vehicles:"vehicle/vehicles",paths:"position/historyPath",positionsDirection:"position/direction",tripTable:"position/tripTable",driverByLicenseNo:"driver/driverByLicenseNo"}),selectedPosition(){return this.selectedPositionIndex>=0?this.tripTable[Math.floor(this.selectedPositionIndex)]:void 0},allPositionTitle(){return"circle"==this.geofenceType?this.positionList.length>0?this.$t("history.geofenceCenter"):"":(console.log(this.geofenceType,this.positionList.length),this.positionList.length>0?this.$t("history.allPositions"):this.$t("history.clickToAddPosition"))},addPositionTitle(){return"circle"==this.geofenceType?this.$t("history.centerPosition"):this.$t("history.addNewPosition")},showAddPosition(){return!("circle"==this.geofenceType&&this.positionList.length>0)&&!("polygon"==this.geofenceType&&this.positionList.length>=20)},validateGeofence(){return!(this.geofenceName.length<0)&&(!(this.positionList.length<=0)&&(!("polygon"==this.geofenceType&&this.positionList.length<3)&&("circle"!=this.geofenceType||!(this.geofenceRadius.length<0||isNaN(this.geofenceRadius)||this.geofenceRadius<=0))))},displayPlaybackDrawer(){return this.positions.length>0}},mounted(){let e=this;this.vehicles.length<=0&&(0,h.kw)(e.user.customer_groups.map(e=>e._id)),this.setBoundOfMap(),this.$refs.HistoryGoogleMap.$mapPromise.then(t=>{e.measureTool=new(y())(t,{contextMenu:!0}),e.measureTool.addListener("measure_start",function(){e.measureToolIsEnable=!0}),e.measureTool.addListener("measure_end",function(){e.measureToolIsEnable=!1})})},beforeDestroy(){this.measureTool=null,this.resetPositionState(),this.resetVehicleState(),this.resetHistoryState()},methods:{...(0,p.i0)({getAllGeofences:"geofence/getAllGeofences",selectPosition:"position/selectPosition",setSaveGeofenceLoading:"loading/setSaveGeofenceLoading",resetGeofenceState:"geofence/resetState",createGeofence:"geofence/createGeofence",resetVehicleState:"vehicle/resetState",resetPositionState:"position/resetState",setSelectedPositionIndex:"history/setSelectedPositionIndex",setPlaybackValueByTimestamp:"history/setPlaybackValueByTimestamp",resetHistoryState:"history/resetHistoryState"}),resetPositionList(){this.geofenceName="",this.geofenceRadius=0,this.positionList=[],this.selectedShape&&(this.selectedShape.setMap(null),this.selectedShape.setEditable(!1))},directionIsInBound(e,t){const i=X.isPointInPolygon({latitude:e,longitude:t},this.boundRect);return i},directionShowLevel(e){return this.mapZoom>=13||(this.mapZoom>10&&this.mapZoom<13?e%3===0:this.mapZoom>0&&this.mapZoom<=10&&e%6===0)},lineClick(e){if(!this.measureToolIsEnable){let t=e.latLng.lat(),i=e.latLng.lng();const s=X.findNearest({latitude:t,longitude:i},this.tripTable.map(e=>
1({index:e.key-1,latitude:e.latitude/1e7,longitude:e.longitude/1e7})));this.setSelectedPositionIndex(s.index),this.setPlaybackValueByTimestamp(this.positions[s.index].timestamp)}},loadMapDrawingManager(){let e=this;this.$refs.HistoryGoogleMap.$mapPromise.then(()=>{e.drawingManager=new window.google.maps.drawing.DrawingManager({drawingControl:!0,drawingControlOptions:{position:window.google.maps.ControlPosition.TOP_CENTER,drawingModes:[window.google.maps.drawing.OverlayType.POLYGON,window.google.maps.drawing.OverlayType.CIRCLE]},polygonOptions:{fillColor:"#0099FF",fillOpacity:.2,strokeColor:"#AA2143",strokeWeight:4,editable:!0},circleOptions:{fillColor:"#ffff00",fillOpacity:.2,strokeWeight:3,clickable:!1,editable:!0,zIndex:1}}),e.drawingManager.setMap(this.$refs.HistoryGoogleMap.$mapObject),window.google.maps.event.addListener(e.drawingManager,"drawingmode_changed",function(){"circle"===e.drawingManager.drawingMode?e.geofenceType="circle":"polygon"===e.drawingManager.drawingMode&&(e.geofenceType="polygon")}),window.google.maps.event.addListener(e.drawingManager,"overlaycomplete",function(t){if(e.drawingManager.setDrawingMode(null),t.type!==window.google.maps.drawing.OverlayType.MARKER){let i=t.overlay;i.type=t.type,window.google.maps.event.addListener(i,"click",function(){e.selectedShape=i}),e.selectedShape=i}if("polygon"===t.type){let i=t.overlay.getPath().getArray();e.positionList=[];let s=[];i.forEach(t=>{const i=parseFloat(t.lat().toFixed(6)),o=parseFloat(t.lng().toFixed(6)),n=new window.google.maps.LatLng(i,o);s.push(n),e.positionList.push({lat:i,lng:o})}),t.overlay.setMap(null),e.createPolygon(s)}else if("circle"===t.type){let i=[t.overlay.center.lat(),t.overlay.center.lng()],s=t.overlay.radius;t.overlay.setMap(null),e.drawingManager.setDrawingMode(null),e.geofenceRadius=parseInt(s.toFixed(0)),e.clickedLat=parseFloat(t.overlay.center.lat().toFixed(6)),e.clickedLng=parseFloat(t.overlay.center.lng().toFixed(6)),e.positionList[0]={lat:e.clickedLat,lng:e.clickedLng},e.createCircle(i,s)}})})},createPolygon(e){let t=this;this.$refs.HistoryGoogleMap.$mapPromise.then(i=>{var s=new window.google.maps.Polygon({paths:e,fillColor:"#ffff00",fillOpacity:.2,strokeWeight:3,draggable:!0,editable:!0});console.log("path",e,s,i),s.setMap(i),t.selectedShape=s})},createCircle(e,t){let i=this;this.$refs.HistoryGoogleMap.$mapPromise.then(s=>{var o=new window.google.maps.Circle({fillColor:"#ffff00",fillOpacity:.2,strokeWeight:3,draggable:!0,editable:!0,map:s,center:{lat:parseFloat(e[0]),lng:parseFloat(e[1])},radius:t});window.google.maps.event.addListener(o,"radius_changed",function(){i.geofenceRadius=parseInt(o.getRadius().toFixed(0))}),window.google.maps.event.addListener(o,"center_changed",function(){i.clickedLat=parseFloat(o.getCenter().lat().toFixed(6)),i.clickedLng=parseFloat(o.getCenter().lng().toFixed(6)),i.positionList[0]={lat:i.clickedLat,lng:i.clickedLng}}),i.selectedShape=o})},getDirectionClass(e){const t=e/100;return`rotate(${t}deg)`},setCenterPath(){this.$refs.HistoryGoogleMap.$mapPromise.then(e=>{let t=new window.google.maps.LatLngBounds;this.paths.position.forEach(e=>{e.path.forEach(e=>{t.extend(e)})}),e.fitBounds(t),e.panTo(t.getCenter())})},setCenterPathGeofence(e){"circle"==e.type?this.$refs.HistoryGoogleMap.$mapPromise.then(t=>{const i=new window.google.maps.Circle({map:t,radius:e.radius,center:{lat:parseFloat(e.Positions[0].lat),lng:parseFloat(e.Positions[0].lng)},fillColor:"#fff",fillOpacity:0,strokeColor:"#fff",strokeOpacity:0});var s=new window.google.maps.LatLngBounds;s.union(i.getBounds()),t.fitBounds(s),t.panTo(i.getBounds().getCenter())}):this.$refs.HistoryGoogleMap.$mapPromise.then(t=>{let i=new window.google.maps.LatLngBounds;for(let s=0;s<e.Positions.length;s++)i.extend(e.Positions[s]);t.fitBounds(i),t.panTo(i.getCenter()),t.setZoom(17)})},getFilterClass(e){return"VEHICLE_MOVING"==e?"running":"ENGINE_IDLE"==e?"idle":"OVER_SPEED"==e?"overspeed":"stop"},async toggleGeofence(){this.$gtag.event("history_google-map-geofences_dis
1played"),this.showGeofence=!this.showGeofence,this.showGeofence?(this.geofenceData.length<=0&&await this.getAllGeofences([this.selectedGroup.id]),this.setGeofenceData(),this.loadMapDrawingManager()):this.drawingManager.setMap(null)},toggleDirection(){this.$gtag.event("history_google-map-direction_displayed"),this.showDirection=!this.showDirection},togglePTO(){this.$gtag.event("history_google-map-PTO_displayed"),this.showPTO=!this.showPTO},async createGeofenceSubmit(){if(!(this.selectedPosition&&this.geofenceName.length>0&&this.geofenceRadius>0))return void this.$notification["error"]({message:this.$t("history.invalidGeofenceData"),description:this.$t("history.checkGeofenceData")});this.setSaveGeofenceLoading(!0);let e={type:"Point",coordinates:[this.selectedPosition.longitude/1e7,this.selectedPosition.latitude/1e7]};await this.createGeofence({name:this.geofenceName,type:"circle",radius:parseFloat(this.geofenceRadius),org:this.selectedGroup.id,positions:[{lat:this.selectedPosition.latitude/1e7,lng:this.selectedPosition.longitude/1e7}],geojson:e}).then(async e=>{e?(this.setSaveGeofenceLoading(!1),this.geofenceName="",this.geofenceRadius=0,this.createGeofenceModalVisible=!1,await this.getAllGeofences([this.selectedGroup.id]),this.$notification["success"]({message:this.$t("history.geofenceSavedSuccess"),description:this.$t("history.geofenceSavedDescription")})):(this.$notification["error"]({message:this.$t("history.errorOccurred"),description:this.$t("history.cannotSaveGeofence")}),this.setSaveGeofenceLoading(!1))}).catch(e=>{console.log(e),this.$notification["error"]({message:this.$t("history.errorOccurred"),description:this.$t("history.cannotSaveGeofence")}),this.setSaveGeofenceLoading(!1)})},cancelCreateGeofence(){this.createGeofenceModalVisible=!1},setGeofenceData(){this.geofencesCircle=[],this.geofencesPolygon=[],this.geofencesList=[];let e=[],t=[],i=[];this.$nextTick(()=>{if(!0===this.showGeofence){for(const s in this.geofenceData){const o=this.geofenceData[s];let n=!1;if(this.boundRect.length>0)if("polygon"==o.type){let e=X.getCenterOfBounds(o.Positions);n=X.isPointInPolygon({latitude:e.latitude,longitude:e.longitude},this.boundRect)}else n=X.isPointInPolygon({latitude:o.Positions[0].lat,longitude:o.Positions[0].lng},this.boundRect);else n=!0;n&&("circle"==o.type?t.push(o):"polygon"==o.type&&i.push(o),e.push(o))}this.geofencesList=e,this.geofencesPolygon=i,this.geofencesCircle=t}})},setBoundOfMap(){if(this.$refs.HistoryGoogleMap&&this.$refs.HistoryGoogleMap.$mapObject){const e=this.$refs.HistoryGoogleMap.$mapObject.getBounds().getNorthEast(),t=this.$refs.HistoryGoogleMap.$mapObject.getBounds().getSouthWest
1(),i=e.lat(),s=e.lng(),o=t.lat(),n=t.lng(),a=[{latitude:i,longitude:s},{latitude:i,longitude:n},{latitude:o,longitude:n},{latitude:o,longitude:s}];this.boundRect=a}},startDragMap(){this.mapMoving=!0},endDragMap(){this.setBoundOfMap(),!0===this.mapMoving&&(this.mapMoving=!1,this.setGeofenceData())},async saveGeofence(){this.setSaveGeofenceLoading(!0);let e={};e="circle"==this.geofenceType?{type:"Point",coordinates:[parseFloat(this.positionList[0].lng),parseFloat(this.positionList[0].lat)]}:{type:"Polygon",coordinates:[this.positionList.map(e=>[parseFloat(e.lng),parseFloat(e.lat)])]},await this.createGeofence({name:this.geofenceName,type:this.geofenceType,radius:parseFloat(this.geofenceRadius),org:this.selectedGroup.id,positions:this.positionList,geojson:e}).then(e=>{e?(this.resetPositionList(),this.getAllGeofences([this.selectedGroup.id]).then(()=>{this.setGeofenceData()}),this.$message.success(this.$t("history.geofenceSaveSuccess"),5)):this.$message.warning(this.$t("history.geofenceSaveError"),5)}).catch(e=>{console.log(e),this.$message.warning(this.$t("history.geofenceSaveError"),5)}),await this.setSaveGeofenceLoading(!1)},zoomLevelChange(e){this.mapZoom=e;let t=this;setTimeout(()=>{t.showBoundryGeofence=e>=16},1e3)},displayDriverName(e,t,i){const s={device:{position:{mcr_driver_name:t,mcr_license_no:e}}};return(0,f.EX)(!0,s,i)},getDriverNameByLicenseNo(e){return this.driverByLicenseNo(e)}},watch:{selectedPosition:function(e){this.$refs.HistoryGoogleMap&&e&&e.latitude&&e.longitude&&this.$refs.HistoryGoogleMap.$mapPromise.then(t=>{t.setCenter(new window.google.maps.LatLng(e.latitude/1e7,e.longitude/1e7))})},paths(e){this.gmapRoutelines.length>0&&this.gmapRoutelines.forEach(e=>e.setMap(null)),this.gmapRoutelines=[],e.position.forEach(e=>{const t=new window.google.maps.Polyline({path:e.path,strokeColor:e.lineColor,strokeWeight:3});window.google.maps.event.addListener(t,"click",this.lineClick),t.setMap(this.$refs.HistoryGoogleMap.$mapObject),this.gmapRoutelines.push(t)})}}},Z=j,U=(0,M.A)(Z,l,c,!1,null,"47451c0b",null),K=U.exports},19619:function(e,t,i){"use strict";i.d(t,{OY:function(){return a},Wy:function(){return r},Yq:function(){return l},a3:function(){return c}});i(18111),i(61701);var s=i(25979),o=i(75642),n=i(69026);async function a({imei:e,start:t,stop:i,customergroup:n,overspeed:a=80}){return await o.A.post(`${s.Ay.coreApi}/positions`,{imei:e,start:t,stop:i,customergroup:n,overspeed:a}).then(e=>{const{data:t}=e;return t&&"timestamp"in t[0]?t:[]}).catch(e=>(console.log("getPositionData error: ",e),[]))}async function r({imei:e,start:t,stop:i}){return await o.A.post(`${s.Ay.coreApi}/report-event`,{imeis:[e],start:t,stop:i,eventType:"END_TRIP"}).then(e=>{const{data:t}=e;return t?t.map(e=>{const t=n.A.unix(e.startTime).format("YYYY-MM-DD");return{id:`${t}_${e.startTime}`,...e}}):[]}).catch(e=>(console.error("getTripData",e),[]))}function l(e){return n.A.unix(e).format("D MMM YYYY HH:mm:ss")}function c(e){const t=Math.floor(e/3600),i=Math.floor(e%3600/60),s=e%60,o=[t.toString().padStart(2,"0"),i.toString().padStart(2,"0"),s.toString().padStart(2,"0")].join(":");return o}},97783:function(e,t,i){var s={"./playback_clear.svg":48134,"./playback_play.svg":19273,"./playback_stop.svg":5111};function o(e){var t=n(e);return i(t)}function n(e){if(!i.o(s,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return s[e]}o.keys=function(){return Object.keys(s)},o.resolve=n,e.exports=o,o.id=97783},48134:function(e,t,i){"use strict";e.exports=i.p+"img/playback_clear.1ee9b250.svg"},19273:function(e,t,i){"use strict";e.exports=i.p+"img/playback_play.b0f1a834.svg"},5111:function(e,t,i){"use strict";e.exports=i.p+"img/playback_stop.d6e7a995.svg"}}]); 2//# sourceMappingURL=history.4494ed0f.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.