import{d as y,k as w,c as o,l as f,b as e,t as i,F as _,m as p,h as l,n as c,j as C,o as a,e as h}from"./index-BvsGCd9b.js";import{u as $}from"./data-C_m0Mceb.js";import{_ as N}from"./TopBar.vue_vue_type_script_setup_true_lang-CtReUXIV.js";import{_ as V}from"./BottomNav.vue_vue_type_script_setup_true_lang-Bb1Ze8Sv.js";const j={class:"pb-32 min-h-dvh"},B={class:"max-w-md mx-auto px-4 pt-2"},D={class:"text-display py-4"},F={class:"grid grid-cols-3 gap-3 mb-6"},H=["onClick"],S={class:"text-2xl"},A={class:"text-display leading-none mt-1"},L={class:"text-micro uppercase text-ink-subtle mt-1"},E={class:"mb-6"},M={key:0,class:"rounded-card bg-surface shadow-card p-6 text-center text-ink-muted"},O=["onClick"],P={class:"flex items-start justify-between gap-3"},R={class:"min-w-0"},Y={class:"font-bold"},q={class:"text-meta text-ink-muted truncate"},z={class:"px-2 py-0.5 rounded-pill text-[10px] font-bold uppercase bg-brand-100 text-brand-700 shrink-0"},G={class:"mt-2 text-meta text-ink-muted tabular-nums"},I={key:0,class:"rounded-card bg-surface shadow-card p-6 text-center text-ink-muted"},J=["onClick"],K={class:"min-w-0 flex-1"},Q={class:"font-bold truncate"},T={class:"text-meta text-ink-muted"},U={key:0},W={key:1},X={key:2},ae=y({__name:"HomeView",setup(Z){const r=$(),d=C();w(()=>r.loadHome());const u=c(()=>r.home),m=c(()=>{var n;return((n=r.home)==null?void 0:n.active_orders)??[]}),v=c(()=>{var n;return((n=r.home)==null?void 0:n.vehicles)??[]}),g=c(()=>{var n,s;return[{label:"Vehicles",value:((n=u.value)==null?void 0:n.vehicle_count)??0,icon:"🚗",to:"/vehicles"},{label:"Active repairs",value:m.value.length,icon:"🔧",to:"/orders"},{label:"Pending estimates",value:((s=u.value)==null?void 0:s.pending_estimates)??0,icon:"📝",to:"/estimates"}]}),x=n=>n.toLocaleString(void 0,{maximumFractionDigits:2});return(n,s)=>{var b;return a(),o("div",j,[f(N),e("main",B,[e("h1",D," Hi, "+i(((b=u.value)==null?void 0:b.greeting_name)||"there")+" 👋 ",1),e("div",F,[(a(!0),o(_,null,p(g.value,t=>(a(),o("button",{key:t.label,type:"button",class:"rounded-card bg-surface shadow-card p-3 text-left active:scale-[0.98] transition",onClick:k=>h(d).push(t.to)},[e("div",S,i(t.icon),1),e("div",A,i(t.value),1),e("div",L,i(t.label),1)],8,H))),128))]),e("section",E,[s[1]||(s[1]=e("h2",{class:"text-title mb-3"},"Active repairs",-1)),m.value.length===0?(a(),o("div",M,[...s[0]||(s[0]=[e("div",{class:"text-4xl mb-2 opacity-60"},"✅",-1),e("p",{class:"text-meta"},"No repairs in progress.",-1)])])):l("",!0),(a(!0),o(_,null,p(m.value,t=>(a(),o("article",{key:t.id,class:"rounded-card bg-surface shadow-card p-4 mb-3 active:scale-[0.99] transition cursor-pointer",onClick:k=>h(d).push(`/orders/${t.id}`)},[e("div",P,[e("div",R,[e("div",Y,i(t.number),1),e("div",q,i(t.vehicle||"—"),1)]),e("span",z,i(t.status_label||t.status),1)]),e("div",G,i(x(t.grand_total)),1)],8,O))),128))]),e("section",null,[s[5]||(s[5]=e("h2",{class:"text-title mb-3"},"Your vehicles",-1)),v.value.length===0?(a(),o("div",I,[...s[2]||(s[2]=[e("p",{class:"text-meta"},"No vehicles on file yet.",-1)])])):l("",!0),(a(!0),o(_,null,p(v.value,t=>(a(),o("article",{key:t.id,class:"rounded-card bg-surface shadow-card p-4 mb-3 flex items-center gap-3 active:scale-[0.99] transition cursor-pointer",onClick:k=>h(d).push(`/vehicles/${t.id}`)},[s[3]||(s[3]=e("div",{class:"w-10 h-10 rounded-pill bg-brand-100 text-brand-700 flex items-center justify-center text-xl shrink-0"},"🚗",-1)),e("div",K,[e("div",Q,i(t.label),1),e("div",T,[t.plate?(a(),o("span",U,i(t.plate),1)):l("",!0),t.plate&&t.odometer!=null?(a(),o("span",W," · ")):l("",!0),t.odometer!=null?(a(),o("span",X,i(x(t.odometer))+" km",1)):l("",!0)])]),s[4]||(s[4]=e("span",{class:"text-ink-subtle"},"›",-1))],8,J))),128))])]),f(V)])}}});export{ae as default};
//# sourceMappingURL=HomeView-DQ2GtePA.js.map
