import{d as x,m as s,o,a,f as n,t as r,j as l,q as i}from"./app-bWy6VYs1.js";const f={class:"flex items-start justify-between gap-1"},h={class:"truncate text-[11px] font-bold leading-tight text-slate-900"},y={key:0,class:"shrink-0 text-amber-600",title:"Scheduling conflict"},_={key:0,class:"truncate text-[10px] leading-tight text-slate-600"},j={key:1,class:"truncate text-[10px] text-slate-500"},w={class:"mt-auto flex flex-wrap gap-0.5 pt-0.5"},k=x({__name:"DispatchJobcardBlock",props:{job:{},compact:{type:Boolean},conflictIds:{}},setup(d){const t=d,p=s(()=>t.job.job_number||`Jobcard #${t.job.id}`),b=s(()=>{const e=t.job.customer;return e?e.city||(e.address?String(e.address).split(",")[0]?.trim():"")||e.name:""}),u=s(()=>{const e=t.job.status??"new";return{new:"bg-slate-100 text-slate-800",needs_scheduling:"bg-amber-100 text-amber-900",scheduled:"bg-blue-100 text-blue-900",dispatched:"bg-indigo-100 text-indigo-900",accepted:"bg-cyan-100 text-cyan-900",en_route:"bg-sky-100 text-sky-900",on_site:"bg-violet-100 text-violet-900",paused:"bg-orange-100 text-orange-900",waiting_for_parts:"bg-yellow-100 text-yellow-900",needs_follow_up:"bg-fuchsia-100 text-fuchsia-900",emergency:"bg-red-100 text-red-900",completed:"bg-emerald-100 text-emerald-900",cancelled:"bg-rose-100 text-rose-900"}[e]??"bg-gray-100 text-gray-800"}),g=s(()=>{const e=t.job.priority??"normal";return e==="urgent"?"border-red-300 bg-red-50 text-red-800":e==="high"?"border-orange-300 bg-orange-50 text-orange-900":e==="low"?"border-slate-200 bg-slate-50 text-slate-600":"border-slate-200 bg-white text-slate-700"}),c=s(()=>t.conflictIds?.has(t.job.id)??!1);return(e,m)=>(o(),a("div",{class:i(["flex h-full min-h-[52px] flex-col overflow-hidden rounded-md border border-slate-200 bg-white px-1.5 py-1 text-left shadow-sm",c.value?"ring-2 ring-amber-400":""])},[n("div",f,[n("span",h,r(p.value),1),c.value?(o(),a("span",y,"!")):l("",!0)]),e.compact?l("",!0):(o(),a("div",_,r(e.job.customer?.name),1)),e.compact?l("",!0):(o(),a("div",j,r(b.value),1)),n("div",w,[n("span",{class:i(["rounded px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide",u.value])},r((e.job.status??"new").replace(/_/g," ")),3),e.job.priority&&e.job.priority!=="normal"?(o(),a("span",{key:0,class:i(["rounded border px-1 py-0.5 text-[9px] font-semibold uppercase",g.value])},r(e.job.priority),3)):l("",!0)])],2))}});export{k as _};
