File: /var/www/vhost/disk-apps/pwa.sports-crowd.com/www/4743.f247e97f74d09f36.js
"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[4743],{64743:(L,T,a)=>{a.r(T),a.d(T,{AddressListPageModule:()=>x});var g=a(56610),n=a(77897),m=a(22882),f=a(36075),v=a(73308),e=a(2978),P=a(57291),s=a(86962),o=a(29885),d=a(54171);function p(i,D){1&i&&e.nrm(0,"ion-icon",12)}function _(i,D){if(1&i){const r=e.RV6();e.j41(0,"ion-item",7)(1,"ion-label",8)(2,"h2",9),e.bIt("click",function(){const l=e.eBV(r).$implicit,c=e.XpG(2);return e.Njj(c.changeAddressUser(l.id))}),e.EFF(3),e.k0s(),e.j41(4,"p",9),e.bIt("click",function(){const l=e.eBV(r).$implicit,c=e.XpG(2);return e.Njj(c.changeAddressUser(l.id))}),e.EFF(5),e.k0s(),e.j41(6,"p",9),e.bIt("click",function(){const l=e.eBV(r).$implicit,c=e.XpG(2);return e.Njj(c.changeAddressUser(l.id))}),e.EFF(7),e.k0s()(),e.DNE(8,p,1,0,"ion-icon",10),e.j41(9,"ion-icon",11),e.bIt("click",function(){const l=e.eBV(r).$implicit,c=e.XpG(2);return e.Njj(c.deleteAddress(l.id))}),e.k0s()()}if(2&i){const r=D.$implicit;e.R7$(3),e.JRh(r.tag),e.R7$(2),e.Lme("",r.direction," - ",r.indications,""),e.R7$(2),e.JRh(r.district),e.R7$(1),e.Y8G("ngIf",r.last_used)}}function U(i,D){if(1&i&&(e.j41(0,"ion-list"),e.DNE(1,_,10,5,"ion-item",6),e.k0s()),2&i){const r=e.XpG();e.R7$(1),e.Y8G("ngForOf",r.userProvider._infoUser.addresses)}}const I=[{path:"",component:(()=>{class i{constructor(r,t,u,l,c,h,C,A){this.storage=r,this.translateService=t,this.loadingCtrl=u,this.alertCtrl=l,this.addressProvider=c,this.userProvider=h,this.utilsService=C,this.router=A,this.translateService.get(["TITLE_ALERT_DELETE_ADDRESS","TEXT_ALERT_DELETE_ADDRESS"]).subscribe(E=>{this.toastMessageText={titleDelete:E.TITLE_ALERT_DELETE_ADDRESS,textDelete:E.TEXT_ALERT_DELETE_ADDRESS}}),A.events.subscribe(E=>{"popstate"===E.navigationTrigger&&E.url.includes("address-list")&&setTimeout(()=>{this.updateInfoUser()},100)})}ngOnInit(){}ionViewDidEnter(){this.updateInfoUser()}addNewAddress(){this.router.navigate(["/address/addressListCreate/true"])}deleteAddress(r){var t=this;return(0,v.A)(function*(){(yield t.alertCtrl.create({header:t.toastMessageText.titleDelete,message:t.toastMessageText.textDelete,buttons:[{text:"No",handler:()=>{console.log("Disagree clicked")}},{text:"Si",handler:()=>{t.storage.get("token").then(function(){var l=(0,v.A)(function*(c){c&&(t.utilsService.presentLoading(t.translateService.instant("all.loading")),(yield t.addressProvider.deleteAddress(r,c.access_token)).subscribe(h=>{"success"==h.status&&t.storage.get("infoUser").then(C=>{let A=C;A.addresses=h.addresses,t.storage.set("infoUser",A),t.updateInfoUser(),t.utilsService.dismissLoading()})},h=>{console.log("error generateOrder",h),t.utilsService.dismissLoading()}))});return function(c){return l.apply(this,arguments)}}())}}]})).present()})()}updateInfoUser(){setTimeout(()=>{this.userProvider.getInfoUser()},500)}changeAddressUser(r){var t=this;return(0,v.A)(function*(){yield t.userProvider.updateLastUsedAddress(r),t.updateInfoUser()})()}static#e=this.\u0275fac=function(t){return new(t||i)(e.rXU(P.n),e.rXU(m.c$),e.rXU(n.Xi),e.rXU(n.hG),e.rXU(s.E),e.rXU(o.D),e.rXU(d.T),e.rXU(f.Ix))};static#t=this.\u0275cmp=e.VBU({type:i,selectors:[["page-address-list"]],decls:13,vars:7,consts:[[1,"ion-no-border"],["slot","start"],["defaultHref","/app/tabs/settings"],[1,"ion-padding"],[4,"ngIf"],["type","submit","color","primary","shape","round","expand","block","fill","solid",1,"marginTop10",3,"click"],["lines","none","class","ion-margin-top",4,"ngFor","ngForOf"],["lines","none",1,"ion-margin-top"],["slot","start",1,"first-item-label","ion-text-wrap"],[3,"click"],["name","checkmark-circle-outline","slot","end","size","small","color","success",4,"ngIf"],["name","trash-outline","slot","end","size","small","color","danger",3,"click"],["name","checkmark-circle-outline","slot","end","size","small","color","success"]],template:function(t,u){1&t&&(e.j41(0,"ion-header",0)(1,"ion-toolbar")(2,"ion-buttons",1),e.nrm(3,"ion-back-button",2),e.k0s(),e.j41(4,"ion-title"),e.EFF(5),e.nI1(6,"translate"),e.k0s()()(),e.j41(7,"ion-content",3),e.DNE(8,U,2,1,"ion-list",4),e.j41(9,"ion-footer",0)(10,"ion-button",5),e.bIt("click",function(){return u.addNewAddress()}),e.EFF(11),e.nI1(12,"translate"),e.k0s()()()),2&t&&(e.R7$(5),e.JRh(e.bMT(6,3,"TITLE_ADDRESS_LIST")),e.R7$(3),e.Y8G("ngIf",u.userProvider._infoUser),e.R7$(3),e.SpI(" ",e.bMT(12,5,"BUTTON_NEW_ADDRESS"),""))},dependencies:[g.Sq,g.bT,n.el,n.Jm,n.QW,n.W9,n.M0,n.eU,n.iq,n.uz,n.he,n.nf,n.BC,n.ai,n.tY,m.D9],styles:[".first-item-label[_ngcontent-%COMP%]{flex-grow:2}ion-list[_ngcontent-%COMP%]{background-color:transparent}ion-item[_ngcontent-%COMP%]{--background: transparent}"]})}return i})()}];let S=(()=>{class i{static#e=this.\u0275fac=function(t){return new(t||i)};static#t=this.\u0275mod=e.$C({type:i});static#s=this.\u0275inj=e.G2t({imports:[f.iI.forChild(I),f.iI]})}return i})(),x=(()=>{class i{static#e=this.\u0275fac=function(t){return new(t||i)};static#t=this.\u0275mod=e.$C({type:i});static#s=this.\u0275inj=e.G2t({imports:[g.MD,n.bv,S,m.h.forChild()]})}return i})()},86962:(L,T,a)=>{a.d(T,{E:()=>v});var g=a(73308),n=a(2978),m=a(3366),f=a(54171);let v=(()=>{class e{constructor(s,o){this.api=s,this.utilsService=o,this._allCitiesService=[],this._allDepartments=[]}getAllCitiesService(){var s=this;return(0,g.A)(function*(){(yield s.api.getFree("address/allCitiesService")).subscribe(d=>{"success"==d.status&&(s._allCitiesService=d.citiesService,s._pointCoverage=d.pointCoverage.point_coverage)},d=>{console.error("Error provider address getAllCitiesService",d)})})()}getAllDepartments(){var s=this;return(0,g.A)(function*(){return new Promise(function(){var o=(0,g.A)(function*(d,p){(yield s.api.getFree("address/allDepartments")).subscribe(_=>{"success"==_.status&&(s._allDepartments=_.departments),d(_)},_=>{console.error("Error provider address getAllDepartments",_),p(_)})});return function(d,p){return o.apply(this,arguments)}}())})()}getAllCities(s){return this.api.getFree("address/allCities/"+s)}getAllCitiesAdvisor(s){return this.api.getFree("address/allCities/"+s)}addAddressUser(s,o){return this.api.post("address/add",s,o)}deleteAddress(s,o){return this.api.post("address/delete",{address_id:s},o)}updateLocationAddress(s,o,d){return this.api.put("address/updateLocation",{address_id:s,lat:o.lat,lng:o.lng},d)}saveCoveragePending(s,o){return this.api.post("address/saveCoveragePending",s,o)}addresToLatLong(s,o){return this.api.get("address/geocode/"+encodeURIComponent(s),o)}static#e=this.\u0275fac=function(o){return new(o||e)(n.KVO(m.G),n.KVO(f.T))};static#t=this.\u0275prov=n.jDH({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})()}}]);