(self.webpackChunkapp=self.webpackChunkapp||[]).push([[8496],{48496:(I,S,r)=>{r.r(S),r.d(S,{CreateEventEventBookeiPageModule:()=>w});var u=r(61380),P=r(69270),E=r(15861),f=r(24889),B=r(64633),e=r(45449),s=r(47898),h=r(90603),v=r(55832),C=r(21284),T=r(37763),k=r(90944),b=r(36290),O=r(64245),x=r(37792),M=r(99826);function A(a,p){if(1&a){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementContainerStart(0),e.\u0275\u0275elementStart(1,"div",13),e.\u0275\u0275pipe(2,"translate"),e.\u0275\u0275elementStart(3,"ion-fab-button",14),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(i.openAddModal())}),e.\u0275\u0275element(4,"ion-icon",15),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementContainerEnd()}if(2&a){const t=p.ngIf,o=e.\u0275\u0275nextContext();e.\u0275\u0275advance(1),e.\u0275\u0275attribute("aria-label",e.\u0275\u0275pipeBind1(2,2,"ACCESSIBILITY.ARIA_LABELS.ADD")),e.\u0275\u0275advance(2),e.\u0275\u0275property("disabled",!o.settings&&!o.requestFinish||"Offline"===t.status||o.disableBtn)}}function y(a,p){if(1&a){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"app-card-booking-component",17),e.\u0275\u0275listener("onSelected",function(){const c=e.\u0275\u0275restoreView(t).$implicit,g=e.\u0275\u0275nextContext(2);return e.\u0275\u0275resetView(g.toggleActions(c))})("onDelete",function(i){e.\u0275\u0275restoreView(t);const c=e.\u0275\u0275nextContext(2);return e.\u0275\u0275resetView(c.canDelete(i))}),e.\u0275\u0275elementEnd()}2&a&&e.\u0275\u0275property("booking",p.$implicit)}function R(a,p){if(1&a&&(e.\u0275\u0275elementContainerStart(0),e.\u0275\u0275template(1,y,1,1,"app-card-booking-component",16),e.\u0275\u0275elementContainerEnd()),2&a){const t=e.\u0275\u0275nextContext();e.\u0275\u0275advance(1),e.\u0275\u0275property("ngForOf",t.selectedBooking)}}function F(a,p){1&a&&(e.\u0275\u0275elementStart(0,"div",18)(1,"span",19),e.\u0275\u0275text(2),e.\u0275\u0275pipe(3,"translate"),e.\u0275\u0275elementEnd()()),2&a&&(e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(3,1,"PG_CREATE_BOOKEI_STEP_TEXT_NOT_RESULT")," "))}const D=[{path:"",component:(()=>{class a{constructor(t,o,i,c,g,N,j,H,L,z,G,V){var l=this;this.createEventService=t,this.navigationService=o,this.modalController=i,this.actionSheetController=c,this.deviceInfoService=g,this.bookeiService=N,this.profileManagerService=j,this.authService=H,this.logService=L,this.translateConfigService=z,this.stateService=G,this.focusService=V,this.selectedBooking=[],this.existPendings=!1,this.navigateToQRCode=()=>{this.navigationService.root(["/home"])},this.navigateToPendingLiberations=()=>{this.navigationService.forward(["/push-notifications"])},this.addRoons=n=>{const m={assetId:n.assetId||n.id,name:n.name||n.assetName,...n};this.verifyForRepetition(m)||this.selectedBooking.push(m)},this.removeBookingFromSelectedReservations=n=>{this.selectedBooking=this.selectedBooking.filter(d=>d.assetId!==n.assetId),this.existIdEvent&&this.addBookingToCancel(n)},this.verifyForRepetition=n=>this.selectedBooking.find(d=>d.assetId===n.assetId),this.addBookingToCancel=n=>{const m={assetId:n.assetId||n.id,name:n.name||n.assetName,...n};this.verifyForRepetition(m)||this.selectedBookingsForCancel.push(m)},this.openAddModal=(0,E.Z)(function*(){!l.settings&&l.requestFinish&&l.loaderSettings();const n=yield l.modalController.create({component:l.isBookeiAvaliable?f.Cu:B._3,componentProps:{props:{isBookei:l.isBookeiAvaliable,bookeis:l.selectedBooking?l.selectedBooking:null,initialRequest:!0}}});n.onDidDismiss().then(l.onModalDismissCallback),yield n.present()}),this.onModalDismissCallback=n=>{n&&n.data&&this.addRoons(n.data)},this.goOneStepBack=()=>{this.createEventService.setBookings(this.selectedBooking),this.existIdEvent&&this.createEventService.setBookeisToCancel(this.selectedBookingsForCancel),this.canBeEdited()||this.onResumeEventInturred()?this.navigationService.back(["/create-event-event-start-date-time"]):this.navigationService.forward(["/events"])},this.goToNextStep=()=>{const n=this.selectedBooking;this.existIdEvent&&this.createEventService.setBookeisToCancel(this.selectedBookingsForCancel),this.createEventService.setBookings(n),"approve-event-review"!==this.createEventService.getAction()||this.approveEventReview?this.goToAddHosts():this.goToEventResumeStep()},this.goToAddGuestsStep=()=>{this.navigationService.forward(["/create-event-event-guests"])},this.goToAddHosts=()=>{this.navigationService.forward(["/create-event-event-hosts"])},this.goToEventResumeStep=()=>{const d={state:{event:{id:this.createEventService.getId(),title:this.createEventService.getTitle(),startAt:this.createEventService.getStartDate(),endAt:this.createEventService.getEndDate(),floor:this.createEventService.getSelectedFloor(),group:this.createEventService.getSelectedGroup(),guests:this.createEventService.getGuests(),multiCheckin:this.createEventService.getMultiCheckIn(),allowCompanion:this.createEventService.getCompanionAllowed(),needAuthorization:this.createEventService.getNeedAuthorization(),checkinStartAt:this.createEventService.getCheckInStartAt(),bookeis:this.createEventService.getBookings(),bookeisToCancel:this.existIdEvent?this.createEventService.getBookeisToCancel():[]},isLimitedProfile:!1}};this.navigationService.forward(["/create-event-event-resume"],d)},this.canBeEdited=()=>!this.createEventService.getGuests().find(n=>"WAITING_FOR_CHECKIN"!==n.status&&"WAITING_FOR_EVENT_APPROVE"!==n.status),this.canDelete=n=>{this.removeBookingFromSelectedReservations(n)},this.toggleActions=function(){var n=(0,E.Z)(function*(d){yield(yield l.actionSheetController.create({header:l.translateConfigService.translate("ACTION_SHEET_HEADER"),cssClass:"",buttons:[{text:l.translateConfigService.translate("ACTION_SHEET_BTN_REMOVE"),role:"destructive",icon:"trash",handler:()=>{l.removeBookingFromSelectedReservations(d)}},{text:l.translateConfigService.translate("ACTION_SHEET_BTN_BACK"),icon:"arrow-back",role:"cancel",handler:()=>{}}]})).present()});return function(d){return n.apply(this,arguments)}}(),this.handleErrorGetSettings=n=>{},this.handeSuccessGetSettings=n=>{this.settings=n[0],this.isBookeiAvaliable=!!n[0]?.bookeiInstance,this.createEventService.setMaxInvites(n[0].maxInvites??0),this.requestFinish=!0},this.approveEventReview=this.isApproveEventReview(),this.heightDeviceSize=g.getDeviceHeight(),this.existIdEvent=!this.createEventService.getIsNew()}ngOnInit(){var t=this;return(0,E.Z)(function*(){let o=t.createEventService.getBookings();if(o=o||[],t.selectedBooking=o,t.existIdEvent){let i=t.createEventService.getBookeisToCancel();i=i||[],t.selectedBookingsForCancel=i,t.disableBtn=t.createEventService.disableFields()}})()}ionViewDidEnter(){this.loaderSettings()}isApproveEventReview(){return!!this.createEventService.getApproveEventReview()}loaderSettings(){var t=this;return(0,E.Z)(function*(){const{accessToken:o,profile:i}=yield t.tokenProfile();o&&i?t.getSettings(i.company.instanceName,o).then(t.handeSuccessGetSettings).catch(t.handleErrorGetSettings).finally((0,E.Z)(function*(){t.focusService.applyFocusQuerySelector("create_bookei_step",3e3)})):t.handleErrorLoaderSettings({getTokenPortalProfile:o?"":"not found getTokenPortalProfile",profile:i?"":"not found getProfilePortalProfile"})})()}getSettings(t,o){return new Promise((i,c)=>{this.bookeiService.getSettings(t,o).subscribe(i,c)})}tokenProfile(){return new Promise((t,o)=>{const i=this.getProfileCurrent;this.authService.getToken().then(c=>{this.bookeiService.getTokenPortalProfile(i,c).then(g=>{t({accessToken:g&&g.access_token?g.access_token:null,profile:i||null})}).catch(g=>{this.logService.logError("bookei::tokenProfile::getTokenPortalProfile","",g),o(g)})}).catch(c=>{this.logService.logError("bookei::tokenProfile::authService.getToken","",c),o(c)})})}get getProfileCurrent(){return this.profileManagerService.getProfile()}handleErrorLoaderSettings(t){this.logService.logError("method::loaderSettings","",t)}onResumeEventInturred(){return!!this.createEventService.getTitle()}}return a.\u0275fac=function(t){return new(t||a)(e.\u0275\u0275directiveInject(s.jc),e.\u0275\u0275directiveInject(s.f5),e.\u0275\u0275directiveInject(h.ModalController),e.\u0275\u0275directiveInject(h.ActionSheetController),e.\u0275\u0275directiveInject(s.Hc),e.\u0275\u0275directiveInject(v.l),e.\u0275\u0275directiveInject(s.v4),e.\u0275\u0275directiveInject(s.e8),e.\u0275\u0275directiveInject(s.$V),e.\u0275\u0275directiveInject(s.wK),e.\u0275\u0275directiveInject(C.b),e.\u0275\u0275directiveInject(T.i))},a.\u0275cmp=e.\u0275\u0275defineComponent({type:a,selectors:[["app-create-event-event-bookei"]],decls:20,vars:20,consts:[["defaultHref","create-event-event-name-step",3,"title","showBadge","refresh","menuToggle"],[3,"ionScroll"],[1,"centralized-content"],[1,"ion-no-padding","top-row"],["tabindex","1","id","create_bookei_step",1,"title",3,"innerHTML"],[1,"ion-no-padding","ion-justify-content-end"],[4,"ngIf"],[1,"card--"],[4,"ngIf","ngIfElse"],["notResult",""],[1,"button-holder"],["type","button",1,"back",3,"name","action"],["type","submit",3,"name","action"],[1,"fab"],["size","small",3,"disabled","click"],["aria-hidden","true","name","add"],[3,"booking","onSelected","onDelete",4,"ngFor","ngForOf"],[3,"booking","onSelected","onDelete"],[1,"not-result"],[1,"text"]],template:function(t,o){if(1&t&&(e.\u0275\u0275element(0,"app-header",0),e.\u0275\u0275pipe(1,"translate"),e.\u0275\u0275elementStart(2,"ion-content",1),e.\u0275\u0275listener("ionScroll",function(){return!0}),e.\u0275\u0275elementStart(3,"div",2)(4,"ion-row",3)(5,"ion-col"),e.\u0275\u0275element(6,"div",4),e.\u0275\u0275pipe(7,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(8,"ion-col",5),e.\u0275\u0275template(9,A,5,4,"ng-container",6),e.\u0275\u0275pipe(10,"async"),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(11,"div",7),e.\u0275\u0275template(12,R,2,1,"ng-container",8),e.\u0275\u0275template(13,F,4,3,"ng-template",null,9,e.\u0275\u0275templateRefExtractor),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(15,"div",10)(16,"app-button-custom-component",11),e.\u0275\u0275listener("action",function(){return o.goOneStepBack()}),e.\u0275\u0275pipe(17,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(18,"app-button-custom-component",12),e.\u0275\u0275listener("action",function(){return o.goToNextStep()}),e.\u0275\u0275pipe(19,"translate"),e.\u0275\u0275elementEnd()()()()),2&t){const i=e.\u0275\u0275reference(14);e.\u0275\u0275property("title",e.\u0275\u0275pipeBind1(1,10,"PG_CREATE_BOOKEI_STEP_HEADER_TITLE"))("showBadge",!0)("refresh",!1)("menuToggle",!1),e.\u0275\u0275advance(6),e.\u0275\u0275property("innerHTML",e.\u0275\u0275pipeBind1(7,12,"PG_CREATE_BOOKEI_STEP_TEXT_SUBTITLE"),e.\u0275\u0275sanitizeHtml),e.\u0275\u0275advance(3),e.\u0275\u0275property("ngIf",e.\u0275\u0275pipeBind1(10,14,o.stateService.getState())),e.\u0275\u0275advance(3),e.\u0275\u0275property("ngIf",o.selectedBooking.length>0)("ngIfElse",i),e.\u0275\u0275advance(4),e.\u0275\u0275property("name",e.\u0275\u0275pipeBind1(17,16,"BTN_BACK")),e.\u0275\u0275advance(2),e.\u0275\u0275property("name",e.\u0275\u0275pipeBind1(19,18,"BTN_NEXT"))}},dependencies:[k.NgForOf,k.NgIf,h.IonCol,h.IonContent,h.IonFabButton,h.IonIcon,h.IonRow,b.G,O.e,x.H,k.AsyncPipe,M.X$],styles:["ion-content[_ngcontent-%COMP%]{--background: var(--ion-color-background)}.centralized-content[_ngcontent-%COMP%]{height:calc(100vh - 56px);display:flex;justify-content:flex-start;flex-direction:column;padding:0 18px}.centralized-content[_ngcontent-%COMP%] .top-row[_ngcontent-%COMP%]{margin:28px 0;display:flex;align-items:center}.centralized-content[_ngcontent-%COMP%] .top-row[_ngcontent-%COMP%] ion-col[_ngcontent-%COMP%]{display:flex}.centralized-content[_ngcontent-%COMP%] .top-row[_ngcontent-%COMP%] ion-col[_ngcontent-%COMP%] .fab[_ngcontent-%COMP%] ion-fab-button[_ngcontent-%COMP%]{--box-shadow: none !important}.centralized-content[_ngcontent-%COMP%] .top-row[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{font-size:18px!important;font-weight:700}.centralized-content[_ngcontent-%COMP%] .top-row[_ngcontent-%COMP%] .title[_ngcontent-%COMP%] .subtible[_ngcontent-%COMP%]{font-weight:100}.centralized-content[_ngcontent-%COMP%] .input-holder[_ngcontent-%COMP%]{margin-top:8px}.centralized-content[_ngcontent-%COMP%] .button-holder[_ngcontent-%COMP%]{width:100%}.not-result[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;height:64px;border-radius:4px;background:#fff}.not-result[_ngcontent-%COMP%] .text[_ngcontent-%COMP%]{font-weight:500}"]}),a})()}];let w=(()=>{class a{}return a.\u0275fac=function(t){return new(t||a)},a.\u0275mod=e.\u0275\u0275defineNgModule({type:a}),a.\u0275inj=e.\u0275\u0275defineInjector({imports:[P.I,u.RouterModule.forChild(D)]}),a})()},37763:(I,S,r)=>{r.d(S,{i:()=>e});var u=r(61380),E=r(92198),f=r(45449);let e=(()=>{class s{constructor(v){this.router=v}focusInRouterNavigate(){this.router.events.pipe((0,E.h)(v=>v instanceof u.NavigationEnd)).subscribe(()=>{const v=document.querySelector("#focusHeader");v&&v?.focus()})}applyFocusQuerySelector(v,C){setTimeout(()=>{document.querySelector(`#${v}`)?.focus()},C)}}return s.\u0275fac=function(v){return new(v||s)(f.\u0275\u0275inject(u.Router))},s.\u0275prov=f.\u0275\u0275defineInjectable({token:s,factory:s.\u0275fac,providedIn:"root"}),s})()}}]);