PageSourceSearch

https://podolab.ai/assets/admin.printers-DvTCKMjL.js

js podolab.ai collected 2026-10-05 15:18:43 UTC 6,705 bytes, 1 lines download raw bytes

1import{b4 as B,A as o,V as y,r as u,j as e,i as P,n as l,B as S,I as x,v as h}from"./index-CYHFdmVv.js";import{u as C,B as m,C as j,a as p,b as g,c as w}from"./badge-yQDl-xq0.js";import{S as E,a as L,b as I,c as A,d as K}from"./select-Bk6YpjzK.js";import{l as Q,a as J,u as V,d as R}from"./printer.functions-Dxw7Svn5.js";import{P as U}from"./printer-Qw3mb6AM.js";import{T as D}from"./trash-2-Cel8Gpkf.js";import{P as G}from"./plus-yBm5vyCw.js";import{S as H}from"./save-BdvYRUJP.js";import"./index-BdQq_4o_.js";import"./index-Du9utITW.js";import"./index-DJdK9FOv.js";import"./chevron-down-CeRuf9cI.js";const O=["offline","idle","printing","paused","error"],W={offline:"border-white/15 bg-white/5 text-white/60",idle:"border-sky-400/40 bg-sky-400/10 text-sky-200",printing:"border-emerald-400/40 bg-emerald-400/10 text-emerald-200",paused:"border-amber-400/40 bg-amber-400/10 text-amber-200",error:"border-red-400/40 bg-red-400/10 text-red-200"};function de(){const b=B(),F=o(Q),z=o(J),_=o(V),q=o(R),N=y({queryKey:["printers"],queryFn:()=>F()}),r=y({queryKey:["print-jobs"],queryFn:()=>z()}),[i,n]=u.useState({status:"offline"}),T=u.useMemo(()=>{const s=new Map;for(const t of r.data?.jobs??[]){if(!t.printer_id)continue;const c=s.get(t.printer_id)??[];c.push(t),s.set(t.printer_id,c)}return s},[r.data]),v=u.useMemo(()=>(r.data?.jobs??[]).filter(s=>!s.printer_id),[r.data]),d=C({mutationFn:s=>_({data:s}),onSuccess:()=>{b.invalidateQueries({queryKey:["printers"]}),n({status:"offline"}),h.success("Printer opgeslagen")},onError:s=>h.error(s.message)}),k=C({mutationFn:s=>q({data:{id:s}}),onSuccess:()=>{b.invalidateQueries({queryKey:["printers"]}),h.success("Printer verwijderd")},onError:s=>h.error(s.message)}),f=N.data?.printers??[];return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("header",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Printer Management"}),e.jsx("p",{className:"text-sm text-white/60",children:"Beheer PodoPrinters, wachtrij en jobs. (Nog geen echte printercommunicatie.)"})]}),e.jsxs("div",{className:"flex gap-2 text-xs text-white/60",children:[e.jsxs(m,{variant:"outline",className:"border-white/15 bg-white/5",children:[f.length," printers"]}),e.jsxs(m,{variant:"outline",className:"border-white/15 bg-white/5",children:[(r.data?.jobs??[]).length," jobs"]})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:[N.isLoading&&e.jsxs("div",{className:"col-span-full flex items-center gap-2 text-white/60",children:[e.jsx(P,{className:"size-4 animate-spin"})," Printers laden…"]}),f.map(s=>{const t=T.get(s.id)??[],c=t.filter(a=>a.status==="printing").length,M=t.filter(a=>a.status==="pending"||a.status==="queued").length;return e.jsxs(j,{className:"border-white/10 bg-white/5 text-white backdrop-blur",children:[e.jsxs(p,{className:"pb-2 flex flex-row items-center justify-between",children:[e.jsxs(g,{className:"flex items-center gap-2 text-sm",children:[e.jsx(U,{className:"size-4 text-white/60"}),s.name]}),e.jsx(m,{variant:"outline",className:"text-[10px] "+(W[s.status]??""),children:s.status})]}),e.jsxs(w,{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs text-white/60",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-white/40",children:"Locatie:"})," ",s.location??"—"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-white/40",children:"Model:"})," ",s.model??"—"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-white/40",children:"IP:"})," ",s.ip_address??"—"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-white/40",children:"Actief:"})," ",c," ·"," ",e.jsx("span",{className:"text-white/40",children:"wachtrij:"})," ",M]})]}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx(l,{className:"text-[10px] text-white/40",children:"Status wijzigen"}),e.jsxs(E,{value:s.status,onValueChange:a=>d.mutate({id:s.id,status:a}),children:[e.jsx(L,{className:"h-8 border-white/15 bg-white/5 text-xs text-white",children:e.jsx(I,{})}),e.jsx(A,{children:O.map(a=>e.jsx(K,{value:a,children:a},a))})]})]}),e.jsx(S,{variant:"ghost",size:"sm",className:"text-red-300 hover:bg-red-400/10",onClick:()=>{confirm(`Printer "${s.name}" verwijderen?`)&&k.mutate(s.id)},children:e.jsx(D,{className:"size-3.5"})})]})]})]},s.id)}),e.jsxs(j,{className:"border-dashed border-white/15 bg-white/[0.02] text-white",children:[e.jsx(p,{className:"pb-2",children:e.jsxs(g,{className:"flex items-center gap-2 text-sm text-white/80",children:[e.jsx(G,{className:"size-4"})," Nieuwe printer"]})}),e.jsxs(w,{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx(l,{className:"text-[10px] text-white/40",children:"Naam"}),e.jsx(x,{value:i.name??"",onChange:s=>n(t=>({...t,name:s.target.value})),className:"h-8 border-white/15 bg-white/5 text-xs"})]}),e.jsxs("div",{children:[e.jsx(l,{className:"text-[10px] text-white/40",children:"Locatie"}),e.jsx(x,{value:i.location??"",onChange:s=>n(t=>({...t,location:s.target.value})),className:"h-8 border-white/15 bg-white/5 text-xs"})]}),e.jsxs("div",{children:[e.jsx(l,{className:"text-[10px] text-white/40",children:"Model"}),e.jsx(x,{value:i.model??"",onChange:s=>n(t=>({...t,model:s.target.value})),className:"h-8 border-white/15 bg-white/5 text-xs"})]}),e.jsxs("div",{children:[e.jsx(l,{className:"text-[10px] text-white/40",children:"IP-adres"}),e.jsx(x,{value:i.ip_address??"",onChange:s=>n(t=>({...t,ip_address:s.target.value})),placeholder:"192.168.…",className:"h-8 border-white/15 bg-white/5 text-xs"})]})]}),e.jsxs(S,{size:"sm",disabled:!i.name||d.isPending,onClick:()=>d.mutate(i),className:"w-full gap-1",children:[d.isPending?e.jsx(P,{className:"size-3.5 animate-spin"}):e.jsx(H,{className:"size-3.5"}),"Printer toevoegen"]})]})]})]}),e.jsxs(j,{className:"border-white/10 bg-white/5 text-white backdrop-blur",children:[e.jsx(p,{className:"pb-2",children:e.jsx(g,{className:"text-sm text-white/70",children:"Wachtrij (niet toegewezen)"})}),e.jsx(w,{children:v.length===0?e.jsx("div",{className:"text-xs text-white/40",children:"Geen wachtende jobs zonder printer."}):e.jsx("div",{className:"divide-y divide-white/5",children:v.map(s=>e.jsxs("div",{className:"flex items-center justify-between py-2 text-xs",children:[e.jsxs("span",{className:"text-white/70",children:["Order ",s.production_order_id.slice(0,8),"…"]}),e.jsx(m,{variant:"outline",className:"border-white/15 bg-white/5 text-[10px] text-white/60",children:s.status})]},s.id))})})]})]})}export{de as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.