import{a as $}from"./chunk-MRIU7QTQ.js";import{e as J,k as K,p as Y,q as Z}from"./chunk-SPUEGBWO.js";import{j as q,k as G}from"./chunk-3JLWQSYQ.js";import{G as Q,ta as V,vb as X}from"./chunk-ROXKKVPK.js";import{A as l,Fa as h,Ha as u,Hc as O,Ic as U,Ja as _,Jc as W,Ka as M,Kb as P,La as T,Ma as w,Nb as A,Pc as H,Qb as N,Rc as j,S as i,Sb as E,Ta as p,Ua as d,X as I,bc as k,bd as z,cc as B,da as S,ea as v,fb as L,fc as x,ic as R,ja as c,ka as o,kc as D,la as r,ma as m,oc as F,ta as g,xb as y}from"./chunk-ZVAMPSQU.js";import{j as b}from"./chunk-FB5LSH2R.js";function ee(t,n){t&1&&(o(0,"span"),h(1),p(2,"translate"),r()),t&2&&(i(),u(" ",d(2,1,"pages.newShoppingList.create")," "))}function te(t,n){t&1&&(o(0,"span"),h(1),p(2,"translate"),r()),t&2&&(i(),u(" ",d(2,1,"pages.newShoppingList.createAndShare")," "))}var _e=(()=>{let n=class n{constructor(){this.modalCtrl=l(W),this.navCtrl=l(E),this.utilService=l(G),this.loadingService=l(J),this.serverActionsService=l(Y),this.messagingService=l(Z),this.toastCtrl=l(H),this.openAfterCreate=!0,this.saving=!1,this.listTitle="",this.selectedCollaboratorIds=[],X({closeOutline:Q,listOutline:V})}save(){return b(this,null,function*(){if(this.saving)return;this.saving=!0;let f=this.loadingService.start(),a=yield this.serverActionsService.shoppingLists.createShoppingList({title:this.listTitle,collaboratorUserIds:this.selectedCollaboratorIds});this.saving=!1,f.dismiss(),a&&(this.modalCtrl.dismiss({success:!0,id:a.id}),this.openAfterCreate&&this.navCtrl.navigateRoot(q.ShoppingListPage.getPath(a.id)))})}cancel(){this.modalCtrl.dismiss({success:!1})}};n.\u0275fac=function(a){return new(a||n)},n.\u0275cmp=I({type:n,selectors:[["page-new-shopping-list-modal"]],inputs:{openAfterCreate:"openAfterCreate"},decls:20,vars:12,consts:[["slot","end"],[3,"click"],["name","close-outline","slot","icon-only"],[1,"ion-padding"],["type","text","autocapitalize","on","autocorrect","on",3,"ngModelChange","label","ngModel"],[3,"selectedCollaboratorIdsChanged","selectedCollaboratorIds"],["expand","block",3,"click","disabled"],["name","list-outline","slot","start"]],template:function(a,e){a&1&&(o(0,"ion-header")(1,"ion-toolbar")(2,"ion-title"),h(3),p(4,"translate"),r(),o(5,"ion-buttons",0)(6,"ion-button",1),g("click",function(){return e.cancel()}),m(7,"ion-icon",2),r()()()(),o(8,"ion-content",3)(9,"text-input",4),p(10,"translate"),T("ngModelChange",function(s){return M(e.listTitle,s)||(e.listTitle=s),s}),r(),m(11,"br")(12,"br"),o(13,"select-collaborators",5),g("selectedCollaboratorIdsChanged",function(s){return e.selectedCollaboratorIds=s}),r()(),o(14,"ion-footer",3)(15,"ion-button",6),g("click",function(){return e.save()}),m(16,"ion-icon",7),o(17,"ion-label"),S(18,ee,3,3,"span"),S(19,te,3,3,"span"),r()()()),a&2&&(i(3),u(" ",d(4,8,"pages.newShoppingList.title")," "),i(6),c("label",w(d(10,10,"pages.newShoppingList.listTitle"))),_("ngModel",e.listTitle),i(4),c("selectedCollaboratorIds",e.selectedCollaboratorIds),i(2),c("disabled",!e.listTitle),i(3),v(e.selectedCollaboratorIds.length===0?18:-1),i(),v(e.selectedCollaboratorIds.length>0?19:-1))},dependencies:[L,N,P,A,y,$,K,D,U,O,B,k,j,x,R,F,z],encapsulation:2});let t=n;return t})();export{_e as a};
