File: /var/www/vhost/disk-apps/pwa.sports-crowd.com/www/742.c329aadb71a6947b.js
"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[742],{10742:(E,T,a)=>{a.r(T),a.d(T,{BuyTicketsPageModule:()=>F});var d=a(56610),k=a(37222),l=a(77897),b=a(36075),y=a(73308),t=a(2978),P=a(54171),s=a(57291),i=a(22882),o=a(55467),m=a(7125),_=a(26173),g=a(29885),u=a(81337);function f(n,v){if(1&n&&t.nrm(0,"app-empty-component",5),2&n){const e=t.XpG();t.Y8G("emptySettingsSlide",e.emptySettingsSlide)}}function S(n,v){if(1&n&&(t.j41(0,"h4"),t.EFF(1),t.k0s()),2&n){const e=t.XpG().$implicit;t.R7$(1),t.JRh(e.stadium_to_play)}}function x(n,v){if(1&n){const e=t.RV6();t.j41(0,"ion-button",15),t.bIt("click",function(){t.eBV(e);const c=t.XpG().$implicit,h=t.XpG(2);return t.Njj(h.buySubscribers(c))}),t.EFF(1),t.nI1(2,"translate"),t.k0s()}if(2&n){const e=t.XpG().$implicit,r=t.XpG(2);t.Y8G("disabled",e.invalidEvent||!r.statusTerms),t.R7$(1),t.SpI(" ",r.ticketParams.subscriber_button?r.ticketParams.subscriber_button:t.bMT(2,2,"tickets.exclusive_subscriptions")," ")}}function I(n,v){1&n&&(t.j41(0,"ion-row",18)(1,"ion-col")(2,"h3",19),t.EFF(3),t.nI1(4,"translate"),t.k0s()()()),2&n&&(t.R7$(3),t.JRh(t.bMT(4,1,"tickets.event_without_prices")))}function $(n,v){if(1&n){const e=t.RV6();t.j41(0,"ion-card")(1,"ion-card-header")(2,"ion-card-title"),t.EFF(3),t.k0s()(),t.j41(4,"ion-card-content")(5,"ion-grid")(6,"ion-row")(7,"ion-col",7),t.nrm(8,"img",8),t.j41(9,"ion-label"),t.EFF(10),t.k0s()(),t.j41(11,"ion-col",9)(12,"h1"),t.EFF(13,"VS"),t.k0s()(),t.j41(14,"ion-col",7),t.nrm(15,"img",8),t.j41(16,"ion-label"),t.EFF(17),t.k0s()()()()(),t.j41(18,"div",10),t.DNE(19,S,2,1,"h4",4),t.j41(20,"h4"),t.EFF(21),t.k0s(),t.j41(22,"div",11)(23,"ion-checkbox",12),t.bIt("ionChange",function(c){t.eBV(e);const h=t.XpG(2);return t.Njj(h.changeStatusTerms(c))}),t.k0s(),t.j41(24,"span",13),t.EFF(25),t.nI1(26,"translate"),t.j41(27,"span",14),t.bIt("click",function(){t.eBV(e);const c=t.XpG(2);return t.Njj(c.openTermsSI())}),t.EFF(28),t.nI1(29,"translate"),t.k0s(),t.EFF(30),t.nI1(31,"translate"),t.k0s()(),t.j41(32,"ion-button",15),t.bIt("click",function(){const h=t.eBV(e).$implicit,p=t.XpG(2);return t.Njj(p.buyTickets(h))}),t.EFF(33),t.nI1(34,"translate"),t.k0s(),t.DNE(35,x,3,4,"ion-button",16),t.k0s(),t.DNE(36,I,5,3,"ion-row",17),t.k0s()}if(2&n){const e=v.$implicit,r=t.XpG(2);let c,h;t.R7$(3),t.JRh(e.season.name),t.R7$(5),t.Y8G("src",r.cityProvider._urlGallery+"teams/"+r.homeProvider._teamData.logo,t.B4B),t.R7$(2),t.JRh(null!==(c=r.homeProvider._teamData.name)&&void 0!==c?c:"Team1"),t.R7$(5),t.Y8G("src",r.cityProvider._urlGallery+"teams/"+e.team.logo,t.B4B),t.R7$(2),t.JRh(null!==(h=e.team.name)&&void 0!==h?h:"Team2"),t.R7$(2),t.Y8G("ngIf",e.stadium_to_play),t.R7$(2),t.Lme("",e.date_name,", ",e.event_start,""),t.R7$(4),t.SpI("",t.bMT(26,15,"TERMS_AND_CONDITIONS_1")," "),t.R7$(3),t.JRh(t.bMT(29,17,"TERMS_AND_CONDITIONS_2")),t.R7$(2),t.JRh(t.bMT(31,19,"REQUIRED_SYMBOL")),t.R7$(2),t.Y8G("disabled",e.invalidEvent||!r.statusTerms),t.R7$(1),t.SpI(" ",r.ticketParams.ticket_button?r.ticketParams.ticket_button:t.bMT(34,21,"tickets.buy_tickets")," "),t.R7$(2),t.Y8G("ngIf",e.subscriberSales),t.R7$(1),t.Y8G("ngIf",e.invalidEvent)}}function R(n,v){if(1&n&&(t.j41(0,"ion-grid")(1,"ion-row"),t.DNE(2,$,37,23,"ion-card",6),t.k0s()()),2&n){const e=t.XpG();t.R7$(2),t.Y8G("ngForOf",e.matchEvents)}}const M=[{path:"",component:(()=>{class n{constructor(e,r,c,h,p,O,j,G,D){this.router=e,this.utilsService=r,this.storage=c,this.translateService=h,this.ticketsService=p,this.cityProvider=O,this.homeProvider=j,this.ticketService=G,this.userService=D,this.matchEvents=[],this.ticketParams={},this.statusInvalidTerms=!1,this.statusTerms=!1}ngOnInit(){this.emptySettingsSlide={showImage:!1,urlImage:"",showText:!0,text:this.translateService.instant("tickets.empty_events")},this.loadInit()}loadInit(e=0){setTimeout(()=>new Promise((r,c)=>{this.utilsService.presentLoading(this.translateService.instant("all.loading")).then(()=>{Promise.all([this.getMatchEvents(),this.ticketService.getParameters("terms").then(h=>{this.ticketParams=h.parameters})]).then(()=>{this.utilsService.closeAllAlerts(),r(!1)}).catch(h=>{this.utilsService.closeAllAlerts(),console.log("Error loadInit BuyTicketsPage",h),c(h)})})}),e)}getMatchEvents(){var e=this;this.storage.get("token").then(function(){var r=(0,y.A)(function*(c){e.utilsService.presentLoading(e.translateService.instant("all.loading")),(yield e.ticketsService.getMatchEvents(c.access_token)).subscribe(h=>{e.matchEvents=[],h.forEach(p=>{e.utilsService.validateDate(p.event_start_sale,"start")&&e.utilsService.validateDate(p.event_end_sale,"end")&&(p.season=p.season_app,delete p.season_app,p.team=p.team_app,delete p.team_app,e.matchEvents.push(p),e.ticketsService.matchEvents=e.matchEvents)}),e.utilsService.closeAllAlerts()},h=>{e.utilsService.closeAllAlerts(),console.log("Error getMatchEvents: ",h)})});return function(c){return r.apply(this,arguments)}}())}dateFormat(e){return new Date(e).toLocaleString()}buyTickets(e){this.userService.validateAlertsUseApp("document")&&e.sales&&this.router.navigate([e.sales])}buySubscribers(e){this.userService.validateAlertsUseApp("document")&&e.subscriberSales&&this.router.navigate([e.subscriberSales])}doRefresh(e){setTimeout(()=>{this.loadInit(100),e.target.complete()},500)}changeStatusTerms(e){this.statusTerms=e.detail.checked}openTermsSI(){this.ticketParams&&this.utilsService.openLink(this.ticketParams.terms)}static#t=this.\u0275fac=function(r){return new(r||n)(t.rXU(b.Ix),t.rXU(P.T),t.rXU(s.n),t.rXU(i.c$),t.rXU(o.t),t.rXU(m.h),t.rXU(_.X),t.rXU(o.t),t.rXU(g.D))};static#e=this.\u0275cmp=t.VBU({type:n,selectors:[["app-buy-tickets"]],decls:11,vars:5,consts:[["defaultHref","/app/tabs/home","slot","start"],[1,"ion-text-center"],["slot","fixed",3,"ionRefresh"],[3,"emptySettingsSlide",4,"ngIf"],[4,"ngIf"],[3,"emptySettingsSlide"],[4,"ngFor","ngForOf"],["col-5",""],["onerror","if (this.src != 'error.jpg') this.src = '../../assets/img/teamEmpty.png';",1,"teamLogo",3,"src"],["col-2","",2,"max-width","40px","justify-content","center"],[1,"btn_buy"],[1,"ion-margin","p-r",2,"height","10%","border-top","none"],["color","primary","checked","false",3,"ionChange"],[1,"text_terms"],[1,"openTerms",3,"click"],["type","submit","color","primary","shape","round","expand","block","fill","solid",1,"ion-margin",3,"disabled","click"],["type","submit","color","primary","shape","round","expand","block","fill","solid","class","ion-margin",3,"disabled","click",4,"ngIf"],["class","card-footer",4,"ngIf"],[1,"card-footer"],[1,"card-alert"]],template:function(r,c){1&r&&(t.j41(0,"ion-header")(1,"ion-toolbar"),t.nrm(2,"ion-back-button",0),t.j41(3,"ion-title",1),t.EFF(4),t.nI1(5,"translate"),t.k0s()()(),t.j41(6,"ion-content")(7,"ion-refresher",2),t.bIt("ionRefresh",function(p){return c.doRefresh(p)}),t.nrm(8,"ion-refresher-content"),t.k0s(),t.DNE(9,f,1,1,"app-empty-component",3),t.DNE(10,R,3,1,"ion-grid",4),t.k0s()),2&r&&(t.R7$(4),t.JRh(t.bMT(5,3,"tickets.matches")),t.R7$(5),t.Y8G("ngIf",c.matchEvents&&!c.matchEvents.length),t.R7$(1),t.Y8G("ngIf",c.matchEvents&&c.matchEvents.length))},dependencies:[d.Sq,d.bT,l.el,l.Jm,l.b_,l.I9,l.ME,l.tN,l.eY,l.hU,l.W9,l.lO,l.eU,l.he,l.To,l.Ki,l.ln,l.BC,l.ai,l.hB,l.tY,u.O,i.D9],styles:["ion-card[_ngcontent-%COMP%]{box-shadow:0 1px 6px gray;margin:10px;width:-webkit-fill-available}ion-card-header[_ngcontent-%COMP%]{border-bottom:1px solid #ddd;background-color:#f5f5f5;padding:10px 20px}ion-card-content[_ngcontent-%COMP%]{display:flex;flex-flow:nowrap;padding-bottom:0}div[_ngcontent-%COMP%]{border-top:1px solid #ddd;background-color:#f5f5f5;height:100%}h4[_ngcontent-%COMP%]{margin:0 20px}ion-col[_ngcontent-%COMP%]{display:flex;flex-flow:column;text-align:center;align-items:center}.teamLogo[_ngcontent-%COMP%]{width:auto;max-width:100%;height:100px}.card-footer[_ngcontent-%COMP%]{position:sticky;bottom:0;width:100%;background-color:#f5f5f5;border-top:1px solid #ddd;padding:10px 20px}.card-alert[_ngcontent-%COMP%]{font-weight:700;text-align:center;margin-top:10px;color:red}.openTerms[_ngcontent-%COMP%]{text-decoration:underline;color:var(--ion-color-primary)}.text_terms[_ngcontent-%COMP%]{top:0;position:absolute;left:30px}.ion-margin-top[_ngcontent-%COMP%]{margin-top:20px}.bold[_ngcontent-%COMP%]{font-weight:700}.btn_buy[_ngcontent-%COMP%]{height:60%}"]})}return n})()}];let B=(()=>{class n{static#t=this.\u0275fac=function(r){return new(r||n)};static#e=this.\u0275mod=t.$C({type:n});static#i=this.\u0275inj=t.G2t({imports:[b.iI.forChild(M),b.iI]})}return n})();var C=a(55553),A=a(41683);let F=(()=>{class n{static#t=this.\u0275fac=function(r){return new(r||n)};static#e=this.\u0275mod=t.$C({type:n});static#i=this.\u0275inj=t.G2t({imports:[d.MD,k.YN,l.bv,B,i.h.forChild(),C.h,A.Y]})}return n})()},55467:(E,T,a)=>{a.d(T,{t:()=>y});var d=a(73308),k=a(2978),l=a(3366),b=a(54171);let y=(()=>{class t{constructor(s,i){this.api=s,this.utilsService=i,this.parameters={},this.matchEvents={}}getMatchEvents(s){return this.api.get("tickets/match_events",s)}loadStadiumZones(s,i){return this.api.get("tickets/loadStadiumZones",s,i)}getSeats(s,i,o){return this.api.get(`tickets/get_seats/${i}/${o}`,s)}getSeatPrice(s,i,o){return this.api.get(`tickets/get_seat_price/${i}/${o}`,s)}generateBlock(s,i){return this.api.post("tickets/createBlock",i,s)}getMatchEventsSuscription(s,i){return this.api.get("tickets/getMatchEventsSuscription",s,i)}isPreabonado(s,i){return this.api.get(`tickets/isPreabonado/${i}`,s)}createBlocks(s,i){return this.api.post("tickets/createBlocks",i,s)}purchaseTickets(s){let o=`${this.api.getUrl()}/tickets/purchase?id=`+s;this.utilsService.openLink(o)}purchaseAbonos(){let i=`${this.api.getUrl()}/abonados/abonados.html`;this.utilsService.openLink(i)}getTickets(s,i){return this.api.get(`tickets/get_tickets/${s}/${i}`)}getPdf(s,i){var o=this;return(0,d.A)(function*(){return o.api.post("tickets/pdf",{code:s,platform:i},yield o.utilsService.getAccessToken())})()}generateTicketBycoins(s,i){return this.api.get(`coins/generateTickets/${i}`,s)}validateUserTickets(s,i,o){return this.api.get(`flash_tickets/validateUserTickets/${i}/${o}`,s)}getTribunesParentFlashTicket(s,i,o,m){return this.api.get(`flash_tickets/getTribunesParent/${i}?availableCupon=${o}&cuponCode=${m}`,s)}validateSeatsAvailableByCapacity(s,i){return this.api.post("flash_tickets/validateSeatsAvailableByCapacity",i,s)}getTicketsSubscriptions(s,i){return this.api.get(`tickets/getTicketsSubscriptions/${i}`,s)}createPurchaseSubscribers(s,i){return this.api.post("tickets/createPurchaseSubscribers",i,s)}validateCouponExist(s,i){var o=this;return(0,d.A)(function*(){let m=yield o.utilsService.getAccessToken();return new Promise(function(){var _=(0,d.A)(function*(g,u){(yield o.api.get(`flash_tickets/validateACoupon/${s}/${i}`,m)).subscribe(f=>{g(f)},f=>{console.error("Error validateCouponExist",f),u(f)})});return function(g,u){return _.apply(this,arguments)}}())})()}userTransferTickets(s){var i=this;return(0,d.A)(function*(){let o=yield i.utilsService.getAccessToken();return new Promise(function(){var m=(0,d.A)(function*(_,g){(yield i.api.post("tickets/transfer",s,o)).subscribe(u=>{_(u)},u=>{console.error("Error userTransferTickets",u),g(u)})});return function(_,g){return m.apply(this,arguments)}}())})()}userInformation(s){var i=this;return(0,d.A)(function*(){let o=yield i.utilsService.getAccessToken();return new Promise(function(){var m=(0,d.A)(function*(_,g){(yield i.api.post("tickets/userInformationToTransferTicket",s,o)).subscribe(u=>{_(u)},u=>{console.error("Error userInformation",u),g(u)})});return function(_,g){return m.apply(this,arguments)}}())})()}getParameters(s){var i=this;return new Promise(function(){var o=(0,d.A)(function*(m,_){(yield i.api.get("tickets/parameters/info"+(s?"?keys="+s:""))).subscribe(u=>{"success"==u.status&&(s||(i.parameters=u.parameters)),m(u)},u=>{console.error("Error provider getParameters",u),_(u)})});return function(m,_){return o.apply(this,arguments)}}())}static#t=this.\u0275fac=function(i){return new(i||t)(k.KVO(l.G),k.KVO(b.T))};static#e=this.\u0275prov=k.jDH({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})()}}]);