import{d as y,k as g,c as o,b as t,e as v,t as a,F as x,h as l,m as w,l as V,j as N,r as c,o as i}from"./index-BvsGCd9b.js";import{u as D}from"./data-C_m0Mceb.js";import{_ as C}from"./BottomNav.vue_vue_type_script_setup_true_lang-Bb1Ze8Sv.js";const j={class:"pb-32 min-h-dvh"},F={class:"sticky top-0 z-20 bg-surface/85 backdrop-blur-lg border-b border-ink/5"},L={class:"flex items-center gap-3 px-4 py-3 max-w-md mx-auto"},S={class:"text-body font-bold truncate flex-1"},$={class:"max-w-md mx-auto px-4 pt-2"},B={key:0,class:"text-center py-12 text-ink-muted text-meta"},R={class:"rounded-card bg-surface shadow-card p-4 my-4"},z={class:"flex items-center gap-3 mb-3"},E={class:"min-w-0"},I={class:"text-title"},M={class:"text-meta text-ink-muted"},O={class:"grid grid-cols-2 gap-y-3 gap-x-4 text-meta"},T={key:0},Y={class:"font-semibold"},q={key:1},A={class:"font-semibold tabular-nums"},G={key:2},H={class:"font-semibold"},J={key:3},K={class:"font-semibold"},P={key:4,class:"col-span-2"},Q={class:"font-semibold font-mono break-all"},U={key:0,class:"rounded-card bg-surface shadow-card p-6 text-center text-ink-muted"},W=["onClick"],X={class:"flex items-start justify-between gap-3"},Z={class:"min-w-0"},tt={class:"font-bold"},et={class:"text-meta text-ink-muted"},st={class:"px-2 py-0.5 rounded-pill text-[10px] font-bold uppercase bg-surface-muted text-ink-muted shrink-0"},ot={class:"mt-2 text-meta text-ink-muted tabular-nums"},at={key:2,class:"text-center py-12 text-ink-muted text-meta"},rt=y({__name:"VehicleDetailView",props:{id:{}},setup(b){const f=b,h=D(),u=N(),s=c(null),r=c([]),m=c(!0);g(async()=>{const d=await h.loadVehicle(Number(f.id));d&&(s.value=d.vehicle,r.value=d.history),m.value=!1});const p=d=>d.toLocaleString(void 0,{maximumFractionDigits:2});function k(d){if(!d)return"";const e=new Date(d);return isNaN(e.getTime())?"":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}return(d,e)=>{var _;return i(),o("div",j,[t("header",F,[t("div",L,[t("button",{type:"button",class:"w-9 h-9 rounded-pill bg-surface-muted flex items-center justify-center text-ink-muted active:scale-95",onClick:e[0]||(e[0]=n=>v(u).back())},"‹"),t("div",S,a(((_=s.value)==null?void 0:_.label)||"Vehicle"),1)])]),t("main",$,[m.value?(i(),o("div",B,"Loading…")):s.value?(i(),o(x,{key:1},[t("div",R,[t("div",z,[e[1]||(e[1]=t("div",{class:"w-12 h-12 rounded-pill bg-brand-100 text-brand-700 flex items-center justify-center text-2xl"},"🚗",-1)),t("div",E,[t("div",I,a(s.value.label),1),t("div",M,a(s.value.plate||"—"),1)])]),t("dl",O,[s.value.year!=null?(i(),o("div",T,[e[2]||(e[2]=t("dt",{class:"text-micro uppercase text-ink-subtle"},"Year",-1)),t("dd",Y,a(s.value.year),1)])):l("",!0),s.value.odometer!=null?(i(),o("div",q,[e[3]||(e[3]=t("dt",{class:"text-micro uppercase text-ink-subtle"},"Odometer",-1)),t("dd",A,a(p(s.value.odometer))+" km",1)])):l("",!0),s.value.color?(i(),o("div",G,[e[4]||(e[4]=t("dt",{class:"text-micro uppercase text-ink-subtle"},"Color",-1)),t("dd",H,a(s.value.color),1)])):l("",!0),s.value.fuel_type?(i(),o("div",J,[e[5]||(e[5]=t("dt",{class:"text-micro uppercase text-ink-subtle"},"Fuel",-1)),t("dd",K,a(s.value.fuel_type),1)])):l("",!0),s.value.vin?(i(),o("div",P,[e[6]||(e[6]=t("dt",{class:"text-micro uppercase text-ink-subtle"},"VIN",-1)),t("dd",Q,a(s.value.vin),1)])):l("",!0)])]),e[8]||(e[8]=t("h2",{class:"text-title mb-3"},"Repair history",-1)),r.value.length===0?(i(),o("div",U,[...e[7]||(e[7]=[t("p",{class:"text-meta"},"No past repairs for this vehicle.",-1)])])):l("",!0),(i(!0),o(x,null,w(r.value,n=>(i(),o("article",{key:n.id,class:"rounded-card bg-surface shadow-card p-4 mb-3 active:scale-[0.99] transition cursor-pointer",onClick:it=>v(u).push(`/orders/${n.id}`)},[t("div",X,[t("div",Z,[t("div",tt,a(n.number),1),t("div",et,a(k(n.updated_at)),1)]),t("span",st,a(n.status_label||n.status),1)]),t("div",ot,a(p(n.grand_total)),1)],8,W))),128))],64)):(i(),o("div",at,"Vehicle not found."))]),V(C)])}}});export{rt as default};
//# sourceMappingURL=VehicleDetailView-DVlSuWAP.js.map
