import{a as q}from"./chunk-VES76S6D.js";import{a as W}from"./chunk-7QGRNZQO.js";import{a as z}from"./chunk-NLHRNPTR.js";import{f as Y}from"./chunk-XLWMYK7F.js";import"./chunk-KPL7BGNQ.js";import{Aa as p,B as r,Ba as c,Cc as j,E as h,Ec as U,F as y,Ka as m,La as d,Lb as T,Qb as b,Rb as k,Sb as M,X as s,Zb as V,_b as D,ac as F,ba as E,bb as _,bc as O,cb as C,cc as B,fc as L,ia as v,ja as I,ka as P,ma as S,na as x,nc as A,oa as g,oc as N,pa as o,pc as R,qa as a,ra as u,tc as $,uc as H,ya as w}from"./chunk-RBLFZ2PJ.js";import"./chunk-IPY3USQV.js";import"./chunk-LNEQX42T.js";import"./chunk-NJFOIAJX.js";import"./chunk-SCFRQ6PW.js";import"./chunk-6P64VPBS.js";import"./chunk-2VLWLWMI.js";import"./chunk-J5EEBZ33.js";import"./chunk-4WFVMWDK.js";import"./chunk-K7C27B2F.js";import"./chunk-DVVH2KKN.js";import"./chunk-NV3QH4JK.js";import"./chunk-LRFGNCHE.js";import"./chunk-PVMEIX5M.js";import"./chunk-42C7ZIID.js";import{k as l}from"./chunk-24IZEI4V.js";function K(n,t){if(n&1&&u(0,"ion-img",9),n&2){let e=c().$implicit,i=c();g("src",i.settings.currentSettings[i.settings.API_SERVER_URL]+"/imgs/camareros/"+e.foto)}}function Q(n,t){if(n&1){let e=w();o(0,"ion-item",7),p("click",function(){let f=h(e).$implicit,J=c();return y(J.selectEmployee(f))}),o(1,"ion-avatar",8),v(2,K,1,1,"ion-img",9),a(),o(3,"ion-label"),m(4),a()()}if(n&2){let e=t.$implicit,i=c();g("color",(i.selectedEmployee==null?null:i.selectedEmployee.codigo)===e.codigo?"secondary":"none"),s(2),I(e.foto!==""?2:-1),s(2),d(e.nombre)}}var G=class n{constructor(){this.employees=r(q);this.toastCtrl=r($);this.settings=r(Y);this.navCtrl=r(T);this.modalCtrl=r(R);this.empleados=[]}ionViewWillEnter(){this.settings.setValue(this.settings.EMPLOYEE,null),this.employees.getEmpleados().then(t=>{t!==void 0&&(this.empleados=t.filter(e=>e.tipo_emp===this.settings.currentSettings[this.settings.COD_TIPO_EMPLEADO]))})}goToConfig(){return l(this,null,function*(){yield this.modalCtrl.create({component:W}).then(t=>{t.present()})})}selectEmployee(t){return l(this,null,function*(){let e=!0;t.password!==""&&(e=yield this.inputPassword(t.password)),e&&(this.selectedEmployee=t,this.save())})}inputPassword(t){return l(this,null,function*(){let e=yield this.modalCtrl.create({component:z,componentProps:{password:t}});return e.present(),(yield e.onDidDismiss()).data})}save(){this.selectedEmployee&&this.settings.setValue(this.settings.EMPLOYEE,this.selectedEmployee).then(()=>{this.navCtrl.navigateForward("/home")})}displayToast(t){return l(this,null,function*(){(yield this.toastCtrl.create({message:t,duration:3e3,position:"top"})).present()})}static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275cmp=E({type:n,selectors:[["app-chef-selection"]],decls:15,vars:6,consts:[[1,"ion-text-center"],[3,"click"],["name","settings"],[1,"ion-padding"],[3,"color"],[2,"display","none"],["expand","full","color","tertiary",1,"saveButton",3,"click"],[3,"click","color"],["slot","start"],[3,"src"]],template:function(e,i){e&1&&(o(0,"ion-header")(1,"ion-toolbar")(2,"ion-buttons")(3,"ion-title",0),m(4),_(5,"translate"),a(),o(6,"ion-button",1),p("click",function(){return i.goToConfig()}),u(7,"ion-icon",2),a()()()(),o(8,"ion-content",3),S(9,Q,5,3,"ion-item",4,P),a(),o(11,"ion-footer",5)(12,"ion-button",6),p("click",function(){return i.save()}),m(13),_(14,"translate"),a()()),e&2&&(s(4),d(C(5,2,"CHEF_SELECTION")),s(5),x(i.empleados),s(4),d(C(14,4,"SAVE")))},dependencies:[D,L,O,b,B,H,k,M,F,N,A,V,U,j],styles:["ion-item[_ngcontent-%COMP%]{margin:10px;width:300px;float:left;cursor:pointer}"]})}};export{G as ChefSelectionPage};
