import{q as y,j as r,x as S,y as C,k as a,l as t,z as d,L,t as l,B as p,A as w,F as b,C as g,D as F,T as D,o,m as M,X as R,w as V,v as j}from"./index-B8bqNNwo.js";import{C as E}from"./clock-COPwQCtz.js";import{A as I}from"./activity-BHBuRjgX.js";/**
 * @license lucide-vue-next v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $=y("fuel",[["path",{d:"M14 13h2a2 2 0 0 1 2 2v2a2 2 0 0 0 4 0v-6.998a2 2 0 0 0-.59-1.42L18 5",key:"1wtuz0"}],["path",{d:"M14 21V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v16",key:"e09ifn"}],["path",{d:"M2 21h13",key:"1x0fut"}],["path",{d:"M3 9h11",key:"1p7c0w"}]]);/**
 * @license lucide-vue-next v0.554.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const A=y("timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]),B={class:"p-8 bg-[#0a0c10] min-h-screen text-slate-300 font-sans selection:bg-indigo-500 selection:text-white"},N={class:"flex flex-col md:flex-row justify-between items-start md:items-end mb-10 gap-4"},U={class:"bg-slate-900/40 border border-slate-800 px-4 py-2 rounded-2xl text-right"},q={class:"text-xl font-black text-emerald-500"},z={class:"grid grid-cols-1 lg:grid-cols-2 gap-10"},O={class:"space-y-6"},H={class:"flex items-center gap-3 border-b border-slate-800/50 pb-4"},P={class:"p-2 bg-indigo-500/10 rounded-xl"},X={class:"flex gap-6 mb-6 px-2"},Y={class:"text-xl font-black text-emerald-500"},G={class:"border-l border-slate-800 pl-6"},J={class:"text-xl font-black text-rose-500"},K={class:"grid grid-cols-1 md:grid-cols-3 gap-4"},Q={class:"text-4xl font-black block leading-none mb-1 text-rose-500 group-hover:scale-110 transition-transform origin-left"},W={class:"mt-4 space-y-1.5 pt-4 border-t border-slate-800/50"},Z={class:"text-slate-500"},tt={class:"text-rose-400"},et={class:"text-4xl font-black block leading-none mb-1 text-rose-600 group-hover:animate-pulse"},st={class:"mt-4 space-y-1.5 pt-4 border-t border-slate-800/50"},lt={class:"text-slate-500"},at={class:"text-rose-500"},ot={class:"text-4xl font-black block leading-none mb-1 text-emerald-500"},nt={class:"flex flex-col"},it={class:"text-slate-300"},rt={class:"text-[8px] text-slate-600 lowercase italic"},dt={class:"text-emerald-500 font-black"},ct={class:"space-y-6"},pt={class:"flex items-center gap-3 border-b border-slate-800/50 pb-4"},xt={class:"p-2 bg-amber-500/10 rounded-xl"},ut={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},bt={class:"flex justify-between items-start"},gt={class:"text-4xl font-black block leading-none mb-1 text-rose-500"},ft={class:"flex justify-between items-start"},vt={class:"text-4xl font-black block leading-none mb-1 text-white"},kt={key:0,class:"fixed inset-0 bg-black/90 backdrop-blur-md flex items-center justify-center p-6 z-50"},mt={class:"bg-[#0f1115] border border-slate-800 w-full max-w-5xl rounded-[3rem] p-10 shadow-2xl flex flex-col max-h-[90vh]"},ht={class:"flex justify-between items-start mb-6"},_t={class:"text-4xl font-black text-white uppercase tracking-tighter"},wt={class:"flex flex-wrap gap-4 mb-8"},yt={class:"flex-1 flex gap-2"},Tt={class:"bg-slate-900 border border-slate-800 rounded-2xl px-4 py-3 flex gap-4 items-center"},St={class:"bg-black/40 rounded-[2rem] border border-slate-800/50 p-6 overflow-y-auto flex-1"},Ct={key:0,class:"flex flex-col items-center py-20"},Lt={key:1,class:"w-full text-left border-separate border-spacing-y-2"},Ft={class:"p-4 rounded-l-2xl font-black text-white"},Dt={class:"p-4 text-xs font-bold text-slate-400"},Mt={class:"p-4 font-black text-indigo-400"},Rt={class:"p-4 rounded-r-2xl text-[10px] text-slate-500"},$t={__name:"Index",setup(Vt){const k=r(0),x=r(null),m=r(""),h=r([]),f=r(!1),u=S({date:new Date().toISOString().split("T")[0]}),n=r({criticalFuel:[],thefts:[],fillings:[],breakdowns:[],grounded:[],longStops:[],fuelRequests:[]}),T=async()=>{const{data:i}=await axios.get("portal/control-tower");k.value=i.totalUnits,n.value=i.stats},c=(i,e)=>{m.value=i,x.value=e,_()},_=async()=>{f.value=!0;try{const{data:i}=await axios.get(`/portal/report/${x.value}`,{params:{start:u.date+" 00:00:00",end:u.date+" 23:59:59"}});h.value=i}finally{f.value=!1}};return C(T),(i,e)=>(o(),a("div",B,[t("div",N,[e[8]||(e[8]=L('<div><h1 class="text-4xl font-black text-white tracking-tighter uppercase leading-none">Fleet Command</h1><p class="text-indigo-500 font-bold text-[10px] tracking-[0.3em] mt-2 flex items-center gap-2"><span class="relative flex h-2 w-2"><span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-400 opacity-75"></span><span class="relative inline-flex rounded-full h-2 w-2 bg-indigo-500"></span></span> LIVE TELEMETRY SNAPSHOT </p></div>',1)),t("div",U,[e[7]||(e[7]=t("p",{class:"text-[9px] font-black text-slate-500 uppercase tracking-widest"},"Active Fleet",-1)),t("p",q,l(k.value)+" Units",1)])]),t("div",z,[t("div",O,[t("div",H,[t("div",P,[d(p($),{class:"text-indigo-500 w-5 h-5"})]),e[9]||(e[9]=t("h2",{class:"text-lg font-black text-white uppercase tracking-tight"},"Fuel Intelligence",-1))]),t("div",X,[t("div",null,[e[11]||(e[11]=t("p",{class:"text-[9px] font-black text-slate-500 uppercase tracking-widest"},"Fleet Refill (Today)",-1)),t("p",Y,[w(l(n.value.totalRefilled)+" ",1),e[10]||(e[10]=t("span",{class:"text-[10px] text-slate-500"},"LITERS",-1))])]),t("div",G,[e[13]||(e[13]=t("p",{class:"text-[9px] font-black text-slate-500 uppercase tracking-widest"},"Est. Loss (Today)",-1)),t("p",J,[w(l(n.value.totalStolen)+" ",1),e[12]||(e[12]=t("span",{class:"text-[10px] text-slate-500"},"LITERS",-1))])])]),e[17]||(e[17]=t("div",{class:"grid grid-cols-1 md:grid-cols-3 gap-4"},null,-1)),t("div",K,[t("div",{onClick:e[0]||(e[0]=s=>c("Critical Fuel Levels","critical-fuel")),class:"bg-slate-900/40 border border-slate-800 p-5 rounded-[2rem] cursor-pointer hover:bg-slate-800/60 hover:border-rose-500/50 transition-all duration-300 group"},[t("span",Q,l(n.value.criticalFuel.length),1),e[14]||(e[14]=t("p",{class:"text-[11px] font-black uppercase tracking-widest text-slate-400 leading-tight"},"Critical Low",-1)),t("div",W,[(o(!0),a(b,null,g(n.value.criticalFuel.slice(0,5),s=>(o(),a("div",{key:s.id,class:"flex justify-between text-[10px] font-bold uppercase tracking-tighter"},[t("span",Z,l(s.plate),1),t("span",tt,l(s.val)+"%",1)]))),128))])]),t("div",{onClick:e[1]||(e[1]=s=>c("Fuel Drains & Theft","thefts")),class:"bg-slate-900/40 border border-rose-900/20 p-5 rounded-[2rem] cursor-pointer hover:bg-rose-950/20 hover:border-rose-500/50 transition-all duration-300 group"},[t("span",et,l(n.value.thefts.length),1),e[15]||(e[15]=t("p",{class:"text-[11px] font-black uppercase tracking-widest text-slate-400 leading-tight"},"Thefts/Drains",-1)),t("div",st,[(o(!0),a(b,null,g(n.value.thefts.slice(0,5),(s,v)=>(o(),a("div",{key:v,class:"flex justify-between text-[10px] font-bold uppercase tracking-tighter"},[t("span",lt,l(s.plate),1),t("span",at,"-"+l(s.val)+"L",1)]))),128))])]),t("div",{onClick:e[2]||(e[2]=s=>c("Recent Fillings","fillings")),class:"bg-slate-900/40 border border-slate-800 p-5 rounded-[2rem] cursor-pointer hover:bg-slate-800/60 hover:border-emerald-500/50 transition-all duration-300 group"},[t("span",ot,l(n.value.fillings.length),1),e[16]||(e[16]=t("p",{class:"text-[11px] font-black uppercase tracking-widest text-slate-400 leading-tight"},"Recent Refills",-1)),(o(!0),a(b,null,g(n.value.fillings,(s,v)=>(o(),a("div",{key:v,class:"flex justify-between items-center text-[10px] font-bold uppercase tracking-tighter"},[t("div",nt,[t("span",it,l(s.plate),1),t("span",rt,l(s.driver_name||"unassigned"),1)]),t("span",dt,"+"+l(Math.round(s.val))+"L",1)]))),128))])])]),t("div",ct,[t("div",pt,[t("div",xt,[d(p(E),{class:"text-amber-500 w-5 h-5"})]),e[18]||(e[18]=t("h2",{class:"text-lg font-black text-white uppercase tracking-tight"},"Operations & Support",-1))]),t("div",ut,[t("div",{onClick:e[3]||(e[3]=s=>c("Active Breakdowns","breakdowns")),class:"bg-slate-900/40 border border-slate-800 p-6 rounded-[2rem] cursor-pointer hover:bg-slate-800/60 transition-all group"},[t("div",bt,[t("div",null,[t("span",gt,l(n.value.breakdowns.length),1),e[19]||(e[19]=t("p",{class:"text-[11px] font-black uppercase tracking-widest text-slate-400"},"Breakdowns",-1))]),d(p(I),{class:"text-slate-700 group-hover:text-rose-500 transition-colors"})])]),t("div",{onClick:e[4]||(e[4]=s=>c("Stationary Vehicles (24h+)","long-stops")),class:"bg-slate-900/40 border border-slate-800 p-6 rounded-[2rem] cursor-pointer hover:bg-slate-800/60 transition-all group"},[t("div",ft,[t("div",null,[t("span",vt,l(n.value.longStops.length),1),e[20]||(e[20]=t("p",{class:"text-[11px] font-black uppercase tracking-widest text-slate-400"},"24h+ Stops",-1))]),d(p(A),{class:"text-slate-700"})])])])])]),d(D,{name:"fade"},{default:F(()=>[x.value?(o(),a("div",kt,[t("div",mt,[t("div",ht,[t("div",null,[e[21]||(e[21]=t("p",{class:"text-indigo-500 text-[10px] font-black uppercase tracking-[0.4em] mb-2"},"Detailed Report",-1)),t("h3",_t,l(m.value),1)]),t("button",{onClick:e[5]||(e[5]=s=>x.value=null),class:"bg-slate-800 hover:bg-rose-600 text-white p-3 rounded-2xl transition-all"},[d(p(R))])]),t("div",wt,[t("div",yt,[t("div",Tt,[V(t("input",{type:"date","onUpdate:modelValue":e[6]||(e[6]=s=>u.date=s),class:"bg-transparent text-xs text-white outline-none"},null,512),[[j,u.date]])]),t("button",{onClick:_,class:"bg-indigo-600 px-6 rounded-2xl text-[10px] font-black uppercase tracking-widest"},"Update View")]),e[22]||(e[22]=t("input",{type:"text",placeholder:"Search plate or driver...",class:"bg-slate-900 border border-slate-800 rounded-2xl px-6 py-4 text-sm outline-none w-full md:w-64"},null,-1))]),t("div",St,[f.value?(o(),a("div",Ct,[...e[23]||(e[23]=[t("div",{class:"w-10 h-10 border-4 border-indigo-500 border-t-transparent rounded-full animate-spin mb-4"},null,-1),t("p",{class:"text-[10px] font-black tracking-widest text-slate-500 uppercase"},"Consulting Telemetry Tables...",-1)])])):(o(),a("table",Lt,[e[24]||(e[24]=t("thead",null,[t("tr",{class:"text-[10px] uppercase text-slate-500 font-black tracking-widest"},[t("th",{class:"px-4"},"Vehicle"),t("th",{class:"px-4"},"Driver"),t("th",{class:"px-4"},"Detail"),t("th",{class:"px-4"},"Time")])],-1)),t("tbody",null,[(o(!0),a(b,null,g(h.value,s=>(o(),a("tr",{key:s.time,class:"bg-slate-900/40 hover:bg-slate-800 transition-colors"},[t("td",Ft,l(s.plate_number),1),t("td",Dt,l(s.driver_name||"Unassigned"),1),t("td",Mt,l(s.val)+"L",1),t("td",Rt,l(new Date(s.time).toLocaleString()),1)]))),128))])]))])])])):M("",!0)]),_:1})]))}};export{$t as default};
