import{c as I}from"./chunk-BW6NO6OF.js";import{b as Q,c as Y,f as q}from"./chunk-MYV7LOMK.js";import{G as Z,O as ee,Q as te,n as X}from"./chunk-KPL7BGNQ.js";import{$b as $,Aa as C,B as c,Ba as u,Cc as J,Ec as K,Ka as a,La as s,Rb as O,Sb as k,X as r,Yb as F,Zb as D,_b as R,ac as B,ba as y,bb as S,cb as _,cc as H,gc as z,hc as A,ia as g,ja as f,jc as N,ka as P,ma as h,na as x,nc as j,oa as T,oc as L,pa as o,pc as U,qa as i,ra as m,sc as G,tb as M,ub as w,uc as V,x as E}from"./chunk-IA4I4FFG.js";import{a as W}from"./chunk-LNEQX42T.js";import{k as l}from"./chunk-24IZEI4V.js";var v=class n{constructor(){this.api=c(Y);this.endpoint="api/ElementoGestion/Gestion/Impresora/screens/";let t=c(q);this.endpoint=this.endpoint+t.currentSettings[t.COD_EMPRESA]+"/",this.endpoint=this.endpoint+t.currentSettings[t.COD_RESTAURANTE]+"/"}getScreens(){return l(this,null,function*(){return yield this.api.getFromServer(this.endpoint)})}static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275prov=E({token:n,factory:n.\u0275fac,providedIn:"root"})}};function oe(n,t){if(n&1&&(o(0,"ion-item",14)(1,"ion-grid")(2,"ion-row")(3,"ion-col",15),a(4),i(),o(5,"ion-col",9),a(6),S(7,"number"),i(),o(8,"ion-col",7),a(9),i(),o(10,"ion-col",9),a(11),i(),o(12,"ion-col",12),a(13),i()()()()),n&2){let e=u().$implicit;T("product",e),r(4),s(e.Descripcion),r(2),s(_(7,6,e.Cantidad)),r(3),s(e.CamareroMarchado),r(2),s(e.Mesa),r(2),s(e.Hora)}}function re(n,t){if(n&1&&g(0,oe,14,8,"ion-item",14),n&2){let e=t.$implicit;f(e.Marcado===1&&e.Servido===0?0:-1)}}function ce(n,t){if(n&1&&(o(0,"ion-list",6)(1,"ion-list-header")(2,"ion-grid")(3,"ion-row",0)(4,"ion-col")(5,"h3"),a(6),i()()(),o(7,"ion-row")(8,"ion-col",7),m(9,"ion-icon",8),i(),o(10,"ion-col",9),a(11),S(12,"translate"),i(),o(13,"ion-col",7),m(14,"ion-icon",10),i(),o(15,"ion-col",9),m(16,"ion-icon",11),i(),o(17,"ion-col",12),m(18,"ion-icon",13),i()()()(),h(19,re,1,1,null,null,P),i()),n&2){let e=u(),d=e.$implicit,p=e.$index,b=u();r(6),s(b.screens[p]==null?null:b.screens[p].nombre),r(5),s(_(12,2,"QUANTITY")),r(8),x(d)}}function ae(n,t){if(n&1&&g(0,ce,21,4,"ion-list",6),n&2){let e=t.$implicit,d=t.$index,p=u();f(p.checkScreen(e,d)?0:-1)}}var ne=class n{constructor(){this.products=c(I);this.promisesHandler=c(Q);this.screensService=c(v);this.productsService=c(I);this.modalCtrl=c(U);this.loadingCtrl=c(G);this.screens=[];W({clipboard:X,person:Z,time:ee,volumeHigh:te})}ngOnInit(){return l(this,null,function*(){yield this.productsService.getSelectedProduct().subscribe(t=>{this.selectedProducts=t}),yield this.getScreens()})}getScreens(){return l(this,null,function*(){yield this.screensService.getScreens().then(t=>{t.forEach(e=>{this.screens[e.codigo]=e})})})}checkScreen(t,e){return t!==void 0&&t.length>0&&this.screens!==void 0}serve(){return l(this,null,function*(){yield this.loadingCtrl.create({}).then(t=>l(this,null,function*(){yield t.present(),this.productsService.processProducts(this.selectedProducts,this.productsService.SERVIR).then(()=>l(this,null,function*(){yield t.dismiss()}))}))})}dismiss(){this.modalCtrl.dismiss()}static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275cmp=y({type:n,selectors:[["app-serve-products"]],decls:15,vars:3,consts:[[1,"ion-text-center"],["slot","end",3,"click"],["name","close"],[1,"ion-padding"],["expand","block","fill","outline","size","large","color","success","icon-left","",3,"click"],["name","volume-high"],[1,"prodCenter"],["size","4",1,"ion-text-center"],["name","clipboard"],["size","1",1,"ion-text-center"],["name","person"],["name","open"],["size","2",1,"ion-text-center"],["name","time"],["appSelectProduct","",3,"product"],["size","4"]],template:function(e,d){e&1&&(o(0,"ion-header")(1,"ion-toolbar")(2,"ion-buttons")(3,"ion-title",0),a(4),S(5,"translate"),i(),o(6,"ion-button",1),C("click",function(){return d.dismiss()}),m(7,"ion-icon",2),i()()()(),o(8,"ion-content",3),h(9,ae,1,1,null,null,P),i(),o(11,"ion-footer")(12,"ion-toolbar",0)(13,"ion-button",4),C("click",function(){return d.serve()}),m(14,"ion-icon",5),i()()()),e&2&&(r(4),s(_(5,1,"SERVE_PRODUCTS")),r(5),x(d.screensProducts))},dependencies:[R,H,V,j,k,O,F,$,A,z,D,N,L,B,w,K,M,J],styles:["ion-grid[_ngcontent-%COMP%]{width:100%;padding:0}ion-grid[_ngcontent-%COMP%]   ion-row[_ngcontent-%COMP%]{width:100%}ion-grid[_ngcontent-%COMP%]   ion-row[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{height:2em;line-height:2em;background-color:var(--ion-color-warning);border-bottom:2px solid rgba(0,0,0,.2);margin-bottom:0;color:#000;font-size:1.2em}ion-item[_ngcontent-%COMP%]{--ion-safe-area-right: 0}"]})}};export{v as a,ne as b};
