@golstats/gsc-top-player 1.0.0

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 (154) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +137 -0
  3. package/dist/FilterConditions-55d68355-Dpbg-_AB.js +191 -0
  4. package/dist/FilterField-59a73e38-j9kmr0oF.js +21 -0
  5. package/dist/FilterSubcategories-a9b32cc9-DwhgmIwf.js +42 -0
  6. package/dist/atajada.svg +57 -0
  7. package/dist/backarrow.svg +3 -0
  8. package/dist/cancha-3d.png +0 -0
  9. package/dist/contorno-escudo.svg +3 -0
  10. package/dist/css/fonts.css +91 -0
  11. package/dist/favicon.ico +0 -0
  12. package/dist/field-green-posesion.png +0 -0
  13. package/dist/fin-del-partido.svg +44 -0
  14. package/dist/fonts/BebasNeue-Bold.otf +0 -0
  15. package/dist/fonts/BebasNeue-Bold.ttf +0 -0
  16. package/dist/fonts/BebasNeue-Bold.woff2 +0 -0
  17. package/dist/fonts/BebasNeue-Book.otf +0 -0
  18. package/dist/fonts/BebasNeue-Book.ttf +0 -0
  19. package/dist/fonts/BebasNeue-Book.woff2 +0 -0
  20. package/dist/fonts/BebasNeue-Light.otf +0 -0
  21. package/dist/fonts/BebasNeue-Light.ttf +0 -0
  22. package/dist/fonts/BebasNeue-Light.woff2 +0 -0
  23. package/dist/fonts/BebasNeue-Regular.otf +0 -0
  24. package/dist/fonts/BebasNeue-Regular.ttf +0 -0
  25. package/dist/fonts/BebasNeue-Regular.woff2 +0 -0
  26. package/dist/fonts/BebasNeue-Thin.otf +0 -0
  27. package/dist/fonts/BebasNeue-Thin.ttf +0 -0
  28. package/dist/fonts/BebasNeue-Thin.woff2 +0 -0
  29. package/dist/fonts/Montserrat-Black.otf +0 -0
  30. package/dist/fonts/Montserrat-BlackItalic.otf +0 -0
  31. package/dist/fonts/Montserrat-Bold.otf +0 -0
  32. package/dist/fonts/Montserrat-BoldItalic.otf +0 -0
  33. package/dist/fonts/Montserrat-ExtraBold.otf +0 -0
  34. package/dist/fonts/Montserrat-ExtraBoldItalic.otf +0 -0
  35. package/dist/fonts/Montserrat-ExtraLight.otf +0 -0
  36. package/dist/fonts/Montserrat-ExtraLightItalic.otf +0 -0
  37. package/dist/fonts/Montserrat-Italic.otf +0 -0
  38. package/dist/fonts/Montserrat-Light.otf +0 -0
  39. package/dist/fonts/Montserrat-LightItalic.otf +0 -0
  40. package/dist/fonts/Montserrat-Medium.otf +0 -0
  41. package/dist/fonts/Montserrat-MediumItalic.otf +0 -0
  42. package/dist/fonts/Montserrat-Regular.otf +0 -0
  43. package/dist/fonts/Montserrat-SemiBold.otf +0 -0
  44. package/dist/fonts/Montserrat-SemiBoldItalic.otf +0 -0
  45. package/dist/fonts/Montserrat-Thin.otf +0 -0
  46. package/dist/fonts/Montserrat-ThinItalic.otf +0 -0
  47. package/dist/fonts/Oswald-Bold.ttf +0 -0
  48. package/dist/fonts/Oswald-ExtraLight.ttf +0 -0
  49. package/dist/fonts/Oswald-Light.ttf +0 -0
  50. package/dist/fonts/Oswald-Medium.ttf +0 -0
  51. package/dist/fonts/Oswald-Regular.ttf +0 -0
  52. package/dist/fonts/Oswald-SemiBold.ttf +0 -0
  53. package/dist/fonts/Poppins-Black.otf +0 -0
  54. package/dist/fonts/Poppins-BlackItalic.otf +0 -0
  55. package/dist/fonts/Poppins-Bold.otf +0 -0
  56. package/dist/fonts/Poppins-BoldItalic.otf +0 -0
  57. package/dist/fonts/Poppins-ExtraBold.otf +0 -0
  58. package/dist/fonts/Poppins-ExtraBoldItalic.otf +0 -0
  59. package/dist/fonts/Poppins-ExtraLight.otf +0 -0
  60. package/dist/fonts/Poppins-ExtraLightItalic.otf +0 -0
  61. package/dist/fonts/Poppins-Italic.otf +0 -0
  62. package/dist/fonts/Poppins-Light.otf +0 -0
  63. package/dist/fonts/Poppins-LightItalic.otf +0 -0
  64. package/dist/fonts/Poppins-Medium.otf +0 -0
  65. package/dist/fonts/Poppins-MediumItalic.otf +0 -0
  66. package/dist/fonts/Poppins-Regular.otf +0 -0
  67. package/dist/fonts/Poppins-SemiBold.otf +0 -0
  68. package/dist/fonts/Poppins-SemiBoldItalic.otf +0 -0
  69. package/dist/fonts/Poppins-Thin.otf +0 -0
  70. package/dist/fonts/Poppins-ThinItalic.otf +0 -0
  71. package/dist/fuera-de-lugar.svg +58 -0
  72. package/dist/gol.svg +49 -0
  73. package/dist/group-427321178.svg +8 -0
  74. package/dist/group-427321179.svg +5 -0
  75. package/dist/group-427321501.svg +5 -0
  76. package/dist/gsc-top-player.css +1 -0
  77. package/dist/gsc-top-player.es.js +4 -0
  78. package/dist/gsc-top-player.umd.js +15 -0
  79. package/dist/icn-arrow-expand.svg +3 -0
  80. package/dist/icn-cambio.svg +27 -0
  81. package/dist/icn-expand-arrow.svg +3 -0
  82. package/dist/icn-expand-arrow1.svg +3 -0
  83. package/dist/icn-falta.svg +43 -0
  84. package/dist/icn-filter.svg +12 -0
  85. package/dist/icn-filter1.svg +12 -0
  86. package/dist/icn-filter2.svg +12 -0
  87. package/dist/icn-golstats.png +0 -0
  88. package/dist/icn-play.svg +10 -0
  89. package/dist/icn-tarjeta-amarilla.svg +4 -0
  90. package/dist/icn-tarjeta-roja.svg +4 -0
  91. package/dist/icn-tiro-a-porteria.svg +36 -0
  92. package/dist/icn-tiros-de-esquina.svg +55 -0
  93. package/dist/index-oO1T2oQg.js +12265 -0
  94. package/dist/inicia-el-partido.svg +46 -0
  95. package/dist/jugada-peligrosa.svg +91 -0
  96. package/dist/line-white.png +0 -0
  97. package/dist/line.png +0 -0
  98. package/dist/next-arrow.svg +3 -0
  99. package/dist/nextarrow.svg +3 -0
  100. package/dist/penal-fallado.svg +195 -0
  101. package/dist/penal-marcado.svg +190 -0
  102. package/dist/play-icn.svg +3 -0
  103. package/dist/public/images/cancha-horizontal-raw.jpg +0 -0
  104. package/dist/public/images/cancha-horizontal.jpg +0 -0
  105. package/dist/public/images/canchaRPH.svg +30 -0
  106. package/dist/public/images/events/atajada.svg +57 -0
  107. package/dist/public/images/events/cambio.svg +27 -0
  108. package/dist/public/images/events/falta.svg +43 -0
  109. package/dist/public/images/events/favicon.ico +0 -0
  110. package/dist/public/images/events/fin-del-partido.svg +44 -0
  111. package/dist/public/images/events/fuera-de-lugar.svg +58 -0
  112. package/dist/public/images/events/generic.svg +1 -0
  113. package/dist/public/images/events/gol.svg +49 -0
  114. package/dist/public/images/events/icn-cambio.svg +6 -0
  115. package/dist/public/images/events/icn-falta.svg +4 -0
  116. package/dist/public/images/events/icn-play.svg +3 -0
  117. package/dist/public/images/events/icn-tarjeta-amarilla.svg +4 -0
  118. package/dist/public/images/events/icn-tarjeta-roja.svg +4 -0
  119. package/dist/public/images/events/icn-tiro-a-porteria.svg +36 -0
  120. package/dist/public/images/events/icn-tiros-de-esquina.svg +18 -0
  121. package/dist/public/images/events/inicia-el-partido.svg +46 -0
  122. package/dist/public/images/events/jugada-peligrosa.svg +91 -0
  123. package/dist/public/images/events/penal-fallado.svg +195 -0
  124. package/dist/public/images/events/penal-marcado.svg +190 -0
  125. package/dist/public/images/events/tiempo-agregado.svg +75 -0
  126. package/dist/public/images/events/tiro-a-porteria.svg +81 -0
  127. package/dist/public/images/events/tiro-de-esquina.svg +55 -0
  128. package/dist/public/images/events/var.png +0 -0
  129. package/dist/public/images/events/var.svg +31 -0
  130. package/dist/shape.svg +3 -0
  131. package/dist/styles.css +1191 -0
  132. package/dist/tiempo-agregado.svg +75 -0
  133. package/dist/tiro-a-porteria.svg +81 -0
  134. package/dist/var.png +0 -0
  135. package/dist/var.svg +31 -0
  136. package/package.json +69 -0
  137. package/src/App.vue +40 -0
  138. package/src/components/comparative/categories.js +137 -0
  139. package/src/components/comparative/composable-filters.js +10 -0
  140. package/src/components/comparative/computedProperties.js +327 -0
  141. package/src/components/comparative/filtersTypes.js +117 -0
  142. package/src/components/comparative/gsc-button.vue +209 -0
  143. package/src/components/comparative/gsc-expanded-info-player.vue +710 -0
  144. package/src/components/comparative/gsc-head-titles.vue +1482 -0
  145. package/src/components/comparative/gsc-header-tops.vue +1192 -0
  146. package/src/components/comparative/gsc-row.vue +1810 -0
  147. package/src/components/comparative/gsc-top.vue +1517 -0
  148. package/src/components/comparative/gsc-tops-full.vue +2463 -0
  149. package/src/components/comparative/nationalities-catalog.js +233 -0
  150. package/src/components/comparative/playsTypes.js +142 -0
  151. package/src/components/comparative/useElementSize.js +23 -0
  152. package/src/components/gsc-top-player.vue +69 -0
  153. package/src/index.js +5 -0
  154. package/src/main.js +4 -0
@@ -0,0 +1,1517 @@
1
+ <template>
2
+ <div :class="type == 0 ? 'gsc-top' : 'gsc-top-full'">
3
+ <div ref="myDivRef">
4
+ <template v-if="type == 0">
5
+ <template v-if="topData.length > 0">
6
+ <GSCCarousel
7
+ :items="topData"
8
+ :is-pagination-visible="carrousel"
9
+ :are-navigation-arrows-visible="carrousel"
10
+ @input="changeCarrousel"
11
+ >
12
+ <template #default="{ item: page }">
13
+ <div class="row-table-carrousel">
14
+ <template v-for="(player, index) in page" :key="index">
15
+ <template v-if="player.top == 1">
16
+ <GSCLeaders
17
+ @mediadata="emitEventMedia($event, category, categoryName)"
18
+ :type="typeTable"
19
+ :type-data="typeData"
20
+ :game="game"
21
+ :arrow="arrow"
22
+ :team-widget="teamWidget"
23
+ :can-play-videos="canPlayVideos"
24
+ :is-expanded="playerexpand == player.id && expand"
25
+ ref="GSCLeaders"
26
+ :data="
27
+ typeTable == 0
28
+ ? {
29
+ top: '01',
30
+ photo: player.img,
31
+ logo:
32
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' +
33
+ player.teamid +
34
+ '.png',
35
+ name: player.name,
36
+ player_short: player.name_short,
37
+ player_id: player.id,
38
+ categoryId: category,
39
+ total: player.total,
40
+ }
41
+ : {
42
+ top: '01',
43
+ logo: player.img,
44
+ total: player.total,
45
+ name_team: player.name,
46
+ player_id: player.id,
47
+ }
48
+ "
49
+ :category-name="categoryName"
50
+ :buttonMaxWidth="
51
+ typeTable != 0
52
+ ? elementSize.width > 360
53
+ ? '210px'
54
+ : '130px'
55
+ : elementSize.width > 360
56
+ ? '180px'
57
+ : '110px'
58
+ "
59
+ buttonFontSize="12px"
60
+ iconSize="11px"
61
+ @expand="clickexpand"
62
+ @more="morestats"
63
+ />
64
+ </template>
65
+ <template v-else>
66
+ <GSCRowTable
67
+ :type-data="typeData"
68
+ :team-widget="teamWidget"
69
+ :game="game"
70
+ :type="typeTable"
71
+ :type-view="type"
72
+ :arrow="arrow"
73
+ :is-expanded="playerexpand == player.id && expand"
74
+ @mediadata="emitEventMedia($event, category, categoryName)"
75
+ :data="
76
+ typeTable == 0
77
+ ? {
78
+ position: player.top,
79
+ player_name: player.name,
80
+ player_short: player.name_short,
81
+ player_photo: player.img,
82
+ total: player.total,
83
+ id: player.id,
84
+ player_age: player.age,
85
+ team_abrev: player.team,
86
+ team_logo:
87
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' +
88
+ player.teamid +
89
+ '.png',
90
+ player_position: player.position,
91
+ player_country_flag:
92
+ 'https://golstatsimages.blob.core.windows.net/flags/' +
93
+ player.country +
94
+ '.jpg',
95
+ player_games: player.minutes,
96
+ player_min: player.games,
97
+ league_name:
98
+ '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Liga MX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
99
+ }
100
+ : {
101
+ position: player.top,
102
+ team_logo: player.img,
103
+ team_abrev: player.name,
104
+ frequency: player.frecuency,
105
+ promthistournament: player.game_avg,
106
+ promlasttournament: player.game_avg_last_season,
107
+ teams_games: '-',
108
+ category: category,
109
+ total: player.total,
110
+ id: player.id,
111
+ }
112
+ "
113
+ height="71px"
114
+ :can-play-videos="canPlayVideos"
115
+ :background="index % 2 === 0 ? backgroundEven : backgroundOdd"
116
+ @expand="clickexpand"
117
+ />
118
+ </template>
119
+ <template v-if="expand && playerexpand == player.id">
120
+ <GSCExpandedInfo
121
+ :type="typeTable"
122
+ :is-live="game.is_live"
123
+ :view-effectiveness="player.positionId === 1 ? false : true"
124
+ :data="
125
+ typeTable == 0
126
+ ? {
127
+ teams: player.teamname,
128
+ age: player.age,
129
+ dataofbirth: player.date,
130
+ nationality: player.nationality,
131
+ countryFlag: player.player_country_flag,
132
+ position: player.position,
133
+ games: player.games,
134
+ min: player.minutes,
135
+ goals: player.total,
136
+ effectiveness: player.effectiveness,
137
+ category: categoryName,
138
+ id: player.id,
139
+ }
140
+ : {
141
+ position: player.positiontable,
142
+ goals: player.goals,
143
+ goals_received: player.goalsrecived,
144
+ games_played: player.games_played,
145
+ category: categoryName,
146
+ effectiveness: player.effectiveness,
147
+ xg: player.xg,
148
+ total: player.total,
149
+ attendance: '-',
150
+ id: player.id,
151
+ }
152
+ "
153
+ @viewprofile="viewprofile($event, player.teamid)"
154
+ :background="index % 2 === 0 ? backgroundEven : backgroundOdd"
155
+ />
156
+ </template>
157
+ </template>
158
+ </div>
159
+ </template>
160
+ </GSCCarousel>
161
+ </template>
162
+ <template v-else>
163
+ <div class="container-no-search-result">
164
+ <template v-if="isloading">
165
+ <div class="overlay-loading-top">
166
+ <div class="overlay-loading-top__spinner">
167
+ <img
168
+ src="https://golstatsimages.blob.core.windows.net/images-library/balon_liga.png"
169
+ alt=""
170
+ />
171
+ </div>
172
+ <div class="overlay-loading-top__text">Loading...</div>
173
+ </div>
174
+ </template>
175
+ <template v-else>
176
+ <div class="container-no-search-result-title">No existen resultados</div>
177
+ <div class="container-no-search-result-subtitle">
178
+ No existen resultados para este tipo de<br />
179
+ jugada, considerando el torneo y otros<br />
180
+ filtros que has seleccionado.
181
+ </div>
182
+ </template>
183
+ </div>
184
+ </template>
185
+ </template>
186
+ <template v-else>
187
+ <GSCTableHeader background="#183143" :type="typeTable" />
188
+ <template v-for="(page, index2) in topData" :key="index2">
189
+ <template v-for="(player, index) in page" :key="index">
190
+ <GSCRowTable
191
+ :type-data="typeData"
192
+ :team-widget="teamWidget"
193
+ :game="game"
194
+ :arrow="arrow"
195
+ :type="typeTable"
196
+ :type-view="type"
197
+ :can-play-videos="canPlayVideos"
198
+ :is-expanded="playerexpand == player.id && expand"
199
+ @mediadata="emitEventMediaFullTable($event, category, categoryName)"
200
+ :data="
201
+ typeTable == 0
202
+ ? {
203
+ position: player.top,
204
+ player_name: player.name,
205
+ player_short: player.name_short,
206
+ player_photo: player.img,
207
+ total: player.total,
208
+ id: player.id,
209
+ player_age: player.age,
210
+ team_abrev: player.team,
211
+ team_logo:
212
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' +
213
+ player.teamid +
214
+ '.png',
215
+ player_position: player.position,
216
+ player_country_flag:
217
+ 'https://golstatsimages.blob.core.windows.net/flags/' +
218
+ player.country +
219
+ '.jpg',
220
+ player_games: player.games,
221
+ player_min: player.minutes,
222
+ league_name:
223
+ '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Liga MX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
224
+ }
225
+ : {
226
+ position: player.positiontable,
227
+ team_logo: player.img,
228
+ team_abrev: player.name,
229
+ frequency: player.frecuency,
230
+ promthistournament: player.game_avg,
231
+ promlasttournament: player.game_avg_last_season,
232
+ category: category,
233
+ team_games: player.games_played,
234
+ total: player.total,
235
+ id: player.id,
236
+ }
237
+ "
238
+ height="71px"
239
+ :background="((index2 + 1) * 5 + index) % 2 === 0 ? backgroundOdd : backgroundEven"
240
+ @expand="clickexpand"
241
+ />
242
+ <template v-if="expand && playerexpand == player.id">
243
+ <GSCExpandedInfo
244
+ :type="typeTable"
245
+ :is-live="game.is_live"
246
+ :additionalClass="'fullTable'"
247
+ :view-effectiveness="player.positionId === 1 ? false : true"
248
+ :data="
249
+ typeTable == 0
250
+ ? {
251
+ teams: player.teamname,
252
+ age: player.age,
253
+ dataofbirth: player.date,
254
+ nationality: player.nationality,
255
+ countryFlag: player.player_country_flag,
256
+ position: player.positionfull,
257
+ positionfull: player.positionfull,
258
+ games: player.games,
259
+ min: player.minutes,
260
+ goals: player.total,
261
+ effectiveness: player.effectiveness,
262
+ category: getCategoryName(category),
263
+ id: player.id,
264
+ }
265
+ : {
266
+ position: player.positiontable,
267
+ goals: player.goals,
268
+ goals_received: player.goalsrecived,
269
+ games_played: player.games_played,
270
+ category: categoryName,
271
+ effectiveness: player.effectiveness,
272
+ xg: player.xg,
273
+ total: player.total,
274
+ category: getCategoryName(category),
275
+ attendance: '-',
276
+ id: player.id,
277
+ }
278
+ "
279
+ @viewprofile="viewprofile($event, player.teamid)"
280
+ :background="index % 2 === 0 ? backgroundEven : backgroundOdd"
281
+ />
282
+ </template>
283
+ </template>
284
+ </template>
285
+ </template>
286
+ </div>
287
+ </div>
288
+ </template>
289
+
290
+ <script>
291
+ import axios from 'axios'
292
+ import { ref } from 'vue'
293
+ import useElementSize from './useElementSize'
294
+ import GSCLeaders from './gsc-header-tops.vue'
295
+ import GSCRowTable from './gsc-row.vue'
296
+ import GSCTableHeader from './gsc-head-titles.vue'
297
+ import GSCExpandedInfo from './gsc-expanded-info-player.vue'
298
+ import { GSCCarousel } from '@golstats/gsc-carousel'
299
+ import '@@/@golstats/gsc-carousel/dist/style.css'
300
+
301
+ import nationalitiesCatalog from '@/components/comparative/nationalities-catalog.js'
302
+
303
+ export default {
304
+ components: {
305
+ GSCCarousel,
306
+ GSCLeaders,
307
+ GSCRowTable,
308
+ GSCTableHeader,
309
+ GSCExpandedInfo,
310
+ },
311
+ props: {
312
+ isTeam: {
313
+ type: Boolean,
314
+ default: false,
315
+ },
316
+ typeTable: {
317
+ type: Number,
318
+ default: 0,
319
+ },
320
+ carrousel: {
321
+ type: Boolean,
322
+ default: false,
323
+ },
324
+ arrow: {
325
+ type: Boolean,
326
+ default: false,
327
+ },
328
+ typeData: {
329
+ type: Number,
330
+ default: 1,
331
+ },
332
+ gameId: {
333
+ type: Number,
334
+ default: 0,
335
+ },
336
+ filtersProp: {
337
+ type: [Object, String],
338
+ default: () => {},
339
+ },
340
+ game: {
341
+ type: Object,
342
+ default: () => ({}),
343
+ },
344
+ isWidget: {
345
+ type: Boolean,
346
+ default: false,
347
+ },
348
+ teamWidget: {
349
+ type: Number,
350
+ default: 0,
351
+ },
352
+ canPlayVideos: {
353
+ type: Boolean,
354
+ default: false,
355
+ },
356
+ filterTeam: {
357
+ type: Number,
358
+ default: 0,
359
+ },
360
+ timeLiveComparativeAvanced: {
361
+ type: Number,
362
+ default: 60000,
363
+ },
364
+ category: {
365
+ type: Number,
366
+ default: 1,
367
+ },
368
+ categoryName: {
369
+ type: String,
370
+ default: 'Goles',
371
+ },
372
+ seasonSelected: {
373
+ type: Object,
374
+ default: () => ({}),
375
+ },
376
+ season: {
377
+ type: Number,
378
+ default: 1772,
379
+ },
380
+ type: {
381
+ type: Number,
382
+ default: 0,
383
+ },
384
+ borderRadius: { type: String, default: '8px' },
385
+ borderWidth: { type: [String, Number], default: '2px' },
386
+ borderColor: { type: String, default: '#cfcfcf' },
387
+ backgroundOdd: { type: String, default: '#172531' },
388
+ backgroundEven: { type: String, default: '#0d1d29' },
389
+ numRows: { type: Number, default: 5 },
390
+ },
391
+ setup() {
392
+ const myDivRef = ref('myDivRef')
393
+ const { elementSize } = useElementSize(myDivRef)
394
+ return {
395
+ myDivRef,
396
+ elementSize,
397
+ }
398
+ },
399
+ watch: {
400
+ game: {
401
+ immediate: true,
402
+ deep: true,
403
+ async handler(newValue) {
404
+ if (!newValue) return
405
+ this.playersInfo = {}
406
+ this.teamInfo = {}
407
+ this.isloading = true
408
+ this.formatFilterStats = []
409
+ await this.getCategoryStats(this.season)
410
+ if (this.game.is_live) {
411
+ this.createIntervalTops()
412
+ this.$emit('intervalidtops', this.intervalIdtops)
413
+ }
414
+ },
415
+ },
416
+ typeData: {
417
+ immediate: true,
418
+ async handler(newValue) {
419
+ await this.getCategoryStats(this.season)
420
+ if (newValue === 1 && this.game.is_live) {
421
+ this.createIntervalTops()
422
+ this.$emit('intervalidtops', this.intervalIdtops)
423
+ } else {
424
+ clearInterval(this.intervalIdtops)
425
+ }
426
+ },
427
+ },
428
+ filtersProp: {
429
+ immediate: false,
430
+ deep: true,
431
+ async handler(newValue, oldValue) {
432
+ if (!newValue) return
433
+ if (
434
+ JSON.stringify(newValue) !== JSON.stringify(oldValue) ||
435
+ this.sonConjuntosDistintos(newValue.setNationalitiesIds, oldValue.setNationalitiesIds)
436
+ ) {
437
+ this.isloading = true
438
+ this.filterEmitAux = newValue
439
+ const categoryZone1 = [1, 23, 3, 4, 5, 7, 6, 9, 8, 11, 10, 12, 13, 15, 14, 17, 16, 22]
440
+ if (categoryZone1.includes(this.category)) {
441
+ this.filterEmitAux.typeZone = 1
442
+ } else {
443
+ this.filterEmitAux.typeZone = 2
444
+ }
445
+ this.formatFilterStats = await this.filterRecords(this.filterEmitAux)
446
+ }
447
+ },
448
+ },
449
+ },
450
+ computed: {
451
+ topData() {
452
+ this.changeStateLoading(true)
453
+ if (Object.entries(this.statsData).length > 0 && this.formatFilterStats.length > 0) {
454
+ var topTeam = {}
455
+ var topPlayer = {}
456
+ var sortTopTeam = []
457
+ var sortMinutes = []
458
+ var sortTopPlayer = []
459
+ var sortTopPlayerFilterTeam = []
460
+
461
+ this.formatFilterStats.map((play) => {
462
+ if (topTeam[play.team_id]) {
463
+ topTeam[play.team_id]['total'] = topTeam[play.team_id]['total'] + play.total
464
+ } else {
465
+ sortMinutes
466
+ topTeam[play.team_id] = {}
467
+ topTeam[play.team_id]['total'] = play.total
468
+ topTeam[play.team_id]['id'] = this.teamInfo[play.team_id].id
469
+ topTeam[play.team_id]['name'] = this.teamInfo[play.team_id].name.replace(' Femenil', '')
470
+ topTeam[play.team_id]['img'] =
471
+ 'https://golstatsimages.blob.core.windows.net/teams-80/' + play.team_id + '.png'
472
+ topTeam[play.team_id]['effectiveness'] = this.teamInfo[play.team_id].effectiveness
473
+ topTeam[play.team_id]['frecuency'] = this.teamInfo[play.team_id].frecuency
474
+ topTeam[play.team_id]['game_avg'] = this.teamInfo[play.team_id].game_avg
475
+ topTeam[play.team_id]['game_avg_last_season'] =
476
+ this.teamInfo[play.team_id].game_avg_last_season
477
+ topTeam[play.team_id]['games_played_lastseason'] =
478
+ this.teamInfo[play.team_id].games_played_lastseason
479
+ topTeam[play.team_id]['games_played'] = this.teamInfo[play.team_id].games_played
480
+ topTeam[play.team_id]['positiontable'] = this.teamInfo[play.team_id].positiontable
481
+ topTeam[play.team_id]['goals'] = this.teamInfo[play.team_id].goals
482
+ topTeam[play.team_id]['goalsrecived'] = this.teamInfo[play.team_id].goalsrecived
483
+ topTeam[play.team_id]['xg'] = this.teamInfo[play.team_id].xg
484
+ }
485
+ if (topPlayer[play.player_id]) {
486
+ if (play.player_id != 0 && play.player_id != 62117) {
487
+ topPlayer[play.player_id]['total'] = topPlayer[play.player_id]['total'] + play.total
488
+ }
489
+ } else {
490
+ if (play.player_id != 0 && play.player_id != 62117) {
491
+ topPlayer[play.player_id] = {}
492
+ topPlayer[play.player_id]['total'] = play.total
493
+ if (play.player_id && this.playersInfo[play.player_id]) {
494
+ topPlayer[play.player_id]['name'] = this.playersInfo[play.player_id].name
495
+ topPlayer[play.player_id]['name_short'] = this.getnameshort(
496
+ this.playersInfo[play.player_id].name,
497
+ )
498
+ topPlayer[play.player_id]['img'] = this.playersInfo[play.player_id].img
499
+ topPlayer[play.player_id]['id'] = this.playersInfo[play.player_id].id
500
+ topPlayer[play.player_id]['age'] = this.playersInfo[play.player_id].age
501
+ topPlayer[play.player_id]['team'] = this.playersInfo[play.player_id].team
502
+ topPlayer[play.player_id]['teamname'] = this.playersInfo[play.player_id].teamname
503
+ topPlayer[play.player_id]['teamid'] = this.playersInfo[play.player_id].teamid
504
+ topPlayer[play.player_id]['position'] = this.playersInfo[play.player_id].position
505
+ topPlayer[play.player_id]['positionId'] =
506
+ this.playersInfo[play.player_id].positionId
507
+ topPlayer[play.player_id]['positionfull'] =
508
+ this.playersInfo[play.player_id].positionfull
509
+ topPlayer[play.player_id]['country'] = this.playersInfo[play.player_id].country
510
+ topPlayer[play.player_id]['effectiveness'] =
511
+ this.playersInfo[play.player_id].effectiveness
512
+ topPlayer[play.player_id]['minutes'] =
513
+ this.playersInfo[play.player_id].minutes_played
514
+ topPlayer[play.player_id]['games'] = this.playersInfo[play.player_id].games_played
515
+ topPlayer[play.player_id]['date'] = this.playersInfo[play.player_id].date
516
+ topPlayer[play.player_id]['nationality'] =
517
+ this.playersInfo[play.player_id].nationality
518
+ topPlayer[play.player_id]['player_country_flag'] =
519
+ this.playersInfo[play.player_id].player_country_flag
520
+ topPlayer[play.player_id]['categoryName'] = this.categoryName
521
+ } else {
522
+ topPlayer[play.player_id]['id'] = play.player_id
523
+ topPlayer[play.player_id]['name'] = play.player_id
524
+ topPlayer[play.player_id]['img'] = 'SIN IMAGEN'
525
+ topPlayer[play.player_id]['age'] = ''
526
+ topPlayer[play.player_id]['teamname'] = ''
527
+ topPlayer[play.player_id]['team'] = ''
528
+ topPlayer[play.player_id]['teamid'] = 0
529
+ topPlayer[play.player_id]['position'] = ''
530
+ topPlayer[play.player_id]['positionId'] = 0
531
+ topPlayer[play.player_id]['positionfull'] = ''
532
+ topPlayer[play.player_id]['country'] = ''
533
+ topPlayer[play.player_id]['effectiveness'] = ''
534
+ topPlayer[play.player_id]['minutes'] = ''
535
+ topPlayer[play.player_id]['games'] = ''
536
+ topPlayer[play.player_id]['date'] = '00-00-0000'
537
+ topPlayer[play.player_id]['nationality'] = ''
538
+ topPlayer[play.player_id]['player_country_flag'] = ''
539
+ topPlayer[play.player_id]['categoryName'] = ''
540
+ }
541
+ }
542
+ }
543
+ })
544
+ sortTopTeam.push(...Object.values(topTeam))
545
+ sortTopPlayer.push(...Object.values(topPlayer))
546
+ sortTopTeam = this.sortAndSlice(Object.values(topTeam), 60)
547
+ //sortTopPlayer = this.sortAndSlice(Object.values(topPlayer), 60)
548
+ //sortTopPlayer.sort(this.compareObjects).reverse();
549
+ sortTopPlayer = sortTopPlayer.sort(this.compareObjectsMinutes).slice(0, 60)
550
+ sortTopPlayer = sortTopPlayer.map((player, index) => {
551
+ player.top = index < 9 ? '0' + (index + 1) : '' + (index + 1)
552
+ return player
553
+ })
554
+ sortTopTeam = sortTopTeam.map((team, index) => {
555
+ team.top = index < 9 ? '0' + (index + 1) : '' + (index + 1)
556
+ return team
557
+ })
558
+ if (this.filterTeam !== 0 && !this.isTeam) {
559
+ sortTopPlayerFilterTeam = sortTopPlayer.filter(
560
+ (player) => player.teamid === this.filterTeam,
561
+ )
562
+ }
563
+ this.changeStateLoading(false)
564
+ if (this.isTeam) {
565
+ return this.formatArrayPaginate(sortTopTeam)
566
+ } else {
567
+ if (this.filterTeam != 0) {
568
+ return this.formatArrayPaginate(sortTopPlayerFilterTeam)
569
+ } else {
570
+ return this.formatArrayPaginate(sortTopPlayer)
571
+ }
572
+ }
573
+ } else {
574
+ this.changeStateLoading(false)
575
+ return []
576
+ }
577
+ },
578
+ },
579
+ data: () => ({
580
+ url: 'https://8grl16o77j.execute-api.us-west-2.amazonaws.com/prod/live/tops',
581
+ urlPrematch:
582
+ 'https://8grl16o77j.execute-api.us-west-2.amazonaws.com/prod/topsBySeasonAndCategory/',
583
+ data_headers: [
584
+ 'team_id',
585
+ 'player_id',
586
+ 'playing_as',
587
+ 'match_result',
588
+ 'section',
589
+ 'total',
590
+ 'origen',
591
+ 'destino',
592
+ ],
593
+ token:
594
+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6IlVzdWFyaW8gRnJlZSIsInVzZXJuYW1lIjoiZnJlZUBnb2xzdGF0cy5jb20iLCJlbWFpbCI6ImZyZWVAZ29sc3RhdHMuY29tIiwiaWF0IjoxNjA2NzU4Nzk1LCJleHAiOjE2MzgyOTQ3OTV9.kPNmP7yDtk38cAXrUyc7OHRh6J25VFqy-XUNzbK-4YE',
595
+ mapPlayers: new Map(),
596
+ setNationalityIds: new Set(),
597
+ arrayAgeRange: [0, 0],
598
+ arePlaysEmpty: false,
599
+ teamInfo: {},
600
+ formatFilterStats: [],
601
+ formatStats: [],
602
+ playersInfo: {},
603
+ isloading: true,
604
+ statsData: {},
605
+ updateSlider: 0,
606
+ intervalIdtops: null,
607
+ filterEmitAux: {},
608
+ filtersSelect: {
609
+ playingAs: [],
610
+ matchResult: [],
611
+ sections: [],
612
+ zone: [],
613
+ typeZone: [],
614
+ },
615
+ filtersValues: {
616
+ type: 1,
617
+ sections: [1, 2, 3, 4, 5, 6],
618
+ matchResult: [1, 2, 3],
619
+ playingAs: [1, 2],
620
+ zone: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
621
+ typeZone: 1,
622
+ arrayAgeRange: [1, 60],
623
+ setNationalitiesIds: [],
624
+ setPositionsIds: [1, 2, 3, 4, 5, 6, 7, 8, 9],
625
+ },
626
+ expand: false,
627
+ playerexpand: 0,
628
+ positions: [
629
+ {
630
+ name: 'Portero',
631
+ fullname: 'POR',
632
+ },
633
+ {
634
+ name: 'Defensa central',
635
+ fullname: 'DFC',
636
+ },
637
+ {
638
+ name: 'Lateral por izquierda',
639
+ fullname: 'LI',
640
+ },
641
+ {
642
+ name: 'Lateral por derecha',
643
+ fullname: 'LD',
644
+ },
645
+ {
646
+ name: 'Volante por izquierda',
647
+ fullname: 'VI',
648
+ },
649
+ {
650
+ name: 'Volante por derecha',
651
+ fullname: 'VD',
652
+ },
653
+ {
654
+ name: 'Volante defensivo',
655
+ fullname: 'VDF',
656
+ },
657
+ {
658
+ name: 'Volante ofensivo',
659
+ fullname: 'VO',
660
+ },
661
+ {
662
+ name: 'Delantero',
663
+ fullname: 'DEL',
664
+ },
665
+ {
666
+ name: 'Desconocida',
667
+ fullname: 'Desc',
668
+ },
669
+ ],
670
+ categories: [
671
+ {
672
+ id: 1,
673
+ name: 'Goles',
674
+ },
675
+ /*{
676
+ id: 2,
677
+ name: 'Pases acertados'
678
+ },
679
+ {
680
+ id: 3,
681
+ name: 'Balones recuperados en disputa'
682
+ },
683
+ {
684
+ id: 4,
685
+ name: 'Asistencias'
686
+ },
687
+ {
688
+ id: 5,
689
+ name: 'Participaciones en gol'
690
+ },
691
+ {
692
+ id: 6,
693
+ name: 'Tiros a gol'
694
+ },
695
+ {
696
+ id: 7,
697
+ name: 'Tiros a gol que llegaron a la portería'
698
+ },
699
+ {
700
+ id: 8
701
+ },
702
+ {
703
+ id: 9,
704
+ name: 'Cabeceos en área propia'
705
+ },
706
+ {
707
+ id: 10,
708
+ name: 'Centros'
709
+ },
710
+ {
711
+ id: 11,
712
+ name: 'Centros acertados'
713
+ },
714
+ {
715
+ id: 12,
716
+ name: '1vs1 exitosos ofensivos'
717
+ },
718
+ {
719
+ id: 13,
720
+ name: '1vs1 exitosos ofensivos que terminaron en gol'
721
+ },
722
+ {
723
+ id: 14,
724
+ name: '1vs1 defensivos exitoso'
725
+ },
726
+ {
727
+ id: 15,
728
+ name: 'Rechaces'
729
+ },
730
+ {
731
+ id: 16,
732
+ name: 'Balones ganados en área propia'
733
+ },
734
+ {
735
+ id: 17,
736
+ name: 'Balones ganados en área rival'
737
+ },
738
+ {
739
+ id: 18,
740
+ name: 'Faltas cometidas'
741
+ },
742
+ {
743
+ id: 19,
744
+ name: 'Faltas recibidas'
745
+ },
746
+ {
747
+ id: 20,
748
+ name: 'Tarjetas amarillas'
749
+ },
750
+ {
751
+ id: 21,
752
+ name: 'Tarjetas rojas'
753
+ },
754
+ {
755
+ id: 22,
756
+ name: 'Atajadas'
757
+ },
758
+ {
759
+ id: 23,
760
+ name: 'Tiros de Esquina'
761
+ }*/
762
+ ],
763
+ }),
764
+ methods: {
765
+ changeStateLoading(value) {
766
+ this.isloading = value
767
+ },
768
+ compareObjectsMinutes(obj1, obj2) {
769
+ if (obj1.total > obj2.total) {
770
+ return -1
771
+ } else if (obj1.total < obj2.total) {
772
+ return 1
773
+ } else {
774
+ // En caso de empate en 'total', desempatar por 'minutes_played'
775
+ if (obj1.minutes < obj2.minutes) {
776
+ return -1
777
+ } else if (obj1.minutes > obj2.minutes) {
778
+ return 1
779
+ } else {
780
+ return 0
781
+ }
782
+ }
783
+ },
784
+
785
+ sonConjuntosDistintos(set1, set2) {
786
+ // Convertir sets a arrays
787
+ const array1 = Array.from(set1)
788
+ const array2 = Array.from(set2)
789
+
790
+ // Verificar si los arrays son iguales
791
+ if (array1.length !== array2.length) {
792
+ return true // Distintos si tienen diferentes longitudes
793
+ }
794
+
795
+ for (let i = 0; i < array1.length; i++) {
796
+ if (!set2.has(array1[i])) {
797
+ return true // Distintos si un elemento no está en el otro conjunto
798
+ }
799
+ }
800
+
801
+ return false // Son iguales
802
+ },
803
+ getnameshort(namePlayerShort) {
804
+ var NameArrayHomeBench = namePlayerShort.split(',')
805
+ var lastArrayNameBench = NameArrayHomeBench[0].split(' ')
806
+ var ArrayNameBench = NameArrayHomeBench[1].trim().split(' ')
807
+ var lastNameHomeBench = ''
808
+ if (lastArrayNameBench.length == 2 || lastArrayNameBench.length == 1) {
809
+ if (lastArrayNameBench[0].length < 4) {
810
+ lastNameHomeBench = lastArrayNameBench[0] + ' ' + lastArrayNameBench[1]
811
+ } else {
812
+ lastNameHomeBench = lastArrayNameBench[0]
813
+ }
814
+ } else {
815
+ if (lastArrayNameBench.length == 3) {
816
+ lastNameHomeBench = lastArrayNameBench[0] + ' ' + lastArrayNameBench[1]
817
+ } else {
818
+ if (lastArrayNameBench.length == 4) {
819
+ lastNameHomeBench =
820
+ lastArrayNameBench[1] + ' ' + lastArrayNameBench[2] + ' ' + lastArrayNameBench[3]
821
+ }
822
+ }
823
+ }
824
+ var nameHomeBench =
825
+ ArrayNameBench[ArrayNameBench.length - 1] != ''
826
+ ? ArrayNameBench[ArrayNameBench.length - 1].charAt(0)
827
+ : ArrayNameBench[ArrayNameBench.length - 2]
828
+ ? ArrayNameBench[ArrayNameBench.length - 2].charAt(0)
829
+ : ''
830
+ lastNameHomeBench = lastNameHomeBench.replace(',', '')
831
+ return nameHomeBench + '. ' + lastNameHomeBench
832
+ },
833
+ changeCarrousel() {
834
+ this.expand = false
835
+ this.playerexpand = 0
836
+ },
837
+ compareObjects(obj1, obj2) {
838
+ // Compare by 'name' first
839
+ if (obj1.total < obj2.total) return -1
840
+ if (obj1.total > obj2.total) return 1
841
+
842
+ // If names are equal, compare by 'age'
843
+ if (obj1.name < obj2.name) return -1
844
+ if (obj1.name > obj2.name) return 1
845
+
846
+ // If both 'name' and 'age' are equal, return 0
847
+ return 0
848
+ },
849
+ sortAndSlice(array, limit) {
850
+ return array
851
+ .sort((a, b) => (a.name < b.name ? 1 : -1) && (a.total < b.total ? 1 : -1))
852
+ .slice(0, limit)
853
+ },
854
+ getCategoryName(category) {
855
+ let ret = ''
856
+ for (let i = 0; i < this.categories.length; i++) {
857
+ if (category == this.categories[i].id) ret = this.categories[i].name
858
+ }
859
+ return ret
860
+ },
861
+ translateTopCategories(topCategoryId) {
862
+ const translator = {
863
+ 1: [12, 55, '35_r', '54_r'],
864
+ 2: [2, 20],
865
+ 3: [485, 486, 487, 488],
866
+ 4: [10, 324],
867
+ 5: [27, 323],
868
+ 6: [510],
869
+ 7: [537, 540, 544, 547],
870
+ 8: [328],
871
+ 9: [231, 238, 280, 287, 294, 406],
872
+ 10: [13, 25],
873
+ 11: [98, 101, 104, 105, 109, 112, 115, 116],
874
+ 12: [4],
875
+ 13: [88],
876
+ 14: [5],
877
+ 15: [34],
878
+ 16: [23],
879
+ 17: [11],
880
+ 18: [17, 50],
881
+ 19: [18, 49],
882
+ 20: [14, 52],
883
+ 21: [15, 53],
884
+ 22: [39],
885
+ 23: [31, 32],
886
+ }
887
+ return translator[topCategoryId] || []
888
+ },
889
+
890
+ getCoordinatePointPerCategory(topCategoryId) {
891
+ const origin = 1
892
+ const middleOrigin = 2
893
+ const destiny = 3
894
+ const coordinatePoints = {
895
+ 1: middleOrigin,
896
+ 2: destiny,
897
+ 3: origin,
898
+ 4: middleOrigin,
899
+ 5: origin,
900
+ 6: middleOrigin,
901
+ 7: middleOrigin,
902
+ 8: origin,
903
+ 9: origin,
904
+ 10: middleOrigin,
905
+ 11: middleOrigin,
906
+ 12: origin,
907
+ 13: origin,
908
+ 14: origin,
909
+ 15: origin,
910
+ 16: origin,
911
+ 17: origin,
912
+ 18: destiny,
913
+ 19: destiny,
914
+ 20: destiny,
915
+ 21: destiny,
916
+ 22: origin,
917
+ 23: origin,
918
+ }
919
+ return coordinatePoints[topCategoryId] || 0
920
+ },
921
+
922
+ emitEventMedia(data, category, categoryName) {
923
+ let matchResult = this.filtersValues.matchResult
924
+ let playingAs = this.filtersValues.playingAs
925
+ let sections = this.filtersValues.sections
926
+ let zone = this.filtersValues.zone
927
+ let categoryIds = this.translateTopCategories(category)
928
+
929
+ if (Object.keys(this.filterEmitAux).length > 0) {
930
+ matchResult = this.filterEmitAux.matchResult
931
+ playingAs = this.filterEmitAux.playingAs
932
+ sections = this.filterEmitAux.sections
933
+ zone = this.filterEmitAux.zone
934
+ }
935
+ const videoPlayerSection = 1
936
+ const playerType = 2
937
+ const teamType = 3
938
+ const playListType = this.isTeam ? teamType : playerType
939
+ const topLeaderId = data.player_id //for team id or player id
940
+ let playerIds = []
941
+ let teamId = this.isTeam ? data.id : this.filterTeam
942
+
943
+ if (topLeaderId) {
944
+ if (this.isTeam) {
945
+ teamId = topLeaderId
946
+ } else {
947
+ playerIds = [topLeaderId]
948
+ categoryIds = categoryIds.filter((id) => !id.toString().includes('_r'))
949
+ }
950
+ } else if (this.isTeam) {
951
+ teamId = data.id
952
+ } else {
953
+ playerIds = [data.id]
954
+ categoryIds = categoryIds.filter((id) => !id.toString().includes('_r'))
955
+ }
956
+ const jsonConfig = {
957
+ auxwidget:
958
+ this.canPlayVideos ||
959
+ (this.game.awayTeam.team_id == this.teamWidget && this.typeData != 1)
960
+ ? true
961
+ : false,
962
+ seasonId: this.game.is_live == 1 ? this.season : this.game.regularSeasonId,
963
+ isFeaturedPlayers: false,
964
+ mainSectionType: videoPlayerSection,
965
+ playListType: playListType,
966
+ gameIds: null,
967
+ playerIds: playerIds,
968
+ goalkeeperIds: [],
969
+ categoryIds: this.translateTopCategories(category),
970
+ teamId: teamId || 0,
971
+ matchResult: matchResult,
972
+ categorySingleName: '',
973
+ isRivalSubject: false,
974
+ avoidCategorySingleName: false,
975
+ currentPlayIndex: 0,
976
+ playData: null,
977
+ lastClashedGameId: null,
978
+ tournamentsLastClashes: null,
979
+ advancedFilter: {
980
+ playListTitle: categoryName,
981
+ playingAs: playingAs,
982
+ timeSections: sections,
983
+ fieldSections: zone,
984
+ coordinatePoint: this.getCoordinatePointPerCategory(category),
985
+ },
986
+ }
987
+ this.$emit('setopenmedia', jsonConfig)
988
+ },
989
+
990
+ emitEventMediaFullTable(data, category, categoryName) {
991
+ let matchResult = this.filtersValues.matchResult
992
+ let playingAs = this.filtersValues.playingAs
993
+ let sections = this.filtersValues.sections
994
+ let zone = this.filtersValues.zone
995
+ let categoryIds = this.translateTopCategories(category)
996
+
997
+ if (Object.keys(this.filterEmitAux).length > 0) {
998
+ matchResult = this.filterEmitAux.matchResult
999
+ playingAs = this.filterEmitAux.playingAs
1000
+ sections = this.filterEmitAux.sections
1001
+ zone = this.filterEmitAux.zone
1002
+ }
1003
+ const videoPlayerSection = 1
1004
+ const playerType = 2
1005
+ const teamType = 3
1006
+ const playListType = this.isTeam ? teamType : playerType
1007
+ let playerIds = []
1008
+ let teamId = this.isTeam ? data.id : this.filterTeam
1009
+ if (this.isTeam) {
1010
+ teamId = data.id
1011
+ } else {
1012
+ playerIds = [data.id]
1013
+ categoryIds = categoryIds.filter((id) => !id.toString().includes('_r'))
1014
+ }
1015
+
1016
+ const jsonConfig = {
1017
+ seasonId: this.season,
1018
+ isFeaturedPlayers: false,
1019
+ mainSectionType: videoPlayerSection,
1020
+ playListType: playListType,
1021
+ gameIds: null,
1022
+ playerIds: playerIds,
1023
+ goalkeeperIds: [],
1024
+ categoryIds,
1025
+ teamId: teamId || 0,
1026
+ matchResult: matchResult,
1027
+ categorySingleName: '',
1028
+ isRivalSubject: false,
1029
+ avoidCategorySingleName: false,
1030
+ currentPlayIndex: 0,
1031
+ playData: null,
1032
+ lastClashedGameId: null,
1033
+ tournamentsLastClashes: null,
1034
+ advancedFilter: {
1035
+ playListTitle: categoryName,
1036
+ playingAs: playingAs,
1037
+ timeSections: sections,
1038
+ fieldSections: zone,
1039
+ coordinatePoint: this.getCoordinatePointPerCategory(category),
1040
+ },
1041
+ }
1042
+ this.$emit('setopenmedia', jsonConfig)
1043
+ },
1044
+
1045
+ replaceImgPlayer(img) {
1046
+ const imgNew = img.replace(
1047
+ 'https://golstatsimages.blob.core.windows.net/players-profile/',
1048
+ 'https://golstatsimages.blob.core.windows.net/players-profile-no-bg/',
1049
+ )
1050
+ return imgNew
1051
+ },
1052
+ abrevName(name) {
1053
+ var NameArrayHome = name.split(',')
1054
+ var lastArrayName = NameArrayHome[0].split(' ')
1055
+ var ArrayName = NameArrayHome[1].trim().split(' ')
1056
+ var lastNameHome = ''
1057
+ if (lastArrayName.length == 2 || lastArrayName.length == 1) {
1058
+ if (lastArrayName[0].length < 4) {
1059
+ lastNameHome = lastArrayName[0] + ' ' + lastArrayName[1]
1060
+ } else {
1061
+ lastNameHome = lastArrayName[0]
1062
+ }
1063
+ } else {
1064
+ if (lastArrayName.length == 3) {
1065
+ lastNameHome = lastArrayName[0] + ' ' + lastArrayName[1]
1066
+ } else {
1067
+ if (lastArrayName.length == 4) {
1068
+ lastNameHome = lastArrayName[1] + ' ' + lastArrayName[2] + ' ' + lastArrayName[3]
1069
+ }
1070
+ }
1071
+ }
1072
+ var nameHome =
1073
+ ArrayName[ArrayName.length - 1] != ''
1074
+ ? ArrayName[ArrayName.length - 1].charAt(0)
1075
+ : ArrayName[ArrayName.length - 2]
1076
+ ? ArrayName[ArrayName.length - 2].charAt(0)
1077
+ : ''
1078
+ lastNameHome = lastNameHome.replace(',', '')
1079
+ var abrevNamePlayerHome = nameHome + '. ' + lastNameHome
1080
+ return abrevNamePlayerHome
1081
+ },
1082
+ clickMore(category) {
1083
+ this.$emit('more', { category: category, categoryName: this.categoryName })
1084
+ },
1085
+ morestats() {
1086
+ this.$emit('more', this.category)
1087
+ },
1088
+ viewprofile(id, teamId) {
1089
+ this.$emit('clickprofile', { id, teamId, isTeam: this.isTeam })
1090
+ },
1091
+ clickexpand(expandobject) {
1092
+ this.expand = expandobject.expand
1093
+ this.playerexpand = expandobject.id
1094
+ },
1095
+ async getCategoryStats(season) {
1096
+ this.mapPlayers = new Map()
1097
+ try {
1098
+ if (!season) return
1099
+ let catPlays = []
1100
+ let teamData = {}
1101
+ let playersData = {}
1102
+ let seasonGet = this.season
1103
+ if (this.seasonSelected?.related_seasons?.some((s) => s.id === this.season)) {
1104
+ seasonGet = this.seasonSelected.id
1105
+ }
1106
+ this.arePlaysEmpty = false
1107
+ const axiosInstance = axios.create({
1108
+ headers: {
1109
+ Authorization: `${this.token}`,
1110
+ },
1111
+ })
1112
+ this.isloading = true
1113
+ let data = {}
1114
+ if (this.typeData == 1) {
1115
+ if (this.isWidget && this.teamWidget != 0) {
1116
+ data = await axiosInstance.get(
1117
+ this.url + '/' + this.gameId + '/' + this.category + '?t=' + this.teamWidget,
1118
+ )
1119
+ } else {
1120
+ data = await axiosInstance.get(this.url + '/' + this.gameId + '/' + this.category)
1121
+ }
1122
+ } else {
1123
+ if (this.game.game_status === 1) {
1124
+ if (this.isWidget && this.teamWidget != 0) {
1125
+ data = await axiosInstance.get(
1126
+ this.url + '/' + this.gameId + '/' + this.category + '?acc=1&t=' + this.teamWidget,
1127
+ )
1128
+ } else {
1129
+ data = await axiosInstance.get(
1130
+ this.url + '/' + this.gameId + '/' + this.category + '?acc=1',
1131
+ )
1132
+ }
1133
+ } else {
1134
+ if (this.isWidget && this.teamWidget != 0) {
1135
+ data = await axiosInstance.get(
1136
+ this.urlPrematch + seasonGet + '/' + this.category + '?t=' + this.teamWidget,
1137
+ )
1138
+ } else {
1139
+ data = await axiosInstance.get(
1140
+ this.urlPrematch +
1141
+ seasonGet +
1142
+ '/' +
1143
+ this.category +
1144
+ '?t=' +
1145
+ this.game.homeTeam.team_id +
1146
+ '&t=' +
1147
+ this.game.awayTeam.team_id,
1148
+ )
1149
+ }
1150
+ }
1151
+ }
1152
+ if (data && data.data && data.data.data && data.data.data.length > 0) {
1153
+ catPlays = data.data.data.map((play) => {
1154
+ return this.formatStatsData(play)
1155
+ })
1156
+ data.data.teams.forEach((data) => {
1157
+ teamData[data[0]] = {}
1158
+ teamData[data[0]]['id'] = data[0]
1159
+ teamData[data[0]]['name'] = data[1]
1160
+ teamData[data[0]]['abrv'] = data[2]
1161
+ teamData[data[0]]['img'] = data[3]
1162
+ teamData[data[0]]['effectiveness'] = data[4]
1163
+ teamData[data[0]]['games_played'] = data[5]
1164
+ teamData[data[0]]['games_played_lastseason'] = data[6]
1165
+ teamData[data[0]]['positiontable'] = data[7]
1166
+ teamData[data[0]]['goals'] = data[8]
1167
+ teamData[data[0]]['goalsrecived'] = data[9]
1168
+ teamData[data[0]]['xg'] = data[10]
1169
+ teamData[data[0]]['frecuency'] = data[11]
1170
+ teamData[data[0]]['game_avg'] = data[12]
1171
+ teamData[data[0]]['game_avg_last_season'] = data[13]
1172
+ })
1173
+ const setNationalityIds = new Set()
1174
+ data.data.players.forEach((data) => {
1175
+ const objectPlayer = this.getObjectPlayer(data)
1176
+ this.mapPlayers.set(objectPlayer.numberId, objectPlayer)
1177
+ const numberPlayerAge = objectPlayer.numberAge
1178
+ const team = objectPlayer.teamName.length > 0 ? objectPlayer.teamName[0].acronym : ''
1179
+ const teamname =
1180
+ objectPlayer.teamName.length > 0
1181
+ ? teamData[objectPlayer.teamName[0].team_id].name
1182
+ : ''
1183
+ const team_id = objectPlayer.teamName.length > 0 ? objectPlayer.teamName[0].team_id : ''
1184
+ const positionname = this.positions[objectPlayer.numberPositionId - 1].fullname
1185
+ const positionnamefull = this.positions[objectPlayer.numberPositionId - 1].name
1186
+ const country =
1187
+ objectPlayer.countryId.length > 0 ? objectPlayer.countryId[0].nationality_id : ''
1188
+ const effectiveness = objectPlayer.effectiveness
1189
+ const minutes = objectPlayer.min
1190
+ const games_played = objectPlayer.games
1191
+ const dateOfBirth = objectPlayer.date
1192
+ objectPlayer.arrayNationalities.forEach((objectNationality) => {
1193
+ setNationalityIds.add(objectNationality.numberId)
1194
+ })
1195
+ playersData[data[0]] = {
1196
+ id: data[0],
1197
+ name: data[1],
1198
+ img: data[2],
1199
+ age: numberPlayerAge,
1200
+ team: team,
1201
+ teamname: teamname,
1202
+ teamid: team_id,
1203
+ position: positionname,
1204
+ positionfull: positionnamefull,
1205
+ effectiveness: effectiveness,
1206
+ country: country,
1207
+ games_played: games_played,
1208
+ minutes_played: minutes,
1209
+ date: dateOfBirth,
1210
+ nationality: objectPlayer.stringNationalityName,
1211
+ player_country_flag: objectPlayer.player_country_flag,
1212
+ positionId: objectPlayer.numberPositionId,
1213
+ }
1214
+ })
1215
+ this.setNationalityIds = setNationalityIds
1216
+ this.arrayAgeRange = [data.data.min_age, data.data.max_age]
1217
+ } else {
1218
+ this.arePlaysEmpty = true
1219
+ }
1220
+ this.teamInfo = teamData
1221
+ this.playersInfo = playersData
1222
+ this.formatStats = catPlays
1223
+ this.formatFilterStats = this.filterRecords(this.filtersSelect)
1224
+ this.statsData = data
1225
+ } catch (e) {
1226
+ return Promise.reject(e)
1227
+ }
1228
+ },
1229
+ filterRecords(filtersEmit) {
1230
+ if (this.formatStats.length > 0) {
1231
+ return this.formatStats.filter((play) => {
1232
+ const playingAs = filtersEmit.playingAs.includes(play.playing_as)
1233
+ const matchResult = filtersEmit.matchResult.includes(play.match_result)
1234
+ const matchLapse = filtersEmit.sections.includes(play.section)
1235
+ const matchZone =
1236
+ (filtersEmit.typeZone === 1 && filtersEmit.zone.includes(play.origen)) ||
1237
+ (filtersEmit.typeZone === 2 && filtersEmit.zone.includes(play.destino))
1238
+ if (
1239
+ filtersEmit.setPositionsIds &&
1240
+ filtersEmit.setNationalitiesIds &&
1241
+ filtersEmit.arrayAgeRange &&
1242
+ filtersEmit.setYear &&
1243
+ !this.isTeam
1244
+ ) {
1245
+ const objectPlayer = this.mapPlayers.get(play.player_id)
1246
+ if (!objectPlayer) {
1247
+ return false
1248
+ }
1249
+ if (filtersEmit.booleanAreNationalTeamsVisible) {
1250
+ // national team validation
1251
+ if (filtersEmit.setAvailableNationalTeamsPlayersIds.size > 0) {
1252
+ if (!filtersEmit.setAvailableNationalTeamsPlayersIds.has(play.player_id)) {
1253
+ return false
1254
+ }
1255
+ }
1256
+ } else {
1257
+ // nationality validation
1258
+ let booleanHasNationality = false
1259
+ for (const numberNationalityId of objectPlayer.arrayNationalitiesIds) {
1260
+ if (filtersEmit.setNationalitiesIds.has(numberNationalityId)) {
1261
+ booleanHasNationality = true
1262
+ break
1263
+ }
1264
+ }
1265
+ if (!booleanHasNationality) {
1266
+ return false
1267
+ }
1268
+ }
1269
+ if (
1270
+ objectPlayer.numberAge < filtersEmit.arrayAgeRange[0] ||
1271
+ objectPlayer.numberAge > filtersEmit.arrayAgeRange[1]
1272
+ ) {
1273
+ return false
1274
+ }
1275
+ if (objectPlayer.date < filtersEmit.setYear) {
1276
+ return false
1277
+ }
1278
+ if (!filtersEmit.setPositionsIds.includes(objectPlayer.numberPositionId)) {
1279
+ return false
1280
+ }
1281
+ }
1282
+
1283
+ //this.isloading = true
1284
+ return (
1285
+ (filtersEmit.playingAs.length === 0 || playingAs) &&
1286
+ (filtersEmit.matchResult.length === 0 || matchResult) &&
1287
+ (filtersEmit.sections.length === 0 || matchLapse) &&
1288
+ (filtersEmit.zone.length === 0 || matchZone)
1289
+ )
1290
+ })
1291
+ } else {
1292
+ return []
1293
+ }
1294
+ },
1295
+ updateSliderF() {
1296
+ this.updateSlider += 1
1297
+ },
1298
+ formatStatsData(play) {
1299
+ const formattedPlay = {}
1300
+
1301
+ // Switch values for play[2]
1302
+ if (play[1] === 0 && (play[2] === 1 || play[2] === 2)) {
1303
+ play[2] = 3 - play[2]
1304
+ }
1305
+
1306
+ // Switch values for play[3]
1307
+ if (play[1] === 0 && (play[3] === 1 || play[3] === 2)) {
1308
+ play[3] = 3 - play[3]
1309
+ }
1310
+
1311
+ this.data_headers.forEach((header, index) => {
1312
+ formattedPlay[header] = play[index]
1313
+ })
1314
+
1315
+ return formattedPlay
1316
+ },
1317
+ getObjectPlayer(arrayPlayerData) {
1318
+ const arrayNationalitiesIds = []
1319
+ const arrayNationalities = arrayPlayerData[7].map((objectNationality) => {
1320
+ arrayNationalitiesIds.push(objectNationality.nationality_id)
1321
+ return {
1322
+ stringName: objectNationality.nationality,
1323
+ numberId: objectNationality.nationality_id,
1324
+ }
1325
+ })
1326
+ const arrayPlayerDateOfBirth = arrayPlayerData[9].split('-')
1327
+ return {
1328
+ numberId: arrayPlayerData[0] !== undefined ? arrayPlayerData[0] : '',
1329
+ stringFullName: arrayPlayerData[1] !== undefined ? arrayPlayerData[1] : '',
1330
+ stringImageUrl: arrayPlayerData[2] !== undefined ? arrayPlayerData[2] : '',
1331
+ numberTeamId: arrayPlayerData[3] !== undefined ? arrayPlayerData[3] : '',
1332
+ player_country_flag:
1333
+ 'https://golstatsimages.blob.core.windows.net/flags/' + arrayPlayerData[3] + '.jpg',
1334
+ stringNationalityName: nationalitiesCatalog[arrayPlayerData[3]],
1335
+ numberAge: arrayPlayerData[5] !== undefined ? arrayPlayerData[5] : '',
1336
+ numberPositionId: arrayPlayerData[6] !== undefined ? arrayPlayerData[6] : '',
1337
+ countryId: arrayPlayerData[7] !== undefined ? arrayPlayerData[7] : '',
1338
+ teamName: arrayPlayerData[10] !== undefined ? arrayPlayerData[10] : '',
1339
+ effectiveness: arrayPlayerData[11] !== undefined ? arrayPlayerData[11] : '',
1340
+ min: arrayPlayerData[13] !== undefined ? arrayPlayerData[13] : '',
1341
+ games: arrayPlayerData[12] !== undefined ? arrayPlayerData[12] : '',
1342
+ date: arrayPlayerDateOfBirth.length > 0 ? Number(arrayPlayerDateOfBirth[0]) : 0,
1343
+ arrayNationalities,
1344
+ category: this.categoryName,
1345
+ arrayNationalitiesIds,
1346
+ }
1347
+ },
1348
+ formatArrayPaginate(arrayData) {
1349
+ const num = Math.ceil(arrayData.length / this.numRows)
1350
+
1351
+ return Array.from({ length: num }, (_, index) => {
1352
+ const start = index * this.numRows
1353
+ const end = start + this.numRows
1354
+ return arrayData.slice(start, end)
1355
+ })
1356
+ },
1357
+ createIntervalTops() {
1358
+ this.intervalIdtops = setInterval(async () => {
1359
+ await this.getCategoryStats(this.season)
1360
+ }, this.timeLiveComparativeAvanced) //300000
1361
+ },
1362
+ clearTopsInterval() {
1363
+ if (this.intervalIdtops) {
1364
+ clearInterval(this.intervalIdtops)
1365
+ this.intervalIdtops = null
1366
+ }
1367
+ },
1368
+ },
1369
+ beforeUnmount() {
1370
+ this.clearTopsInterval()
1371
+ },
1372
+ }
1373
+ </script>
1374
+ <style lang="scss" scoped>
1375
+ @import '/css/fonts.css';
1376
+ .overlay-loading-top {
1377
+ position: absolute; /* Sit on top of the page content */
1378
+ display: flex; /* Hidden by default */
1379
+ flex-direction: column;
1380
+ justify-content: center;
1381
+ align-items: center;
1382
+ width: 100%; /* Full width (cover the whole page) */
1383
+ height: 100%; /* Full height (cover the whole page) */
1384
+ top: 0;
1385
+ left: 0;
1386
+ right: 0;
1387
+ bottom: 0;
1388
+ z-index: 2; /* Specify a stack order in case you're using a different order for other elements */
1389
+
1390
+ &__spinner {
1391
+ height: 70px;
1392
+ -webkit-animation: spin 2s linear infinite; /* Safari */
1393
+ animation: spin 2s linear infinite;
1394
+
1395
+ & > img {
1396
+ height: 70px;
1397
+ object-fit: contain;
1398
+ }
1399
+ }
1400
+
1401
+ &__text {
1402
+ font-size: 1.4rem;
1403
+ margin-top: 0.8em;
1404
+ color: white;
1405
+ font-family: 'Poppins-Regular';
1406
+ }
1407
+ }
1408
+ .groupsLeague {
1409
+ position: relative;
1410
+ line-height: 20px;
1411
+ font-weight: 500;
1412
+ font-family: 'Poppins-Regular';
1413
+ font-size: 12px;
1414
+ color: '#FFFFFF';
1415
+ max-width: 182px;
1416
+ line-height: 14px;
1417
+ text-align: left;
1418
+ }
1419
+
1420
+ @media screen and (max-width: 1125px) {
1421
+ .groupsLeague {
1422
+ max-width: 150px;
1423
+ }
1424
+ }
1425
+
1426
+ @media screen and (max-width: 480px) {
1427
+ .groupsLeague {
1428
+ max-width: 160px;
1429
+ }
1430
+ }
1431
+ @media screen and (max-width: 380px) {
1432
+ .groupsLeague {
1433
+ font-size: 11px;
1434
+ max-width: 140px;
1435
+ }
1436
+ }
1437
+ .text {
1438
+ display: flex;
1439
+ flex-direction: row;
1440
+ padding: 0px 16px;
1441
+ align-items: center;
1442
+ justify-content: center;
1443
+ }
1444
+ .btnViewFullList {
1445
+ margin: 0 !important;
1446
+
1447
+ position: absolute;
1448
+ right: 8px;
1449
+ width: fit-content;
1450
+ border-bottom: 1px solid rgb(203, 238, 107);
1451
+
1452
+ padding: 0px 0px 2px;
1453
+ align-items: center;
1454
+ justify-content: flex-end;
1455
+ z-index: 1;
1456
+ text-align: center;
1457
+ font-size: 13px;
1458
+ font-family: Montserrat-SemiBold;
1459
+ height: 33px;
1460
+ display: flex;
1461
+ align-items: flex-end;
1462
+ }
1463
+
1464
+ .hidden {
1465
+ display: none;
1466
+ }
1467
+ .gsc-top {
1468
+ width: 100%;
1469
+ position: relative;
1470
+ height: auto;
1471
+ min-height: 460px;
1472
+ margin: 0 auto;
1473
+ padding-bottom: 30px;
1474
+ border-radius: v-bind(borderRadius);
1475
+ border-style: solid;
1476
+ border-width: v-bind(borderWidth);
1477
+ border-color: v-bind(borderColor);
1478
+ }
1479
+
1480
+ .gsc-top-full {
1481
+ width: 100%;
1482
+ height: auto;
1483
+ margin: 0 auto;
1484
+ background: rgb(13, 29, 41);
1485
+ margin-top: 20px;
1486
+ }
1487
+
1488
+ .row-table-carrousel {
1489
+ width: 100%;
1490
+ height: auto;
1491
+ /* min-height: 480px; */
1492
+ display: inline-block;
1493
+ margin-top: 45px;
1494
+ }
1495
+ .container-no-search-result {
1496
+ width: 100%;
1497
+ height: 480px;
1498
+ margin-top: 5px;
1499
+ border: 1px solid rgba(149, 149, 149, 0.4);
1500
+ position: relative;
1501
+ }
1502
+ .container-no-search-result-subtitle {
1503
+ font-family: 'Poppins-Regular';
1504
+ font-size: 14px;
1505
+ color: rgb(172, 172, 172);
1506
+ text-align: center;
1507
+ line-height: 18px;
1508
+ margin-top: 10px;
1509
+ }
1510
+ .container-no-search-result-title {
1511
+ font-family: 'Poppins-SemiBold';
1512
+ font-size: 17px;
1513
+ color: rgb(225, 225, 225);
1514
+ text-align: center;
1515
+ margin-top: 170px;
1516
+ }
1517
+ </style>