import{a as z}from"./chunk-ETF5LFT3.js";import{a as q}from"./chunk-W4XSW6AJ.js";import{a as G}from"./chunk-WWNSR6WM.js";import{f as j}from"./chunk-MT5VNIHV.js";import"./chunk-KPL7BGNQ.js";import{$ as v,$a as C,$b as B,Ac as U,B as a,Cc as W,E as y,F as E,Ia as d,Ja as f,Jb as b,Ob as k,Pb as M,Qb as V,U as r,Xb as D,Yb as F,_b as O,ab as h,ac as L,dc as A,ga as I,ha as x,ia as P,ka as S,la as w,lc as N,ma as u,mc as R,na as n,nc as $,oa as o,pa as _,rc as H,sc as Y,wa as T,ya as m,za as p}from"./chunk-DRW4ORQZ.js";import"./chunk-BJ5K5KE7.js";import"./chunk-LNEQX42T.js";import"./chunk-3ZOJ5B5W.js";import"./chunk-3ITX5V5R.js";import"./chunk-KOWO2Z3R.js";import"./chunk-ZYIC63LD.js";import"./chunk-F2T7ZI6U.js";import"./chunk-4WFVMWDK.js";import"./chunk-M2X7KQLB.js";import"./chunk-DVVH2KKN.js";import"./chunk-NV3QH4JK.js";import"./chunk-LRFGNCHE.js";import"./chunk-OZYWYLNK.js";import"./chunk-42C7ZIID.js";import{k as c}from"./chunk-24IZEI4V.js";function Q(l,t){if(l&1&&_(0,"ion-img",9),l&2){let e=p().$implicit,i=p();u("src",i.settings.currentSettings[i.settings.API_SERVER_URL]+"/imgs/camareros/"+e.foto)}}function X(l,t){if(l&1){let e=T();n(0,"ion-item",7),m("click",function(){let g=y(e).$implicit,K=p();return E(K.selectEmployee(g))}),n(1,"ion-avatar",8),I(2,Q,1,1,"ion-img",9),o(),n(3,"ion-label"),d(4),o()()}if(l&2){let e=t.$implicit,i=p();u("color",(i.selectedEmployee==null?null:i.selectedEmployee.codigo)===e.codigo?"secondary":"none"),r(2),x(e.foto!==""?2:-1),r(2),f(e.nombre)}}var s=class s{constructor(){this.employees=a(z);this.toastCtrl=a(H);this.settings=a(j);this.navCtrl=a(b);this.modalCtrl=a($);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 c(this,null,function*(){yield this.modalCtrl.create({component:q}).then(t=>{t.present()})})}selectEmployee(t){return c(this,null,function*(){let e=!0;t.password!==""&&(e=yield this.inputPassword(t.password)),e&&(this.selectedEmployee=t,this.save())})}inputPassword(t){return c(this,null,function*(){let e=yield this.modalCtrl.create({component:G,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 c(this,null,function*(){(yield this.toastCtrl.create({message:t,duration:3e3,position:"top"})).present()})}};s.\u0275fac=function(e){return new(e||s)},s.\u0275cmp=v({type:s,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&&(n(0,"ion-header")(1,"ion-toolbar")(2,"ion-buttons")(3,"ion-title",0),d(4),C(5,"translate"),o(),n(6,"ion-button",1),m("click",function(){return i.goToConfig()}),_(7,"ion-icon",2),o()()()(),n(8,"ion-content",3),S(9,X,5,3,"ion-item",4,P),o(),n(11,"ion-footer",5)(12,"ion-button",6),m("click",function(){return i.save()}),d(13),C(14,"translate"),o()()),e&2&&(r(4),f(h(5,2,"CHEF_SELECTION")),r(5),w(i.empleados),r(4),f(h(14,4,"SAVE")))},dependencies:[F,A,B,k,L,Y,M,V,O,R,N,D,W,U],styles:["ion-item[_ngcontent-%COMP%]{margin:10px;width:300px;float:left;cursor:pointer}"]});var J=s;export{J as ChefSelectionPage};
