File: /var/www/vhost/disk-apps/pwa.sports-crowd.com/www/4865.a130a5d14456d1df.js
"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[4865,5553,7934,315],{55553:(b,R,o)=>{o.d(R,{h:()=>s});var _=o(77897),y=o(56610),l=o(41683),E=o(13721),P=o(22882),e=o(37222),C=o(36594),r=o(2978);let s=(()=>{class g{static#e=this.\u0275fac=function(c){return new(c||g)};static#t=this.\u0275mod=r.$C({type:g});static#i=this.\u0275inj=r.G2t({imports:[y.MD,_.bv,E.h,l.Y,P.h.forChild(),e.YN,C.rJ]})}return g})()},57246:(b,R,o)=>{o.r(R),o.d(R,{BusinessDirectoryRatePageModule:()=>S});var _=o(56610),y=o(37222),l=o(77897),E=o(36075),P=o(73308),e=o(2978),C=o(22882),r=o(54171),s=o(73012),g=o(29885);function d(i,p){if(1&i){const t=e.RV6();e.j41(0,"ion-item",17)(1,"ion-label"),e.EFF(2),e.k0s(),e.j41(3,"ion-checkbox",18),e.bIt("click",function(){const h=e.eBV(t).$implicit,f=e.XpG(2);return e.Njj(f.onChange(h))}),e.k0s()()}if(2&i){const t=p.$implicit;e.R7$(2),e.JRh(t)}}function m(i,p){if(1&i&&(e.j41(0,"ion-list"),e.DNE(1,d,4,1,"ion-item",16),e.k0s()),2&i){const t=e.XpG();e.R7$(1),e.Y8G("ngForOf",t.checkOption)}}function c(i,p){if(1&i){const t=e.RV6();e.j41(0,"ion-item",20)(1,"ion-label"),e.EFF(2),e.k0s(),e.j41(3,"ion-checkbox",18),e.bIt("click",function(){const h=e.eBV(t).$implicit,f=e.XpG(2);return e.Njj(f.onChange(h))}),e.k0s()()}if(2&i){const t=p.$implicit;e.R7$(2),e.JRh(t)}}function u(i,p){if(1&i&&(e.j41(0,"ion-list"),e.DNE(1,c,4,1,"ion-item",19),e.k0s()),2&i){const t=e.XpG();e.R7$(1),e.Y8G("ngForOf",t.checkOption)}}function v(i,p){if(1&i){const t=e.RV6();e.j41(0,"ion-item",22)(1,"ion-label"),e.EFF(2),e.k0s(),e.j41(3,"ion-checkbox",18),e.bIt("click",function(){const h=e.eBV(t).$implicit,f=e.XpG(2);return e.Njj(f.onChange(h))}),e.k0s()()}if(2&i){const t=p.$implicit;e.R7$(2),e.JRh(t)}}function D(i,p){if(1&i&&(e.j41(0,"ion-list"),e.DNE(1,v,4,1,"ion-item",21),e.k0s()),2&i){const t=e.XpG();e.R7$(1),e.Y8G("ngForOf",t.checkOption)}}function k(i,p){if(1&i){const t=e.RV6();e.j41(0,"ion-item",24)(1,"ion-label"),e.EFF(2),e.k0s(),e.j41(3,"ion-checkbox",18),e.bIt("click",function(){const h=e.eBV(t).$implicit,f=e.XpG(2);return e.Njj(f.onChange(h))}),e.k0s()()}if(2&i){const t=p.$implicit;e.R7$(2),e.JRh(t)}}function x(i,p){if(1&i&&(e.j41(0,"ion-list"),e.DNE(1,k,4,1,"ion-item",23),e.k0s()),2&i){const t=e.XpG();e.R7$(1),e.Y8G("ngForOf",t.checkOption)}}const B=[{path:"",component:(()=>{class i{constructor(t,n,a,h,f,T,j,F){this.route=t,this.translateService=n,this.utilsService=a,this.navCtrl=h,this.alertController=f,this.businessService=T,this.location=j,this.userService=F,this.options=[],this.checkOption=[],this.checkedItems=[],this.form=[],this.business=this.route.snapshot.paramMap.get("business")}ngOnInit(){this.loadInit(240)}loadInit(t=0){setTimeout(()=>new Promise((n,a)=>{this.utilsService.presentLoading(this.translateService.instant("all.loading")).then(()=>{Promise.all([this.userService.getInfoUser().then(h=>{h&&(this.onlyUserId=h.id,this.businessService.getScoringOptions().then(f=>{this.options=f}))})]).then(()=>{this.utilsService.dismissLoading(),n(!1)}).catch(h=>{this.utilsService.dismissLoading(),console.log("Error loadInit BusinessDirectoryListPage",h),a(h)})})}),t)}segmentChanged(t){let n;this.form=[],t.detail.value&&(this.emotion=t.detail.value,this.form=this.options.filter(a=>a.name==this.emotion).sort((a,h)=>a.comment.localeCompare(h.comment)),this.form.forEach(function(a,h){n=a.comment.split(",")}),this.checkOption=n)}onChange(t){this.checkedItems.includes(t)?this.checkedItems=this.checkedItems.filter(n=>n!=t):this.checkedItems.push(t)}presentAlertRate(t){var n=this;return(0,P.A)(function*(){yield(yield n.alertController.create({header:"Mensaje",message:t,buttons:[{text:"NO",role:"cancel",cssClass:"secondary",handler:()=>{}},{text:"SI",handler:()=>{n.sendRating()}}]})).present()})()}rate(){this.presentAlertRate("Est\xe1 seguro de enviar la calificaci\xf3n actual del negocio?")}sendRating(){var t;let n="";n=this.checkedItems.map(a=>a).join(","),(n||this.emotion)&&(t={user_id:this.onlyUserId,bussines_id:this.business,comments:n,emotion:this.emotion},this.utilsService.presentLoading(this.translateService.instant("all.loading")),this.businessService.registerScoring(t).then(a=>{this.utilsService.dismissLoading(),a.r?(this.utilsService.presentToast(6e3,"success","top","Gracias, has calificado con \xe9xito el negocio y esto ayudar\xe1 mucho a otros hinchas.",!0),this.navCtrl.back()):this.utilsService.presentToast(4e3,"tertiary","top",a.m)}).catch(a=>{this.utilsService.dismissLoading(),this.utilsService.presentToast(4e3,"danger","top",this.translateService.instant("all.error_request"))}))}confirmRegistration(t){var n=this;return(0,P.A)(function*(){yield(yield n.alertController.create({header:"Mensaje",message:t.m,buttons:[{text:"Ok",handler:()=>{n.location.back()}}]})).present()})()}static#e=this.\u0275fac=function(n){return new(n||i)(e.rXU(E.nX),e.rXU(C.c$),e.rXU(r.T),e.rXU(l.q9),e.rXU(l.hG),e.rXU(s.u),e.rXU(_.aZ),e.rXU(g.D))};static#t=this.\u0275cmp=e.VBU({type:i,selectors:[["app-business-directory-rate"]],decls:35,vars:6,consts:[[1,"ion-no-border"],["slot","start"],[1,"ion-text-center"],[1,"emotionTitle"],[1,"emotionSegment",3,"value","ionChange"],["value","Mala"],["src","assets/img/icons/bad.svg",1,"red-apple"],["value","Regular"],["src","assets/img/icons/regular.svg"],["value","Buena"],["src","assets/img/icons/good.svg"],["value","Excelente"],["src","assets/img/icons/excellent.svg"],[3,"ngSwitch"],[4,"ngSwitchCase"],["expand","block","size","large",3,"click"],["class","itemWrong",4,"ngFor","ngForOf"],[1,"itemWrong"],["slot","start",3,"click"],["class","itemRegular",4,"ngFor","ngForOf"],[1,"itemRegular"],["class","itemGood",4,"ngFor","ngForOf"],[1,"itemGood"],["class","itemExcellent",4,"ngFor","ngForOf"],[1,"itemExcellent"]],template:function(n,a){1&n&&(e.j41(0,"ion-header",0)(1,"ion-toolbar"),e.nrm(2,"ion-back-button",1),e.j41(3,"ion-title",2),e.EFF(4,"Calificar Negocio"),e.k0s()()(),e.j41(5,"ion-content")(6,"h2",3),e.EFF(7,"Seleccionar calificaci\xf3n del negocio:"),e.k0s(),e.j41(8,"ion-segment",4),e.bIt("ionChange",function(f){return a.segmentChanged(f)}),e.j41(9,"ion-segment-button",5),e.nrm(10,"ion-icon",6),e.j41(11,"ion-label"),e.EFF(12,"Mal"),e.k0s()(),e.j41(13,"ion-segment-button",7),e.nrm(14,"ion-icon",8),e.j41(15,"ion-label"),e.EFF(16,"Regular"),e.k0s()(),e.j41(17,"ion-segment-button",9),e.nrm(18,"ion-icon",10),e.j41(19,"ion-label"),e.EFF(20,"Bueno"),e.k0s()(),e.j41(21,"ion-segment-button",11),e.nrm(22,"ion-icon",12),e.j41(23,"ion-label"),e.EFF(24,"Excelente"),e.k0s()()(),e.j41(25,"div",13),e.DNE(26,m,2,1,"ion-list",14),e.DNE(27,u,2,1,"ion-list",14),e.DNE(28,D,2,1,"ion-list",14),e.DNE(29,x,2,1,"ion-list",14),e.k0s()(),e.j41(30,"ion-footer")(31,"ion-item")(32,"ion-label",2)(33,"ion-button",15),e.bIt("click",function(){return a.rate()}),e.EFF(34,"Enviar"),e.k0s()()()()),2&n&&(e.R7$(8),e.Y8G("value",a.emotion),e.R7$(17),e.Y8G("ngSwitch",a.emotion),e.R7$(1),e.Y8G("ngSwitchCase","Mala"),e.R7$(1),e.Y8G("ngSwitchCase","Regular"),e.R7$(1),e.Y8G("ngSwitchCase","Buena"),e.R7$(1),e.Y8G("ngSwitchCase","Excelente"))},dependencies:[_.Sq,_.ux,_.e1,l.el,l.Jm,l.eY,l.W9,l.M0,l.eU,l.iq,l.uz,l.he,l.nf,l.Gp,l.eP,l.BC,l.ai,l.hB,l.Je,l.tY],styles:[".emotionTitle[_ngcontent-%COMP%]{padding:0 15px}.emotionSegment[_ngcontent-%COMP%]{background-color:transparent;color:orange}.itemWrong[_ngcontent-%COMP%]{color:red}.itemRegular[_ngcontent-%COMP%]{color:gray}.itemGood[_ngcontent-%COMP%]{color:#2286d7}.itemExcellent[_ngcontent-%COMP%]{color:green}.red-apple[_ngcontent-%COMP%]{fill:#ed6866}"]})}return i})()}];let O=(()=>{class i{static#e=this.\u0275fac=function(n){return new(n||i)};static#t=this.\u0275mod=e.$C({type:i});static#i=this.\u0275inj=e.G2t({imports:[E.iI.forChild(B),E.iI]})}return i})();var M=o(55553);let S=(()=>{class i{static#e=this.\u0275fac=function(n){return new(n||i)};static#t=this.\u0275mod=e.$C({type:i});static#i=this.\u0275inj=e.G2t({imports:[_.MD,y.YN,l.bv,O,C.h.forChild(),M.h]})}return i})()},73012:(b,R,o)=>{o.d(R,{u:()=>P});var _=o(73308),y=o(2978),l=o(3366),E=o(54171);let P=(()=>{class e{constructor(r,s){this.api=r,this.utilsService=s,this.categories=[],this.businesses=[],this.centerFirstMarker=!1,this.userHaveBusiness=!1,this.loadingBusiness=!0}getCategories(r){var s=this;return(0,_.A)(function*(){return s.categories=[],new Promise(function(){var g=(0,_.A)(function*(d,m){(yield s.api.get("business/getCategories/"+r,yield s.utilsService.getAccessToken())).subscribe(u=>{s.categories=u,d(u)},u=>{console.error("Error getCategories",u),m(u)})});return function(d,m){return g.apply(this,arguments)}}())})()}registerBusiness(r){var s=this;return(0,_.A)(function*(){let g=yield s.utilsService.getAccessToken();return new Promise(function(){var d=(0,_.A)(function*(m,c){(yield s.api.post("business/register",r,g)).subscribe(u=>{m(u)},u=>{console.error("Error registerBusiness",u),c(u)})});return function(m,c){return d.apply(this,arguments)}}())})()}getBusinesses(r){var s=this;return(0,_.A)(function*(){s.params=r;let g=yield s.utilsService.getAccessToken();return r.reset&&(s.businesses=[]),new Promise(function(){var d=(0,_.A)(function*(m,c){(yield s.api.get("business/getBusinesses",g,r)).subscribe(v=>{s.loadingBusiness=!1,r.reset?s.businesses=v:s.businesses.push(...v),r.user&&v.length&&(s.userHaveBusiness=!0),s.centerFirstMarker=!(!r.search&&1!=v.length),m(s.businesses)},v=>{console.error("Error getBusinesses",v),c(v)})});return function(m,c){return d.apply(this,arguments)}}())})()}deleteBusiness(r){var s=this;return(0,_.A)(function*(){let g=yield s.utilsService.getAccessToken();return new Promise(function(){var d=(0,_.A)(function*(m,c){(yield s.api.delete("business/delete/"+r,g)).subscribe(u=>{m(u)},u=>{console.error("Error registerBusiness",u),c(u)})});return function(m,c){return d.apply(this,arguments)}}())})()}getParameters(){var r=this;return(0,_.A)(function*(){return new Promise(function(){var s=(0,_.A)(function*(g,d){(yield r.api.get("business/getParameters",yield r.utilsService.getAccessToken())).subscribe(c=>{g(c)},c=>{console.error("Error getParemeters",c),d(c)})});return function(g,d){return s.apply(this,arguments)}}())})()}getScoringOptions(){var r=this;return(0,_.A)(function*(){return new Promise(function(){var s=(0,_.A)(function*(g,d){(yield r.api.get("business/getScoringOptions",yield r.utilsService.getAccessToken())).subscribe(c=>{g(c)},c=>{console.error("Error getParemeters",c),d(c)})});return function(g,d){return s.apply(this,arguments)}}())})()}registerScoring(r){var s=this;return(0,_.A)(function*(){let g=yield s.utilsService.getAccessToken();return new Promise(function(){var d=(0,_.A)(function*(m,c){(yield s.api.post("business/scoreRegistry",r,g)).subscribe(u=>{m(u)},u=>{console.error("Error registerScoring",u),c(u)})});return function(m,c){return d.apply(this,arguments)}}())})()}static#e=this.\u0275fac=function(s){return new(s||e)(y.KVO(l.G),y.KVO(E.T))};static#t=this.\u0275prov=y.jDH({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})()}}]);