import{c as h,w as y,a as s,t as l,f as c,o as d,b as a,F as r,r as u,d as v,l as f,n as p,j as w}from"./app-C3b5PNmt.js";import{_}from"./Layout-CoWQewh6.js";import{f as b}from"./helpers-CqmLUGKl.js";const k={class:"page-sub"},C={class:"cards section"},S={class:"card info"},x={class:"num"},A={class:"card warn"},O={class:"num"},T={class:"card ok"},N={class:"num"},V={class:"card alert"},j={class:"num"},B={class:"card info"},D={class:"num"},F={class:"card warn"},I={class:"num"},z={class:"card warn"},P={class:"num"},Q={class:"card alert"},R={class:"num"},q={class:"section panel"},$={key:0},E=["onClick"],L={style:{"font-weight":"600"}},M={style:{color:"#64748b"}},G={style:{"text-transform":"capitalize"}},H={key:1,class:"state"},J={class:"section panel"},K={style:{padding:"16px"}},U={class:"bar-label"},W={class:"bar-track"},X={class:"bar-val"},Y={class:"section panel"},ls={__name:"Supervisor",props:{today:String,cards:Object,statusCounts:Object,validationQueue:Array,byTech:Array},setup(n){const g=i=>{w.get(window.route("inspections.index"),{open:i})},m=i=>({Scheduled:"badge b-grey",Assigned:"badge b-blue","In Progress":"badge b-amber","Awaiting Validation":"badge b-purple","Needs Revision":"badge b-red",Completed:"badge b-green",Overdue:"badge b-red",Cancelled:"badge b-grey",Rescheduled:"badge b-grey"})[i]||"badge b-grey";return(i,t)=>(d(),h(_,null,{default:y(()=>[t[16]||(t[16]=s("h2",{class:"page-title"},"Supervision Dashboard",-1)),s("p",k,"Telecom & Navigation Division · "+l(c(b)(n.today)),1),s("div",C,[s("div",S,[s("div",x,l(n.cards.scheduled),1),t[0]||(t[0]=s("div",{class:"lbl"},"Scheduled / Assigned",-1))]),s("div",A,[s("div",O,l(n.cards.inProgress),1),t[1]||(t[1]=s("div",{class:"lbl"},"In progress",-1))]),s("div",T,[s("div",N,l(n.cards.completed),1),t[2]||(t[2]=s("div",{class:"lbl"},"Completed",-1))]),s("div",V,[s("div",j,l(n.cards.overdue),1),t[3]||(t[3]=s("div",{class:"lbl"},"Overdue",-1))]),s("div",B,[s("div",D,l(n.cards.awaitingValidation),1),t[4]||(t[4]=s("div",{class:"lbl"},"Awaiting validation",-1))]),s("div",F,[s("div",I,l(n.cards.needsRevision),1),t[5]||(t[5]=s("div",{class:"lbl"},"Needs revision",-1))]),s("div",z,[s("div",P,l(n.cards.openFindings),1),t[6]||(t[6]=s("div",{class:"lbl"},"Open findings",-1))]),s("div",Q,[s("div",R,l(n.cards.criticalFindings),1),t[7]||(t[7]=s("div",{class:"lbl"},"Critical findings",-1))])]),s("div",q,[t[12]||(t[12]=s("div",{class:"panel-head"},[s("h3",null,"Validation queue")],-1)),n.validationQueue.length?(d(),a("table",$,[t[10]||(t[10]=s("thead",null,[s("tr",null,[s("th",null,"Inspection"),s("th",null,"Type"),s("th",null,"Scheduled"),s("th",null,"Assigned"),s("th",null,"Status"),s("th")])],-1)),s("tbody",null,[(d(!0),a(r,null,u(n.validationQueue,e=>(d(),a("tr",{key:e.id,class:"clickable",onClick:o=>g(e.id)},[s("td",L,[v(l(e.title),1),t[8]||(t[8]=s("br",null,null,-1)),s("small",M,l(e.equipment?.name),1)]),s("td",G,l(e.inspection_type),1),s("td",null,l(c(b)(e.scheduled_date)),1),s("td",null,l(e.assignee?.name||"—"),1),s("td",null,[s("span",{class:f(m(e.status))},l(e.status),3)]),t[9]||(t[9]=s("td",null,[s("button",{class:"btn-sm"},"Validate")],-1))],8,E))),128))])])):(d(),a("div",H,[...t[11]||(t[11]=[s("div",{class:"big"},"📭",-1),v("Nothing awaiting validation.",-1)])]))]),s("div",J,[t[13]||(t[13]=s("div",{class:"panel-head"},[s("h3",null,"Inspection status distribution")],-1)),s("div",K,[(d(!0),a(r,null,u(n.statusCounts,(e,o)=>(d(),a("div",{key:o,class:"bar-row"},[s("div",U,l(o),1),s("div",W,[s("div",{class:"bar-fill",style:p({width:e/Math.max(1,...Object.values(n.statusCounts))*100+"%"})},null,4)]),s("div",X,l(e),1)]))),128))])]),s("div",Y,[t[15]||(t[15]=s("div",{class:"panel-head"},[s("h3",null,"Performance by technician")],-1)),s("table",null,[t[14]||(t[14]=s("thead",null,[s("tr",null,[s("th",null,"Technician"),s("th",null,"Total"),s("th",null,"Completed"),s("th",null,"Overdue")])],-1)),s("tbody",null,[(d(!0),a(r,null,u(n.byTech,e=>(d(),a("tr",{key:e.name},[s("td",null,l(e.name),1),s("td",null,l(e.total),1),s("td",null,l(e.completed),1),s("td",null,l(e.overdue),1)]))),128))])])])]),_:1}))}};export{ls as default};
