PageSourceSearch

https://vabourlettis.be/chunk-F75PAPM6.js

js vabourlettis.be collected 2026-10-03 02:28:12 UTC 132,755 bytes, 4 lines download raw bytes

1import{b as Ii}from"./chunk-HUEVU2ON.js";import{a as Pi,b as Ai}from"./chunk-G2WPON25.js";import{a as Di,f as Et}from"./chunk-NROXMB3U.js";import{a as Mt,b as Ot}from"./chunk-5ONLVAKV.js";import"./chunk-FVXDG74B.js";import{a as xi,b as wt}from"./chunk-2HTBYGYX.js";import{a as Si}from"./chunk-ASTPUXTF.js";import"./chunk-ZEPXYJ4X.js";import{b as Ti,f as _i}from"./chunk-EETZ3ZZR.js";import"./chunk-AH7Z4532.js";import{a as yi,b as vi}from"./chunk-YMFAISKY.js";import"./chunk-AC5Y2J64.js";import{b as ke,d as Ne,e as Re,f as Fe}from"./chunk-H7XQLDKZ.js";import{a as It}from"./chunk-SKBXP5GX.js";import"./chunk-LGTU2HLM.js";import"./chunk-PFWECNZI.js";import"./chunk-FVZAJ5X3.js";import{b as fi,c as bi}from"./chunk-GMXJDXHP.js";import{b as At}from"./chunk-JVJNM2C4.js";import{c as De,d as Pe,f as Xe}from"./chunk-YKGADUKV.js";import"./chunk-3RK6DDJD.js";import{g as Ae,j as je}from"./chunk-ODSU66AL.js";import"./chunk-4JR63SCJ.js";import"./chunk-FQDXRJIQ.js";import"./chunk-LKHIVITT.js";import{a as Ci}from"./chunk-XPTH3RVF.js";import{a as re}from"./chunk-WW5R56WL.js";import{A as Ve,L as q,M as ne,d as p,e as Ue,f as ae,g as Gi,j as ut,k as ui,l as zt,m as hi,s as Z}from"./chunk-BKBX5KWR.js";import{B as Ee,c as mi,h as Ke,i as Ie,j as Me,l as B,n as Oe,q as we,r as Qe,z as pi}from"./chunk-IGUTW5VM.js";import{a as me,b as pe,c as ue,d as gi,e as he,f as ge}from"./chunk-JFVL7FSH.js";import"./chunk-VCZFE3GL.js";import"./chunk-TZRQC2HJ.js";import"./chunk-WUONTDUZ.js";import"./chunk-H6CBF4L7.js";import"./chunk-ITWDF5QD.js";import{j as di}from"./chunk-5ZNHGDCP.js";import"./chunk-MM3EPEEU.js";import{m as Y,n as ie,o as Q}from"./chunk-JWDBZGUU.js";import"./chunk-4N3QRLFI.js";import{a as G}from"./chunk-P653GW4R.js";import{$b as c,$c as mt,Ac as P,Bc as _e,Cb as x,Cc as Be,E as ft,Fb as Ct,Gd as ce,Hd as de,Ia as bt,Jc as xt,Oc as si,Od as Dt,Pc as Yt,Pd as oi,Qa as ni,Qd as ci,Sd as K,Wc as O,Xc as w,Xd as pt,Zb as m,Zc as qt,_b as d,ac as A,ba as j,c as vt,cd as li,ec as R,f as J,fc as F,ha as ai,hc as M,jc as v,kb as l,la as Te,lc as h,md as We,pc as St,qb as g,qc as Tt,ra as b,rc as _t,sa as C,vc as dt,wc as Gt,xb as X,xc as ri,yc as T,zc as f}from"./chunk-IJZMKO22.js";import{l as Le,o as I,q as ee,r as Pt,t as Je,u as xe}from"./chunk-MIPO3MND.js";import{a as ti,b as ii,h as $i,j as H}from"./chunk-MJU6LYFT.js";var kt=$i(Gi());var V=class extends ui{day=null;present=null;type="";extraTrainingIsAtHome=!1;extraTrainingTeam="";extraTrainingTimeStarting="";extraTrainingTimeEnding="";extraTrainingBuilding="";reason="";isPresenceNotCounted=!1;trainingPlayerSysId=null;playerSysId=0;player=new hi;teamSysId=0;championshipSysId=0;championship};H([Reflect.metadata("day",{editVariableValidator:{},editControlType:3})],V.prototype,"day",2),H([Reflect.metadata("present",{editVariableValidator:{}})],V.prototype,"present",2),H([Reflect.metadata("type",{editVariableValidator:{MaxLength:"30"}})],V.prototype,"type",2),H([Reflect.metadata("extraTrainingIsAtHome",{editVariableValidator:{}})],V.prototype,"extraTrainingIsAtHome",2),H([Reflect.metadata("extraTrainingTeam",{editVariableValidator:{MaxLength:"50"}})],V.prototype,"extraTrainingTeam",2),H([Reflect.metadata("extraTrainingTimeStarting",{editVariableValidator:{MaxLength:"5"}})],V.prototype,"extraTrainingTimeStarting",2),H([Reflect.metadata("extraTrainingTimeEnding",{editVariableValidator:{MaxLength:"5"}})],V.prototype,"extraTrainingTimeEnding",2),H([Reflect.metadata("extraTrainingBuilding",{editVariableValidator:{MaxLength:"200"}})],V.prototype,"extraTrainingBuilding",2),H([Reflect.metadata("reason",{editVariableValidator:{MaxLength:"30"}})],V.prototype,"reason",2),H([Reflect.metadata("isPresenceNotCounted",{editVariableValidator:{}})],V.prototype,"isPresenceNotCounted",2),H([Reflect.metadata("trainingPlayerSysId",{editVariableValidator:{}})],V.prototype,"trainingPlayerSysId",2),H([Reflect.metadata("playerSysId",{editVariableValidator:{}})],V.prototype,"playerSysId",2),H([Reflect.metadata("player",{editColumnIsVisible:Le[0],gridColumnIsVisible:Le[0]}),(0,kt.jsonIgnore)()],V.prototype,"player",2),H([Reflect.metadata("teamSysId",{edit
1ColumnIsVisible:Le[0],gridColumnIsVisible:Le[0]}),(0,kt.jsonIgnore)()],V.prototype,"teamSysId",2),H([Reflect.metadata("championshipSysId",{editStickyValidator:[5],editControlType:5,editDropdownEntityMapping:"championship",editDropdownPropertiesForDisplay:"yearStarting;yearEnding",editDropdownFormatForDisplay:"{0}-{1}"})],V.prototype,"championshipSysId",2),H([Reflect.metadata("championship",{editColumnIsVisible:Le[0],gridColumnIsVisible:Le[0],grisIsInDetailExpanded:!0}),(0,kt.jsonIgnore)()],V.prototype,"championship",2),V=H([Reflect.metadata("trainingPlayerBase","trainingPlayerBase")],V);var $=class extends V{};$=H([Reflect.metadata("trainingPlayer","trainingPlayer")],$);var Mi={Aucune:"Aucune",OK:"OK",TrainingPlayerEditionEndTime:"Heure de fin :",TrainingPlayerEditionHome:"A domicile :",TrainingPlayerEditionLocation:"Lieu :",TrainingPlayerEditionNewTitle:"Nouvelle activit\xE9 au {{date}}",TrainingPlayerEditionNoCoachForTeam:"Impossible d'ajouter : l'\xE9quipe s\xE9lectionn\xE9e n'a aucun coach assign\xE9.",TrainingPlayerEditionNoAttendance:"Non comptabilisation de pr\xE9sence :",TrainingPlayerEditionNoTime:"Pas d'horaire",TrainingPlayerEditionOpponent:"Contre :",TrainingPlayerEditionTime:"Heure :",TrainingPlayerEditionType:"Type"};var Oi={Aucune:"None",OK:"OK",TrainingPlayerEditionEndTime:"End time:",TrainingPlayerEditionHome:"Home:",TrainingPlayerEditionLocation:"Location:",TrainingPlayerEditionNewTitle:"New activity on {{date}}",TrainingPlayerEditionNoCoachForTeam:"Cannot add: the selected team has no assigned coach.",TrainingPlayerEditionNoAttendance:"No attendance counting:",TrainingPlayerEditionNoTime:"No schedule",TrainingPlayerEditionOpponent:"Against:",TrainingPlayerEditionTime:"Time:",TrainingPlayerEditionType:"Type"};var Ze=class s{constructor(t,e,i,a,n,r,o){this.trainingPlayerService=t;this.cacheService=e;this.frameworkService=i;this.alertShowService=a;this.encryptionService=n;this.subjectService=r;this.translateService=o}deleteTrainingPlayer(t,e){return new vt(i=>{this.trainingPlayerService.deleteWithServerDateCheck(t,t.day,t.extraTrainingTimeStarting,!e).subscribe({next:a=>{let n=this.handleDeleteResponse(a,"MessageDataDeletedSuccessfully",!1);i.next(n),i.complete()},error:a=>{this.handleError(a),i.error(a)}})})}deleteAllTrainingPlayersForDate(t,e,i){return new vt(a=>{let n=[];for(let r=0;r<e.length;r++){let o=i.find(y=>y.playerSysId==e[r].sysId&&p.yyyyMmDd(y.day)==p.yyyyMmDd(t));o!=null&&n.push(o)}this.trainingPlayerService.deleteAll(n).subscribe({next:r=>{let o=this.handleDeleteResponse(r,"MessageDataDeletedSuccessfully",!1);a.next(o),a.complete()},error:r=>{this.handleError(r),a.error(r)}})})}insertTrainingPlayer(t,e){return new vt(i=>{this.trainingPlayerService.insertWithServerDateCheck(t,!e).subscribe({next:a=>{let n=this.handleInsertResponse(a,"MessageDataSavedSuccessfully","MessageDataNotSavedDueToAnError",!1);i.next(n),i.complete()},error:a=>{this.handleError(a),i.error(a)}})})}handleDeleteResponse(t,e,i=!0){let a=this.encryptionService.decryptObject(!1,t.value);return a!=null?a.reason=="OUTOFDATE"?(this.frameworkService.displayAlert(!1,"Un \xE9v\xE9nement pass\xE9 ne peut plus \xEAtre modifi\xE9 !"),this.subjectService.IsButtonInLoadingSubject.next(!1),{success:!1,reason:"OUTOFDATE",message:"Past event cannot be modified"}):(this.cacheService.cacheUpdatedDataLoad(!0),i&&this.frameworkService.displayAlert(!0,this.translateService.instant(e)),this.subjectService.IsButtonInLoadingSubject.next(!1),{success:!0,data:a,message:"Delete completed successfully"}):(this.alertShowService.error(this.translateService.instant("MessageDataNotDeletedDueToAnError")),ft(this.frameworkService.saveStatusResetTimeOnFailed()).subscribe(n=>{this.alertShowService.clear()}),this.subjectService.IsButtonInLoadingSubject.next(!1),{success:!1,message:"Data validation failed"})}handleInsertResponse(t,e,i,a=!0){let n=this.encryptionService.decryptObject(!1,t.value);return n!=null?n.reason=="OUTOFDATE"?(this.frameworkService.displayAlert(!1,"Un \xE9v\xE9nement pass\xE9 ne peut plus \xEAtre modifi\xE9 !"),this.subjectService.IsButtonInLoadingSubject.next(!1),{success:!1,reason:"OUTOFDATE",message:"Past event cannot be modified"}):(this.cacheService.cacheUpdatedDataLoad(!0),a&&this.frameworkService.displayAlert(!0,this.translateService.instant(e)),this.subjectService.IsButtonInLoadingSubject.next(!1),{success:!0,data:n,message:"Insert completed successfully"}):(this.alertShowService.error(this.translateService.instant(i)),ft(this.frameworkService.saveStatusResetTimeOnFailed()).subscribe(r=>{this.alertShowService.clear()}),this.subjectService.IsButtonInLoadingSubject.next(!1),{success:!1,message:"Data validation failed"})}handleError(t){this.alertShowService.error(t.mes),ft(this.frameworkService.saveStatusResetTimeOnFailed()).subscribe(e=>{this.alertShowService.clear()}),this.subjectService.IsButtonInLoadingSubject.next(!1)}static \u0275fac=function(e){return new(e||s)(Te(Ve),Te(q),Te(Z),Te(Ii),Te(Ue),Te(G),Te(Y))};static \u0275prov=ai({token:s,factory:s.\u0275fac,providedIn:"root"})};function zi(s,t){if(s&1&&(d(0,"mat-option",24),R(1),f(2),F(),c()),s&2){let e=t.$implicit;m("value",e.value),l(2),P(e.viewValue)}}function Wi(s,t){s&1&&A(0,"div",12)}function Ji(s,t){s&1&&(d(0,"div",5)(1,"div"),f(2,"Contre :"),c(),d(3,"div")(4,"mat-form-field",7),A(5,"input",25),c()()()),s&2&&(l(5),Gt("width","52ch"),m("maxLength",50))}function Xi(s,t){s&1&&(d(0,"div",5)(1,"div"),f(2,"A domicile :"),c(),d(3,"div",6),A(4,"mat-checkbox",26),c()())}function Ki(s,t){s&1&&(A(0,"app-button",27),O(1,"translate")),s&2&&(T("x-buttonSeparator x-buttonNormalYes"),m("text",w(1,6,"OK"))("isBackgroun
1dOpaque",!0)("isAlwaysEnabled",!0)("visibility",!0))}function Qi(s,t){s&1&&(A(0,"app-button",27),O(1,"translate")),s&2&&(T("x-buttonSeparator x-buttonNormalNo"),m("text",w(1,6,"Cancel"))("isBackgroundOpaque",!0)("isAlwaysEnabled",!0)("visibility",!0))}function Zi(s,t){s&1&&A(0,"div",12)}function ea(s,t){s&1&&(A(0,"app-button",27),O(1,"translate")),s&2&&(T("x-buttonSeparator x-buttonNormalYes"),m("text",w(1,6,"OK"))("isBackgroundOpaque",!0)("isAlwaysEnabled",!0)("visibility",!0))}function ta(s,t){s&1&&(A(0,"app-button",27),O(1,"translate")),s&2&&(T("x-buttonSeparator x-buttonNormalNo"),m("text",w(1,6,"Cancel"))("isBackgroundOpaque",!0)("isAlwaysEnabled",!0)("visibility",!0))}function ia(s,t){if(s&1){let e=M();d(0,"div",14)(1,"div",15),f(2,"Heure de fin :"),c(),d(3,"div",6),A(4,"ngx-timepicker-field",28),x(5,ea,2,8,"ng-template",null,0,mt)(7,ta,2,8,"ng-template",null,1,mt),c(),d(9,"div")(10,"app-button",17),O(11,"translate"),v("onClick",function(){b(e);let a=h();return C(a.resetTimeEnding())}),c()()()}if(s&2){let e=dt(6),i=dt(8);l(4),m("format",24)("defaultTime","00:00")("confirmBtnTmpl",e)("cancelBtnTmpl",i),l(6),T("x-buttonSeparator x-buttonNormalNo"),m("text",w(11,10,"Aucune"))("isBackgroundOpaque",!0)("visibility",!0)("isAlwaysEnabled",!0)}}var it=class s{constructor(t,e,i,a,n,r,o,y,E,se,le){this.dialogRef=t;this.data=e;this.trainingPlayerService=i;this.trainingPlayerCRUDService=a;this.frameworkService=n;this.cacheService=r;this.subjectService=o;this.storageService=y;this.accessRightsService=E;this.encryptionService=se;this.translateService=le;this.translateService.setTranslation("fr",Mi,!0),this.translateService.setTranslation("en",Oi,!0),this.subjectService.IsButtonInLoadingSubject.next(!1),this.isCoachOnlyConnected=this.accessRightsService.isMemberCoachOnly(this.storageService.getUserConnected()),this.user=this.storageService.getUserConnected(),this.date=e.date,this.team=e.team}allActivities=[];allClubEventsOfUserAuthenticated;allReasons=[];crudType;date;eventClub;form=new Me({allReasons:new B(""),allActivities:new B(""),team:new B(""),isAtHome:new B(""),timeStarting:new B(""),timeEnding:new B(""),trainingBuilding:new B("Hall des sports anderlues"),isPresenceNotCounted:new B("")});isCoachOnlyConnected=!1;isDeleteVisible=!1;selectedActivityType="";title="";tpOfCoach;user;team;destroy$=new J;getCoachOfTeam(t){if(!t)return null;let e=this.cacheService.getAllUsers()??[];return e.find(i=>i.sysId===t.coachT1SysId)??e.find(i=>i.sysId===t.coachT2SysId)??e.find(i=>i.sysId===t.coachT3SysId)??e.find(i=>i.sysId===t.assitantCoachSysId)??null}async loadCacheDataAndInitialize(){try{await this.cacheService.loadTrainingPlayersCache(!0),this.initializeEventData()}catch(t){console.error("Error loading training player edition data:",t),this.initializeEventData()}}initializeEventData(){if(this.allReasons=this.frameworkService.getNonPresenceReason(),this.allActivities=this.frameworkService.getMatchTrainingActivitiesType(),this.data.tpOverride){let e=this.data.tpOverride;this.tpOfCoach=e,this.eventClub=this.buildEventClubFromTp(e),this.crudType=2,this.fillFormFromTp(e),this.title=this.translateService.instant(e.type)+" du "+p.activityDisplay(this.data.date,this.translateService,!0),this.isDeleteVisible=!0;return}this.allClubEventsOfUserAuthenticated=this.cacheService.getAllClubEventsOfUserAuthenticated();let t=this.frameworkService.findFirstEventClub(this.allClubEventsOfUserAuthenticated,p.yyyyMmDd(this.data.date)+this.team.sysId.formatWithLeadingZeros(6));if(t==null)this.crudType=1,this.title=this.translateService.instant("TrainingPlayerEditionNewTitle",{date:p.activityDisplay(this.data.date,this.translateService,!0)}),this.isDeleteVisible=!1;else if(this.tpOfCoach=this.cacheService.getExtraTrainingOfCoachFromDate(this.date),this.tpOfCoach!=null&&(this.eventClub=this.frameworkService.findFirstEventClub(this.allClubEventsOfUserAuthenticated,p.yyyyMmDd(this.date)+this.team.sysId.formatWithLeadingZeros(6)+this.tpOfCoach.type)?.eventClub),this.isAnExtraDay(t.clubActivityType)){if(this.tpOfCoach==null){this.crudType=1,this.title=this.translateService.instant("TrainingPlayerEditionNewTitle",{date:p.activityDisplay(this.data.date,this.translateService,!0)}),this.isDeleteVisible=!1;return}this.crudType=2,this.fillFormFromTp(this.tpOfCoach),this.title=this.translateService.instant(this.tpOfCoach.type)+" du "+p.activityDisplay(this.data.date,this.translateService,!0),this.isDeleteVisible=!0}else this.dialogRef.close(!0)}fillFormFromTp(t){this.form.get("allActivities").setValue(t.type),this.selectedActivityType=t.type,this.form.get("team").setValue(t.extraTrainingTeam),this.form.get("timeStarting").setValue(t.extraTrainingTimeStarting),this.form.get("timeEnding").setValue(t.extraTrainingTimeEnding),this.form.get("isAtHome").setValue(t.extraTrainingIsAtHome),this.form.get("trainingBuilding").setValue(t.extraTrainingBuilding),this.form.get("isPresenceNotCounted").setValue(t.isPresenceNotCounted)}buildEventClubFromTp(t){let e=new ut;return e.tpSysId=t.sysId,e.day=t.day,e.event=new zt,e.event.sysId=t.sysId,e.event.day=t.day,e.event.name=t.type,e.event.type=t.type,e.clubActivityType=this.frameworkService.getClubActivityType(t.type),e.event.time=t.extraTrainingTimeEnding=="00:00"||t.extraTrainingTimeEnding==""?t.extraTrainingTimeStarting:t.extraTrainingTimeStarting+" \xE0 "+t.extraTrainingTimeEnding,t.extraTrainingIsAtHome?e.event.awayTeam=t.extraTrainingTeam:e.event.fromTeam=t.extraTrainingTeam,e.event.isAtHome=t.extraTrainingIsAtHome,e.event.buildingName=t.extraTrainingBuilding,e}cloneEventClub(t){if(t==null)return t;let e=Object.assign(Object.create(Object.getPrototypeOf(t)),t);return t.event!=null&&(e.event=Object.assign(Object.create(Object.getPrototypeOf(t.event)),t.event)),e}onActivityTypeChange(t){this.selectedActivityType=t.value}deleteTrainingPlayers(t,e,i){let a=this.accessRightsService.isMemberCoachsOrAssistantOrSupervisor(t),n=this.cacheService.applyOptimisticTrainingPlayerDelete(i,t,this.team);n&&(this.allClubEventsOfUserAuthenticated=this.cacheService.getAllClubEventsOfUserAuthenticated(),this.subjectService.IsTrainingPlayerCacheLoadedSubject.next(!0)),this.trainingPlayerCRUDService.deleteTrainingPlayer(i,a).subscribe({next:r=>{r?.success===!1&&this.restoreDeletedTrainingPlayer(t,e,i,n)},error:r=>{this.restoreDeletedTrainingPlayer(t,e,i,n)}})}restoreDeletedTrainingPlayer(t,e,i,a){a&&(this.cacheService.rollbackOptimisticTrainingPlayerDelete(this.date,i,e,this.team,t),this.allClubEventsOfUserAuthenticated=this.cacheService.getAllClubEventsOfUserAuthenticated(),this.subjectService.IsTrainingPlayerCacheLoadedSubject.next(!0))}isAnExtraDay(t){return t==I[4]||t==I[2]||t==I[5]}isAnExtraTrainingDay(t){return t==I[5]}isAnTournamentDay(t){return t==I[2]}isAnFriendlyMatchDay(t){return t==I[4]}manageTrainingPlayer(t,e){let i=new ut;if(this.crudType==1){i.tpSysId=null,i.day=e.day,i.event=new zt,i.event.sysId=null,i.event.day=p.databaseDateOnly(this.date),i.event.Present=!0,i.event.name=e.type,i.event.type=e.type,i.clubActivityType=this.frameworkService.getClubActivityType(e.type),e.extraTrainingTimeEnding=="00:00"||e.extraTrainingTimeEnding==""?i.event.time=e.extraTrainingTimeStarting:i.event.time=e.extraTrainingTimeStarting+" \xE0 "+e.extraTrainingTimeEnding,e.extraTrainingIsAtHome?i.event.awayTeam=e.extraTrainingTeam:i.event.fromTeam=e.extraTrainingTeam,i.event.isAtHome=e.extraTrainingIsAtHome,i.event.buildingName=e.extraTrainingBuilding,this.cacheService.applyOptimisticTrainingPlayer(this.date,e,i,this.team),this.allClubEventsOfUserAuthenticated=this.cacheService.getAllClubEventsOfUserAuthenticated(),this.subjectService.IsTrainingPlayerCacheLoadedSubject.next(!0);let a=e;this.trainingPlayerService.insertWithServerDateCheck(e,!1).subscribe({next:n=>{let r=this.encryptionService.decryptObject(!1,n.value);r!=null?(this.cacheService.reconcileOptimisticTrainingPlayer(this.date,a,r,i,this.team,t),this.allClubEventsOfUserAuthenticated=this.cacheService.getAllClubEventsOfUserAuthenticated(),this.subjectService.IsTrainingPlayerCacheLoadedSubject.next(!0)):(this.cacheService.rollbackOptimisticTrainingPlayer(this.date,a,this.team),this.frameworkService.displayAlert(!1),this.subjectService.IsTrainingPlayerCacheLoadedSubject.next(!0))},error:n=>{this.cacheService.rollbackOptimisticTrainingPlayer(this.date,a,this.team),this.frameworkService.displayAlert(null,n),this.subjectService.IsTrainingPlayerCacheLoadedSubject.next(!0)}})}else{i=this.eventClub;let a=this.cloneEventClub(i);i.event.name=e.type,i.event.type=e.type,i.clubActivityType=this.frameworkService.getClubActivityType(e.type),e.extraTrainingTimeEnding=="00:00"||e.extraTrainingTimeEnding==""?i.event.time=e.extraTrainingTimeStarting:i.event.time=e.extraTrainingTimeStarting+" \xE0 "+e.extraTrainingTimeEnding,e.extraTrainingIsAtHome?i.event.awayTeam=e.extraTrainingTeam:i.event.fromTeam=e.extraTrainingTeam,i.event.isAtHome=e.extraTrainingIsAtHome,i.event.buildingName=e.extraTrainingBuilding;let n=e,r=this.cacheService.applyOptimisticTrainingPlayerUpdate(this.date,n,i,this.team,t);this.allClubEventsOfUserAuthenticated=this.cacheService.getAllClubEventsOfUserAuthenticated(),this.subjectService.IsTrainingPlayerCacheLoadedSubject.next(!0),this.trainingPlayerService.updateAllTrainingPlayerOfCoach(e).subscribe({next:o=>{let y=this.encryptionService.decryptObject(!1,o.value);y!=null&&y.reason!="OUTOFDATE"?this.allClubEventsOfUserAuthenticated=this.cacheService.reconcileOptimisticTrainingPlayerUpdate(this.date,n,y,i,this.team,t):(this.cacheService.rollbackOptimisticTrainingPlayerUpdate(this.date,r,a,this.team,t),this.allClubEventsOfUserAuthenticated=this.cacheService.getAllClubEventsOfUserAuthenticated(),y?.reason=="OUTOFDATE"&&this.frameworkService.displayAlert(!1,"Un \xE9v\xE9nement pass\xE9 ne peut plus \xEAtre modifi\xE9 !")),this.subjectService.IsTrainingPlayerCacheLoadedSubject.next(!0),this.cacheService.cacheUpdatedDataLoad(!0)},error:o=>{this.cacheService.rollbackOptimisticTrainingPlayerUpdate(this.date,r,a,this.team,t),this.allClubEventsOfUserAuthenticated=this.cacheService.getAllClubEventsOfUserAuthenticated(),this.frameworkService.displayAlert(null,o),this.subjectService.IsTrainingPlayerCacheLoadedSubject.next(!0),this.cacheService.cacheUpdatedDataLoad(!0)}})}}ngOnInit(){this.destroy$.next(),this.loadCacheDataAndInitialize()}resetTimeStarting(){this.form.get("timeStarting").setValue("")}resetTimeEnding(){this.form.get("timeEnding").setValue("")}onCancel(){this.dialogRef.close(!1)}onDelete(){this.deleteTrainingPlayers(this.user,this.eventClub,this.tpOfCoach),this.dialogRef.close(!0)}onSave(){if(this.form.get("allActivities").value==""){this.frameworkService.displayAlert(null,"Vous devez s\xE9lectionner un type d'activit\xE9."),this.subjectService.IsButtonInLoadingSubject.next(!1);return}let t=new $;if(t.championship=null,t.player=null,t.teamSysId=this.team.sysId,this.crudType==1){t.championshipSysId=this.cacheService.getCurrentChampionship().sysId;let e=this.getCoachOfTeam(this.team)??this.cacheService.mainCoac
1hOfCurrentLogged();if(e==null){this.frameworkService.displayAlert(!1,this.translateService.instant("TrainingPlayerEditionNoCoachForTeam")),this.subjectService.IsButtonInLoadingSubject.next(!1);return}t.playerSysId=this.frameworkService.getSysIdOfUser(e),t.day=p.databaseDateOnly(this.date),t.present=1}else t=Object.assign(new $,JSON.parse(JSON.stringify(this.tpOfCoach)));t.type=this.form.get("allActivities").value,t.type==I[5]?t.extraTrainingTeam="":t.extraTrainingTeam=this.form.get("team").value.toString().toUpperCase(),t.extraTrainingTimeStarting=this.form.get("timeStarting").value,this.form.get("timeEnding").value=="00:00"||this.form.get("timeEnding").value==""?t.extraTrainingTimeEnding="":t.extraTrainingTimeEnding=this.form.get("timeEnding").value,t.extraTrainingIsAtHome=this.form.get("isAtHome").value==""?!1:this.form.get("isAtHome").value,t.extraTrainingBuilding=this.form.get("trainingBuilding").value.toString(),t.isPresenceNotCounted=this.form.get("isPresenceNotCounted").value==""?!1:this.form.get("isPresenceNotCounted").value,this.manageTrainingPlayer(this.user,t),this.dialogRef.close(!0)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}static \u0275fac=function(e){return new(e||s)(g(De),g(Pe),g(Ve),g(Ze),g(Z),g(q),g(G),g(ae),g(ne),g(Ue),g(Y))};static \u0275cmp=X({type:s,selectors:[["app-trainingPlayerEditionDialog"]],decls:56,vars:46,consts:[["okButton",""],["cancelButton",""],[3,"formGroup"],[1,"x-matcardHeaderColor"],[1,"x-trainingPlayerFormGrid"],[1,"x-trainingPlayerFormRow"],[1,"x-formControl-wrapper"],["appearance","fill"],["placeholder","Choisir ...","formControlName","allActivities",1,"dropDownTPEditionWidth",3,"selectionChange"],[3,"value",4,"ngFor","ngForOf"],["class","x-br1",4,"ngIf"],["class","x-trainingPlayerFormRow",4,"ngIf"],[1,"x-br1"],["formControlName","isPresenceNotCounted"],[1,"x-trainingPlayerFormRow","x-flexStart"],[1,"x-label"],["formControlName","timeStarting",3,"format","defaultTime","confirmBtnTmpl","cancelBtnTmpl"],["icon","refresh",3,"onClick","text","isBackgroundOpaque","visibility","isAlwaysEnabled"],["class","x-trainingPlayerFormRow x-flexStart",4,"ngIf"],["matInput","","type","text","formControlName","trainingBuilding",1,"x-formControl",3,"maxLength"],[1,"x-flexSpaceBetween"],["icon","cancel",3,"onClick","text","isBackgroundOpaque","visibility"],["icon","delete",3,"onClick","visibility","text","disabled","isSubmit"],["icon","save",3,"onClick","text","disabled","isSubmit","visibility"],[3,"value"],["matInput","","type","text","formControlName","team",1,"x-formControl",3,"maxLength"],["formControlName","isAtHome"],[3,"text","isBackgroundOpaque","isAlwaysEnabled","visibility"],["formControlName","timeEnding",3,"format","defaultTime","confirmBtnTmpl","cancelBtnTmpl"]],template:function(e,i){if(e&1){let a=M();d(0,"form",2)(1,"mat-card")(2,"mat-card-header",3)(3,"mat-card-title"),f(4),c()(),d(5,"mat-card-content")(6,"div",4)(7,"div",5)(8,"div"),f(9,"Type :"),c(),d(10,"div",6)(11,"mat-form-field",7)(12,"mat-select",8),v("selectionChange",function(r){return b(a),C(i.onActivityTypeChange(r))}),x(13,zi,3,2,"mat-option",9),c()()()(),x(14,Wi,1,0,"div",10)(15,Ji,6,3,"div",11),A(16,"div",12),x(17,Xi,5,0,"div",11),d(18,"div",5)(19,"div"),f(20,"Non comptabilisation de pr\xE9sence :"),c(),d(21,"div",6),A(22,"mat-checkbox",13),c()(),A(23,"div",12),d(24,"div",14)(25,"div",15),f(26,"Heure :"),c(),d(27,"div",6),A(28,"ngx-timepicker-field",16),x(29,Ki,2,8,"ng-template",null,0,mt)(31,Qi,2,8,"ng-template",null,1,mt),c(),d(33,"div")(34,"app-button",17),O(35,"translate"),v("onClick",function(){return b(a),C(i.resetTimeStarting())}),c()()(),x(36,Zi,1,0,"div",10)(37,ia,12,12,"div",18),A(38,"div",12),d(39,"div",5)(40,"div"),f(41,"Lieu :"),c(),d(42,"div")(43,"mat-form-field",7),A(44,"input",19),c()()()(),A(45,"div",12),d(46,"div",20)(47,"div")(48,"app-button",21),O(49,"translate"),v("onClick",function(){return b(a),C(i.onCancel())}),c()(),d(50,"div")(51,"app-button",22),O(52,"translate"),v("onClick",function(){return b(a),C(i.onDelete())}),c()(),d(53,"div")(54,"app-button",23),O(55,"translate"),v("onClick",function(){return b(a),C(i.onSave())}),c()()()()()()}if(e&2){let a=dt(30),n=dt(32);m("formGroup",i.form),l(4),P(i.title),l(9),m("ngForOf",i.allActivities),l(),m("ngIf",!i.isAnExtraTrainingDay(i.selectedActivityType)),l(),m("ngIf",!i.isAnExtraTrainingDay(i.selectedActivityType)),l(2),m("ngIf",!i.isAnExtraTrainingDay(i.selectedActivityType)),l(11),m("format",24)("defaultTime","00:00")("confirmBtnTmpl",a)("cancelBtnTmpl",n),l(6),T("x-buttonSeparator x-buttonNormalNo"),m("text",w(35,38,"Aucune"))("isBackgroun
1dOpaque",!0)("visibility",!0)("isAlwaysEnabled",!0),l(2),m("ngIf",i.isAnExtraTrainingDay(i.selectedActivityType)),l(),m("ngIf",i.isAnExtraTrainingDay(i.selectedActivityType)),l(7),Gt("width","72ch"),m("maxLength",200),l(4),T("x-buttonSeparator x-buttonNormalNo"),m("text",w(49,40,"Cancel"))("isBackgroundOpaque",!0)("visibility",!0),l(3),T("x-buttonSeparator x-buttonDelete"),m("visibility",i.isDeleteVisible)("text",w(52,42,"Delete"))("disabled",i.form.invalid)("isSubmit",!0),l(3),T("x-buttonSeparator x-buttonNormalYes"),m("text",w(55,44,"Save"))("disabled",i.form.invalid)("isSubmit",!0)("visibility",!0)}},dependencies:[K,ce,de,Ee,Oe,mi,Ke,Ie,we,Qe,je,Ae,bi,fi,Fe,Re,ke,Ne,ge,me,ue,he,pe,wt,xi,At,Q,Ai,Pi,re,ie],styles:[`:host{display:block}.x-timepicker-with-reset{display:flex;align-items:center;gap:12px}.x-label{width:100px}
2`],encapsulation:2})},at=class{constructor(t,e,i=null){this.date=t;this.team=e;this.tpOverride=i}};var Ei={TrainingPlayerAdminTitle:"Gestion des activit\xE9s au {{date}}",TrainingPlayerAdminColumnTeam:"\xC9quipe",TrainingPlayerAdminColumnEncoded:"Encodage du jour",TrainingPlayerAdminNone:"\u2014 aucun \u2014",TrainingPlayerAdminAdd:"Ajouter",TrainingPlayerAdminEdit:"Modifier"};var ki={TrainingPlayerAdminTitle:"Activities management for {{date}}",TrainingPlayerAdminColumnTeam:"Team",TrainingPlayerAdminColumnEncoded:"Entry for the day",TrainingPlayerAdminNone:"\u2014 none \u2014",TrainingPlayerAdminAdd:"Add",TrainingPlayerAdminEdit:"Edit"};function sa(s,t){if(s&1){let e=M();d(0,"div",11)(1,"div",12),f(2),c(),d(3,"div",13),f(4),c(),d(5,"div")(6,"app-button",14),v("onClick",function(){let a=b(e).$implicit,n=h();return C(n.onRowAction(a))}),c()()()}if(s&2){let e=t.$implicit;ri("x-trainingPlayerAdminRowEmpty",!e.tp),l(2),P(e.team.teamDisplay),l(2),P(e.resume),l(2),m("icon",e.tp?"edit":"add_box")("text","")("isBackgroundOpaque",!0)("visibility",!0)("isAlwaysEnabled",!0)}}var Rt=class{constructor(t){this.date=t}},Ft=class s{constructor(t,e,i,a,n,r){this.dialogRef=t;this.data=e;this.dialog=i;this.cacheService=a;this.subjectService=n;this.translateService=r;this.translateService.setTranslation("fr",Ei,!0),this.translateService.setTranslation("en",ki,!0),this.subjectService.IsButtonInLoadingSubject.next(!1),this.date=e.date,this.title=this.translateService.instant("TrainingPlayerAdminTitle",{date:p.activityDisplay(new Date(e.date),this.translateService,!0,!0)}),this.rebuild(),this.subjectService.IsTrainingPlayerCacheLoadedSubject.pipe(j(this.destroy$)).subscribe(o=>{o&&this.rebuild()}),this.subjectService.GlobalCacheLoadedStatusSubject.pipe(j(this.destroy$)).subscribe(o=>{(o===3||o===2)&&this.rebuild()})}date;title="";allRows=[];destroy$=new J;isExtraDayType(t){return t==I[5]||t==I[4]||t==I[2]}isPseudoTeam(t){let e=a=>(a??"").normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase(),i=`${e(t?.teamDisplay)} ${e(t?.teamCategory)}`;return i.includes("hors equipe")||i.includes("non classe")}rebuild(){let t=p.yyyyMmDd(new Date(this.date)),e=this.cacheService.getAllTrainingPlayers()??[],a=(this.cacheService.getAllTeamsWithoutPicture()??[]).filter(n=>(n.order??0)>0&&!this.isPseudoTeam(n)).sort((n,r)=>(n.order??0)-(r.order??0)).map(n=>{let r=e.find(o=>String(o.teamSysId)===String(n.sysId)&&o.type&&this.isExtraDayType(o.type)&&p.yyyyMmDd(new Date(o.day))===t)??null;return{team:n,tp:r,resume:r?this.resumeOf(r):this.translateService.instant("TrainingPlayerAdminNone")}});this.allRows=a}resumeOf(t){let e=[];e.push(this.translateService.instant(t.type)),t.extraTrainingTeam&&e.push(t.extraTrainingTeam);let i=t.extraTrainingTimeStarting&&t.extraTrainingTimeStarting!=="00:00"?t.extraTrainingTimeStarting:"",a=t.extraTrainingTimeEnding&&t.extraTrainingTimeEnding!=="00:00"?t.extraTrainingTimeEnding:"",n=i+(a?" \xE0 "+a:"");return n&&e.push(n),t.extraTrainingBuilding&&e.push(t.extraTrainingBuilding),e.join(" \xB7 ")}onRowAction(t){this.subjectService.IsButtonInLoadingSubject.next(!0),this.dialog.open(it,{panelClass:"x-dialogFormDimension",width:this.subjectService.isMobile()?"99vw":"600px",maxWidth:"calc(100vw - 20px)",maxHeight:"calc(100vh - 20px)",data:new at(this.date,t.team,t.tp)}).afterClosed().pipe(j(this.destroy$)).subscribe(()=>{this.rebuild(),this.subjectService.IsButtonInLoadingSubject.next(!1)})}onClose(){this.dialogRef.close(!1)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}static \u0275fac=function(e){return new(e||s)(g(De),g(Pe),g(Xe),g(q),g(G),g(Y))};static \u0275cmp=X({type:s,selectors:[["app-trainingPlayerAdmin"]],decls:26,vars:16,consts:[[1,"x-dialogCard"],[1,"x-dialogFormHeader","x-dialogFormHeaderColor"],[1,"x-dialogFormHeaderContent","x-flexSpaceBetween"],[1,"x-flexStart"],[1,"material-icons","x-iconMatCardTitleOffset"],["icon","close",3,"onClick","text","isBackgroun
2dOpaque","visibility","isAlwaysEnabled"],[1,"x-dialogFormModalContent"],["mat-dialog-content",""],[1,"x-dialogScrollable"],[1,"x-trainingPlayerAdminRow","x-trainingPlayerAdminHeaderRow"],["class","x-trainingPlayerAdminRow",3,"x-trainingPlayerAdminRowEmpty",4,"ngFor","ngForOf"],[1,"x-trainingPlayerAdminRow"],[1,"x-trainingPlayerAdminTeam"],[1,"x-fontSmall"],[3,"onClick","icon","text","isBackgroundOpaque","visibility","isAlwaysEnabled"]],template:function(e,i){e&1&&(d(0,"mat-card",0)(1,"div",1)(2,"mat-card-header")(3,"div",2)(4,"div",3)(5,"span",4),f(6,"edit_calendar"),c(),d(7,"div")(8,"mat-card-title"),f(9),c()()(),d(10,"div")(11,"app-button",5),O(12,"translate"),v("onClick",function(){return i.onClose()}),c()()()()(),d(13,"mat-card-content",6)(14,"div")(15,"div",7)(16,"div",8)(17,"div",9)(18,"div"),f(19),O(20,"translate"),c(),d(21,"div"),f(22),O(23,"translate"),c(),A(24,"div"),c(),x(25,sa,7,9,"div",10),c()()()()()),e&2&&(l(9),P(i.title),l(2),T("x-buttonNormalNo"),m("text",w(12,10,"Close"))("isBackgroundOpaque",!0)("visibility",!0)("isAlwaysEnabled",!0),l(8),P(w(20,12,"TrainingPlayerAdminColumnTeam")),l(3),P(w(23,14,"TrainingPlayerAdminColumnEncoded")),l(3),m("ngForOf",i.allRows))},dependencies:[K,ce,ge,me,ue,he,pe,At,Q,re,ie],styles:[`@charset "UTF-8";.x-trainingPlayerAdminRow{display:grid;grid-template-columns:160px 1fr 44px;align-items:center;gap:10px;padding:6px 8px;border-bottom:1px solid rgba(255,255,255,.1)}.x-trainingPlayerAdminHeaderRow{font-weight:700;opacity:.85;border-bottom:1px solid rgba(255,255,255,.25)}.x-trainingPlayerAdminRowEmpty{opacity:.75}.x-trainingPlayerAdminTeam{font-weight:600}@media screen and (max-width: 480px){.x-trainingPlayerAdminRow{grid-template-columns:110px 1fr 40px;gap:6px;font-size:13px}}
3`],encapsulation:2})};var Ni={TrainingPlayersManagerAbsent:"Absent",TrainingPlayersManagerAddPlayer:"Ajouter un joueur",TrainingPlayersManagerAvailabilityTitle:"Disponibilit\xE9s au {{date}}",TrainingPlayersManagerCancel:"Annuler",TrainingPlayersManagerDate:"Date",TrainingPlayersManagerExcused:"Excus\xE9",TrainingPlayersManagerNoTraining:"Aucun entra\xEEnement s\xE9lectionn\xE9",TrainingPlayersManagerPlayer:"Joueur",TrainingPlayersManagerPresent:"Pr\xE9sent",TrainingPlayersManagerRemovePlayer:"Retirer",TrainingPlayersManagerSave:"Enregistrer",TrainingPlayersManagerSelectTraining:"S\xE9lectionner un entra\xEEnement",TrainingPlayersManagerTitle:"Gestion des pr\xE9sences"};var ji={TrainingPlayersManagerAbsent:"Absent",TrainingPlayersManagerAddPlayer:"Add player",TrainingPlayersManagerAvailabilityTitle:"Availability for {{date}}",TrainingPlayersManagerCancel:"Cancel",TrainingPlayersManagerDate:"Date",TrainingPlayersManagerExcused:"Excused",TrainingPlayersManagerNoTraining:"No training selected",TrainingPlayersManagerPlayer:"Player",TrainingPlayersManagerPresent:"Present",TrainingPlayersManagerRemovePlayer:"Remove",TrainingPlayersManagerSave:"Save",TrainingPlayersManagerSelectTraining:"Select a training",TrainingPlayersManagerTitle:"Attendance management"};var da=()=>["elderly","visibility"],ma=()=>["elderly","visibility_off"];function pa(s,t){if(s&1){let e=M();d(0,"div")(1,"div",3)(2,"div")(3,"app-button",17),v("onClick",function(){b(e);let a=h();return C(a.onSaveAll())}),c()(),d(4,"div")(5,"app-button",18),v("onClick",function(){b(e);let a=h();return C(a.turnOnOffAvailabilitiesVisibility())}),c()(),d(6,"div")(7,"app-button",19),v("onClick",function(){b(e);let a=h();return C(a.onDiscardAll())}),c()()()()}if(s&2){let e=h();l(3),T("x-buttonNormalNo"),m("text","")("isBackgroundOpaque",!0)("visibility",!0)("disabled",!e.isDirty),l(2),m("icon",e.isAvailabilitiesDisplayed?Yt(16,da):Yt(17,ma))("text","")("isAlwaysEnabled",!0)("visibility",!0),l(2),T("x-buttonNormalNo"),m("text","")("isBackgroundOpaque",!0)("visibility",!0)("disabled",!e.isDirty)}}function ua(s,t){if(s&1&&(d(0,"div")(1,"div",26),f(2),c()()),s&2){let e=h(),i=e.$implicit,a=e.index,n=h();T(n.allButtonClass[a+n.allCoachsOfTeamOfCurrentUser.length]),l(2),P(n.getPresenceIcon(i))}}function ha(s,t){if(s&1&&(d(0,"mat-option",32),R(1),f(2),F(),c()),s&2){let e=t.$implicit;m("value",e.value),l(2),P(e.viewValue)}}function ga(s,t){if(s&1){let e=M();d(0,"div",27)(1,"div")(2,"app-button",28),v("onClick",function(){b(e);let a=h(),n=a.$implicit,r=a.index,o=h();return C(o.onChangeToNotPresent(n,r+o.allCoachsOfTeamOfCurrentUser.length,o.team))}),c()(),d(3,"div")(4,"mat-form-field",29)(5,"mat-select",30),v("selectionChange",function(a){b(e);let n=h(),r=n.$implicit,o=n.index,y=h();return C(y.onReasonSelect(a.value,r,o+y.allCoachsOfTeamOfCurrentUser.length))}),x(6,ha,3,2,"mat-option",31),c()()(),d(7,"div")(8,"app-button",28),v("onClick",function(){b(e);let a=h(),n=a.$implicit,r=a.index,o=h();return C(o.onChangeToGuard(n,r+o.allCoachsOfTeamOfCurrentUser.length,o.team))}),c()()()}if(s&2){let e=h(2);
3l(2),T("x-notPresentColor"),m("icon","thumb_down")("isBackgroundOpaque",!0)("text","")("visibility",!0),l(4),m("ngForOf",e.allReasons),l(2),T("x-guardColor x-space"),m("icon","thumbs_up_down")("isBackgroundOpaque",!0)("text","")("visibility",!0)}}function ya(s,t){if(s&1&&(d(0,"mat-option",32),R(1),f(2),F(),c()),s&2){let e=t.$implicit;m("value",e.value),l(2),P(e.viewValue)}}function va(s,t){if(s&1){let e=M();d(0,"div",27)(1,"div")(2,"app-button",28),v("onClick",function(){b(e);let a=h(),n=a.$implicit,r=a.index,o=h();return C(o.onChangeToNotPresent(n,r+o.allCoachsOfTeamOfCurrentUser.length,o.team))}),c()(),d(3,"div")(4,"mat-form-field",29)(5,"mat-select",30),v("selectionChange",function(a){b(e);let n=h(),r=n.$implicit,o=n.index,y=h();return C(y.onReasonSelect(a.value,r,o+y.allCoachsOfTeamOfCurrentUser.length))}),x(6,ya,3,2,"mat-option",31),c()()(),d(7,"div")(8,"app-button",28),v("onClick",function(){b(e);let a=h(),n=a.$implicit,r=a.index,o=h();return C(o.onChangeToPresent(n,r+o.allCoachsOfTeamOfCurrentUser.length,o.team))}),c()()()}if(s&2){let e=h(2);l(2),T("x-notPresentColor"),m("icon","thumb_down")("isBackgroundOpaque",!0)("text","")("visibility",!0),l(4),m("ngForOf",e.allReasons),l(2),T("x-presentColor"),m("icon","thumb_up")("isBackgroundOpaque",!0)("text","")("visibility",!0)}}function fa(s,t){if(s&1&&(d(0,"mat-option",32),R(1),f(2),F(),c()),s&2){let e=t.$implicit;m("value",e.value),l(2),P(e.viewValue)}}function ba(s,t){if(s&1){let e=M();d(0,"div",27)(1,"div")(2,"mat-form-field",29)(3,"mat-select",30),v("selectionChange",function(a){b(e);let n=h(),r=n.$implicit,o=n.index,y=h();return C(y.onReasonSelect(a.value,r,o+y.allCoachsOfTeamOfCurrentUser.length))}),x(4,fa,3,2,"mat-option",31),c()()(),d(5,"div")(6,"app-button",28),v("onClick",function(){b(e);let a=h(),n=a.$implicit,r=a.index,o=h();return C(o.onChangeToNotPresent(n,r+o.allCoachsOfTeamOfCurrentUser.length,o.team))}),c()(),d(7,"div")(8,"app-button",28),v("onClick",function(){b(e);let a=h(),n=a.$implicit,r=a.index,o=h();return C(o.onChangeToGuard(n,r+o.allCoachsOfTeamOfCurrentUser.length,o.team))}),c()(),d(9,"div")(10,"app-button",28),v("onClick",function(){b(e);let a=h(),n=a.$implicit,r=a.index,o=h();return C(o.onChangeToPresent(n,r+o.allCoachsOfTeamOfCurrentUser.length,o.team))}),c()()()}if(s&2){let e=h(2);l(4),m("ngForOf",e.allReasons),l(2),T("x-notPresentColor x-space"),m("icon","thumb_down")("isBackgroundOpaque",!0)("text","")("visibility",!0),l(2),T("x-guardColor x-space"),m("icon","thumbs_up_down")("isBackgroundOpaque",!0)("text","")("visibility",!0),l(2),T("x-presentColor"),m("icon","thumb_up")("isBackgroundOpaque",!0)("text","")("visibility",!0)}}function Ca(s,t){if(s&1&&(R(0),d(1,"div",3)(2,"div"),f(3),c(),d(4,"div"),f(5),O(6,"translate"),O(7,"translate"),c()(),F()),s&2){let e=t.$implicit,i=h(3);l(3),P(i.activityDisplay(e.day)),l(2),Be("",w(6,3,e.type)," / ",w(7,5,"REASON_"+e.reason))}}function Sa(s,t){if(s&1&&(d(0,"div",33),x(1,Ca,8,7,"ng-container",12),c()),s&2){let e=h().$implicit,i=h();l(),m("ngForOf",i.getAllAvailability(e))}}function Ta(s,t){if(s&1){let e=M();R(0,null,0),d(2,"div")(3,"div",20)(4,"div")(5,"app-button",21),v("onClick",function(){let a=b(e),n=a.$implicit,r=a.index,o=h();return C(o.onEditPresence(n,r+o.allCoachsOfTeamOfCurrentUser.length))}),c()(),x(6,ua,3,3,"div",22),d(7,"div",23),f(8),c(),d(9,"div",7),f(10),c()(),x(11,ga,9,13,"div",24)(12,va,9,13,"div",24)(13,ba,11,19,"div",24)(14,Sa,2,1,"div",25),c(),A(15,"div",13),F()}if(s&2){let e=t.$implicit,i=t.index,a=h();l(5),T(a.allButtonClass[i+a.allCoachsOfTeamOfCurrentUser.length]),m("visibility",a.isMemberCoachsOrAssistantOrSupervisorConnected)("text",a.getReasonTranslated(e))("isBackgroundOpaque",!0),l(),m("ngIf",!a.isMemberCoachsOrAssistantOrSupervisorConnected),l(2),P(e.firstName),l(2),Be("",e.lastName," ",a.getJacketNumber(e)),l(),m("ngIf",a.editionIndexVisible==i+a.allCoachsOfTeamOfCurrentUser.length&&a.getAvailability(e)==a.EnumAvailability.PRESENT),l(),m("ngIf",a.editionIndexVisible==i+a.allCoachsOfTeamOfCurrentUser.length&&a.getAvailability(e)==a.EnumAvailability.GUARD),l(),m("ngIf",a.editionIndexVisible==i+a.allCoachsOfTeamOfCurrentUser.length&&a.getAvailability(e)==a.EnumAvailability.NOTPRESENT),l(),m("ngIf",a.isAvailabilitiesDisplayed&&a.getAllAvailability(e).length>0&&(e.sysId==a.storageService.getUserConnected().sysId||a.isMemberCoachsOrAssistantOrSupervisorConnected))}}function _a(s,t){if(s&1&&(d(0,"div")(1,"div",26),f(2),c()()),s&2){let e=h(),i=e.$implicit,a=e.index,n=h();T(n.allButtonClass[a]),l(2),P(n.getPresenceIcon(i))}}function xa(s,t){if(s&1&&(d(0,"mat-option",32),R(1),f(2),F(),c()),s&2){let e=t.$implicit;m("value",e.value),l(2),P(e.viewValue)}}function Da(s,t){if(s&1){let e=M();d(0,"div",27)(1,"div")(2,"app-button",28),v("onClick",function(){b(e);let a=h(),n=a.$implicit,r=a.index,o=h();return C(o.onChangeToNotPresent(n,r,o.team))}),c()(),d(3,"div")(4,"mat-form-field",29)(5,"mat-select",30),v("selectionChange",function(a){b(e);let n=h(),r=n.$implicit,o=n.index,y=h();return C(y.onReasonSelect(a.value,r,o))}),x(6,xa,3,2,"mat-option",31),c()()(),d(7,"div")(8,"app-button",28),v("onClick",function(){b(e);let a=h(),n=a.$implicit,r=a.index,o=h();return C(o.onChangeToGuard(n,r,o.team))}),c()()()}if(s&2){let e=h(2);
3l(2),T("x-notPresentColor"),m("icon","thumb_down")("isBackgroundOpaque",!0)("text","")("visibility",!0),l(4),m("ngForOf",e.allReasons),l(2),T("x-guardColor"),m("icon","thumbs_up_down")("isBackgroundOpaque",!0)("text","")("visibility",!0)}}function Pa(s,t){if(s&1&&(d(0,"mat-option",32),R(1),f(2),F(),c()),s&2){let e=t.$implicit;m("value",e.value),l(2),P(e.viewValue)}}function Aa(s,t){if(s&1){let e=M();d(0,"div",27)(1,"div")(2,"app-button",28),v("onClick",function(){b(e);let a=h(),n=a.$implicit,r=a.index,o=h();return C(o.onChangeToNotPresent(n,r,o.team))}),c()(),d(3,"div")(4,"mat-form-field",29)(5,"mat-select",30),v("selectionChange",function(a){b(e);let n=h(),r=n.$implicit,o=n.index,y=h();return C(y.onReasonSelect(a.value,r,o))}),x(6,Pa,3,2,"mat-option",31),c()()(),d(7,"div")(8,"app-button",28),v("onClick",function(){b(e);let a=h(),n=a.$implicit,r=a.index,o=h();return C(o.onChangeToPresent(n,r,o.team))}),c()()()}if(s&2){let e=h(2);l(2),T("x-notPresentColor"),m("icon","thumb_down")("isBackgroundOpaque",!0)("text","")("visibility",!0),l(4),m("ngForOf",e.allReasons),l(2),T("x-presentColor"),m("icon","thumb_up")("isBackgroundOpaque",!0)("text","")("visibility",!0)}}function Ia(s,t){if(s&1&&(d(0,"mat-option",32),R(1),f(2),F(),c()),s&2){let e=t.$implicit;m("value",e.value),l(2),P(e.viewValue)}}function Ma(s,t){if(s&1){let e=M();d(0,"div",27)(1,"div")(2,"mat-form-field",29)(3,"mat-select",30),v("selectionChange",function(a){b(e);let n=h(),r=n.$implicit,o=n.index,y=h();return C(y.onReasonSelect(a.value,r,o))}),x(4,Ia,3,2,"mat-option",31),c()()(),d(5,"div")(6,"app-button",28),v("onClick",function(){b(e);let a=h(),n=a.$implicit,r=a.index,o=h();return C(o.onChangeToNotPresent(n,r,o.team))}),c()(),d(7,"div")(8,"app-button",28),v("onClick",function(){b(e);let a=h(),n=a.$implicit,r=a.index,o=h();return C(o.onChangeToGuard(n,r,o.team))}),c(),d(9,"app-button",28),v("onClick",function(){b(e);let a=h(),n=a.$implicit,r=a.index,o=h();return C(o.onChangeToPresent(n,r,o.team))}),c()()()}if(s&2){let e=h(2);l(4),m("ngForOf",e.allReasons),l(2),T("x-notPresentColor x-space"),m("icon","thumb_down")("isBackgroundOpaque",!0)("text","")("visibility",!0),l(2),T("x-guardColor x-space"),m("icon","thumbs_up_down")("isBackgroundOpaque",!0)("text","")("visibility",!0),l(),T("x-presentColor"),m("icon","thumb_up")("isBackgroundOpaque",!0)("text","")("visibility",!0)}}function Oa(s,t){if(s&1&&(R(0),d(1,"div",3)(2,"div"),f(3),c(),d(4,"div"),f(5),O(6,"translate"),O(7,"translate"),c()(),F()),s&2){let e=t.$implicit,i=h(3);l(3),P(i.activityDisplay(e.day)),l(2),Be("",w(6,3,e.type)," / ",w(7,5,"REASON_"+e.reason))}}function wa(s,t){if(s&1&&(d(0,"div",33),x(1,Oa,8,7,"ng-container",12),c()),s&2){let e=h().$implicit,i=h();l(),m("ngForOf",i.getAllAvailabilityOfCoach(e))}}function Ea(s,t){if(s&1){let e=M();R(0,null,0),d(2,"div")(3,"div",20)(4,"div")(5,"app-button",34),v("onClick",function(){let a=b(e),n=a.$implicit,r=a.index,o=h();return C(o.onEditPresence(n,r))}),c()(),x(6,_a,3,3,"div",22),d(7,"div",23),f(8),c(),d(9,"div",7),f(10),c()(),x(11,Da,9,13,"div",24)(12,Aa,9,13,"div",24)(13,Ma,10,19,"div",24)(14,wa,2,1,"div",25),c(),F()}if(s&2){let e=t.$implicit,i=t.index,a=h();l(5),T(a.allButtonClass[i]),m("visibility",a.isMemberCoachsOrAssistantOrSupervisorConnected)("text",a.getReasonTranslated(e)),l(),m("ngIf",!a.isMemberCoachsOrAssistantOrSupervisorConnected),l(2),P(e.firstName),l(2),Be("",e.lastName," ",a.getJacketNumber(e)),l(),m("ngIf",a.editionIndexVisible==i&&a.getAvailability(e)==a.EnumAvailability.PRESENT),l(),m("ngIf",a.editionIndexVisible==i&&a.getAvailability(e)==a.EnumAvailability.GUARD),l(),m("ngIf",a.editionIndexVisible==i&&a.getAvailability(e)==a.EnumAvailability.NOTPRESENT),l(),m("ngIf",a.editionIndexVisible==i&&a.getAllAvailabilityOfCoach(e).length>0)}}var Ut=class s{constructor(t,e,i,a,n,r,o,y,E,se,le,Ye){this.dialogRef=t;this.data=e;this.accessRightsService=i;this.frameworkService=a;this.translateService=n;this.trainingPlayerService=r;this.cacheService=o;this.subjectService=y;this.storageService=E;this.encryptionService=se;this.dialog=le;this.cdr=Ye;this.translateService.setTranslation("fr",Ni,!0),this.translateService.setTranslation("en",ji,!0);try{this.pieChartOptions.plugins.legend.position=this.subjectService.isMobile()?"to
3p":"right"}catch{}this.form.addControl("allReasons",new B("")),this.subjectService.IsButtonInLoadingSubject.next(!1),this.date=e.date,this.team=e.team,this.isMemberCoachsOrAssistantOrSupervisorConnected=this.accessRightsService.isMemberCoachsOrAssistantOrSupervisorOfTeam(this.storageService.getUserConnected(),this.team),this.isCoachOnlyConnected=this.accessRightsService.isMemberCoachOnly(this.storageService.getUserConnected()),this.title=this.translateService.instant("TrainingPlayersManagerAvailabilityTitle",{date:p.activityDisplay(new Date(e.date),this.translateService,!0)}),this.loadCacheDataAndInitialize()}chartColors=["#2c662c","#ddbb25","#c03030"];pieChartPlugins=[];pieChartType="doughnut";pieChartData={datasets:[],labels:[]};pieChartLabels;pieChartLegend=!0;pieChartOptions={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"right",labels:{color:"#ffffff",boxWidth:12,padding:6,font:{size:11}}},tooltip:{titleColor:"#ffffff",bodyColor:"#ffffff",backgroundColor:"rgba(0,0,0,0.7)"}}};EnumAvailability=Je;EnumAvailabilityReason=xe;allButtonClass=[];allClubEventsOfUserAuthenticated;allCoachsOfTeamOfCurrentUser=[];allReasons=[];allUsersOfTeamOfCurrentUser=[];date;editionIndexVisible=-1;eventClub=null;form=new Me({});isCoachOnlyConnected=!1;isMemberCoachsOrAssistantOrSupervisorConnected=!1;playersNotPresentTotal=0;playersPresentTotal=0;subTitle;title;team;isAvailabilitiesDisplayed=!1;modifiedTrainingPlayers=new Map;isDirty=!1;destroy$=new J;async loadCacheDataAndInitialize(){try{await Promise.all([this.cacheService.loadTrainingPlayersCache(!0),this.cacheService.loadUsersCache(!0)]),this.initialize(),this.cdr.detectChanges()}catch(t){console.error("Error loading training players manager data:",t),this.initialize(),this.cdr.detectChanges()}this.subjectService.IsTrainingPlayerCacheLoadedSubject.pipe(j(this.destroy$)).subscribe(t=>{t&&(this.initialize(),this.cdr.detectChanges())}),this.allReasons=this.frameworkService.getNonPresenceReason()}getAllAvailability(t){return this.cacheService.getAllTrainingPlayers().filter(e=>e.playerSysId==t.sysId&&e.teamSysId==this.team.sysId).sort((e,i)=>e.day>i.day?1:e.day<i.day?-1:0)}getAllAvailabilityOfCoach(t){return this.cacheService.getAllTrainingPlayers().filter(e=>e.playerSysId==t.sysId&&e.teamSysId==this.team.sysId&&e.present==0&&p.yyyyMmDd(new Date(e.day))>=p.yyyyMmDd(new Date(this.date))).sort((e,i)=>e.day>i.day?1:e.day<i.day?-1:0)}getAvailability(t){let e=this.getModifiedTrainingPlayerForUser(t);if(e!=null)return this.cacheService.getAvailabilityFromTrainingPlayer(e);let i=this.cacheService.getAllTrainingPlayers().find(a=>a.playerSysId==t.sysId&&a.teamSysId==this.team.sysId&&p.yyyyMmDd(new Date(a.day))==p.yyyyMmDd(new Date(this.date)));return this.cacheService.getAvailabilityFromTrainingPlayer(i)}getAvailabilityClass(t){var e="";if(t!=null){let i=this.getModifiedTrainingPlayerForUser(t);if(i!=null){let a=i;e=a.present==null?"x-guardColor":a.present>=1?" x-presentColor":" x-notPresentColor"}else{let a=this.cacheService.getAllTrainingPlayers().find(n=>n.playerSysId==t.sysId&&n.teamSysId==this.team.sysId&&p.yyyyMmDd(new Date(n.day))==p.yyyyMmDd(new Date(this.date)));a!=null?e=a.present==null?"x-guardColor":a.present>=1?" x-presentColor":" x-notPresentColor":e="x-presentColor"}}else e="";return e}activityDisplay(t){return p.activityDisplay(new Date(t),this.translateService,!0)}getJacketNumber(t){return this.frameworkService.getJacketNumber(t)}getPresenceIcon(t){let e=this.getModifiedTrainingPlayerForUser(t);if(e!=null){let a=e;return a.present==null?"thumbs_up_down":a.present>=1?"thumb_up":"thumb_down"}let i=this.cacheService.getAllTrainingPlayers().find(a=>a.playerSysId==t.sysId&&a.teamSysId==this.team.sysId&&p.yyyyMmDd(new Date(a.day))==p.yyyyMmDd(new Date(this.date)));return i!=null?i.present==null?"thumbs_up_down":i.present>=1?"thumb_up":"thumb_down":"thumb_up"}getReason(t){let e=this.getModifiedTrainingPlayerForUser(t);if(e!=null)return e.reason;let i=this.cacheService.getAllTrainingPlayers().find(a=>a.playerSysId==t.sysId&&a.teamSysId==this.team.sysId&&p.yyyyMmDd(new Date(a.day))==p.yyyyMmDd(new Date(this.date)));return i!=null?i.reason:""}getReasonTranslated(t){let e=this.getModifiedTrainingPlayerForUser(t);if(e!=null)return e.reason!=""?this.translateService.instant("REASON_"+e.reason):"";let i=this.cacheService.getAllTrainingPlayers().find(a=>a.playerSysId==t.sysId&&a.teamSysId==this.team.sysId&&p.yyyyMmDd(new Date(a.day))==p.yyyyMmDd(new Date(this.date)));return i!=null&&i.reason!=""?this.translateService.instant("REASON_"+i.reason):""}makeKey(t){return`${t.sysId}|${p.databaseDateOnly(this.date)}`}resolveActivityTypeForDate(){if(this.isATrainingDay())return ee[7];let t=this.cacheService.getExtraTrainingOfCoachFromDate(this.date);return t?.type?t.type:this.cacheService.getEventClubWithTraining(this.allClubEventsOfUserAuthenticated,this.date,this.team)?.event?.type??ee[7]}getModifiedTrainingPlayerForUser(t){let e=this.makeKey(t);return this.modifiedTrainingPlayers.has(e)?this.modifiedTrainingPlayers.get(e):null}markModified(t,e){let i=this.makeKey(e),a=Object.assign(new $,JSON.parse(JSON.stringify(t))),n=this.modifiedTrainingPlayers.get(i);if(n!=null){let o={present:n.present,reason:n.reason,type:n.type},y={present:a.present,reason:a.reason,type:a.type};if(JSON.stringify(o)===JSON.stringify(y)){this.modifiedTrainingPlayers.delete(i),this.isDirty=this.modifiedTrainingPlayers.size>0,this.recalculateTotals(),this.cdr.detectChanges();return}}let r=this.cacheService.getAllTrainingPlayers().find(o=>o.playerSysId==e.sysId&&o.teamSysId==this.team.sysId&&p.yyyyMmDd(new Date(o.day))==p.yyyyMmDd(new Date(this.date)));if(r!=null){let o={present:r.present,reason:r.reason,type:r.type},y={present:a.present,reason:a.reason,type:a.type};if(JSON.stringify(o)===JSON.stringify(y)){this.modifiedTrainingPlayers.delete(i),this.isDirty=this.modifiedTrainingPlayers.size>0,this.recalculateTotals(),this.cdr.detectChanges();return}}this.modifiedTrainingPlayers.set(i,a),this.isDirty=this.modifiedTrainingPlayers.size>0,this.recalculateTotals(),this.cdr.detectChanges()}onDiscardAll(){this.modifiedTrainingPlayers.clear(),this.subjectService.IsButtonInLoadingSubject.next(!1),this.isDirty=!1,this.initialize()}onReasonSelect(t,e,i){try{let a=this.getModifiedTrainingPlayerForUser(e);if(a==null){let n=this.cacheService.getAllTrainingPlayers().find(o=>o.playerSysId==e.sysId&&o.teamSysId==this.team.sysId&&p.yyyyMmDd(new Date(o.day))==p.yyyyMmDd(new Date(this.date))),r;n==null?(r=new $,r.day=p.databaseDateOnly(this.date),r.type=this.resolveActivityTypeForDate(),r.championshipSysId=this.cacheService.getCurrentChampionship().sysId,r.playerSysId=e.sysId,r.teamSysId=this.team.sysId,r.championship=null,r.player=null,r.present=0):r=Object.assign(new $,JSON.parse(JSON.stringify(n))),r.reason=t,this.markModified(r,e)}else a.reason=t,this.markModified(a,e);this.allButtonClass[i]=this.getAvailabilityClass(e),this.editionIndexVisible=i,this.subjectService.IsButtonInLoadingSubject.next(!1)}catch{this.subjectService.IsButtonInLoadingSubject.next(!1)}}async onSaveAll(){if(this.modifiedTrainingPlayers.size==0){this.frameworkService.displayAlertWarning("No changes to save");return}this.subjectService.IsButtonInLoadingSubject.next(!0);let t=!1;for(let[e,i]of this.modifiedTrainingPlayers.entries())try{this.cacheService.getAllTrainingPlayers().some(n=>n.playerSysId==i.playerSysId&&n.teamSysId==i.teamSysId&&p.yyyyMmDd(new Date(n.day))==p.yyyyMmDd(new Date(i.day)))?await new Promise((n,r)=>{this.trainingPlayerService.updateWithServerDateCheck(i,!1).pipe(j(this.destroy$)).subscribe({next:o=>{let y=this.encryptionService.decryptObject(!1,o.value);y!=null?(this.allClubEventsOfUserAuthenticated=this.cacheService.manageIUClubEventsOfUserAuthenticated(this.date,y,this.eventClub,this.team,!1,null),this.subjectService.IsTrainingPlayerCacheLoadedSubject.next(!0),n()):(t=!0,this.frameworkService.displayAlert(!1),n())},error:o=>{t=!0,this.frameworkService.displayAlert(null,o),n()}})}):await new Promise((n,r)=>{this.trainingPlayerService.insertWithServerDateCheck(i,!1).pipe(j(this.destroy$)).subscribe({next:o=>{let y=this.encryptionService.decryptObject(!1,o.value);y!=null?(this.allClubEventsOfUserAuthenticated=this.cacheService.manageIUClubEventsOfUserAuthenticated(this.date,y,this.eventClub,this.team,!0,null),this.subjectService.IsTrainingPlayerCacheLoadedSubject.next(!0),n()):(t=!0,this.frameworkService.displayAlert(!1),n())},error:o=>{t=!0,this.frameworkService.displayAlert(null,o),n()}})})}catch{t=!0}this.modifiedTrainingPlayers.clear(),this.subjectService.IsButtonInLoadingSubject.next(!1),this.isDirty=!1,this.initialize(),this.cdr.detectChanges(),t||this.frameworkService.displayAlert(!0)}initialize(){this.playersNotPresentTotal=0,this.playersPresentTotal=0,this.allClubEventsOfUserAuthenticated=this.cacheService.getAllClubEventsOfUserAuthenticated(),this.allCoachsOfTeamOfCurrentUser=this.cacheService.getAllCoachsOfCurrentLogged().sort((e,i)=>e.firstName+e.lastName<i.firstName+i.lastName?-1:1);let t=this.allCoachsOfTeamOfCurrentUser.map(function(e){return e.sysId});this.allUsersOfTeamOfCurrentUser=this.cacheService.getAllUsersOfTeamOfCurrentUser().filter(e=>e.sysId>2&&!t.includes(e.sysId)).sort((e,i)=>e.firstName+e.lastName<i.firstName+i.lastName?-1:1),this.allButtonClass=[],this.allCoachsOfTeamOfCurrentUser.forEach(e
3=>{this.allButtonClass.push(this.getAvailabilityClass(e))}),this.allUsersOfTeamOfCurrentUser.forEach(e=>{this.allButtonClass.push(this.getAvailabilityClass(e))}),this.recalculateTotals()}recalculateTotals(){this.playersNotPresentTotal=0,this.playersPresentTotal=0,this.allUsersOfTeamOfCurrentUser.forEach(a=>{this.getAvailability(a)==1?this.playersPresentTotal++:this.playersNotPresentTotal++});let t=Number(this.playersPresentTotal+this.playersNotPresentTotal),e=0,i=0;t>0&&(e=Number(this.playersPresentTotal)/t*100,i=Number(this.playersNotPresentTotal)/t*100),this.pieChartLabels=[`${e.toFixed(1)}% pr\xE9sent`,`${i.toFixed(1)}% absent`],this.pieChartData={labels:this.pieChartLabels,datasets:[{data:[e,i],backgroundColor:["#2e7d32","#c03030"],hoverBackgroundColor:["#b0b1b0","#b0b1b0"]}]}}isATrainingDay(){return this.cacheService.getAllTrainingDays().find(t=>t.day==new Date(this.date).getDay())!=null}isAnExtraDay(t){return t==I[4]||t==I[2]||t==I[5]}ngOnInit(){this.destroy$.next()}onCancel(){if(this.isDirty){let t=this.translateService.instant("Confirm"),e=this.translateService.instant("ThereAreUnsavedChanges"),i=this.translateService.instant("DoYouWantToCloseWithoutSaving"),a=new vi(t,e,i);this.dialog.open(yi,{panelClass:"x-dialogFormDimension",width:this.subjectService.isMobile()?"95vw":"400px",maxWidth:"calc(100vw - 20px)",maxHeight:"calc(100vh - 20px)",data:a}).afterClosed().pipe(j(this.destroy$)).subscribe(r=>{r===!0?this.dialogRef.close(!1):this.subjectService.IsButtonInLoadingSubject.next(!1)})}else this.dialogRef.close(!1)}async onChangeToGuard(t,e,i){try{let a="",n=!1,r,o=this.cacheService.getExtraTrainingOfCoachFromDate(this.date);this.storageService.getUserConnected().sysId==t.sysId?(this.eventClub=this.cacheService.getEventClubWithTraining(this.allClubEventsOfUserAuthenticated,this.date,i),r=this.cacheService.getAllTrainingPlayersOfCurrentLogged().find(y=>y.sysId==this.eventClub?.tpSysId),a=this.eventClub?.event?.type??this.resolveActivityTypeForDate()):(r=this.cacheService.getAllTrainingPlayers().find(y=>y.playerSysId==t.sysId&&y.teamSysId==this.team.sysId&&p.yyyyMmDd(new Date(y.day))==p.yyyyMmDd(new Date(this.date))),r==null?this.isATrainingDay()?a=ee[7]:a=o?.type??this.resolveActivityTypeForDate():this.isATrainingDay()?a=ee[7]:a=o?.type??this.resolveActivityTypeForDate()),r==null?(n=!0,r=new $,r.day=p.databaseDateOnly(this.date),r.type=a,r.championshipSysId=this.cacheService.getCurrentChampionship().sysId,r.playerSysId=this.storageService.getUserConnected().sysId==t.sysId?this.storageService.getUserConnected().sysId:t.sysId,r.teamSysId=this.team.sysId,r.championship=null,r.player=null,r.present=null,this.isAnExtraDay(r.type)&&o!=null&&(r.extraTrainingBuilding=o.extraTrainingBuilding,r.extraTrainingIsAtHome=o.extraTrainingIsAtHome,r.extraTrainingTeam=o.extraTrainingTeam,r.extraTrainingTimeStarting=o.extraTrainingTimeStarting,r.extraTrainingTimeEnding=o.extraTrainingTimeEnding,r.trainingPlayerSysId=o.sysId,r.isPresenceNotCounted=o.isPresenceNotCounted),this.isATrainingDay()&&(r.extraTrainingIsAtHome=!0,r.extraTrainingTimeStarting=this.cacheService.getAllTrainingDays().find(y=>y.day==new Date(this.date).getDay()).timeFrom,r.extraTrainingTimeEnding=this.cacheService.getAllTrainingDays().find(y=>y.day==new Date(this.date).getDay()).timeTo)):(r=Object.assign(new $,JSON.parse(JSON.stringify(r))),r.present=null),r.reason=xe[5],r.present=null,this.markModified(r,t),this.editionIndexVisible=-1,this.allButtonClass[e]=this.getAvailabilityClass(t),this.subjectService.IsButtonInLoadingSubject.next(!1)}catch{this.subjectService.IsButtonInLoadingSubject.next(!1)}}async onChangeToNotPresent(t,e,i){try{let a="",n=!1,r,o=this.cacheService.getExtraTrainingOfCoachFromDate(this.date);this.eventClub=this.cacheService.getEventClubWithTraining(this.allClubEventsOfUserAuthenticated,this.date,i),this.storageService.getUserConnected().sysId==t.sysId?(r=this.cacheService.getAllTrainingPlayersOfCurrentLogged().find(y=>y.sysId==this.eventClub?.tpSysId),a=this.eventClub?.event?.type??this.resolveActivityTypeForDate()):(r=this.cacheService.getAllTrainingPlayers().find(y=>y.playerSysId==t.sysId&&y.teamSysId==this.team.sysId&&p.yyyyMmDd(new Date(y.day))==p.yyyyMmDd(new Date(this.date))),r==null?this.isATrainingDay()?a=ee[7]:a=o?.type??this.eventClub?.event?.type??this.resolveActivityTypeForDate():this.isATrainingDay()?a=ee[7]:a=o?.type??this.eventClub?.event?.type??this.resolveActivityTypeForDate()),r==null?(n=!0,r=new $,r.day=p.databaseDateOnly(this.date),r.type=a,r.championshipSysId=this.cacheService.getCurrentChampionship().sysId,r.playerSysId=this.storageService.getUserConnected().sysId==t.sysId?this.storageService.getUserConnected().sysId:t.sysId,r.teamSysId=this.team.sysId,r.championship=null,r.player=null,r.present=0,this.isAnExtraDay(r.type)&&o!=null&&(r.extraTrainingBuilding=o.extraTrainingBuilding,r.extraTrainingIsAtHome=o.extraTrainingIsAtHome,r.extraTrainingTeam=o.extraTrainingTeam,r.extraTrainingTimeStarting=o.extraTrainingTimeStarting,r.extraTrainingTimeEnding=o.extraTrainingTimeEnding,r.trainingPlayerSysId=o.sysId,r.isPresenceNotCounted=o.isPresenceNotCounted)):(r=Object.assign(new $,JSON.parse(JSON.stringify(r))),r.present=0),r.reason=this.form.get("allReasons").value==""?xe[6]:this.form.get("allReasons").value,r.present=0,this.markModified(r,t),this.editionIndexVisible=-1,this.allButtonClass[e]=this.getAvailabilityClass(t),this.subjectService.IsButtonInLoadingSubject.next(!1)}catch{this.subjectService.IsButtonInLoadingSubject.next(!1)}}async onChangeToPresent(t,e,i){try{this.storageService.getUserConnected().sysId==t.sysId&&(this.eventClub=this.cacheService.getEventClubWithTraining(this.allClubEventsOfUserAuthenticated,this.date,i));let a=this.getModifiedTrainingPlayerForUser(t);if(a==null){let n=this.cacheService.getAllTrainingPlayers().find(r=>r.playerSysId==t.sysId&&r.teamSysId==this.team.sysId&&p.yyyyMmDd(new Date(r.day))==p.yyyyMmDd(new Date(this.date)));n==null?(n=new $,n.day=p.databaseDateOnly(this.date),n.type=this.resolveActivityTypeForDate(),n.championshipSysId=this.cacheService.getCurrentChampionship().sysId,n.playerSysId=t.sysId,n.teamSysId=this.team.sysId,n.championship=null,n.player=null):n=Object.assign(new $,JSON.parse(JSON.stringify(n))),n.present=1,n.reason="",this.markModified(n,t)}else a.present=1,a.reason="",this.markModified(a,t);this.allButtonClass[e]=this.getAvailabilityClass(t),this.editionIndexVisible=-1,this.subjectService.IsButtonInLoadingSubject.next(!1)}catch{this.subjectService.IsButtonInLoadingSubject.next(!1)}}onEditPresence(t,e){this.editionIndexVisible=e,this.form.get("allReasons").setValue(this.getReason(t)),this.subjectService.IsButtonInLoadingSubject.next(!1)}turnOnOffAvailabilitiesVisibility(){this.isAvailabilitiesDisplayed=!this.isAvailabilitiesDisplayed,this.subjectService.IsButtonInLoadingSubject.next(!1)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}static \u0275fac=function(e){return new(e||s)(g(De),g(Pe),g(ne),g(Z),g(Y),g(Ve),g(q),g(G),g(ae),g(Ue),g(Xe),g(We))};static \u0275cmp=X({type:s,selectors:[["tpm"]],decls:36,vars:21,consts:[["allButtons",""],[3,"formGroup"],[1,"x-matcardHeaderColor"],[1,"x-flexSpaceBetween"],[1,"x-presentColor","x-trainingPlayerManagerLegendAvailability"],[1,"x-trainingPlayerManagerLegendCenter"],[1,"x-notPresentColor","x-trainingPlayerManagerLegendAvailability"],[1,"x-fontSmall"],["icon","close",3,"onClick","text","isBackgroun
3dOpaque","visibility"],[1,"x-br1"],[4,"ngIf"],[1,"x-dialogScrollable"],[4,"ngFor","ngForOf"],[1,"x-br0"],[1,"x-trainingPlayerManagerBottomBorder"],[1,"x-trainingPlayerManagerChart"],["baseChart","",3,"data","labels","type","options","plugins","legend"],["icon","save",3,"onClick","text","isBackgroundOpaque","visibility","disabled"],[3,"onClick","icon","text","isAlwaysEnabled","visibility"],["icon","undo",3,"onClick","text","isBackgroundOpaque","visibility","disabled"],[1,"x-trainingPlayerManagerUserInfo"],["icon","expand_more",3,"onClick","visibility","text","isBackgroundOpaque"],[3,"class",4,"ngIf"],[1,"x-fontBig"],["class","x-flexStart x-trainingPlayerManagerEditionPanel",4,"ngIf"],["class","x-trainingPlayerManagerPanel",4,"ngIf"],[1,"material-icons"],[1,"x-flexStart","x-trainingPlayerManagerEditionPanel"],[3,"onClick","icon","isBackgroundOpaque","text","visibility"],["appearance","fill"],["placeholder","(motif)","formControlName","allReasons",1,"x-trainingPlayerManagerDropDown","x-space","x-spaceBefore",3,"selectionChange"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],[1,"x-trainingPlayerManagerPanel"],["icon","expand_more",3,"onClick","visibility","text"]],template:function(e,i){e&1&&(d(0,"form",1)(1,"mat-card")(2,"mat-card-header",2)(3,"mat-card-title")(4,"div"),f(5),c()(),d(6,"mat-card-subtitle")(7,"div",3)(8,"div",3)(9,"div")(10,"span",4)(11,"div",5),f(12),c()()(),d(13,"div")(14,"span",6)(15,"div",5),f(16),c()()(),d(17,"div")(18,"span",7),f(19),c()()(),d(20,"div")(21,"app-button",8),O(22,"translate"),v("onClick",function(){return i.onCancel()}),c()()(),A(23,"div",9),x(24,pa,8,18,"div",10),c()(),d(25,"mat-card-content")(26,"div",11),x(27,Ta,16,13,"ng-container",12),A(28,"div",13),d(29,"div"),f(30,"COACHS"),c(),A(31,"div",14)(32,"div",13),x(33,Ea,15,12,"ng-container",12),d(34,"div",15),A(35,"canvas",16),c()()()()()),e&2&&(m("formGroup",i.form),l(5),P(i.title),l(7),P(i.playersPresentTotal),l(4),_e("",i.playersNotPresentTotal," "),l(3),_e(" (",i.playersNotPresentTotal+i.playersPresentTotal," joueurs) "),l(2),T("x-buttonNormalNo"),m("text",w(22,19,"Close"))("isBackgroundOpaque",!0)("visibility",!0),l(3),m("ngIf",i.isMemberCoachsOrAssistantOrSupervisorConnected),l(3),m("ngForOf",i.allUsersOfTeamOfCurrentUser),l(6),m("ngForOf",i.allCoachsOfTeamOfCurrentUser),l(2),m("data",i.pieChartData)("labels",i.pieChartLabels)("type",i.pieChartType)("options",i.pieChartOptions)("plugins",i.pieChartPlugins)("legend",i.pieChartLegend))},dependencies:[K,ce,de,Ee,Oe,Ke,Ie,we,Qe,je,Ae,Fe,Re,ke,Ne,ge,me,ue,he,gi,pe,Q,Ot,Mt,re,ie],styles:['@charset "UTF-8";[_ngcontent-%COMP%]:root{--bgc-primary: #c4392e;--bgc-navbarPrimary: #1a1512;--bgc-primary-fade: rgba(196, 57, 46, .1);--fc-primary: #f5f0ec;--brand-700: #8a2820;--brand-600: #a33028;--brand-mid: #c4392e;--brand-400: #d4463a;--brand-alt: #e8564a;--brand-3: #6e2018;--brand-700-rgb: 138, 40, 32;--brand-600-rgb: 163, 48, 40;--brand-mid-rgb: 196, 57, 46;--brand-400-rgb: 212, 70, 58;--brand-alt-rgb: 232, 86, 74;--brand-3-rgb: 110, 32, 24;--surface-base: #120e0c;--surface-1: #1a1512;--surface-2: #231c18;--surface-3: #2d2420;--surface-4: #382e28;--border-subtle: #3a2e28;--border-default: #4a3a32;--text-primary: #f5f0ec;--text-secondary: #e9d9d9;--text-muted: #7a6a5a;--bgc-comitee-normal: #1a2744;--fc-comitee-normal: #8aa0b8;--bgc-comitee-technical: #1e2c24;--fc-comitee-technical: #8aa890;--bgc-comitee-strategic: #3a263e;--fc-comitee-strategic: #b89ab0}[_nghost-%COMP%]   canvas[_ngcontent-%COMP%]{touch-action:pan-y!important}[_nghost-%COMP%]{display:flex;flex-direction:column;height:100%;min-height:0}[_nghost-%COMP%]   form[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;min-height:0}[_nghost-%COMP%]   mat-card[_ngcontent-%COMP%]{flex:1 1 auto;min-height:0}[_nghost-%COMP%]   mat-card-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1 1 auto;min-height:0}[_nghost-%COMP%]   .x-dialogScrollable[_ngcontent-%COMP%]{flex:1 1 auto;min-height:0;max-height:none!important;overflow-y:auto}.x-trainingPlayerManagerAvailabilitySize[_ngcontent-%COMP%]{border-radius:5px;width:30px;height:30px;padding:5px;display:inline-block}.x-trainingPlayerManagerUserInfo[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:nowrap;background-color:#2b1212ce;box-sizing:border-box}.x-trainingPlayerManagerUserInfo[_ngcontent-%COMP%]   .material-icons[_ngcontent-%COMP%]{margin-left:0}.x-trainingPlayerManagerEditionPanel[_ngcontent-%COMP%]{background-color:#2b1212ce;padding-left:20px;padding-top:5px;padding-bottom:5px}.x-trainingPlayerManagerPanel[_ngcontent-%COMP%]{border:1px solid #AAAAAA;border-radius:5px;padding:5px;color:#000;background-color:#ffffffd0}.x-trainingPlayerManagerChart[_ngcontent-%COMP%]{display:flex;justify-content:center;box-sizing:border-box;width:100%;max-width:100%;height:150px;padding:2px 10px 8px;margin:10px}@media screen and (max-width: 480px),screen and (max-height: 500px){.x-trainingPlayerManagerChart[_ngcontent-%COMP%]{height:140px}}.x-trainingPlayerManagerBottomBorder[_ngcontent-%COMP%]{border-bottom:1px solid #e0e0e0}.x-trainingPlayerManagerLegendAvailability[_ngcontent-%COMP%]{width:32px;height:32px;color:#fff!important;border-radius:5px;margin-right:5px;display:inline-block;text-align:center}.x-trainingPlayerManagerLegendCenter[_ngcontent-%COMP%]{display:block;left:50%;position:relative;top:50%;transform:translate(-50%,-50%)}.x-trainingPlayerManagerDropDown[_ngcontent-%COMP%]{width:100px!important}.x-trainingPlayerManagerUserWrap[_ngcontent-%COMP%]{display:inline-block;vertical-align:top;margin-right:8px}.x-trainingPlayerManagerUserInfo[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{width:100%;display:flex;justify-content:center;align-items:center}']})},Vt=class{constructor(t,e){this.date=t;this.team=e}};var Bt=class{sysId=0;name="";countOfPresenceOnMatch=0;countOfPresenceOnTraining=0;percentOfPresenceOnMatch=[];percentOfPresenceOnTraining=[];
3pieChartLabelsForMatch=[];pieChartLabelsForTraining=[];constructor(t){Object.assign(this,t)}};var Ri={TrainingPlayerStatisticsAbsences:"Absences",TrainingPlayerStatisticsAll:"Tous",TrainingPlayerStatisticsAvailabilityTitle:"Disponibilit\xE9",TrainingPlayerStatisticsDialogTitle:"Rapport des disponibilit\xE9s de l'\xE9quipe",TrainingPlayerStatisticsExport:"Exporter",TrainingPlayerStatisticsPercentage:"Pourcentage",TrainingPlayerStatisticsPeriod:"P\xE9riode",TrainingPlayerStatisticsPlayer:"Joueur",TrainingPlayerStatisticsPresences:"Pr\xE9sences",TrainingPlayerStatisticsPresencesTitle:"Total de pr\xE9sences :",TrainingPlayerStatisticsTitle:"Statistiques des pr\xE9sences",TrainingPlayerStatisticsTotal:"Total"};var Fi={TrainingPlayerStatisticsAbsences:"Absences",TrainingPlayerStatisticsAll:"All",TrainingPlayerStatisticsAvailabilityTitle:"Availability",TrainingPlayerStatisticsDialogTitle:"Team availability report",TrainingPlayerStatisticsExport:"Export",TrainingPlayerStatisticsPercentage:"Percentage",TrainingPlayerStatisticsPeriod:"Period",TrainingPlayerStatisticsPlayer:"Player",TrainingPlayerStatisticsPresences:"Presences",TrainingPlayerStatisticsPresencesTitle:"Total presences:",TrainingPlayerStatisticsTitle:"Attendance statistics",TrainingPlayerStatisticsTotal:"Total"};var Lt=class s{constructor(t,e,i,a,n,r,o,y,E,se){this.dialogRef=t;this.data=e;this.locale=i;this.translateService=a;this.cacheService=n;this.subjectService=r;this.frameworkService=o;this.accessRightsService=y;this.storageService=E;this.changeDetectorRef=se;this.translateService.setTranslation("fr",Ri,!0),this.translateService.setTranslation("en",Fi,!0),this.subjectService.IsButtonInLoadingSubject.next(!1),this.isMemberCoachsOrAssistantOrSupervisorConnected=this.accessRightsService.isMemberCoachsOrAssistantOrSupervisor(this.storageService.getUserConnected()),this.paramDate=e.date,this.title=this.translateService.instant("TrainingPlayerStatisticsDialogTitle"),this.subjectService.isMobile()&&(this.barChartOptions=ii(ti({},this.barChartOptions),{aspectRatio:1.7})),this.subjectService.IsTrainingPlayerCacheLoadedSubject.pipe(j(this.destroy$)).subscribe(le=>{le&&(this.isInitialized=!1,this.initializeAfterChangeDetection())})}chartColors=["#2c662c","#ddbb25","#c03030"];pieChartPlugins=[];pieChartType="doughnut";pieChartData={datasets:[],labels:[]};pieChartLabels;pieChartLegend=!1;pieChartOptions={responsive:!0,plugins:{legend:{labels:{color:"#ffffff"}},tooltip:{titleColor:"#ffffff",bodyColor:"#ffffff",backgroundColor:"rgba(0,0,0,0.7)"}}};barChartType="bar";barChartData1=[];barChartData2=[];barChartLabels1;barChartLabels2;barChartLegend=!0;barChartOptions={maintainAspectRatio:!0,aspectRatio:1.3,responsive:!0,scales:{y:{beginAtZero:!0}},plugins:{legend:{display:!0}}};allInfoPresenceOfUser=[];allTrainingDay=[];allTrainingPlayersOfCS=[];allUsers=[];coachsCount=0;paramDate;isMemberCoachsOrAssistantOrSupervisorConnected=!1;
3matchDayCount=0;notPresencePercent=0;playersCount=0;playersNotPresentTotal=0;playersPresentTotal=0;presencePercent=0;subTitle1a;subTitle1b;subTitle2;temp=[];title;trainingDayCount=0;destroy$=new J;isInitialized=!1;initialize(){if(this.isInitialized)return;this.isInitialized=!0,this.allTrainingPlayersOfCS=this.cacheService.getAllTrainingPlayers().filter(e=>e.playerSysId==this.storageService.getUserConnected().sysId||e.playerSysId==this.frameworkService.getSysIdOfUser(this.cacheService.mainCoachOfCurrentLogged())),this.allTrainingDay=[],this.temp=[];let t=this.cacheService.teamForTP();t!=null&&(t.trainingDay1!=-1&&this.allTrainingDay.push({day:t.trainingDay1,timeFrom:t.trainingTimeFrom1,timeTo:t.trainingTimeTo1,buildingTraining:t.buildingTrainingName1}),t.trainingDay2!=-1&&this.allTrainingDay.push({day:t.trainingDay2,timeFrom:t.trainingTimeFrom2,timeTo:t.trainingTimeTo2,buildingTraining:t.buildingTrainingName2}),t.trainingDay3!=-1&&this.allTrainingDay.push({day:t.trainingDay3,timeFrom:t.trainingTimeFrom3,timeTo:t.trainingTimeTo3,buildingTraining:t.buildingTrainingName3})),this.loadAllInfoPresenceOfUser(),this.subTitle2=this.playersCount+" joueurs"+(this.coachsCount>=1?" / "+this.coachsCount+" coach(s)":"")}isDateIsRecordedAsTrainings(t){return this.allTrainingDay.find(e=>e.day==new Date(t).getDay())!=null}isAMatch(t,e){return t.filter(i=>p.yyyyMmDd(new Date(e))==p.yyyyMmDd(new Date(i.day)))}loadAllInfoPresenceOfUser(){this.playersNotPresentTotal=0,this.playersPresentTotal=0;let t=p.today();if(this.isMemberCoachsOrAssistantOrSupervisorConnected&&t!=null&&(t=this.paramDate),this.cacheService.teamForTP()!=null){let S=this.cacheService.teamForTP().startOfTrainingDate instanceof Date?this.cacheService.teamForTP().startOfTrainingDate:new Date(this.cacheService.teamForTP().startOfTrainingDate),D=t instanceof Date?t:new Date(t);this.subTitle1a="du "+p.activityDisplay(S,this.translateService,!0),this.subTitle1b="au "+p.activityDisplay(D,this.translateService,!0)}let e=this.cacheService.getAllBuildingTrainingsClosingDay();this.allInfoPresenceOfUser=[];let i=this.cacheService.getAllMatchsOfUserTeamAndClub().filter(S=>{let D=new Date(S.day),te=new Date(t);return p.yyyyMmDd(D)<=p.yyyyMmDd(te)&&(S.type==I[3]||S.type==I[6])});this.frameworkService.traceInfo("Official matchs (CHAMPIONSHIP, HAINAUT_CUP) <= "+p.yyyyMmDd(new Date(t)),i.length),this.matchDayCount=i.length,this.trainingDayCount=0;let a=null;this.cacheService.teamForTP()!=null&&(this.cacheService.teamForTP().trainingDay1!=-1&&(a=p.daysBetweenDates(this.cacheService.teamForTP().startOfTrainingDate,t,this.cacheService.teamForTP().trainingDay1),a=a.filter(S=>{let D=new Date(S),te=new Date(t);return p.yyyyMmDd(D)<=p.yyyyMmDd(te)&&i.filter(z=>{let U=new Date(z.day);return p.yyyyMmDd(U)===p.yyyyMmDd(D)}).length==0&&e.filter(z=>{let U=new Date(z.day);return p.yyyyMmDd(U)===p.yyyyMmDd(D)}).length==0}),this.trainingDayCount+=a.length),this.cacheService.teamForTP().trainingDay2!=-1&&(a=p.daysBetweenDates(this.cacheService.teamForTP().startOfTrainingDate,t,this.cacheService.teamForTP().trainingDay2),a=a.filter(S=>p.yyyyMmDd(new Date(S))<=p.yyyyMmDd(new Date(t))&&i.filter(D=>p.yyyyMmDd(new Date(D.day))===p.yyyyMmDd(new Date(S))).length==0&&e.filter(D=>p.yyyyMmDd(new Date(D.day))===p.yyyyMmDd(new Date(S))).length==0),this.trainingDayCount+=a.length),this.cacheService.teamForTP().trainingDay3!=-1&&(a=p.daysBetweenDates(this.cacheService.teamForTP().startOfTrainingDate,t,this.cacheService.teamForTP().trainingDay3),a=a.filter(S=>p.yyyyMmDd(new Date(S))<=p.yyyyMmDd(new Date(t))&&i.filter(D=>p.yyyyMmDd(new Date(D.day))===p.yyyyMmDd(new Date(S))).length==0&&e.filter(D=>p.yyyyMmDd(new Date(D.day))===p.yyyyMmDd(new Date(S))).length==0),this.trainingDayCount+=a.length)),this.frameworkService.traceInfo("Training (TRAINING_DAY)",this.trainingDayCount);let n=this.allTrainingPlayersOfCS.filter(S=>{let D=new Date(S.day),te=new Date(t);return S.playerSysId==this.frameworkService.getSysIdOfUser(this.cacheService.mainCoachOfCurrentLogged())&&this.frameworkService.getMatchTrainingActivitiesType().some(function(z){return z.value===S.type})&&p.yyyyMmDd(D)<=p.yyyyMmDd(te)&&e.filter(z=>{let U=new Date(z.day);return p.yyyyMmDd(U)===p.yyyyMmDd(D)}).length==0});this.trainingDayCount+=n.filter(S=>S.type==I[5]).length,this.frameworkService.traceInfo("Extra training (EXTRA_TRAINING_DAY)",
3n.filter(S=>S.type==I[5]).length);let r=n.filter(S=>S.type==I[4]||S.type==I[2]).length;this.matchDayCount+=r,this.frameworkService.traceInfo("Extra matchs (FRIENDLY_MATCH_DAY + TOURNAMENT_DAY)",r);let o=[],y=[],E=[],se=[],le=[],Ye=[],k=this.cacheService.getAllUsersOfTeamOfCurrentUser().filter(S=>S.firstName!="VAB").sort((S,D)=>(S.firstName+S.lastName).localeCompare(D.firstName+D.lastName)),ye=this.cacheService.getAllCoachsOfCurrentLogged().map(function(S){return S.sysId});this.coachsCount=ye.length,this.playersCount=k.length-ye.length;for(let S=0;S<k.length;S++){this.frameworkService.traceInfo("---------->"+k[S].firstName+" "+k[S].lastName,k[S].sysId);let D=[],te=[],z=[];D=this.cacheService.getAllTrainingPlayers().filter(u=>u.playerSysId==k[S].sysId&&p.yyyyMmDd(new Date(u.day))<=p.yyyyMmDd(new Date(t))&&!u.isPresenceNotCounted&&(u.type==I[5]||(u.type==""||u.type==I[11])&&i.filter(_=>p.yyyyMmDd(new Date(_.day))===p.yyyyMmDd(new Date(u.day))).length==0)),D=this.dedupeAbsentDominates(D),D.forEach(u=>{u.present==null?z.push(u):u.present==0&&te.push(u)}),this.frameworkService.traceInfo("allTrainingPlayers TRAINING_DAY, EXTRA_TRAINING_DAY",D.length);let U=[],ve=[];D=this.cacheService.getAllTrainingPlayers().filter(u=>u.playerSysId==k[S].sysId&&p.yyyyMmDd(new Date(u.day))<=p.yyyyMmDd(new Date(t))&&e.filter(_=>p.yyyyMmDd(new Date(_.day))===p.yyyyMmDd(new Date(u.day))).length==0&&(u.type==I[3]||u.type==I[6]||u.type==I[4]||u.type==I[2]||i.filter(_=>p.yyyyMmDd(new Date(_.day))===p.yyyyMmDd(new Date(u.day))).length!=0)&&!u.isPresenceNotCounted),D=this.dedupeAbsentDominates(D),D.forEach(u=>{u.present==null?ve.push(u):u.present==0&&U.push(u)}),this.frameworkService.traceInfo("allTrainingPlayers CHAMPIONSHIP, HAINAUT_CUP, FRIENDLY_MATCH_DAY, TOURNAMENT_DAY",D.length);let st=U.length,lt=ve.length,oe=Math.max(0,this.matchDayCount-st-lt),qe=te.length,ot=z.length,fe=Math.max(0,this.trainingDayCount-qe-ot);this.frameworkService.traceInfo("allNotPresentForTrainingPlayersOfMatch length",U.length),this.frameworkService.traceInfo("allOnGuardForTrainingPlayersOfMatch",ve.length),this.frameworkService.traceInfo("allNotPresentForTrainingPlayersOfTraining",te.length),this.frameworkService.traceInfo("allOnGuardForTrainingPlayersOfTraining",z.length);let ze=0,ct=0;this.matchDayCount>0&&(ze=Math.round(oe/this.matchDayCount*100)),this.trainingDayCount>0&&(ct=Math.round(fe/this.trainingDayCount*100));let W=new Bt;W.sysId=k[S].sysId,W.name="{0} {1}".formatString([k[S].firstName,k[S].lastName.left(1)]),W.percentOfPresenceOnTraining=new Array(ct,0),W.percentOfPresenceOnMatch=new Array(ze,0),W.countOfPresenceOnTraining=fe,W.countOfPresenceOnMatch=oe,S>=k.length/2?(se.push(W.percentOfPresenceOnTraining),le.push(W.percentOfPresenceOnMatch),Ye.push(W.name+" "+Math.round(fe)+"/"+Math.round(oe))):(o.push(W.percentOfPresenceOnTraining),y.push(W.percentOfPresenceOnMatch),E.push(W.name+" "+Math.round(fe)+"/"+Math.round(oe))),this.temp.push(W),this.playersPresentTotal+=fe+oe,this.playersNotPresentTotal+=qe+st+ot+lt}this.barChartLabels1=E,this.barChartData1=[{data:o,label:this.trainingDayCount+" entrainements",backgroundColor:"#2e7d32",hoverBackgroundColor:"#b0b1b0"},{data:y,label:this.matchDayCount+" matchs",backgroundColor:"#2C3E50",hoverBackgroundColor:"#5e5e5e"}],this.barChartLabels2=Ye,this.barChartData2=[{data:se,label:this.trainingDayCount+" entrainements",backgroundColor:"#2e7d32",hoverBackgroundColor:"#b0b1b0"},{data:le,label:this.matchDayCount+" matchs",backgroundColor:"#2C3E50",hoverBackgroundColor:"#5e5e5e"}],this.allInfoPresenceOfUser=this.temp,this.playersPresentTotal+this.playersNotPresentTotal!=0&&(this.presencePercent=Number(this.playersPresentTotal)/Number(this.playersPresentTotal+this.playersNotPresentTotal)*100,this.notPresencePercent=Number(this.playersNotPresentTotal)/Number(this.playersPresentTotal+this.playersNotPresentTotal)*100),this.pieChartLabels=[`${this.presencePercent.toFixed(2)}% pr\xE9sent`,`${this.notPresencePercent.toFixed(2)}% absent`],this.pieChartData={labels:this.pieChartLabels,datasets:[{data:[this.presencePercent,this.notPresencePercent],backgroundColor:["#2e7d32","#c03030"],hoverBackgroun
3dColor:["#b0b1b0","#b0b1b0"]}]}}dedupeAbsentDominates(t){let e=a=>a===0?2:a==null?1:0,i=new Map;for(let a of t??[]){let n=p.yyyyMmDd(new Date(a.day))+"|"+a.type,r=i.get(n);(!r||e(a.present)>e(r.present))&&i.set(n,a)}return[...i.values()]}ngOnInit(){this.destroy$.next(),this.loadDataAndInitialize()}async loadDataAndInitialize(){try{if(!(!this.cacheService.isTrainingPlayersLoaded()||!this.cacheService.isTeamsLoaded()||!this.cacheService.isUsersLoaded()||!this.cacheService.isMatchesLoaded()||!this.cacheService.isBuildingClosingDaysLoaded())){this.initializeAfterChangeDetection();return}await Promise.all([this.cacheService.loadTrainingPlayersCache(!0),this.cacheService.loadTeamsCache(!0),this.cacheService.loadUsersCache(!0),this.cacheService.loadMatchesCache(!0),this.cacheService.loadBuildingTrainingClosingDaysCache(!0)]),this.initializeAfterChangeDetection()}catch(t){console.error("Error loading training players statistics data:",t)}}initializeAfterChangeDetection(){setTimeout(()=>{this.initialize(),this.changeDetectorRef.markForCheck()})}onCancel(){this.dialogRef.close(!1)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}static \u0275fac=function(e){return new(e||s)(g(De),g(Pe),g(li),g(Y),g(q),g(G),g(Z),g(ne),g(ae),g(We))};static \u0275cmp=X({type:s,selectors:[["tps"]],decls:48,vars:40,consts:[[1,"x-dialogCard"],[1,"x-matcardHeaderColor"],[1,"x-flexSpaceBetween"],["icon","close",3,"onClick","text","isBackgroundOpaque","visibility"],[1,"x-dialogFormModalContent"],["mat-dialog-content",""],[1,"x-dialogScrollable"],[1,"x-flexSpaceBetween","x-trainingPlayerStatisticsEffectifRow"],[1,"x-fontSmall"],[1,"x-trainingPlayerStatisticsPercentRow"],[1,"x-presentColor","x-trainingPlayerStatisticsLegendAvailability"],[1,"x-trainingPlayerStatisticsLegendCenter"],[1,"x-notPresentColor","x-trainingPlayerStatisticsLegendAvailability"],[1,"x-trainingPlayerStatisticsChart","x-alignmentCenter"],["baseChart","",3,"data","labels","type","options","plugins","legend"],["baseChart","",3,"datasets","labels","type","options","legend"],[1,"x-trainingPlayerStatisticsTotalRow"],[1,"x-trainingPlayerStatisticsLegendAvailability"],[1,"x-trainingPlayerStatisticsLegendCenter","smallFont"]],template:function(e,i){e&1&&(d(0,"mat-card",0)(1,"mat-card-header",1)(2,"mat-card-title")(3,"div",2)(4,"div")(5,"div"),f(6),c(),d(7,"div"),f(8),c()(),d(9,"div")(10,"app-button",3),O(11,"translate"),v("onClick",function(){return i.onCancel()}),c()()()()(),d(12,"mat-card-content",4)(13,"div")(14,"div",5)(15,"div",6)(16,"div",7)(17,"div",8),f(18),c()(),d(19,"div",2)(20,"div",9)(21,"span",10)(22,"div",11),f(23),O(24,"number"),c()(),d(25,"span",12)(26,"div",11),f(27),O(28,"number"),c()(),d(29,"span"),f(30," % de l'\xE9quipe "),c()()(),d(31,"div",13),A(32,"canvas",14),c(),d(33,"div"),A(34,"canvas",15)(35,"canvas",15),c(),d(36,"div",16)(37,"span",10)(38,"div",11),f(39),c()(),d(40,"span",12)(41,"div",11),f(42),c()(),d(43,"span",8),f(44,"Total de pr\xE9sences : "),c(),d(45,"span",17)(46,"div",18),f(47),c()()()()()()()()),e&2&&(l(6),P(i.title),l(2),Be("",i.subTitle1a," ",i.subTitle1b),l(2),T("x-buttonNormalNo"),m("text",w(11,30,"Close"))("isBackgroundOpaque",!0)("visibility",!0),l(8),_e(" ",i.subTitle2," "),l(5),P(qt(24,32,i.presencePercent??0,"1.1-2","fr")),l(4),P(qt(28,36,i.notPresencePercent??0,"1.1-2","fr")),l(5),m("data",i.pieChartData)("labels",i.pieChartLabels)("type",i.pieChartType)("options",i.pieChartOptions)("plugins",i.pieChartPlugins)("legend",i.pieChartLegend),l(2),m("datasets",i.barChartData1)("labels",i.barChartLabels1)("type",i.barChartType)("options",i.barChartOptions)("legend",i.barChartLegend),l(),m("datasets",i.barChartData2)("labels",i.barChartLabels2)("type",i.barChartType)("options",i.barChartOptions)("legend",i.barChartLegend),l(4),P(i.playersPresentTotal),l(3),P(i.playersNotPresentTotal),l(5),_e("",i.playersPresentTotal+i.playersNotPresentTotal," "))},dependencies:[K,ge,me,ue,he,pe,Q,Ot,Mt,re,ci,ie],styles:['@charset "UTF-8";[_ngcontent-%COMP%]:root{--bgc-primary: #c4392e;--bgc-navbarPrimary: #1a1512;--bgc-primary-fade: rgba(196, 57, 46, .1);--fc-primary: #f5f0ec;--brand-700: #8a2820;--brand-600: #a33028;--brand-mid: #c4392e;--brand-400: #d4463a;--brand-alt: #e8564a;--brand-3: #6e2018;--brand-700-rgb: 138, 40, 32;--brand-600-rgb: 163, 48, 40;--brand-mid-rgb: 196, 57, 46;--brand-400-rgb: 212, 70, 58;--brand-alt-rgb: 232, 86, 74;--brand-3-rgb: 110, 32, 24;--surface-base: #120e0c;--surface-1: #1a1512;--surface-2: #231c18;--surface-3: #2d2420;--surface-4: #382e28;--border-subtle: #3a2e28;--border-default: #4a3a32;--text-primary: #f5f0ec;--text-secondary: #e9d9d9;--text-muted: #7a6a5a;--bgc-comitee-normal: #1a2744;--fc-comitee-normal: #8aa0b8;--bgc-comitee-technical: #1e2c24;--fc-comitee-technical: #8aa890;--bgc-comitee-strategic: #3a263e;--fc-comitee-strategic: #b89ab0}[_nghost-%COMP%]   canvas[_ngcontent-%COMP%]{touch-action:pan-y!important}.x-trainingPlayerStatisticsEffectifRow[_ngcontent-%COMP%]{margin-bottom:10px}.x-trainingPlayerStatisticsPercentRow[_ngcontent-%COMP%], .x-trainingPlayerStatisticsTotalRow[_ngcontent-%COMP%]{display:flex;align-items:center}
3.x-trainingPlayerStatisticsChart[_ngcontent-%COMP%]{display:flex;justify-content:center;width:200px;padding:10px}@media screen and (max-width: 480px),screen and (max-height: 500px){.x-trainingPlayerStatisticsChart[_ngcontent-%COMP%]{width:50%}}.x-trainingPlayerStatisticsBottomBorder[_ngcontent-%COMP%]{border-bottom:1px solid #e0e0e0}.x-trainingPlayerStatisticsLegendAvailability[_ngcontent-%COMP%]{width:45px;height:32px;color:#fff;border-radius:5px;margin-right:5px;display:inline-block;text-align:center}.x-trainingPlayerStatisticsLegendCenter[_ngcontent-%COMP%]{display:block;left:50%;position:relative;top:50%;transform:translate(-50%,-50%);color:#fff}.x-trainingPlayerStatisticsChartContent[_ngcontent-%COMP%]{padding:0 10px;overflow-x:hidden!important}']})},Ht=class{constructor(t){this.date=t}};var Ui={CommonMatchStatusReason:"(motif)",CommonMatchStatusCannotModifyPastEvent:"Un \xE9v\xE9nement pass\xE9 ne peut plus \xEAtre modifi\xE9 !"};var Vi={CommonMatchStatusReason:"(motif)",CommonMatchStatusCannotModifyPastEvent:"un \xE9v\xE9nement pass\xE9 ne peut plus \xEAtre modifi\xE9 !"};function Fa(s,t){if(s&1&&(d(0,"mat-option",12),R(1),f(2),F(),c()),s&2){let e=t.$implicit;m("value",e.value),l(2),P(e.viewValue)}}function Ua(s,t){if(s&1){let e=M();R(0),d(1,"div")(2,"app-button",7),v("onClick",function(){b(e);let a=h(3);return C(a.onChangeToNotPresent())}),c()(),d(3,"div",8)(4,"mat-form-field",9)(5,"mat-select",10),O(6,"translate"),x(7,Fa,3,2,"mat-option",11),c()()(),d(8,"div")(9,"app-button",7),v("onClick",function(){b(e);let a=h(3);return C(a.onChangeToGuard())}),c()(),F()}if(s&2){let e=h(3);l(2),T("x-notPresentColor x-space"),m("icon","thumb_down")("isBackgroundOpaque",!0)("text","")("visibility",!0),l(3),m("placeholder",xt(w(6,15,"CommonMatchStatusReason"))),l(2),m("ngForOf",e.allReasons),l(2),T("x-guardColor x-space"),m("icon","thumbs_up_down")("isBackgroundOpaque",!0)("text","")("visibility",!0)}}function Va(s,t){if(s&1){let e=M();d(0,"div",6),x(1,Ua,10,17,"ng-container",1),d(2,"div")(3,"app-button",7),v("onClick",function(){b(e);let a=h(2);return C(a.onTrainingPlayersManager())}),c()()()}if(s&2){let e=h(2);l(),m("ngIf",e.canManageOwnPresence),l(2),T("x-neutralColor"),m("icon","groups")("isBackgroundOpaque",!0)("text","")("visibility",!0)}}function Ba(s,t){if(s&1&&(d(0,"mat-option",12),R(1),f(2),F(),c()),s&2){let e=t.$implicit;m("value",e.value),l(2),P(e.viewValue)}}function La(s,t){if(s&1){let e=M();R(0),d(1,"div",8)(2,"mat-form-field",9)(3,"mat-select",10),O(4,"translate"),x(5,Ba,3,2,"mat-option",11),c()()(),d(6,"div")(7,"app-button",7),v("onClick",function(){b(e);let a=h(3);return C(a.onChangeToNotPresent())}),c()(),d(8,"div")(9,"app-button",7),v("onClick",function(){b(e);let a=h(3);return C(a.onChangeToGuard())}),c()(),d(10,"div")(11,"app-button",7),v("onClick",function(){b(e);let a=h(3);return C(a.onChangeToPresent())}),c()(),F()}if(s&2){let e=h(3);l(3),m("placeholder",xt(w(4,21,"CommonMatchStatusReason"))),l(2),m("ngForOf",e.allReasons),l(2),T("x-notPresentColor x-space"),m("icon","thumb_down")("isBackgroundOpaque",!0)("text","")("visibility",!0),l(2),T("x-guardColor x-space"),m("icon","thumbs_up_down")("isBackgroundOpaque",!0)("text","")("visibility",!0),l(2),T("x-presentColor x-space"),m("icon","thumb_up")("isBackgroundOpaque",!0)("text","")("visibility",!0)}}function Ha(s,t){if(s&1){let e=M();d(0,"div",6),x(1,La,12,23,"ng-container",1),d(2,"div")(3,"app-button",7),v("onClick",function(){b(e);let a=h(2);return C(a.onTrainingPlayersManager())}),c()()()}if(s&2){let e=h(2);l(),m("ngIf",e.canManageOwnPresence),l(2),T("x-neutralColor"),m("icon","groups")("isBackgroundOpaque",!0)("text","")("visibility",!0)}}function $a(s,t){if(s&1&&(d(0,"mat-option",12),R(1),f(2),F(),c()),s&2){let e=t.$implicit;m("value",e.value),l(2),P(e.viewValue)}}function Ga(s,t){if(s&1){let e=M();R(0),d(1,"div",8)(2,"mat-form-field",9)(3,"mat-select",10),O(4,"translate"),x(5,$a,3,2,"mat-option",11),c()()(),d(6,"div")(7,"app-button",7),v("onClick",function(){b(e);let a=h(3);return C(a.onChangeToNotPresent())}),c()(),d(8,"div")(9,"app-button",7),v("onClick",function(){b(e);let a=h(3);return C(a.onChangeToPresent())}),c()(),F()}if(s&2){let e=h(3);l(3),m("placeholder",xt(w(4,15,"CommonMatchStatusReason"))),l(2),m("ngForOf",e.allReasons),l(2),T("x-notPresentColor x-space"),m("icon","thumb_down")("isBackgroun
3dOpaque",!0)("text","")("visibility",!0),l(2),T("x-presentColor x-space"),m("icon","thumb_up")("isBackgroundOpaque",!0)("text","")("visibility",!0)}}function Ya(s,t){if(s&1){let e=M();d(0,"div",6),x(1,Ga,10,17,"ng-container",1),d(2,"div")(3,"app-button",13),v("onClick",function(){b(e);let a=h(2);return C(a.onTrainingPlayersManager())}),c()()()}if(s&2){let e=h(2);l(),m("ngIf",e.canManageOwnPresence),l(2),T("x-neutralColor x-space"),m("isBackgroundOpaque",!0)("visibility",!0)}}function qa(s,t){if(s&1&&(R(0),d(1,"div")(2,"div"),A(3,"div",2),c(),x(4,Va,4,7,"div",3)(5,Ha,4,7,"div",3)(6,Ya,4,5,"div",3),d(7,"div"),A(8,"div",4),c()(),d(9,"div"),A(10,"md",5),c(),d(11,"div"),A(12,"div",2),c(),F()),s&2){let e=h();l(4),m("ngIf",e.eventClub.availability==e.EnumAvailability.PRESENT),l(),m("ngIf",e.eventClub.availability==e.EnumAvailability.NOTPRESENT),l(),m("ngIf",e.eventClub.availability==e.EnumAvailability.GUARD),l(4),m("eventClub",e.eventClub)("matchDisplayType",e.EnumMatchDisplayType.STATUS_DETAIL)("isClickable",!1)("isPresentVisible",!1)}}var $t=class s{constructor(t,e,i,a,n,r,o,y){this.cacheService=t;this.subjectService=e;this.frameworkService=i;this.accessRightsService=a;this.trainingPlayerService=n;this.storageService=r;this.encryptionService=o;this.translateService=y;this.translateService.setTranslation("fr",Ui,!0),this.translateService.setTranslation("en",Vi,!0),this.form.addControl("allReasons",new B(""))}allClubEventsOfUserAuthenticated=new Map;date;team;visible=!0;OnEditTeamAvailability=new Ct;EnumAvailability=Je;EnumAvailabilityReason=xe;EnumMatchDisplayType=Pt;allReasons=[];eventClub=null;form=new Me({});isCoachOnlyConnected=!1;isMemberCoachsOrAssistantOrSupervisorConnected=!1;isDisplayOnAMobile=null;reason="";userConnected;destroy$=new J;get canManageOwnPresence(){if(!this.accessRightsService.isUserConnectedAdministratorOrSupervisor())return!0;let t=this.storageService.getUserConnected();return t==null||this.team==null?!1:t.team1SysId==this.team.sysId||t.team2SysId==this.team.sysId||t.team3SysId==this.team.sysId||t.team4SysId==this.team.sysId}isATrainingDay(){return this.cacheService.getAllTrainingDays().find(t=>t.day==new Date(this.date).getDay())!=null}isAnExtraDay(t){return t==I[4]||t==I[2]||t==I[5]}ngOnChanges(t){let e=t.team?.currentValue!=t.team?.previousValue,i=t.date?.currentValue!=t.date?.previousValue,a=t.allClubEventsOfUserAuthenticated?.currentValue!=t.allClubEventsOfUserAuthenticated?.previousValue;if(e&&(this.team=t.team?.currentValue),i&&(this.date=t.date?.currentValue),e||i||a){let n=this.date instanceof Date?this.date:new Date(this.date);this.eventClub=this.cacheService.getEventClubWithTraining(this.allClubEventsOfUserAuthenticated,n,this.team),this.form.get("allReasons")?.setValue(this.eventClub?.reason)}}ngOnInit(){this.destroy$.next(),this.subjectService.IsWindowResizingSubject.pipe(j(this.destroy$)).subscribe(t=>{this.isDisplayOnAMobile=t}),this.subjectService.IsTrainingPlayerCacheLoadedSubject.pipe(j(this.destroy$)).subscribe(t=>{t&&this.loadDataAndInitialize()}),this.loadDataAndInitialize()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}async loadDataAndInitialize(){try{await this.cacheService.loadTrainingPlayersCache(!0),this.refresh()}catch(t){console.error("Error loading match status data:",t),this.refresh()}}async onChangeToGuard(){try{let t=!1,e=this.cacheService.getAllTrainingPlayersOfCurrentLogged().find(a=>a.sysId==this.eventClub.tpSysId);e==null&&(e=this.cacheService.getAllTrainingPlayersOfCurrentLogged().find(a=>p.yyyyMmDd(a.day)==p.yyyyMmDd(this.date))??null);let i=this.cacheService.getExtraTrainingOfCoachFromDate(this.date);e==null?(t=!0,e=new $,e.day=p.databaseDateOnly(this.date),e.type=this.eventClub.event.type,e.championshipSysId=this.cacheService.getCurrentChampionship().sysId,e.playerSysId=this.storageService.getUserConnected().sysId,e.teamSysId=this.team.sysId,e.championship=null,e.player=null,e.present=null,!this.isAnExtraDay(e.type)&&!this.isATrainingDay()?e.extraTrainingTimeStarting=this.eventClub.event.time:(this.isAnExtraDay(e.type)&&(e.extraTrainingBuilding=i.extraTrainingBuilding,e.extraTrainingIsAtHome=i.extraTrainingIsAtHome,e.extraTrainingTeam=i.extraTrainingTeam,e.extraTrainingTimeStarting=i.extraTrainingTimeStarting,e.extraTrainingTimeEnding=i.extraTrainingTimeEnding,e.isPresenceNotCounted=i.isPresenceNotCounted,e.trainingPlayerSysId=i.sysId),this.isATrainingDay()&&(e.extraTrainingIsAtHome=!0,e.extraTrainingTimeStarting=this.cacheService.getAllTrainingDays().find(a=>a.day==new Date(this.date).getDay()).timeFrom,e.extraTrainingTimeEnding=this.cacheService.getAllTrainingDays().find(a=>a.day==new Date(this.date).getDay()).timeTo))):e.present=null,this.saveNotPresent(this.userConnected,t,e,xe[5])}catch{this.subjectService.IsButtonInLoadingSubject.next(!1)}}async onChangeToNotPresent(){try{let t=!1,e=this.cacheService.getAllTrainingPlayersOfCurrentLogged().find(a=>
3a.sysId==this.eventClub.tpSysId);e==null&&(e=this.cacheService.getAllTrainingPlayersOfCurrentLogged().find(a=>p.yyyyMmDd(a.day)==p.yyyyMmDd(this.date))??null);let i=this.cacheService.getExtraTrainingOfCoachFromDate(this.date);e==null?(t=!0,e=new $,e.day=p.databaseDateOnly(this.date),e.type=this.eventClub.event.type,e.championshipSysId=this.cacheService.getCurrentChampionship().sysId,e.playerSysId=this.storageService.getUserConnected().sysId,e.teamSysId=this.team.sysId,e.championship=null,e.player=null,e.present=0,!this.isAnExtraDay(e.type)&&!this.isATrainingDay()?e.extraTrainingTimeStarting=this.eventClub.event.time:(this.isAnExtraDay(e.type)&&(e.extraTrainingBuilding=i.extraTrainingBuilding,e.extraTrainingIsAtHome=i.extraTrainingIsAtHome,e.extraTrainingTeam=i.extraTrainingTeam,e.extraTrainingTimeStarting=i.extraTrainingTimeStarting,e.extraTrainingTimeEnding=i.extraTrainingTimeEnding,e.trainingPlayerSysId=i.sysId,e.isPresenceNotCounted=i.isPresenceNotCounted),this.isATrainingDay()&&(e.extraTrainingIsAtHome=!0,e.extraTrainingTimeStarting=this.cacheService.getAllTrainingDays().find(a=>a.day==new Date(this.date).getDay()).timeFrom,e.extraTrainingTimeEnding=this.cacheService.getAllTrainingDays().find(a=>a.day==new Date(this.date).getDay()).timeTo))):e.present=0,this.saveNotPresent(this.userConnected,t,e,this.form.get("allReasons").value)}catch{this.subjectService.IsButtonInLoadingSubject.next(!1)}}async onChangeToPresent(){try{let t=this.cacheService.getAllTrainingPlayersOfCurrentLogged().find(e=>e.sysId==this.eventClub.tpSysId);t==null&&(t=this.cacheService.getAllTrainingPlayersOfCurrentLogged().find(e=>p.yyyyMmDd(e.day)==p.yyyyMmDd(this.date))??null),t!=null&&(this.isATrainingDay()&&(t.extraTrainingIsAtHome=!0,t.extraTrainingTimeStarting=this.cacheService.getAllTrainingDays().find(e=>e.day==new Date(this.date).getDay()).timeFrom,t.extraTrainingTimeEnding=this.cacheService.getAllTrainingDays().find(e=>e.day==new Date(this.date).getDay()).timeTo),t.present=1,t.reason="",this.savePresent(this.userConnected,this.eventClub,t)),this.subjectService.IsButtonInLoadingSubject.next(!1)}catch{this.subjectService.IsButtonInLoadingSubject.next(!1)}}onTrainingPlayersManager(){this.OnEditTeamAvailability.emit(this.date)}refresh(){this.isMemberCoachsOrAssistantOrSupervisorConnected=this.accessRightsService.isMemberCoachsOrAssistantOrSupervisor(this.storageService.getUserConnected()),this.isCoachOnlyConnected=this.accessRightsService.isMemberCoachOnly(this.storageService.getUserConnected()),this.userConnected=this.storageService.getUserConnected(),this.allReasons=this.frameworkService.getNonPresenceReason(),this.eventClub=this.cacheService.getEventClubWithTraining(this.allClubEventsOfUserAuthenticated,this.date,this.team),this.form.get("allReasons")?.setValue(this.eventClub?.reason)}saveNotPresent(t,e,i,a){i.reason=a==""?xe[6]:a,e?this.trainingPlayerService.insertWithServerDateCheck(i,!this.isMemberCoachsOrAssistantOrSupervisorConnected).subscribe({next:n=>{let r=this.encryptionService.decryptObject(!1,n.value);r!=null?r.reason=="OUTOFDATE"?this.frameworkService.displayAlert(!1,this.translateService.instant("CommonMatchStatusCannotModifyPastEvent")):(this.allClubEventsOfUserAuthenticated=this.cacheService.manageIUClubEventsOfUserAuthenticated(this.date,r,this.eventClub,this.team,!0,t),this.subjectService.IsTrainingPlayerCacheLoadedSubject.next(!0)):this.frameworkService.displayAlert(!1),this.subjectService.IsButtonInLoadingSubject.next(!1)},error:n=>{this.frameworkService.displayAlert(null,n),this.subjectService.IsButtonInLoadingSubject.next(!1)}}):this.trainingPlayerService.updateWithServerDateCheck(i,!this.isMemberCoachsOrAssistantOrSupervisorConnected).subscribe({next:n=>{let r=this.encryptionService.decryptObject(!1,n.value);r!=null?r.reason=="OUTOFDATE"?this.frameworkService.displayAlert(!1,this.translateService.instant("CommonMatchStatusCannotModifyPastEvent")):(this.allClubEventsOfUserAuthenticated=this.cacheService.manageIUClubEventsOfUserAuthenticated(this.date,r,this.eventClub,this.team,!1,t),this.subjectService.IsTrainingPlayerCacheLoadedSubject.next(!0)):this.frameworkService.displayAlert(!1),this.subjectService.IsButtonInLoadingSubject.next(!1)},error:n=>{this.frameworkService.displayAlert(null,n),this.subjectService.IsButtonInLoadingSubject.next(!1)}})}savePresent(t,e,i){let a=this.isCoachOnlyConnected;a&&i.type!=ee[6]&&i.type!=ee[4]&&i.type!=ee[5]&&(a=!1),a?this.trainingPlayerService.updateWithServerDateCheck(i,!this.isMemberCoachsOrAssistantOrSupervisorConnected).subscribe({next:n=>{let r=this.encryptionService.decryptObject(!1,n.value);if(r!=null)if(r.reason=="OUTOFDATE")this.frameworkService.displayAlert(!1,"Un \xE9v\xE9nement pass\xE9 ne peut plus \xEAtre modifi\xE9 !");else{let o=!0;this.accessRightsService.isMemberCoachOnly(t)&&(o=!1),this.allClubEventsOfUserAuthenticated=this.cacheService.manageIUClubEventsOfUserAuthenticated(this.date,r,this.eventClub,this.team,o,t),this.subjectService.IsTrainingPlayerCacheLoadedSubject.next(!0)}else this.frameworkService.displayAlert(!1);this.subjectService.IsButtonInLoadingSubject.next(!1)},error:n=>{this.frameworkService.displayAlert(null,n),this.subjectService.IsButtonInLoadingSubject.next(!1)}}):this.trainingPlayerService.deleteWithServerDateCheck(i,i.day,i.extraTrainingTimeStarting,!this.isMemberCoachsOrAssistantOrSupervisorConnected).subscribe({next:n=>{let r=this.encryptionService.decryptObject(!1,n.value);r!=null?r.reason=="OUTOFDATE"?this.frameworkService.displayAlert(!1,"Un \xE9v\xE9nement pass\xE9 ne peut plus \xEAtre modifi\xE9 !"):(e.tpSysId!=0&&(this.allClubEventsOfUserAuthenticated=this.cacheService.manageRClubEventsOfUserAuthenticated(i,t,this.team)),this.subjectService.IsTrainingPlayerCacheLoadedSubject.next(!0)):this.frameworkService.displayAlert(!1),this.subjectService.IsButtonInLoadingSubject.next(!1)},error:n=>{this.frameworkService.displayAlert(null,n),this.subjectService.IsButtonInLoadingSubject.next(!1)}})}static \u0275fac=function(e){return new(e||s)(g(q),g(G),g(Z),g(ne),g(Ve),g(ae),g(Ue),g(Y))};static \u0275cmp=X({type:s,selectors:[["ms"]],inputs:{allClubEventsOfUserAuthenticated:"allClubEventsOfUserAuthenticated",date:"date",team:"team",visible:"visible"},outputs:{OnEditTeamAvailability:"OnEditTeamAvailability"},features:[bt],decls:2,vars:2,consts:[[3,"formGroup"],[4,"ngIf"],[1,"x-br1"],["class","x-flexStart x-matchStatusPanel",4,"ngIf"],[1,"x-br0"],[3,"eventClub","match
3DisplayType","isClickable","isPresentVisible"],[1,"x-flexStart","x-matchStatusPanel"],[3,"onClick","icon","isBackgroundOpaque","text","visibility"],[1,"x-matchStatusDropDownWidthParent"],["appearance","fill"],["formControlName","allReasons",1,"x-matchStatusDropDownWidth","x-space","x-spaceBefore",3,"placeholder"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],["icon","groups",3,"onClick","isBackgroundOpaque","text","visibility"]],template:function(e,i){e&1&&(d(0,"form",0),x(1,qa,13,7,"ng-container",1),c()),e&2&&(m("formGroup",i.form),l(),m("ngIf",i.visible&&i.eventClub!=null))},dependencies:[K,ce,de,Ee,Oe,Ke,Ie,we,Qe,re,It,je,Ae,Fe,Re,ke,Ne,Q,ie],styles:["[_ngcontent-%COMP%]:root{--bgc-primary: #c4392e;--bgc-navbarPrimary: #1a1512;--bgc-primary-fade: rgba(196, 57, 46, .1);--fc-primary: #f5f0ec;--brand-700: #8a2820;--brand-600: #a33028;--brand-mid: #c4392e;--brand-400: #d4463a;--brand-alt: #e8564a;--brand-3: #6e2018;--brand-700-rgb: 138, 40, 32;--brand-600-rgb: 163, 48, 40;--brand-mid-rgb: 196, 57, 46;--brand-400-rgb: 212, 70, 58;--brand-alt-rgb: 232, 86, 74;--brand-3-rgb: 110, 32, 24;--surface-base: #120e0c;--surface-1: #1a1512;--surface-2: #231c18;--surface-3: #2d2420;--surface-4: #382e28;--border-subtle: #3a2e28;--border-default: #4a3a32;--text-primary: #f5f0ec;--text-secondary: #e9d9d9;--text-muted: #7a6a5a;--bgc-comitee-normal: #1a2744;--fc-comitee-normal: #8aa0b8;--bgc-comitee-technical: #1e2c24;--fc-comitee-technical: #8aa890;--bgc-comitee-strategic: #3a263e;--fc-comitee-strategic: #b89ab0}.x-matchStatusDropDownWidth[_ngcontent-%COMP%]{width:100px!important}@media screen and (max-width: 480px),screen and (max-height: 500px){.x-matchStatusDropDownWidthParent[_ngcontent-%COMP%]{width:140px!important}}.x-matchStatusPanel[_ngcontent-%COMP%]{border:1px solid #AAAAAA;border-radius:5px;padding:5px;color:#000;background-color:#ffffffd0}"]})};var Bi={};var Li={};var Ja=["calendar"];function Xa(s,t){if(s&1){let e=M();R(0),d(1,"mat-calendar",2,0),v("selectedChange",function(a){b(e);let n=h();return C(n.onSelectedChange(a))}),c(),F()}if(s&2){let e=h();l(),m("minDate",e.minDate)("maxDate",e.maxDate)("dateClass",e.changeCalendarDate)("selected",e.selectedDate)}}var yt=class s{constructor(t,e,i,a,n,r){this.cacheService=t;this.subjectService=e;this.frameworkService=i;this.accessRightsService=a;this.storageService=n;this.translateService=r;this.translateService.setTranslation("fr",Bi,!0),this.translateService.setTranslation("en",Li,!0)}allClubEventsOfUserAuthenticated=new Map;maxDate=null;minDate=null;selectedDate;visible=!0;team=null;onSelected=new Ct;calendar;changeCalendarDate=(t,e)=>this.getCalendarCellClass(t);isMemberCoachsOrAssistantOrSupervisorConnected=!1;isDisplayOnAMobile=null;destroy$=new J;changeSelectedDate(t){this.selectedDate=t,this.calendar._goToDateInView(new Date(t),"month"),this.calendar.updateTodaysDate()}updateTodaysDate(){this.calendar.updateTodaysDate()}getByeClass(t){return t?.fromTeam.includes(this.frameworkService.getByeStatus())||t?.awayTeam.includes(this.frameworkService.getByeStatus())?" x-matCalendarBye":""}getCalendarCellClass(t){if(this.team!=null){let e=p.yyyyMmDd(t),i="",a=this.frameworkService.findFirstEventClub(this.allClubEventsOfUserAuthenticated,e+this.team.sysId?.formatWithLeadingZeros(6))?.eventClub;if(this.isMemberCoachsOrAssistantOrSupervisorConnected||e>=p.yyyyMmDd(p.today())){if(a!=null)return a.clubActivityType==11?"x-matCalendarClosing":(a.availability==4?i+=" x-matCalendarGuardPresentMember"+this.getByeClass(a.event):a.availability==1?i+=" x-matCalendarPresentMember"+this.getByeClass(a.event):i+=" x-matCalendarNotPresentMember"+this.getByeClass(a.event),i);if(new Date(t)<new Date(this.team.startOfTrainingDate))return"x-matCalendarNoDay";if(this.cacheService.getAllTrainingDays().find(n=>n.day==new Date(t).getDay())!=null){i="";let n=this.cacheService.getAllTrainingPlayersOfCurrentLogged().find(r=>p.yyyyMmDd(t)==p.yyyyMmDd(r.day));return n!=null?i+=n.present==null?" x-matCalendarGuardPresentMember":n.present>=1?" x-matCalendarPresentMember":" x-matCalendarNotPresentMember":i+=" x-matCalendarPresentMember",i}}return this.isMemberCoachsOrAssistantOrSupervisorConnected?"":"x-matCalendarNoDay"}else return""}
3getSelectedDate(){return this.selectedDate}initialize(){this.isMemberCoachsOrAssistantOrSupervisorConnected=this.accessRightsService.isMemberCoachsOrAssistantOrSupervisor(this.storageService.getUserConnected())}ngOnChanges(t){if((t.team||t.allClubEventsOfUserAuthenticated||t.minDate||t.maxDate)&&this.calendar)try{this.calendar.updateTodaysDate()}catch{}}ngOnInit(){this.destroy$.next(),this.subjectService.IsWindowResizingSubject.pipe(j(this.destroy$)).subscribe(t=>{this.isDisplayOnAMobile=t}),this.subjectService.IsTrainingPlayerCacheLoadedSubject.pipe(j(this.destroy$)).subscribe(t=>{t&&this.loadDataAndInitialize()}),this.initialize()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}async loadDataAndInitialize(){try{await this.cacheService.loadTrainingPlayersCache(!0),this.calendar!=null&&this.selectedDate!=null&&(this.calendar._goToDateInView(new Date(this.selectedDate),"month"),this.calendar.updateTodaysDate())}catch(t){console.error("Error loading match calendar data:",t),this.calendar!=null&&this.selectedDate!=null&&(this.calendar._goToDateInView(new Date(this.selectedDate),"month"),this.calendar.updateTodaysDate())}}onSelectedChange(t){this.changeSelectedDate(t),this.onSelected.emit(t)}static \u0275fac=function(e){return new(e||s)(g(q),g(G),g(Z),g(ne),g(ae),g(Y))};static \u0275cmp=X({type:s,selectors:[["mc"]],viewQuery:function(e,i){if(e&1&&St(Ja,5),e&2){let a;Tt(a=_t())&&(i.calendar=a.first)}},inputs:{allClubEventsOfUserAuthenticated:"allClubEventsOfUserAuthenticated",maxDate:"maxDate",minDate:"minDate",selectedDate:"selectedDate",visible:"visible",team:"team"},outputs:{onSelected:"onSelected"},features:[bt],decls:1,vars:1,consts:[["calendar",""],[4,"ngIf"],[1,"x-matCalendar",3,"selectedChange","minDate","maxDate","dateClass","selected"]],template:function(e,i){e&1&&x(0,Xa,3,4,"ng-container",1),e&2&&m("ngIf",i.visible)},dependencies:[K,de,Et,Di,Q],encapsulation:2})};function Ka(s,t){s&1&&A(0,"app-alertMessage",8),s&2&&m("title","Attention")("message","Les rencontres sont susceptibles d'\xEAtre modifi\xE9es !!!")("type","Warning")("icon","\u26A0\uFE0F")("width","500px")}function Qa(s,t){if(s&1&&(d(0,"mat-option",15),f(1),c()),s&2){let e=t.$implicit;m("value",e),l(),_e(" ",e.teamDisplay," ")}}function Za(s,t){if(s&1){let e=M();d(0,"app-panel")(1,"div",9)(2,"div",10)(3,"div"),f(4,"Equipe"),c(),d(5,"div",11)(6,"mat-form-field",12)(7,"mat-select",13),v("selectionChange",function(a){b(e);let n=h();return C(n.onTeamChange(a.value))}),x(8,Qa,2,2,"mat-option",14),c()()()()()()}if(s&2){let e=h();l(7),m("value",e.teamSelected),l(),m("ngForOf",e.allTeams)}}function en(s,t){if(s&1){let e=M();d(0,"div")(1,"app-button",21),v("onClick",function(){b(e);let a=h(3);return C(a.onTrainingPlayerEdition())}),c()()}if(s&2){let e=h(3);l(),T("x-buttonSeparator"),m("icon",e.iconForCalendarDate)("text","")("visibility",!0)}}function tn(s,t){if(s&1){let e=M();d(0,"div")(1,"app-button",22),v("onClick",function(){b(e);let a=h(3);return C(a.onTrainingPlayerAdmin())}),c()()}s&2&&(l(),T("x-buttonSeparator"),m("text","")("visibility",!0))}function an(s,t){if(s&1){let e=M();d(0,"div")(1,"app-button",23),v("onClick",function(){b(e);let a=h(3);return C(a.onTrainingPlayersStatistics())}),c()()}s&2&&(l(),m("isBackgroundOpaque",!1)("text","")("visibility",!0))}function nn(s,t){if(s&1){let e=M();d(0,"div")(1,"app-button",24),v("onClick",function(){b(e);let a=h(3);return C(a.onExportChampionshipToExcel())}),c()()}s&2&&(l(),m("isBackgroundOpaque",!1)("isAlwaysEnabled",!0)("text","")("visibility",!0))}function rn(s,t){if(s&1&&(d(0,"div",20),x(1,en,2,5,"div",6)(2,tn,2,4,"div",6)(3,an,2,3,"div",6)(4,nn,2,4,"div",6),c()),s&2){let e=h(2);l(),m("ngIf",!e.isDayManagerAdmin&&e.isMemberCoachsOrAssistantOrSupervisorConnected&&e.selectedCalendarDate!=null&&e.isSelectedCalendarDateAvailable!=null),l(),m("ngIf",e.isDayManagerAdmin&&e.selectedCalendarDate!=null),l(),m("ngIf",e.isDateManuallySelected),l(),m("ngIf",e.isMemberCoachsOrAssistantOrSupervisorConnected)}}function sn(s,t){if(s&1){let e=M();d(0,"div")(1,"mat-card",16)(2,"mat-card-content")(3,"mc",17),v("onSelected",function(a){b(e);let n=h();return C(n.onCalendarDateSelect(a,n.teamSelected))}),c(),x(4,rn,5,4,"div",18),d(5,"ms",19),v("OnEditTeamAvailability",function(){b(e);let a=h();return C(a.onTrainingPlayersManager())}),c()()()()}if(s&2){let e=h();l(3),m("minDate",e.minDate)("maxDate",e.maxDate)("team",e.teamSelected)("allClubEventsOfUserAuthenticated",e.allClubEventsOfUserAuthenticatedForCalendar),l(),m("ngIf",!e.isDataLoading),l(
3),m("allClubEventsOfUserAuthenticated",e.allClubEventsOfUserAuthenticatedForCalendar)("team",e.teamSelected)("date",e.selectedCalendarDate)}}function ln(s,t){if(s&1){let e=M();d(0,"span")(1,"md",29),v("onClick",function(){let a=b(e).$implicit,n=h(2);return C(n.onMatchClick(a.value.event.day))}),c()()}if(s&2){let e=t.$implicit,i=h(2);l(),m("eventClub",e.value)("matchDisplayType",i.EnumMatchDisplayType.STATUS)("isPresentVisible",!0)("isClickable",!0)}}function on(s,t){if(s&1&&(d(0,"div",25)(1,"app-panel",26)(2,"div",9),f(3,"Liste des matchs (\xE0 jouer)"),c(),d(4,"div",27),x(5,ln,2,4,"span",28),O(6,"keyvalue"),c()()()),s&2){let e=h();l(),m("widthPanel","500px"),l(4),m("ngForOf",w(6,2,e.allClubEventsOfUserAuthenticatedToPlay))}}function cn(s,t){if(s&1){let e=M();d(0,"span")(1,"md",29),v("onClick",function(){let a=b(e).$implicit,n=h(2);return C(n.onMatchClick(a.value.event.day))}),c()()}if(s&2){let e=t.$implicit,i=h(2);l(),m("eventClub",e.value)("matchDisplayType",i.EnumMatchDisplayType.STATUS)("isPresentVisible",!0)("isClickable",!0)}}function dn(s,t){if(s&1&&(d(0,"div",25)(1,"app-panel",26)(2,"div",9),f(3,"Liste des matchs pass\xE9s"),c(),d(4,"div",27),x(5,cn,2,4,"span",28),O(6,"keyvalue"),c()()()),s&2){let e=h();l(),m("widthPanel","500px"),l(4),m("ngForOf",w(6,2,e.allClubEventsOfUserAuthenticatedPast))}}var Hi=class s{constructor(t,e,i,a,n,r,o,y,E,se,le,Ye,k,ye){this.formBuilder=t;this.cacheService=e;this.subjectService=i;this.dateAdapter=a;this.frameworkService=n;this.translateService=r;this.accessRightsService=o;this.trainingPlayerCRUDService=y;this.router=E;this.storageService=se;this.dialog=le;this.cdr=Ye;this.datePipe=k;this.platformId=ye;try{let S=this.subjectService.IsWindowResizingSubject.getValue();S!=null&&(this.isDisplayOnAMobile=S)}catch{}this.subjectService.IsWindowResizingSubject.subscribe(S=>{this.isDisplayOnAMobile=S;try{this.cdr.markForCheck()}catch{}}),this.form.addControl("allReasons",new B("")),this.form.addControl("allActivities",new B("")),this.form.addControl("team",new B("")),this.form.addControl("isAtHome",new B("")),this.form.addControl("time",new B("")),this.form.addControl("trainingBuilding",new B("")),this.form.addControl("isPresenceNotCounted",new B(""))}matchCalendar;EnumActivityType=I;EnumMatchDisplayType=Pt;activityType=13;allActivities=[];allClubEventsOfUserAuthenticated=new Map;allClubEventsOfUserAuthenticatedForCalendar=new Map;allClubEventsOfUserAuthenticatedToPlay=new Map;allClubEventsOfUserAuthenticatedPast=new Map;allReasons=[];form=new Me({});isMemberCoachsOrAssistantOrSupervisorConnected=!1;isDayManagerAdmin=!1;isDisplayOnAMobile=null;isNetworkStatusOnline=!1;isNotFirstTime=!1;maxDate=p.today();minDate=p.today();selectedCalendarDate;isSelectedCalendarDateAvailable=null;isDateManuallySelected=!1;titleDescriptionDisplay="";isDataLoading=!0;allTeams=[];isPreCalendar=!1;teamSelected=null;oldTeamSelected=null;dataInitialized=!1;lastConnectedUserSysId=null;destroy$=new J;ngOnInit(){this.destroy$.next(),this.form=this.formBuilder.group({teamSelected:[""],coachT1Selected:[""],coachT2Selected:[""],coachT3Selected:[""],coachACSelected:[""]}),this.isDataLoading=!0,this.dateAdapter.setLocale(this.translateService.currentLang),this.subjectService.IsNetworkStatusOnlineSubject.pipe(j(this.destroy$)).subscribe(t=>{this.isNetworkStatusOnline=t}),this.subjectService.IsRefreshClubEventsDoneSubject.pipe(j(this.destroy$)).subscribe(t=>{t&&this.refresh()}),this.subjectService.UserConnectedSubject.pipe(j(this.destroy$)).subscribe(t=>{if(t==null)return;let e=t.sysId??null;this.lastConnectedUserSysId!=null&&e===this.lastConnectedUserSysId||(this.lastConnectedUserSysId=e,this.dataInitialized&&(this.dataInitialized=!1,this.isDataLoading=!0,this.selectedCalendarDate=null,this.teamSelected=null,this.allTeams=[],this.cdr.markForCheck()))}),this.subjectService.IsTrainingPlayerCacheLoadedSubject.pipe(j(this.destroy$)).subscribe(t=>{if(t){try{this.setAllClubEvent()}catch{}this.updateIconState();try{this.matchCalendar&&this.matchCalendar.changeSelectedDate(this.selectedCalendarDate??new Date)}catch{}try{this.cdr.detectChanges()}catch{}}}),this.subjectService.GlobalCacheLoadedStatusSubject.pipe(j(this.destroy$)).subscribe(t=>{this.subjectService.IsButtonInLoadingSubject.next(!1),t===1?(this.dataInitialized=!1,this.isDataLoading=!0,this.cdr.markForCheck()):t!=null&&t==3?this.dataInitialized?this.refresh():this.loadDataAndInitialize():t!=null&&t>=2&&!this.dataInitialized&&this.loadDataAndInitialize()}),this.subjectService.GlobalCacheLoadStatus==2&&!this.dataInitialized?this.loadDataAndInitialize():setTimeout(()=>{this.subjectService.GlobalCacheLoadStatus<2&&this.cacheService.cacheUpdatedDataLoad(!0)},1e3)}async loadDataAndInitialize(){this.dataInitialized||(this.isDataLoading=!0,this.subjectService.IsButtonInLoadingSubject.next(!0),this.cdr.markForCheck(),setTimeout(async()=>{try{this.subjectService.GlobalCacheLoadStatus>=2&&(this.initialize(),this.cdr.markForCheck()),!this.cacheService.isTrainingPlayersLoaded()||!this.cacheService.isTeamsLoaded()||!this.cacheService.isUsersLoaded()||!this.cacheService.isMatchesLoaded()?(await Promise.all([this.cacheService.loadTrainingPlayersCache(!0),this.cacheService.loadTeamsCache(!0),this.cacheService.loadUsersCache(!0),this.cacheService.loadMatchesCache(!0)]),this.initialize(),this.refresh(),this.cdr.markForCheck()):this.refresh(),this.dataInitialized=!0;try{let e=this.storageService.getUserConnected()?.sysId??null;e!=null&&(this.lastConnectedUserSysId=e)}catch{}this.accessRightsService.isUserConnected&&this.teamSelected&&this.subjectService.RefreshClubEventsSubject.next(this.teamSelected),this.isDataLoading=!1,this.subjectService.IsButtonInLoadingSubject.next(!1),this.cdr.markForCheck(),setTimeout(()=>
3{this.cacheService.loadAllSecondaryData().catch(e=>{console.error("Error loading secondary data:",e)})},0)}catch(t){console.error("Error loading training player data:",t),this.isDataLoading=!1,this.subjectService.IsButtonInLoadingSubject.next(!1),this.dataInitialized=!0,this.initialize(),this.cdr.markForCheck()}},0))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}deleteAll(t){this.trainingPlayerCRUDService.deleteAllTrainingPlayersForDate(t,this.cacheService.getAllUsersOfTeamOfCurrentUser(),this.cacheService.getAllTrainingPlayers()).subscribe({next:e=>{if(e&&e.success){let a=this.teamSelected?.sysId;this.removeAllTrainingPlayersForDateFromCache(t,a),this.updateIconState()}},error:e=>{}})}initialize(){if(this.subjectService.GlobalCacheLoadStatus<2){this.setAllClubEvent(),this.setMinMaxDateOfCalendar(),this.translatePage();return}this.isPreCalendar=this.cacheService.getCurrentChampionship().isPreCalendar,this.setMinMaxDateOfCalendar();let t;if(this.accessRightsService.isUserConnectedAdministratorOrSupervisor())t=[...this.cacheService.getAllTeamsWithoutPicture()].filter(n=>!this.isPseudoTeam(n));else{let n=this.storageService.getUserConnected(),r=[];n.team1SysId!=null&&r.push(n.team1SysId),n.team2SysId!=null&&r.push(n.team2SysId),n.team3SysId!=null&&r.push(n.team3SysId),n.team4SysId!=null&&r.push(n.team4SysId);let o=n.sysId;this.cacheService.getAllTeamsWithoutPicture().filter(E=>E!=null&&(E.coachT1SysId!=null&&E.coachT1SysId==o||E.coachT2SysId!=null&&E.coachT2SysId==o||E.coachT3SysId!=null&&E.coachT3SysId==o||E.assitantCoachSysId!=null&&E.assitantCoachSysId==o)).forEach(E=>{r.includes(E.sysId)||r.push(E.sysId)}),t=this.cacheService.getAllTeamsWithoutPicture().filter(E=>r.includes(E.sysId))}this.allTeams=t;let e=this.cacheService.teamForTP(),i=e!=null?t.find(n=>n.sysId==e.sysId)??null:null,a=i==null?this.getOwnTeamOfAdminOrSupervisorInList(t):null;this.teamSelected=i??a??t[0]??null,this.isMemberCoachsOrAssistantOrSupervisorConnected=this.accessRightsService.isMemberCoachsOrAssistantOrSupervisorOfTeam(this.storageService.getUserConnected(),this.teamSelected),this.isDayManagerAdmin=this.accessRightsService.isUserConnectedAdministratorOrSupervisor(),this.selectedCalendarDate?this.matchCalendar?.changeSelectedDate(this.selectedCalendarDate):(this.selectedCalendarDate=p.today(),this.isDateManuallySelected=!0,this.matchCalendar?.changeSelectedDate(this.selectedCalendarDate),this.updateIconState()),this.translatePage(),this.translateService.onLangChange.subscribe(n=>{this.translatePage()})}isPseudoTeam(t){let e=a=>(a??"").normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase(),i=`${e(t?.teamDisplay)} ${e(t?.teamCategory)}`;return i.includes("hors equipe")||i.includes("non classe")}getOwnTeamOfAdminOrSupervisorInList(t){if(!this.accessRightsService.isUserConnectedAdministratorOrSupervisor())return null;let e=this.storageService.getUserConnected();if(e==null)return null;let i=[e.team1SysId,e.team2SysId,e.team3SysId,e.team4SysId];for(let a of i){if(a==null)continue;let n=t.find(r=>r!=null&&r.sysId==a)??null;if(n!=null)return n}return null}blurActiveElement(){try{let t=document.activeElement;t&&typeof t.blur=="function"&&t.blur()}catch{}}onTeamChange(t){setTimeout(()=>{this.isDataLoading=!0,this.teamSelected=t,this.isMemberCoachsOrAssistantOrSupervisorConnected=this.accessRightsService.isMemberCoachsOrAssistantOrSupervisorOfTeam(this.storageService.getUserConnected(),this.teamSelected),this.isDayManagerAdmin=this.accessRightsService.isUserConnectedAdministratorOrSupervisor();let e=this.selectedCalendarDate;this.subjectService.IsButtonInLoadingSubject.next(!0),e&&this.matchCalendar&&(this.selectedCalendarDate=e,this.matchCalendar.changeSelectedDate(e),this.updateIconState(),this.subjectService.IsButtonInLoadingSubject.next(!1)),this.subjectService.RefreshClubEventsSubject.next(t)},0)}setAllClubEvent(){if(this.subjectService.GlobalCacheLoadStatus<2){this.allClubEventsOfUserAuthenticatedForCalendar=new Map,this.allClubEventsOfUserAuthenticated=new Map,this.setMatchListsToPlayAndPast();return}let t=this.cacheService.getAllClubEventsOfUserAuthenticated(),e=this.cacheService.getTrainingPlayerClubEvents();if(this.allClubEventsOfUserAuthenticatedForCalendar=t||new Map,(!e||e.size===0)&&t&&t.size>0){let i=this.teamSelected?.sysId;if(i!=null){let a=("000000"+i).slice(-6);this.allClubEventsOfUserAuthenticated=new Map([...t].filter(([n])=>n.substring(8,14)===a))}else this.allClubEventsOfUserAuthenticated=t}else this.allClubEventsOfUserAuthenticated=e||new Map;this.setMatchListsToPlayAndPast()}setMatchListsToPlayAndPast(){let t=this.storageService.getUserConnected();if(!(t!=null&&this.accessRightsService.isMemberCoachsOrAssistantOrSupervisor(t))){this.allClubEventsOfUserAuthenticatedToPlay=this.allClubEventsOfUserAuthenticated,this.allClubEventsOfUserAuthenticatedPast=new Map;return}let i=p.yyyyMmDd(p.today());this.allClubEventsOfUserAuthenticatedToPlay=new Map,this.allClubEventsOfUserAuthenticatedPast=new Map,this.allClubEventsOfUserAuthenticated.forEach((a,n)=>{p.yyyyMmDd(a.day)<i?this.allClubEventsOfUserAuthenticatedPast.set(n,a):this.allClubEventsOfUserAuthenticatedToPlay.set(n,a)})}refresh(){if(this.subjectService.GlobalCacheLoadStatus<2){this.isDataLoading=!1;return}this.forceRefreshAfterCacheUpdate()}forceRefreshAfterCacheUpdate(){let t=this.selectedCalendarDate;this.setAllClubEvent(),this.matchCalendar!=null&&(this.matchCalendar.updateTodaysDate(),t&&(this.selectedCalendarDate=t,this.matchCalendar.changeSelectedDate(t),this.updateIconState())),this.isNotFirstTime||(this.allReasons=this.frameworkService.getNonPresenceReason(),this.allActivities=this.frameworkService.getMatchTrainingActivitiesType(),this.isNotFirstTime=!0),this.setMinMaxDateOfCalendar(
3),this.isDataLoading=!1}insert(t){this.trainingPlayerCRUDService.insertTrainingPlayer(t,this.isMemberCoachsOrAssistantOrSupervisorConnected).subscribe({next:e=>{e&&e.success&&e.data&&(this.addTrainingPlayerToCache(e.data),this.updateIconState())},error:e=>{}})}onCalendarDateSelect(t,e){this.selectedCalendarDate=t,this.isSelectedCalendarDateAvailable=this.getIsSelectedCalendarDateAvailable(t,e),this.isDateManuallySelected=!0}get iconForCalendarDate(){return this.isSelectedCalendarDateAvailable?"edit delete":"add_box"}updateIconState(){this.selectedCalendarDate&&(this.isSelectedCalendarDateAvailable=this.getIsSelectedCalendarDateAvailable(this.selectedCalendarDate,this.teamSelected),this.cdr.detectChanges())}addTrainingPlayerToCache(t){let e=this.cacheService.getAllTrainingPlayers();e&&(t?.sysId!=null&&e.some(a=>a.sysId===t.sysId)||e.push(t))}removeTrainingPlayerFromCache(t,e=!1){let i=this.cacheService.getAllTrainingPlayers();if(i){let a=i.findIndex(n=>n.trainingPlayerSysId===t.trainingPlayerSysId||n.day&&new Date(n.day).toDateString()===new Date(t.day).toDateString()&&n.teamSysId===t.teamSysId&&n.playerSysId===t.playerSysId);if(a>-1){let n=i.splice(a,1)[0];e?(this.updateIconState(),this.cdr.detectChanges()):this.subjectService.IsTrainingPlayerCacheLoadedSubject.next(!0)}}}removeAllTrainingPlayersForDateFromCache(t,e){let i=this.cacheService.getAllTrainingPlayers();if(i)for(let a=i.length-1;a>=0;a--){let n=i[a];n.day&&new Date(n.day).toDateString()===t.toDateString()&&n.teamSysId===e&&i.splice(a,1)}}getIsSelectedCalendarDateAvailable(t,e){let i=this.cacheService.getEventClubWithTraining(this.allClubEventsOfUserAuthenticated,t,e),a=this.cacheService.getAllTrainingPlayers(),n=e?.idTeam||e?.sysId,r=a?.some(o=>{let y=o.day?new Date(o.day).toDateString():null,E=t==null?"":new Date(t).toDateString(),se=y===E,le=o.teamSysId===n;return se&&le})||!1;return i?.clubActivityType==11?null:i?.clubActivityType==6||i?.clubActivityType==5||i?.clubActivityType==4?!0:i?.clubActivityType==1||i?.clubActivityType==3||i?.clubActivityType==7?null:!!r}onCancelDialog(){this.dialog.closeAll()}onMatchClick(t){this.selectedCalendarDate=t,this.isDateManuallySelected=!0,this.matchCalendar.changeSelectedDate(this.selectedCalendarDate)}onReturnToTraining(){this.subjectService.IsButtonInLoadingSubject.next(!1),this.router.navigate(["/training"])}onTrainingPlayerEdition(){if(this.cacheService.mainCoachOfCurrentLogged()==null)this.frameworkService.displayAlert(!1,"Impossible d'effectuer l'op\xE9ration. Il n'existe aucun coach pour votre \xE9quipe !"),this.subjectService.IsButtonInLoadingSubject.next(!1);else{let t=new at(this.selectedCalendarDate,this.teamSelected);pt(this.platformId)&&this.dialog?(this.blurActiveElement(),this.dialog.open(it,{panelClass:"x-dialogFormDimension",width:this.subjectService.isMobile()?"99vw":"600px",maxWidth:"calc(100vw - 20px)",maxHeight:"calc(100vh - 20px)",data:t}).afterClosed().subscribe(i=>{this.setAllClubEvent(),this.updateIconState(),this.matchCalendar&&this.matchCalendar.changeSelectedDate(this.selectedCalendarDate??new Date),this.subjectService.IsButtonInLoadingSubject.next(!1);try{this.cdr.detectChanges()}catch{}})):this.subjectService.IsButtonInLoadingSubject.next(!1)}}onTrainingPlayerAdmin(){if(!pt(this.platformId)||!this.dialog){this.subjectService.IsButtonInLoadingSubject.next(!1);return}this.blurActiveElement(),this.dialog.open(Ft,{panelClass:"x-dialogFormDimension",width:this.subjectService.isMobile()?"99vw":"720px",maxWidth:"calc(100vw - 20px)",maxHeight:"calc(100vh - 20px)",data:new Rt(this.selectedCalendarDate)}).afterClosed().subscribe(()=>{this.setAllClubEvent(),this.updateIconState(),this.matchCalendar&&this.matchCalendar.changeSelectedDate(this.selectedCalendarDate??new Date),this.subjectService.IsButtonInLoadingSubject.next(!1);try{this.cdr.detectChanges()}catch{}})}onTrainingPlayersManager(){let t=new Vt(this.selectedCalendarDate,this.teamSelected);pt(this.platformId)&&this.dialog?(this.blurActiveElement(),this.dialog.open(Ut,{panelClass:this.subjectService.isMobile()?["x-dialogFormDimension","x-dialogFullHeightMobile"]:"x-dialogFormDimension",width:this.subjectService.isMobile()?"99vw":"600px",maxWidth:"calc(100vw - 20px)",maxHeight:"calc(100vh - 20px)",data:t}).afterClosed().subscribe(i=>{this.setAllClubEvent(),this.updateIconState(),this.matchCalendar&&this.matchCalendar.changeSelectedDate(this.selectedCalendarDate??new Date),this.subjectService.IsButtonInLoadingSubject.next(!1);try{this.cdr.detectChanges()}catch{}})):this.subjectService.IsButtonInLoadingSubject.next(!1)}onTrainingPlayersStatistics(){let t=new Ht(this.selectedCalendarDate);pt(this.platformId)&&this.dialog?(this.blurActiveElement(),this.dialog.open(Lt,{panelClass:"x-dialogFormDimension",width:this.subjectService.isMobile()?"99vw":"600px",maxWidth:"calc(100vw - 20px)",maxHeight:"calc(100vh - 20px)",data:t}).afterClosed().subscribe(i=>{this.subjectService.IsButtonInLoadingSubject.next(!1)})):this.subjectService.IsButtonInLoadingSubject.next(!1)}
3setMinMaxDateOfCalendar(){let t=this.cacheService.teamForTP();t!=null?this.isMemberCoachsOrAssistantOrSupervisorConnected?(this.minDate=new Date(t.startOfTrainingDate),this.maxDate=new Date(t.endOfTrainingDate)):(this.minDate=new Date(p.today()),this.maxDate=new Date(t.endOfTrainingDate)):(this.minDate=new Date(p.today()),this.maxDate=new Date(p.today()),this.maxDate.setFullYear(this.maxDate.getFullYear()+1))}async onExportChampionshipToExcel(){let t=this.cacheService.getAllUsersOfTeamOfCurrentUser().sort((u,_)=>(u.firstName+u.lastName).localeCompare(_.firstName+_.lastName)),e=this.cacheService.getAllTrainingPlayers(),i=this.teamSelected?.sysId,a=u=>u==null?"Garde":u>=1?"Pr\xE9sent":"Absent",n=u=>{switch(u){case 1:return"Championnat";case 3:return"Coupe Hainaut";case 4:return"Match amical";case 5:return"Tournoi";case 6:return"Entra\xEEnement extra";case 7:return"Entra\xEEnement";default:return"Activit\xE9"}},r=i!=null?("000000"+i).slice(-6):null,o=Array.from(this.allClubEventsOfUserAuthenticatedForCalendar.entries()).filter(([u])=>r==null||u.substring(8,14)===r).map(([,u])=>u).filter(u=>[1,3,4,5,6].includes(u.clubActivityType)),y=this.cacheService.getAllTrainingDays(),E=new Set(o.map(u=>new Date(u.day).toDateString())),se=[];if(y.length>0){let u=new Date(this.minDate),_=new Date(this.maxDate);for(;u<=_;){let N=y.find(L=>L.day===u.getDay());N&&!E.has(u.toDateString())&&se.push(new ut({clubActivityType:7,day:new Date(u),availability:1,event:{day:new Date(u),type:"TRAINING_DAY",time:N.timeFrom}})),u.setDate(u.getDate()+1)}}let le=p.today(),Ye=[...o,...se].filter(u=>new Date(u.day)<=le).sort((u,_)=>new Date(u.day).getTime()-new Date(_.day).getTime()),k=t.map(u=>`${u.firstName} ${u.lastName.charAt(0)}.`),ye=Ye.map(u=>{let _=u.event?.fromTeam&&u.event?.awayTeam?[u.event.fromTeam,u.event.awayTeam].find(L=>!L.toLowerCase().includes("bourlettis"))??"":u.event?.description??"",N={Activit\u00E9:_?`${n(u.clubActivityType)} - ${_}`:n(u.clubActivityType),Date:this.datePipe.transform(new Date(u.day),"dd/MM/yyyy")??""};return t.forEach((L,be)=>{let Ce=e.find(Se=>Se.playerSysId===L.sysId&&Se.teamSysId===i&&Se.day&&new Date(Se.day).toDateString()===new Date(u.day).toDateString());N[k[be]]=Ce?a(Ce.present):"Pr\xE9sent"}),N}),S=[...new Set(ye.map(u=>u.Activit\u00E9))],D={};k.forEach(u=>{D[u]={},S.forEach(_=>{D[u][_]={p:0,a:0,g:0}})}),ye.forEach(u=>{let _=u.Activit\u00E9;k.forEach(N=>{let L=u[N];L==="Pr\xE9sent"?D[N][_].p++:L==="Absent"?D[N][_].a++:L==="Garde"&&D[N][_].g++})});let te=u=>u.split(" - ")[0].trim(),z=[...new Set(S.map(te))],U={};k.forEach(u=>{U[u]={},z.forEach(_=>{U[u][_]={p:0,a:0,g:0}})}),ye.forEach(u=>{let _=te(u.Activit\u00E9);k.forEach(N=>{let L=u[N];L==="Pr\xE9sent"?U[N][_].p++:L==="Absent"?U[N][_].a++:L==="Garde"&&U[N][_].g++})});let ve=(u,_)=>_>0?`${Math.round(u/_*100)}%`:"-",st=["Activit\xE9","TOTAL","","",""];k.forEach(u=>st.push(u,"","",""));let lt=[""];["TOTAL",...k].forEach(()=>lt.push("Pr\xE9sent","Absent","Garde","% Pr\xE9s."));let oe=k.map(u=>{let _=0,N=0,L=0;return z.forEach(be=>{_+=U[u][be].p,N+=U[u][be].a,L+=U[u][be].g}),{tP:_,tA:N,tG:L}}),qe=oe.reduce((u,_)=>u+_.tP,0),ot=oe.reduce((u,_)=>u+_.tA,0),fe=oe.reduce((u,_)=>u+_.tG,0),ze=[st,lt],ct=["TOUTES ACTIVIT\xC9S",qe,ot,fe,ve(qe,qe+ot+fe)];oe.forEach(({tP:u,tA:_,tG:N})=>{ct.push(u,_,N,ve(u,u+_+N))}),ze.push(ct),z.forEach(u=>{let _=0,N=0,L=0;k.forEach(Ce=>{_+=U[Ce][u].p,N+=U[Ce][u].a,L+=U[Ce][u].g});let be=[u,_,N,L,ve(_,_+N+L)];
3k.forEach(Ce=>{let{p:Se,a:Zt,g:ei}=U[Ce][u];be.push(Se,Zt,ei,ve(Se,Se+Zt+ei))}),ze.push(be)});let W=`${this.teamSelected?.teamDisplay??"equipe"}${this.datePipe.transform(p.today(),"yyyyMMdd")}`;await this.frameworkService.exportToExcelStyled({fileName:W,actSheet:{rows:ye,playerCols:k},statsPlayerAoa:ze})}translatePage(){this.translateService.get(["TrainingPlayerTitle"]).subscribe(t=>{this.titleDescriptionDisplay=t.TrainingPlayerTitle})}static \u0275fac=function(e){return new(e||s)(g(pi),g(q),g(G),g(Ti),g(Z),g(Y),g(ne),g(Ze),g(di),g(ae),g(Xe),g(We),g(Dt),g(ni))};static \u0275cmp=X({type:s,selectors:[["app-trainingPlayer"]],viewQuery:function(e,i){if(e&1&&St(yt,5),e&2){let a;Tt(a=_t())&&(i.matchCalendar=a.first)}},features:[si([Dt])],decls:20,vars:9,consts:[[3,"formGroup"],[1,"x-matcardHeaderColor"],[1,"x-flexSpaceBetween"],[1,"material-icons","x-iconMatCardTitleOffset"],[1,"x-trainingPlayerContent"],[3,"title","message","type","icon","width",4,"ngIf"],[4,"ngIf"],["class","x-matcard x-matcardFloat",4,"ngIf"],[3,"title","message","type","icon","width"],["panel-title",""],[1,"x-flexStart"],[1,"x-trainingPlayerDropDownTeamTPWidth"],["appearance","fill",1,"x-trainingPlayerDropDownTeamTP"],["panelClass","x-trainingPlayerTeamPanel",3,"selectionChange","value"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],[1,"x-matcard"],[3,"onSelected","minDate","maxDate","team","allClubEventsOfUserAuthenticated"],["class","x-flexCenter",4,"ngIf"],[3,"OnEditTeamAvailability","allClubEventsOfUserAuthenticated","team","date"],[1,"x-flexCenter"],[3,"onClick","icon","text","visibility"],["icon","edit_calendar",3,"onClick","text","visibility"],["icon","pie_chart",3,"onClick","isBackgroundOpaque","text","visibility"],["icon","table_view",3,"onClick","isBackgroundOpaque","isAlwaysEnabled","text","visibility"],[1,"x-matcard","x-matcardFloat"],[3,"widthPanel"],["panel-content",""],[4,"ngFor","ngForOf"],[3,"onClick","eventClub","matchDisplayType","isPresentVisible","isClickable"]],template:function(e,i){e&1&&(d(0,"form",0)(1,"div")(2,"mat-card")(3,"mat-card-header",1)(4,"mat-card-title")(5,"div",2)(6,"div")(7,"span",3),f(8,"thumbs_up_down"),c(),d(9,"span"),f(10),O(11,"translate"),c()()()()(),d(12,"mat-card-content")(13,"mat-card",4)(14,"mat-card-content"),x(15,Ka,1,5,"app-alertMessage",5)(16,Za,9,2,"app-panel",6)(17,sn,6,8,"div",6)(18,on,7,4,"div",7)(19,dn,7,4,"div",7),c()()()()()()),e&2&&(m("formGroup",i.form),l(10),P(i.isDataLoading?w(11,7,"LoadingInProgress"):i.titleDescriptionDisplay),l(5),m("ngIf",i.isPreCalendar),l(),m("ngIf",i.allTeams.length>1),l(),m("ngIf",!i.isDataLoading),l(),m("ngIf",!i.isDataLoading),l(),m("ngIf",!i.isDataLoading&&i.allClubEventsOfUserAuthenticatedPast.size>0))},dependencies:[K,ce,de,Ee,Oe,Ie,we,je,Ae,Fe,Re,ke,Ne,ge,me,ue,he,pe,wt,Q,re,Ci,$t,yt,Si,It,Et,_i,oi,ie],styles:[`:root{--bgc-primary: #c4392e;--bgc-navbarPrimary: #1a1512;--bgc-primary-fade: rgba(196, 57, 46, .1);--fc-primary: #f5f0ec;--brand-700: #8a2820;--brand-600: #a33028;--brand-mid: #c4392e;--brand-400: #d4463a;--brand-alt: #e8564a;--brand-3: #6e2018;--brand-700-rgb: 138, 40, 32;--brand-600-rgb: 163, 48, 40;--brand-mid-rgb: 196, 57, 46;--brand-400-rgb: 212, 70, 58;--brand-alt-rgb: 232, 86, 74;--brand-3-rgb: 110, 32, 24;--surface-base: #120e0c;--surface-1: #1a1512;--surface-2: #231c18;--surface-3: #2d2420;--surface-4: #382e28;--border-subtle: #3a2e28;--border-default: #4a3a32;--text-primary: #f5f0ec;--text-secondary: #e9d9d9;--text-muted: #7a6a5a;--bgc-comitee-normal: #1a2744;--fc-comitee-normal: #8aa0b8;--bgc-comitee-technical: #1e2c24;--fc-comitee-technical: #8aa890;--bgc-comitee-strategic: #3a263e;--fc-comitee-strategic: #b89ab0}.x-trainingPlayerContent{width:600px}@media screen and (max-width: 480px),screen and (max-height: 500px){.x-trainingPlayerContent{width:99%}}.x-trainingPlayerGrid{display:grid;grid-template-columns:1fr auto;gap:0px;height:110%}.x-trainingPlayerDropDownTeamTP{margin-left:20px;width:100%;min-width:300px}@media screen and (max-width: 480px),screen and (max-height: 500px){.x-trainingPlayerDropDownTeamTP{width:100%;min-width:0}}.x-trainingPlayerDropDownTeamTPWidth{flex:1 1 auto;min-width:300px}@media screen and (max-width: 480px),screen and (max-height: 500px){.x-trainingPlayerDropDownTeamTPWidth{width:100%;min-width:0}}.x-trainingPlayerTeamPanel.mat-mdc-select-panel{max-width:600px!important}
4`],encapsulation:2,changeDetection:0})};export{Hi as TrainingPlayerComponent};

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.