(self.webpackChunkapp=self.webpackChunkapp||[]).push([[2794],{52794:(N,m,n)=>{n.r(m),n.d(m,{CreateEventEventNameStepPageModule:()=>O});var p=n(61380),e=n(45449),l=n(24006),s=n(47898),T=n(21284),f=n(37763),v=n(90944),E=n(90603),c=n(36290),_=n(99826);function P(r,g){if(1&r&&(e.\u0275\u0275elementStart(0,"div",14),e.\u0275\u0275text(1),e.\u0275\u0275elementEnd()),2&r){const o=g.$implicit;e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate(o.message)}}function I(r,g){if(1&r&&(e.\u0275\u0275elementStart(0,"div",12),e.\u0275\u0275template(1,P,2,1,"div",13),e.\u0275\u0275elementEnd()),2&r){const o=e.\u0275\u0275nextContext();e.\u0275\u0275advance(1),e.\u0275\u0275property("ngForOf",o.eventTitleFormErrors)}}let A=(()=>{class r{constructor(o,u,S,M,G,F,x,L,b,B,w,j,D,U,V){this.formBuilder=o,this.notificatorService=u,this.navigationService=S,this.createEventService=M,this.loadingService=G,this.commonService=F,this.activatedRoute=x,this.router=L,this.pendingRelease=b,this.apiService=B,this.resumeCreateEventInterruptedService=w,this.profileManagerService=j,this.translateConfigService=D,this.stateService=U,this.focusService=V,this.isLimitedProfile=!1,this.action=null,this.approveEventReview="",this.navigateToQRCode=()=>{this.navigationService.forward(["/home"])},this.navigateToPendingLiberations=()=>{this.navigationService.forward(["/push-notifications"])},this.getCompanyGroups=()=>{this.createEventService.getCompanyGroups().then(this.handleGetCompanyGroupsSuccessResponse).catch(this.handleGetCompanyGroupsErrorResponse).finally(()=>{this.loadingService.hide(null,"loading-company-data"),this.focusService.applyFocusQuerySelector("create_name_step",1e3)})},this.handleGetCompanyGroupsSuccessResponse=t=>{this.createEventService.setGroups(t);const i=this.createEventService.getGroups();1===i.length&&this.createEventService.setSelectedGroup(i[0]),this.getCompanyFloors()},this.handleGetCompanyGroupsErrorResponse=t=>{this.loadingService.hide(null,"loading-company-data")},this.getCompanyFloors=()=>{this.createEventService.getCompanyFloors().then(this.handleGetCompanyFloorsSuccessResponse).catch(this.handleGetCompanyFloorsErrorResponse)},this.handleGetCompanyFloorsSuccessResponse=t=>{if(t.length){this.createEventService.setFloors(t);const i=this.createEventService.getFloors();1===i.length&&this.createEventService.setSelectedFloor(i[0]),this.createEventService.getIsNew()?this.createEventService.getAccount().then(this.handleGetUserAccountSuccessResponse).catch(this.handleGetUserAccountErrorResponse):this.approveEventReview||"edit"===this.action&&this.canBeEdited()?this.isLimitedProfile?this.goToLimitedFirstPage():this.createEventService.getAccount().then(a=>{this.handleGetUserAccountSuccessResponse(a)}).catch(this.handleGetUserAccountErrorResponse):(this.loadingService.hide(null,"loading-company-data"),this.navigationService.forward(["/create-event-event-hosts"]))}else{const i=this.translateConfigService.translate("PG_CREATE_NAME_STEP_TOAST_COMPANY_HAS_NO_FLOORS_TITLE"),a=this.translateConfigService.translate("PG_CREATE_NAME_STEP_TOAST_COMPANY_HAS_NO_FLOORS_MESSAGE");this.notificatorService.notify({title:i,message:a,type:"error"}),this.navigationService.back(["/home"])}},this.goToLimitedFirstPage=()=>{const t={state:{isLimitedProfile:!0,event:this.event}};this.loadingService.hide(null,"loading-company-data").then(()=>{this.navigationService.forward(["/create-event-event-guests"],t)})},this.canBeEdited=()=>!this.event?.guests.find(t=>"WAITING_FOR_CHECKIN"!==t.status&&"WAITING_FOR_EVENT_APPROVE"!==t.status),this.handleGetCompanyFloorsErrorResponse=t=>{console.log("handleGetCompanyFloorsErrorResponse"),console.log(t),this.navigationService.back(["/home"]),this.loadingService.hide(null,"loading-company-data");const i=this.translateConfigService.translate("PG_CREATE_NAME_STEP_TOAST_FLOORS_TITLE"),a=this.translateConfigService.translate("PG_CREATE_NAME_STEP_TOAST_FLOORS_MESSAGE");this.notificatorService.notify({title:i,message:a,type:"error"})},this.handleGetUserAccountSuccessResponse=t=>{this.loadingService.hide(null,"loading-company-data");const i=this.createEventService.getIsNew(),a=this.createEventService.getAction(),h=this.createEventService.getHosts();if((i||"approve-event-review"===a)&&h.length<2&&this.createEventService.getCompanyHost(t.refId).then(d=>{this.createEventService.setHosts(d)}).catch(d=>{}),!i&&("edit"===this.action||this.canBeEdited())&&h.length<2&&this.createEventService.getCompanyHost(t.refId).then(d=>{this.createEventService.setHosts(d)}).catch(d=>{}),"approve-event-review"===a&&!this.approveEventReview){const d={state:{isLimitedProfile:this.isLimitedProfile}},C=this.createEventService.getSelectedFloor(),H=this.createEventService.getSelectedGroup();C&&H&&!this.approveEventReview?this.navigationService.forward(["/create-event-event-hosts"]):this.navigationService.forward(["/create-event-event-start-date-time"],d)}},this.handleGetUserAccountErrorResponse=t=>{console.log("handleGetUserAccountErrorResponse"),console.log("error:",t),this.loadingService.hide(null,"loading-company-data");const i=this.translateConfigService.translate("PG_CREATE_NAME_STEP_TOAST_GETUSER_TITLE"),a=this.translateConfigService.translate("PG_CREATE_NAME_STEP_TOAST_GETUSER_MESSAGE");this.notificatorService.notify({title:i,message:a,type:"error"}),this.navigationService.back(["/home"])},this.onSubmit=()=>{this.cleanValidationErrors();const t=this.commonService.clearString(this.eventTitleForm.controls.title.value),a=this.validateInput({title:t});if(a.length){this.setValidationErrors(a),this.translateConfigService.translate("PG_CREATE_NAME_STEP_TOAST_INVALID_DATA_TITLE");const d=this.translateConfigService.translate("PG_CREATE_NAME_STEP_TOAST_INVALID_DATA_NESSAGE");this.notificatorService.notify({title:t,message:d,type:"error"})}else this.createEventService.setTitle(t),this.navigationService.forward(["/create-event-event-start-date-time"]),this.setResumeCreationInterrupte()},this.validateInput=t=>{const i=[],a=this.validateTitleInput(t);return a&&i.push(a),i},this.validateTitleInput=t=>!t.title||t.title.length<1?{message:this.translateConfigService.translate("PG_CREATE_NAME_STEP_TEXT_ERROR_INPUT_TITLE"),field:"title"}:null,this.goOneStepBack=()=>{this.cleanValidationErrors(),this.createEventService.clearCreateEventData(),this.createEventService.getIsNew()?this.navigationService.forward(["/home"]):this.navigationService.forward(["/events"])},this.setValidationErrors=t=>{console.log("setValidationErrors:",t),this.eventTitleFormErrors=t},this.cleanValidationErrors=()=>{this.eventTitleFormErrors=[]},this.eventTitleForm=this.formBuilder.group({title:[""]}),this.getParansNavigation()}ionViewDidEnter(){this.loadData()}ionViewDidLeave(){}loadData(){this.loadingService.show(this.translateConfigService.translate("PG_CREATE_NAME_STEP_LOADING"),"loading-company-data");let o=null;"create"===this.action&&!this.resumeEventInterrupted&&!this.onBack&&!this.event&&this.createEventService.clearCreateEventData(),("edit"===this.action||this.resumeEventInterrupted||this.onBack||this.event?.title)&&(o=this.event?.title||this.createEventService.getTitle()),this.createEventService.setAction(this.action),this.createEventService.setApproveEventReview(this.approveEventReview),this.createEventService.setEventToEdit(this.event),this.event?.id&&this.createEventService.disableFields()?this.eventTitleForm.controls.title?.disable():this.eventTitleForm.controls.title?.enable(),this.eventTitleForm.patchValue({title:o}),this.eventTitleFormErrors=[],this.getCompanyGroups()}getParansNavigation(){this.activatedRoute.queryParams.subscribe(o=>{this.router.getCurrentNavigation().extras.state&&(this.event=this.router.getCurrentNavigation().extras.state.event,this.isLimitedProfile=!!this.router.getCurrentNavigation().extras.state.isLimitedProfile&&this.router.getCurrentNavigation().extras.state.isLimitedProfile,this.action=this.router.getCurrentNavigation().extras.state.action?this.router.getCurrentNavigation().extras.state.action:null,this.approveEventReview=this.router.getCurrentNavigation().extras.state.approveEventReview?this.router.getCurrentNavigation().extras.state.approveEventReview:"",this.resumeEventInterrupted=!!this.router.getCurrentNavigation().extras.state.resumeEventInterrupted&&this.router.getCurrentNavigation().extras.state.resumeEventInterrupted,this.onBack=!!this.router.getCurrentNavigation().extras.state.onBack&&this.router.getCurrentNavigation().extras.state.onBack)})}setResumeCreationInterrupte(){this.resumeCreateEventInterruptedService.setResumeCreationInterrupte({logistic:{eventType:""},vo:!0,action:this.action,event:this.event?.id?{id:this.event.id,instanceName:this.event?.company?.instanceName?this.event.company.instanceName:""}:{id:"",instanceName:""}})}}return r.\u0275fac=function(o){return new(o||r)(e.\u0275\u0275directiveInject(l.UntypedFormBuilder),e.\u0275\u0275directiveInject(s.V6),e.\u0275\u0275directiveInject(s.f5),e.\u0275\u0275directiveInject(s.jc),e.\u0275\u0275directiveInject(s.bz),e.\u0275\u0275directiveInject(s.v_),e.\u0275\u0275directiveInject(p.ActivatedRoute),e.\u0275\u0275directiveInject(p.Router),e.\u0275\u0275directiveInject(s.xJ),e.\u0275\u0275directiveInject(s.sM),e.\u0275\u0275directiveInject(s.NL),e.\u0275\u0275directiveInject(s.v4),e.\u0275\u0275directiveInject(s.wK),e.\u0275\u0275directiveInject(T.b),e.\u0275\u0275directiveInject(f.i))},r.\u0275cmp=e.\u0275\u0275defineComponent({type:r,selectors:[["app-create-event-event-name-step"]],decls:22,vars:20,consts:[["defaultHref","events",3,"title","showBadge","refresh","menuToggle"],[1,"centralized-content"],[1,"page-title"],["id","create_name_step","tabindex","1",1,"sub-title"],[1,"ion-margin-vertical"],[3,"formGroup","ngSubmit"],[1,"input-holder"],["type","text","formControlName","title",3,"placeholder"],["class","errors",4,"ngIf"],[1,"button-holder"],["type","button",1,"back",3,"click"],["type","submit",3,"click"],[1,"errors"],["class","error",4,"ngFor","ngForOf"],[1,"error"]],template:function(o,u){1&o&&(e.\u0275\u0275element(0,"app-header",0),e.\u0275\u0275pipe(1,"translate"),e.\u0275\u0275elementStart(2,"ion-content")(3,"div",1)(4,"div",2)(5,"div",3),e.\u0275\u0275text(6),e.\u0275\u0275pipe(7,"translate"),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(8,"ion-row")(9,"ion-col",4)(10,"form",5),e.\u0275\u0275listener("ngSubmit",function(){return u.onSubmit()}),e.\u0275\u0275elementStart(11,"div",6),e.\u0275\u0275element(12,"input",7),e.\u0275\u0275pipe(13,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(14,I,2,1,"div",8),e.\u0275\u0275elementStart(15,"div",9)(16,"button",10),e.\u0275\u0275listener("click",function(){return u.goOneStepBack()}),e.\u0275\u0275text(17),e.\u0275\u0275pipe(18,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(19,"button",11),e.\u0275\u0275listener("click",function(){return u.onSubmit()}),e.\u0275\u0275text(20),e.\u0275\u0275pipe(21,"translate"),e.\u0275\u0275elementEnd()()()()()()()),2&o&&(e.\u0275\u0275property("title",e.\u0275\u0275pipeBind1(1,10,"PG_CREATE_NAME_STEP_HEADER_TITLE"))("showBadge",!0)("refresh",!1)("menuToggle",!1),e.\u0275\u0275advance(6),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(7,12,"PG_CREATE_NAME_STEP_TEXT_SUBTITLE")," "),e.\u0275\u0275advance(4),e.\u0275\u0275property("formGroup",u.eventTitleForm),e.\u0275\u0275advance(2),e.\u0275\u0275property("placeholder",e.\u0275\u0275pipeBind1(13,14,"PG_CREATE_NAME_STEP_TEXT_INPUT")),e.\u0275\u0275advance(2),e.\u0275\u0275property("ngIf",u.eventTitleFormErrors),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(18,16,"BTN_BACK")," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(21,18,"BTN_NEXT")))},dependencies:[v.NgForOf,v.NgIf,E.IonCol,E.IonContent,E.IonRow,l.\u0275NgNoValidate,l.DefaultValueAccessor,l.NgControlStatus,l.NgControlStatusGroup,l.FormGroupDirective,l.FormControlName,c.G,_.X$],styles:["ion-content[_ngcontent-%COMP%]{--background: #f1f1f1}ion-toolbar[_ngcontent-%COMP%]{font-family:Nunito,sans-serif}ion-toolbar[_ngcontent-%COMP%] ion-img[_ngcontent-%COMP%]{height:25px;width:25px}ion-toolbar[_ngcontent-%COMP%] ion-title[_ngcontent-%COMP%]{letter-spacing:1px}ion-toolbar[_ngcontent-%COMP%] ion-button[_ngcontent-%COMP%] fa-icon[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;height:24px;padding:0;width:24px;margin:0;font-size:19px;color:#656768}ion-toolbar[_ngcontent-%COMP%] ion-button.hover[_ngcontent-%COMP%]{background:#fff}.centralized-content[_ngcontent-%COMP%]{height:calc(100vh - 56px);display:flex;justify-content:flex-start;flex-direction:column}.centralized-content[_ngcontent-%COMP%] .errors[_ngcontent-%COMP%]{width:80%;margin:12px 10% 0;color:#f0181b;text-align:center}.centralized-content[_ngcontent-%COMP%] .page-title[_ngcontent-%COMP%]{margin-top:30px;margin-bottom:26px}.centralized-content[_ngcontent-%COMP%] .page-title[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{font-size:initial!important;font-weight:700;text-align:center}.centralized-content[_ngcontent-%COMP%] .page-title[_ngcontent-%COMP%] .sub-title[_ngcontent-%COMP%]{text-align:center;color:#656768;font-size:.9em;margin-top:4px}.pulsate-fwd[_ngcontent-%COMP%]{animation:pulsate-fwd .5s ease-in-out infinite both;outline:none}@keyframes pulsate-fwd{0%{transform:scale(1)}50%{transform:scale(1.5)}to{transform:scale(1)}}"]}),r})();var R=n(69270);const y=[{path:"",component:A}];let O=(()=>{class r{}return r.\u0275fac=function(o){return new(o||r)},r.\u0275mod=e.\u0275\u0275defineNgModule({type:r}),r.\u0275inj=e.\u0275\u0275defineInjector({imports:[R.I,p.RouterModule.forChild(y)]}),r})()},37763:(N,m,n)=>{n.d(m,{i:()=>f});var p=n(61380),l=n(92198),s=n(45449);let f=(()=>{class v{constructor(c){this.router=c}focusInRouterNavigate(){this.router.events.pipe((0,l.h)(c=>c instanceof p.NavigationEnd)).subscribe(()=>{const c=document.querySelector("#focusHeader");c&&c?.focus()})}applyFocusQuerySelector(c,_){setTimeout(()=>{document.querySelector(`#${c}`)?.focus()},_)}}return v.\u0275fac=function(c){return new(c||v)(s.\u0275\u0275inject(p.Router))},v.\u0275prov=s.\u0275\u0275defineInjectable({token:v,factory:v.\u0275fac,providedIn:"root"}),v})()}}]);