@golstats/gsc-reports 1.0.52 → 1.0.54
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.
- package/dist/{FilterConditions-55d68355-C06ae5UH-CEA4TfvA-DSWBY7HO.js → FilterConditions-55d68355-zHMe0Dyg-CrLqkkfP-M-GLdj8H.js} +5 -5
- package/dist/{FilterField-59a73e38-CwFxdon3-CZO9BXOb-Ck2Zy8SI.js → FilterField-59a73e38-DtNZKbqt-BMRKmoBk-C6CpYJ5U.js} +3 -3
- package/dist/{FilterSubcategories-a9b32cc9-Dfm_NNj7-9s2uLZyt-Cq2yOJ8R.js → FilterSubcategories-a9b32cc9-BjvvEE_X-DQe88zvC-BZF4ehk1.js} +3 -3
- package/dist/gsc-reports.css +1 -1
- package/dist/gsc-reports.es.js +1 -1
- package/dist/gsc-reports.umd.js +209 -209
- package/dist/{index-DfyEOv8s.js → index-DoXBPhEZ.js} +55424 -55207
- package/package.json +2 -2
- package/src/components/TemplatesSection.vue +1 -0
- package/src/components/elementsTemplates/ModalGenerarReporte.vue +379 -27
- package/src/components/thumbnails-reports/AnalisisPostMatchType3.vue +0 -22
- package/src/components/thumbnails-reports/AnalisisPostMatchType4.vue +0 -22
- package/src/components/thumbnails-reports/AnalisisPrematchType1.vue +68 -0
- package/src/components/thumbnails-reports/AnalisisPrematchType2.vue +68 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golstats/gsc-reports",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.54",
|
|
4
4
|
"main": "dist/gsc-reports.umd.js",
|
|
5
5
|
"module": "dist/gsc-reports.es.js",
|
|
6
6
|
"exports": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@golstats/gsc-checkbox": "^1.0.13",
|
|
50
|
-
"@golstats/gsc-template-report-maker": "^1.0.
|
|
50
|
+
"@golstats/gsc-template-report-maker": "^1.0.73",
|
|
51
51
|
"axios": "^1.10.0",
|
|
52
52
|
"gridstack": "^12.1.1",
|
|
53
53
|
"tiny-emitter": "^2.1.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="modal-overlay">
|
|
3
3
|
<div class="modal-content">
|
|
4
|
-
<button class="close-btn" @click="
|
|
4
|
+
<button class="close-btn" @click="closeModal">
|
|
5
5
|
<img
|
|
6
6
|
src="https://golstatsimages.blob.core.windows.net/reports-images/icn-close.svg"
|
|
7
7
|
alt="Cerrar"
|
|
@@ -27,9 +27,16 @@
|
|
|
27
27
|
</div>
|
|
28
28
|
|
|
29
29
|
<!-- Mostrar selectores solo cuando no hay error 409 -->
|
|
30
|
-
<div v-else>
|
|
30
|
+
<div v-else style="position: relative">
|
|
31
|
+
<!-- Loading overlay para autoseteo -->
|
|
32
|
+
<div v-if="loadingAutoseteo" class="loading-autoseteo-overlay">
|
|
33
|
+
<div class="loading-autoseteo-content">
|
|
34
|
+
<div class="loading-spinner"></div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
31
38
|
<div class="modal-group">
|
|
32
|
-
<label>1. Elige
|
|
39
|
+
<label>1. Elige el torneo</label>
|
|
33
40
|
<div
|
|
34
41
|
class="select-wrapper custom-dropdown liga-select"
|
|
35
42
|
tabindex="0"
|
|
@@ -42,11 +49,11 @@
|
|
|
42
49
|
>
|
|
43
50
|
<template v-if="loading">
|
|
44
51
|
<span class="placeholder"
|
|
45
|
-
><span class="loading-spinner select-spinner"></span>Cargando
|
|
52
|
+
><span class="loading-spinner select-spinner"></span>Cargando torneos...</span
|
|
46
53
|
>
|
|
47
54
|
</template>
|
|
48
55
|
<template v-else>
|
|
49
|
-
<span v-if="!selectedLiga" class="placeholder">Selecciona
|
|
56
|
+
<span v-if="!selectedLiga" class="placeholder">Selecciona el torneo</span>
|
|
50
57
|
<span v-else>{{ selectedLiga.name }}</span>
|
|
51
58
|
</template>
|
|
52
59
|
<span class="select-chevron" :class="{ open: showDropdownLigas }">
|
|
@@ -81,7 +88,7 @@
|
|
|
81
88
|
</div>
|
|
82
89
|
<div class="modal-row">
|
|
83
90
|
<div class="modal-group">
|
|
84
|
-
<label>2. Elige
|
|
91
|
+
<label>2. Elige la temporada</label>
|
|
85
92
|
<div
|
|
86
93
|
class="select-wrapper custom-dropdown torneo-select"
|
|
87
94
|
tabindex="0"
|
|
@@ -94,11 +101,12 @@
|
|
|
94
101
|
>
|
|
95
102
|
<template v-if="loading">
|
|
96
103
|
<span class="placeholder"
|
|
97
|
-
><span class="loading-spinner select-spinner"></span>Cargando
|
|
104
|
+
><span class="loading-spinner select-spinner"></span>Cargando
|
|
105
|
+
temporada...</span
|
|
98
106
|
>
|
|
99
107
|
</template>
|
|
100
108
|
<template v-else>
|
|
101
|
-
<span v-if="!selectedTorneo" class="placeholder">Elige
|
|
109
|
+
<span v-if="!selectedTorneo" class="placeholder">Elige la temporada</span>
|
|
102
110
|
<span v-else>{{ selectedTorneo.name }}</span>
|
|
103
111
|
</template>
|
|
104
112
|
<span class="select-chevron" :class="{ open: showDropdownTorneos }">
|
|
@@ -139,7 +147,7 @@
|
|
|
139
147
|
<div
|
|
140
148
|
class="select-wrapper custom-dropdown jornada-select"
|
|
141
149
|
tabindex="0"
|
|
142
|
-
@click="
|
|
150
|
+
@click="toggleJornadasDropdown"
|
|
143
151
|
@blur="showDropdownJornadas = false"
|
|
144
152
|
>
|
|
145
153
|
<div
|
|
@@ -175,7 +183,7 @@
|
|
|
175
183
|
</span>
|
|
176
184
|
</div>
|
|
177
185
|
<div
|
|
178
|
-
v-if="showDropdownJornadas && jornadas.length > 0
|
|
186
|
+
v-if="showDropdownJornadas && jornadas.length > 0"
|
|
179
187
|
class="custom-select-dropdown"
|
|
180
188
|
>
|
|
181
189
|
<div
|
|
@@ -264,7 +272,7 @@
|
|
|
264
272
|
</div>
|
|
265
273
|
<div class="header-separator" v-if="!showError409"></div>
|
|
266
274
|
<div class="modal-footer" v-if="!showError409">
|
|
267
|
-
<button class="cancel-btn" @click="
|
|
275
|
+
<button class="cancel-btn" @click="closeModal">Cancelar</button>
|
|
268
276
|
<button
|
|
269
277
|
class="next-btn"
|
|
270
278
|
:disabled="
|
|
@@ -281,7 +289,7 @@
|
|
|
281
289
|
</template>
|
|
282
290
|
|
|
283
291
|
<script setup>
|
|
284
|
-
import { ref, defineEmits, onMounted, onUnmounted } from 'vue'
|
|
292
|
+
import { ref, defineEmits, onMounted, onUnmounted, watch } from 'vue'
|
|
285
293
|
import axios from 'axios'
|
|
286
294
|
|
|
287
295
|
const props = defineProps({
|
|
@@ -293,6 +301,10 @@ const props = defineProps({
|
|
|
293
301
|
type: String,
|
|
294
302
|
required: true,
|
|
295
303
|
},
|
|
304
|
+
team: {
|
|
305
|
+
type: Number,
|
|
306
|
+
required: true,
|
|
307
|
+
},
|
|
296
308
|
templateId: {
|
|
297
309
|
type: String,
|
|
298
310
|
required: true,
|
|
@@ -328,6 +340,9 @@ const showDropdownPartidos = ref(false)
|
|
|
328
340
|
const loading = ref(false)
|
|
329
341
|
const loadingPartidos = ref(false)
|
|
330
342
|
const loadingJornadas = ref(false)
|
|
343
|
+
const loadingAutoseteo = ref(false) // Loading para el autoseteo automático
|
|
344
|
+
const autoseteoActivo = ref(false) // Controla si el autoseteo está activo
|
|
345
|
+
const cambioAutomatico = ref(false) // Indica si el cambio fue automático
|
|
331
346
|
const showError409 = ref(false) // Controla la visualización del mensaje de error 409
|
|
332
347
|
const torneosRaw = ref([]) // Aquí se guarda el response.data completo
|
|
333
348
|
const allPartidos = ref([]) // Guardar todos los partidos de la season seleccionada
|
|
@@ -339,21 +354,45 @@ const showDropdownTorneos = ref(false)
|
|
|
339
354
|
const showDropdownJornadas = ref(false)
|
|
340
355
|
|
|
341
356
|
function selectLiga(liga) {
|
|
357
|
+
// Si el usuario selecciona manualmente, desactivar autoseteo
|
|
358
|
+
if (autoseteoActivo.value) {
|
|
359
|
+
autoseteoActivo.value = false
|
|
360
|
+
loadingAutoseteo.value = false
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
cambioAutomatico.value = false // Marcar como cambio manual
|
|
342
364
|
selectedLiga.value = liga
|
|
343
365
|
showDropdownLigas.value = false
|
|
344
366
|
onLigaChange()
|
|
345
367
|
}
|
|
346
368
|
function selectTorneo(season) {
|
|
369
|
+
// Si el usuario selecciona manualmente, desactivar autoseteo
|
|
370
|
+
if (autoseteoActivo.value) {
|
|
371
|
+
autoseteoActivo.value = false
|
|
372
|
+
loadingAutoseteo.value = false
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
cambioAutomatico.value = false // Marcar como cambio manual
|
|
347
376
|
selectedTorneo.value = season
|
|
348
377
|
showDropdownTorneos.value = false
|
|
349
378
|
onTorneoChange()
|
|
350
379
|
}
|
|
351
380
|
function selectJornada(jornada) {
|
|
381
|
+
// Si el usuario selecciona manualmente, desactivar autoseteo
|
|
382
|
+
if (autoseteoActivo.value) {
|
|
383
|
+
autoseteoActivo.value = false
|
|
384
|
+
loadingAutoseteo.value = false
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
cambioAutomatico.value = false // Marcar como cambio manual
|
|
352
388
|
selectedJornada.value = jornada
|
|
353
389
|
showDropdownJornadas.value = false
|
|
354
390
|
onJornadaChange()
|
|
355
391
|
}
|
|
356
392
|
|
|
393
|
+
// Variable para almacenar el partido que se configurará automáticamente
|
|
394
|
+
const partidoParaConfigurar = ref(null)
|
|
395
|
+
|
|
357
396
|
// Función para cargar los torneos desde el endpoint
|
|
358
397
|
async function cargarTorneos() {
|
|
359
398
|
try {
|
|
@@ -390,6 +429,21 @@ async function cargarTorneos() {
|
|
|
390
429
|
selectedJornada.value = ''
|
|
391
430
|
partidos.value = []
|
|
392
431
|
selectedPartido.value = null
|
|
432
|
+
|
|
433
|
+
// Si hay un partido para configurar automáticamente, hacerlo ahora
|
|
434
|
+
if (partidoParaConfigurar.value) {
|
|
435
|
+
setTimeout(() => {
|
|
436
|
+
configurarSelectoresAutomaticamente(partidoParaConfigurar.value)
|
|
437
|
+
}, 100)
|
|
438
|
+
} else {
|
|
439
|
+
// Si no hay partido para configurar, forzar la carga de datos para tener opciones disponibles
|
|
440
|
+
if (ligas.value.length > 0) {
|
|
441
|
+
// Seleccionar la primera liga para cargar datos
|
|
442
|
+
const primeraLiga = ligas.value[0]
|
|
443
|
+
selectedLiga.value = primeraLiga
|
|
444
|
+
filtrarSeasonsPorTorneo(primeraLiga)
|
|
445
|
+
}
|
|
446
|
+
}
|
|
393
447
|
}
|
|
394
448
|
} catch (error) {
|
|
395
449
|
console.error('Error al cargar torneos:', error)
|
|
@@ -461,14 +515,13 @@ function onTorneoChange() {
|
|
|
461
515
|
.map((season) => season.id)
|
|
462
516
|
.filter(Boolean)
|
|
463
517
|
seasonIds.push(...relatedIds)
|
|
464
|
-
console.log('relatedIds', relatedIds)
|
|
465
518
|
}
|
|
466
519
|
|
|
467
520
|
cargarPartidosPorSeason(seasonIds)
|
|
468
|
-
}
|
|
469
|
-
|
|
521
|
+
} else {
|
|
522
|
+
// Si no hay torneo seleccionado, asegurar que el loading termine
|
|
470
523
|
loadingJornadas.value = false
|
|
471
|
-
}
|
|
524
|
+
}
|
|
472
525
|
}
|
|
473
526
|
|
|
474
527
|
async function cargarPartidosPorSeason(seasonIds) {
|
|
@@ -480,10 +533,7 @@ async function cargarPartidosPorSeason(seasonIds) {
|
|
|
480
533
|
const response = await axiosInstance.get(
|
|
481
534
|
`https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason?seasons=${seasonsQueryString}`,
|
|
482
535
|
)
|
|
483
|
-
console.log('response.data:: 2', response.data)
|
|
484
536
|
if (response.data.data && Array.isArray(response.data.data)) {
|
|
485
|
-
console.log('response.data:: 4ddd', response.data.data)
|
|
486
|
-
|
|
487
537
|
// Unir todos los arrays de partidos de todas las temporadas
|
|
488
538
|
const todosLosPartidos = response.data.data.reduce((acumulador, temporada) => {
|
|
489
539
|
if (temporada.games && Array.isArray(temporada.games)) {
|
|
@@ -492,8 +542,6 @@ async function cargarPartidosPorSeason(seasonIds) {
|
|
|
492
542
|
return acumulador
|
|
493
543
|
}, [])
|
|
494
544
|
|
|
495
|
-
console.log('Todos los partidos unidos:', todosLosPartidos)
|
|
496
|
-
|
|
497
545
|
// Guardar todos los partidos
|
|
498
546
|
allPartidos.value = todosLosPartidos.map((partido) => ({
|
|
499
547
|
label:
|
|
@@ -511,6 +559,7 @@ async function cargarPartidosPorSeason(seasonIds) {
|
|
|
511
559
|
|
|
512
560
|
// Filtrar partidos según templateType para jornadas válidas
|
|
513
561
|
let partidosValidos = allPartidos.value
|
|
562
|
+
|
|
514
563
|
if (props.templateType === '2' || props.templateType === 2) {
|
|
515
564
|
partidosValidos = partidosValidos.filter((p) => p.game_status === 1)
|
|
516
565
|
} else if (props.templateType === '1' || props.templateType === 1) {
|
|
@@ -518,14 +567,19 @@ async function cargarPartidosPorSeason(seasonIds) {
|
|
|
518
567
|
}
|
|
519
568
|
|
|
520
569
|
// Extraer matchdays únicos SOLO de partidos válidos
|
|
521
|
-
const
|
|
522
|
-
|
|
523
|
-
]
|
|
570
|
+
const matchdayIds = partidosValidos.map((p) => p.matchday_id).filter(Boolean)
|
|
571
|
+
|
|
572
|
+
const matchdaysUnicos = [...new Set(matchdayIds)]
|
|
524
573
|
|
|
525
574
|
// Llenar jornadas con los objetos matchday únicos y ordenar por matchday_id
|
|
526
575
|
jornadas.value = matchdaysUnicos
|
|
527
576
|
.map((id) => {
|
|
528
577
|
const partido = allPartidos.value.find((p) => p.matchday_id && p.matchday_id === id)
|
|
578
|
+
|
|
579
|
+
if (!partido) {
|
|
580
|
+
return null
|
|
581
|
+
}
|
|
582
|
+
|
|
529
583
|
return {
|
|
530
584
|
id,
|
|
531
585
|
name: partido.matchday_name
|
|
@@ -539,6 +593,7 @@ async function cargarPartidosPorSeason(seasonIds) {
|
|
|
539
593
|
.replace('Playoffs 6', 'Final Vuelta'),
|
|
540
594
|
}
|
|
541
595
|
})
|
|
596
|
+
.filter(Boolean) // Filtrar los nulls
|
|
542
597
|
.sort((a, b) => {
|
|
543
598
|
// Solo ordenar por matchday_id si ambos nombres empiezan con "Jornada"
|
|
544
599
|
const aIsJornada = a.name.startsWith('Jornada')
|
|
@@ -554,11 +609,21 @@ async function cargarPartidosPorSeason(seasonIds) {
|
|
|
554
609
|
return 0 // Mantener orden original para playoffs/finales
|
|
555
610
|
}
|
|
556
611
|
})
|
|
557
|
-
console.log('jornadas: ', jornadas)
|
|
558
612
|
// NO seleccionar automáticamente ninguna jornada
|
|
559
613
|
selectedJornada.value = ''
|
|
560
614
|
partidos.value = []
|
|
561
615
|
selectedPartido.value = null
|
|
616
|
+
|
|
617
|
+
// Asegurar que el loading de jornadas termine
|
|
618
|
+
loadingJornadas.value = false
|
|
619
|
+
|
|
620
|
+
// Después de cargar gamesBySeason, volver a intentar setear la información automáticamente
|
|
621
|
+
// SOLO si el autoseteo está activo (no cuando el usuario cambia manualmente)
|
|
622
|
+
if (partidoParaConfigurar.value && autoseteoActivo.value) {
|
|
623
|
+
setTimeout(() => {
|
|
624
|
+
configurarSelectoresSoloSetear(partidoParaConfigurar.value)
|
|
625
|
+
}, 200)
|
|
626
|
+
}
|
|
562
627
|
} else {
|
|
563
628
|
allPartidos.value = []
|
|
564
629
|
jornadas.value = []
|
|
@@ -573,6 +638,8 @@ async function cargarPartidosPorSeason(seasonIds) {
|
|
|
573
638
|
selectedJornada.value = ''
|
|
574
639
|
partidos.value = []
|
|
575
640
|
selectedPartido.value = null
|
|
641
|
+
// Asegurar que el loading de jornadas también termine en caso de error
|
|
642
|
+
loadingJornadas.value = false
|
|
576
643
|
} finally {
|
|
577
644
|
loadingPartidos.value = false
|
|
578
645
|
}
|
|
@@ -636,8 +703,6 @@ async function generarReporte() {
|
|
|
636
703
|
},
|
|
637
704
|
)
|
|
638
705
|
|
|
639
|
-
console.log('Reporte generado exitosamente:', response.data)
|
|
640
|
-
|
|
641
706
|
// Emitir evento con los datos del reporte generado
|
|
642
707
|
emit('generar', {
|
|
643
708
|
liga: selectedLiga.value,
|
|
@@ -667,7 +732,18 @@ async function generarReporte() {
|
|
|
667
732
|
}
|
|
668
733
|
}
|
|
669
734
|
|
|
735
|
+
function toggleJornadasDropdown() {
|
|
736
|
+
showDropdownJornadas.value = !showDropdownJornadas.value
|
|
737
|
+
}
|
|
738
|
+
|
|
670
739
|
function selectPartido(partido) {
|
|
740
|
+
// Si el usuario selecciona manualmente, desactivar autoseteo
|
|
741
|
+
if (autoseteoActivo.value) {
|
|
742
|
+
autoseteoActivo.value = false
|
|
743
|
+
loadingAutoseteo.value = false
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
cambioAutomatico.value = false // Marcar como cambio manual
|
|
671
747
|
selectedPartido.value = partido
|
|
672
748
|
showDropdownPartidos.value = false
|
|
673
749
|
}
|
|
@@ -682,14 +758,259 @@ function restaurarScroll() {
|
|
|
682
758
|
onMounted(() => {
|
|
683
759
|
cargarTorneos()
|
|
684
760
|
bloquearScroll()
|
|
761
|
+
cargarUltimosJuegos()
|
|
762
|
+
|
|
763
|
+
// Activar loading de autoseteo desde el inicio si hay partido para configurar
|
|
764
|
+
if (partidoParaConfigurar.value) {
|
|
765
|
+
loadingAutoseteo.value = true
|
|
766
|
+
autoseteoActivo.value = true
|
|
767
|
+
}
|
|
768
|
+
})
|
|
769
|
+
|
|
770
|
+
// Watchers para autoseteo automático sin setTimeout
|
|
771
|
+
watch(selectedLiga, (nuevaLiga, anteriorLiga) => {
|
|
772
|
+
// Solo ejecutar si es autoseteo (no cambio manual) y no es un cambio automático
|
|
773
|
+
if (
|
|
774
|
+
nuevaLiga &&
|
|
775
|
+
partidoParaConfigurar.value &&
|
|
776
|
+
autoseteoActivo.value &&
|
|
777
|
+
!anteriorLiga &&
|
|
778
|
+
!cambioAutomatico.value
|
|
779
|
+
) {
|
|
780
|
+
// Buscar torneo automáticamente
|
|
781
|
+
const torneoEncontrado = torneos.value.find(
|
|
782
|
+
(torneo) => torneo.id === partidoParaConfigurar.value.season_id,
|
|
783
|
+
)
|
|
784
|
+
if (torneoEncontrado) {
|
|
785
|
+
cambioAutomatico.value = true
|
|
786
|
+
selectedTorneo.value = torneoEncontrado
|
|
787
|
+
// Ejecutar directamente la función que hace la petición a gamesBySeason
|
|
788
|
+
cargarPartidosPorSeason([torneoEncontrado.id])
|
|
789
|
+
cambioAutomatico.value = false
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
// Removemos la condición else if que detectaba cambios manuales en liga
|
|
793
|
+
// porque esto estaba causando problemas cuando se limpiaban otros valores
|
|
794
|
+
})
|
|
795
|
+
|
|
796
|
+
watch(selectedTorneo, (nuevoTorneo, anteriorTorneo) => {
|
|
797
|
+
// Solo ejecutar si es autoseteo (no cambio manual) y no es un cambio automático
|
|
798
|
+
if (
|
|
799
|
+
nuevoTorneo &&
|
|
800
|
+
partidoParaConfigurar.value &&
|
|
801
|
+
autoseteoActivo.value &&
|
|
802
|
+
!anteriorTorneo &&
|
|
803
|
+
!cambioAutomatico.value
|
|
804
|
+
) {
|
|
805
|
+
// Buscar jornada automáticamente después de que se carguen las jornadas
|
|
806
|
+
setTimeout(() => {
|
|
807
|
+
const jornadaEncontrada = jornadas.value.find(
|
|
808
|
+
(jornada) => jornada.id === partidoParaConfigurar.value.matchday_id,
|
|
809
|
+
)
|
|
810
|
+
if (jornadaEncontrada) {
|
|
811
|
+
cambioAutomatico.value = true
|
|
812
|
+
selectedJornada.value = jornadaEncontrada
|
|
813
|
+
// Ejecutar directamente la función que filtra partidos por jornada
|
|
814
|
+
filtrarPartidosPorJornada(jornadaEncontrada)
|
|
815
|
+
cambioAutomatico.value = false
|
|
816
|
+
}
|
|
817
|
+
}, 500) // Solo un setTimeout para esperar que se carguen las jornadas
|
|
818
|
+
} else if (nuevoTorneo && anteriorTorneo && autoseteoActivo.value) {
|
|
819
|
+
// Si el usuario cambió el torneo manualmente, desactivar autoseteo
|
|
820
|
+
autoseteoActivo.value = false
|
|
821
|
+
loadingAutoseteo.value = false
|
|
822
|
+
}
|
|
823
|
+
})
|
|
824
|
+
|
|
825
|
+
watch(selectedJornada, (nuevaJornada, anteriorJornada) => {
|
|
826
|
+
// Solo ejecutar si es autoseteo (no cambio manual) y no es un cambio automático
|
|
827
|
+
if (
|
|
828
|
+
nuevaJornada &&
|
|
829
|
+
partidoParaConfigurar.value &&
|
|
830
|
+
autoseteoActivo.value &&
|
|
831
|
+
!anteriorJornada &&
|
|
832
|
+
!cambioAutomatico.value
|
|
833
|
+
) {
|
|
834
|
+
setTimeout(() => {
|
|
835
|
+
// Primer intento: buscar por game_id
|
|
836
|
+
const partidoEncontrado = partidos.value.find(
|
|
837
|
+
(p) =>
|
|
838
|
+
p.game_id === partidoParaConfigurar.value.game_id ||
|
|
839
|
+
p.id === partidoParaConfigurar.value.game_id,
|
|
840
|
+
)
|
|
841
|
+
|
|
842
|
+
if (partidoEncontrado) {
|
|
843
|
+
selectedPartido.value = partidoEncontrado
|
|
844
|
+
loadingAutoseteo.value = false
|
|
845
|
+
autoseteoActivo.value = false
|
|
846
|
+
return
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
// Segundo intento: buscar por equipos
|
|
850
|
+
const partidoAlternativo = partidos.value.find(
|
|
851
|
+
(p) =>
|
|
852
|
+
p.home_team === partidoParaConfigurar.value.home_team &&
|
|
853
|
+
p.visiting_team === partidoParaConfigurar.value.visiting_team,
|
|
854
|
+
)
|
|
855
|
+
|
|
856
|
+
if (partidoAlternativo) {
|
|
857
|
+
selectedPartido.value = partidoAlternativo
|
|
858
|
+
loadingAutoseteo.value = false
|
|
859
|
+
autoseteoActivo.value = false
|
|
860
|
+
return
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
// Tercer intento: buscar en todos los partidos (allPartidos)
|
|
864
|
+
if (allPartidos.value.length > 0) {
|
|
865
|
+
const partidoEnTodos = allPartidos.value.find(
|
|
866
|
+
(p) =>
|
|
867
|
+
p.game_id === partidoParaConfigurar.value.game_id ||
|
|
868
|
+
p.id === partidoParaConfigurar.value.game_id,
|
|
869
|
+
)
|
|
870
|
+
|
|
871
|
+
if (partidoEnTodos) {
|
|
872
|
+
selectedPartido.value = partidoEnTodos
|
|
873
|
+
// Desactivar loading de autoseteo
|
|
874
|
+
loadingAutoseteo.value = false
|
|
875
|
+
autoseteoActivo.value = false
|
|
876
|
+
return
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
loadingAutoseteo.value = false
|
|
880
|
+
autoseteoActivo.value = false
|
|
881
|
+
}, 1000) // Solo un setTimeout para esperar que se carguen los partidos
|
|
882
|
+
} else if (nuevaJornada && anteriorJornada && autoseteoActivo.value) {
|
|
883
|
+
// Si el usuario cambió la jornada manualmente, desactivar autoseteo
|
|
884
|
+
autoseteoActivo.value = false
|
|
885
|
+
loadingAutoseteo.value = false
|
|
886
|
+
}
|
|
685
887
|
})
|
|
686
888
|
|
|
687
889
|
onUnmounted(() => {
|
|
688
890
|
restaurarScroll()
|
|
689
891
|
})
|
|
690
892
|
|
|
893
|
+
// Función para cargar los últimos juegos del equipo
|
|
894
|
+
async function cargarUltimosJuegos() {
|
|
895
|
+
try {
|
|
896
|
+
const response = await axiosInstance.get(
|
|
897
|
+
`https://m9qip57rsh.execute-api.us-east-2.amazonaws.com/prod/teams/${props.team}/last-games`,
|
|
898
|
+
)
|
|
899
|
+
|
|
900
|
+
// Imprimir datos según el tipo de template
|
|
901
|
+
if (props.templateType === '1' || props.templateType === 1) {
|
|
902
|
+
partidoParaConfigurar.value = response.data.data.prematch
|
|
903
|
+
// Activar loading de autoseteo si hay partido
|
|
904
|
+
if (response.data.data.prematch) {
|
|
905
|
+
loadingAutoseteo.value = true
|
|
906
|
+
autoseteoActivo.value = true
|
|
907
|
+
}
|
|
908
|
+
} else if (props.templateType === '2' || props.templateType === 2) {
|
|
909
|
+
partidoParaConfigurar.value = response.data.data.postmatch
|
|
910
|
+
// Activar loading de autoseteo si hay partido
|
|
911
|
+
if (response.data.data.postmatch) {
|
|
912
|
+
loadingAutoseteo.value = true
|
|
913
|
+
autoseteoActivo.value = true
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
} catch (error) {
|
|
917
|
+
console.error('Error al cargar últimos juegos:', error)
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
// Función para configurar automáticamente los selectores basado en el partido
|
|
922
|
+
function configurarSelectoresAutomaticamente(partido) {
|
|
923
|
+
if (!partido || !partido.game_id) {
|
|
924
|
+
return
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
// Buscar y seleccionar la liga/torneo
|
|
928
|
+
if (partido.tournament_id && ligas.value.length > 0) {
|
|
929
|
+
const ligaEncontrada = ligas.value.find((liga) => liga.id === partido.tournament_id)
|
|
930
|
+
if (ligaEncontrada) {
|
|
931
|
+
selectedLiga.value = ligaEncontrada
|
|
932
|
+
|
|
933
|
+
// Cargar torneos para esta liga
|
|
934
|
+
filtrarSeasonsPorTorneo(ligaEncontrada)
|
|
935
|
+
// Los watchers se encargarán del resto automáticamente
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
// Función para solo setear los selectores sin cargar datos (evita ciclos)
|
|
941
|
+
function configurarSelectoresSoloSetear(partido) {
|
|
942
|
+
if (!partido || !partido.game_id) {
|
|
943
|
+
return
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// Buscar y seleccionar la liga/torneo
|
|
947
|
+
if (partido.tournament_id && ligas.value.length > 0) {
|
|
948
|
+
const ligaEncontrada = ligas.value.find((liga) => liga.id === partido.tournament_id)
|
|
949
|
+
if (ligaEncontrada) {
|
|
950
|
+
selectedLiga.value = ligaEncontrada
|
|
951
|
+
|
|
952
|
+
// Buscar y seleccionar la temporada (ya están cargados los torneos)
|
|
953
|
+
if (partido.season_id && torneos.value.length > 0) {
|
|
954
|
+
const torneoEncontrado = torneos.value.find((torneo) => torneo.id === partido.season_id)
|
|
955
|
+
if (torneoEncontrado) {
|
|
956
|
+
selectedTorneo.value = torneoEncontrado
|
|
957
|
+
|
|
958
|
+
// Buscar y seleccionar la jornada (ya están cargadas las jornadas)
|
|
959
|
+
if (partido.matchday_id && jornadas.value.length > 0) {
|
|
960
|
+
const jornadaEncontrada = jornadas.value.find(
|
|
961
|
+
(jornada) => jornada.id === partido.matchday_id,
|
|
962
|
+
)
|
|
963
|
+
if (jornadaEncontrada) {
|
|
964
|
+
selectedJornada.value = jornadaEncontrada
|
|
965
|
+
|
|
966
|
+
// Buscar y seleccionar el partido (ya están cargados los partidos)
|
|
967
|
+
if (partido.game_id && partidos.value.length > 0) {
|
|
968
|
+
const partidoEncontrado = partidos.value.find(
|
|
969
|
+
(p) => p.game_id === partido.game_id || p.id === partido.game_id,
|
|
970
|
+
)
|
|
971
|
+
if (partidoEncontrado) {
|
|
972
|
+
selectedPartido.value = partidoEncontrado
|
|
973
|
+
} else {
|
|
974
|
+
// Intentar buscar por otros campos
|
|
975
|
+
const partidoAlternativo = partidos.value.find(
|
|
976
|
+
(p) =>
|
|
977
|
+
p.home_team === partido.home_team &&
|
|
978
|
+
p.visiting_team === partido.visiting_team,
|
|
979
|
+
)
|
|
980
|
+
if (partidoAlternativo) {
|
|
981
|
+
selectedPartido.value = partidoAlternativo
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
|
|
691
993
|
function closeModal() {
|
|
692
994
|
showError409.value = false
|
|
995
|
+
|
|
996
|
+
// Restaurar todos los valores del autoseteo
|
|
997
|
+
selectedLiga.value = ''
|
|
998
|
+
selectedTorneo.value = ''
|
|
999
|
+
selectedJornada.value = ''
|
|
1000
|
+
selectedPartido.value = null
|
|
1001
|
+
// NO limpiar partidoParaConfigurar.value para mantener los datos del autoseteo
|
|
1002
|
+
|
|
1003
|
+
// Limpiar las listas de opciones
|
|
1004
|
+
torneos.value = []
|
|
1005
|
+
jornadas.value = []
|
|
1006
|
+
partidos.value = []
|
|
1007
|
+
|
|
1008
|
+
// Cerrar todos los dropdowns
|
|
1009
|
+
showDropdownLigas.value = false
|
|
1010
|
+
showDropdownTorneos.value = false
|
|
1011
|
+
showDropdownJornadas.value = false
|
|
1012
|
+
showDropdownPartidos.value = false
|
|
1013
|
+
|
|
693
1014
|
restaurarScroll()
|
|
694
1015
|
emit('close')
|
|
695
1016
|
}
|
|
@@ -1175,4 +1496,35 @@ select:focus {
|
|
|
1175
1496
|
.accept-btn:hover {
|
|
1176
1497
|
background: #b6d94c;
|
|
1177
1498
|
}
|
|
1499
|
+
|
|
1500
|
+
/* Loading overlay para autoseteo */
|
|
1501
|
+
.loading-autoseteo-overlay {
|
|
1502
|
+
position: absolute;
|
|
1503
|
+
top: 0;
|
|
1504
|
+
left: 0;
|
|
1505
|
+
right: 0;
|
|
1506
|
+
bottom: 0;
|
|
1507
|
+
background: rgba(46, 59, 70, 0.8);
|
|
1508
|
+
display: flex;
|
|
1509
|
+
align-items: center;
|
|
1510
|
+
justify-content: center;
|
|
1511
|
+
z-index: 1000;
|
|
1512
|
+
border-radius: 10px;
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
.loading-autoseteo-content {
|
|
1516
|
+
display: flex;
|
|
1517
|
+
flex-direction: column;
|
|
1518
|
+
align-items: center;
|
|
1519
|
+
gap: 16px;
|
|
1520
|
+
color: #fff;
|
|
1521
|
+
text-align: center;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
.loading-autoseteo-content p {
|
|
1525
|
+
font-family: Poppins-Regular;
|
|
1526
|
+
font-size: 14px;
|
|
1527
|
+
margin: 0;
|
|
1528
|
+
color: #fff;
|
|
1529
|
+
}
|
|
1178
1530
|
</style>
|
|
@@ -1,28 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="prematch-bg">
|
|
3
3
|
<!-- Escudos de fondo -->
|
|
4
|
-
<div class="background-shields">
|
|
5
|
-
<div class="shield-left">
|
|
6
|
-
<img
|
|
7
|
-
:src="
|
|
8
|
-
'https://golstatsimages.blob.core.windows.net/teams-150/' +
|
|
9
|
-
report.game.home_team +
|
|
10
|
-
'.png'
|
|
11
|
-
"
|
|
12
|
-
alt="Escudo local"
|
|
13
|
-
/>
|
|
14
|
-
</div>
|
|
15
|
-
<div class="shield-right">
|
|
16
|
-
<img
|
|
17
|
-
:src="
|
|
18
|
-
'https://golstatsimages.blob.core.windows.net/teams-150/' +
|
|
19
|
-
report.game.visiting_team +
|
|
20
|
-
'.png'
|
|
21
|
-
"
|
|
22
|
-
alt="Escudo visitante"
|
|
23
|
-
/>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
4
|
|
|
27
5
|
<div class="title">Análisis <span class="highlight">Postmatch</span></div>
|
|
28
6
|
<div class="subtitle">
|
|
@@ -1,28 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="prematch-bg">
|
|
3
3
|
<!-- Escudos de fondo -->
|
|
4
|
-
<div class="background-shields">
|
|
5
|
-
<div class="shield-left">
|
|
6
|
-
<img
|
|
7
|
-
:src="
|
|
8
|
-
'https://golstatsimages.blob.core.windows.net/teams-150/' +
|
|
9
|
-
report.game.home_team +
|
|
10
|
-
'.png'
|
|
11
|
-
"
|
|
12
|
-
alt="Escudo local"
|
|
13
|
-
/>
|
|
14
|
-
</div>
|
|
15
|
-
<div class="shield-right">
|
|
16
|
-
<img
|
|
17
|
-
:src="
|
|
18
|
-
'https://golstatsimages.blob.core.windows.net/teams-150/' +
|
|
19
|
-
report.game.visiting_team +
|
|
20
|
-
'.png'
|
|
21
|
-
"
|
|
22
|
-
alt="Escudo visitante"
|
|
23
|
-
/>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
4
|
|
|
27
5
|
<div class="title">Análisis <span class="highlight">Postmatch</span></div>
|
|
28
6
|
<div class="subtitle">
|