(self.webpackChunkapp=self.webpackChunkapp||[]).push([[7092],{57092:(k,f,i)=>{i.r(f),i.d(f,{ContactsPageModule:()=>b});var h=i(61380),_=i(15861),P=i(24889),t=i(45449),c=i(47898),l=i(24006),O=i(90603),v=i(90944),x=i(36290),y=i(99826);function T(n,r){1&n&&(t.\u0275\u0275elementStart(0,"div",14)(1,"div",15),t.\u0275\u0275text(2),t.\u0275\u0275pipe(3,"translate"),t.\u0275\u0275elementEnd()()),2&n&&(t.\u0275\u0275advance(2),t.\u0275\u0275textInterpolate(t.\u0275\u0275pipeBind1(3,1,"PG_CONTACTS_TEXT_NO_CONTACTS")))}function S(n,r){if(1&n&&(t.\u0275\u0275elementStart(0,"div",19),t.\u0275\u0275text(1),t.\u0275\u0275elementEnd()),2&n){const o=t.\u0275\u0275nextContext().$implicit;t.\u0275\u0275advance(1),t.\u0275\u0275textInterpolate(o.company)}}function N(n,r){if(1&n){const o=t.\u0275\u0275getCurrentView();t.\u0275\u0275elementStart(0,"div",16),t.\u0275\u0275listener("click",function(){const d=t.\u0275\u0275restoreView(o).$implicit,u=t.\u0275\u0275nextContext();return t.\u0275\u0275resetView(u.onContactClick(d))}),t.\u0275\u0275elementStart(1,"div",17),t.\u0275\u0275text(2),t.\u0275\u0275elementEnd(),t.\u0275\u0275template(3,S,2,1,"div",18),t.\u0275\u0275elementEnd()}if(2&n){const o=r.$implicit,a=t.\u0275\u0275nextContext();t.\u0275\u0275property("className","contact"),t.\u0275\u0275advance(2),t.\u0275\u0275textInterpolate1(" ",a.helperService.normalizeName(o.firstName,o.lastName)," "),t.\u0275\u0275advance(1),t.\u0275\u0275property("ngIf",o.company)}}let E=(()=>{class n{constructor(o,a,g,d,u,j,R,A,w,D,F,z,B){var m=this;this.loadingService=o,this.notificatorService=a,this.companyService=g,this.formBuilder=d,this.modalController=u,this.navigationService=j,this.profileManagerService=R,this.router=A,this.helperService=w,this.logService=D,this.apiService=F,this.pendingRelease=z,this.translateConfigService=B,this.contacts=[],this.rows=[],this.existPendings=!1,this.profileManagerSubscription=null,this.ionViewWillLeave=()=>{this.profileManagerSubscription.unsubscribe()},this.navigateToPendingLiberations=()=>{this.navigationService.forward(["/push-notifications"])},this.startListeningForProfileChanges=()=>{this.profileManagerSubscription=this.router.events.subscribe(e=>{e instanceof h.NavigationEnd&&"/contacts"===e.url&&this.getContacts()})},this.getContacts=()=>{this.loadingService.show(this.translateConfigService.translate("PG_CONTACTS_LOADING_CONTACTS"),"loading-contacts"),this.companyService.getContacts({size:100,sort:"firstName,asc"}).then(this.processGetContactsSuccessResponse).catch(this.processGetContactsErrorResponse)},this.processGetContactsSuccessResponse=e=>{this.loadingService.hide(null,"loading-contacts"),this.contacts=e,this.rows=this.contacts},this.processGetContactsErrorResponse=e=>{console.log("processGetEventsErrorResponse"),console.log("error:",e),this.logService.logError("http::accountActivateErrorResponse","",e),this.loadingService.hide(null,"loading-contacts");const s=this.translateConfigService.translate("PG_CONTACTS_TOAST_ERROR_TITLE"),p=this.translateConfigService.translate("PG_CONTACTS_TOAST_MESSAGE_ERROR");this.notificatorService.notify({title:s,message:p,type:"error"})},this.pullDownToGetContacts=()=>{this.loadingService.show(this.translateConfigService.translate("PG_CONTACTS_LOADING_CONTACTS"),"loading-contacts"),this.companyService.getContacts({size:100,sort:"firstName,asc"}).then(s=>{this.processGetContactsSuccessResponse(s)}).catch(s=>{this.processGetContactsErrorResponse(s)})},this.onContactClick=function(){var e=(0,_.Z)(function*(s){const p=yield m.modalController.create({component:P.Ez,componentProps:{contact:s}});p.onDidDismiss().then(m.onModalDismissCallback),yield p.present()});return function(s){return e.apply(this,arguments)}}(),this.onCreateGuest=(0,_.Z)(function*(){const e=yield m.modalController.create({component:P.Ez,componentProps:{contact:null}});e.onDidDismiss().then(m.onModalDismissCallback),yield e.present()}),this.onModalDismissCallback=()=>{this.getContacts()},this.onInputChange=e=>{const{value:s}=e.target;this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout(()=>{this.doSearch(s)},750)},this.doSearch=e=>{(!e||""===e||void 0===e)&&this.getContacts();const s=e.split(" "),p=s[0],C=s.slice(1).join(" "),M={"firstName.contains":p.trim(),sort:"firstName,asc"};C.trim().length>0&&(M["lastName.contains"]=C.trim()),this.companyService.getContacts(M).then(this.processGetContactsSuccessResponse).catch(this.processGetContactsErrorResponse)},this.navigateToQRCode=()=>{this.navigationService.forward(["/home"])}}ngOnInit(){this.contacts=[],this.searchTimeout=null,this.userForm=this.formBuilder.group({searchTerm:[""]})}ionViewDidEnter(){this.getContacts(),this.startListeningForProfileChanges()}ionViewDidLeave(){}}return n.\u0275fac=function(o){return new(o||n)(t.\u0275\u0275directiveInject(c.bz),t.\u0275\u0275directiveInject(c.V6),t.\u0275\u0275directiveInject(c.JN),t.\u0275\u0275directiveInject(l.UntypedFormBuilder),t.\u0275\u0275directiveInject(O.ModalController),t.\u0275\u0275directiveInject(c.f5),t.\u0275\u0275directiveInject(c.v4),t.\u0275\u0275directiveInject(h.Router),t.\u0275\u0275directiveInject(c.W_),t.\u0275\u0275directiveInject(c.$V),t.\u0275\u0275directiveInject(c.sM),t.\u0275\u0275directiveInject(c.xJ),t.\u0275\u0275directiveInject(c.wK))},n.\u0275cmp=t.\u0275\u0275defineComponent({type:n,selectors:[["app-contacts"]],decls:24,vars:20,consts:[[3,"title","showBadge","refresh","callRefresh"],[1,"page-title"],[1,"sub-title"],[1,"events"],["class","empty",4,"ngIf"],[1,"search"],[3,"formGroup"],[1,"input-holder"],["id","name","type","text","formControlName","searchTerm",3,"placeholder","keyup"],[1,"new-holder"],[1,"button-holder"],["type","button",3,"click"],[1,"contacts"],[3,"className","click",4,"ngFor","ngForOf"],[1,"empty"],[1,"text"],[3,"className","click"],[1,"full-name"],["class","company",4,"ngIf"],[1,"company"]],template:function(o,a){1&o&&(t.\u0275\u0275elementStart(0,"app-header",0),t.\u0275\u0275listener("callRefresh",function(){return a.pullDownToGetContacts()}),t.\u0275\u0275pipe(1,"translate"),t.\u0275\u0275elementEnd(),t.\u0275\u0275elementStart(2,"ion-content")(3,"div",1)(4,"div",2),t.\u0275\u0275text(5),t.\u0275\u0275pipe(6,"translate"),t.\u0275\u0275elementEnd()(),t.\u0275\u0275elementStart(7,"div",3),t.\u0275\u0275template(8,T,4,3,"div",4),t.\u0275\u0275elementStart(9,"div",5)(10,"form",6)(11,"div",7)(12,"input",8),t.\u0275\u0275listener("keyup",function(d){return a.onInputChange(d)}),t.\u0275\u0275pipe(13,"translate"),t.\u0275\u0275elementEnd(),t.\u0275\u0275elementStart(14,"div",9)(15,"div",10)(16,"button",11),t.\u0275\u0275listener("click",function(){return a.onCreateGuest()}),t.\u0275\u0275text(17),t.\u0275\u0275pipe(18,"translate"),t.\u0275\u0275elementEnd()()()()()(),t.\u0275\u0275elementStart(19,"div",12)(20,"div",2),t.\u0275\u0275text(21),t.\u0275\u0275pipe(22,"translate"),t.\u0275\u0275elementEnd(),t.\u0275\u0275template(23,N,4,3,"div",13),t.\u0275\u0275elementEnd()()()),2&o&&(t.\u0275\u0275property("title",t.\u0275\u0275pipeBind1(1,10,"PG_CONTACTS_HEADER_TITLE"))("showBadge",!0)("refresh",!0),t.\u0275\u0275advance(5),t.\u0275\u0275textInterpolate(t.\u0275\u0275pipeBind1(6,12,"PG_CONTACTS_TEXT_VIEW_EDIT_GUEST_CONTACTS")),t.\u0275\u0275advance(3),t.\u0275\u0275property("ngIf",a.contacts&&0===a.contacts.length),t.\u0275\u0275advance(2),t.\u0275\u0275property("formGroup",a.userForm),t.\u0275\u0275advance(2),t.\u0275\u0275property("placeholder",t.\u0275\u0275pipeBind1(13,14,"PG_CONTACTS_INPUT")),t.\u0275\u0275advance(5),t.\u0275\u0275textInterpolate1(" ",t.\u0275\u0275pipeBind1(18,16,"PG_CONTACTS_BTN_NEW")," "),t.\u0275\u0275advance(4),t.\u0275\u0275textInterpolate(t.\u0275\u0275pipeBind1(22,18,"PG_CONTACTS_TEXT_TAP_ITEM_EDIT")),t.\u0275\u0275advance(2),t.\u0275\u0275property("ngForOf",a.rows))},dependencies:[v.NgForOf,v.NgIf,O.IonContent,l.\u0275NgNoValidate,l.DefaultValueAccessor,l.NgControlStatus,l.NgControlStatusGroup,l.FormGroupDirective,l.FormControlName,x.G,y.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}.page-title[_ngcontent-%COMP%]{margin-top:30px;margin-bottom:26px}.page-title[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{font-size:initial!important;font-weight:700;text-align:center}.page-title[_ngcontent-%COMP%] .sub-title[_ngcontent-%COMP%]{text-align:center;color:#656768;font-size:.9em;margin-top:4px}.empty[_ngcontent-%COMP%], .not-empty[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;padding:3em;color:#656768;font-size:.9em}.empty[_ngcontent-%COMP%] .text[_ngcontent-%COMP%], .not-empty[_ngcontent-%COMP%] .text[_ngcontent-%COMP%]{text-align:center}.empty[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] .pull-to-reload-message[_ngcontent-%COMP%], .not-empty[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] .pull-to-reload-message[_ngcontent-%COMP%]{display:inline-flex;justify-content:center;align-items:center;margin-top:1em}.empty[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] .pull-to-reload-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%], .not-empty[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] .pull-to-reload-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:inline-flex;justify-content:center;align-items:center;border:1px solid #eee;padding:.25em .75em;border-radius:32px;margin-right:8px}.empty[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] .pull-to-reload-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%] ion-icon[_ngcontent-%COMP%], .not-empty[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] .pull-to-reload-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%] ion-icon[_ngcontent-%COMP%]{margin-left:4px;color:#0ec254;margin-top:2px}.not-empty[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;padding:1em;color:#656768;font-size:.9em;margin-bottom:2em}.not-empty[_ngcontent-%COMP%] .text[_ngcontent-%COMP%]{text-align:center}.not-empty[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] .pull-to-reload-message[_ngcontent-%COMP%]{display:inline-flex;justify-content:center;align-items:center;margin-top:0}.not-empty[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] .pull-to-reload-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:inline-flex;justify-content:center;align-items:center;border:1px solid #eee;padding:.25em .75em;border-radius:32px;margin-right:8px}.not-empty[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] .pull-to-reload-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%] ion-icon[_ngcontent-%COMP%]{margin-left:4px;color:#0ec254;margin-top:2px}.search[_ngcontent-%COMP%] .input-holder[_ngcontent-%COMP%]{margin-top:8px;display:flex;justify-content:center;align-items:center}.search[_ngcontent-%COMP%] .input-holder[_ngcontent-%COMP%] .new-holder[_ngcontent-%COMP%]{margin-top:18px}.search[_ngcontent-%COMP%] .input-holder[_ngcontent-%COMP%] .new-holder[_ngcontent-%COMP%] .button-holder[_ngcontent-%COMP%]{margin-top:0}.contacts[_ngcontent-%COMP%] .sub-title[_ngcontent-%COMP%]{width:80%;margin:11px 10%;font-size:.9em;background-color:#eee;padding:4px 8px;border-radius:2px}.contacts[_ngcontent-%COMP%] .contact[_ngcontent-%COMP%]{width:80%;margin:0 10% 4px;border:1px solid #eee;border-radius:4px;padding:8px 12px}.contacts[_ngcontent-%COMP%] .contact[_ngcontent-%COMP%] .company[_ngcontent-%COMP%]{color:#aaa}.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)}}"]}),n})();var I=i(69270);const G=[{path:"",component:E}];let b=(()=>{class n{}return n.\u0275fac=function(o){return new(o||n)},n.\u0275mod=t.\u0275\u0275defineNgModule({type:n}),n.\u0275inj=t.\u0275\u0275defineInjector({imports:[I.I,h.RouterModule.forChild(G)]}),n})()}}]);