import{c as F,f as U}from"./chunk-MT5VNIHV.js";import{o as H}from"./chunk-KPL7BGNQ.js";import{$ as E,$a as R,Ac as $,B as n,Cc as j,E as u,F as _,Ia as m,Ja as g,Pb as b,Qb as T,U as l,Xb as w,_b as x,ab as D,ac as N,dc as A,ec as M,ia as v,ka as f,la as I,lc as P,mc as y,na as s,nc as k,oa as o,pa as C,pc as B,qc as L,sc as V,wa as O,ya as p,za as S,zc as Y}from"./chunk-DRW4ORQZ.js";import{a as G}from"./chunk-LNEQX42T.js";import{k as r}from"./chunk-24IZEI4V.js";function J(h,t){if(h&1){let e=O();s(0,"ion-item",6),p("click",function(){let c=u(e).$implicit,d=S();return _(d.deliverOrder(c.idComanda))}),s(1,"ion-label",0),m(2),o()()}if(h&2){let e=t.$implicit;l(2),g((e==null?null:e.market_order_code)||(e==null?null:e.idComanda))}}var a=class a{constructor(){this.api=n(F);this.settings=n(U);this.modalCtrl=n(k);this.loadingCtrl=n(L);this.alert=n(B);this.translate=n(Y);this.endpoint="api/ElementoGestion/FrontOffice/PantallaCocina/";this.translations=[];this.getTranslations(),G({close:H})}ngOnInit(){return r(this,null,function*(){let t=yield this.loadingCtrl.create({});yield t.present();let e=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(e).then(i=>r(this,null,function*(){this.orders=i,yield t.dismiss()}))})}dismiss(){this.modalCtrl.dismiss()}getTranslations(){this.translate.get("DELIVER_ORDER_NUMBER").subscribe(t=>{this.translations.DELIVER_ORDER_NUMBER=t}),this.translate.get("YES").subscribe(t=>{this.translations.YES=t}),this.translate.get("NO").subscribe(t=>{this.translations.NO=t})}deliverOrder(t){return r(this,null,function*(){yield(yield this.alert.create({message:"\xBF"+this.translations.DELIVER_ORDER_NUMBER+" "+t+"?",buttons:[{text:this.translations.YES,handler:()=>r(this,null,function*(){let i=yield this.loadingCtrl.create({});yield i.present(),this.deliver(t).then(c=>r(this,null,function*(){let d=this.orders.findIndex(z=>z.idComanda===t);this.orders.splice(d,1),yield i.dismiss()}))})},{text:this.translations.NO,role:"cancel"}]})).present()})}deliver(t){let e=this.endpoint+"entregar/"+this.settings.currentSettings[this.settings.COD_EMPRESA]+"/"+this.settings.currentSettings[this.settings.COD_RESTAURANTE]+"/"+t;return this.api.post(e)}};a.\u0275fac=function(e){return new(e||a)},a.\u0275cmp=E({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(e,i){e&1&&(s(0,"ion-header")(1,"ion-toolbar")(2,"ion-title",0),m(3),R(4,"translate"),o(),s(5,"ion-buttons",1)(6,"ion-button",2),p("click",function(){return i.dismiss()}),C(7,"ion-icon",3),o()()()(),s(8,"ion-content",4)(9,"ion-list"),f(10,J,3,1,"ion-item",5,v),o()()),e&2&&(l(3),g(D(4,1,"DELIVER_ORDERS")),l(7),I(i.orders))},dependencies:[M,w,V,b,T,A,N,P,y,x,j,$],encapsulation:2});var q=a;export{q as a};
