import{a as q}from"./chunk-4VPKYDQG.js";import{a as W}from"./chunk-CXHGMIU7.js";import{a as z}from"./chunk-FWFSSKBJ.js";import{f as Y}from"./chunk-MYV7LOMK.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 b,Qb as T,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-IA4I4FFG.js";import"./chunk-TZKEAXTW.js";import"./chunk-LNEQX42T.js";import"./chunk-2AGRZFDF.js";import"./chunk-RJD74PWK.js";import"./chunk-7Y4TN2QM.js";import"./chunk-JJB3Y43V.js";import"./chunk-YUNOCBLG.js";import"./chunk-VGMJM2GZ.js";import"./chunk-2NIBOUWM.js";import"./chunk-I547WOKC.js";import"./chunk-BJ43HUSB.js";import"./chunk-7NPRN4HX.js";import"./chunk-NMFL75IO.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(b);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,T,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};
