1import{a as ie}from"./BGYd1yIb.js";import{D as h,E as H,En as Q,Ht as le,On as e,Rt as te,Yt as Y,_ as a,b as L,bt as ue,er as ce,g as D,k as Z,mt as c,o as de,qt as b,tr as l,un as G,v as R,vn as F,y as P}from"./D6WHS1fr.js";import{at as J}from"./B3knHKPP.js";import{i as pe}from"./kvDYmd4-.js";import{t as me}from"./CJdvDGmD.js";import{t as fe}from"./CHu6lqp5.js";import{n as oe}from"./_M0T3Ajy.js";import{m as ve}from"./vzfjObSJ.js";import{n as U}from"./cyl1wqhB.js";import{T as ge}from"./C8AATz1e.js";import{t as W}from"./CSt4_oPS2.js";import{i as X}from"./PGSORsQg2.js";import{n as ee,o as _e}from"./Cg6BXmdO2.js";import{D as he,F as ye,O as be,t as se}from"./CNarOvmV.js";import{t as O}from"./_c3ft1t-2.js";import{t as z}from"./CK-0bgm_2.js";import{t as K}from"./BxLSmyRK2.js";import{t as ae}from"./DTVDTKqh.js";import{t as xe}from"./DVLytQtY.js";import{t as we}from"./CvXEJT792.js";import{t as Le}from"./7SoagyTp2.js";import{t as ke}from"./BMRUlzL92.js";import{t as A}from"./dW-idgoe2.js";import{t as De}from"./CsQJOOxn2.js";import{t as Te}from"./C2K-dika.js";(function(){try{var d=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};d.SENTRY_RELEASE={id:"2e8dfcbf6f3796e3e06db87f2dcb866f53d3cce2"};var n=new d.Error().stack;
1n&&(d._sentryDebugIds=d._sentryDebugIds||{},d._sentryDebugIds[n]="77c95620-f44d-417f-867b-3843a4c65e5a",d._sentryDebugIdIdentifier="sentry-dbid-77c95620-f44d-417f-867b-3843a4c65e5a")}catch{}})();var Se={class:"relative size-full"},$e={key:0,class:"absolute top-4 left-4 z-50 2xl:left-6"},Fe={class:"absolute right-4 bottom-6 left-4 z-40 rounded-lg bg-default shadow 2xl:right-6 2xl:left-6"},Ce={class:"text-center"},Ie={class:"mt-2 text-sm font-semibold text-highlighted 2xl:text-base"},Me={class:"mt-1 text-sm text-toned"},Ne={class:"flex items-center justify-between"},Be={href:"https://apps.apple.com/de/app/xrouten/id1552428765",target:"_blank"},Pe={class:"flex items-center text-info hover:underline"},Ee={class:"ml-0.5 text-sm 2xl:text-base"},He={href:"https://play.google.com/store/apps/details?id=com.de.xrouten",target:"_blank"},Re={class:"flex items-center text-info hover:underline"},Ue={class:"ml-0.5 text-sm 2xl:text-base"},ze={class:"mb-6 flex items-center justify-between"},Oe={class:"text-left"},je={class:"text-sm leading-6 font-semibold text-highlighted 2xl:text-base"},Ve={class:"mt-1 flex items-center gap-x-2 text-xs leading-5 text-muted 2xl:text-sm"},qe=Z({__name:"DashboardMap",props:{driverLocations:{default:()=>[]},activeTours:{},showRefreshButton:{type:Boolean}},emits:["refresh"],setup(d,{emit:n}){const{t:m}=oe(),E=K(),C=ae(),$=F(new Date().toISOString()),I=te("mapRef");function M(){const v=d.driverLocations[0]?.currentLng??E.value.company.startLng,p=d.driverLocations[0]?.currentLat??E.value.company.startLat;I.value?.setCenter(v?Number(v):13.38665,p?Number(p):52.453279)}const y=n;function g(){$.value=new Date().toISOString(),y("refresh")}const x=me(),f=D(()=>d.driverLocations.map(v=>({type:"Feature",geometry:{type:"Point",coordinates:[Number(v.currentLng),Number(v.currentLat)]},properties:{color:"#FBBF24",tooltip:m("user.term.driver"),size:"medium"}})));return(v,p)=>{const T=fe;return c(),L("div",Se,[h(se,{ref_key:"mapRef",ref:I,"map-style":e(C).mapStyle,center:[0,0],"point-data":f.value,"map-configuration-control":{enabled:!0,position:"bottom-right"},"cluster-options":{enabled:!0,radius:60,maxZoom:20},"navigation-control":{enabled:!0,position:"bottom-right"},"geolocate-control":{enabled:!0,position:"bottom-right"},onMapLoaded:M},null,8,["map-style","point-data"]),d.showRefreshButton?(c(),L("div",$e,[h(z,{color:"neutral",variant:"outline",class:"flex w-full items-center justify-center rounded-md bg-default px-3 py-2 text-sm font-medium text-highlighted shadow-sm ring-1 ring-accented ring-inset hover:bg-muted focus-visible:outline-offset-0",onClick:g},{leading:b(()=>[h(O,{name:e(U).refresh,class:"mr-2 h-4 w-4"},null,8,["name"])]),default:b(()=>[H(" "+l(e(m)("app.action.refresh")),1)]),_:1})])):P("",!0),a("div",Fe,[d.driverLocations.length===0?(c(),R(A,{key:0},{footer:b(()=>[a("div",Ne,[a("a",Be,[a("span",Pe,[h(O,{name:e(U).apple,class:"h-6 w-6 pb-0.5"},null,8,["name"]),a("p",Ee,l(e(m)("dashboard.field.map.ios_app")),1)])]),a("a",He,[a("span",Re,[h(O,{name:e(U).android,class:"h-5 w-5"},null,8,["name"]),a("p",Ue,l(e(m)("dashboard.field.map.android_app")),1)])])])]),default:b(()=>[a("div",Ce,[a("h3",Ie,l(e(m)("dashboard.title.map.no_drivers")),1),a("p",Me,l(e(m)("dashboard.description.map.no_drivers")),1)])]),_:1})):(c(),R(A,{key:1},{footer:b(()=>[h(T,{to:e(x)("/tours/map"),class:"flex w-full items-center justify-center rounded-md bg-default px-3 py-2 text-sm font-semibold text-highlighted shadow-sm ring-1 ring-accented ring-inset hover:bg-muted focus-visible:outline-offset-0"},{default:b(()=>[H(l(e(m)("dashboard.field.map.view_all_on_map")),1)]),_:1},8,["to"])]),default:b(()=>[a("div",ze,[a("div",Oe,[a("p",je,l(e(m)("dashboard.title.map.active_drivers",{count:d.driverLocations.length})),1),a("div",Ve,[a("p",null,l(e(m)("dashboard.field.map.last_update")),1),p[0]||(p[0]=a("svg",{class:"h-0.5 w-0.5 fill-current",viewBox:"0 0 2 2"},[a("circle",{cx:"1",cy:"1",r:"1"})],-1)),a("p",null,[h(ke,{date:$.value},null,8,["date"])])])])])]),_:1}))])])}}}),Ae=Object.assign(qe,{__name:"FeaturesDashboardMap"}),Ze=ie(he()),Ke=Z({__name:"DeviceHistoryMap",props:{locations:{},tours:{}},setup(d){const n=d,m=K(),{getDateTimeWithSeconds:E}=Le(),C=ae(),$=D(()=>{const t={};for(const u of n.tours)t[u["@id"]]=u;return t});function I(t){return(t.tour?$.value[t.tour]:void 0)?.color??"#FBBF24"}const M=D(()=>n.locations.map((t,u)=>({type:"Feature",geometry:{type:"Point",coordinates:[Number(t.currentLng),Number(t.currentLat)]},properties:{color:I(t),size:"small",timestamp:t.originalTimeStamp,driverIri:t.driver,tour:t.tour,seq:u+1}}))),y=D(()=>{const t=new Map;for(const i of n.locations){const _=i.driver||`tour:${i.tour}
1`,N=I(i),k=Number(i.currentLng),w=Number(i.currentLat);!Number.isFinite(k)||!Number.isFinite(w)||(t.has(_)||t.set(_,{color:N,coords:[]}),t.get(_).coords.push([k,w]))}const u={};for(const i of n.locations){const _=i.driver||`tour:${i.tour}`;u[_]||(u[_]=[]),u[_].push(i)}const S=[];for(const[i,_]of Object.entries(u)){const N=_.sort((w,B)=>new Date(w.originalTimeStamp).getTime()-new Date(B.originalTimeStamp).getTime()),k=[];for(const w of N){const B=Number(w.currentLng),j=Number(w.currentLat);Number.isFinite(B)&&Number.isFinite(j)&&k.push([B,j])}if(k.length>=2){const w=t.get(i)?.color??"#F59E0B";S.push({type:"Feature",geometry:{type:"LineString",coordinates:k},properties:{color:w,arrows:!1}})}}return S}),g=te("mapRef"),x=F(!1);let f=null;function v(){if(!x.value)return;const t=[];for(const S of M.value){const i=S.geometry.coordinates;Number.isFinite(i[0])&&Number.isFinite(i[1])&&t.push(i)}if(t.length===0)return;const u=ye(t,14);u&&be(g.value,u,{padding:48,maxZoom:16,duration:600})}function p(){if(x.value=!0,M.value.length>0)v();else{const t=m.value.company.startLng??13.38665,u=m.value.company.startLat??52.453279;g.value?.setCenter(Number(t),Number(u)),g.value?.setZoom(0)}}le(()=>n.locations,()=>{x.value&&v()});function T(t){try{f&&(f.remove(),f=null);const[u,S]=t.geometry.coordinates,i=t.properties.timestamp,_=typeof i=="string"?new Date(i):null,N=` 2 <div class="p-3 min-w-[200px]"> 3 <div class="font-semibold text-sm mb-2">GPS Tracking Point</div> 4 <div class="text-xs space-y-1.5"> 5 <div class="flex justify-between"><span>Zeit:</span><span class="font-medium">${_?E(_):""}</span></div> 6 <div class="flex justify-between"><span>Position:</span><span class="font-medium">${t.properties?.seq??""}</span></div> 7 <div class="flex justify-between"><span>Koordinaten:</span><span class="font-medium font-mono text-xs">${S?.toFixed?.(6)}, ${u?.toFixed?.(6)}</span></div> 8 <div class="flex justify-between"><span>Farbe:</span><span class="font-medium" style="color:${t.properties?.color}">â</span></div> 9 </div> 10 </div>`,k=g.value?.map;if(!k)return;f=new Ze.default.Popup({closeButton:!0,closeOnClick:!0,offset:[0,-10]}).setLngLat([u,S]).setHTML(N).addTo(k)}catch{}}return(t,u)=>(c(),R(se,{ref_key:"mapRef",ref:g,"cluster-point-data":M.value,"cluster-options":{enabled:e(C).clusterEnabled,radius:50,maxZoom:e(C).clusterMaxZoom,minPoints:2},"line-string-data":y.value,"navigation-control":{enabled:!0,position:"bottom-right"},"map-configuration-control":{enabled:!0,availableConfigurations:{showLineString:!0,enableCluster:!0}},onMapLoaded:p,"onUpdate:enableCluster":e(C).updateClusterEnabled,"onUpdate:clusterMaxZoom":e(C).updateClusterMaxZoom,onPointClicked:T},null,8,["cluster-point-data","cluster-options","line-string-data","onUpdate:enableCluster","onUpdate:clusterMaxZoom"]))}}),Qe=Object.assign(Ke,{__name:"FeaturesDevicesDeviceHistoryMap"}),Ye={class:"flex h-full w-full flex-1 overflow-hidden"},Ge={class:"relative size-full"},Je={class:"pointer-events-auto flex items-center gap-2"},We={class:"text-sm font-semibold"},Xe={class:"ml-2"},et={key:0,class:"ml-2"},tt={key:0,class:"pointer-events-auto mt-2 flex flex-wrap items-center gap-2"},ot={class:"text-xs"},st={class:"ml-2 text-xs"},at={key:0,class:"ml-2 text-[11px]"},rt={key:1,class:"pointer-events-auto text-[11px] text-error"},nt={key:2,class:"pointer-events-auto text-[11px]"},it={key:3,class:"pointer-events-auto mt-2 max-h-64 overflow-auto rounded p-2 shadow"},lt={class:"mb-1 text-[11px] font-semibold"},ut={class:"space-y-1"},ct={key:1},dt=Z({__name:"list",setup(d){const{t:n}=oe();if(!K().value.company?.features?.includes("FEATURE_DEVICES"))throw pe({statusCode:403,statusMessage:n("app.term.http_403"),data:{message:n("app.message.http_403.message")}});Te({shortcuts:["ctrl","J"],title:o=>o("device.name_plural"),roles:[ve.companyAdmin],globalSearch:{icon:U.pcDesktop,name:o=>"Devices"}});const m=W(X({"exists[endDate]":!1,locationTracking:!0,itemsPerPage:150})),E=W(ee()),C=D(()=>E.data?.value?.data["hydra:member"]??[]),$=D(()=>m.data?.value?.data["hydra:member"]??[]),I=ge();function M(){I.invalidateQueries({queryKey:Q(ee().queryKey)}),I.invalidateQueries({queryKey:Q(X({"exists[endDate]":!1,locationTracking:!0,itemsPerPage:150}).queryKey)})}const y=F(!1),g=F(""),x=F(""),f=F(!1),v=F({current:0,total:0}),p=F([]),T=F(""),t=D(()=>{const o=new Set;for(const s of p.value){const r=s.driver||`tour:${s.tour}`;o.add(r)}return o.size}),u=D(()=>p.value.length),S=D(()=>{const o={};for(const s of $.value||[])o[s["@id"]]=s;return o}
10),i=D(()=>{const o=new Map;for(const s of p.value){const r=s.driver||null,V=r??`tour:${s.tour}`,q=(s.tour?S.value[s.tour]?.color:void 0)??"#FBBF24";o.has(V)||o.set(V,{userIri:r,tourIri:s.tour,color:q})}return Array.from(o.values())}),{usersById:_,isLoading:N}=De(D(()=>i.value.map(({userIri:o})=>o??void 0)));function k(o){return _.value.get(xe(o))}function w(o){const s=r=>`${r}`.padStart(2,"0");return`${o.getFullYear()}-${s(o.getMonth()+1)}-${s(o.getDate())}T${s(o.getHours())}:${s(o.getMinutes())}`}function B(){const o=new Date,s=new Date(o);s.setHours(8,0,0,0);const r=new Date(o);r.setHours(16,0,0,0),g.value=w(s),x.value=w(r)}B();async function j(){if(T.value="",!g.value||!x.value){T.value="Please select both From and To.";return}const o=new Date(g.value),s=new Date(x.value);if(o>=s){T.value="Start time must be before End time.";return}if(s.getTime()-o.getTime()>10080*60*1e3){T.value="Range cannot exceed 7 days.";return}f.value=!0,p.value=[];const r=$.value||[];v.value={current:0,total:r.length};try{for(const V of r){const q=await _e(V.id,{"originalTimeStamp[after]":o.toISOString(),"originalTimeStamp[before]":s.toISOString(),"sort[originalTimeStamp]":"asc"});p.value.push(...q),v.value.current++,await new Promise(ne=>setTimeout(ne))}}finally{f.value=!1}}function re(){B(),p.value=[]}return(o,s)=>(c(),L("div",Ye,[a("div",Ge,[e(y)?(c(),R(Qe,{key:0,locations:e(p),tours:e($)},null,8,["locations","tours"])):(c(),R(Ae,{key:1,"driver-locations":e(C),"active-tours":e($),onRefresh:M},null,8,["driver-locations","active-tours"])),h(A,{class:"pointer-events-none absolute top-4 left-4 z-40 flex flex-col gap-2"},{default:b(()=>[a("div",Je,[h(O,{name:e(U).pcDesktop,class:"h-4 w-4"},null,8,["name"]),a("span",We,l(e(n)("device.name_plural")),1),a("div",Xe,[h(z,{size:"xs",variant:"outline",color:"neutral",onClick:s[0]||(s[0]=r=>y.value=!e(y))},{default:b(()=>[H(l(e(y)?e(n)("device.action.live"):e(n)("device.action.history")),1)]),_:1})]),e(y)?P("",!0):(c(),L("div",et,[h(z,{size:"xs",variant:"outline",color:"neutral",onClick:M},{leading:b(()=>[h(O,{name:e(U).refresh,class:"h-3 w-3"},null,8,["name"])]),default:b(()=>[H(" "+l(e(n)("app.action.refresh")),1)]),_:1})]))]),e(y)?(c(),L("div",tt,[a("label",ot,l(e(n)("device.field.from")),1),Y(a("input",{"onUpdate:modelValue":s[1]||(s[1]=r=>G(g)?g.value=r:null),type:"datetime-local",class:"rounded border px-2 py-1 text-xs"},null,512),[[J,e(g)]]),a("label",st,l(e(n)("device.field.to")),1),Y(a("input",{"onUpdate:modelValue":s[2]||(s[2]=r=>G(x)?x.value=r:null),type:"datetime-local",class:"rounded border px-2 py-1 text-xs"},null,512),[[J,e(x)]]),h(z,{size:"xs",variant:"outline",color:"neutral",disabled:e(f),onClick:j},{default:b(()=>[H(l(e(f)?e(n)("device.message.loading"):e(n)("device.action.load")),1)]),_:1},8,["disabled"]),h(z,{size:"xs",variant:"ghost",color:"neutral",disabled:e(f),onClick:re},{default:b(()=>[H(l(e(n)("device.action.reset")),1)]),_:1},8,["disabled"]),e(f)&&e(v).total>0?(c(),L("span",at,l(e(v).current)+" / "+l(e(v).total),1)):P("",!0)])):P("",!0),e(y)&&e(T)?(c(),L("div",rt,l(e(T)),1)):P("",!0),e(y)&&!e(f)&&e(p).length>0?(c(),L("div",nt,l(e(n)("device.field.users_and_points",{users:e(t),points:e(u)})),1)):P("",!0),e(y)&&!e(f)&&e(i).length>0?(c(),L("div",it,[a("div",lt,l(e(n)("device.title.users")),1),a("ul",ut,[(c(!0),L(de,null,ue(e(i),r=>(c(),L("li",{key:r.userIri??r.tourIri,class:"flex items-center gap-2 text-[11px]"},[a("span",{class:"inline-block h-2.5 w-2.5 rounded-full",style:ce({backgroundColor:r.color})},null,4),r.userIri?(c(),R(we,{key:0,user:k(r.userIri),loading:e(N)},null,8,["user","loading"])):(c(),L("span",ct,l(e(S)[r.tourIri]?.name??r.tourIri),1))]))),128))])])):P("",!0)]),_:1})])]))}}),Ht=dt;export{Ht as default};
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.