import{c as V,f as F}from"./chunk-MYV7LOMK.js";import{o as G}from"./chunk-KPL7BGNQ.js";import{Aa as p,B as n,Ba as O,Bc as U,Cc as Y,E as u,Ec as $,F as h,Ka as m,La as g,Rb as D,Sb as b,X as l,Zb as T,ac as w,ba as _,bb as S,cb as R,cc as x,fc as y,gc as P,ka as E,ma as v,na as f,nc as N,oc as A,pa as s,pc as M,qa as o,ra as I,rc as k,sc as B,uc as L,ya as C}from"./chunk-IA4I4FFG.js";import{a as j}from"./chunk-LNEQX42T.js";import{k as r}from"./chunk-24IZEI4V.js";function z(a,e){if(a&1){let t=C();s(0,"ion-item",6),p("click",function(){let c=u(t).$implicit,d=O();return h(d.deliverOrder(c.idComanda))}),s(1,"ion-label",0),m(2),o()()}if(a&2){let t=e.$implicit;l(2),g((t==null?null:t.market_order_code)||(t==null?null:t.idComanda))}}var H=class a{constructor(){this.api=n(V);this.settings=n(F);this.modalCtrl=n(M);this.loadingCtrl=n(B);this.alert=n(k);this.translate=n(U);this.endpoint="api/ElementoGestion/FrontOffice/PantallaCocina/";this.translations=[];this.getTranslations(),j({close:G})}ngOnInit(){return r(this,null,function*(){let e=yield this.loadingCtrl.create({});yield e.present();let t=this.endpoint+"pendiente-entregar/"+this.settings.currentSettings[this.settings.COD_EMPRESA]+"/"+this.settings.currentSettings[this.settings.COD_RESTAURANTE]+"/"+this.settings.currentSettings[this.settings.COD_IMPRESORA_COCINA];yield this.api.getFromServer(t).then(i=>r(this,null,function*(){this.orders=i,yield e.dismiss()}))})}dismiss(){this.modalCtrl.dismiss()}getTranslations(){this.translate.get("DELIVER_ORDER_NUMBER").subscribe(e=>{this.translations.DELIVER_ORDER_NUMBER=e}),this.translate.get("YES").subscribe(e=>{this.translations.YES=e}),this.translate.get("NO").subscribe(e=>{this.translations.NO=e})}deliverOrder(e){return r(this,null,function*(){yield(yield this.alert.create({message:"\xBF"+this.translations.DELIVER_ORDER_NUMBER+" "+e+"?",buttons:[{text:this.translations.YES,handler:()=>r(this,null,function*(){let i=yield this.loadingCtrl.create({});yield i.present(),this.deliver(e).then(c=>r(this,null,function*(){let d=this.orders.findIndex(q=>q.idComanda===e);this.orders.splice(d,1),yield i.dismiss()}))})},{text:this.translations.NO,role:"cancel"}]})).present()})}deliver(e){let t=this.endpoint+"entregar/"+this.settings.currentSettings[this.settings.COD_EMPRESA]+"/"+this.settings.currentSettings[this.settings.COD_RESTAURANTE]+"/"+e;return this.api.post(t)}static{this.\u0275fac=function(t){return new(t||a)}}static{this.\u0275cmp=_({type:a,selectors:[["app-deliver-order"]],decls:12,vars:3,consts:[[1,"ion-text-center"],["slot","end"],[3,"click"],["name","close"],[1,"ion-padding"],["lines","full"],["lines","full",3,"click"]],template:function(t,i){t&1&&(s(0,"ion-header")(1,"ion-toolbar")(2,"ion-title",0),m(3),S(4,"translate"),o(),s(5,"ion-buttons",1)(6,"ion-button",2),p("click",function(){return i.dismiss()}),I(7,"ion-icon",3),o()()()(),s(8,"ion-content",4)(9,"ion-list"),v(10,z,3,1,"ion-item",5,E),o()()),t&2&&(l(3),g(R(4,1,"DELIVER_ORDERS")),l(7),f(i.orders))},dependencies:[P,T,L,D,b,y,x,N,A,w,$,Y],encapsulation:2})}};export{H as a};
