import{an as P,x as B,u as _,a as v,c as S,o as I,j as u,e as s,b as k,H as L,f as l,g as c,P as M,w as d,F as N,k as C,q as A,n as h,Q as x,h as b,l as q,t as i,B as z,A as F}from"./index-OSKNspXo.js";const T={key:0,class:"q-pa-md"},$={key:0},j={class:"text-caption text-grey"},D={key:1,class:"text-center q-pa-md"},E={key:1,class:"text-center q-pa-md"},R={__name:"deenovaPrinterListComponent",props:{maxPrintValue:{type:Number,default:1},mag:{type:String},command:{type:String},showQuantity:{type:Boolean,default:!0},enabled:{type:Boolean,default:!0},disabledMessage:{type:String},startAtMax:{type:Boolean,default:!1}},emits:["printLabels"],setup(e,{emit:Q}){const y=P(),f=B(),{t:m}=_(),p=v([]),r=v(0),g=S(()=>r.value>0&&r.value<=a.maxPrintValue),a=e,V=Q,w=t=>{if(!a.enabled){console.warn("Printing is disabled");return}V("printLabels",{printerPk:t,quantity:r.value})};return I(async()=>{var o;let t=null;a.mag?t=await y.send("get","printers",a.mag,null,{quasar:f}):a.command&&(t=await y.send("get","printers",`command/${a.command}`,null,{quasar:f})),(o=t.data)!=null&&o.printers?p.value=t.data.printers:console.error("Printer list : Failed to fetch printers"),a.startAtMax&&(r.value=a.maxPrintValue)}),(t,o)=>e.enabled?(s(),u("div",T,[p.value.length>0?(s(),u("div",$,[e.showQuantity?(s(),k(M,{key:0,modelValue:r.value,"onUpdate:modelValue":o[0]||(o[0]=n=>r.value=n),type:"number",label:c(m)("ui.printer.label_qty.text"),min:0,max:e.maxPrintValue,error:!g.value},null,8,["modelValue","label","max","error"])):L("",!0),l(z,{dense:""},{default:d(()=>[(s(!0),u(N,null,C(p.value,n=>(s(),k(A,{key:n.pk,clickable:"",disable:!g.value,onClick:()=>{g.value&&w(n.pk)}},{default:d(()=>[l(h,{avatar:""},{default:d(()=>[l(x,{name:"printer"})]),_:1}),l(h,null,{default:d(()=>[b("div",null,[q(i(n.name)+" ",1),b("div",j,i(c(m)("ui.printer.label_size.text"))+" : "+i(n.label_width)+"×"+i(n.label_height),1)])]),_:2},1024)]),_:2},1032,["disable","onClick"]))),128))]),_:1})])):(s(),u("div",D,[l(x,{name:"warning",color:"amber",size:"sm",class:"q-mr-xs"}),b("span",null,i(c(m)("ui.printer.no_printers.text")),1),l(F,null,{default:d(()=>[q(i(e.mag?e.mag:e.command?e.command:"N/A"),1)]),_:1})]))])):(s(),u("div",E,[l(x,{name:"warning",color:"amber",size:"sm",class:"q-mr-xs"}),b("span",null,i(e.disabledMessage?e.disabledMessage:c(m)("ui.printer.printing_disabled.text")),1)]))}};export{R as _};
//# sourceMappingURL=deenovaPrinterListComponent-DVDZgpK4.js.map
