import{d as j,u as S,i as V,c as a,j as m,k as A,a as t,n as _,f as y,F as x,l as b,m as L,p as M,r as D,q as h,g as F,o as e,t as l,e as v}from"./index-b7Iy0dz5.js";import{u as O}from"./data-mgWZh0lg.js";import{_ as R}from"./TopBar.vue_vue_type_script_setup_true_lang-CME3XXLt.js";import{_ as T}from"./BottomNav.vue_vue_type_script_setup_true_lang-CF62GDaf.js";import{_ as q,a as g}from"./Spinner.vue_vue_type_script_setup_true_lang-CM_j_vtu.js";const z={class:"pb-24"},E={class:"grid grid-cols-2 gap-1 p-0.5 rounded-pill bg-surface-muted text-meta font-semibold"},W={class:"max-w-md mx-auto px-4 mt-4"},G={class:"grid grid-cols-4 gap-2"},H={class:"text-title text-brand-600 leading-none"},I={class:"text-[10px] text-ink-subtle uppercase mt-1 leading-tight"},J={key:1,class:"max-w-md mx-auto px-4"},K={key:2,class:"mt-4 overflow-x-auto scroll-hide px-4"},P={class:"flex gap-3 snap-x snap-mandatory"},Q={class:"flex items-center justify-between mb-2 px-1"},U={class:"text-body font-semibold"},X={class:"text-micro text-ink-subtle"},Y={key:0,class:"card p-4 text-center text-meta text-ink-subtle"},Z={key:1,class:"space-y-2"},tt=["onClick"],et={class:"flex items-center gap-2"},st={class:"font-semibold truncate"},at={key:0,class:"ml-auto"},ot={class:"text-meta text-ink-muted truncate mt-0.5"},nt={class:"flex items-center gap-2 mt-2"},rt={key:1,class:"text-micro text-ink-subtle ml-auto"},_t=j({__name:"BoardView",setup(lt){const w=F(),C=S(),i=O(),d=D("mine"),p=h(()=>{var o;return((o=i.board)==null?void 0:o.columns)??[]}),u=h(()=>i.summary);function k(){i.loadBoard(d.value)}function f(o){d.value!==o&&(d.value=o,k())}function B(o){w.push("/orders/"+o.id)}function $(o){switch((o??"").toLowerCase()){case"urgent":case"high":return"text-status-crit";case"medium":return"text-status-warn";default:return"text-ink-subtle"}}const N=h(()=>{var o,r,c,s;return[{label:"Open orders",value:(o=u.value)==null?void 0:o.open_orders},{label:"My open jobs",value:(r=u.value)==null?void 0:r.my_open_jobs},{label:"Ready pickup",value:(c=u.value)==null?void 0:c.ready_pickup},{label:"Awaiting parts",value:(s=u.value)==null?void 0:s.awaiting_parts}]});return V(()=>{i.loadSummary(),k()}),(o,r)=>{var c;return e(),a("div",z,[m(R,{title:"Workshop",subtitle:((c=y(C).me)==null?void 0:c.name)??""},{actions:A(()=>[t("div",E,[t("button",{onClick:r[0]||(r[0]=s=>f("mine")),class:_(["px-3 py-1 rounded-pill transition",d.value==="mine"?"bg-brand-600 text-white":"text-ink-muted"])},"My jobs",2),t("button",{onClick:r[1]||(r[1]=s=>f("all")),class:_(["px-3 py-1 rounded-pill transition",d.value==="all"?"bg-brand-600 text-white":"text-ink-muted"])},"All",2)])]),_:1},8,["subtitle"]),t("div",W,[t("div",G,[(e(!0),a(x,null,b(N.value,s=>(e(),a("div",{key:s.label,class:"card p-2 text-center"},[t("div",H,l(s.value??"—"),1),t("div",I,l(s.label),1)]))),128))])]),y(i).loadingBoard&&!p.value.length?(e(),L(q,{key:0,label:"Loading board…"})):p.value.length?(e(),a("div",K,[t("div",P,[(e(!0),a(x,null,b(p.value,s=>(e(),a("section",{key:s.status,class:"snap-start shrink-0 w-[78vw] max-w-[20rem]"},[t("header",Q,[t("h2",U,l(s.label),1),t("span",X,l(s.orders.length),1)]),s.orders.length?(e(),a("ul",Z,[(e(!0),a(x,null,b(s.orders,n=>(e(),a("li",{key:n.id,class:"card p-3",onClick:it=>B(n)},[t("div",et,[t("span",st,l(n.number),1),n.is_rework?(e(),a("span",at,[m(g,{status:"rework",label:"rework"})])):v("",!0)]),t("div",ot,l(n.vehicle),1),t("div",nt,[m(g,{status:n.status,label:n.status_label},null,8,["status","label"]),n.priority?(e(),a("span",{key:0,class:_(["text-micro uppercase font-bold",$(n.priority)])},l(n.priority),3)):v("",!0),n.promised_at?(e(),a("span",rt,l(n.promised_at),1)):v("",!0)])],8,tt))),128))])):(e(),a("div",Y," Nothing here. "))]))),128))])])):(e(),a("div",J,[...r[2]||(r[2]=[t("div",{class:"card p-8 text-center text-ink-subtle mt-4"},[t("div",{class:"text-3xl mb-2"},"🧰"),M(" No orders on the board. ")],-1)])])),m(T)])}}});export{_t as default};
//# sourceMappingURL=BoardView-DJ1JIm83.js.map
