1"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[3366],{3366:(ce,w,i)=>{i.d(w,{v:()=>Q});var T=i(58864),P=i(96853),a=i(73664),F=i(2615);i(38139);let H=(()=>{class E{static \u0275fac=function(k){return new(k||E)};static \u0275mod=a.$C({type:E});static \u0275inj=F.G2t({imports:[T.J,P.G]})}return E})();i(41448);let z=(()=>{class E{static \u0275fac=function(k){return new(k||E)};static \u0275mod=a.$C({type:E});static \u0275inj=F.G2t({imports:[T.J,H]})}return E})();var V=i(33142);i(48224);let t=(()=>{class E{static \u0275fac=function(k){return new(k||E)};static \u0275mod=a.$C({type:E});static \u0275inj=F.G2t({imports:[T.J,V.v]})}return E})();var b=i(37836),W=i(71576),y=i(7030),s=i(56216),_=i(66456),B=i(21867),$=i(32951),Y=i(481);i(12772);let Q=(()=>{class E{static \u0275fac=function(k){return new(k||E)};static \u0275mod=a.$C({type:E});static \u0275inj=F.G2t({imports:[T.J,V.v,y.g,t,W.G,b.F,s.S,_.c,z,B.v,$.S,Y.R]})}return E})()},12772:(ce,w,i)=>{i.d(w,{u:()=>Oe});var T=i(10467),P=i(2615),a=i(73664),F=i(89079),f=i(86111),H=i(14934),ee=i(51589),z=i(6961),V=i(60152),te=i(68010),t=i(25615),b=i(63924),W=i(13961),y=i(5964),s=i(23294),_=i(54843),B=i(38968),$=i(81048),Y=i(82e3),J=i(3356),Q=i(61048),E=i(27544),re=i(61448),ae=i(54423),k=i(69915),oe=i(85160),U=i(26221),le=i(13102),n=i(13443),m=i(91029),O=i(36229),I=i(57303),N=i(72200),c=i(18594),R=i(94474),v=i(95064),M=i(69415),D=i(48224),l=i(71576),p=i(29605),g=i(41448),S=i(85340),L=i(11630),Z=i(68018);const ie=()=>["competition"],ne=(h,K,e,o)=>({"admin-dashboard white":h,topbar:K,bread:e,topbread:o}),x=()=>({icon:"fa-solid fa-plus"});function se(h,K){if(1&h){const e=a.RV6();a.j41(0,"app-clupik-button",10),a.bIt("buttonAction",function(){P.eBV(e);const r=a.XpG(2);return P.Njj(r.exportTable())}),a.k0s()}if(2&h){const e=a.XpG(2);a.Y8G("tooltip","global.button.export")("icon","fa-regular fa-file-export")("isDisabled",e.noGames)}}function pe(h,K){if(1&h){const e=a.RV6();a.j41(0,"div",3)(1,"app-clupik-button",6),a.bIt("buttonAction",function(){P.eBV(e);const r=a.XpG();return P.Njj(r.openFilter())}),a.k0s(),a.j41(2,"div",7),a.nVh(3,se,1,3,"app-clupik-button",8),a.j41(4,"app-clupik-button",9),a.bIt("buttonAction",function(){P.eBV(e);const r=a.XpG();return P.Njj(r.globalVars.openChat())}),a.k0s()()()}if(2&h){const e=a.XpG();a.R7$(),a.Y8G("label","global.common.filters"),a.R7$(2),a.vxM(e.isAdmin?3:-1),a.R7$(),a.Y8G("tooltip","global.common.ia")("icon","fa-regular fa-wand-magic-sparkles")}}function de(h,K){1&h&&a.nrm(0,"i",13)}function _e(h,K){if(1&h){const e=a.RV6();a.j41(0,"div",5)(1,"i",11),a.nI1(2,"translate"),a.bIt("click",function(){P.eBV(e);const r=a.XpG();return P.Njj(r.nextWeek(-1))}),a.k0s(),a.j41(3,"div",12),a.bIt("click",function(){P.eBV(e);const r=a.XpG();return P.Njj(r.openFilterGamesDatesDialog())}),a.nVh(4,de,1,0,"i",13),a.j41(5,"div",14),a.EFF(6),a.k0s()(),a.j41(7,"i",15),a.nI1(8,"translate"),a.bIt("click",function(){P.eBV(e);const r=a.XpG();return P.Njj(r.nextWeek(1))}),a.k0s()()}if(2&h){const e=a.XpG();a.R7$(),a.BMQ("aria-label",a.bMT(2,4,"global.common.previous_week")),a.R7$(3),a.vxM(e.globalVars.desktop?4:-1),a.R7$(2),a.JRh(e.descriptionWeek),a.R7$(),a.BMQ("aria-label",a.bMT(8,6,"global.common.next_week"))}}function ue(h,K){1&h&&a.nrm(0,"app-skeleton-table")}function ge(h,K){if(1&h&&(a.j41(0,"div",19),a.nrm(1,"app-games-results",20),a.k0s()),2&h){const e=a.XpG(3);a.R7$(),a.Y8G("games",e.selectedGames)("fromDate",e.selectedFromDate)("toDate",e.selectedToDate)("section",e.currentSection)}}function he(h,K){if(1&h&&a.nrm(0,"app-empty-space",18),2&h){const e=a.XpG(3);a.Y8G("noButton",!0)("isMedium",e.globalVars.responsive)("isLarge",e.globalVars.desktop)("textArray",e.textArray)}}function fe(h,K){if(1&h&&(a.j41(0,"div"),a.nVh(1,ge,2,4,"div",19),a.nVh(2,he,1,4,"app-empty-space",18),a.k0s()),2&h){const e=a.XpG(2);a.R7$(),a.vxM(e.selectedGames?1:-1),a.R7$(),a.vxM(e.selectedGames?-1:2)}}function ve(h,K){if(1&h&&a.nrm(0,"app-games-table",21),2&h){const e=a.XpG(3);a.Y8G("games",e.selectedGames)("fullScreenTable",!0)("section",e.currentSection)}}
1function De(h,K){if(1&h&&a.nrm(0,"app-empty-space",18),2&h){const e=a.XpG(3);a.Y8G("noButton",!0)("isMedium",e.globalVars.responsive)("isLarge",e.globalVars.desktop)("textArray",e.textArray)}}function Ce(h,K){if(1&h&&(a.j41(0,"div",16),a.nVh(1,ve,1,3,"app-games-table",21),a.nVh(2,De,1,4,"app-empty-space",18),a.k0s()),2&h){const e=a.XpG(2);a.R7$(),a.vxM((null==e.selectedGames?null:e.selectedGames.length)>0?1:-1),a.R7$(),a.vxM(0!==(null==e.selectedGames?null:e.selectedGames.length)&&e.selectedGames?-1:2)}}function Te(h,K){if(1&h){const e=a.RV6();a.j41(0,"app-clupik-floating-button",22),a.bIt("click",function(){P.eBV(e);const r=a.XpG(2);return P.Njj(r.openAddGameDialog())}),a.k0s()}2&h&&a.Y8G("button",a.lJ4(1,x))}function Me(h,K){if(1&h&&a.nrm(0,"app-empty-space",18),2&h){const e=a.XpG(2);a.Y8G("noButton",!0)("isMedium",e.globalVars.responsive)("isLarge",e.globalVars.desktop)("textArray",e.textArraySection)}}function Ee(h,K){if(1&h&&(a.qex(0),a.nVh(1,fe,3,2,"div"),a.nVh(2,Ce,3,2,"div",16),a.nVh(3,Te,1,2,"app-clupik-floating-button",17),a.nVh(4,Me,1,4,"app-empty-space",18),a.bVm()),2&h){const e=a.XpG();a.R7$(),a.vxM(!e.showTable&&e.hasSectionCompetition?1:-1),a.R7$(),a.vxM(e.showTable?2:-1),a.R7$(),a.vxM(e.isAdmin||e.isCoach?3:-1),a.R7$(),a.vxM(e.hasSectionCompetition?-1:4)}}let Oe=(()=>{class h{globalVars;appService;userService;authService;apiAuthService;route;clubsService;apiTeamsService;gamesService;apiSeasonsService;dialog;router;location;addDialog;teamService;sectionsService;translationService;activatedRoute;apiSectionsService;apiCompetitionService;apiSubscriptionService;breadCrumbs;platformId;apiOrganizationService;_modalService;textArray=["global.search.nothing_found","module.games.no_matches_in_date"];textArraySection=["global.search.nothing_found","global.competition.no_games_section"];userName;user;isAdmin;isCoach;isPlayer;hasDateRange;currentSeason;sections;currentSection;seasons;organizers;currentOrganizer;competitions;currentCompetition;phaseGroups=[];currentPhaseGroups;isMyGames;teamId;teamPage;dateRange;showTitle;clubId;layout;games=[];gamesLoading;selectedGames;selectTeamsLoaded;selectTeams;selectedTeamId;selectedFromDate;selectedToDate;currentDayNumber;currentWeekNumber;currentMonthNumber;descriptionDateRange;descriptionDateRangeMobile;descriptionFilterDateRange;descriptionWeek;descriptionWeekMobile;descriptionFilter;title;showComboTeam=!0;hasDateUrl=!1;showTable=!1;firstLoad;hasSectionCompetition=!0;subscription=new W.yU;moment;filtersState=(0,P.WQX)(U.j);currentDate;isFed=!1;inAdmin=!1;currentMessage="";messageType="";isMessage=!1;isDismissable=!0;gamesToShow;currentCategory;currentGroupId;noGames;constructor(e,o,r,u,d,C,X,q,G,j,be,ye,Pe,Se,Ge,Re,Ie,xe,Ae,Ue,Le,Be,Fe,We,ke){this.globalVars=e,this.appService=o,this.userService=r,this.authService=u,this.apiAuthService=d,this.route=C,this.clubsService=X,this.apiTeamsService=q,this.gamesService=G,this.apiSeasonsService=j,this.dialog=be,this.router=ye,this.location=Pe,this.addDialog=Se,this.teamService=Ge,this.sectionsService=Re,this.translationService=Ie,this.activatedRoute=xe,this.apiSectionsService=Ae,this.apiCompetitionService=Ue,this.apiSubscriptionService=Le,this.breadCrumbs=Be,this.platformId=Fe,this.apiOrganizationService=We,this._modalService=ke,this.moment=this.globalVars.getMoment(),this.subscription.add(this.teamService.subscribe("success-alert",A=>{this.showAlert("success",A.message,!0)})),this.subscription.add(this.teamService.subscribe("error-alert",A=>{this.showAlert("danger",A.message,!0)})),this.subscription.add(this.route.data.subscribe(A=>{this.showTable=A.table||!1,this.inAdmin=A.admin||!1})),this.isFed=this.clubsService.isClubFederation()||this.clubsService.isClubOrganization(),(0,F.br)(this.filtersState.filters).pipe((0,y.p)(()=>this.filtersState.seasonReady()),(0,s.F)((A,me)=>A.seasonId===me.seasonId&&A.sectionId===me.sectionId&&A.teamId===me.teamId&&A.organizerId===me.organizerId&&A.competitionId===me.competitionId&&A.phaseGroupId===me.phaseGroupId),(0,F.pQ)()).subscribe(A=>this.applyFilters(A)),"section-team"===this.filtersState.clubMode()&&this.loadSections(),this.subscription.add(this.teamService.subscribe("setDateRange",A=>{this.selectedFromDate=A.from,this.selectedToDate=A.to})),this.subscription.add(this.teamService.subscribe("gamesLoaded",A=>{this.gamesLoading=A})),this.subscription.add(this.appService.subscribe("openMassiveEditor",()=>{this.massiveEditor()}))}ngOnDestroy(){this.subscription.unsubscribe(),localStorage.removeItem("gamesFilters")}ngOnChanges(e){e.teamId&&!e.teamId.isFirstChange()&&(this.teamId=e.teamId.currentValue,this.teamPage=e.teamPage?e.teamPage.currentValue:this.teamPage,this.dateRange=e.dateRange?e.dateRange.currentValue:this.dateRange),this.teamService.broadcast("getExternalData",{isMyGames:this.isMyGames,teamId:this.teamId,teamPage:this.teamPage})}showAlert(e,o,r){this.appService.broadcast("showAlert",{state:e,mainTitle:o,autoHide:!0})}ngOnInit(){var e=this;return(0,T.A)(function*(){e.route.snapshot.queryParams.show&&(e.gamesToShow=e.route.snapshot.queryParams.show),e.clubId=e.clubsService.getClubId(),e.isAdmin=e.authService.isClubAdministrator(e.clubId),e.
1isCoach=e.authService.isCoach()})()}applyFilters(e){this.currentSeason={id:e.seasonId},this.currentSection=e.sectionId?{id:e.sectionId}:{id:"-1"},this.selectedTeamId=e.teamId??this.teamId??null,this.teamId=this.selectedTeamId,this.currentOrganizer=e.organizerId??"-1",this.currentCompetition=e.competitionId??"-1",this.currentPhaseGroups=e.phaseGroupId??"-1",this.selectedFromDate=e.from,this.selectedToDate=e.to,this.currentDate=e.from,this.selectTeamsLoaded=!0,this.gamesLoading=!0,"competition"===this.filtersState.clubMode()?this.loadCompetitionGames(this.selectedFromDate,this.selectedToDate,this.currentOrganizer,this.currentCompetition,this.currentPhaseGroups):this.loadGames(this.clubId,this.selectedTeamId,this.selectedFromDate,this.selectedToDate)}loadSections(){var e=this;return(0,T.A)(function*(){let o=yield(0,_._)(e.apiSectionsService.getAllSections());e.inAdmin||(o=o.filter(r=>r.visibility)),e.sections=o.filter(r=>r.hasCompetition)})()}ngAfterViewInit(){this.teamPage||(this.title=this.appService.getIsAdmin()?"global.title.games":this.isMyGames?"global.title.my_games":"global.title.games",this.globalVars.navbarTop.title=this.title)}SetdateRange(){var e=this;return(0,T.A)(function*(o=!1){if(e.activatedRoute.snapshot.queryParams.hasOwnProperty("onlyDay")&&(e.dateRange="day"),!e.route.snapshot.queryParams.onlyDay&&(!e.dateRange||"week"===e.dateRange)&&(e.currentDate=o?e.moment(e.selectedFromDate).startOf("week").startOf("day"):e.moment().startOf("week").startOf("day"),yield e.prevNextWeek(e.currentDate)),"day"===e.dateRange||e.route.snapshot.queryParams.onlyDay){let r=o?e.moment(e.selectedToDate):e.moment();e.currentDate=o?e.moment(e.selectedFromDate).startOf("day"):e.moment().startOf("day"),yield e.prevNextDay(e.currentDate,r)}}).apply(this,arguments)}openFilterGamesDatesDialog(){var e=this;return(0,T.A)(function*(){e.dialog.open(f.s,{data:{selectedFromDate:e.selectedFromDate,selectedToDate:e.selectedToDate}}).afterClosed().subscribe(function(){var r=(0,T.A)(function*(u){u&&(e.selectedFromDate=u.selectedFromDate,e.selectedToDate=u.selectedToDate,e.loadGames(e.clubId,e.selectedTeamId,u.selectedFromDate,u.selectedToDate),e.hasDateRange=!0,e.teamService.broadcast("setDates",{from:e.selectedFromDate,to:e.selectedToDate}))});return function(u){return r.apply(this,arguments)}}())})()}changeDay(e){var o=this;return(0,T.A)(function*(r,u=r){o.currentDate=r;const d=o.moment(o.currentDate),C=o.moment(u).endOf("day");o.selectedFromDate=d,o.selectedToDate=C.toISOString(),o.teamService.broadcast("setDates",{from:o.selectedFromDate,to:o.selectedToDate})}).apply(this,arguments)}prevNextDay(e){var o=this;return(0,T.A)(function*(r,u=r){o.currentDate=r;const d=o.moment(o.currentDate),C=o.moment(u).endOf("day");o.selectedFromDate=d.toISOString(),o.selectedToDate=C.toISOString(),o.teamService.broadcast("setDates",{from:o.selectedFromDate,to:o.selectedToDate}),o.loadGames(o.clubId,o.selectedTeamId,o.selectedFromDate,o.selectedToDate)}).apply(this,arguments)}nextWeek(e){var o=this;return(0,T.A)(function*(){const r=o.moment(o.selectedToDate).diff(o.moment(o.selectedFromDate),"days")+1;o.currentDate=o.moment(o.selectedFromDate).add(e*r,"days"),yield o.prevNextInterval(o.currentDate,r)})()}prevNextInterval(e,o){var r=this;return(0,T.A)(function*(){const u=r.moment(e).startOf("day"),d=r.moment(e).add(o-1,"days").endOf("day");r.selectedFromDate=u.toISOString(),r.selectedToDate=d.toISOString(),r.teamService.broadcast("setDates",{from:r.selectedFromDate,to:r.selectedToDate}),r.loadGames(r.clubId,r.selectedTeamId,r.selectedFromDate,r.selectedToDate)})()}prevNextWeek(e){var o=this;return(0,T.A)(function*(){const r=o.moment(e).startOf("day"),u=o.moment(e).endOf("week").endOf("day");o.selectedFromDate=r.toISOString(),o.selectedToDate=u.toISOString(),o.teamService.broadcast("setDates",{from:o.selectedFromDate,to:o.selectedToDate}),o.loadGames(o.clubId,o.selectedTeamId,o.selectedFromDate,o.selectedToDate)})()}changeWeek(e){var o=this;return(0,T.A)(function*(){o.currentDate=e;const r=o.moment(e).startOf("day"),u=o.moment(e).endOf("week").endOf("day");o.selectedFromDate=r.toISOString(),o.selectedToDate=u.toISOString(),o.teamService.broadcast("setDates",{from:o.selectedFromDate,to:o.selectedToDate})})()}changeMonth(e){var o=this;return(0,T.A)(function*(){o.currentDate=e;const r=o.moment(o.currentDate).startOf("month"),u=o.moment(o.currentDate).endOf("month").endOf("day");o.selectedFromDate=r.toISOString(),o.selectedToDate=u.toISOString(),o.teamService.broadcast("setDates",{from:o.selectedFromDate,to:o.selectedToDate})})()}nextMonth(e){var o=this;return(0,T.A)(function*(){o.currentDate=o.moment(o.currentDate).add(e,"months").startOf("month").startOf("day"),yield o.prevNextMonth(o.currentDate)})()}prevNextMonth(e){var o=this;return(0,T.A)(function*(){const r=o.moment(e).startOf("day"),u=o.moment(e).endOf("month").endOf("day");o.selectedFromDate=r.toISOString(),o.selectedToDate=u.toISOString(),o.teamService.broadcast("setDates",{from:o.selectedFromDate,to:o.selectedToDate}),o.loadGames(o.clubId,o.selectedTeamId,o.selectedFromDate,o.selectedToDate)})()}clearFilters(){var e=this;return(0,T.A)(function*(){e.hasDateRange=!1,"day"===e.dateRange&&(e.currentDate=e.moment().startOf("day"),yield e.prevNextWeek(e.currentDate)),(!e.dateRange||"week"===e.dateRange)&&(e.currentDate=e.moment().startOf("week").startOf("day"),yield e.prevNextWeek(e.currentDate)),"month"===e.dateRange&&(e.currentDate=e.moment().startOf("month").startOf("day"),yield e.prevNextMonth(e.currentDate))})()}loadGames(e=null,o=null,r=null,u=null){var d=this;if(this.gamesLoading=!0,"competition"===this.filtersState.clubMode())this.loadCompetitionGames(r,u,this.currentOrganizer,this.currentCompetition,this.currentPhaseGroups);else{let C=this.teamId?"-1"!==this.teamId?this.teamId:null:o;this.clubId||(this.clubId=this.clubsService.getClubId()),this.selectedGames=[],this.gamesService.getGamesByClub(e,C,r,u,this.firstLoad,null!=this.teamId?null:this.currentOrganizer,null!=this.teamId?null:this.currentCompetition,null!=this.teamId||-1==this.currentPhaseGroups?null:this.currentPhaseGroups,this.currentSection&&"-1"!==this.currentSection?.id?this.currentSection.id:null,e||this.clubId,!!this.teamId).subscribe(function(){var X=(0,T.A)(function*(q){if(null!=d.organizers&&d.organizers.length<=0&&(q.games=[]),d.setDescriptionText(q.from,q.to),d.games=q.games,d.sections?.length>0&&(d.games=d.games.filter(G=>d.sections.some(j=>null!=G.localTeam.teamClub&&j.id===G.localTeam.teamClub.sectionId||null!=G.visitorTeam.teamClub&&j.id===G.visitorTeam.teamClub.sectionId)).map(G=>(G.sectionName=d.sections.find(j=>null!=G.localTeam.teamClub&&j.id===G.localTeam.teamClub.sectionId||null!=G.visitorTeam.teamClub&&j.id===G.visitorTeam.teamClub.sectionId).name,G))),d.games.length>0&&d.firstLoad&&(d.firstLoad=!1,d.dateRange&&"week"!==d.dateRange?"day"===d.dateRange&&(d.currentDate=d.moment(d.games[0].date).startOf("day"),yield d.changeDay(d.currentDate,d.currentDate)):(d.currentDate=d.moment(d.games[0].date).startOf("week").startOf("day"),yield d.changeWeek(d.currentDate))),d.isMyGames){let G=[];G=null!=d.user?d.user.id===d.authService.getId()?yield(0,_._)(d.apiAuthService.getAssociatedTeamIds()):yield(0,_._)(d.apiAuthService.getAssociatedTeamIds(d.user.id)):yield(0,_._)(d.apiAuthService.getAssociatedTeamIds()),d.selectedGames=d.getMyGames(G)}else d.selectedGames=d.games;d.gamesLoading=!1,d.updateUrl()});return function(q){return X.apply(this,arguments)}}())}}loadCompetitionGames(e=this.selectedFromDate,o=this.selectedToDate,r=this.currentCompetition,u=this.currentCategory,d=this.currentGroupId){var C=this;let X={idType:"",value:""};var q;
1"-1"!==r&&null!=r&&(X.idType="organizer",X.value=r),"-1"!==u&&null!=u&&(X.idType="competition",X.value=u),"-1"!==d&&null!=d&&(X.idType="group",X.value=d),X.idType||(X=void 0),this.gamesService.getOrgGames(e,o,X).subscribe({next:(q=(0,T.A)(function*(G){if(C.setDescriptionText(G.from,G.to),C.games=G.games,C.games.length>0&&C.firstLoad&&(C.firstLoad=!1,(!C.dateRange||"week"===C.dateRange)&&(C.currentDate=C.moment(C.games[0].date).startOf("week").startOf("day"),yield C.changeWeek(C.currentDate))),C.isMyGames){C.title="global.title.my_games";let j=[];j=null!=C.user?C.user.id===C.authService.getId()?yield(0,_._)(C.apiAuthService.getAssociatedTeamIds()):yield(0,_._)(C.apiAuthService.getAssociatedTeamIds(C.user.id)):yield(0,_._)(C.apiAuthService.getAssociatedTeamIds()),C.selectedGames=C.getMyGames(j)}else C.title="global.title.games",C.selectedGames=C.games,setTimeout(()=>{C.globalVars.navbarTop.title=C.title});C.gamesLoading=!1,C.updateUrl()}),function(j){return q.apply(this,arguments)}),error:q=>console.error("Error gettting competition games:",q)})}setDescriptionText(e,o){var r=this;return(0,T.A)(function*(){const u={from:r.moment(e).format("DD"),fromMonth:r.moment(e).format("MMMM"),yearFrom:r.moment(e).format("YYYY"),to:r.moment(o).format("DD"),monthTo:r.moment(o).format("MMMM"),yearTo:r.moment(o).format("YYYY")};r.descriptionWeek=r.moment(e).isSame(r.moment(o),"day")?yield r.translationService.getTranslation("module.games.description_day",{day:u.from,month:u.fromMonth,year:u.yearFrom}):u.yearFrom===u.yearTo?yield r.translationService.getTranslation("module.games.description_week_with_year_new",{dayFrom:u.from,dayTo:u.to,month:u.monthTo,fromMonth:u.fromMonth,year:u.yearTo}):yield r.translationService.getTranslation("module.games.description_week_with_year_diff_year_new",{dayFrom:u.from,dayTo:u.to,month:u.monthTo,fromMonth:u.fromMonth,year:u.yearTo,yearFrom:u.yearFrom})})()}getMyGames(e){let o=[];return this.games.forEach(r=>{(e.includes(r.localTeamId)||e.includes(r.visitorTeamId))&&o.push(r)}),o}openAddGameDialog(){this.addDialog.open(H.S).afterClosed().subscribe(o=>{"object"==typeof o&&("competition"===this.filtersState.clubMode()?this.loadCompetitionGames(this.selectedFromDate,this.selectedToDate):this.loadGames(this.clubId,this.selectedTeamId,this.selectedFromDate,this.selectedToDate))})}updateUrl(){if(!this.teamPage){let e=this.router.url.split("?"),r={...this.route.snapshot.queryParams};["show","from","to"].forEach(u=>delete r[u]),this.gamesToShow&&(r={...r,show:this.gamesToShow.show}),this.selectedFromDate&&(r={...r,from:this.selectedFromDate}),this.selectedToDate&&(r={...r,to:this.selectedToDate}),this.router.navigate([e[0]],{queryParams:r})}}openFilter(){this.appService.broadcast("sidenav",{id:"sidenavgames",side:"start",component:oe.G,data:{fromSideNav:!0},hasHead:!0,hasClose:!0})}exportTable(){this.appService.broadcast("export_games_table")}massiveEditor(){var e=this;return(0,T.A)(function*(){(yield e._modalService.openModal({component:le.c,modalSize:"medium",data:{selectedGames:e.selectedGames,fromDate:e.selectedFromDate,toDate:e.selectedToDate}})).data&&("competition"===e.filtersState.clubMode()?e.loadCompetitionGames(e.selectedFromDate,e.selectedToDate):e.loadGames(e.clubId,e.selectedTeamId,e.selectedFromDate,e.selectedToDate))})()}static \u0275fac=function(o){return new(o||h)(a.rXU(t.Y),a.rXU(k.d),a.rXU(n.D),a.rXU(te.u),a.rXU($.g),a.rXU(m.nX),a.rXU(V.X),a.rXU(re.k),a.rXU(J.n),a.rXU(E.o),a.rXU(O.h),a.rXU(m.Ix),a.rXU(I.aZ),a.rXU(O.h),a.rXU(ee.n),a.rXU(b.c),a.rXU(z.T),a.rXU(m.nX),a.rXU(B.k),a.rXU(Y.Y),a.rXU(ae.P),a.rXU(c.E),a.rXU(a.Agw),a.rXU(Q.k),a.rXU(R.M))};static \u0275cmp=a.VBU({type:h,selectors:[["app-games-header"]],inputs:{isMyGames:"isMyGames",teamId:"teamId",teamPage:"teamPage",dateRange:"dateRange",showTitle:"showTitle"},standalone:!1,features:[a.OA$],decls:8,vars:16,consts:[[3,"features"],["id","games-header-component",3,"ngClass"],[1,"subsection-header"],[1,"responsive-btns"],[3,"fromSideNav","teamPage","teamId","isTable"],[1,"date-nav"],["type","icon","config","onlyicon","size","sm","icon","fa-regular fa-sliders-up",1,"link",3,"buttonAction","label"],[1,"fix"],["type","icon","config","onlyicon","size","sm",3,"tooltip","icon","isDisabled"],["type","icon","config","onlyicon","size","sm",3,"buttonAction","tooltip","icon"],["type","icon","config","onlyicon","size","sm",3,"buttonAction","tooltip","icon","isDisabled"],["role","button","tabindex","0",1,"fa-solid","fa-chevron-left",3,"click"],[1,"date-click",3,"click"],[1,"fa-regular","fa-calendar-day"],[1,"heading-text","h5","center"],["role","button","tabindex","0",1,"fa-solid","fa-chevron-right",3,"click"],[1,"section-results-table"],[3,"button"],["svgImage","empty_search",3,"noButton","isMedium","isLarge","textArray"],[1,"section-results"],[3,"games","fromDate","toDate","section"],[3,"games","fullScreenTable","section"],[3,"click","button"]],template:function(o,r){1&o&&(a.j41(0,"app-clupik-feature-lock",0)(1,"div",1)(2,"div",2),a.nVh(3,pe,5,4,"div",3),a.nrm(4,"app-games-filters",4),a.k0s(),a.nVh(5,_e,9,8,"div",5),a.nVh(6,ue,1,0,"app-skeleton-table"),a.nVh(7,Ee,5,4,"ng-container"),a.k0s()()),2&o&&(a.Y8G("features",a.lJ4(10,ie)),a.R7$(),a.Y8G("ngClass",a.ziG(11,ne,!r.teamPage,r.clubsService.isTopBar()&&!r.breadCrumbs.hasBreadcrumbs(),r.breadCrumbs.hasBreadcrumbs()&&r.clubsService.onlyBread(),r.breadCrumbs.hasBreadcrumbs()&&r.clubsService.isTopBar())),a.R7$(2),a.vxM(r.globalVars.responsive&&!r.teamPage?3:-1),a.R7$(),a.Y8G("fromSideNav",!1)("teamPage",r.teamPage)("teamId",r.teamId)("isTable",r.showTable),a.R7$(),a.vxM(r.hasSectionCompetition?5:-1),a.R7$(),a.vxM(r.gamesLoading?6:-1),a.R7$(),a.vxM(r.gamesLoading?-1:7))},dependencies:[N.YU,v.X,M.p,D.L,l.G,p.n,g.b,S.U,L.q,Z.D9],styles:[".week-navbar[_ngcontent-%COMP%]:not(.no-margin){margin-right:12px}.section-results-table[_ngcontent-%COMP%] .alert-warning[_ngcontent-%COMP%]{margin-right:12px}app-games-filters[_ngcontent-%COMP%]{margin-left:auto}@media (max-width: 991px){app-games-filters[_ngcontent-%COMP%]{display:none}}@media (max-width: 991px){.week-navbar[_ngcontent-%COMP%]{padding-left:0;padding-right:0}}.responsive-btns[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;width:100%}.responsive-btns[_ngcontent-%COMP%] .fix[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;
1gap:4px;flex-grow:1}.date-nav[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;margin-bottom:0;margin-left:0;margin-right:0;flex-grow:1;border-top:var(--border);border-bottom:var(--border);padding:10px 20px}@media (max-width: 991px){.date-nav[_ngcontent-%COMP%]{margin-top:12px}}.date-nav[_ngcontent-%COMP%] .heading-text[_ngcontent-%COMP%]{cursor:pointer}.date-nav[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{cursor:pointer;color:var(--link-color)}.date-click[_ngcontent-%COMP%]{min-width:300px;display:flex;align-items:center;justify-content:center;margin:0 var(--module)}@media (max-width: 991px){.date-click[_ngcontent-%COMP%]{margin-left:0;margin-right:0;flex-grow:1}}.date-click[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:var(--link-color);margin-right:12px;font-size:18px;line-height:33px}@media (max-width: 991px){.date-click[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{margin-right:6px}}.admin-dashboard[_ngcontent-%COMP%]{padding-bottom:0!important}"]})}return h})()},13102:(ce,w,i)=>{i.d(w,{c:()=>v});var T=i(10467),P=i(72200),a=i(89417),F=i(3356),f=i(69915),H=i(51589),ee=i(6961),z=i(52280),V=i(66220),te=i(62470),t=i(66124),b=i(6212),W=i(49189),y=i(25615),s=i(73664),_=i(2615),B=i(15449),$=i(82966),Y=i(19735),J=i(80954),Q=i(5900),E=i(89902),re=i(3801),ae=i(47649);const k=()=>({placeholder:"module.accounting.day",inputType:"date"}),oe=()=>({placeholder:"global.common.time",inputType:"time"}),U=()=>({placeholder:"module.competition.local",inputType:"number"}),le=()=>({placeholder:"module.competition.visitor",inputType:"number"}),n=(M,D)=>D.date,m=(M,D)=>D.id;function O(M,D){1&M&&(s.j41(0,"div",2),s.nrm(1,"app-skeleton-block"),s.k0s())}function I(M,D){if(1&M&&(s.j41(0,"div",17),s.EFF(1),s.k0s(),s.j41(2,"form",18)(3,"div",19)(4,"div",20)(5,"div",21)(6,"div",22),s.nrm(7,"app-clupik-avatar",23),s.j41(8,"div",24),s.EFF(9),s.k0s()(),s.j41(10,"div",25),s.nrm(11,"app-input",26),s.k0s()(),s.j41(12,"div",27)(13,"div",22),s.nrm(14,"app-clupik-avatar",23),s.j41(15,"div",24),s.EFF(16),s.k0s()(),s.j41(17,"div",25),s.nrm(18,"app-input",28),s.k0s()()()()()),2&M){const l=s.XpG().$implicit,p=s.XpG(3);s.R7$(),s.JRh(p.getGameSubInfo(l)),s.R7$(),s.Y8G("formGroup",p.getForm(l.id)),s.R7$(5),s.Y8G("image",l.localTeam.shieldUrl)("width",16),s.R7$(2),s.JRh(p.getTeamName(l.localTeam)),s.R7$(2),s.Y8G("input",s.lJ4(10,U)),s.R7$(3),s.Y8G("image",l.visitorTeam.shieldUrl)("width",16),s.R7$(2),s.JRh(p.getTeamName(l.visitorTeam)),s.R7$(2),s.Y8G("input",s.lJ4(11,le))}}function N(M,D){if(1&M&&(s.j41(0,"app-list-item",16),s.DNE(1,I,19,12,"ng-template",null,0,s.C5r),s.k0s()),2&M){const l=D.$implicit,p=s.XpG(3);s.Y8G("whiteBkg",!0)("hasBorder",!0)("infoStyle",!1)("hasHover",!1)("mainTitle",p.getGameInfo(l))("subtitle",p.getGameSubInfo(l))}}function c(M,D){if(1&M&&(s.nrm(0,"app-navbar-resume",14),s.j41(1,"div",15),s.Z7z(2,N,3,6,"app-list-item",16,m),s.k0s()),2&M){const l=D.$implicit,p=s.XpG(2);s.Y8G("descriptionNumber",l.games.length)("titleClass","h6")("mainTitle",p.globalVars.getMoment()(l.date).format("LL")),s.R7$(2),s.Dyx(l.games)}}function R(M,D){if(1&M){const l=s.RV6();s.j41(0,"ion-accordion-group")(1,"ion-accordion",3)(2,"app-list-item",4),s.bIt("click",function(){_.eBV(l);const g=s.XpG();return _.Njj(g.isOpen=!g.isOpen)}),s.k0s(),s.j41(3,"div",5)(4,"form",6),s.nrm(5,"app-form-section",7),s.j41(6,"app-form-row",8),s.nrm(7,"app-input",9)(8,"app-input",10),s.k0s(),s.nrm(9,"app-form-section",7),s.j41(10,"app-form-row",8),s.nrm(11,"app-input",11)(12,"app-input",12),s.k0s()()()()(),s.j41(13,"div",13),s.Z7z(14,c,4,3,null,null,n),s.k0s()}if(2&M){const l=s.XpG();s.R7$(2),s.Y8G("isCollapsed",!0)("hasBorder",!0)("subtitle",l.selectedDatesSubtitle)("iconRight",l.isOpen?"fa-light fa-chevron-up":"fa-light fa-chevron-down")("hasEllipsis",!0),s.R7$(2),s.Y8G("formGroup",l.datesForm),s.R7$(),s.Y8G("mainTitle","global.common.from")("titleClass","h6")("description","module.games.from_games_desc")("descriptionClass","sm"),s.R7$(),s.Y8G("items",2)("separation",12),s.R7$(),s.Y8G("minDate",l.minDate)("maxDate",l.toDate)("input",s.lJ4(28,k)),s.R7$(),s.Y8G("maxDate",2100)("input",s.lJ4(29,oe)),s.R7$(),s.Y8G("mainTitle","global.common.to")("titleClass","h6")("description","module.games.to_games_desc")("descriptionClass","sm"),s.R7$(),s.Y8G("items",2)("separation",12),s.R7$(),s.Y8G("minDate",l.minDate)("maxDate",l.toDate)("input",s.lJ4(30,k)),s.R7$(),s.Y8G("maxDate",2100)("input",s.lJ4(31,oe)),s.R7$(2),s.Dyx(l.filteredGames)}}let v=(()=>{class M{globalVars;_appService;_apiGames;_teamService;_translate;selectedGames=[];fromDate="";toDate="";loading=!0;forms=new Map;groupedGames=[];filteredGames=[];_moment=null;datesForm=null;minDate=null;isOpen=!1;literals={hasta:"To",desde:"From"};constructor(l,p,g,S,L){this.globalVars=l,this._appService=p,this._apiGames=g,this._teamService=S,this._translate=L,this._moment=this.globalVars.getMoment(),this.getTranslations()}getTranslations(){var l=this;return(0,T.A)(function*(){l.literals.hasta=yield l._translate.getTranslation("global.common.to"),l.literals.desde=yield l._translate.getTranslation("global.common.from")})()}get selectedDatesSubtitle(){const l=this.datesForm?.get("from")?.value,p=this.datesForm?.get("fromHour")?.value,g=this.datesForm?.get("to")?.value,S=this.datesForm?.get("toHour")?.value;if(!(l||g||p||S)){const x=this.fromDate?this._moment(this.fromDate).format("DD/MM/YYYY"):"",se=this.toDate?this._moment(this.toDate).format("DD/MM/YYYY"):"";return`${this.literals?.desde} ${x} ${this.literals?.hasta} ${se}`}const L=l||p,Z=g||S;if(L&&!Z){let x=`${this.literals?.desde} `;return l&&(x+=this._moment(l).format("DD/MM/YYYY")),p&&(x+=(l?" ":"")+p),x}if(!L&&Z){let x=`${this.literals?.hasta} `;return g&&(x+=this._moment(g).format("DD/MM/YYYY")),S&&(x+=(g?" ":"")+S),x}let ie="";l&&(ie=this._moment(l).format("DD/MM/YYYY")),p&&(ie+=(l?" ":"")+p);let ne="";return g&&(ne=this._moment(g).format("DD/MM/YYYY")),S&&(ne+=(g?" ":"")+S),`${this.literals?.desde} ${ie} ${this.literals?.hasta} ${ne}`}ngAfterViewInit(){this.minDate=this._moment(this.fromDate).add(2,"hour").toISOString(),this.datesForm=new a.gE({from:new a.MJ(this.fromDate),fromHour:new a.MJ(null),to:new a.MJ(this.toDate),toHour:new a.MJ(null)}),this.setForms(),this.datesForm.valueChanges.subscribe(l=>{console.log("Fechas filtrado cambiadas:",l),this.updateFilteredGames()}),this.updateFilteredGames()}setForms(){const l=new Map,p=new Set;for(const g of this.selectedGames){const S=g.date||g.startDate,L=new Date(S).toISOString().split("T")[0];l.has(L)||l.set(L,[]),l.get(L).push(g),this.forms.set(g.id,new a.gE({id:new a.MJ(g.id),status:new a.MJ("finished"),localScore:new a.MJ(g.localScore),visitorScore:new a.MJ(g.visitorScore)})),p.add(this._moment(S).format("HH:mm"))}this.groupedGames=Array.from(l.entries()).map(([g,S])=>({date:g,games:S.sort((L,Z)=>new Date(L.date||L.startDate).getTime()-new Date(Z.date||Z.startDate).getTime())})).sort((g,S)=>new Date(g.date).getTime()-new Date(S.date).getTime()),this.loading=!1}getGameInfo(l){return[this._moment(l.date).format("HH:mm"),l.organization?.name,l.competition?.name].filter(
1Boolean).join(" - ")}getGameSubInfo(l){return[l.group?.phase?.title,l.group?.title].filter(Boolean).join(" - ")}getTeamName(l){return this._teamService.getCustomTeamName(l)}getForm(l){return this.forms.get(l)}updateFilteredGames(){this.filteredGames=this.getFilteredGames(),console.log("Juegos filtrados:",this.filteredGames)}getFilteredGames(){const l=this.datesForm?.get("from")?.value,p=this.datesForm?.get("fromHour")?.value,g=this.datesForm?.get("to")?.value,S=this.datesForm?.get("toHour")?.value;if(!l&&!g)return this.groupedGames;const L=l?this._moment(l).startOf("day").valueOf():-1/0,Z=g?this._moment(g).endOf("day").valueOf():1/0;let ie=0,ne=1439;if(p){const[x,se]=p.split(":");ie=60*parseInt(x)+parseInt(se)}if(S){const[x,se]=S.split(":");ne=60*parseInt(x)+parseInt(se)}return this.groupedGames.map(x=>({...x,games:x.games.filter(se=>{const de=this._moment(se.date||se.startDate),_e=de.valueOf();if(_e<L||_e>Z)return!1;const ue=60*de.hours()+de.minutes();return ue>=ie&&ue<=ne})})).filter(x=>x.games.length>0)}cancel(){this.globalVars.closeModal()}save(){this.loading=!0;const l=Array.from(this.forms.values()).filter(p=>p.dirty).map(p=>({...p.value,localScore:Number(p.value.localScore),visitorScore:Number(p.value.visitorScore)}));0!==l.length?this._apiGames.setManyGamesScores(l).subscribe({next:p=>{this._appService.broadcast("showAlert",{state:"success",mainTitle:"Partidos editados",autoHide:!0}),this.globalVars.closeModal({data:!0})},error:p=>{console.error("Error al guardar los resultados",p),this.loading=!1,this._appService.broadcast("showAlert",{state:"danger",mainTitle:"Error editando resultados",autoHide:!1})}}):this.globalVars.closeModal({data:!1})}static \u0275fac=function(p){return new(p||M)(s.rXU(y.Y),s.rXU(f.d),s.rXU(F.n),s.rXU(H.n),s.rXU(ee.T))};static \u0275cmp=s.VBU({type:M,selectors:[["app-set-many-games-score"]],inputs:{selectedGames:"selectedGames",fromDate:"fromDate",toDate:"toDate"},decls:3,vars:7,consts:[["descriptionOutlet",""],["mainButtonValue","global.button.save","secondaryButtonValue","global.button.cancel",3,"mainAction","secondaryAction","modalTitle","hasButtons","mainButtonDisabled","hasSecondaryButton","secondaryButtonDisabled","showDivider"],[1,"loading-block"],[1,"clean"],["slot","header","mainTitle","global.common.filters","iconLeft","fa-regular fa-sliders",3,"click","isCollapsed","hasBorder","subtitle","iconRight","hasEllipsis"],["slot","content",1,"accordion-content"],[3,"formGroup"],[3,"mainTitle","titleClass","description","descriptionClass"],[3,"items","separation"],["inputSize","sm","type","normal","formControlName","from",3,"minDate","maxDate","input"],["inputSize","sm","type","normal","formControlName","fromHour",3,"maxDate","input"],["inputSize","sm","type","normal","formControlName","to",3,"minDate","maxDate","input"],["inputSize","sm","type","normal","formControlName","toHour",3,"maxDate","input"],[1,"days"],["description","global.common.games",3,"descriptionNumber","titleClass","mainTitle"],[1,"games"],["mainTitleClass","h6",3,"whiteBkg","hasBorder","infoStyle","hasHover","mainTitle","subtitle"],[1,"text","sm","gray"],[1,"list-game",3,"formGroup"],[1,"list"],[1,"teams"],[1,"local"],[1,"team"],[3,"image","width"],[1,"text","md"],[1,"score"],["inputSize","sm","type","normal","formControlName","localScore",3,"input"],[1,"visitor"],["inputSize","sm","type","normal","formControlName","visitorScore",3,"input"]],template:function(p,g){1&p&&(s.j41(0,"app-clupik-modal",1),s.bIt("mainAction",function(){return g.save()})("secondaryAction",function(){return g.cancel()}),s.nVh(1,O,2,0,"div",2)(2,R,16,32),s.k0s()),2&p&&(s.Y8G("modalTitle","module.games.assign_scores")("hasButtons",!g.loading)("mainButtonDisabled",g.loading)("hasSecondaryButton",!g.loading)("secondaryButtonDisabled",g.loading)("showDivider",!0),s.R7$(),s.vxM(g.loading?1:2))},dependencies:[t.M,B.P,P.MD,W.G,a.qT,a.BC,a.cb,a.j4,a.JD,$.K,te.k,Y.$,z.s,J.Y,Q.t,E.S,V._,re.t,b.m,ae.P],styles:[".list-game[_ngcontent-%COMP%]{display:flex;align-items:center;margin-top:6px}.list-game[_ngcontent-%COMP%] .list[_ngcontent-%COMP%]{display:flex;min-height:44px;align-items:center;gap:12px;flex:1 0 0}.list-game[_ngcontent-%COMP%] .list[_ngcontent-%COMP%] .teams[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:var(--sizes-module-14, 6px);flex:1 0 0}.list-game[_ngcontent-%COMP%] .list[_ngcontent-%COMP%] .teams[_ngcontent-%COMP%] .visitor[_ng
1content-%COMP%], .list-game[_ngcontent-%COMP%] .list[_ngcontent-%COMP%] .teams[_ngcontent-%COMP%] .local[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;width:100%}.list-game[_ngcontent-%COMP%] .list[_ngcontent-%COMP%] .teams[_ngcontent-%COMP%] .visitor[_ngcontent-%COMP%] .team[_ngcontent-%COMP%], .list-game[_ngcontent-%COMP%] .list[_ngcontent-%COMP%] .teams[_ngcontent-%COMP%] .local[_ngcontent-%COMP%] .team[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--sizes-module-14, 6px);flex:1 0 0}.list-game[_ngcontent-%COMP%] .list[_ngcontent-%COMP%] .teams[_ngcontent-%COMP%] .visitor[_ngcontent-%COMP%] .score[_ngcontent-%COMP%], .list-game[_ngcontent-%COMP%] .list[_ngcontent-%COMP%] .teams[_ngcontent-%COMP%] .local[_ngcontent-%COMP%] .score[_ngcontent-%COMP%]{width:100px}.list-game[_ngcontent-%COMP%] .list[_ngcontent-%COMP%] .teams[_ngcontent-%COMP%] .visitor[_ngcontent-%COMP%] .score[_ngcontent-%COMP%] app-input[_ngcontent-%COMP%], .list-game[_ngcontent-%COMP%] .list[_ngcontent-%COMP%] .teams[_ngcontent-%COMP%] .local[_ngcontent-%COMP%] .score[_ngcontent-%COMP%] app-input[_ngcontent-%COMP%]{display:block;width:100%}.games[_ngcontent-%COMP%], .days[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--sizes-module-12, 12px)}.accordion-content[_ngcontent-%COMP%]{padding:0 16px}"]})}return M})()},38139:(ce,w,i)=>{i.d(w,{B:()=>N});var T=i(10467),P=i(68010),a=i(13961),F=i(69915),f=i(51589),H=i(60152),ee=i(94883),z=i(26742),V=i(25615),te=i(35292),t=i(73664),b=i(36229),W=i(94474),y=i(72200),s=i(38132),_=i(53986),B=i(68018);const $=c=>({bold:c});function Y(c,R){1&c&&(t.j41(0,"div",22),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&c&&(t.R7$(),t.JRh(t.bMT(2,1,"module.games.absent")))}function J(c,R){if(1&c&&(t.j41(0,"span",23),t.EFF(1),t.k0s()),2&c){const v=t.XpG(2);t.R7$(),t.JRh(null!=v.game.localScore?v.game.localScore:"")}}function Q(c,R){if(1&c&&(t.j41(0,"div",10),t.nVh(1,Y,3,3,"div",22),t.nVh(2,J,2,1,"span",23),t.k0s()),2&c){const v=t.XpG();t.R7$(),t.vxM(v.game.localNotShowed?1:-1),t.R7$(),t.vxM(v.game.localNotShowed?-1:2)}}function E(c,R){1&c&&(t.j41(0,"div",22),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&c&&(t.R7$(),t.JRh(t.bMT(2,1,"module.games.absent")))}function re(c,R){if(1&c&&(t.j41(0,"span",23),t.EFF(1),t.k0s()),2&c){const v=t.XpG(2);t.R7$(),t.JRh(null!=v.game.visitorScore?v.game.visitorScore:"")}}function ae(c,R){if(1&c&&(t.j41(0,"div",10),t.nVh(1,E,3,3,"div",22),t.nVh(2,re,2,1,"span",23),t.k0s()),2&c){const v=t.XpG();t.R7$(),t.vxM(v.game.visitorNotShowed?1:-1),t.R7$(),t.vxM(v.game.visitorNotShowed?-1:2)}}function k(c,R){if(1&c&&(t.j41(0,"span",23),t.EFF(1),t.k0s()),2&c){const v=t.XpG(3);t.R7$(),t.JRh(v.gameHour)}}function oe(c,R){if(1&c&&(t.qex(0),t.nVh(1,k,2,1,"span",23),t.bVm()),2&c){const v=t.XpG(2);
1t.R7$(),t.vxM("playing"!=v.game.status?1:-1)}}function U(c,R){1&c&&(t.j41(0,"div",24),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&c&&(t.R7$(),t.JRh(t.bMT(2,1,"module.competition.games.state.deferred")))}function le(c,R){if(1&c&&(t.j41(0,"div",12),t.nVh(1,oe,2,1,"ng-container"),t.nVh(2,U,3,3,"div",24),t.k0s()),2&c){const v=t.XpG();t.R7$(),t.vxM("deferred"!=v.game.status?1:-1),t.R7$(),t.vxM("deferred"===v.game.status?2:-1)}}function n(c,R){if(1&c&&(t.j41(0,"div",14),t.EFF(1),t.k0s()),2&c){const v=t.XpG();t.R7$(),t.JRh(v.game.stadium.name)}}function m(c,R){if(1&c&&(t.j41(0,"div",18),t.EFF(1),t.k0s()),2&c){const v=t.XpG();t.R7$(),t.JRh(v.game.sectionName)}}function O(c,R){if(1&c&&(t.j41(0,"div",20)(1,"div",15),t.EFF(2),t.k0s(),t.j41(3,"div",16),t.EFF(4),t.k0s()()),2&c){const v=t.XpG();t.R7$(2),t.JRh(v.game.competition.name),t.R7$(2),t.JRh(v.gameRoundCategory)}}function I(c,R){if(1&c&&(t.j41(0,"div",21)(1,"button",25),t.nrm(2,"i",26),t.k0s()()),2&c){const v=t.XpG();t.Y8G("routerLink",v.gameLink)}}let N=(()=>{class c{dialog;authService;appService;gameService;globalVars;clubsService;imagesService;modalService;teamService;game;section;isLogged;formatDate;gameLoaded;isLocalTeamClub;isVisitorTeamClub;localTeamName;visitorTeamName;clubId;localTeamLogo;visitorTeamLogo;gameLink;gameHour;gameRoundCategory;moment;subscription=new a.yU;constructor(v,M,D,l,p,g,S,L,Z){this.dialog=v,this.authService=M,this.appService=D,this.gameService=l,this.globalVars=p,this.clubsService=g,this.imagesService=S,this.modalService=L,this.teamService=Z,this.moment=this.globalVars.getMoment(),this.subscription.add(this.appService.subscribe("editGame",ie=>{this.game.id==ie.gameId&&(this.game=this.gameService.getGame(),this.ngOnInit())}))}ngOnDestroy(){this.subscription.unsubscribe()}isOrganization(){return this.clubsService.isClubOrganization()}isFederation(){return"FED"===this.clubsService.getClubData().type}ngOnInit(){this.isLogged=this.authService.isLoggedIn(),"0:00"==this.moment(this.game.date).format("LT")?this.formatDate=this.moment(this.game.date).format("LL"):(this.formatDate=this.moment(this.game.date).format("LLLL"),this.gameHour=this.moment(this.game.date).format("LT")),this.clubId=this.clubsService.getClubId(),this.isLocalTeamClub=this.clubId===this.game.localTeam.club.id,this.isVisitorTeamClub=this.clubId===this.game.visitorTeam.club.id,this.localTeamLogo=this.imagesService.getClubLogoThumbnailUrl(this.game.localTeam.club.id),this.visitorTeamLogo=this.imagesService.getClubLogoThumbnailUrl(this.game.visitorTeam.club.id),this.localTeamName=this.teamService.getCustomTeamName(this.game.localTeam),this.visitorTeamName=this.teamService.getCustomTeamName(this.game.visitorTeam),this.gameLink="/games/"+this.game.id,this.gameRoundCategory="",this.appService.broadcast("gameLoaded",{})}onPublish(){var v=this;return(0,T.A)(function*(){yield v.modalService.openModal({component:te.Z,modalSize:"lg",options:{backdropDismiss:!1,id:"publish"}})})()}static \u0275fac=function(M){return new(M||c)(t.rXU(b.h),t.rXU(P.u),t.rXU(F.d),t.rXU(ee.w),t.rXU(V.Y),t.rXU(H.X),t.rXU(z.M),t.rXU(W.M),t.rXU(f.n))};static \u0275cmp=t.VBU({type:c,selectors:[["app-games-card-game"]],inputs:{game:"game",section:"section"},standalone:!1,decls:32,vars:22,consts:[[1,"games-game-component","game-box"],[1,"game-content",3,"routerLink"],[1,"game-info"],["fxFlex","100%","fxFlex.gt-sm","50%","fxAlign","center",1,"game-teams"],[1,"teams"],[1,"game-local"],[1,"game-shield"],["appLazyLoadImage","","type","club",3,"src"],[1,"game-name"],[1,"clupik-text-body-normal",3,"ngClass"],[1,"game-score"],[1,"game-visitor"],[1,"hours"],["fxHide","","fxShow.gt-sm","","fxFlex","50%","fxLayout","column","fxAlign","center",1,"game-status",3,"routerLink"],[1,"stadium"],[1,"competition"],[1,"category"],[1,"organization"],[1,"section"],["fxHide","","fxShow.lt-md","",1,"category-mobile"],[1,"info"],[1,"game-actions",3,"routerLink"],[1,"not-showed"],[1,"clupik-title-h3"],[1,"game-status-chip"],["fxFlex","30px",1,"no-bg-btn"],["aria-hidden","true",1,"fa","fa-chevron-right"]],template:function(M,D){1&M&&(t.j41(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"div",4)(5,"div",5)(6,"figure",6),t.nrm(7,"img",7),t.k0s(),t.j41(8,"div",8)(9,"span",9),t.EFF(10),t.k0s()(),t.nVh(11,Q,3,2,"div",10),t.k0s(),t.j41(12,"div",11)(13,"figure",6),t.nrm(14,"img",7),t.k0s(),t.j41(15,"div",8)(16,"span",9),t.EFF(17),t.k0s()(),t.nVh(18,ae,3,2,"div",10),t.k0s()(),t.nVh(19,le,3,2,"div",12),t.k0s(),t.j41(20,"div",13),t.nVh(21,n,2,1,"div",14),t.j41(22,"div",15),t.EFF(23),t.k0s(),t.j41(24,"div",16),t.EFF(25),t.k0s(),t.j41(26,"div",17),t.EFF(27),t.k0s(),t.nVh(28,m,2,1,"div",18),t.k0s()(),t.j41(29,"div",19),t.nVh(30,O,5,2,"div",20),t.k0s()(),t.nVh(31,I,3,1,"div",21),t.k0s()),2&M&&(t.R
17$(),t.Y8G("routerLink",D.gameLink),t.R7$(6),t.Y8G("src",D.game.localTeam.shieldUrl,t.B4B),t.R7$(2),t.Y8G("ngClass",t.eq3(18,$,D.isLocalTeamClub)),t.R7$(),t.JRh(D.localTeamName),t.R7$(),t.vxM("deferred"!=D.game.status?11:-1),t.R7$(3),t.Y8G("src",D.game.visitorTeam.shieldUrl,t.B4B),t.R7$(2),t.Y8G("ngClass",t.eq3(20,$,D.isVisitorTeamClub)),t.R7$(),t.JRh(D.visitorTeamName),t.R7$(),t.vxM("deferred"!=D.game.status?18:-1),t.R7$(),t.vxM(D.gameHour&&null===D.game.localScore&&null===D.game.visitorScore?19:-1),t.R7$(),t.Y8G("routerLink",D.gameLink),t.R7$(),t.vxM(D.game.stadium?21:-1),t.R7$(2),t.JRh(D.game.competition.name),t.R7$(2),t.JRh(D.gameRoundCategory),t.R7$(2),t.JRh(D.game.organization.name),t.R7$(),t.vxM("-1"===D.section?28:-1),t.R7$(2),t.vxM(D.isOrganization()||D.isFederation()?30:-1),t.R7$(),t.vxM(D.globalVars.desktop?31:-1))},dependencies:[y.YU,s.Wk,_.J,B.D9],styles:[".hours[_ngcontent-%COMP%] .clupik-title-h3[_ngcontent-%COMP%]{color:var(--text-small)!important;font-weight:600}"]})}return c})()},41448:(ce,w,i)=>{i.d(w,{b:()=>t});var T=i(13961),P=i(69915),a=i(60152),F=i(25615),f=i(73664),H=i(38139);function ee(b,W){if(1&b&&f.nrm(0,"app-games-card-game",5),2&b){const y=W.$implicit,s=f.XpG(4);f.Y8G("game",y)("section",s.section)}}function z(b,W){if(1&b&&f.Z7z(0,ee,1,2,"app-games-card-game",5,f.fX1),2&b){const y=f.XpG(2).$implicit;f.Dyx(y.games)}}function V(b,W){if(1&b&&(f.j41(0,"div",2)(1,"p",3),f.EFF(2),f.k0s()(),f.j41(3,"div",4),f.nVh(4,z,2,0),f.k0s()),2&b){const y=f.XpG().$implicit,s=f.XpG();f.R7$(2),f.JRh(y.nameFormat),f.R7$(2),f.vxM(s.startLoad?4:-1)}}function te(b,W){if(1&b&&(f.j41(0,"div",1),f.nVh(1,V,5,2),f.k0s()),2&b){const y=W.$implicit;f.R7$(),f.vxM(y.games.length?1:-1)}}let t=(()=>{class b{appService;globalVars;clubsService;games=[];fromDate;toDate;section;days;gamesLoaded=!1;startLoad=!1;subscription=new T.yU;count=0;moment;
1constructor(y,s,_){this.appService=y,this.globalVars=s,this.clubsService=_,this.moment=this.globalVars.getMoment(),this.subscription.add(this.appService.subscribe("gameLoaded",()=>{this.count++,this.games&&this.count===this.games.length&&(this.gamesLoaded=!0)}))}ngOnDestroy(){this.count=0,this.subscription.unsubscribe()}ngOnInit(){this.count=0,this.gamesLoaded=null!=this.games&&0===this.games.length,this.startLoad=!0}ngOnChanges(y){y.games&&(this.count=0,this.gamesLoaded=null!=this.games&&0===this.games.length,this.generateDays(this.fromDate,this.toDate,y.games.currentValue))}generateDays(y,s,_){const B=this.moment(y).clone().startOf("day"),$=this.moment(s).clone().startOf("day");if(this.days=[],_&&_.length>0)do{const Y=[];_.forEach(J=>{const Q=this.moment(J.date);B.isSame(Q,"day")&&Y.push(J)}),this.days.push({number:B.format("DD"),name:B.format("dddd"),nameFormat:B.format("dddd D MMMM"),games:Y})}while(B.add(1,"days").diff($)<=0)}static \u0275fac=function(s){return new(s||b)(f.rXU(P.d),f.rXU(F.Y),f.rXU(a.X))};static \u0275cmp=f.VBU({type:b,selectors:[["app-games-results"]],inputs:{games:"games",fromDate:"fromDate",toDate:"toDate",section:"section"},standalone:!1,features:[f.OA$],decls:3,vars:0,consts:[["id","games-results-components",1,"games"],[1,"game-row"],[1,"days-section"],[1,"clupik-text-body-normal","bold"],["fxLayout","column",1,"games-section"],["fxFlex","1 1 auto",3,"game","section"]],template:function(s,_){1&s&&(f.j41(0,"div",0),f.Z7z(1,te,2,1,"div",1,f.fX1),f.k0s()),2&s&&(f.R7$(),f.Dyx(_.days))},dependencies:[H.B],styles:["#games-results-components[_ngcontent-%COMP%] .game-row[_ngcontent-%COMP%]{display:flex;flex-direction:column}"]})}return b})()},48224:(ce,w,i)=>{i.d(w,{L:()=>oe});var T=i(10467),P=i(34118),a=i(3356),F=i(69915),f=i(68010),H=i(45276),ee=i(94883),z=i(51589),V=i(14934),te=i(7044),t=i(67201),b=i(70843),W=i(25615),y=i(13961),s=i(54843),_=i(73664),B=i(2615),$=i(36229),Y=i(91029),J=i(74173),Q=i(95064);function E(U,le){1&U&&_.nrm(0,"app-skeleton-table")}function re(U,le){if(1&U){const n=_.RV6();_.j41(0,"app-clupik-table",1),_.bIt("onButtonClicked",function(O){B.eBV(n);const I=_.XpG();return B.Njj(I.selectAction(O))}),_.k0s()}if(2&U){const n=_.XpG();_.Y8G("settings",n.settings)("source",n.source)}}let oe=(()=>{class U{addDialog;apiGameService;gameService;appService;competitionService;globalVars;confirmDialog;authService;apiGamesService;router;teamService;_apiStadiums;games;fullScreenTable;section;table;clubId;gamesLoaded=!1;canEdit=!1;source;settings={serverFiltered:!1,showTotalResults:!1,paginator:{size:30,paginatorType:"vertical",verticalButton:!1},class:"full-height-clupik-table",title:"games",noDataMessage:"no_game_competition",columns:{actions:{stickedFront:!0,hideSticky:!0,noExport:!0,title:"",type:"custom",renderComponent:te.H,actionsData:{actions:[{icon:"fa-light fa-link",text:"module.competition.show_game",condition:n=>!0,disabled:n=>!1,event:(n,m)=>this.router.navigate([`/games/${m.id}`])},{icon:"fa-light fa-edit",text:"module.competition.edit_game",condition:n=>!0,disabled:n=>!1,event:(n,m)=>this.onEditGame(m)},{icon:"fa-light fa-trash",text:"module.competition.remove_game",condition:n=>!0,disabled:n=>!1,event:(n,m)=>this.onDeleteGame(m)}]}},clubImage:{title:"",type:"image",imageType:"organization",size:32,noExport:!0,filter:!1,sort:!1},date:{filterType:{type:"date"},title:"date",type:"date",filter:!0,sort:!0,dateFormat:"L - LT",ignoreMidDay:!0,configTitle:"date"},localTeam:{title:"local",configTitle:"local",filter:!0,sort:!0,type:"new-cell",cell:n=>({type:()=>"content",order:"left",showTitle:!0,mainTitle:()=>n.localTeam})},localTeamImage:{title:"",noExport:!0,type:"new-cell",cell:n=>({type:()=>"content",order:"left",showImage:!0,size:32,image:{url:()=>n.localTeamImage.shieldUrl,imageType:"club"}})},result:{title:"result",configTitle:"result",type:"new-cell",cell:n=>({type:()=>"content",order:"center",showTitle:!0,mainTitle:()=>n.result})},visitorTeamImage:{title:"",noExport:!0,type:"new-cell",cell:n=>({type:()=>"content",order:"left",showImage:!0,size:32,image:{url:()=>n.visitorTeamImage.shieldUrl,imageType:"club"}})},visitorTeam:{title:"visitor",configTitle:"visitor",filter:!0,sort:!0,type:"new-cell",cell:n=>({type:()=>"content",order:"left",showTitle:!0,mainTitle:()=>n.visitorTeam})},round:{title:"game_day",configTitle:"game_day",filter:!0,sort:!0,type:"new-cell",cell:n=>({type:()=>"content",order:"left",showTitle:!0,mainTitle:()=>n.round})}
1,status:{title:"state",configTitle:"state",filter:!0,sort:!0,type:"new-cell",cell:n=>({type:()=>"content",order:"left",showTitle:!0,mainTitle:()=>n.status})},stadium:{title:"stadium",configTitle:"stadium",filter:!0,sort:!0,type:"new-cell",cell:n=>({type:()=>"content",order:"left",showTitle:!0,mainTitle:()=>n.stadium})}}};tableData;moment;statuses=[{name:"Sin comenzar",key:"pending"},{name:"En juego",key:"playing"},{name:"Terminado",key:"finished"},{name:"Aplazado",key:"deferred"},{name:"No presentado",key:"teamNotShowed"}];subscription=new y.yU;isClupikOrganization;stadiums=[];constructor(n,m,O,I,N,c,R,v,M,D,l,p){this.addDialog=n,this.apiGameService=m,this.gameService=O,this.appService=I,this.competitionService=N,this.globalVars=c,this.confirmDialog=R,this.authService=v,this.apiGamesService=M,this.router=D,this.teamService=l,this._apiStadiums=p,this.moment=this.globalVars.getMoment(),this.subscription.add(this.appService.subscribe("edit-game",g=>{this.openEditCompetitionGameDialog(g)})),this.subscription.add(this.appService.subscribe("delete-game",g=>{this.openDeleteCompetitionGameDialog(g)})),this.subscription.add(this.appService.subscribe("export_games_table",g=>{this.table.exportTable()}))}ngOnInit(){}ngAfterViewInit(){this.init()}init(){var n=this;return(0,T.A)(function*(){if(n.fullScreenTable&&(n.settings.class="full-height-clupik-table"),n.authService.isSuperAdmin()&&(n.settings.columns={id:{filter:!0,title:"id",dontTranslateTitle:!0,hideSticky:!0,stickedFront:!0,type:"new-cell",cell:m=>({type:()=>"content",order:"left",showTitle:!0,mainTitle:m.id})},...n.settings.columns}),n.tableData=[],n.gamesLoaded=!1,0===n.stadiums.length&&(n.stadiums=yield(0,s._)(n._apiStadiums.getAllStadiums())),"-1"===n.section){let m=n.settings;m.columns={...n.settings.columns,sectionName:{title:"section",configTitle:"section",filter:!0,sort:!0,type:"new-cell",cell:O=>({type:()=>"content",order:"left",showTitle:!0,mainTitle:O.sectionName})}},n.settings={...m}}n.games&&n.games.forEach((m,O)=>{n.createTableRow(m),O==n.games.length-1&&(n.source=n.tableData,n.gamesLoaded=!0)})})()}createTableRow(n){let m=this.createNewRowData(n);null!=m&&this.tableData.push(m)}createNewRowData(n){let m=this.teamService.getCustomTeamName(n.localTeam),O=this.teamService.getCustomTeamName(n.visitorTeam),I=n.date;"0:00"==this.moment(n.date).format("LT")&&(I=n.date);let N=n.localScore+" - "+n.visitorScore;return n.localScore==n.visitorScore==null&&(N="-"),{id:n.id,clubImage:{id:n.organizationId},date:I,localTeam:m,visitorTeam:O,statistics:n.statistics,round:n.round?n.round.toString():null,status:this.statuses.find(c=>c.key===n.status).name,result:"pending"===n.status||"deferred"===n.status?"-":N,localTeamImage:{shieldUrl:n.localTeam.shieldUrl},visitorTeamImage:{shieldUrl:n.visitorTeam.shieldUrl},actions:JSON.stringify({fromGamesGroup:!0,game:n}),sectionName:n.sectionName,...n.competitionGameRugby&&{competitionGameRugby:n.competitionGameRugby},game:n,stadium:this.getStadium(n?.stadiumId||n?.stadium?.id)}}getStadium(n){return this.stadiums.find(m=>m.id===n)?.name||"-"}openEditCompetitionGameDialog(n){var m=this,O=n.rowData.actions;this.addDialog.open(V.S,{data:{game:n.game}}).afterClosed().subscribe(function(){var N=(0,T.A)(function*(c){if("object"==typeof c){m.teamService.broadcast("success-alert",{message:"Los cambios han sido guardados correctamente"}),yield m.apiGameService.setGame(c.id);let v=m.gameService.getGame();var R=m.createNewRowData(v);let M=m.games.findIndex(D=>D.id==v.id);m.games[M]=v,R.actions=O,m.table.tableDataSource.update(n.rowData,R),m.competitionService.broadcast("refresh",null)}});return function(c){return N.apply(this,arguments)}}())}openDeleteCompetitionGameDialog(n){this.confirmDialog.open(t.w,{panelClass:"clupik-modal-md",data:{type:"delete-game"}}).afterClosed().subscribe(O=>{!0===O&&this.apiGameService.deleteGame(n.gameId).subscribe(()=>{this.teamService.broadcast("success-alert",{message:"Los cambios han sido guardados correctamente"}),this.competitionService.broadcast("refresh",null),this.table.tableDataSource.remove(n.rowData)},I=>{this.teamService.broadcast("error-alert",{message:"No se han guardado los cambios"})})})}ngOnDestroy(){this.subscription.unsubscribe()}selectAction(n){"export"===(this.appService.broadcast("closeDropdown"),n)&&this.table.exportTable()}checkUserPermission(n){var m=this;return(0,T.A)(function*(){return!!m.authService.isSuperAdmin()||!!(yield(0,s._)(m.apiGamesService.canEditGame(n?.id,m.authService.getId())))&&m.authService.canUserEditGame(n?.visitorTeamId,n?.localTeamId)})()}onEditGame(n){var m=this;return(0,T.A)(function*(){(yield m.checkUserPermission(n))?m.openEditCompetitionGameDialog({game:n.game,rowData:n}):m.appService.broadcast("showAlert",{state:"warning",mainTitle:"module.games.cant_edit_permissions",autoHide:!1})})()}onDeleteGame(n){var m=this;return(0,T.A)(function*(){(yield m.checkUserPermission(n))?m.openDeleteCompetitionGameDialog({gameId:n.game.id,rowData:n}):m.appService.broadcast("showAlert",{state:"warning",mainTitle:"module.games.cant_remove_permissions",autoHide:!1})})()}static \u0275fac=function(m){return new(m||U)(_.rXU($.h),_.rXU(a.n),_.rXU(ee.w),_.rXU(F.d),_.rXU(H.u),_.rXU(W.Y),_.rXU($.h),_.rXU(f.u),_.rXU(a.n),_.rXU(Y.Ix),_.rXU(z.n),_.rXU(P.i))};static \u0275cmp=_.VBU({type:U,selectors:[["app-games-table"]],viewQuery:function(m,O){if(1&m&&_.GBs(b.YT,5),2&m){let I;_.mGM(I=_.lsd())&&(O.table=I.first)}},inputs:{games:"games",fullScreenTable:"fullScreenTable",section:"section"},standalone:!1,decls:2,vars:1,consts:[[3,"settings","source"],[3,"onButtonClicked","settings","source"]],template:function(m,O){1&m&&_.nVh(0,E,1,0,"app-skeleton-table")(1,re,1,2,"app-clupik-table",0),2&m&&_.vxM(O.gamesLoaded?1:0)},dependencies:[J.YT,Q.X],encapsulation:2})}return U})()}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.