text: (window.webpackJsonp=window.webpackJsonp||[]).push([[11],{jcJX:function(e,t,o){"use strict";o.r(t),o.d(t,"AccountPageModule",(function(){return C}));var s=o("ofXK"),i=o("3Pt+"),r=o("TEn/"),n=o("tyNb"),a=o("2g2N"),b=o("fXoL"),d=o("qfBg"),c=o("A1CT"),l=o("/oCc");const u=["datePicker"];function m(e,t){if(1&e&&(b.Kb(0,"ion-select-option"),b.fc(1),b.Jb()),2&e){const e=t.$implicit;b.xb(1),b.gc(e.countryName)}}function p(e,t){if(1&e&&(b.Kb(0,"ion-select-option"),b.fc(1),b.Jb()),2&e){const e=t.$implicit;b.xb(1),b.gc(e.name)}}function g(e,t){if(1&e&&(b.Kb(0,"ion-select-option",23),b.fc(1),b.Jb()),2&e){const e=t.$implicit;b.Xb("value",e.dial_code),b.xb(1),b.ic("",e.name,", ",e.dial_code,"")}}const f=function(){return{type:"num",mask:"999-999-9999"}};function h(e,t){if(1&e){const e=b.Lb();b.Kb(0,"ion-col",4),b.Kb(1,"ion-card"),b.Kb(2,"form",5),b.Sb("ngSubmit",(function(){return b.bc(e),b.Ub().updateDetails()})),b.Kb(3,"ion-row"),b.Kb(4,"ion-col",6),b.Kb(5,"ion-item"),b.Kb(6,"ion-label",7),b.fc(7,"Country"),b.Jb(),b.Kb(8,"ion-select",8),b.Sb("ionChange",(function(){return b.bc(e),b.Ub().setRegions()})),b.ec(9,m,2,1,"ion-select-option",9),b.Jb(),b.Jb(),b.Kb(10,"ion-item"),b.Kb(11,"ion-label",7),b.fc(12,"Region"),b.Jb(),b.Kb(13,"ion-select",10),b.ec(14,p,2,1,"ion-select-option",9),b.Jb(),b.Jb(),b.Kb(15,"ion-item"),b.Kb(16,"ion-label",7),b.fc(17,"City"),b.Jb(),b.Ib(18,"ion-input",11),b.Jb(),b.Kb(19,"ion-item"),b.Kb(20,"ion-label",7),b.fc(21,"PIN code"),b.Jb(),b.Ib(22,"ion-input",12),b.Jb(),b.Kb(23,"ion-item"),b.Kb(24,"ion-label",7),b.fc(25,"Email"),b.Jb(),b.Ib(26,"ion-input",13),b.Jb(),b.Jb(),b.Kb(27,"ion-col",6),b.Kb(28,"ion-item"),b.Kb(29,"ion-label",7),b.fc(30,"Name"),b.Jb(),b.Ib(31,"ion-input",14),b.Jb(),b.Kb(32,"ion-grid",15),b.Kb(33,"ion-row"),b.Kb(34,"ion-col",2),b.Kb(35,"ion-item"),b.Kb(36,"ion-label",7),b.fc(37,"Code"),b.Jb(),b.Kb(38,"ion-select",16),b.ec(39,g,2,3,"ion-select-option",17),b.Jb(),b.Jb(),b.Jb(),b.Kb(40,"ion-col",4),b.Kb(41,"ion-item"),b.Kb(42,"ion-label",7),b.fc(43,"Phone"),b.Jb(),b.Ib(44,"ion-input",18),b.Jb(),b.Jb(),b.Jb(),b.Jb(),b.Kb(45,"ion-item"),b.Kb(46,"ion-label",7),b.fc(47,"Address"),b.Jb(),b.Ib(48,"ion-textarea",19),b.Jb(),b.Kb(49,"ion-item"),b.Kb(50,"ion-label",7),b.fc(51,"Date of birth"),b.Jb(),b.Ib(52,"ion-datetime",20,21),b.Jb(),b.Jb(),b.Jb(),b.Kb(54,"ion-button",22),b.fc(55,"Update details"),b.Jb(),b.Jb(),b.Jb(),b.Jb()}if(2&e){const e=b.Ub();b.xb(2),b.Xb("formGroup",e.addressForm),b.xb(7),b.Xb("ngForOf",e.countries),b.xb(5),b.Xb("ngForOf",e.regions),b.xb(24),b.Xb("selectedText",e.addressForm.get("code").value.split(",")[0]),b.xb(1),b.Xb("ngForOf",e.phoneCodes),b.xb(5),b.Xb("brmasker",b.Yb(7,f)),b.xb(4),b.Xb("rows",4)}}function J(e,t){if(1&e){const e=b.Lb();b.Kb(0,"ion-col",4),b.Kb(1,"ion-card"),b.Kb(2,"form",5),b.Sb("ngSubmit",(function(){return b.bc(e),b.Ub().updatePassword()})),b.Kb(3,"ion-row"),b.Kb(4,"ion-col",24),b.Kb(5,"ion-item"),b.Kb(6,"ion-label",7),b.fc(7,"Current password"),b.Jb(),b.Ib(8,"ion-input",25),b.Jb(),b.Kb(9,"ion-item"),b.Kb(10,"ion-label",7),b.fc(11,"New password"),b.Jb(),b.Ib(12,"ion-input",26),b.Jb(),b.Kb(13,"ion-item"),b.Kb(14,"ion-label",7),b.fc(15,"Retype new password"),b.Jb(),b.Ib(16,"ion-input",27),b.Jb(),b.Jb(),b.Jb(),b.Kb(17,"ion-button",22),b.fc(18,"Change password"),b.Jb(),b.Jb(),b.Jb(),b.Jb()}if(2&e){const e=b.Ub();b.xb(2),b.Xb("formGroup",e.passForm)}}const K=[{path:"",component:(()=>{class e{constructor(e,t,o,s){this.userService=e,this.formBuilder=t,this.utilityService=o,this.cdr=s,this.address="medium",this.useAddress=!0,this.pass="",this.usePass=!1,this.phoneCodes=[],this.countries=[],this.regions=[],this.addressForm=this.formBuilder.group({country:["",[i.m.required]],phone:["",[i.m.required]],name:["",i.m.required],address:["",i.m.required],city:["",i.m.required],region:["",i.m.required],pinCode:["",i.m.required],code:["",i.m.required],email:["",[i.m.required]],dob:["",i.m.required]}),this.passForm=this.formBuilder.group({oldPass:["",[i.m.required]],pass:["",[i.m.required]],rePass:["",[i.m.required]]}),this.getData()}getData(){this.userService.addressDetails().subscribe(e=>{this.data=e,this.addressForm.get("name").setValue(e.name),this.addressForm.get("phone").setValue(e.phone.slice(-10)),this.addressForm.get("code").setValue("+"+e.phone.slice(0,e.phone.length-10)),this.addressForm.get("country").setValue(e.country),this.addressForm.get("region").setValue(e.region),this.addressForm.get("city").setValue(e.city),this.addressForm.get("address").setValue(e.address),this.addressForm.get("pinCode").setValue(e.pinCode),this.addressForm.get("email").setValue(e.email),this.addressForm.get("dob").setValue(e.dob),this.utilityService.getCurrentCountryPhoneCode().subscribe(e=>{this.utilityService.getPhoneCodeList().subscribe(e=>{this.phoneCodes=e})}),this.utilityService.getCountryRegionList().subscribe(e=>{this.countries=e,this.utilityService.getCurrentCountry().subscribe(e=>{for(const t of this.countries)if(t.countryShortCode===e){this.setRegions();break}})})})}setRegions(){const e=this.addressForm.get("country").value;if(e.length>0)for(const t of this.countries)if(t.countryName===e){this.regions=t.regions;break}}updateDetails(){if(this.addressForm.valid){const e=new Date(this.addressForm.get("dob").value),t={name:this.addressForm.get("name").value,phone:this.addressForm.get("code").value.replace("+","")+this.addressForm.get("phone").value.replace(/-/gi,""),email:this.addressForm.get("email").value,dob:`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`,address:{country:this.addressForm.get("country").value,city:this.addressForm.get("city").value,region:this.addressForm.get("region").value,pinCode:this.addressForm.get("pinCode").value,address:this.addressForm.get("address").value}};this.userService.updateDetails(t).subscribe(e=>{e?(a.a.toast("Details updated successfully!",3e3,"success"),this.getData()):a.a.toast("Could not update details!",3e3,"danger")})}else a.a.toast("Fill out the form properly!",3e3,"danger")}updatePassword(){if(this.passForm.valid){if(this.passForm.get("pass").value!==this.passForm.get("rePass").value)return void a.a.toast("New passwords do not match!",3e3,"danger");this.userService.updatePassword(this.passForm.get("oldPass").value,this.passForm.get("pass").value).subscribe(e=>{this.passForm.reset(),e.status?a.a.toast("Password updated successfully!",3e3,"success"):a.a.toast(e.message,3e3,"danger")})}else a.a.toast("Fill out the form properly!",3e3,"danger")}ngAfterViewInit(){const e=new Date((new Date).setFullYear((new Date).getFullYear()-18));this.datePicker.value=`${e.getDate()}-${e.getMonth()+1}-${e.getFullYear()}`,this.cdr.detectChanges()}goToAddress(){this.address="medium",this.pass="",this.useAddress=!0,this.usePass=!1}goToPassword(){this.address="",this.pass="medium",this.useAddress=!1,this.usePass=!0}}return e.\u0275fac=function(t){return new(t||e)(b.Hb(d.a),b.Hb(i.b),b.Hb(c.a),b.Hb(b.h))},e.\u0275cmp=b.Bb({type:e,selectors:[["app-account"]],viewQuery:function(e,t){var o;1&e&&b.kc(u,!0),2&e&&b.ac(o=b.Tb())&&(t.datePicker=o.first)},decls:14,vars:6,consts:[[1,"full-height","full-width"],["size","9",4,"ngIf"],["size","3"],["lines","none","detail","false","button","",3,"click"],["size","9"],[3,"formGroup","ngSubmit"],["size","6"],["position","floating"],["formControlName","country",3,"ionChange"],[4,"ngFor","ngForOf"],["formControlName","region"],["type","text","formControlName","city"],["type","number","max","9999999999","min","0","formControlName","pinCode"],["type","email","formControlName","email"],["type","text","formControlName","name"],[1,"ion-no-padding"],["formControlName","code",3,"selectedText"],[3,"value",4,"ngFor","ngForOf"],["type","text","formControlName","phone",3,"brmasker"],["type","text","formControlName","address",3,"rows"],["display-format","DD-MM-YYYY","formControlName","dob"],["datePicker",""],["type","submit",1,"ion-float-right"],[3,"value"],["size","6","offset","3"],["type","password","formControlName","oldPass"],["type","password","formControlName","pass"],["type","password","formControlName","rePass"]],template:function(e,t){1&e&&(b.Kb(0,"ion-content"),b.Kb(1,"ion-grid",0),b.Kb(2,"ion-row",0),b.ec(3,h,56,8,"ion-col",1),b.ec(4,J,19,1,"ion-col",1),b.Kb(5,"ion-col",2),b.Kb(6,"ion-card"),b.Kb(7,"ion-list"),b.Kb(8,"ion-item",3),b.Sb("click",(function(){return t.goToAddress()})),b.Kb(9,"ion-label"),b.fc(10,"Address details"),b.Jb(),b.Jb(),b.Kb(11,"ion-item",3),b.Sb("click",(function(){return t.goToPassword()})),b.Kb(12,"ion-label"),b.fc(13,"Change password"),b.Jb(),b.Jb(),b.Jb(),b.Jb(),b.Jb(),b.Jb(),b.Jb(),b.Jb()),2&e&&(b.xb(3),b.Xb("ngIf",t.useAddress),b.xb(1),b.Xb("ngIf",t.usePass),b.xb(4),b.zb("selected",t.useAddress),b.xb(3),b.zb("selected",t.usePass))},directives:[r.l,r.o,r.z,s.j,r.k,r.g,r.x,r.v,r.w,i.n,i.j,i.e,r.B,r.O,i.i,i.d,s.i,r.u,r.P,r.K,l.a,r.E,r.m,r.e,r.C],styles:["ion-item.selected[_ngcontent-%COMP%]{--background:rgba(var(--ion-color-dark-rgb),0.14)}ion-item.selected[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{color:var(--ion-color-dark)}ion-item.selected[_ngcontent-%COMP%]{--color:var(--ion-color-dark)}"]}),e})()}];let y=(()=>{class e{}return e.\u0275mod=b.Fb({type:e}),e.\u0275inj=b.Eb({factory:function(t){return new(t||e)},imports:[[n.i.forChild(K)],n.i]}),e})(),C=(()=>{class e{}return e.\u0275mod=b.Fb({type:e}),e.\u0275inj=b.Eb({factory:function(t){return new(t||e)},imports:[[s.b,i.f,r.I,y,l.b,i.l]]}),e})()}}]);