@golstats/gsc-lineups-reports 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +2 -0
  2. package/dist/atajada.svg +57 -0
  3. package/dist/backarrow.svg +3 -0
  4. package/dist/cancha-3d.png +0 -0
  5. package/dist/contorno-escudo.svg +3 -0
  6. package/dist/css/fonts.css +91 -0
  7. package/dist/escudo1.png +0 -0
  8. package/dist/escudo2.png +0 -0
  9. package/dist/favicon.ico +0 -0
  10. package/dist/field-green-posesion.png +0 -0
  11. package/dist/fin-del-partido.svg +44 -0
  12. package/dist/fonts/BebasNeue-Bold.otf +0 -0
  13. package/dist/fonts/BebasNeue-Bold.ttf +0 -0
  14. package/dist/fonts/BebasNeue-Bold.woff2 +0 -0
  15. package/dist/fonts/BebasNeue-Book.otf +0 -0
  16. package/dist/fonts/BebasNeue-Book.ttf +0 -0
  17. package/dist/fonts/BebasNeue-Book.woff2 +0 -0
  18. package/dist/fonts/BebasNeue-Light.otf +0 -0
  19. package/dist/fonts/BebasNeue-Light.ttf +0 -0
  20. package/dist/fonts/BebasNeue-Light.woff2 +0 -0
  21. package/dist/fonts/BebasNeue-Regular.otf +0 -0
  22. package/dist/fonts/BebasNeue-Regular.ttf +0 -0
  23. package/dist/fonts/BebasNeue-Regular.woff2 +0 -0
  24. package/dist/fonts/BebasNeue-Thin.otf +0 -0
  25. package/dist/fonts/BebasNeue-Thin.ttf +0 -0
  26. package/dist/fonts/BebasNeue-Thin.woff2 +0 -0
  27. package/dist/fonts/Montserrat-Black.otf +0 -0
  28. package/dist/fonts/Montserrat-BlackItalic.otf +0 -0
  29. package/dist/fonts/Montserrat-Bold.otf +0 -0
  30. package/dist/fonts/Montserrat-BoldItalic.otf +0 -0
  31. package/dist/fonts/Montserrat-ExtraBold.otf +0 -0
  32. package/dist/fonts/Montserrat-ExtraBoldItalic.otf +0 -0
  33. package/dist/fonts/Montserrat-ExtraLight.otf +0 -0
  34. package/dist/fonts/Montserrat-ExtraLightItalic.otf +0 -0
  35. package/dist/fonts/Montserrat-Italic.otf +0 -0
  36. package/dist/fonts/Montserrat-Light.otf +0 -0
  37. package/dist/fonts/Montserrat-LightItalic.otf +0 -0
  38. package/dist/fonts/Montserrat-Medium.otf +0 -0
  39. package/dist/fonts/Montserrat-MediumItalic.otf +0 -0
  40. package/dist/fonts/Montserrat-Regular.otf +0 -0
  41. package/dist/fonts/Montserrat-SemiBold.otf +0 -0
  42. package/dist/fonts/Montserrat-SemiBoldItalic.otf +0 -0
  43. package/dist/fonts/Montserrat-Thin.otf +0 -0
  44. package/dist/fonts/Montserrat-ThinItalic.otf +0 -0
  45. package/dist/fonts/Oswald-Bold.ttf +0 -0
  46. package/dist/fonts/Oswald-ExtraLight.ttf +0 -0
  47. package/dist/fonts/Oswald-Light.ttf +0 -0
  48. package/dist/fonts/Oswald-Medium.ttf +0 -0
  49. package/dist/fonts/Oswald-Regular.ttf +0 -0
  50. package/dist/fonts/Oswald-SemiBold.ttf +0 -0
  51. package/dist/fonts/Poppins-Black.otf +0 -0
  52. package/dist/fonts/Poppins-BlackItalic.otf +0 -0
  53. package/dist/fonts/Poppins-Bold.otf +0 -0
  54. package/dist/fonts/Poppins-BoldItalic.otf +0 -0
  55. package/dist/fonts/Poppins-ExtraBold.otf +0 -0
  56. package/dist/fonts/Poppins-ExtraBoldItalic.otf +0 -0
  57. package/dist/fonts/Poppins-ExtraLight.otf +0 -0
  58. package/dist/fonts/Poppins-ExtraLightItalic.otf +0 -0
  59. package/dist/fonts/Poppins-Italic.otf +0 -0
  60. package/dist/fonts/Poppins-Light.otf +0 -0
  61. package/dist/fonts/Poppins-LightItalic.otf +0 -0
  62. package/dist/fonts/Poppins-Medium.otf +0 -0
  63. package/dist/fonts/Poppins-MediumItalic.otf +0 -0
  64. package/dist/fonts/Poppins-Regular.otf +0 -0
  65. package/dist/fonts/Poppins-SemiBold.otf +0 -0
  66. package/dist/fonts/Poppins-SemiBoldItalic.otf +0 -0
  67. package/dist/fonts/Poppins-Thin.otf +0 -0
  68. package/dist/fonts/Poppins-ThinItalic.otf +0 -0
  69. package/dist/fuera-de-lugar.svg +58 -0
  70. package/dist/gol.svg +49 -0
  71. package/dist/group-427321178.svg +8 -0
  72. package/dist/group-427321179.svg +5 -0
  73. package/dist/group-427321501.svg +5 -0
  74. package/dist/gsc-lineups-reports.css +1 -0
  75. package/dist/gsc-lineups-reports.es.js +11272 -0
  76. package/dist/gsc-lineups-reports.umd.js +10 -0
  77. package/dist/icn-arrow-expand.svg +3 -0
  78. package/dist/icn-cambio.svg +27 -0
  79. package/dist/icn-expand-arrow.svg +3 -0
  80. package/dist/icn-expand-arrow1.svg +3 -0
  81. package/dist/icn-falta.svg +43 -0
  82. package/dist/icn-filter.svg +12 -0
  83. package/dist/icn-filter1.svg +12 -0
  84. package/dist/icn-filter2.svg +12 -0
  85. package/dist/icn-golstats.png +0 -0
  86. package/dist/icn-play.svg +10 -0
  87. package/dist/icn-tarjeta-amarilla.svg +4 -0
  88. package/dist/icn-tarjeta-roja.svg +4 -0
  89. package/dist/icn-tiro-a-porteria.svg +36 -0
  90. package/dist/icn-tiros-de-esquina.svg +55 -0
  91. package/dist/images/cancha-horizontal-raw.jpg +0 -0
  92. package/dist/images/cancha-horizontal.jpg +0 -0
  93. package/dist/images/canchaRPH.svg +30 -0
  94. package/dist/images/events/atajada.svg +57 -0
  95. package/dist/images/events/cambio.svg +27 -0
  96. package/dist/images/events/falta.svg +43 -0
  97. package/dist/images/events/favicon.ico +0 -0
  98. package/dist/images/events/fin-del-partido.svg +44 -0
  99. package/dist/images/events/fuera-de-lugar.svg +58 -0
  100. package/dist/images/events/generic.svg +1 -0
  101. package/dist/images/events/gol.svg +49 -0
  102. package/dist/images/events/icn-cambio.svg +6 -0
  103. package/dist/images/events/icn-falta.svg +4 -0
  104. package/dist/images/events/icn-play.svg +3 -0
  105. package/dist/images/events/icn-tarjeta-amarilla.svg +3 -0
  106. package/dist/images/events/icn-tarjeta-roja.svg +3 -0
  107. package/dist/images/events/icn-tiro-a-porteria.svg +36 -0
  108. package/dist/images/events/icn-tiros-de-esquina.svg +18 -0
  109. package/dist/images/events/inicia-el-partido.svg +46 -0
  110. package/dist/images/events/jugada-peligrosa.svg +91 -0
  111. package/dist/images/events/penal-fallado.svg +195 -0
  112. package/dist/images/events/penal-marcado.svg +190 -0
  113. package/dist/images/events/tiempo-agregado.svg +75 -0
  114. package/dist/images/events/tiro-a-porteria.svg +81 -0
  115. package/dist/images/events/tiro-de-esquina.svg +55 -0
  116. package/dist/images/events/var.png +0 -0
  117. package/dist/images/events/var.svg +31 -0
  118. package/dist/inicia-el-partido.svg +46 -0
  119. package/dist/jugada-peligrosa.svg +91 -0
  120. package/dist/line-white.png +0 -0
  121. package/dist/line.png +0 -0
  122. package/dist/next-arrow.svg +3 -0
  123. package/dist/nextarrow.svg +3 -0
  124. package/dist/penal-fallado.svg +195 -0
  125. package/dist/penal-marcado.svg +190 -0
  126. package/dist/play-icn.svg +3 -0
  127. package/dist/shape.svg +3 -0
  128. package/dist/styles.css +1191 -0
  129. package/dist/tiempo-agregado.svg +75 -0
  130. package/dist/tiro-a-porteria.svg +81 -0
  131. package/dist/var.png +0 -0
  132. package/dist/var.svg +31 -0
  133. package/package.json +71 -0
  134. package/src/App.vue +9 -0
  135. package/src/components/Lineup2D/CheckBox.vue +42 -0
  136. package/src/components/Lineup2D/FilterEmpty.vue +49 -0
  137. package/src/components/Lineup2D/Icons.vue +30 -0
  138. package/src/components/Lineup2D/LineupField.vue +120 -0
  139. package/src/components/Lineup2D/LineupFilter.vue +286 -0
  140. package/src/components/Lineup2D/LineupMainHeader.vue +223 -0
  141. package/src/components/Lineup2D/LineupRecentItem.vue +111 -0
  142. package/src/components/Lineup2D/MatchDetails.vue +67 -0
  143. package/src/components/Lineup2D/playerimg.png +0 -0
  144. package/src/components/Lineup2D/tijuana.png +0 -0
  145. package/src/components/gsc-filter.vue +287 -0
  146. package/src/components/gsc-header-historico-lineup.vue +985 -0
  147. package/src/components/gsc-header-postmatch-lineup.vue +968 -0
  148. package/src/components/gsc-header-probables-lineup.vue +1044 -0
  149. package/src/components/gsc-header-recientes-lineup.vue +1873 -0
  150. package/src/components/gsc-lineup-dosd.vue +3752 -0
  151. package/src/components/gsc-lineup-main.vue +65 -0
  152. package/src/components/gsc-lineups-reports.vue +27 -0
  153. package/src/components/gsc-lineups.vue +6562 -0
  154. package/src/components/gsc-player-card.vue +166 -0
  155. package/src/index.js +4 -0
  156. package/src/main.js +4 -0
  157. package/src/types.d.ts +45 -0
  158. package/src/utils/socketConnection.js +29 -0
@@ -0,0 +1,3752 @@
1
+ <template>
2
+ <section class="lineup" :class="{ 'break-point-3': mobileClass }">
3
+ <div class="lineup__header" ref="gamesContainer">
4
+ <h2>Alineaciones</h2>
5
+ <div style="width: 325px" v-if="selectedOption !== 'Postmatch'">
6
+ <GscSwitchComponent
7
+ v-if="
8
+ (gameInfoheader.game_status == 0 || gameInfoheader.game_status == 4) &&
9
+ gameRecientesFilter.length > 0
10
+ "
11
+ :buttons="['Historicos', 'Recientes', 'Probables']"
12
+ :selectedOption="selectedOption"
13
+ :type="1"
14
+ :arrow="false"
15
+ borderRadius="32px"
16
+ height="28px"
17
+ fontSize="11px;"
18
+ fontFamily="Poppins-Regular"
19
+ border-width="1px"
20
+ border-width-container="0.5px"
21
+ backgroundOptionDisable="#162533"
22
+ @input="selectedOption = $event"
23
+ />
24
+ </div>
25
+ </div>
26
+ <div class="lineup__card">
27
+ <template v-if="selectedOption !== 'Postmatch'">
28
+ <h3 v-if="selectedOption === 'Probables'">Alineación utilizada este torneo en:</h3>
29
+ <h3 v-else-if="selectedOption === 'Recientes'">Alineaciones recientes de:</h3>
30
+ <h3 v-else>Alineación utilizada en:</h3>
31
+ </template>
32
+ <template v-if="selectedOption === 'Historicos'">
33
+ <LineupMainHeader
34
+ v-if="Object.keys(headerInfoHistoricItemGame).length > 0"
35
+ :localTeam="{
36
+ acronym: headerInfoHistoricItemGame.home_team_abbreviation,
37
+ img:
38
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' +
39
+ headerInfoHistoricItemGame.home_team +
40
+ '.png'
41
+ }"
42
+ :visitTeam="{
43
+ acronym: headerInfoHistoricItemGame.away_team_abbreviation,
44
+ img:
45
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' +
46
+ headerInfoHistoricItemGame.away_team +
47
+ '.png'
48
+ }"
49
+ :probablyTeamHome="{ acronym: rivalHomeAbrev, img: rivalHomeImg }"
50
+ :probablyTeamAway="{ acronym: rivalVisitAbrev, img: rivalVisitImg }"
51
+ :score="headerInfoHistoricItemGame.score[0] + ' - ' + headerInfoHistoricItemGame.score[1]"
52
+ @change="changeSwitchRadio"
53
+ :type="selectedOption"
54
+ />
55
+ </template>
56
+ <template v-else>
57
+ <LineupMainHeader
58
+ v-if="Object.keys(gameInfoheader).length > 0"
59
+ :localTeam="{
60
+ acronym: gameInfoheader.home_team_abbreviation,
61
+ img: 'https://golstatsimages.blob.core.windows.net/teams-80/' + gameInfoheader.home_team + '.png'
62
+ }"
63
+ :visitTeam="{
64
+ acronym: gameInfoheader.away_team_abbreviation,
65
+ img: 'https://golstatsimages.blob.core.windows.net/teams-80/' + gameInfoheader.away_team + '.png'
66
+ }"
67
+ :probablyTeamHome="{ acronym: rivalHomeAbrev, img: rivalHomeImg }"
68
+ :probablyTeamAway="{ acronym: rivalVisitAbrev, img: rivalVisitImg }"
69
+ :score="gameInfoheader.score[0] + ' - ' + gameInfoheader.score[1]"
70
+ @change="changeSwitchRadio"
71
+ :type="selectedOption"
72
+ />
73
+ </template>
74
+
75
+ <div v-if="selectedOption === 'Historicos'" class="lineup__card-body">
76
+ <template v-if="selectedOption !== 'Postmatch'">
77
+ <div class="lineup__selector" style="margin: auto">
78
+ <GSCCarousel
79
+ :key="updatehistoricos"
80
+ v-if="gamesHistoric.length > 0"
81
+ @input="changeCarouselItemH"
82
+ :items="gamesHistoric"
83
+ isMainSlidePriority
84
+ areSlidesArrowsVisible
85
+ :areNavigationArrowsVisible="false"
86
+ slideLeftArrowBackgroundImage="none"
87
+ slideRightArrowBackgroundImage="none"
88
+ >
89
+ <template #default="{ item }">
90
+ <div class="lineup__selector-item">
91
+ {{ item.description }}
92
+ </div>
93
+ </template>
94
+ </GSCCarousel>
95
+ </div>
96
+ <div class="lineup__text-btn-abs" @click="showDetails = !showDetails">
97
+ {{ !showDetails ? 'Ver detalles' : 'Ocultar detalles' }}
98
+ </div>
99
+ </template>
100
+ </div>
101
+ <div
102
+ v-else-if="selectedOption === 'Recientes'"
103
+ class="lineup__card-body"
104
+ style="flex-flow: column"
105
+ >
106
+ <div class="lineup__filters">
107
+ <LineupFilter name="Filtros" @change="changeFiltersModal" :reset="vDeleteFilter" />
108
+ <div class="lineup__filters__selector" ref="targetElement" @click="handleInsideClick">
109
+ <GSCDropdown
110
+ @click="clickOnValueFilter"
111
+ :items="matchdaysFinal"
112
+ @input="changeDropdown"
113
+ backgroundColor="transparent"
114
+ height="25px"
115
+ :key="keyUpdate"
116
+ color="rgba(255, 255, 255, 0.7)"
117
+ arrowColor="rgba(255, 255, 255, 0.7)"
118
+ borderColor="rgba(255, 255, 255, 0.3)"
119
+ style="font-size: 10px"
120
+ arrowHeight="16"
121
+ :arrowWidth="16"
122
+ :default-item-by-prop="defaultDropItem"
123
+ listHeight="300px"
124
+ listBackgroundColor="#243a4c"
125
+ hoverBackgroundColor="#0d1d2a"
126
+ listItemColor="#FFFFFF"
127
+ listItemSelectedBackgroundColor="#0d1d2a"
128
+ listItemSelectedColor="#c3e569"
129
+ listItemPadding="8px 7px"
130
+ listBorderColor="rgba(255, 255, 255, 0.1)"
131
+ listBorderRadius="2px"
132
+ >
133
+ <template #default="data">
134
+ <div class="selector-tournaments">{{ data.selectedItem.name }}</div>
135
+ </template>
136
+ <template #availableItem="{ item }">
137
+ <div>{{ item.name }}</div>
138
+ </template>
139
+ </GSCDropdown>
140
+ </div>
141
+ <div class="lineup__text-btn" @click="showDetails = !showDetails">
142
+ {{ !showDetails ? 'Ver detalles' : 'Ocultar detalles' }}
143
+ </div>
144
+ </div>
145
+ <div class="lineup__items-carousel">
146
+ <div></div>
147
+ <div class="lineup__items-center">
148
+ <template v-if="!mobileClass">
149
+ <div class="lineup__selector-recientes">
150
+ <GSCCarousel
151
+ @click="clickOnValueCarrousel"
152
+ :default-item-by-index="selectedIndexOption"
153
+ v-if="gameRecientesFilter.length > 0"
154
+ width="600px"
155
+ height="80px"
156
+ :key="updateCarouselGames"
157
+ @input="changeCarouselItem"
158
+ :items="gameRecientesFilter"
159
+ isMainSlidePriority
160
+ areSlidesArrowsVisible
161
+ :areNavigationArrowsVisible="false"
162
+ slideLeftArrowBackgroundImage="none"
163
+ slideRightArrowBackgroundImage="none"
164
+ >
165
+ <template #default="{ item }">
166
+ <LineupRecentItem :game="item" :teamSelect="teamSelect" />
167
+ </template>
168
+ </GSCCarousel>
169
+ <div v-else class="containernofoundsearchrecientes">
170
+ <div class="text-containernofoundsearchrecientes">
171
+ No hay resultados con los criterios, <br />
172
+ de búsqueda aplicados.
173
+ </div>
174
+ <div class="btn-delete-filters" @click="clickOnDeleteFilter">
175
+ Eliminar filtros aplicados
176
+ </div>
177
+ </div>
178
+ </div>
179
+ <MatchDetails
180
+ v-if="showDetails"
181
+ :localDetails="localDetails"
182
+ :foreignDetails="foreignDetails"
183
+ />
184
+ </template>
185
+ <!-- <FilterEmpty />-->
186
+ </div>
187
+ </div>
188
+ <div
189
+ v-if="mobileClass"
190
+ class="lineup__selector-recientes"
191
+ style="margin: auto; width: 100%"
192
+ >
193
+ <GSCCarousel
194
+ @click="clickOnValueCarrousel"
195
+ :default-item-by-index="selectedIndexOption"
196
+ v-if="gameRecientesFilter.length > 0"
197
+ width="600px"
198
+ height="80px"
199
+ :key="updateCarouselGames"
200
+ @input="changeCarouselItem"
201
+ :items="gameRecientesFilter"
202
+ isMainSlidePriority
203
+ areSlidesArrowsVisible
204
+ :areNavigationArrowsVisible="false"
205
+ >
206
+ <template #default="{ item }">
207
+ <LineupRecentItem :game="item" :teamSelect="teamSelect" style="max-width: 200px" />
208
+ </template>
209
+ </GSCCarousel>
210
+ <MatchDetails
211
+ v-if="showDetails"
212
+ :localDetails="localDetails"
213
+ :foreignDetails="foreignDetails"
214
+ />
215
+ </div>
216
+ </div>
217
+ <div v-else-if="selectedOption === 'Probables'" class="lineup__card-body space-between">
218
+ <div class="lineup__card-body__probables">
219
+ <GSCDropdown
220
+ :items="matchHomeProbables"
221
+ @input="changeDropdownLocal"
222
+ backgroundColor="transparent"
223
+ height="25px"
224
+ color="rgba(255, 255, 255, 0.7)"
225
+ arrowColor="rgba(255, 255, 255, 0.7)"
226
+ borderColor="rgba(255, 255, 255, 0.3)"
227
+ style="font-size: 10px"
228
+ arrowHeight="16"
229
+ :arrowWidth="16"
230
+ listHeight="300px"
231
+ listBackgroundColor="#243a4c"
232
+ hoverBackgroundColor="#0d1d2a"
233
+ listItemColor="#FFFFFF"
234
+ listItemSelectedBackgroundColor="#0d1d2a"
235
+ listItemSelectedColor="#c3e569"
236
+ listItemPadding="8px 7px"
237
+ listBorderColor="rgba(255, 255, 255, 0.1)"
238
+ listBorderRadius="2px"
239
+ >
240
+ <template #default="data">
241
+ <div class="selector-tournaments">{{ data.selectedItem.name }}</div>
242
+ </template>
243
+ <template #availableItem="{ item }">
244
+ <div>{{ item.name }}</div>
245
+ </template>
246
+ </GSCDropdown>
247
+ <div class="lineup__card-body__team-vs">vs</div>
248
+ <img :src="rivalHomeImg" class="lineup__card-body__img-probables" />
249
+ </div>
250
+
251
+ <div class="lineup__card-body__probables">
252
+ <img :src="rivalVisitImg" class="lineup__card-body__img-probables" />
253
+ <div class="lineup__card-body__team-vs">vs</div>
254
+ <GSCDropdown
255
+ :items="matchAwayProbables"
256
+ @input="changeDropdownVisit"
257
+ backgroundColor="transparent"
258
+ height="25px"
259
+ color="rgba(255, 255, 255, 0.7)"
260
+ arrowColor="rgba(255, 255, 255, 0.7)"
261
+ borderColor="rgba(255, 255, 255, 0.3)"
262
+ style="font-size: 10px"
263
+ arrowHeight="16"
264
+ :arrowWidth="16"
265
+ listHeight="300px"
266
+ listBackgroundColor="#243a4c"
267
+ hoverBackgroundColor="#0d1d2a"
268
+ listItemColor="#FFFFFF"
269
+ listItemSelectedBackgroundColor="#0d1d2a"
270
+ listItemSelectedColor="#c3e569"
271
+ listItemPadding="8px 7px"
272
+ listBorderColor="rgba(255, 255, 255, 0.1)"
273
+ listBorderRadius="2px"
274
+ >
275
+ <template #default="data">
276
+ <div class="selector-tournaments">{{ data.selectedItem.name }}</div>
277
+ </template>
278
+ <template #availableItem="{ item }">
279
+ <div>{{ item.name }}</div>
280
+ </template>
281
+ </GSCDropdown>
282
+ </div>
283
+ </div>
284
+
285
+ <div v-else-if="selectedOption === 'Postmatch'" class="lineup__card-body space-between">
286
+ <div class="postmatch__matchday">
287
+ {{
288
+ gameInfoheader.season_name !== undefined
289
+ ? gameInfoheader.season_name +
290
+ '&nbsp; | &nbsp;' +
291
+ remplazarMxJor(gameInfoheader.matchday_abbreviation) +
292
+ '&nbsp; | &nbsp;' +
293
+ gameInfoheader.home_team_abbreviation +
294
+ ' - ' +
295
+ gameInfoheader.away_team_abbreviation
296
+ : ''
297
+ }}
298
+ </div>
299
+ <div class="lineup__text-btn-abs" @click="showDetails = !showDetails">
300
+ {{ !showDetails ? 'Ver detalles' : 'Ocultar detalles' }}
301
+ </div>
302
+ </div>
303
+ <MatchDetails
304
+ style="margin-bottom: 17px"
305
+ v-if="showDetails && (selectedOption === 'Historicos' || selectedOption === 'Postmatch')"
306
+ :localDetails="localDetails"
307
+ :foreignDetails="foreignDetails"
308
+ />
309
+ <LineupField class="lineup__field" :players="players" />
310
+ </div>
311
+ </section>
312
+ </template>
313
+
314
+ <script>
315
+ import axios from 'axios'
316
+ import { connectSocket, connectChannel } from '@/utils/socketConnection'
317
+ let calendarResizeObserver = null
318
+ import tijuanaImage from '@/components/Lineup2D/tijuana.png'
319
+ import LineupField from '@/components/Lineup2D/LineupField.vue'
320
+ import LineupRecentItem from '@/components/Lineup2D/LineupRecentItem.vue'
321
+ import LineupMainHeader from '@/components/Lineup2D/LineupMainHeader.vue'
322
+ import LineupFilter from '@/components/Lineup2D/LineupFilter.vue'
323
+ import MatchDetails from '@/components/Lineup2D/MatchDetails.vue'
324
+ import { GscSwitchComponent } from '@golstats/gsc-switch-component'
325
+ import { GSCCarousel } from '@golstats/gsc-carousel'
326
+
327
+ /*
328
+ import {
329
+ GSCDropdown
330
+ } from './gsc-dropdown.js'
331
+ import './style.css'
332
+ */
333
+
334
+ import { GSCDropdown } from '@golstats/gsc-dropdown'
335
+ import '@@/@golstats/gsc-dropdown/dist/style.css'
336
+
337
+ import '@@/@golstats/gsc-switch-radio/dist/style.css'
338
+ import '@@/@golstats/gsc-switch-component/dist/style.css'
339
+ import '@@/@golstats/gsc-carousel/dist/style.css'
340
+ import '@@/@golstats/gsc-button/dist/style.css'
341
+
342
+ export default {
343
+ components: {
344
+ LineupField,
345
+ LineupRecentItem,
346
+ LineupMainHeader,
347
+ LineupFilter,
348
+ MatchDetails,
349
+ GscSwitchComponent,
350
+ GSCCarousel,
351
+ GSCDropdown
352
+ },
353
+ props: {
354
+ game: {
355
+ type: Object,
356
+ default: () => {}
357
+ },
358
+ selectedOption: {
359
+ type: String,
360
+ default: 'Recientes'
361
+ },
362
+ componentWidth: {
363
+ type: Number,
364
+ default: 767,
365
+ validator(value) {
366
+ return value > 0
367
+ }
368
+ },
369
+ socket: {
370
+ type: Object,
371
+ default: () => {}
372
+ }
373
+ },
374
+ data() {
375
+ return {
376
+ selectedIndexOption: 0,
377
+ rivalHomeImg: '',
378
+ rivalVisitImg: '',
379
+ rivalHomeAbrev: '',
380
+ updatehistoricos: 0,
381
+ rivalVisitAbrev: '',
382
+ selectOptMenuheader: 'Recientes',
383
+ token:
384
+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6IlVzdWFyaW8gRnJlZSIsInVzZXJuYW1lIjoiZnJlZUBnb2xzdGF0cy5jb20iLCJlbWFpbCI6ImZyZWVAZ29sc3RhdHMuY29tIiwiaWF0IjoxNjA2NzU4Nzk1LCJleHAiOjE2MzgyOTQ3OTV9.kPNmP7yDtk38cAXrUyc7OHRh6J25VFqy-XUNzbK-4YE',
385
+ tokenPremium:
386
+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NTg2LCJuYW1lIjoiSkFTIEdvbFN0YXRzIiwidXNlcm5hbWUiOiJ5YXRlYW1lcmljYSIsImVtYWlsIjoiIiwicHJvdmlkZXJfaWQiOjEsImxvZ2luX2dvbHN0YXRzIjoxLCJpYXQiOjE2OTYzNjU1ODcsImV4cCI6MTcyNzkwMTU4N30.jynRtgtFM8sf8gtqZJ-1gHLc2Ws13TIykXcfrlOvv1g',
387
+ urlGames:
388
+ 'https://iwxfzq6e2h.execute-api.us-west-2.amazonaws.com/prod/v2/statisticsLeagueBySeason/',
389
+ url: 'https://tj4cepyjc4.execute-api.us-west-2.amazonaws.com/prod/lineups/',
390
+ urlMXM: 'https://al2nv2dmkc.execute-api.us-west-2.amazonaws.com/prod/mxm/',
391
+ retries: 3,
392
+ teamActive: 'home',
393
+ subsActive: false,
394
+ playersHome: [],
395
+ gamesContainerWidth: 0,
396
+ playersAway: [],
397
+ subsTitle: false,
398
+ uniformHome: '',
399
+ uniformHomeG: '',
400
+ uniformAway: '',
401
+ uniformAwayG: '',
402
+ dataPlayersHome: [],
403
+ dataPlayersAway: [],
404
+ homeTeamLogo: '',
405
+ awayTeamLogo: '',
406
+ homeTeamName: '',
407
+ auxISsection: 0,
408
+ awayTeamName: '',
409
+ homeTeamAbrev: '',
410
+ awayTeamAbrev: '',
411
+ home_team_id: 0,
412
+ updateComponentAway: 0,
413
+ away_team_id: 0,
414
+ substitutionModal: {
415
+ min: '',
416
+ in: {
417
+ playerImg: '',
418
+ teamImg: '',
419
+ nationalityimg: '',
420
+ name: '',
421
+ position: '',
422
+ shirt_number: ''
423
+ },
424
+ out: {
425
+ playerImg: '',
426
+ teamImg: '',
427
+ nationalityimg: '',
428
+ name: '',
429
+ position: '',
430
+ shirt_number: ''
431
+ }
432
+ },
433
+ isInsideClick: false,
434
+ homeTeam: {},
435
+ headerInfoHistoricItemGame: {},
436
+ visitingTeam: {},
437
+ gameForAnalysis: {},
438
+ movil: false,
439
+ auxProbablesIDGameHome: 0,
440
+ auxProbablesIDGameAway: 0,
441
+ positions: [
442
+ {
443
+ name: 'Portero'
444
+ },
445
+ {
446
+ name: 'Defensa central'
447
+ },
448
+ {
449
+ name: 'Lateral por izquierda'
450
+ },
451
+ {
452
+ name: 'Lateral por derecha'
453
+ },
454
+ {
455
+ name: 'Volante por izquierda'
456
+ },
457
+ {
458
+ name: 'Volante por derecha'
459
+ },
460
+ {
461
+ name: 'Volante defensivo'
462
+ },
463
+ {
464
+ name: 'Volante ofensivo'
465
+ },
466
+ {
467
+ name: 'Delantero'
468
+ },
469
+ {
470
+ name: 'Desconocida'
471
+ }
472
+ ],
473
+ vDeleteFilter: false,
474
+ gameInfoheader: {},
475
+ gamesHistoric: [],
476
+ gamesRecientes: [],
477
+ matchdaysPerTeam: [],
478
+ lastGetGame: 0,
479
+
480
+ probablyTeam: {
481
+ acronym: 'NEX',
482
+ img: tijuanaImage
483
+ },
484
+ localDetails: [],
485
+ postmatchDescription: 'Clausura 2018 I JOR 5 I CHI - ATL 12',
486
+ showDetails: false,
487
+ foreignDetails: [],
488
+ players: [],
489
+ filterObject: {
490
+ selectedFilterResults: ['win', 'draw', 'lose'],
491
+ selectedFilterTeam: ['visit', 'local']
492
+ },
493
+ updateCarouselGames: 0,
494
+ teamSelect: '',
495
+ matchdaysFiltersUpdate: [],
496
+ gamesFiltersUpdate: []
497
+ }
498
+ },
499
+ computed: {
500
+ matchdaysFinal() {
501
+ var matchdaysFinal = []
502
+ if (typeof this.filterObject.selectedFilterResults !== 'undefined') {
503
+ if (Object.keys(this.filterObject.selectedFilterResults).length != 3) {
504
+ if (Object.keys(this.filterObject.selectedFilterResults).length == 2) {
505
+ if (
506
+ Object.values(this.filterObject.selectedFilterResults).includes('win') &&
507
+ Object.values(this.filterObject.selectedFilterResults).includes('draw')
508
+ ) {
509
+ for (let index = 0; index < this.matchdaysFiltersUpdate.length; index++) {
510
+ if (this.matchdaysFiltersUpdate[index].match_result == 1) {
511
+ matchdaysFinal.push(this.matchdaysFiltersUpdate[index])
512
+ }
513
+ }
514
+ for (let index = 0; index < this.matchdaysFiltersUpdate.length; index++) {
515
+ if (this.matchdaysFiltersUpdate[index].match_result == 3) {
516
+ matchdaysFinal.push(this.matchdaysFiltersUpdate[index])
517
+ }
518
+ }
519
+ }
520
+ if (
521
+ Object.values(this.filterObject.selectedFilterResults).includes('win') &&
522
+ Object.values(this.filterObject.selectedFilterResults).includes('lose')
523
+ ) {
524
+ for (let index = 0; index < this.matchdaysFiltersUpdate.length; index++) {
525
+ if (this.matchdaysFiltersUpdate[index].match_result == 1) {
526
+ matchdaysFinal.push(this.matchdaysFiltersUpdate[index])
527
+ }
528
+ }
529
+ for (let index = 0; index < this.matchdaysFiltersUpdate.length; index++) {
530
+ if (this.matchdaysFiltersUpdate[index].match_result == 2) {
531
+ matchdaysFinal.push(this.matchdaysFiltersUpdate[index])
532
+ }
533
+ }
534
+ }
535
+ if (
536
+ Object.values(this.filterObject.selectedFilterResults).includes('lose') &&
537
+ Object.values(this.filterObject.selectedFilterResults).includes('draw')
538
+ ) {
539
+ for (let index = 0; index < this.matchdaysFiltersUpdate.length; index++) {
540
+ if (this.matchdaysFiltersUpdate[index].match_result == 3) {
541
+ matchdaysFinal.push(this.matchdaysFiltersUpdate[index])
542
+ }
543
+ }
544
+ for (let index = 0; index < this.matchdaysFiltersUpdate.length; index++) {
545
+ if (this.matchdaysFiltersUpdate[index].match_result == 2) {
546
+ matchdaysFinal.push(this.matchdaysFiltersUpdate[index])
547
+ }
548
+ }
549
+ }
550
+ } else {
551
+ if (this.filterObject.selectedFilterResults[0] == 'win') {
552
+ for (let index = 0; index < this.matchdaysFiltersUpdate.length; index++) {
553
+ if (this.matchdaysFiltersUpdate[index].match_result == 1) {
554
+ matchdaysFinal.push(this.matchdaysFiltersUpdate[index])
555
+ }
556
+ }
557
+ }
558
+ if (this.filterObject.selectedFilterResults[0] == 'lose') {
559
+ for (let index = 0; index < this.matchdaysFiltersUpdate.length; index++) {
560
+ if (this.matchdaysFiltersUpdate[index].match_result == 2) {
561
+ matchdaysFinal.push(this.matchdaysFiltersUpdate[index])
562
+ }
563
+ }
564
+ }
565
+ if (this.filterObject.selectedFilterResults[0] == 'draw') {
566
+ for (let index = 0; index < this.matchdaysFiltersUpdate.length; index++) {
567
+ if (this.matchdaysFiltersUpdate[index].match_result == 3) {
568
+ matchdaysFinal.push(this.matchdaysFiltersUpdate[index])
569
+ }
570
+ }
571
+ }
572
+ }
573
+ } else {
574
+ for (let index = 0; index < this.matchdaysFiltersUpdate.length; index++) {
575
+ matchdaysFinal.push(this.matchdaysFiltersUpdate[index])
576
+ }
577
+ }
578
+ } else {
579
+ for (let index = 0; index < this.matchdaysFiltersUpdate.length; index++) {
580
+ matchdaysFinal.push(this.matchdaysFiltersUpdate[index])
581
+ }
582
+ }
583
+ matchdaysFinal.sort((a, b) => b.id - a.id)
584
+ return matchdaysFinal
585
+ },
586
+ gameRecientesFilter() {
587
+ var gameFilterFinal = []
588
+ if (typeof this.filterObject.selectedFilterResults !== 'undefined') {
589
+ if (Object.keys(this.filterObject.selectedFilterResults).length != 3) {
590
+ if (Object.keys(this.filterObject.selectedFilterResults).length == 2) {
591
+ if (
592
+ Object.values(this.filterObject.selectedFilterResults).includes('win') &&
593
+ Object.values(this.filterObject.selectedFilterResults).includes('draw')
594
+ ) {
595
+ for (let index = 0; index < this.gamesFiltersUpdate.length; index++) {
596
+ if (
597
+ (this.gamesFiltersUpdate[index].away_team_abbreviation == this.teamSelect &&
598
+ this.gamesFiltersUpdate[index].visiting_match_result == 1) ||
599
+ (this.gamesFiltersUpdate[index].home_team_abbreviation == this.teamSelect &&
600
+ this.gamesFiltersUpdate[index].home_match_result == 1)
601
+ ) {
602
+ gameFilterFinal.push(this.gamesFiltersUpdate[index])
603
+ }
604
+ }
605
+ for (let index = 0; index < this.gamesFiltersUpdate.length; index++) {
606
+ if (
607
+ (this.gamesFiltersUpdate[index].away_team_abbreviation == this.teamSelect &&
608
+ this.gamesFiltersUpdate[index].visiting_match_result == 3) ||
609
+ (this.gamesFiltersUpdate[index].home_team_abbreviation == this.teamSelect &&
610
+ this.gamesFiltersUpdate[index].home_match_result == 3)
611
+ ) {
612
+ gameFilterFinal.push(this.gamesFiltersUpdate[index])
613
+ }
614
+ }
615
+ }
616
+ if (
617
+ Object.values(this.filterObject.selectedFilterResults).includes('win') &&
618
+ Object.values(this.filterObject.selectedFilterResults).includes('lose')
619
+ ) {
620
+ for (let index = 0; index < this.gamesFiltersUpdate.length; index++) {
621
+ if (
622
+ (this.gamesFiltersUpdate[index].away_team_abbreviation == this.teamSelect &&
623
+ this.gamesFiltersUpdate[index].visiting_match_result == 1) ||
624
+ (this.gamesFiltersUpdate[index].home_team_abbreviation == this.teamSelect &&
625
+ this.gamesFiltersUpdate[index].home_match_result == 1)
626
+ ) {
627
+ gameFilterFinal.push(this.gamesFiltersUpdate[index])
628
+ }
629
+ }
630
+ for (let index = 0; index < this.gamesFiltersUpdate.length; index++) {
631
+ if (
632
+ (this.gamesFiltersUpdate[index].away_team_abbreviation == this.teamSelect &&
633
+ this.gamesFiltersUpdate[index].visiting_match_result == 2) ||
634
+ (this.gamesFiltersUpdate[index].home_team_abbreviation == this.teamSelect &&
635
+ this.gamesFiltersUpdate[index].home_match_result == 2)
636
+ ) {
637
+ gameFilterFinal.push(this.gamesFiltersUpdate[index])
638
+ }
639
+ }
640
+ }
641
+ if (
642
+ Object.values(this.filterObject.selectedFilterResults).includes('lose') &&
643
+ Object.values(this.filterObject.selectedFilterResults).includes('draw')
644
+ ) {
645
+ for (let index = 0; index < this.gamesFiltersUpdate.length; index++) {
646
+ if (
647
+ (this.gamesFiltersUpdate[index].away_team_abbreviation == this.teamSelect &&
648
+ this.gamesFiltersUpdate[index].visiting_match_result == 3) ||
649
+ (this.gamesFiltersUpdate[index].home_team_abbreviation == this.teamSelect &&
650
+ this.gamesFiltersUpdate[index].home_match_result == 3)
651
+ ) {
652
+ gameFilterFinal.push(this.gamesFiltersUpdate[index])
653
+ }
654
+ }
655
+ for (let index = 0; index < this.gamesFiltersUpdate.length; index++) {
656
+ if (
657
+ (this.gamesFiltersUpdate[index].away_team_abbreviation == this.teamSelect &&
658
+ this.gamesFiltersUpdate[index].visiting_match_result == 2) ||
659
+ (this.gamesFiltersUpdate[index].home_team_abbreviation == this.teamSelect &&
660
+ this.gamesFiltersUpdate[index].home_match_result == 2)
661
+ ) {
662
+ gameFilterFinal.push(this.gamesFiltersUpdate[index])
663
+ }
664
+ }
665
+ }
666
+ } else {
667
+ if (this.filterObject.selectedFilterResults[0] == 'win') {
668
+ for (let index = 0; index < this.matchdaysFiltersUpdate.length; index++) {
669
+ if (
670
+ (this.gamesFiltersUpdate[index].away_team_abbreviation == this.teamSelect &&
671
+ this.gamesFiltersUpdate[index].visiting_match_result == 1) ||
672
+ (this.gamesFiltersUpdate[index].home_team_abbreviation == this.teamSelect &&
673
+ this.gamesFiltersUpdate[index].home_match_result == 1)
674
+ ) {
675
+ gameFilterFinal.push(this.gamesFiltersUpdate[index])
676
+ }
677
+ }
678
+ }
679
+ if (this.filterObject.selectedFilterResults[0] == 'lose') {
680
+ for (let index = 0; index < this.matchdaysFiltersUpdate.length; index++) {
681
+ if (
682
+ (this.gamesFiltersUpdate[index].away_team_abbreviation == this.teamSelect &&
683
+ this.gamesFiltersUpdate[index].visiting_match_result == 2) ||
684
+ (this.gamesFiltersUpdate[index].home_team_abbreviation == this.teamSelect &&
685
+ this.gamesFiltersUpdate[index].home_match_result == 2)
686
+ ) {
687
+ gameFilterFinal.push(this.gamesFiltersUpdate[index])
688
+ }
689
+ }
690
+ }
691
+ if (this.filterObject.selectedFilterResults[0] == 'draw') {
692
+ for (let index = 0; index < this.matchdaysFiltersUpdate.length; index++) {
693
+ if (
694
+ (this.gamesFiltersUpdate[index].away_team_abbreviation == this.teamSelect &&
695
+ this.gamesFiltersUpdate[index].visiting_match_result == 3) ||
696
+ (this.gamesFiltersUpdate[index].home_team_abbreviation == this.teamSelect &&
697
+ this.gamesFiltersUpdate[index].home_match_result == 3)
698
+ ) {
699
+ gameFilterFinal.push(this.gamesFiltersUpdate[index])
700
+ }
701
+ }
702
+ }
703
+ }
704
+ } else {
705
+ for (let index = 0; index < this.gamesFiltersUpdate.length; index++) {
706
+ gameFilterFinal.push(this.gamesFiltersUpdate[index])
707
+ }
708
+ }
709
+ } else {
710
+ for (let index = 0; index < this.gamesFiltersUpdate.length; index++) {
711
+ gameFilterFinal.push(this.gamesFiltersUpdate[index])
712
+ }
713
+ }
714
+ gameFilterFinal.sort((a, b) => a.matchday_id - b.matchday_id)
715
+ return gameFilterFinal
716
+ },
717
+ matchHomeProbables() {
718
+ return this.matchdaysPerTeam[this.gameInfoheader.home_team_abbreviation]
719
+ },
720
+ matchAwayProbables() {
721
+ return this.matchdaysPerTeam[this.gameInfoheader.home_team_abbreviation]
722
+ },
723
+ sizeBrowser() {
724
+ return this.gamesContainerWidth
725
+ },
726
+ numPlayer() {
727
+ return Number(this.playersAway.length) + Number(this.playersHome.length)
728
+ },
729
+ benchFillHome() {
730
+ if (this.playersHome.length < this.playersAway.length) {
731
+ return this.playersAway.length - this.playersHome.length
732
+ } else {
733
+ return 0
734
+ }
735
+ },
736
+ benchFillAway() {
737
+ if (this.playersAway.length < this.playersHome.length) {
738
+ return this.playersHome.length - this.playersAway.length
739
+ } else {
740
+ return 0
741
+ }
742
+ },
743
+ mobileClass() {
744
+ return this.calendarResizeObserver < 768 ? 'break-point-3' : ''
745
+ }
746
+ },
747
+ async mounted() {
748
+ document.addEventListener('click', this.handleOutsideClick)
749
+ setTimeout(() => {
750
+ this.setUpResizeObserver()
751
+ }, 500)
752
+ if (this.game || this.$route.params.gameId) {
753
+ try {
754
+ this.cleaneData()
755
+ this.getLineUp(this.game.game_id)
756
+ await this.getHeaderInfo(this.game)
757
+ this.teamSelect = this.gameInfoheader.home_team_abbreviation
758
+ await this.matchFilter()
759
+ if (this.selectedOption === 'Postmatch') {
760
+ setTimeout(() => {
761
+ this.getMinutesData(this.gameInfoheader.minutes)
762
+ }, 600)
763
+ }
764
+ } catch (e) {
765
+ throw new Error(e)
766
+ }
767
+ }
768
+ },
769
+ beforeDestroy() {
770
+ // Remove the click event listener when the component is destroyed
771
+ document.removeEventListener('click', this.handleOutsideClick)
772
+ },
773
+ watch: {
774
+ selectedOption: {
775
+ immediate: false,
776
+ async handler(newValue) {
777
+ this.cleaneData()
778
+ this.auxProbablesIDGameHome = 0
779
+ this.auxProbablesIDGameAway = 0
780
+ if (newValue === 'Postmatch') {
781
+ await this.getLineUp(this.game.game_id)
782
+ }
783
+ if (newValue === 'Probables') {
784
+ await this.getHeaderInfo(this.game)
785
+ }
786
+ if (newValue === 'Recientes') {
787
+ this.auxISsection = 1
788
+ this.teamSelect = this.gameInfoheader.home_team_abbreviation
789
+ await this.matchFilter()
790
+ await this.getLineUp(this.gameRecientesFilter[0].id)
791
+ }
792
+ if (newValue === 'Historicos') {
793
+ this.updatehistoricos += 1
794
+ if (
795
+ this.gamesHistoric &&
796
+ this.gamesHistoric.length > 0 &&
797
+ this.gamesHistoric[0] &&
798
+ this.gamesHistoric[0].game
799
+ ) {
800
+ this.getLineUp(this.gamesHistoric[0].game)
801
+ this.getMinutesData(this.gamesHistoric[0].objgame.minutes)
802
+ }
803
+ }
804
+ }
805
+ },
806
+ 'socket.connected': {
807
+ immediate: true,
808
+ handler(newValue) {
809
+ if (newValue) {
810
+ this.getDataSocket()
811
+ }
812
+ }
813
+ },
814
+ game: {
815
+ immediate: true,
816
+ handler: async function (newValue) {
817
+ try {
818
+ if (newValue !== null && newValue !== '' && typeof newValue === 'undefined') {
819
+ this.cleaneData()
820
+ await this.gameDataInfo(newValue)
821
+ await this.getHeaderInfo(newValue)
822
+
823
+ if (this.selectedOption == 'Recientes') {
824
+ this.teamSelect = this.gameInfoheader.home_team_abbreviation
825
+
826
+ await this.matchFilter()
827
+ await this.getLineUp(this.gameRecientesFilter[0].id)
828
+ }
829
+ if (this.selectedOption == 'Historicos') {
830
+ this.updatehistoricos += 1
831
+ if (
832
+ this.gamesHistoric &&
833
+ this.gamesHistoric.length > 0 &&
834
+ this.gamesHistoric[0] &&
835
+ this.gamesHistoric[0].game
836
+ ) {
837
+ this.getLineUp(this.gamesHistoric[0].game)
838
+ this.getMinutesData(this.gamesHistoric[0].objgame.minutes)
839
+ }
840
+ }
841
+ }
842
+ } catch (e) {
843
+ throw new Error(e)
844
+ }
845
+ }
846
+ }
847
+ },
848
+ methods: {
849
+ clickOnDeleteFilter() {
850
+ this.vDeleteFilter = true
851
+ setTimeout(() => {
852
+ this.vDeleteFilter = false
853
+ }, 200)
854
+ },
855
+ clickready() {},
856
+ handleInsideClick() {
857
+ this.isInsideClick = true
858
+ },
859
+ handleOutsideClick(event) {
860
+ if (this.$refs.targetElement && !this.$refs.targetElement.contains(event.target)) {
861
+ // Click occurred outside the target element
862
+ this.isInsideClick = false
863
+ }
864
+ },
865
+ remplazarMxJor(val) {
866
+ return val.replace('M', 'JOR ')
867
+ },
868
+ changeSwitchRadio(val) {
869
+ this.auxISsection = 1
870
+ if (typeof val !== 'object') {
871
+ this.teamSelect = val
872
+
873
+ this.matchFilter()
874
+ setTimeout(() => {
875
+ this.keyUpdate += 1
876
+ this.updateCarouselGames += 1
877
+ }, 600)
878
+ }
879
+ },
880
+ matchFilter() {
881
+ var matchdayFilter = []
882
+ var gameFilter = []
883
+ if (Object.keys(this.filterObject).length > 0) {
884
+ if (Object.keys(this.filterObject.selectedFilterTeam).length != 2) {
885
+ for (let index = 0; index < this.gamesRecientes[this.teamSelect].length; index++) {
886
+ if (this.filterObject.selectedFilterTeam[0] == 'local') {
887
+ if (
888
+ this.gamesRecientes[this.teamSelect][index].home_team_abbreviation ==
889
+ this.teamSelect
890
+ ) {
891
+ matchdayFilter.push({
892
+ name: this.gamesRecientes[this.teamSelect][index].matchday_abbreviation.replace(
893
+ 'M',
894
+ 'Jornada '
895
+ ),
896
+ id: this.gamesRecientes[this.teamSelect][index].matchday_id,
897
+ match_result: this.gamesRecientes[this.teamSelect][index].home_match_result
898
+ })
899
+ gameFilter.push(this.gamesRecientes[this.teamSelect][index])
900
+ }
901
+ } else {
902
+ if (
903
+ this.gamesRecientes[this.teamSelect][index].away_team_abbreviation ==
904
+ this.teamSelect
905
+ ) {
906
+ matchdayFilter.push({
907
+ name: this.gamesRecientes[this.teamSelect][index].matchday_abbreviation.replace(
908
+ 'M',
909
+ 'Jornada '
910
+ ),
911
+ id: this.gamesRecientes[this.teamSelect][index].matchday_id,
912
+ match_result: this.gamesRecientes[this.teamSelect][index].visiting_match_result
913
+ })
914
+ gameFilter.push(this.gamesRecientes[this.teamSelect][index])
915
+ }
916
+ }
917
+ }
918
+ } else {
919
+ if (this.gamesRecientes[this.teamSelect]) {
920
+ for (let index = 0; index < this.gamesRecientes[this.teamSelect].length; index++) {
921
+ matchdayFilter.push({
922
+ name: this.gamesRecientes[this.teamSelect][index].matchday_abbreviation.replace(
923
+ 'M',
924
+ 'Jornada '
925
+ ),
926
+ id: this.gamesRecientes[this.teamSelect][index].matchday_id,
927
+ match_result:
928
+ this.gamesRecientes[this.teamSelect][index].home_team_abbreviation ==
929
+ this.teamSelect
930
+ ? this.gamesRecientes[this.teamSelect][index].home_match_result
931
+ : this.gamesRecientes[this.teamSelect][index].visiting_match_result
932
+ })
933
+ gameFilter.push(this.gamesRecientes[this.teamSelect][index])
934
+ }
935
+ }
936
+ }
937
+ } else {
938
+ if (this.gamesRecientes[this.teamSelect]) {
939
+ for (let index = 0; index < this.gamesRecientes[this.teamSelect].length; index++) {
940
+ matchdayFilter.push({
941
+ name: this.getRound(
942
+ this.gamesRecientes[this.teamSelect][index].matchday_abbreviation
943
+ ),
944
+ id: this.gamesRecientes[this.teamSelect][index].matchday_id,
945
+ match_result:
946
+ this.gamesRecientes[this.teamSelect][index].home_team_abbreviation ==
947
+ this.teamSelect
948
+ ? this.gamesRecientes[this.teamSelect][index].home_match_result
949
+ : this.gamesRecientes[this.teamSelect][index].visiting_match_result
950
+ })
951
+ gameFilter.push(this.gamesRecientes[this.teamSelect][index])
952
+ }
953
+ }
954
+ }
955
+ this.gamesFiltersUpdate = gameFilter
956
+ this.matchdaysFiltersUpdate = matchdayFilter
957
+ },
958
+ changeFiltersModal(filters) {
959
+ this.auxISsection = 1
960
+ this.filterObject = filters
961
+ this.matchFilter()
962
+ setTimeout(() => {
963
+ this.keyUpdate += 1
964
+ this.updateCarouselGames += 1
965
+ }, 600)
966
+ },
967
+
968
+ changeDropdownVisit(val) {
969
+ if (this.auxProbablesIDGameAway != val.id) {
970
+ this.auxProbablesIDGameAway = val.id
971
+ const indexGame = this.gamesRecientes[this.gameInfoheader.away_team_abbreviation].findIndex(
972
+ (x) => x.matchday_id === val.id
973
+ )
974
+ this.rivalVisitAbrev =
975
+ this.gameInfoheader.away_team_abbreviation ==
976
+ this.gamesRecientes[this.gameInfoheader.away_team_abbreviation][indexGame]
977
+ .home_team_abbreviation
978
+ ? this.gamesRecientes[this.gameInfoheader.away_team_abbreviation][indexGame]
979
+ .away_team_abbreviation
980
+ : this.gamesRecientes[this.gameInfoheader.away_team_abbreviation][indexGame]
981
+ .home_team_abbreviation
982
+ this.rivalVisitImg =
983
+ this.gameInfoheader.away_team_abbreviation ==
984
+ this.gamesRecientes[this.gameInfoheader.away_team_abbreviation][indexGame]
985
+ .home_team_abbreviation
986
+ ? 'https://golstatsimages.blob.core.windows.net/teams-80/' +
987
+ this.gamesRecientes[this.gameInfoheader.away_team_abbreviation][indexGame].away_team +
988
+ '.png'
989
+ : 'https://golstatsimages.blob.core.windows.net/teams-80/' +
990
+ this.gamesRecientes[this.gameInfoheader.away_team_abbreviation][indexGame].home_team +
991
+ '.png'
992
+ this.cleaneDataProbablesAway()
993
+ this.getLineupDataProbablesAway(
994
+ this.gamesRecientes[this.gameInfoheader.away_team_abbreviation][indexGame].id
995
+ )
996
+ }
997
+ },
998
+ changeDropdownLocal(val) {
999
+ if (this.auxProbablesIDGameHome != val.id) {
1000
+ this.auxProbablesIDGameHome = val.id
1001
+ const indexGame = this.gamesRecientes[this.gameInfoheader.home_team_abbreviation].findIndex(
1002
+ (x) => x.matchday_id === val.id
1003
+ )
1004
+ this.rivalHomeAbrev =
1005
+ this.gameInfoheader.home_team_abbreviation ==
1006
+ this.gamesRecientes[this.gameInfoheader.home_team_abbreviation][indexGame]
1007
+ .away_team_abbreviation
1008
+ ? this.gamesRecientes[this.gameInfoheader.home_team_abbreviation][indexGame]
1009
+ .home_team_abbreviation
1010
+ : this.gamesRecientes[this.gameInfoheader.home_team_abbreviation][indexGame]
1011
+ .away_team_abbreviation
1012
+ this.rivalHomeImg =
1013
+ this.gameInfoheader.home_team_abbreviation ==
1014
+ this.gamesRecientes[this.gameInfoheader.home_team_abbreviation][indexGame]
1015
+ .away_team_abbreviation
1016
+ ? 'https://golstatsimages.blob.core.windows.net/teams-80/' +
1017
+ this.gamesRecientes[this.gameInfoheader.home_team_abbreviation][indexGame].home_team +
1018
+ '.png'
1019
+ : 'https://golstatsimages.blob.core.windows.net/teams-80/' +
1020
+ this.gamesRecientes[this.gameInfoheader.home_team_abbreviation][indexGame].away_team +
1021
+ '.png'
1022
+ this.cleaneDataProbablesHome()
1023
+ this.getLineupDataProbablesHome(
1024
+ this.gamesRecientes[this.gameInfoheader.home_team_abbreviation][indexGame].id
1025
+ )
1026
+ }
1027
+ },
1028
+ async getLineupProbables(val) {
1029
+ var newValue = { season_id: val.season_id, game_id: val.id }
1030
+ if (this.lastGetGame != newValue.game_id) {
1031
+ this.cleaneData()
1032
+
1033
+ this.getLineUp(newValue.game_id)
1034
+ }
1035
+ this.lastGetGame = newValue.game_id
1036
+ },
1037
+
1038
+ async changeCarouselItemH(val) {
1039
+ this.headerInfoHistoricItemGame = val.selectedItem.objgame
1040
+ var newValue = { season_id: val.selectedItem.season, game_id: val.selectedItem.game }
1041
+ this.cleaneData()
1042
+ this.getMinutesData(val.selectedItem.objgame.minutes)
1043
+ this.getLineUp(newValue.game_id)
1044
+ },
1045
+
1046
+ getMinutesData(plays) {
1047
+ this.localDetails = []
1048
+ this.foreignDetails = []
1049
+ if (plays) {
1050
+ if (plays.home_goals_minutes) {
1051
+ for (let index = 0; index < plays.home_goals_minutes.length; index++) {
1052
+ this.localDetails.push({ description: plays.home_goals_minutes[index], icon: 'goal' })
1053
+ }
1054
+ }
1055
+ if (plays.visiting_goals_minutes) {
1056
+ for (let index = 0; index < plays.visiting_goals_minutes.length; index++) {
1057
+ this.foreignDetails.push({
1058
+ description: plays.visiting_goals_minutes[index],
1059
+ icon: 'goal'
1060
+ })
1061
+ }
1062
+ }
1063
+ if (plays.home_yellow_cards_minutes) {
1064
+ for (let index = 0; index < plays.home_yellow_cards_minutes.length; index++) {
1065
+ this.localDetails.push({
1066
+ description: plays.home_yellow_cards_minutes[index],
1067
+ icon: 'yellow-card'
1068
+ })
1069
+ }
1070
+ }
1071
+ if (plays.away_yellow_cards_minutes) {
1072
+ for (let index = 0; index < plays.away_yellow_cards_minutes.length; index++) {
1073
+ this.foreignDetails.push({
1074
+ description: plays.away_yellow_cards_minutes[index],
1075
+ icon: 'yellow-card'
1076
+ })
1077
+ }
1078
+ }
1079
+ if (plays.home_red_cards_minutes) {
1080
+ for (let index = 0; index < plays.home_red_cards_minutes.length; index++) {
1081
+ this.localDetails.push({
1082
+ description: plays.home_red_cards_minutes[index],
1083
+ icon: 'red-card'
1084
+ })
1085
+ }
1086
+ }
1087
+ if (plays.away_red_cards_minutes) {
1088
+ for (let index = 0; index < plays.away_red_cards_minutes.length; index++) {
1089
+ this.foreignDetails.push({
1090
+ description: plays.away_red_cards_minutes[index],
1091
+ icon: 'red-card'
1092
+ })
1093
+ }
1094
+ }
1095
+ }
1096
+ },
1097
+ changeDropdown(value) {
1098
+ if (this.gameRecientesFilter && this.gameRecientesFilter.length > 0) {
1099
+ if (this.auxISsection == 1) {
1100
+ this.selectedIndexOption = this.gameRecientesFilter.length - 1
1101
+ this.defaultDropItem = {
1102
+ propName: 'id',
1103
+ value: this.gameRecientesFilter[this.gameRecientesFilter.length - 1].matchday_id
1104
+ }
1105
+ } else {
1106
+ const index = this.gameRecientesFilter.findIndex((x) => x.matchday_id == value.id)
1107
+ if (index != -1) {
1108
+ this.selectedIndexOption = index
1109
+ }
1110
+ this.defaultDropItem = {
1111
+ propName: 'id',
1112
+ value: this.gameRecientesFilter[index].matchday_id
1113
+ }
1114
+ }
1115
+ }
1116
+ },
1117
+ clickOnValueFilter() {
1118
+ this.auxISsection = 0
1119
+ },
1120
+ clickOnValueCarrousel() {
1121
+ this.auxISsection = 0
1122
+ },
1123
+ async changeCarouselItem(val) {
1124
+ setTimeout(() => {
1125
+ if (this.gameRecientesFilter && this.gameRecientesFilter.length > 0) {
1126
+ if (val) {
1127
+ if (val.selectedItem === undefined) {
1128
+ val.selectedItem = this.gameRecientesFilter[this.gameRecientesFilter.length - 1]
1129
+ val.selectedItemIndex = this.gameRecientesFilter.length - 1
1130
+ }
1131
+ var newValue = {}
1132
+ if (this.auxISsection == 1) {
1133
+ newValue = {
1134
+ season_id: this.gameRecientesFilter[this.gameRecientesFilter.length - 1].season_id,
1135
+ game_id: this.gameRecientesFilter[this.gameRecientesFilter.length - 1].id
1136
+ }
1137
+ } else {
1138
+ newValue = { season_id: val.selectedItem.season_id, game_id: val.selectedItem.id }
1139
+ }
1140
+ if (this.lastGetGame != newValue.game_id) {
1141
+ this.cleaneData()
1142
+ this.getLineUp(newValue.game_id)
1143
+ }
1144
+ if (this.auxISsection == 1) {
1145
+ this.getMinutesData(
1146
+ this.gameRecientesFilter[this.gameRecientesFilter.length - 1].minutes
1147
+ )
1148
+ this.selectedIndexOption = this.gameRecientesFilter.length - 1
1149
+ this.defaultDropItem = {
1150
+ propName: 'id',
1151
+ value:
1152
+ this.gameRecientesFilter[this.gameRecientesFilter.length - 1].minutes.matchday_id
1153
+ }
1154
+
1155
+ this.lastGetGame = newValue.game_id
1156
+ } else {
1157
+ this.getMinutesData(val.selectedItem.minutes)
1158
+ this.defaultDropItem = { propName: 'id', value: val.selectedItem.matchday_id }
1159
+
1160
+ this.lastGetGame = newValue.game_id
1161
+ this.selectedIndexOption = val.selectedItemIndex
1162
+ }
1163
+
1164
+ this.keyUpdate += 1
1165
+ }
1166
+ }
1167
+ }, 200)
1168
+ },
1169
+ async changeCarouselItemRecent(val) {
1170
+ if (val.selectedItem) {
1171
+ var newValue = { season_id: val.selectedItem.season_id, game_id: val.selectedItem.id }
1172
+ if (this.lastGetGame != newValue.game_id) {
1173
+ this.cleaneData()
1174
+ this.getLineUp(newValue.game_id)
1175
+ }
1176
+ this.lastGetGame = newValue.game_id
1177
+ }
1178
+ },
1179
+ getRound(abrev) {
1180
+ let abrevFormatted = abrev.replace('M', 'Jornada ')
1181
+ abrevFormatted = abrevFormatted.replace('PO1', 'CFI')
1182
+ abrevFormatted = abrevFormatted.replace('PO2', 'CFV')
1183
+ abrevFormatted = abrevFormatted.replace('PO3', 'SFI')
1184
+ abrevFormatted = abrevFormatted.replace('PO4', 'SFV')
1185
+ abrevFormatted = abrevFormatted.replace('PO5', 'FI')
1186
+ abrevFormatted = abrevFormatted.replace('PO6', 'FV')
1187
+ return abrevFormatted
1188
+ },
1189
+ getRoundH(abrev) {
1190
+ let abrevFormatted = abrev.replace('M', 'J')
1191
+ abrevFormatted = abrevFormatted.replace('PO1', 'CFI')
1192
+ abrevFormatted = abrevFormatted.replace('PO2', 'CFV')
1193
+ abrevFormatted = abrevFormatted.replace('PO3', 'SFI')
1194
+ abrevFormatted = abrevFormatted.replace('PO4', 'SFV')
1195
+ abrevFormatted = abrevFormatted.replace('PO5', 'FI')
1196
+ abrevFormatted = abrevFormatted.replace('PO6', 'FV')
1197
+ return abrevFormatted
1198
+ },
1199
+ async getHeaderInfo(game) {
1200
+ const axiosInstance = axios.create({
1201
+ headers: {
1202
+ Authorization: `${this.tokenPremium}`
1203
+ }
1204
+ })
1205
+ const data = await axiosInstance.get(
1206
+ 'https://fxtcaw9tw6.execute-api.us-east-2.amazonaws.com/prod/historic/seasons/' +
1207
+ game.season_id +
1208
+ '/games/' +
1209
+ game.game_id +
1210
+ '/lineups'
1211
+ )
1212
+ this.gameInfoheader = data.data.game
1213
+ if (data.data.games_historic && data.data.games_historic.length > 0) {
1214
+ for (let index = 0; index < data.data.games_historic.length; index++) {
1215
+ this.gamesHistoric.push({
1216
+ objgame: data.data.games_historic[index],
1217
+ game: data.data.games_historic[index].id,
1218
+ season: data.data.games_historic[index].season_id,
1219
+ description:
1220
+ data.data.games_historic[index].season_name +
1221
+ ' | ' +
1222
+ this.getRoundH(data.data.games_historic[index].matchday_abbreviation) +
1223
+ ' | ' +
1224
+ data.data.games_historic[index].home_team_abbreviation +
1225
+ ' - ' +
1226
+ data.data.games_historic[index].away_team_abbreviation
1227
+ })
1228
+ }
1229
+ }
1230
+ this.gamesRecientes[data.data.game.home_team_abbreviation] = []
1231
+ this.gamesRecientes[data.data.game.away_team_abbreviation] = []
1232
+ this.matchdaysPerTeam[data.data.game.home_team_abbreviation] = []
1233
+ this.matchdaysPerTeam[data.data.game.away_team_abbreviation] = []
1234
+ if (data.data.home_team_games_recent && data.data.home_team_games_recent.length > 0) {
1235
+ for (let index = 0; index < data.data.home_team_games_recent.length; index++) {
1236
+ this.gamesRecientes[data.data.game.home_team_abbreviation].push(
1237
+ data.data.home_team_games_recent[index]
1238
+ )
1239
+ this.matchdaysPerTeam[data.data.game.home_team_abbreviation].push({
1240
+ name: this.getRound(data.data.home_team_games_recent[index].matchday_abbreviation),
1241
+ id: data.data.home_team_games_recent[index].matchday_id
1242
+ })
1243
+ }
1244
+ }
1245
+
1246
+ if (data.data.away_team_games_recent && data.data.away_team_games_recent.length > 0) {
1247
+ for (let index = 0; index < data.data.away_team_games_recent.length; index++) {
1248
+ this.gamesRecientes[data.data.game.away_team_abbreviation].push(
1249
+ data.data.away_team_games_recent[index]
1250
+ )
1251
+ this.matchdaysPerTeam[data.data.game.away_team_abbreviation].push({
1252
+ name: data.data.away_team_games_recent[index].matchday_abbreviation.replace(
1253
+ 'M',
1254
+ 'Jornada '
1255
+ ),
1256
+ id: data.data.away_team_games_recent[index].matchday_id
1257
+ })
1258
+ }
1259
+ }
1260
+ },
1261
+ clickOnSelectOption(val) {
1262
+ this.selectOptMenuheader = val
1263
+ },
1264
+ async gameDataInfo(game) {
1265
+ const axiosInstance = axios.create({
1266
+ headers: {
1267
+ Authorization: `${this.tokenPremium}`
1268
+ }
1269
+ })
1270
+ const data = await axiosInstance.get(
1271
+ this.urlGames + game.season_id + '/games/' + game.game_id
1272
+ )
1273
+ this.homeTeam = data.data.teams[0]
1274
+ this.visitingTeam = data.data.teams[1]
1275
+ const gameinfo = data.data.games.find((game) => game.game_id === Number(game.game_id))
1276
+ this.gameForAnalysis = gameinfo
1277
+ },
1278
+ cleaneDataProbablesHome() {
1279
+ this.lastGetGame = 0
1280
+ this.retries = 3
1281
+ this.teamActive = 'home'
1282
+ this.subsActive = false
1283
+ this.playersHome = []
1284
+ this.gamesContainerWidth = 0
1285
+
1286
+ this.subsTitle = false
1287
+ this.uniformHome = ''
1288
+ this.uniformHomeG = ''
1289
+
1290
+ this.dataPlayersHome = []
1291
+ this.players = this.players.filter(
1292
+ (player) => player.team_id !== this.gameInfoheader.home_team
1293
+ )
1294
+
1295
+ this.homeTeamLogo = ''
1296
+ this.homeTeamName = ''
1297
+ this.homeTeamAbrev = ''
1298
+ this.home_team_id = 0
1299
+ this.substitutionModal = {
1300
+ min: '',
1301
+ in: {
1302
+ playerImg: '',
1303
+ teamImg: '',
1304
+ nationalityimg: '',
1305
+ name: '',
1306
+ position: '',
1307
+ shirt_number: ''
1308
+ },
1309
+ out: {
1310
+ playerImg: '',
1311
+ teamImg: '',
1312
+ nationalityimg: '',
1313
+ name: '',
1314
+ position: '',
1315
+ shirt_number: ''
1316
+ }
1317
+ }
1318
+ this.movil = false
1319
+ },
1320
+ cleaneDataProbablesAway() {
1321
+ this.lastGetGame = 0
1322
+ this.retries = 3
1323
+ this.teamActive = 'home'
1324
+ this.subsActive = false
1325
+
1326
+ this.gamesContainerWidth = 0
1327
+ this.playersAway = []
1328
+ this.subsTitle = false
1329
+
1330
+ this.uniformAway = ''
1331
+ this.uniformAwayG = ''
1332
+
1333
+ this.dataPlayersAway = []
1334
+
1335
+ this.awayTeamLogo = ''
1336
+
1337
+ this.awayTeamName = ''
1338
+ this.players = this.players.filter(
1339
+ (player) => player.team_id !== this.gameInfoheader.away_team
1340
+ )
1341
+
1342
+ this.awayTeamAbrev = ''
1343
+ this.updateComponentAway = 0
1344
+ this.away_team_id = 0
1345
+ this.substitutionModal = {
1346
+ min: '',
1347
+ in: {
1348
+ playerImg: '',
1349
+ teamImg: '',
1350
+ nationalityimg: '',
1351
+ name: '',
1352
+ position: '',
1353
+ shirt_number: ''
1354
+ },
1355
+ out: {
1356
+ playerImg: '',
1357
+ teamImg: '',
1358
+ nationalityimg: '',
1359
+ name: '',
1360
+ position: '',
1361
+ shirt_number: ''
1362
+ }
1363
+ }
1364
+ this.movil = false
1365
+ },
1366
+ cleaneData() {
1367
+ this.lastGetGame = 0
1368
+ this.retries = 3
1369
+ this.teamActive = 'home'
1370
+ this.subsActive = false
1371
+ this.playersHome = []
1372
+ this.gamesContainerWidth = 0
1373
+ this.playersAway = []
1374
+ this.subsTitle = false
1375
+ this.uniformHome = ''
1376
+ this.uniformHomeG = ''
1377
+ this.uniformAway = ''
1378
+ this.uniformAwayG = ''
1379
+ this.dataPlayersHome = []
1380
+ this.dataPlayersAway = []
1381
+ this.homeTeamLogo = ''
1382
+ this.awayTeamLogo = ''
1383
+ this.homeTeamName = ''
1384
+ this.awayTeamName = ''
1385
+ this.homeTeamAbrev = ''
1386
+ this.awayTeamAbrev = ''
1387
+ this.home_team_id = 0
1388
+ this.players = []
1389
+ this.updateComponentAway = 0
1390
+ this.away_team_id = 0
1391
+ this.substitutionModal = {
1392
+ min: '',
1393
+ in: {
1394
+ playerImg: '',
1395
+ teamImg: '',
1396
+ nationalityimg: '',
1397
+ name: '',
1398
+ position: '',
1399
+ shirt_number: ''
1400
+ },
1401
+ out: {
1402
+ playerImg: '',
1403
+ teamImg: '',
1404
+ nationalityimg: '',
1405
+ name: '',
1406
+ position: '',
1407
+ shirt_number: ''
1408
+ }
1409
+ }
1410
+ this.movil = false
1411
+ },
1412
+ getDataSocket() {
1413
+ connectChannel(`lineups.game.` + this.game.game_id, this.socket)
1414
+ connectChannel(`mxm.game.` + this.game.game_id, this.socket)
1415
+ connectChannel(`lineups.bench.game.` + this.game.game_id, this.socket)
1416
+ },
1417
+ resetPlayUpdate(playType, Team, index, playerIndex) {
1418
+ if (playType == 'Substitution') {
1419
+ if (Team == 'Home') {
1420
+ var idsPlayers = this.playersHome[index].substitutionDataID.split('@')
1421
+ var indexChangeHomeOut = this.playersHome.findIndex(
1422
+ (player) => player.playerId == idsPlayers[1]
1423
+ )
1424
+ var indexChangeHomeIn = this.playersHome.findIndex(
1425
+ (player) => player.playerId == idsPlayers[2]
1426
+ )
1427
+ if (indexChangeHomeOut != -1) {
1428
+ this.playersHome[indexChangeHomeOut].substitutionOut = false
1429
+ this.playersHome[indexChangeHomeOut].substitutionMin = ''
1430
+ this.playersHome[indexChangeHomeOut].substitutionDataID = ''
1431
+ this.playersHome[indexChangeHomeOut].idSubstitution = 0
1432
+ }
1433
+ if (indexChangeHomeIn != -1) {
1434
+ this.playersHome[indexChangeHomeIn].substitutionIn = false
1435
+ this.playersHome[indexChangeHomeIn].substitutionMin = ''
1436
+ this.playersHome[indexChangeHomeIn].substitutionDataID = ''
1437
+ this.playersHome[indexChangeHomeIn].idSubstitution = 0
1438
+ }
1439
+ } else {
1440
+ var idsPlayersAway = this.playersAway[index].substitutionDataID.split('@')
1441
+ var indexChangeAwayOut = this.playersAway.findIndex(
1442
+ (player) => player.playerId == idsPlayersAway[1]
1443
+ )
1444
+ var indexChangeAwayIn = this.playersAway.findIndex(
1445
+ (player) => player.playerId == idsPlayersAway[2]
1446
+ )
1447
+ if (indexChangeHomeOut != -1) {
1448
+ this.playersAway[indexChangeAwayOut].substitutionOut = false
1449
+ this.playersAway[indexChangeAwayOut].substitutionMin = ''
1450
+ this.playersAway[indexChangeAwayOut].substitutionDataID = ''
1451
+ this.playersAway[indexChangeAwayOut].idSubstitution = 0
1452
+ }
1453
+ if (indexChangeAwayIn != -1) {
1454
+ this.playersAway[indexChangeAwayIn].substitutionIn = false
1455
+ this.playersAway[indexChangeAwayIn].substitutionMin = ''
1456
+ this.playersAway[indexChangeAwayIn].substitutionDataID = ''
1457
+ this.playersAway[indexChangeAwayIn].idSubstitution = 0
1458
+ }
1459
+ }
1460
+ }
1461
+ if (playType == 'YellowCard') {
1462
+ if (Team == 'Home') {
1463
+ this.playersHome[index].yellowcards = 0
1464
+ this.playersHome[index].yellowcardsMin = 0
1465
+ this.playersHome[index].idyellowcards = 0
1466
+ } else {
1467
+ this.playersAway[index].yellowcards = 0
1468
+ this.playersAway[index].yellowcardsMin = 0
1469
+ this.playersAway[index].idyellowcards = 0
1470
+ }
1471
+ }
1472
+ if (playType == 'RedCard') {
1473
+ if (Team == 'Home') {
1474
+ this.playersHome[index].redcards = 0
1475
+ this.playersHome[index].redcardsMin = 0
1476
+ this.playersHome[index].idredcards = 0
1477
+ } else {
1478
+ this.playersAway[index].redcards = 0
1479
+ this.playersAway[index].redcardsMin = 0
1480
+ this.playersAway[index].idredcards = 0
1481
+ }
1482
+ }
1483
+ if (playType == 'Goals') {
1484
+ if (Team == 'Home') {
1485
+ this.playersHome[playerIndex].goals = this.playersHome[playerIndex].goals - 1
1486
+ this.playersHome[playerIndex].goalsMin.splice(index, 1)
1487
+ this.playersHome[playerIndex].idsGoals.splice(index, 1)
1488
+ } else {
1489
+ this.playersAway[playerIndex].goals = this.playersAway[playerIndex].goals - 1
1490
+ this.playersAway[playerIndex].goalsMin.splice(index, 1)
1491
+ this.playersAway[playerIndex].idsGoals.splice(index, 1)
1492
+ }
1493
+ }
1494
+ },
1495
+ setUpResizeObserver() {
1496
+ if (window.ResizeObserver) {
1497
+ calendarResizeObserver = new ResizeObserver(() => {
1498
+ this.gamesContainerWidth = this.$refs.gamesContainer.clientWidth
1499
+ if (this.gamesContainerWidth < 740) {
1500
+ this.movil = true
1501
+ } else {
1502
+ this.movil = false
1503
+ }
1504
+ })
1505
+ calendarResizeObserver.observe(this.$refs.gamesContainer)
1506
+ } else {
1507
+ throw new Error('Resize observer not supported!')
1508
+ }
1509
+ },
1510
+ async getMXM(game) {
1511
+ try {
1512
+ const axiosInstanceMXM = axios.create({
1513
+ headers: {
1514
+ Authorization: `${this.tokenPremium}`
1515
+ }
1516
+ })
1517
+ const dataMXM = await axiosInstanceMXM.get(this.urlMXM + game)
1518
+
1519
+ for (let index = 0; index < dataMXM.data.plays.length; index++) {
1520
+ if (dataMXM.data.plays[index].event_type_id == 3) {
1521
+ if (dataMXM.data.plays[index].team_id == this.home_team_id) {
1522
+ if (this.players.length > 0) {
1523
+ var idsPlayers = dataMXM.data.plays[index].player_id.split('@')
1524
+ var indexChangeHomeOut = this.players.findIndex(
1525
+ (player) => player.playerId == idsPlayers[0]
1526
+ )
1527
+ var indexChangeHomeIn = this.players.findIndex(
1528
+ (player) => player.playerId == idsPlayers[1]
1529
+ )
1530
+ if (indexChangeHomeOut != -1) {
1531
+ this.players[indexChangeHomeOut].idSubstitution =
1532
+ dataMXM.data.plays[index].play_id
1533
+ this.players[indexChangeHomeOut].substitutionOut = true
1534
+ this.players[indexChangeHomeOut].substitutionMin =
1535
+ dataMXM.data.plays[index].minute
1536
+ this.players[indexChangeHomeOut].substitutionDataID =
1537
+ dataMXM.data.plays[index].team_id + '@' + dataMXM.data.plays[index].player_id
1538
+ }
1539
+ if (indexChangeHomeIn != -1) {
1540
+ this.players[indexChangeHomeIn].idSubstitution = dataMXM.data.plays[index].play_id
1541
+ this.players[indexChangeHomeIn].substitutionIn = true
1542
+ this.players[indexChangeHomeIn].substitutionMin = dataMXM.data.plays[index].minute
1543
+ this.players[indexChangeHomeIn].substitutionDataID =
1544
+ dataMXM.data.plays[index].team_id + '@' + dataMXM.data.plays[index].player_id
1545
+ }
1546
+ }
1547
+ } else {
1548
+ if (this.players.length > 0) {
1549
+ var idsPlayersAway = dataMXM.data.plays[index].player_id.split('@')
1550
+ var indexChangeAwayOut = this.players.findIndex(
1551
+ (player) => player.playerId == idsPlayersAway[0]
1552
+ )
1553
+ var indexChangeAwayIn = this.players.findIndex(
1554
+ (player) => player.playerId == idsPlayersAway[1]
1555
+ )
1556
+ if (indexChangeAwayOut != -1) {
1557
+ this.players[indexChangeAwayOut].idSubstitution =
1558
+ dataMXM.data.plays[index].play_id
1559
+ this.players[indexChangeAwayOut].substitutionOut = true
1560
+ this.players[indexChangeAwayOut].substitutionMin =
1561
+ dataMXM.data.plays[index].minute
1562
+ this.players[indexChangeAwayOut].substitutionDataID =
1563
+ dataMXM.data.plays[index].team_id + '@' + dataMXM.data.plays[index].player_id
1564
+ }
1565
+ if (indexChangeAwayIn != -1) {
1566
+ this.players[indexChangeAwayIn].idSubstitution = dataMXM.data.plays[index].play_id
1567
+ this.players[indexChangeAwayIn].substitutionIn = true
1568
+ this.players[indexChangeAwayIn].substitutionMin = dataMXM.data.plays[index].minute
1569
+ this.players[indexChangeAwayIn].substitutionDataID =
1570
+ dataMXM.data.plays[index].team_id + '@' + dataMXM.data.plays[index].player_id
1571
+ }
1572
+ }
1573
+ }
1574
+ }
1575
+ if (dataMXM.data.plays[index].event_type_id == 1) {
1576
+ if (dataMXM.data.plays[index].team_id == this.home_team_id) {
1577
+ if (this.players.length > 0) {
1578
+ var indexPlayerGoalHome = this.players.findIndex(
1579
+ (player) => player.playerId == dataMXM.data.plays[index].player_id
1580
+ )
1581
+ if (indexPlayerGoalHome != -1) {
1582
+ this.players[indexPlayerGoalHome].goals += 1
1583
+ this.players[indexPlayerGoalHome].goalsMin.push(dataMXM.data.plays[index].minute)
1584
+ this.players[indexPlayerGoalHome].idsGoals.push(dataMXM.data.plays[index].play_id)
1585
+ }
1586
+ }
1587
+ } else {
1588
+ if (this.players.length > 0) {
1589
+ var indexPlayerGoalAway = this.players.findIndex(
1590
+ (player) => player.playerId == dataMXM.data.plays[index].player_id
1591
+ )
1592
+ if (indexPlayerGoalAway != -1) {
1593
+ this.players[indexPlayerGoalAway].goals += 1
1594
+ this.players[indexPlayerGoalAway].goalsMin.push(dataMXM.data.plays[index].minute)
1595
+ this.players[indexPlayerGoalAway].idsGoals.push(dataMXM.data.plays[index].play_id)
1596
+ }
1597
+ }
1598
+ }
1599
+ }
1600
+ if (dataMXM.data.plays[index].event_type_id == 2) {
1601
+ if (dataMXM.data.plays[index].category_id == 8) {
1602
+ if (dataMXM.data.plays[index].team_id == this.home_team_id) {
1603
+ if (this.players.length > 0) {
1604
+ var indexPlayerYellowHome = this.players.findIndex(
1605
+ (player) => player.playerId == dataMXM.data.plays[index].player_id
1606
+ )
1607
+ if (indexPlayerYellowHome != -1) {
1608
+ this.players[indexPlayerYellowHome].yellowcards += 1
1609
+ this.players[indexPlayerYellowHome].yellowcardsMin =
1610
+ dataMXM.data.plays[index].minute
1611
+ this.players[indexPlayerYellowHome].idyellowcards =
1612
+ dataMXM.data.plays[index].play_id
1613
+ }
1614
+ }
1615
+ } else {
1616
+ if (this.players.length > 0) {
1617
+ var indexPlayerYellowAway = this.players.findIndex(
1618
+ (player) => player.playerId == dataMXM.data.plays[index].player_id
1619
+ )
1620
+ if (indexPlayerYellowAway != -1) {
1621
+ this.players[indexPlayerYellowAway].yellowcards += 1
1622
+ this.players[indexPlayerYellowAway].yellowcardsMin =
1623
+ dataMXM.data.plays[index].minute
1624
+ this.players[indexPlayerYellowAway].idyellowcards =
1625
+ dataMXM.data.plays[index].play_id
1626
+ }
1627
+ }
1628
+ }
1629
+ }
1630
+ if (dataMXM.data.plays[index].category_id == 9) {
1631
+ if (dataMXM.data.plays[index].team_id == this.home_team_id) {
1632
+ if (this.players.length > 0) {
1633
+ var indexPlayerRedHome = this.players.findIndex(
1634
+ (player) => player.playerId == dataMXM.data.plays[index].player_id
1635
+ )
1636
+ if (indexPlayerRedHome != -1) {
1637
+ this.players[indexPlayerRedHome].redcards += 1
1638
+ this.players[indexPlayerRedHome].redcardsMin = dataMXM.data.plays[index].minute
1639
+ this.players[indexPlayerRedHome].idredcards = dataMXM.data.plays[index].play_id
1640
+ }
1641
+ }
1642
+ } else {
1643
+ if (this.players.length > 0) {
1644
+ var indexPlayerRedAway = this.players.findIndex(
1645
+ (player) => player.playerId == dataMXM.data.plays[index].player_id
1646
+ )
1647
+ if (indexPlayerRedAway != -1) {
1648
+ this.players[indexPlayerRedAway].redcards += 1
1649
+ this.players[indexPlayerRedAway].redcardsMin = dataMXM.data.plays[index].minute
1650
+ this.players[indexPlayerRedAway].idredcards = dataMXM.data.plays[index].play_id
1651
+ }
1652
+ }
1653
+ }
1654
+ }
1655
+ }
1656
+ }
1657
+ } catch (e) {
1658
+ return Promise.reject(e)
1659
+ }
1660
+ },
1661
+ async getLineupDataProbablesAway(gameid) {
1662
+ try {
1663
+ const axiosInstanceLineUp = axios.create({
1664
+ headers: {
1665
+ Authorization: `${this.tokenPremium}`
1666
+ }
1667
+ })
1668
+ const data = await axiosInstanceLineUp.get(this.url + gameid)
1669
+ if (!data || !data.data) {
1670
+ throw new Error('There is not lineups for this game.')
1671
+ }
1672
+
1673
+ if (data.data.home_team.team_id == this.gameInfoheader.away_team) {
1674
+ for (
1675
+ let index = 0;
1676
+ index < data.data.home_team.starting_lineup[0].lineup.length;
1677
+ index++
1678
+ ) {
1679
+ this.away_team_id = data.data.home_team.team_id
1680
+ this.imageExists(
1681
+ 'https://golstatsimages.blob.core.windows.net/jersey-teams/' + data.data.home_team.team_id + '.svg',
1682
+ 'away',
1683
+ 1
1684
+ )
1685
+ this.imageExists(
1686
+ 'https://golstatsimages.blob.core.windows.net/jersey-teams/' +
1687
+ data.data.home_team.team_id +
1688
+ '_g.svg',
1689
+ 'away',
1690
+ 0
1691
+ )
1692
+ var NameArrayAway =
1693
+ data.data.home_team.starting_lineup[0].lineup[index].player_name.split(',')
1694
+ var lastArrayNameAway = NameArrayAway[0].split(' ')
1695
+ var ArrayNameAway = NameArrayAway[1].trim().split(' ')
1696
+ var lastNameAway = ''
1697
+ if (lastArrayNameAway.length == 2 || lastArrayNameAway.length == 1) {
1698
+ if (lastArrayNameAway[0].length < 4) {
1699
+ lastNameAway = lastArrayNameAway[0] + ' ' + lastArrayNameAway[1]
1700
+ } else {
1701
+ lastNameAway = lastArrayNameAway[0]
1702
+ }
1703
+ } else {
1704
+ if (lastArrayNameAway.length == 3) {
1705
+ lastNameAway = lastArrayNameAway[0] + ' ' + lastArrayNameAway[1]
1706
+ } else {
1707
+ if (lastArrayNameAway.length == 4) {
1708
+ lastNameAway =
1709
+ lastArrayNameAway[1] + ' ' + lastArrayNameAway[2] + ' ' + lastArrayNameAway[3]
1710
+ }
1711
+ }
1712
+ }
1713
+ var nameAway =
1714
+ ArrayNameAway[ArrayNameAway.length - 1] != ''
1715
+ ? ArrayNameAway[ArrayNameAway.length - 1].charAt(0)
1716
+ : ArrayNameAway[ArrayNameAway.length - 2]
1717
+ ? ArrayNameAway[ArrayNameAway.length - 2].charAt(0)
1718
+ : ''
1719
+ lastNameAway = lastNameAway.replace(',', '')
1720
+
1721
+ var newCooAway = data.data.home_team.starting_lineup[0].lineup[index].x
1722
+ newCooAway = Math.abs(newCooAway - 100)
1723
+ // var positionConvert = 100 - ((100 - newCooAway) * 50) / 100;
1724
+ var positionConvert = 100 - ((100 - newCooAway) * 50) / 100
1725
+ positionConvert = positionConvert * 0.9
1726
+
1727
+ this.players.push({
1728
+ team_id: data.data.home_team.team_id,
1729
+ number: data.data.home_team.starting_lineup[0].lineup[index].jersey_number,
1730
+ isFirstTeam: false,
1731
+ name: nameAway + '. ' + lastNameAway,
1732
+ photo:
1733
+ 'https://golstatsimages.blob.core.windows.net/players-profile/' +
1734
+ data.data.home_team.starting_lineup[0].lineup[index].player_id +
1735
+ '.png',
1736
+ posX: positionConvert + 7,
1737
+ posY: data.data.home_team.starting_lineup[0].lineup[index].y,
1738
+ goals: 0,
1739
+ yellowcards: 0,
1740
+ redcards: 0,
1741
+ goalsMin: [],
1742
+ yellowcardsMin: 0,
1743
+ redcardsMin: 0,
1744
+ idyellowcards: 0,
1745
+ idredcards: 0,
1746
+ idsGoals: [],
1747
+ idSubstitution: 0
1748
+ })
1749
+
1750
+ this.awayTeamLogo =
1751
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' + data.data.home_team.team_id + '.png'
1752
+ }
1753
+ this.playersAway.sort((a, b) =>
1754
+ a.position_id > b.position_id ? 1 : b.position_id > a.position_id ? -1 : 0
1755
+ )
1756
+ }
1757
+ if (data.data.away_team.team_id == this.gameInfoheader.away_team) {
1758
+ for (
1759
+ let index = 0;
1760
+ index < data.data.away_team.starting_lineup[0].lineup.length;
1761
+ index++
1762
+ ) {
1763
+ this.away_team_id = data.data.away_team.team_id
1764
+ this.imageExists(
1765
+ 'https://golstatsimages.blob.core.windows.net/jersey-teams/' + data.data.away_team.team_id + '.svg',
1766
+ 'away',
1767
+ 1
1768
+ )
1769
+ this.imageExists(
1770
+ 'https://golstatsimages.blob.core.windows.net/jersey-teams/' +
1771
+ data.data.away_team.team_id +
1772
+ '_g.svg',
1773
+ 'away',
1774
+ 0
1775
+ )
1776
+ var NameArrayAway =
1777
+ data.data.away_team.starting_lineup[0].lineup[index].player_name.split(',')
1778
+ var lastArrayNameAway = NameArrayAway[0].split(' ')
1779
+ var ArrayNameAway = NameArrayAway[1].trim().split(' ')
1780
+ var lastNameAway = ''
1781
+ if (lastArrayNameAway.length == 2 || lastArrayNameAway.length == 1) {
1782
+ if (lastArrayNameAway[0].length < 4) {
1783
+ lastNameAway = lastArrayNameAway[0] + ' ' + lastArrayNameAway[1]
1784
+ } else {
1785
+ lastNameAway = lastArrayNameAway[0]
1786
+ }
1787
+ } else {
1788
+ if (lastArrayNameAway.length == 3) {
1789
+ lastNameAway = lastArrayNameAway[0] + ' ' + lastArrayNameAway[1]
1790
+ } else {
1791
+ if (lastArrayNameAway.length == 4) {
1792
+ lastNameAway =
1793
+ lastArrayNameAway[1] + ' ' + lastArrayNameAway[2] + ' ' + lastArrayNameAway[3]
1794
+ }
1795
+ }
1796
+ }
1797
+ var nameAway =
1798
+ ArrayNameAway[ArrayNameAway.length - 1] != ''
1799
+ ? ArrayNameAway[ArrayNameAway.length - 1].charAt(0)
1800
+ : ArrayNameAway[ArrayNameAway.length - 2]
1801
+ ? ArrayNameAway[ArrayNameAway.length - 2].charAt(0)
1802
+ : ''
1803
+ lastNameAway = lastNameAway.replace(',', '')
1804
+
1805
+ var newCooAway = data.data.away_team.starting_lineup[0].lineup[index].x
1806
+
1807
+ // var positionConvert = 100 - ((100 - newCooAway) * 50) / 100;
1808
+ var positionConvert = 100 - ((100 - newCooAway) * 50) / 100
1809
+ positionConvert = positionConvert * 0.9
1810
+
1811
+ this.players.push({
1812
+ team_id: data.data.away_team.team_id,
1813
+ number: data.data.away_team.starting_lineup[0].lineup[index].jersey_number,
1814
+ isFirstTeam: false,
1815
+ name: nameAway + '. ' + lastNameAway,
1816
+ photo:
1817
+ 'https://golstatsimages.blob.core.windows.net/players-profile/' +
1818
+ data.data.away_team.starting_lineup[0].lineup[index].player_id +
1819
+ '.png',
1820
+ posX:
1821
+ 100 - ((100 - data.data.away_team.starting_lineup[0].lineup[index].x) * 50) / 100,
1822
+ posY: data.data.away_team.starting_lineup[0].lineup[index].y,
1823
+ goals: 0,
1824
+ yellowcards: 0,
1825
+ redcards: 0,
1826
+ goalsMin: [],
1827
+ yellowcardsMin: 0,
1828
+ redcardsMin: 0,
1829
+ idyellowcards: 0,
1830
+ idredcards: 0,
1831
+ idsGoals: [],
1832
+ idSubstitution: 0
1833
+ })
1834
+
1835
+ this.awayTeamLogo =
1836
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' + data.data.away_team.team_id + '.png'
1837
+ }
1838
+ }
1839
+ } catch (e) {
1840
+ return Promise.reject(e)
1841
+ }
1842
+ },
1843
+ async getLineupDataProbablesHome(gameid) {
1844
+ try {
1845
+ const axiosInstanceLineUp = axios.create({
1846
+ headers: {
1847
+ Authorization: `${this.tokenPremium}`
1848
+ }
1849
+ })
1850
+ const data = await axiosInstanceLineUp.get(this.url + gameid)
1851
+ if (!data || !data.data) {
1852
+ throw new Error('There is not lineups for this game.')
1853
+ }
1854
+
1855
+ if (data.data.home_team.team_id == this.gameInfoheader.home_team) {
1856
+ this.dataPlayersHome = data.data.home_team.players
1857
+ data.data.home_team.starting_lineup[0].lineup.sort((a, b) =>
1858
+ a.position_id > b.position_id ? 1 : b.position_id > a.position_id ? -1 : 0
1859
+ )
1860
+ for (
1861
+ let index = 0;
1862
+ index < data.data.home_team.starting_lineup[0].lineup.length;
1863
+ index++
1864
+ ) {
1865
+ this.home_team_id = data.data.home_team.team_id
1866
+ this.imageExists(
1867
+ 'https://golstatsimages.blob.core.windows.net/jersey-teams/' + data.data.home_team.team_id + '.svg',
1868
+ 'home',
1869
+ 1
1870
+ )
1871
+ this.imageExists(
1872
+ 'https://golstatsimages.blob.core.windows.net/jersey-teams/' +
1873
+ data.data.home_team.team_id +
1874
+ '_g.svg',
1875
+ 'home',
1876
+ 0
1877
+ )
1878
+ var NameArrayHome =
1879
+ data.data.home_team.starting_lineup[0].lineup[index].player_name.split(',')
1880
+ var lastArrayName = NameArrayHome[0].split(' ')
1881
+ var ArrayName = NameArrayHome[1].trim().split(' ')
1882
+ var lastNameHome = ''
1883
+ if (lastArrayName.length == 2 || lastArrayName.length == 1) {
1884
+ if (lastArrayName[0].length < 4) {
1885
+ lastNameHome = lastArrayName[0] + ' ' + lastArrayName[1]
1886
+ } else {
1887
+ lastNameHome = lastArrayName[0]
1888
+ }
1889
+ } else {
1890
+ if (lastArrayName.length == 3) {
1891
+ lastNameHome = lastArrayName[0] + ' ' + lastArrayName[1]
1892
+ } else {
1893
+ if (lastArrayName.length == 4) {
1894
+ lastNameHome = lastArrayName[1] + ' ' + lastArrayName[2] + ' ' + lastArrayName[3]
1895
+ }
1896
+ }
1897
+ }
1898
+ var nameHome =
1899
+ ArrayName[ArrayName.length - 1] != ''
1900
+ ? ArrayName[ArrayName.length - 1].charAt(0)
1901
+ : ArrayName[ArrayName.length - 2]
1902
+ ? ArrayName[ArrayName.length - 2].charAt(0)
1903
+ : ''
1904
+ lastNameHome = lastNameHome.replace(',', '')
1905
+
1906
+ var newCooHome = data.data.home_team.starting_lineup[0].lineup[index].x
1907
+ var positionConvertHome = (newCooHome * 50) / 100
1908
+
1909
+ this.players.push({
1910
+ team_id: data.data.home_team.team_id,
1911
+ number: data.data.home_team.starting_lineup[0].lineup[index].jersey_number,
1912
+ isFirstTeam: true,
1913
+ name: nameHome + '. ' + lastNameHome,
1914
+ photo:
1915
+ 'https://golstatsimages.blob.core.windows.net/players-profile/' +
1916
+ data.data.home_team.starting_lineup[0].lineup[index].player_id +
1917
+ '.png',
1918
+ posX: (data.data.home_team.starting_lineup[0].lineup[index].x * 50) / 100,
1919
+ posY: data.data.home_team.starting_lineup[0].lineup[index].y,
1920
+ goals: 0,
1921
+ yellowcards: 0,
1922
+ redcards: 0,
1923
+ goalsMin: [],
1924
+ yellowcardsMin: 0,
1925
+ redcardsMin: 0,
1926
+ idyellowcards: 0,
1927
+ idredcards: 0,
1928
+ idsGoals: [],
1929
+ idSubstitution: 0
1930
+ })
1931
+ this.homeTeamLogo =
1932
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' + data.data.home_team.team_id + '.png'
1933
+ }
1934
+ }
1935
+ if (data.data.away_team.team_id == this.gameInfoheader.home_team) {
1936
+ this.dataPlayersHome = data.data.away_team.players
1937
+ data.data.away_team.starting_lineup[0].lineup.sort((a, b) =>
1938
+ a.position_id > b.position_id ? 1 : b.position_id > a.position_id ? -1 : 0
1939
+ )
1940
+ for (
1941
+ let index = 0;
1942
+ index < data.data.away_team.starting_lineup[0].lineup.length;
1943
+ index++
1944
+ ) {
1945
+ this.home_team_id = data.data.away_team.team_id
1946
+ this.imageExists(
1947
+ 'https://golstatsimages.blob.core.windows.net/jersey-teams/' + data.data.away_team.team_id + '.svg',
1948
+ 'home',
1949
+ 1
1950
+ )
1951
+ this.imageExists(
1952
+ 'https://golstatsimages.blob.core.windows.net/jersey-teams/' +
1953
+ data.data.away_team.team_id +
1954
+ '_g.svg',
1955
+ 'home',
1956
+ 0
1957
+ )
1958
+ var NameArrayHome =
1959
+ data.data.away_team.starting_lineup[0].lineup[index].player_name.split(',')
1960
+ var lastArrayName = NameArrayHome[0].split(' ')
1961
+ var ArrayName = NameArrayHome[1].trim().split(' ')
1962
+ var lastNameHome = ''
1963
+ if (lastArrayName.length == 2 || lastArrayName.length == 1) {
1964
+ if (lastArrayName[0].length < 4) {
1965
+ lastNameHome = lastArrayName[0] + ' ' + lastArrayName[1]
1966
+ } else {
1967
+ lastNameHome = lastArrayName[0]
1968
+ }
1969
+ } else {
1970
+ if (lastArrayName.length == 3) {
1971
+ lastNameHome = lastArrayName[0] + ' ' + lastArrayName[1]
1972
+ } else {
1973
+ if (lastArrayName.length == 4) {
1974
+ lastNameHome = lastArrayName[1] + ' ' + lastArrayName[2] + ' ' + lastArrayName[3]
1975
+ }
1976
+ }
1977
+ }
1978
+ var nameHome =
1979
+ ArrayName[ArrayName.length - 1] != ''
1980
+ ? ArrayName[ArrayName.length - 1].charAt(0)
1981
+ : ArrayName[ArrayName.length - 2]
1982
+ ? ArrayName[ArrayName.length - 2].charAt(0)
1983
+ : ''
1984
+ lastNameHome = lastNameHome.replace(',', '')
1985
+
1986
+ var newX = data.data.away_team.starting_lineup[0].lineup[index].x
1987
+ newX = Math.abs(newX - 100)
1988
+ var positionConvertHome = (newX * 50) / 100
1989
+ var newY = data.data.away_team.starting_lineup[0].lineup[index].y
1990
+ newY = Math.abs(newY - 100)
1991
+ this.players.push({
1992
+ team_id: data.data.away_team.team_id,
1993
+ number: data.data.away_team.starting_lineup[0].lineup[index].jersey_number,
1994
+ isFirstTeam: true,
1995
+ name: nameHome + '. ' + lastNameHome,
1996
+ photo:
1997
+ 'https://golstatsimages.blob.core.windows.net/players-profile/' +
1998
+ data.data.away_team.starting_lineup[0].lineup[index].player_id +
1999
+ '.png',
2000
+ posX: positionConvertHome - 2,
2001
+ posY: newY - 9,
2002
+ goals: 0,
2003
+ yellowcards: 0,
2004
+ redcards: 0,
2005
+ goalsMin: [],
2006
+ yellowcardsMin: 0,
2007
+ redcardsMin: 0,
2008
+ idyellowcards: 0,
2009
+ idredcards: 0,
2010
+ idsGoals: [],
2011
+ idSubstitution: 0
2012
+ })
2013
+
2014
+ this.homeTeamLogo =
2015
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' + data.data.away_team.team_id + '.png'
2016
+ }
2017
+ }
2018
+ } catch (e) {
2019
+ return Promise.reject(e)
2020
+ }
2021
+ },
2022
+ async getLineUp(game) {
2023
+ connectSocket()
2024
+ if (this.playersHome.length) {
2025
+ return
2026
+ }
2027
+ try {
2028
+ const axiosInstanceLineUp = axios.create({
2029
+ headers: {
2030
+ Authorization: `${this.tokenPremium}`
2031
+ }
2032
+ })
2033
+ const data = await axiosInstanceLineUp.get(this.url + game)
2034
+ if (!data || !data.data) {
2035
+ throw new Error('There is not lineups for this game.')
2036
+ }
2037
+ this.players = []
2038
+ this.dataPlayersHome = data.data.home_team.players
2039
+ this.dataPlayersAway = data.data.away_team.players
2040
+ data.data.home_team.starting_lineup[0].lineup.sort((a, b) =>
2041
+ a.position_id > b.position_id ? 1 : b.position_id > a.position_id ? -1 : 0
2042
+ )
2043
+ for (let index = 0; index < data.data.home_team.starting_lineup[0].lineup.length; index++) {
2044
+ this.home_team_id = data.data.home_team.team_id
2045
+ this.imageExists(
2046
+ 'https://golstatsimages.blob.core.windows.net/jersey-teams/' + data.data.home_team.team_id + '.svg',
2047
+ 'home',
2048
+ 1
2049
+ )
2050
+ this.imageExists(
2051
+ 'https://golstatsimages.blob.core.windows.net/jersey-teams/' + data.data.home_team.team_id + '_g.svg',
2052
+ 'home',
2053
+ 0
2054
+ )
2055
+ var NameArrayHome =
2056
+ data.data.home_team.starting_lineup[0].lineup[index].player_name.split(',')
2057
+ var lastArrayName = NameArrayHome[0].split(' ')
2058
+ var ArrayName = NameArrayHome[1].trim().split(' ')
2059
+ var lastNameHome = ''
2060
+ if (lastArrayName.length == 2 || lastArrayName.length == 1) {
2061
+ if (lastArrayName[0].length < 4) {
2062
+ lastNameHome = lastArrayName[0] + ' ' + lastArrayName[1]
2063
+ } else {
2064
+ lastNameHome = lastArrayName[0]
2065
+ }
2066
+ } else {
2067
+ if (lastArrayName.length == 3) {
2068
+ lastNameHome = lastArrayName[0] + ' ' + lastArrayName[1]
2069
+ } else {
2070
+ if (lastArrayName.length == 4) {
2071
+ lastNameHome = lastArrayName[1] + ' ' + lastArrayName[2] + ' ' + lastArrayName[3]
2072
+ }
2073
+ }
2074
+ }
2075
+ var nameHome =
2076
+ ArrayName[ArrayName.length - 1] != ''
2077
+ ? ArrayName[ArrayName.length - 1].charAt(0)
2078
+ : ArrayName[ArrayName.length - 2]
2079
+ ? ArrayName[ArrayName.length - 2].charAt(0)
2080
+ : ''
2081
+ lastNameHome = lastNameHome.replace(',', '')
2082
+ var abrevNamePlayerHome = nameHome + '. ' + lastNameHome
2083
+
2084
+ var newCooHome = data.data.home_team.starting_lineup[0].lineup[index].x
2085
+ var positionConvertHome = (newCooHome * 50) / 100
2086
+ var indexPlayerDataHome = data.data.home_team.players.findIndex(
2087
+ (player) =>
2088
+ player.player_id == data.data.home_team.starting_lineup[0].lineup[index].player_id
2089
+ )
2090
+ this.players.push({
2091
+ playerId: data.data.home_team.starting_lineup[0].lineup[index].player_id,
2092
+ number: data.data.home_team.starting_lineup[0].lineup[index].jersey_number,
2093
+ isFirstTeam: true,
2094
+ name: nameHome + '. ' + lastNameHome,
2095
+ photo:
2096
+ 'https://golstatsimages.blob.core.windows.net/players-profile/' +
2097
+ data.data.home_team.starting_lineup[0].lineup[index].player_id +
2098
+ '.png',
2099
+ posX: (data.data.home_team.starting_lineup[0].lineup[index].x * 50) / 100,
2100
+ posY: data.data.home_team.starting_lineup[0].lineup[index].y,
2101
+ goals: 0,
2102
+ yellowcards: 0,
2103
+ redcards: 0,
2104
+ goalsMin: [],
2105
+ yellowcardsMin: 0,
2106
+ redcardsMin: 0,
2107
+ idyellowcards: 0,
2108
+ idredcards: 0,
2109
+ idsGoals: [],
2110
+ idSubstitution: 0
2111
+ })
2112
+ this.playersHome.push({
2113
+ played: true,
2114
+ name: data.data.home_team.starting_lineup[0].lineup[index].player_name,
2115
+ position:
2116
+ this.positions[data.data.home_team.players[indexPlayerDataHome].position_id - 1].name,
2117
+ position_id: data.data.home_team.players[indexPlayerDataHome].position_id - 1,
2118
+ imgPlayer:
2119
+ 'https://golstatsimages.blob.core.windows.net/players-profile/' +
2120
+ data.data.home_team.starting_lineup[0].lineup[index].player_id +
2121
+ '.png',
2122
+ nationality: data.data.home_team.players[indexPlayerDataHome].nationality
2123
+ ? data.data.home_team.players[indexPlayerDataHome].nationality.substring(0, 3)
2124
+ : '',
2125
+ imgNationality: data.data.home_team.players[indexPlayerDataHome].nationality_photo,
2126
+ substitutionIn: false,
2127
+ substitutionOut: false,
2128
+ abrevNamePlayer: abrevNamePlayerHome,
2129
+ imgTeam:
2130
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' + data.data.home_team.team_id + '.png',
2131
+ substitutionMin: '',
2132
+ substitutionDataID: '',
2133
+ shirt_number: data.data.home_team.starting_lineup[0].lineup[index].jersey_number,
2134
+ positionX: data.data.home_team.starting_lineup[0].lineup[index].y - 13,
2135
+ positionY: positionConvertHome * 0.9,
2136
+ positionXOrigin: data.data.home_team.starting_lineup[0].lineup[index].y - 17,
2137
+ positionYOrigin: data.data.home_team.starting_lineup[0].lineup[index].x - 2,
2138
+ playerId: data.data.home_team.starting_lineup[0].lineup[index].player_id,
2139
+ goals: 0,
2140
+ yellowcards: 0,
2141
+ redcards: 0,
2142
+ goalsMin: [],
2143
+ yellowcardsMin: 0,
2144
+ redcardsMin: 0,
2145
+ idyellowcards: 0,
2146
+ idredcards: 0,
2147
+ idsGoals: [],
2148
+ idSubstitution: 0,
2149
+ isbench: false,
2150
+ id_team: data.data.home_team.team_id
2151
+ })
2152
+ this.homeTeamLogo =
2153
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' + data.data.home_team.team_id + '.png'
2154
+ }
2155
+ this.playersHome.sort((a, b) =>
2156
+ a.position_id > b.position_id ? 1 : b.position_id > a.position_id ? -1 : 0
2157
+ )
2158
+ if (data.data.home_team.bench) {
2159
+ for (let index = 0; index < data.data.home_team.bench.length; index++) {
2160
+ this.subsTitle = true
2161
+ var NameArrayHomeBench = data.data.home_team.bench[index].playerName.split(',')
2162
+ var lastArrayNameBench = NameArrayHomeBench[0].split(' ')
2163
+ var ArrayNameBench = NameArrayHomeBench[1].trim().split(' ')
2164
+ var lastNameHomeBench = ''
2165
+ if (lastArrayNameBench.length == 2 || lastArrayNameBench.length == 1) {
2166
+ if (lastArrayNameBench[0].length < 4) {
2167
+ lastNameHomeBench = lastArrayNameBench[0] + ' ' + lastArrayNameBench[1]
2168
+ } else {
2169
+ lastNameHomeBench = lastArrayNameBench[0]
2170
+ }
2171
+ } else {
2172
+ if (lastArrayNameBench.length == 3) {
2173
+ lastNameHomeBench = lastArrayNameBench[0] + ' ' + lastArrayNameBench[1]
2174
+ } else {
2175
+ if (lastArrayNameBench.length == 4) {
2176
+ lastNameHomeBench =
2177
+ lastArrayNameBench[1] +
2178
+ ' ' +
2179
+ lastArrayNameBench[2] +
2180
+ ' ' +
2181
+ lastArrayNameBench[3]
2182
+ }
2183
+ }
2184
+ }
2185
+ var nameHomeBench =
2186
+ ArrayNameBench[ArrayNameBench.length - 1] != ''
2187
+ ? ArrayNameBench[ArrayNameBench.length - 1].charAt(0)
2188
+ : ArrayNameBench[ArrayNameBench.length - 2]
2189
+ ? ArrayNameBench[ArrayNameBench.length - 2].charAt(0)
2190
+ : ''
2191
+ lastNameHomeBench = lastNameHomeBench.replace(',', '')
2192
+ var abrevNamePlayerHomeBench = nameHomeBench + '. ' + lastNameHomeBench
2193
+ var indexPlayerDataHomeBench = data.data.home_team.players.findIndex(
2194
+ (player) => player.player_id == data.data.home_team.bench[index].playerID
2195
+ )
2196
+ this.playersHome.push({
2197
+ played: false,
2198
+ name: data.data.home_team.bench[index].playerName,
2199
+ position:
2200
+ indexPlayerDataHomeBench != -1
2201
+ ? this.positions[
2202
+ data.data.home_team.players[indexPlayerDataHomeBench].position_id - 1
2203
+ ].name
2204
+ : '',
2205
+ position_id: data.data.home_team.players[indexPlayerDataHomeBench].position_id,
2206
+ imgPlayer:
2207
+ 'https://golstatsimages.blob.core.windows.net/players-profile/' +
2208
+ data.data.home_team.bench[index].playerID +
2209
+ '.png',
2210
+ nationality:
2211
+ indexPlayerDataHomeBench != -1
2212
+ ? data.data.home_team.players[indexPlayerDataHomeBench].nationality
2213
+ ? data.data.home_team.players[indexPlayerDataHomeBench].nationality.substring(
2214
+ 0,
2215
+ 3
2216
+ )
2217
+ : ''
2218
+ : '',
2219
+ imgNationality:
2220
+ indexPlayerDataHomeBench != -1
2221
+ ? data.data.home_team.players[indexPlayerDataHomeBench].nationality_photo
2222
+ : '',
2223
+ substitutionIn: false,
2224
+ substitutionOut: false,
2225
+ abrevNamePlayer: abrevNamePlayerHomeBench,
2226
+ imgTeam:
2227
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' + data.data.home_team.team_id + '.png',
2228
+ substitutionMin: '',
2229
+ substitutionDataID: '',
2230
+ shirt_number: data.data.home_team.bench[index].jerseyNumber,
2231
+ positionX: '',
2232
+ positionY: '',
2233
+ positionXOrigin: '',
2234
+ positionYOrigin: '',
2235
+ playerId: data.data.home_team.bench[index].playerID,
2236
+ goals: 0,
2237
+ yellowcards: 0,
2238
+ redcards: 0,
2239
+ goalsMin: [],
2240
+ yellowcardsMin: 0,
2241
+ redcardsMin: 0,
2242
+ idyellowcards: 0,
2243
+ idredcards: 0,
2244
+ idsGoals: [],
2245
+ idSubstitution: 0,
2246
+ isbench: true,
2247
+ id_team: data.data.home_team.team_id
2248
+ })
2249
+ }
2250
+ this.playersHome.sort((a, b) =>
2251
+ a.position_id > b.position_id ? 1 : b.position_id > a.position_id ? -1 : 0
2252
+ )
2253
+ }
2254
+ for (let index = 0; index < data.data.away_team.starting_lineup[0].lineup.length; index++) {
2255
+ this.away_team_id = data.data.away_team.team_id
2256
+ this.imageExists(
2257
+ 'https://golstatsimages.blob.core.windows.net/jersey-teams/' + data.data.away_team.team_id + '.svg',
2258
+ 'away',
2259
+ 1
2260
+ )
2261
+ this.imageExists(
2262
+ 'https://golstatsimages.blob.core.windows.net/jersey-teams/' + data.data.away_team.team_id + '_g.svg',
2263
+ 'away',
2264
+ 0
2265
+ )
2266
+ var NameArrayAway =
2267
+ data.data.away_team.starting_lineup[0].lineup[index].player_name.split(',')
2268
+ var lastArrayNameAway = NameArrayAway[0].split(' ')
2269
+ var ArrayNameAway = NameArrayAway[1].trim().split(' ')
2270
+ var lastNameAway = ''
2271
+ if (lastArrayNameAway.length == 2 || lastArrayNameAway.length == 1) {
2272
+ if (lastArrayNameAway[0].length < 4) {
2273
+ lastNameAway = lastArrayNameAway[0] + ' ' + lastArrayNameAway[1]
2274
+ } else {
2275
+ lastNameAway = lastArrayNameAway[0]
2276
+ }
2277
+ } else {
2278
+ if (lastArrayNameAway.length == 3) {
2279
+ lastNameAway = lastArrayNameAway[0] + ' ' + lastArrayNameAway[1]
2280
+ } else {
2281
+ if (lastArrayNameAway.length == 4) {
2282
+ lastNameAway =
2283
+ lastArrayNameAway[1] + ' ' + lastArrayNameAway[2] + ' ' + lastArrayNameAway[3]
2284
+ }
2285
+ }
2286
+ }
2287
+ var nameAway =
2288
+ ArrayNameAway[ArrayName.length - 1] != ''
2289
+ ? ArrayNameAway[ArrayNameAway.length - 1].charAt(0)
2290
+ : ArrayNameAway[ArrayNameAway.length - 2]
2291
+ ? ArrayNameAway[ArrayNameAway.length - 2].charAt(0)
2292
+ : ''
2293
+ lastNameAway = lastNameAway.replace(',', '')
2294
+ var abrevNamePlayerAway = nameAway + '. ' + lastNameAway
2295
+
2296
+ var newCooAway = data.data.away_team.starting_lineup[0].lineup[index].x
2297
+
2298
+ // var positionConvert = 100 - ((100 - newCooAway) * 50) / 100;
2299
+ var positionConvert = 100 - ((100 - newCooAway) * 50) / 100
2300
+ positionConvert = positionConvert * 0.9
2301
+ var indexPlayerData = data.data.away_team.players.findIndex(
2302
+ (player) =>
2303
+ player.player_id == data.data.away_team.starting_lineup[0].lineup[index].player_id
2304
+ )
2305
+ this.players.push({
2306
+ playerId: data.data.away_team.starting_lineup[0].lineup[index].player_id,
2307
+ number: data.data.away_team.starting_lineup[0].lineup[index].jersey_number,
2308
+ isFirstTeam: false,
2309
+ name: nameAway + '. ' + lastNameAway,
2310
+ photo:
2311
+ 'https://golstatsimages.blob.core.windows.net/players-profile/' +
2312
+ data.data.away_team.starting_lineup[0].lineup[index].player_id +
2313
+ '.png',
2314
+ posX: 100 - ((100 - data.data.away_team.starting_lineup[0].lineup[index].x) * 50) / 100,
2315
+ posY: data.data.away_team.starting_lineup[0].lineup[index].y,
2316
+ goals: 0,
2317
+ yellowcards: 0,
2318
+ redcards: 0,
2319
+ goalsMin: [],
2320
+ yellowcardsMin: 0,
2321
+ redcardsMin: 0,
2322
+ idyellowcards: 0,
2323
+ idredcards: 0,
2324
+ idsGoals: [],
2325
+ idSubstitution: 0
2326
+ })
2327
+ this.playersAway.push({
2328
+ played: true,
2329
+ name: data.data.away_team.starting_lineup[0].lineup[index].player_name,
2330
+ position:
2331
+ this.positions[data.data.away_team.players[indexPlayerData].position_id - 1].name,
2332
+ position_id: data.data.away_team.players[indexPlayerData].position_id,
2333
+ imgPlayer:
2334
+ 'https://golstatsimages.blob.core.windows.net/players-profile/' +
2335
+ data.data.away_team.starting_lineup[0].lineup[index].player_id +
2336
+ '.png',
2337
+ nationality: data.data.away_team.players[indexPlayerData].nationality
2338
+ ? data.data.away_team.players[indexPlayerData].nationality.substring(0, 3)
2339
+ : '',
2340
+ imgNationality: data.data.away_team.players[indexPlayerData].nationality_photo,
2341
+ substitutionIn: false,
2342
+ substitutionOut: false,
2343
+ abrevNamePlayer: abrevNamePlayerAway,
2344
+ imgTeam:
2345
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' + data.data.away_team.team_id + '.png',
2346
+ substitutionMin: '',
2347
+ substitutionDataID: '',
2348
+ shirt_number: data.data.away_team.starting_lineup[0].lineup[index].jersey_number,
2349
+ positionX: data.data.away_team.starting_lineup[0].lineup[index].y - 13,
2350
+ positionY: positionConvert,
2351
+ positionXOrigin: data.data.away_team.starting_lineup[0].lineup[index].y - 17,
2352
+ positionYOrigin: data.data.away_team.starting_lineup[0].lineup[index].x - 7,
2353
+ playerId: data.data.away_team.starting_lineup[0].lineup[index].player_id,
2354
+ goals: 0,
2355
+ yellowcards: 0,
2356
+ redcards: 0,
2357
+ goalsMin: [],
2358
+ yellowcardsMin: 0,
2359
+ redcardsMin: 0,
2360
+ idyellowcards: 0,
2361
+ idredcards: 0,
2362
+ idsGoals: [],
2363
+ idSubstitution: 0,
2364
+ isbench: false,
2365
+ id_team: data.data.away_team.team_id
2366
+ })
2367
+ this.awayTeamLogo =
2368
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' + data.data.away_team.team_id + '.png'
2369
+ }
2370
+ this.playersAway.sort((a, b) =>
2371
+ a.position_id > b.position_id ? 1 : b.position_id > a.position_id ? -1 : 0
2372
+ )
2373
+ if (data.data.away_team.bench) {
2374
+ for (let index = 0; index < data.data.away_team.bench.length; index++) {
2375
+ this.subsTitle = true
2376
+ var NameArrayAwayBench = data.data.away_team.bench[index].playerName.split(',')
2377
+ var lastArrayNameBenchAway = NameArrayAwayBench[0].split(' ')
2378
+ var ArrayNameBenchAway = NameArrayAwayBench[1].trim().split(' ')
2379
+ var lastNameAwayBench = ''
2380
+ if (lastArrayNameBenchAway.length == 2 || lastArrayNameBenchAway.length == 1) {
2381
+ if (lastArrayNameBenchAway[0].length < 4) {
2382
+ lastNameAwayBench = lastArrayNameBenchAway[0] + ' ' + lastArrayNameBenchAway[1]
2383
+ } else {
2384
+ lastNameAwayBench = lastArrayNameBenchAway[0]
2385
+ }
2386
+ } else {
2387
+ if (lastArrayNameBenchAway.length == 3) {
2388
+ lastNameAwayBench = lastArrayNameBenchAway[0] + ' ' + lastArrayNameBenchAway[1]
2389
+ } else {
2390
+ if (lastArrayNameBenchAway.length == 4) {
2391
+ lastNameAwayBench =
2392
+ lastArrayNameBenchAway[1] +
2393
+ ' ' +
2394
+ lastArrayNameBenchAway[2] +
2395
+ ' ' +
2396
+ lastArrayNameBenchAway[3]
2397
+ }
2398
+ }
2399
+ }
2400
+ var TnameBenchAway =
2401
+ ArrayNameBenchAway[ArrayNameBenchAway.length - 1] != ''
2402
+ ? ArrayNameBenchAway[ArrayNameBenchAway.length - 1].charAt(0)
2403
+ : ArrayNameBenchAway[ArrayNameBenchAway.length - 2]
2404
+ ? ArrayNameBenchAway[ArrayNameBenchAway.length - 2].charAt(0)
2405
+ : ''
2406
+ lastNameAwayBench = lastNameAwayBench.replace(',', '')
2407
+ var abrevNamePlayerAwayBench = TnameBenchAway + '. ' + lastNameAwayBench
2408
+ var indexPlayerDataAwayBench = data.data.away_team.players.findIndex(
2409
+ (player) => player.player_id == data.data.away_team.bench[index].playerID
2410
+ )
2411
+ this.playersAway.push({
2412
+ played: false,
2413
+ name: data.data.away_team.bench[index].playerName,
2414
+ position:
2415
+ indexPlayerDataAwayBench != -1
2416
+ ? this.positions[
2417
+ data.data.away_team.players[indexPlayerDataAwayBench].position_id - 1
2418
+ ].name
2419
+ : '',
2420
+ position_id: data.data.away_team.players[indexPlayerDataAwayBench].position_id,
2421
+ imgPlayer:
2422
+ 'https://golstatsimages.blob.core.windows.net/players-profile/' +
2423
+ data.data.away_team.bench[index].playerID +
2424
+ '.png',
2425
+ nationality:
2426
+ indexPlayerDataAwayBench != -1
2427
+ ? data.data.away_team.players[indexPlayerDataAwayBench].nationality
2428
+ ? data.data.away_team.players[indexPlayerDataAwayBench].nationality.substring(
2429
+ 0,
2430
+ 3
2431
+ )
2432
+ : ''
2433
+ : '',
2434
+ imgNationality:
2435
+ indexPlayerDataAwayBench != -1
2436
+ ? data.data.away_team.players[indexPlayerDataAwayBench].nationality_photo
2437
+ : '',
2438
+ substitutionIn: false,
2439
+ substitutionOut: false,
2440
+ abrevNamePlayer: abrevNamePlayerAwayBench,
2441
+ imgTeam:
2442
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' + data.data.away_team.team_id + '.png',
2443
+ substitutionMin: '',
2444
+ substitutionDataID: '',
2445
+ shirt_number: data.data.away_team.bench[index].jerseyNumber,
2446
+ positionX: '',
2447
+ positionY: '',
2448
+ positionXOrigin: '',
2449
+ positionYOrigin: '',
2450
+ playerId: data.data.away_team.bench[index].playerID,
2451
+ goals: 0,
2452
+ yellowcards: 0,
2453
+ redcards: 0,
2454
+ goalsMin: [],
2455
+ yellowcardsMin: 0,
2456
+ redcardsMin: 0,
2457
+ idyellowcards: 0,
2458
+ idredcards: 0,
2459
+ idsGoals: [],
2460
+ idSubstitution: 0,
2461
+ isbench: true,
2462
+ id_team: data.data.away_team.team_id
2463
+ })
2464
+ }
2465
+ this.playersAway.sort((a, b) =>
2466
+ a.position_id > b.position_id ? 1 : b.position_id > a.position_id ? -1 : 0
2467
+ )
2468
+ }
2469
+ //if (!this.game.prematch) {
2470
+ this.getMXM(game)
2471
+ //}
2472
+ } catch (e) {
2473
+ return Promise.reject(e)
2474
+ }
2475
+ },
2476
+ closeChange() {
2477
+ this.subsActive = false
2478
+ },
2479
+ imageExists(image_url, team, type) {
2480
+ var http = new XMLHttpRequest()
2481
+ var requestFlag = 0
2482
+ if (team == 'away') {
2483
+ if (type == 1) {
2484
+ if (this.uniformAway == '') {
2485
+ http.open('HEAD', image_url, false)
2486
+ http.send()
2487
+ requestFlag = 1
2488
+ }
2489
+ } else {
2490
+ if (this.uniformAwayG == '') {
2491
+ http.open('HEAD', image_url, false)
2492
+ http.send()
2493
+ requestFlag = 1
2494
+ }
2495
+ }
2496
+ } else {
2497
+ if (type == 1) {
2498
+ if (this.uniformHome == '') {
2499
+ http.open('HEAD', image_url, false)
2500
+ http.send()
2501
+ requestFlag = 1
2502
+ }
2503
+ } else {
2504
+ if (this.uniformHomeG == '') {
2505
+ http.open('HEAD', image_url, false)
2506
+ http.send()
2507
+ requestFlag = 1
2508
+ }
2509
+ }
2510
+ }
2511
+ if (requestFlag == 1) {
2512
+ if (http.status == 200) {
2513
+ if (team == 'away') {
2514
+ if (type == 1) {
2515
+ this.uniformAway = 'url(' + image_url + ')'
2516
+ } else {
2517
+ this.uniformAwayG = 'url(' + image_url + ')'
2518
+ }
2519
+ } else {
2520
+ if (type == 1) {
2521
+ this.uniformHome = 'url(' + image_url + ')'
2522
+ } else {
2523
+ this.uniformHomeG = 'url(' + image_url + ')'
2524
+ }
2525
+ }
2526
+ } else {
2527
+ if (team == 'away') {
2528
+ if (type == 1) {
2529
+ this.uniformAway =
2530
+ 'url(https://golstatsimages.blob.core.windows.net/jersey-teams/default_visita.svg)'
2531
+ } else {
2532
+ this.uniformAwayG =
2533
+ 'url(https://golstatsimages.blob.core.windows.net/jersey-teams/default_visita_g.svg)'
2534
+ }
2535
+ } else {
2536
+ if (type == 1) {
2537
+ this.uniformHome =
2538
+ 'url(https://golstatsimages.blob.core.windows.net/jersey-teams/default_local.svg)'
2539
+ } else {
2540
+ this.uniformHomeG =
2541
+ 'url(https://golstatsimages.blob.core.windows.net/jersey-teams/default_local_g.svg)'
2542
+ }
2543
+ }
2544
+ }
2545
+ }
2546
+ },
2547
+ viewChange(ids) {
2548
+ var idSubstitution = ids.split('@')
2549
+ if (idSubstitution[0] == this.home_team_id) {
2550
+ var indexChangeHomeOut = this.playersHome.findIndex(
2551
+ (player) => player.playerId == idSubstitution[1]
2552
+ )
2553
+ var indexChangeHomeIn = this.playersHome.findIndex(
2554
+ (player) => player.playerId == idSubstitution[2]
2555
+ )
2556
+ if (indexChangeHomeOut != -1) {
2557
+ this.substitutionModal.min = this.playersHome[indexChangeHomeOut].substitutionMin
2558
+ this.substitutionModal.in.name = this.playersHome[indexChangeHomeOut].abrevNamePlayer
2559
+ this.substitutionModal.in.teamImg = this.playersHome[indexChangeHomeOut].imgTeam
2560
+ this.substitutionModal.in.shirt_number = this.playersHome[indexChangeHomeOut].shirt_number
2561
+ this.substitutionModal.in.playerImg = this.playersHome[indexChangeHomeOut].imgPlayer
2562
+ this.substitutionModal.in.nationalityimg =
2563
+ this.playersHome[indexChangeHomeOut].imgNationality
2564
+ } else {
2565
+ this.substitutionModal.in.name = ''
2566
+ this.substitutionModal.in.teamImg = ''
2567
+ this.substitutionModal.in.shirt_number = ''
2568
+ this.substitutionModal.in.playerImg = ''
2569
+ this.substitutionModal.in.nationalityimg = ''
2570
+ }
2571
+ if (indexChangeHomeIn != -1) {
2572
+ this.substitutionModal.out.name = this.playersHome[indexChangeHomeIn].abrevNamePlayer
2573
+ this.substitutionModal.out.teamImg = this.playersHome[indexChangeHomeIn].imgTeam
2574
+ this.substitutionModal.out.playerImg = this.playersHome[indexChangeHomeIn].imgPlayer
2575
+ this.substitutionModal.out.nationalityimg =
2576
+ this.playersHome[indexChangeHomeIn].imgNationality
2577
+ this.substitutionModal.out.shirt_number = this.playersHome[indexChangeHomeIn].shirt_number
2578
+ } else {
2579
+ this.substitutionModal.out.name = ''
2580
+ this.substitutionModal.out.teamImg = ''
2581
+ this.substitutionModal.out.shirt_number = ''
2582
+ this.substitutionModal.out.playerImg = ''
2583
+ this.substitutionModal.out.nationalityimg = ''
2584
+ }
2585
+ } else {
2586
+ var indexChangeAwayOut = this.playersAway.findIndex(
2587
+ (player) => player.playerId == idSubstitution[1]
2588
+ )
2589
+ var indexChangeAwayIn = this.playersAway.findIndex(
2590
+ (player) => player.playerId == idSubstitution[2]
2591
+ )
2592
+ if (indexChangeAwayOut != -1) {
2593
+ this.substitutionModal.min = this.playersAway[indexChangeAwayOut].substitutionMin
2594
+ this.substitutionModal.in.name = this.playersAway[indexChangeAwayOut].abrevNamePlayer
2595
+ this.substitutionModal.in.teamImg = this.playersAway[indexChangeAwayOut].imgTeam
2596
+ this.substitutionModal.in.playerImg = this.playersAway[indexChangeAwayOut].imgPlayer
2597
+ this.substitutionModal.in.nationalityimg =
2598
+ this.playersAway[indexChangeAwayOut].imgNationality
2599
+ this.substitutionModal.in.shirt_number = this.playersAway[indexChangeAwayOut].shirt_number
2600
+ } else {
2601
+ this.substitutionModal.in.name = ''
2602
+ this.substitutionModal.in.teamImg = ''
2603
+ this.substitutionModal.in.shirt_number = ''
2604
+ this.substitutionModal.in.playerImg = ''
2605
+ this.substitutionModal.in.nationalityimg = ''
2606
+ }
2607
+ if (indexChangeAwayIn != -1) {
2608
+ this.substitutionModal.out.name = this.playersAway[indexChangeAwayIn].abrevNamePlayer
2609
+ this.substitutionModal.out.teamImg = this.playersAway[indexChangeAwayIn].imgTeam
2610
+ this.substitutionModal.out.playerImg = this.playersAway[indexChangeAwayIn].imgPlayer
2611
+ this.substitutionModal.out.nationalityimg =
2612
+ this.playersAway[indexChangeAwayIn].imgNationality
2613
+ this.substitutionModal.out.shirt_number = this.playersAway[indexChangeAwayIn].shirt_number
2614
+ } else {
2615
+ this.substitutionModal.out.name = ''
2616
+ this.substitutionModal.out.teamImg = ''
2617
+ this.substitutionModal.out.shirt_number = ''
2618
+ this.substitutionModal.out.playerImg = ''
2619
+ this.substitutionModal.out.nationalityimg = ''
2620
+ }
2621
+ }
2622
+ this.subsActive = true
2623
+ },
2624
+ viewLineupTeam(opt) {
2625
+ this.teamActive = opt
2626
+ }
2627
+ },
2628
+
2629
+ sockets: {
2630
+ new_bench([channelName, benchEvent]) {
2631
+ if (benchEvent[this.home_team_id]) {
2632
+ this.playersHome = this.playersHome.filter(function (el) {
2633
+ return !el.isbench
2634
+ })
2635
+ for (let index = 0; index < benchEvent[this.home_team_id].length; index++) {
2636
+ if (!benchEvent[this.home_team_id][index].isTitular) {
2637
+ this.subsTitle = true
2638
+ var NameArrayHomeBench = benchEvent[this.home_team_id][index].playerName.split(',')
2639
+ var lastArrayNameBench = NameArrayHomeBench[0].split(' ')
2640
+ var ArrayNameBench = NameArrayHomeBench[1].trim().split(' ')
2641
+ var lastNameHomeBench = ''
2642
+ if (lastArrayNameBench.length == 2 || lastArrayNameBench.length == 1) {
2643
+ if (lastArrayNameBench[0].length < 4) {
2644
+ lastNameHomeBench = lastArrayNameBench[0] + ' ' + lastArrayNameBench[1]
2645
+ } else {
2646
+ lastNameHomeBench = lastArrayNameBench[0]
2647
+ }
2648
+ } else {
2649
+ if (lastArrayNameBench.length == 3) {
2650
+ lastNameHomeBench = lastArrayNameBench[0] + ' ' + lastArrayNameBench[1]
2651
+ } else {
2652
+ if (lastArrayNameBench.length == 4) {
2653
+ lastNameHomeBench =
2654
+ lastArrayNameBench[1] +
2655
+ ' ' +
2656
+ lastArrayNameBench[2] +
2657
+ ' ' +
2658
+ lastArrayNameBench[3]
2659
+ }
2660
+ }
2661
+ }
2662
+ var nameHomeBench =
2663
+ ArrayNameBench[ArrayNameBench.length - 1] != ''
2664
+ ? ArrayNameBench[ArrayNameBench.length - 1].charAt(0)
2665
+ : ArrayNameBench[ArrayNameBench.length - 2]
2666
+ ? ArrayNameBench[ArrayNameBench.length - 2].charAt(0)
2667
+ : ''
2668
+ lastNameHomeBench = lastNameHomeBench.replace(',', '')
2669
+ var abrevNamePlayerHomeBench = nameHomeBench + '. ' + lastNameHomeBench
2670
+ var indexPlayerDataHomeBench = this.dataPlayersHome.findIndex(
2671
+ (player) => player.player_id == benchEvent[this.home_team_id][index].playerID
2672
+ )
2673
+ this.playersHome.push({
2674
+ played: false,
2675
+ name: benchEvent[this.home_team_id][index].playerName,
2676
+ position:
2677
+ indexPlayerDataHomeBench != -1
2678
+ ? this.positions[this.dataPlayersHome[indexPlayerDataHomeBench].position_id - 1]
2679
+ .name
2680
+ : '',
2681
+ position_id: this.dataPlayersHome[indexPlayerDataHomeBench].position_id,
2682
+ imgPlayer:
2683
+ 'https://golstatsimages.blob.core.windows.net/players-profile/' +
2684
+ benchEvent[this.home_team_id][index].playerID +
2685
+ '.png',
2686
+ nationality:
2687
+ indexPlayerDataHomeBench != -1
2688
+ ? this.dataPlayersHome[indexPlayerDataHomeBench].nationality
2689
+ ? this.dataPlayersHome[indexPlayerDataHomeBench].nationality.substring(0, 3)
2690
+ : ''
2691
+ : '',
2692
+ imgNationality:
2693
+ indexPlayerDataHomeBench != -1
2694
+ ? this.dataPlayersHome[indexPlayerDataHomeBench].nationality_photo
2695
+ : '',
2696
+ substitutionIn: false,
2697
+ substitutionOut: false,
2698
+ abrevNamePlayer: abrevNamePlayerHomeBench,
2699
+ imgTeam: 'https://golstatsimages.blob.core.windows.net/teams-80/' + this.home_team_id + '.png',
2700
+ substitutionMin: '',
2701
+ substitutionDataID: '',
2702
+ shirt_number: benchEvent[this.home_team_id][index].jerseyNumber,
2703
+ positionX: '',
2704
+ positionY: '',
2705
+ positionXOrigin: '',
2706
+ positionYOrigin: '',
2707
+ playerId: benchEvent[this.home_team_id][index].playerID,
2708
+ goals: 0,
2709
+ yellowcards: 0,
2710
+ redcards: 0,
2711
+ goalsMin: [],
2712
+ yellowcardsMin: 0,
2713
+ redcardsMin: 0,
2714
+ idyellowcards: 0,
2715
+ idredcards: 0,
2716
+ idsGoals: [],
2717
+ idSubstitution: 0,
2718
+ isbench: true
2719
+ })
2720
+ }
2721
+ }
2722
+ this.playersHome.sort((a, b) =>
2723
+ a.position_id > b.position_id ? 1 : b.position_id > a.position_id ? -1 : 0
2724
+ )
2725
+ }
2726
+
2727
+ if (benchEvent[this.away_team_id]) {
2728
+ this.playersAway = this.playersAway.filter(function (el) {
2729
+ return !el.isbench
2730
+ })
2731
+ for (let index = 0; index < benchEvent[this.away_team_id].length; index++) {
2732
+ if (!benchEvent[this.away_team_id][index].isTitular) {
2733
+ this.subsTitle = true
2734
+ var NameArrayAwayBench = benchEvent[this.away_team_id][index].playerName.split(',')
2735
+ var lastArrayNameBenchAway = NameArrayAwayBench[0].split(' ')
2736
+ var ArrayNameBenchAway = NameArrayHomeBench[1].trim().split(' ')
2737
+ var lastNameAwayBench = ''
2738
+ if (lastArrayNameBenchAway.length == 2 || lastArrayNameBenchAway.length == 1) {
2739
+ if (lastArrayNameBenchAway[0].length < 4) {
2740
+ lastNameAwayBench = lastArrayNameBenchAway[0] + ' ' + lastArrayNameBenchAway[1]
2741
+ } else {
2742
+ lastNameAwayBench = lastArrayNameBenchAway[0]
2743
+ }
2744
+ } else {
2745
+ if (lastArrayNameBenchAway.length == 3) {
2746
+ lastNameAwayBench = lastArrayNameBenchAway[0] + ' ' + lastArrayNameBenchAway[1]
2747
+ } else {
2748
+ if (lastArrayNameBenchAway.length == 4) {
2749
+ lastNameAwayBench =
2750
+ lastArrayNameBenchAway[1] +
2751
+ ' ' +
2752
+ lastArrayNameBenchAway[2] +
2753
+ ' ' +
2754
+ lastArrayNameBenchAway[3]
2755
+ }
2756
+ }
2757
+ }
2758
+ var nameHomeBenchAway =
2759
+ ArrayNameBenchAway[ArrayNameBenchAway.length - 1] != ''
2760
+ ? ArrayNameBenchAway[ArrayNameBenchAway.length - 1].charAt(0)
2761
+ : ArrayNameBenchAway[ArrayNameBenchAway.length - 2]
2762
+ ? ArrayNameBenchAway[ArrayNameBenchAway.length - 2].charAt(0)
2763
+ : ''
2764
+ lastNameAwayBench = lastNameAwayBench.replace(',', '')
2765
+ var abrevNamePlayerAwayBench = nameHomeBenchAway + '. ' + lastNameAwayBench
2766
+ var indexPlayerDataAwayBench = this.dataPlayersAway.findIndex(
2767
+ (player) => player.player_id == benchEvent[this.away_team_id][index].playerID
2768
+ )
2769
+ this.playersAway.push({
2770
+ played: false,
2771
+ name: benchEvent[this.away_team_id][index].playerName,
2772
+ position:
2773
+ indexPlayerDataAwayBench != -1
2774
+ ? this.positions[this.dataPlayersAway[indexPlayerDataAwayBench].position_id - 1]
2775
+ .name
2776
+ : '',
2777
+ position_id: this.dataPlayersAway[indexPlayerDataAwayBench].position_id,
2778
+ imgPlayer:
2779
+ 'https://golstatsimages.blob.core.windows.net/players-profile/' +
2780
+ benchEvent[this.away_team_id][index].playerID +
2781
+ '.png',
2782
+ nationality:
2783
+ indexPlayerDataAwayBench != -1
2784
+ ? this.dataPlayersAway[indexPlayerDataAwayBench].nationality
2785
+ ? this.dataPlayersAway[indexPlayerDataAwayBench].nationality.substring(0, 3)
2786
+ : ''
2787
+ : '',
2788
+ imgNationality:
2789
+ indexPlayerDataAwayBench != -1
2790
+ ? this.dataPlayersAway[indexPlayerDataAwayBench].nationality_photo
2791
+ : '',
2792
+ substitutionIn: false,
2793
+ substitutionOut: false,
2794
+ abrevNamePlayer: abrevNamePlayerAwayBench,
2795
+ imgTeam: 'https://golstatsimages.blob.core.windows.net/teams-80/' + this.away_team_id + '.png',
2796
+ substitutionMin: '',
2797
+ substitutionDataID: '',
2798
+ shirt_number: benchEvent[this.away_team_id][index].jerseyNumber,
2799
+ positionX: '',
2800
+ positionY: '',
2801
+ positionXOrigin: '',
2802
+ positionYOrigin: '',
2803
+ playerId: benchEvent[this.away_team_id][index].playerID,
2804
+ goals: 0,
2805
+ yellowcards: 0,
2806
+ redcards: 0,
2807
+ goalsMin: [],
2808
+ yellowcardsMin: 0,
2809
+ redcardsMin: 0,
2810
+ idyellowcards: 0,
2811
+ idredcards: 0,
2812
+ idsGoals: [],
2813
+ idSubstitution: 0,
2814
+ isbench: true
2815
+ })
2816
+ }
2817
+ }
2818
+ this.playersAway.sort((a, b) =>
2819
+ a.position_id > b.position_id ? 1 : b.position_id > a.position_id ? -1 : 0
2820
+ )
2821
+ }
2822
+ },
2823
+ new_lineup([channelName, gameEvent]) {
2824
+ if (gameEvent.team_id == gameEvent.home_team.team_id) {
2825
+ if (this.playersHome.length == 0) {
2826
+ this.dataPlayersHome = gameEvent.home_team.players
2827
+
2828
+ for (let index = 0; index < gameEvent.data.length; index++) {
2829
+ this.home_team_id = gameEvent.team_id
2830
+ this.imageExists(
2831
+ 'https://golstatsimages.blob.core.windows.net/jersey-teams/' + gameEvent.team_id + '.svg',
2832
+ 'home',
2833
+ 1
2834
+ )
2835
+ this.imageExists(
2836
+ 'https://golstatsimages.blob.core.windows.net/jersey-teams/' + gameEvent.team_id + '_g.svg',
2837
+ 'home',
2838
+ 0
2839
+ )
2840
+ var NameArrayHome = gameEvent.data[index].player_name.split(',')
2841
+ var lastArrayName = NameArrayHome[0].split(' ')
2842
+ var ArrayName = NameArrayHome[1].trim().split(' ')
2843
+ var lastNameHome = ''
2844
+ if (lastArrayName.length == 2 || lastArrayName.length == 1) {
2845
+ if (lastArrayName[0].length < 4) {
2846
+ lastNameHome = lastArrayName[0] + ' ' + lastArrayName[1]
2847
+ } else {
2848
+ lastNameHome = lastArrayName[0]
2849
+ }
2850
+ } else {
2851
+ if (lastArrayName.length == 3) {
2852
+ lastNameHome = lastArrayName[0] + ' ' + lastArrayName[1]
2853
+ } else {
2854
+ if (lastArrayName.length == 4) {
2855
+ lastNameHome = lastArrayName[1] + ' ' + lastArrayName[2] + ' ' + lastArrayName[3]
2856
+ }
2857
+ }
2858
+ }
2859
+ var nameHome =
2860
+ ArrayName[ArrayName.length - 1] != ''
2861
+ ? ArrayName[ArrayName.length - 1].charAt(0)
2862
+ : ArrayName[ArrayName.length - 2]
2863
+ ? ArrayName[ArrayName.length - 2].charAt(0)
2864
+ : ''
2865
+ lastNameHome = lastNameHome.replace(',', '')
2866
+ var abrevNamePlayerHome = nameHome + '. ' + lastNameHome
2867
+
2868
+ var newCooHome = gameEvent.data[index].x
2869
+ var positionConvertHome = (newCooHome * 50) / 100
2870
+ var indexPlayerDataHome = gameEvent.home_team.players.findIndex(
2871
+ (player) => player.player_id == gameEvent.data[index].player_id
2872
+ )
2873
+ this.playersHome.push({
2874
+ played: true,
2875
+ name: gameEvent.data[index].player_name,
2876
+ position:
2877
+ indexPlayerDataHome != -1
2878
+ ? this.positions[gameEvent.home_team.players[indexPlayerDataHome].position_id - 1]
2879
+ .name
2880
+ : '',
2881
+ position_id: gameEvent.home_team.players[indexPlayerDataHome].position_id,
2882
+ imgPlayer:
2883
+ 'https://golstatsimages.blob.core.windows.net/players-profile/' +
2884
+ gameEvent.data[index].player_id +
2885
+ '.png',
2886
+ nationality:
2887
+ indexPlayerDataHome != -1
2888
+ ? gameEvent.home_team.players[indexPlayerDataHome].nationality
2889
+ ? gameEvent.home_team.players[indexPlayerDataHome].nationality.substring(0, 3)
2890
+ : ''
2891
+ : '',
2892
+ imgNationality:
2893
+ indexPlayerDataHome != -1
2894
+ ? gameEvent.home_team.players[indexPlayerDataHome].nationality_photo
2895
+ : '',
2896
+ substitutionIn: false,
2897
+ substitutionOut: false,
2898
+ abrevNamePlayer: abrevNamePlayerHome,
2899
+ imgTeam: 'https://golstatsimages.blob.core.windows.net/teams-80/' + gameEvent.team_id + '.png',
2900
+ substitutionMin: '',
2901
+ substitutionDataID: '',
2902
+ shirt_number: gameEvent.data[index].jersey_number,
2903
+ positionX: gameEvent.data[index].y - 13,
2904
+ positionY: positionConvertHome * 0.9,
2905
+ positionXOrigin: gameEvent.data[index].y - 17,
2906
+ positionYOrigin: gameEvent.data[index].x - 2,
2907
+ playerId: gameEvent.data[index].player_id,
2908
+ goals: 0,
2909
+ yellowcards: 0,
2910
+ redcards: 0,
2911
+ goalsMin: [],
2912
+ yellowcardsMin: 0,
2913
+ redcardsMin: 0,
2914
+ idyellowcards: 0,
2915
+ idredcards: 0,
2916
+ idsGoals: [],
2917
+ idSubstitution: 0,
2918
+ isbench: false,
2919
+ id_team: gameEvent.team_id
2920
+ })
2921
+ this.homeTeamLogo =
2922
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' + gameEvent.team_id + '.png'
2923
+ }
2924
+
2925
+ this.playersHome.sort((a, b) =>
2926
+ a.position_id > b.position_id ? 1 : b.position_id > a.position_id ? -1 : 0
2927
+ )
2928
+ }
2929
+ } else {
2930
+ if (this.playersAway.length == 0) {
2931
+ this.dataPlayersAway = gameEvent.away_team.players
2932
+ for (let index = 0; index < gameEvent.data.length; index++) {
2933
+ this.away_team_id = gameEvent.team_id
2934
+ this.imageExists(
2935
+ 'https://golstatsimages.blob.core.windows.net/jersey-teams/' + gameEvent.team_id + '.svg',
2936
+ 'away',
2937
+ 1
2938
+ )
2939
+ this.imageExists(
2940
+ 'https://golstatsimages.blob.core.windows.net/jersey-teams/' + gameEvent.team_id + '_g.svg',
2941
+ 'away',
2942
+ 0
2943
+ )
2944
+ var NameArrayAway = gameEvent.data[index].player_name.split(',')
2945
+ var lastArrayNameAway = NameArrayAway[0].split(' ')
2946
+ var ArrayNameAway = NameArrayAway[1].trim().split(' ')
2947
+ var lastNameAway = ''
2948
+ if (lastArrayNameAway.length == 2 || lastArrayNameAway.length == 1) {
2949
+ if (lastArrayNameAway[0].length < 4) {
2950
+ lastNameAway = lastArrayNameAway[0] + ' ' + lastArrayNameAway[1]
2951
+ } else {
2952
+ lastNameAway = lastArrayNameAway[0]
2953
+ }
2954
+ } else {
2955
+ if (lastArrayNameAway.length == 3) {
2956
+ lastNameAway = lastArrayNameAway[0] + ' ' + lastArrayNameAway[1]
2957
+ } else {
2958
+ if (lastArrayNameAway.length == 4) {
2959
+ lastNameAway =
2960
+ lastArrayNameAway[1] + ' ' + lastArrayNameAway[2] + ' ' + lastArrayNameAway[3]
2961
+ }
2962
+ }
2963
+ }
2964
+ var nameAway =
2965
+ ArrayNameAway[ArrayNameAway.length - 1] != ''
2966
+ ? ArrayNameAway[ArrayNameAway.length - 1].charAt(0)
2967
+ : ArrayNameAway[ArrayNameAway.length - 2]
2968
+ ? ArrayNameAway[ArrayNameAway.length - 2].charAt(0)
2969
+ : ''
2970
+ lastNameAway = lastNameAway.replace(',', '')
2971
+ var abrevNamePlayerAway = nameAway + '. ' + lastNameAway
2972
+
2973
+ var newCooAway = gameEvent.data[index].x
2974
+
2975
+ var positionConvertAway = 100 - ((100 - newCooAway) * 50) / 100
2976
+ positionConvertAway = positionConvertAway * 0.9
2977
+ var indexPlayerDataAway = gameEvent.away_team.players.findIndex(
2978
+ (player) => player.player_id == gameEvent.data[index].player_id
2979
+ )
2980
+ this.playersAway.push({
2981
+ played: true,
2982
+ name: gameEvent.data[index].player_name,
2983
+ position:
2984
+ indexPlayerDataAway != -1
2985
+ ? this.positions[gameEvent.away_team.players[indexPlayerDataAway].position_id - 1]
2986
+ .name
2987
+ : '',
2988
+ position_id: gameEvent.away_team.players[indexPlayerDataAway].position_id,
2989
+ imgPlayer:
2990
+ 'https://golstatsimages.blob.core.windows.net/players-profile/' +
2991
+ gameEvent.data[index].player_id +
2992
+ '.png',
2993
+ nationality:
2994
+ indexPlayerDataAway != -1
2995
+ ? gameEvent.away_team.players[indexPlayerDataAway].nationality
2996
+ ? gameEvent.away_team.players[indexPlayerDataAway].nationality.substring(0, 3)
2997
+ : ''
2998
+ : '',
2999
+ imgNationality:
3000
+ indexPlayerDataAway != -1
3001
+ ? gameEvent.away_team.players[indexPlayerDataAway].nationality_photo
3002
+ : '',
3003
+ substitutionIn: false,
3004
+ substitutionOut: false,
3005
+ abrevNamePlayer: abrevNamePlayerAway,
3006
+ imgTeam: 'https://golstatsimages.blob.core.windows.net/teams-80/' + gameEvent.team_id + '.png',
3007
+ substitutionMin: '',
3008
+ substitutionDataID: '',
3009
+ shirt_number: gameEvent.data[index].jersey_number,
3010
+ positionX: gameEvent.data[index].y - 13,
3011
+ positionY: positionConvertAway + 2,
3012
+ positionXOrigin: gameEvent.data[index].y - 17,
3013
+ positionYOrigin: gameEvent.data[index].x - 7,
3014
+ playerId: gameEvent.data[index].player_id,
3015
+ goals: 0,
3016
+ yellowcards: 0,
3017
+ redcards: 0,
3018
+ goalsMin: [],
3019
+ yellowcardsMin: 0,
3020
+ redcardsMin: 0,
3021
+ idyellowcards: 0,
3022
+ idredcards: 0,
3023
+ idsGoals: [],
3024
+ idSubstitution: 0,
3025
+ isbench: false,
3026
+ id_team: gameEvent.team_id
3027
+ })
3028
+ this.awayTeamLogo =
3029
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' + gameEvent.team_id + '.png'
3030
+ }
3031
+ this.playersAway.sort((a, b) =>
3032
+ a.position_id > b.position_id ? 1 : b.position_id > a.position_id ? -1 : 0
3033
+ )
3034
+ }
3035
+ }
3036
+ },
3037
+ update_mxm([channelName, updateGameEvent]) {
3038
+ var indexGoalF = -1
3039
+ var indexGoalP = -1
3040
+ if (this.players.length > 0) {
3041
+ var playIndexHomeRedCard = this.players.findIndex(
3042
+ (player) => player.idredcards == updateGameEvent.play_id
3043
+ )
3044
+ var playIndexHomeYellowCard = this.players.findIndex(
3045
+ (player) => player.idyellowcards == updateGameEvent.play_id
3046
+ )
3047
+ var playIndexHomeSubstitution = this.players.findIndex(
3048
+ (player) => player.idSubstitution == updateGameEvent.play_id
3049
+ )
3050
+ for (let indexH = 0; indexH < this.players.length; indexH++) {
3051
+ var playIndexHomeGoals = this.players[indexH].idsGoals.findIndex(
3052
+ (goalMin) => goalMin == updateGameEvent.play_id
3053
+ )
3054
+ if (playIndexHomeGoals != -1) {
3055
+ indexGoalF = playIndexHomeGoals
3056
+ indexGoalP = indexH
3057
+ }
3058
+ }
3059
+ if (playIndexHomeRedCard != -1) {
3060
+ this.resetPlayUpdate('RedCard', 'Home', playIndexHomeRedCard, indexGoalP)
3061
+ }
3062
+ if (playIndexHomeYellowCard != -1) {
3063
+ this.resetPlayUpdate('YellowCard', 'Home', playIndexHomeYellowCard, indexGoalP)
3064
+ }
3065
+ if (playIndexHomeSubstitution != -1) {
3066
+ this.resetPlayUpdate('Substitution', 'Home', playIndexHomeSubstitution, indexGoalP)
3067
+ }
3068
+ if (indexGoalF != -1) {
3069
+ this.resetPlayUpdate('Goals', 'Home', indexGoalF, indexGoalP)
3070
+ }
3071
+ }
3072
+ if (this.players.length > 0) {
3073
+ var playIndexHAwayRedCard = this.players.findIndex(
3074
+ (player) => player.idredcards == updateGameEvent.play_id
3075
+ )
3076
+ var playIndexAwayYellowCard = this.players.findIndex(
3077
+ (player) => player.idyellowcards == updateGameEvent.play_id
3078
+ )
3079
+ var playIndexAwaySubstitution = this.players.findIndex(
3080
+ (player) => player.idSubstitution == updateGameEvent.play_id
3081
+ )
3082
+ for (let indexA = 0; indexA < this.players.length; indexA++) {
3083
+ var playIndexAwayGoals = this.players[indexA].idsGoals.findIndex(
3084
+ (goalMin) => goalMin == updateGameEvent.play_id
3085
+ )
3086
+ if (playIndexAwayGoals != -1) {
3087
+ indexGoalF = playIndexAwayGoals
3088
+ indexGoalP = indexA
3089
+ }
3090
+ }
3091
+ if (playIndexHAwayRedCard != -1) {
3092
+ this.resetPlayUpdate('RedCard', 'Away', playIndexHAwayRedCard, indexGoalP)
3093
+ }
3094
+ if (playIndexAwayYellowCard != -1) {
3095
+ this.resetPlayUpdate('YellowCard', 'Away', playIndexAwayYellowCard, indexGoalP)
3096
+ }
3097
+ if (playIndexAwaySubstitution != -1) {
3098
+ this.resetPlayUpdate('Substitution', 'Away', playIndexAwaySubstitution, indexGoalP)
3099
+ }
3100
+ if (indexGoalF != -1) {
3101
+ this.resetPlayUpdate('Goals', 'Away', indexGoalF, indexGoalP)
3102
+ }
3103
+ }
3104
+ if (updateGameEvent.event_type_id == 3) {
3105
+ if (updateGameEvent.team_id == this.home_team_id) {
3106
+ if (this.players.length > 0) {
3107
+ var idsPlayers = updateGameEvent.player_id.split('@')
3108
+ var indexChangeHomeOut = this.players.findIndex(
3109
+ (player) => player.playerId == idsPlayers[0]
3110
+ )
3111
+ var indexChangeHomeIn = this.players.findIndex(
3112
+ (player) => player.playerId == idsPlayers[1]
3113
+ )
3114
+ if (indexChangeHomeOut != -1) {
3115
+ this.players[indexChangeHomeOut].idSubstitution = updateGameEvent.play_id
3116
+ this.players[indexChangeHomeOut].substitutionOut = true
3117
+ this.players[indexChangeHomeOut].substitutionMin = updateGameEvent.minute
3118
+ this.players[indexChangeHomeOut].substitutionDataID =
3119
+ updateGameEvent.team_id + '@' + updateGameEvent.player_id
3120
+ }
3121
+ if (indexChangeHomeIn != -1) {
3122
+ this.players[indexChangeHomeIn].idSubstitution = updateGameEvent.play_id
3123
+ this.players[indexChangeHomeIn].substitutionIn = true
3124
+ this.players[indexChangeHomeIn].substitutionMin = updateGameEvent.minute
3125
+ this.players[indexChangeHomeIn].substitutionDataID =
3126
+ updateGameEvent.team_id + '@' + updateGameEvent.player_id
3127
+ }
3128
+ }
3129
+ } else {
3130
+ if (this.players.length > 0) {
3131
+ var idsPlayersAway = updateGameEvent.player_id.split('@')
3132
+ var indexChangeAwayOut = this.players.findIndex(
3133
+ (player) => player.playerId == idsPlayersAway[0]
3134
+ )
3135
+ var indexChangeAwayIn = this.players.findIndex(
3136
+ (player) => player.playerId == idsPlayersAway[1]
3137
+ )
3138
+ if (indexChangeHomeOut != -1) {
3139
+ this.players[indexChangeAwayOut].idSubstitution = updateGameEvent.play_id
3140
+ this.players[indexChangeAwayOut].substitutionOut = true
3141
+ this.players[indexChangeAwayOut].substitutionMin = updateGameEvent.minute
3142
+ this.players[indexChangeAwayOut].substitutionDataID =
3143
+ updateGameEvent.team_id + '@' + updateGameEvent.player_id
3144
+ }
3145
+ if (indexChangeAwayIn != -1) {
3146
+ this.players[indexChangeAwayIn].idSubstitution = updateGameEvent.play_id
3147
+ this.players[indexChangeAwayIn].substitutionIn = true
3148
+ this.players[indexChangeAwayIn].substitutionMin = updateGameEvent.minute
3149
+ this.players[indexChangeAwayIn].substitutionDataID =
3150
+ updateGameEvent.team_id + '@' + updateGameEvent.player_id
3151
+ }
3152
+ }
3153
+ }
3154
+ }
3155
+ if (updateGameEvent.event_type_id == 1) {
3156
+ if (updateGameEvent.team_id == this.home_team_id) {
3157
+ if (this.playersHome.length > 0) {
3158
+ var indexPlayerGoalHome = this.playersHome.findIndex(
3159
+ (player) => player.playerId == updateGameEvent.player_id
3160
+ )
3161
+ if (indexPlayerGoalHome != -1) {
3162
+ this.playersHome[indexPlayerGoalHome].goals += 1
3163
+ this.playersHome[indexPlayerGoalHome].goalsMin.push(updateGameEvent.minute)
3164
+ this.playersHome[indexPlayerGoalHome].idsGoals.push(updateGameEvent.play_id)
3165
+ }
3166
+ }
3167
+ } else {
3168
+ if (this.players.length > 0) {
3169
+ var indexPlayerGoalAway = this.players.findIndex(
3170
+ (player) => player.playerId == updateGameEvent.player_id
3171
+ )
3172
+ if (indexPlayerGoalAway != -1) {
3173
+ this.players[indexPlayerGoalAway].goals += 1
3174
+ this.players[indexPlayerGoalAway].goalsMin.push(updateGameEvent.minute)
3175
+ this.players[indexPlayerGoalAway].idsGoals.push(updateGameEvent.play_id)
3176
+ }
3177
+ }
3178
+ }
3179
+ }
3180
+ if (updateGameEvent.event_type_id == 2) {
3181
+ if (updateGameEvent.category_id == 8) {
3182
+ if (updateGameEvent.team_id == this.home_team_id) {
3183
+ if (this.playersHome.length > 0) {
3184
+ var indexPlayerYellowHome = this.playersHome.findIndex(
3185
+ (player) => player.playerId == updateGameEvent.player_id
3186
+ )
3187
+ if (indexPlayerYellowHome != -1) {
3188
+ this.playersHome[indexPlayerYellowHome].yellowcards += 1
3189
+ this.playersHome[indexPlayerYellowHome].yellowcardsMin = updateGameEvent.minute
3190
+ this.playersHome[indexPlayerYellowHome].idyellowcards = updateGameEvent.play_id
3191
+ }
3192
+ }
3193
+ } else {
3194
+ if (this.players.length > 0) {
3195
+ var indexPlayerYellowAway = this.players.findIndex(
3196
+ (player) => player.playerId == updateGameEvent.player_id
3197
+ )
3198
+ if (indexPlayerYellowAway != -1) {
3199
+ this.players[indexPlayerYellowAway].yellowcards += 1
3200
+ this.players[indexPlayerYellowAway].yellowcardsMin = updateGameEvent.minute
3201
+ this.players[indexPlayerYellowAway].idyellowcards = updateGameEvent.play_id
3202
+ }
3203
+ }
3204
+ }
3205
+ }
3206
+ if (updateGameEvent.category_id == 9) {
3207
+ if (updateGameEvent.team_id == this.home_team_id) {
3208
+ if (this.playersHome.length > 0) {
3209
+ var indexPlayerRedHome = this.playersHome.findIndex(
3210
+ (player) => player.playerId == updateGameEvent.player_id
3211
+ )
3212
+ if (indexPlayerRedHome != -1) {
3213
+ this.playersHome[indexPlayerRedHome].redcards += 1
3214
+ this.playersHome[indexPlayerRedHome].redcardsMin = updateGameEvent.minute
3215
+ this.playersHome[indexPlayerRedHome].idredcards = updateGameEvent.play_id
3216
+ }
3217
+ }
3218
+ } else {
3219
+ if (this.players.length > 0) {
3220
+ var indexPlayerRedAway = this.players.findIndex(
3221
+ (player) => player.playerId == updateGameEvent.player_id
3222
+ )
3223
+ if (indexPlayerRedAway != -1) {
3224
+ this.players[indexPlayerRedAway].redcards += 1
3225
+ this.players[indexPlayerRedAway].redcardsMin = updateGameEvent.minute
3226
+ this.players[indexPlayerRedAway].idredcards = updateGameEvent.play_id
3227
+ }
3228
+ }
3229
+ }
3230
+ }
3231
+ }
3232
+ },
3233
+ delete_mxm([channelName, deleteGameEvent]) {
3234
+ if (this.players.length > 0) {
3235
+ for (let index = 0; index < this.players.length; index++) {
3236
+ if (this.players[index].idSubstitution == deleteGameEvent.play_id) {
3237
+ this.players[index].substitutionOut = false
3238
+ this.players[index].substitutionIn = false
3239
+ this.players[index].substitutionMin = ''
3240
+ this.players[index].substitutionDataID = ''
3241
+ this.players[index].idSubstitution = 0
3242
+ }
3243
+ }
3244
+ }
3245
+ if (this.players.length > 0) {
3246
+ for (let indexAS = 0; indexAS < this.players.length; indexAS++) {
3247
+ if (this.players[indexAS].idSubstitution == deleteGameEvent.play_id) {
3248
+ this.players[indexAS].substitutionOut = false
3249
+ this.players[indexAS].substitutionIn = false
3250
+ this.players[indexAS].substitutionMin = ''
3251
+ this.players[indexAS].substitutionDataID = ''
3252
+ this.players[indexAS].idSubstitution = 0
3253
+ }
3254
+ }
3255
+ }
3256
+ if (this.players.length > 0) {
3257
+ for (let indexGH = 0; indexGH < this.players.length; indexGH++) {
3258
+ const indexGoal = this.players[indexGH].idsGoals.findIndex(
3259
+ (goalMin) => goalMin == deleteGameEvent.play_id
3260
+ )
3261
+ if (indexGoal != -1) {
3262
+ this.players[indexGH].goals = this.players[indexGH].goals - 1
3263
+ this.players[indexGH].goalsMin.splice(indexGoal, 1)
3264
+ this.players[indexGH].idsGoals.splice(indexGoal, 1)
3265
+ }
3266
+ }
3267
+ }
3268
+ if (this.players.length > 0) {
3269
+ for (let indexGA = 0; indexGA < this.players.length; indexGA++) {
3270
+ const indexGoal = this.players[indexGA].idsGoals.findIndex(
3271
+ (goalMin) => goalMin == deleteGameEvent.play_id
3272
+ )
3273
+ if (indexGoal != -1) {
3274
+ this.players[indexGA].goals = this.players[indexGA].goals - 1
3275
+ this.players[indexGA].goalsMin.splice(indexGoal, 1)
3276
+ this.players[indexGA].idsGoals.splice(indexGoal, 1)
3277
+ }
3278
+ }
3279
+ }
3280
+ if (this.players.length > 0) {
3281
+ for (let indexAH = 0; indexAH < this.players.length; indexAH++) {
3282
+ if (this.players[indexAH].idyellowcards == deleteGameEvent.play_id) {
3283
+ this.players[indexAH].yellowcards = 0
3284
+ this.players[indexAH].yellowcardsMin = 0
3285
+ this.players[indexAH].idyellowcards = 0
3286
+ }
3287
+ }
3288
+ }
3289
+ if (this.players.length > 0) {
3290
+ for (let indexAA = 0; indexAA < this.players.length; indexAA++) {
3291
+ if (this.players[indexAA].idyellowcards == deleteGameEvent.play_id) {
3292
+ this.players[indexAA].yellowcards = 0
3293
+ this.players[indexAA].yellowcardsMin = 0
3294
+ this.players[indexAA].idyellowcards = 0
3295
+ }
3296
+ }
3297
+ }
3298
+ if (this.players.length > 0) {
3299
+ for (let indexRH = 0; indexRH < this.players.length; indexRH++) {
3300
+ if (this.players[indexRH].idredcards == deleteGameEvent.play_id) {
3301
+ this.players[indexRH].redcards = 0
3302
+ this.players[indexRH].redcardsMin = 0
3303
+ this.players[indexRH].idredcards = 0
3304
+ }
3305
+ }
3306
+ }
3307
+ if (this.players.length > 0) {
3308
+ for (let indexRA = 0; indexRA < this.players.length; indexRA++) {
3309
+ if (this.players[indexRA].idredcards == deleteGameEvent.play_id) {
3310
+ this.players[indexRA].redcards = 0
3311
+ this.players[indexRA].redcardsMin = 0
3312
+ this.players[indexRA].idredcards = 0
3313
+ }
3314
+ }
3315
+ }
3316
+ },
3317
+ new_mxm([channelName, gameEvent]) {
3318
+ if (gameEvent.event_type_id == 3) {
3319
+ if (gameEvent.team_id == this.home_team_id) {
3320
+ if (this.players.length > 0) {
3321
+ var idsPlayers = gameEvent.player_id.split('@')
3322
+ var indexChangeHomeOut = this.players.findIndex(
3323
+ (player) => player.playerId == idsPlayers[0]
3324
+ )
3325
+ var indexChangeHomeIn = this.players.findIndex(
3326
+ (player) => player.playerId == idsPlayers[1]
3327
+ )
3328
+ if (indexChangeHomeOut != -1) {
3329
+ this.players[indexChangeHomeOut].idSubstitution = gameEvent.play_id
3330
+ this.players[indexChangeHomeOut].substitutionOut = true
3331
+ this.players[indexChangeHomeOut].substitutionMin = gameEvent.minute
3332
+ this.players[indexChangeHomeOut].substitutionDataID =
3333
+ gameEvent.team_id + '@' + gameEvent.player_id
3334
+ }
3335
+ if (indexChangeHomeIn != -1) {
3336
+ this.players[indexChangeHomeIn].idSubstitution = gameEvent.play_id
3337
+ this.players[indexChangeHomeIn].substitutionIn = true
3338
+ this.players[indexChangeHomeIn].substitutionMin = gameEvent.minute
3339
+ this.players[indexChangeHomeIn].substitutionDataID =
3340
+ gameEvent.team_id + '@' + gameEvent.player_id
3341
+ }
3342
+ }
3343
+ } else {
3344
+ if (this.players.length > 0) {
3345
+ var idsPlayersAway = gameEvent.player_id.split('@')
3346
+ var indexChangeAwayOut = this.players.findIndex(
3347
+ (player) => player.playerId == idsPlayersAway[0]
3348
+ )
3349
+ var indexChangeAwayIn = this.players.findIndex(
3350
+ (player) => player.playerId == idsPlayersAway[1]
3351
+ )
3352
+ if (indexChangeHomeOut != -1) {
3353
+ this.players[indexChangeAwayOut].idSubstitution = gameEvent.play_id
3354
+ this.players[indexChangeAwayOut].substitutionOut = true
3355
+ this.players[indexChangeAwayOut].substitutionMin = gameEvent.minute
3356
+ this.players[indexChangeAwayOut].substitutionDataID =
3357
+ gameEvent.team_id + '@' + gameEvent.player_id
3358
+ }
3359
+ if (indexChangeAwayIn != -1) {
3360
+ this.players[indexChangeAwayIn].idSubstitution = gameEvent.play_id
3361
+ this.players[indexChangeAwayIn].substitutionIn = true
3362
+ this.players[indexChangeAwayIn].substitutionMin = gameEvent.minute
3363
+ this.players[indexChangeAwayIn].substitutionDataID =
3364
+ gameEvent.team_id + '@' + gameEvent.player_id
3365
+ }
3366
+ }
3367
+ }
3368
+ }
3369
+ if (gameEvent.event_type_id == 1) {
3370
+ if (gameEvent.team_id == this.home_team_id) {
3371
+ if (this.players.length > 0) {
3372
+ var indexPlayerGoalHome = this.players.findIndex(
3373
+ (player) => player.playerId == gameEvent.player_id
3374
+ )
3375
+ if (indexPlayerGoalHome != -1) {
3376
+ this.players[indexPlayerGoalHome].goals += 1
3377
+ this.players[indexPlayerGoalHome].goalsMin.push(gameEvent.minute)
3378
+ this.players[indexPlayerGoalHome].idsGoals.push(gameEvent.play_id)
3379
+ }
3380
+ }
3381
+ } else {
3382
+ if (this.players.length > 0) {
3383
+ var indexPlayerGoalAway = this.players.findIndex(
3384
+ (player) => player.playerId == gameEvent.player_id
3385
+ )
3386
+ if (indexPlayerGoalAway != -1) {
3387
+ this.players[indexPlayerGoalAway].goals += 1
3388
+ this.players[indexPlayerGoalAway].goalsMin.push(gameEvent.minute)
3389
+ this.players[indexPlayerGoalAway].idsGoals.push(gameEvent.play_id)
3390
+ }
3391
+ }
3392
+ }
3393
+ }
3394
+ if (gameEvent.event_type_id == 2) {
3395
+ if (gameEvent.category_id == 8) {
3396
+ if (gameEvent.team_id == this.home_team_id) {
3397
+ if (this.players.length > 0) {
3398
+ var indexPlayerYellowHome = this.players.findIndex(
3399
+ (player) => player.playerId == gameEvent.player_id
3400
+ )
3401
+ if (indexPlayerYellowHome != -1) {
3402
+ this.players[indexPlayerYellowHome].yellowcards += 1
3403
+ this.players[indexPlayerYellowHome].yellowcardsMin = gameEvent.minute
3404
+ this.players[indexPlayerYellowHome].idyellowcards = gameEvent.play_id
3405
+ }
3406
+ }
3407
+ } else {
3408
+ if (this.players.length > 0) {
3409
+ var indexPlayerYellowAway = this.players.findIndex(
3410
+ (player) => player.playerId == gameEvent.player_id
3411
+ )
3412
+ if (indexPlayerYellowAway != -1) {
3413
+ this.players[indexPlayerYellowAway].yellowcards += 1
3414
+ this.players[indexPlayerYellowAway].yellowcardsMin = gameEvent.minute
3415
+ this.players[indexPlayerYellowAway].idyellowcards = gameEvent.play_id
3416
+ }
3417
+ }
3418
+ }
3419
+ }
3420
+ if (gameEvent.category_id == 9) {
3421
+ if (gameEvent.team_id == this.home_team_id) {
3422
+ if (this.players.length > 0) {
3423
+ var indexPlayerRedHome = this.players.findIndex(
3424
+ (player) => player.playerId == gameEvent.player_id
3425
+ )
3426
+ if (indexPlayerRedHome != -1) {
3427
+ this.players[indexPlayerRedHome].redcards += 1
3428
+ this.players[indexPlayerRedHome].redcardsMin = gameEvent.minute
3429
+ this.players[indexPlayerRedHome].idredcards = gameEvent.play_id
3430
+ }
3431
+ }
3432
+ } else {
3433
+ if (this.players.length > 0) {
3434
+ var indexPlayerRedAway = this.players.findIndex(
3435
+ (player) => player.playerId == gameEvent.player_id
3436
+ )
3437
+ if (indexPlayerRedAway != -1) {
3438
+ this.players[indexPlayerRedAway].redcards += 1
3439
+ this.players[indexPlayerRedAway].redcardsMin = gameEvent.minute
3440
+ this.players[indexPlayerRedAway].idredcards = gameEvent.play_id
3441
+ }
3442
+ }
3443
+ }
3444
+ }
3445
+ }
3446
+ }
3447
+ }
3448
+ }
3449
+ </script>
3450
+
3451
+ <style lang="scss" scoped>
3452
+ .containernofoundsearchrecientes {
3453
+ width: 100%;
3454
+ height: 38px;
3455
+ display: inline-block;
3456
+ margin: 0 auto;
3457
+ }
3458
+ .text-containernofoundsearchrecientes {
3459
+ font-size: 13px;
3460
+ text-align: center;
3461
+ color: rgb(176, 176, 176);
3462
+ line-height: 16px;
3463
+ }
3464
+ .btn-delete-filters {
3465
+ width: 70%;
3466
+ height: 26px;
3467
+ border-radius: 16px;
3468
+ font-size: 14px;
3469
+ text-align: center;
3470
+ background: rgba($color: #ffffff, $alpha: 0.2);
3471
+ color: white;
3472
+ margin: 0 auto;
3473
+ line-height: 26px;
3474
+ margin-top: 5px;
3475
+ }
3476
+ .btn-delete-filters:hover {
3477
+ cursor: pointer;
3478
+ background: rgba($color: #ffffff, $alpha: 0.5);
3479
+ }
3480
+ .selectoritem {
3481
+ width: 300px;
3482
+ color: rgba(255, 255, 255, 0.7);
3483
+ text-align: center;
3484
+ font-family: 'Poppins-Regular';
3485
+ font-size: 14px;
3486
+ }
3487
+
3488
+ .postmatch__matchday {
3489
+ width: 100%;
3490
+ text-align: center;
3491
+ font-family: Poppins-Regular;
3492
+ font-size: 13px;
3493
+ font-stretch: normal;
3494
+ font-style: normal;
3495
+ line-height: 1.43;
3496
+ letter-spacing: -0.14px;
3497
+ text-align: center;
3498
+ color: rgba(255, 255, 255, 0.7);
3499
+ padding: 0;
3500
+ margin: 0;
3501
+ }
3502
+ .lineup {
3503
+ width: 100%;
3504
+ font-family: Poppins, sans-serif;
3505
+
3506
+ &.break-point-3 &__card {
3507
+ padding: 23px 11px;
3508
+ }
3509
+
3510
+ &.break-point-3 &__card-body {
3511
+ margin: 0 auto 20px;
3512
+ }
3513
+
3514
+ &__header {
3515
+ display: flex;
3516
+ align-items: flex-start;
3517
+ justify-content: space-between;
3518
+ margin-bottom: 11px;
3519
+ gap: 10px;
3520
+ flex-wrap: wrap;
3521
+ @media only screen and (max-width: 500px) {
3522
+ justify-content: center;
3523
+ gap: 3px;
3524
+ }
3525
+
3526
+ h2 {
3527
+ margin: 0;
3528
+ color: #fff;
3529
+ font-family: Poppins, sans-serif;
3530
+ font-size: 18px;
3531
+ font-weight: 500;
3532
+ @media only screen and (max-width: 500px) {
3533
+ width: 100%;
3534
+ }
3535
+ }
3536
+ }
3537
+
3538
+ &__card {
3539
+ padding: 17px 32px 24px;
3540
+ border-radius: 12px;
3541
+ background-color: #1d2a35;
3542
+ filter: drop-shadow(0px 3.860927104949951px 19.304636001586914px rgba(0, 0, 0, 0.25));
3543
+ @media screen and (max-width: 500px) {
3544
+ padding: 17px 12px 24px;
3545
+ }
3546
+
3547
+ h3 {
3548
+ color: rgba(255, 255, 255, 0.7);
3549
+ text-align: center;
3550
+ font-family: Poppins, sans-serif;
3551
+ font-size: 12px;
3552
+ font-weight: 500;
3553
+ line-height: normal;
3554
+ margin: 0 auto 8px;
3555
+ max-width: 300px;
3556
+ }
3557
+
3558
+ &-header {
3559
+ display: flex;
3560
+ align-items: center;
3561
+ justify-content: space-between;
3562
+ margin-bottom: 16px;
3563
+ }
3564
+ }
3565
+
3566
+ &__filters {
3567
+ display: grid;
3568
+ grid-template-columns: 1fr 1fr 1fr;
3569
+ align-items: center;
3570
+
3571
+ &__selector {
3572
+ margin: auto;
3573
+ max-width: 183px;
3574
+ @media screen and (max-width: 500px) {
3575
+ max-width: 99px;
3576
+ }
3577
+ }
3578
+ }
3579
+
3580
+ &__card-body {
3581
+ margin: 0 auto 20px;
3582
+ display: flex;
3583
+ justify-content: center;
3584
+ position: relative;
3585
+ &.space-between {
3586
+ justify-content: space-between;
3587
+ }
3588
+
3589
+ &__probables {
3590
+ display: flex;
3591
+ justify-content: space-between;
3592
+ font-size: 10px;
3593
+ gap: 8px;
3594
+ align-items: center;
3595
+ }
3596
+
3597
+ &__img-probables {
3598
+ width: 18px;
3599
+ height: 18px;
3600
+ visibility: hidden;
3601
+ width: 0;
3602
+ @media screen and (max-width: 500px) {
3603
+ visibility: visible;
3604
+ width: auto;
3605
+ }
3606
+ }
3607
+
3608
+ &__team-vs {
3609
+ color: rgba(255, 255, 255, 0.7);
3610
+ font-size: 12px;
3611
+ visibility: hidden;
3612
+ width: 0;
3613
+ @media screen and (max-width: 500px) {
3614
+ visibility: visible;
3615
+ width: auto;
3616
+ }
3617
+ }
3618
+ }
3619
+
3620
+ &__items-carousel {
3621
+ display: flex;
3622
+ justify-content: center;
3623
+ align-items: start;
3624
+ margin-top: 20px;
3625
+ }
3626
+
3627
+ &__items-center {
3628
+ }
3629
+
3630
+ &__text-btn {
3631
+ outline: none;
3632
+ background: transparent;
3633
+ color: rgba(255, 255, 255, 0.7);
3634
+ text-align: center;
3635
+ font-family: Poppins, sans-serif;
3636
+ font-size: 13px;
3637
+ font-style: normal;
3638
+ font-weight: normal;
3639
+ line-height: 100%;
3640
+ /* 14.4px */
3641
+ letter-spacing: 0px;
3642
+ text-decoration-line: underline;
3643
+ cursor: pointer;
3644
+ border: none;
3645
+ justify-self: flex-end;
3646
+ @media only screen and (max-width: 500px) {
3647
+ font-size: 11px;
3648
+ }
3649
+ &:hover {
3650
+ color: rgba(255, 255, 255, 1);
3651
+ }
3652
+ }
3653
+ &__text-btn-recientes {
3654
+ outline: none;
3655
+ background: transparent;
3656
+ color: rgba(255, 255, 255, 0.7);
3657
+ text-align: center;
3658
+ font-family: Poppins, sans-serif;
3659
+ font-size: 13px;
3660
+ font-style: normal;
3661
+ font-weight: normal;
3662
+ line-height: 100%;
3663
+ right: 0px;
3664
+ /* 14.4px */
3665
+ letter-spacing: 0px;
3666
+ text-decoration-line: underline;
3667
+ cursor: pointer;
3668
+ border: none;
3669
+ justify-self: flex-end;
3670
+ @media only screen and (max-width: 500px) {
3671
+ font-size: 11px;
3672
+ margin-top: -20px;
3673
+ }
3674
+ @media only screen and (max-width: 380px) {
3675
+ font-size: 10px;
3676
+ margin-top: -40px;
3677
+ }
3678
+ &:hover {
3679
+ color: rgba(255, 255, 255, 1);
3680
+ }
3681
+ }
3682
+ &__text-btn-abs {
3683
+ outline: none;
3684
+ position: absolute;
3685
+ background: transparent;
3686
+ color: rgba(255, 255, 255, 0.7);
3687
+ text-align: center;
3688
+ font-family: Poppins, sans-serif;
3689
+ font-size: 13px;
3690
+ font-style: normal;
3691
+ font-weight: normal;
3692
+ line-height: 100%;
3693
+ right: 0px;
3694
+ /* 14.4px */
3695
+ letter-spacing: 0px;
3696
+ text-decoration-line: underline;
3697
+ cursor: pointer;
3698
+ border: none;
3699
+ justify-self: flex-end;
3700
+ @media only screen and (max-width: 500px) {
3701
+ font-size: 11px;
3702
+ }
3703
+ &:hover {
3704
+ color: rgba(255, 255, 255, 1);
3705
+ }
3706
+ }
3707
+
3708
+ &__selector-recientes {
3709
+ min-width: 310px;
3710
+ max-width: 310px;
3711
+ width: 100%;
3712
+
3713
+ &-item {
3714
+ width: 100%;
3715
+ color: rgba(255, 255, 255, 0.7);
3716
+ text-align: center;
3717
+ font-family: Poppins, sans-serif;
3718
+ font-size: 14px;
3719
+ font-weight: 500;
3720
+ line-height: 143.322%;
3721
+ letter-spacing: -0.14px;
3722
+ }
3723
+ }
3724
+ &__selector {
3725
+ max-width: 390px;
3726
+ margin: auto;
3727
+ @media screen and (max-width: 530px) {
3728
+ max-width: 300px;
3729
+ margin-top: 10px !important;
3730
+ }
3731
+
3732
+ &-item {
3733
+ width: 100%;
3734
+ color: rgba(255, 255, 255, 0.7);
3735
+ text-align: center;
3736
+ font-family: Poppins, sans-serif;
3737
+ font-size: 14px;
3738
+ font-weight: 500;
3739
+ line-height: 143.322%;
3740
+ letter-spacing: -0.14px;
3741
+ @media screen and (max-width: 530px) {
3742
+ font-size: 11px;
3743
+ }
3744
+ }
3745
+ }
3746
+
3747
+ &__field {
3748
+ width: 100%;
3749
+ height: auto;
3750
+ }
3751
+ }
3752
+ </style>