@golstats/gsc-top-player 1.0.11 → 1.0.13

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