@golstats/gsc-reports 1.0.75 → 1.0.77

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golstats/gsc-reports",
3
- "version": "1.0.75",
3
+ "version": "1.0.77",
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.108",
50
+ "@golstats/gsc-template-report-maker": "^1.0.110",
51
51
  "axios": "^1.10.0",
52
52
  "gridstack": "^12.1.1",
53
53
  "tiny-emitter": "^2.1.0",
@@ -108,8 +108,9 @@
108
108
  :template-id="generarTemplateId"
109
109
  :template-type="generarTemplateType"
110
110
  :template="generarTemplate"
111
+ :show-error409-on-mount="showError409InModal"
111
112
  v-if="showModalGenerarReporte"
112
- @close="showModalGenerarReporte = false"
113
+ @close="handleCloseModalGenerarReporte"
113
114
  @switch-to-reports="$emit('switch-to-reports')"
114
115
  @open-configurar-contenido="onOpenConfigurarContenido"
115
116
  />
@@ -213,6 +214,7 @@ const showModalDuplicateTemplate = ref(false)
213
214
  const showModalDeleteTemplate = ref(false)
214
215
  const showModalConfigurarContenido = ref(false)
215
216
  const configurarContenidoData = ref(null)
217
+ const showError409InModal = ref(false)
216
218
  const renameTemplateName = ref('')
217
219
  const renameTemplateType = ref('')
218
220
  const duplicateTemplateName = ref('')
@@ -374,10 +376,17 @@ function onEditTemplate(template) {
374
376
  emit('edit-template', template)
375
377
  }
376
378
 
379
+ // Función para manejar cuando se cierra ModalGenerarReporte
380
+ function handleCloseModalGenerarReporte() {
381
+ showModalGenerarReporte.value = false
382
+ showError409InModal.value = false // Resetear el estado del error
383
+ }
384
+
377
385
  // Función para manejar cuando se detecta componente Fortalezas y se necesita abrir ModalConfigurarContenido
378
386
  function onOpenConfigurarContenido(data) {
379
387
  configurarContenidoData.value = data
380
388
  showModalGenerarReporte.value = false
389
+ showError409InModal.value = false // Asegurar que el error esté reseteado
381
390
  showModalConfigurarContenido.value = true
382
391
  }
383
392
 
@@ -468,7 +477,25 @@ async function onNextFromConfigurar(options) {
468
477
  configurarContenidoData.value = null
469
478
  } catch (error) {
470
479
  console.error('Error al generar el reporte:', error)
471
- alert('Error al generar el reporte. Por favor, intenta de nuevo.')
480
+
481
+ // Verificar si es error 409 (Report with same template and game already exists)
482
+ if (error.response && error.response.status === 409) {
483
+ // Volver a abrir ModalGenerarReporte con el error 409 visible desde el inicio
484
+ // Necesitamos restaurar los datos del template para mostrar el modal
485
+ if (configurarContenidoData.value) {
486
+ generarTemplateId.value = configurarContenidoData.value.template.id
487
+ generarTemplateType.value = configurarContenidoData.value.template.template_type
488
+ generarTemplate.value = configurarContenidoData.value.template
489
+ // Activar el flag para mostrar el error 409 desde el inicio
490
+ showError409InModal.value = true
491
+ // Usar nextTick para asegurar que el modal se monte antes de mostrar el error
492
+ await nextTick()
493
+ showModalGenerarReporte.value = true
494
+ }
495
+ } else {
496
+ // Para otros errores, mostrar alerta genérica
497
+ alert('Error al generar el reporte. Por favor, intenta de nuevo.')
498
+ }
472
499
  }
473
500
  }
474
501
 
@@ -279,22 +279,35 @@ function tieneComponenteFortalezas() {
279
279
 
280
280
  // Función para contar Fortalezas del equipo propio y del rival
281
281
  function contarFortalezas() {
282
+ console.log(
283
+ '5555555555555555 Nuevo Valor al crear fortalezas:: : : :: : : : :: : : :',
284
+ props.template,
285
+ )
282
286
  if (!props.template || !props.template.pages) {
283
287
  return { equipo: 0, rival: 0, total: 0 }
284
288
  }
289
+ console.log('Nuevo Valor al crear fortalezas:: : : :: : : : :: : : :', props.template)
285
290
 
286
291
  let countEquipo = 0
287
292
  let countRival = 0
288
293
 
289
294
  // Iterar sobre todas las pages del template
290
295
  for (const page of props.template.pages) {
296
+ console.log('page 11 5555555555555555555555555555555555 ', page)
291
297
  // Verificar si la page tiene components
292
298
  if (page.components && Array.isArray(page.components)) {
299
+ console.log('page entro')
293
300
  // Filtrar componentes Fortalezas
294
301
  const componentesFortalezas = page.components.filter(
295
- (component) => component.name === 'Fortalezas' || component.id === 15,
302
+ (component) =>
303
+ component.componentName === 'GSCStrengths' ||
304
+ component.id === 15 ||
305
+ component.name === 'Fortalezas',
306
+ )
307
+ console.log(
308
+ 'componentesFortalezas componentesFortalezas componentesFortalezas',
309
+ componentesFortalezas,
296
310
  )
297
-
298
311
  // Para cada componente Fortalezas, verificar dynamicFilters
299
312
  for (const component of componentesFortalezas) {
300
313
  // Verificar si tiene dynamicFilters y es un array
@@ -306,6 +319,14 @@ function contarFortalezas() {
306
319
  countEquipo += component.dynamicFilters[1]
307
320
  } else if (component.dynamicFilters[0] === 2) {
308
321
  countRival += component.dynamicFilters[1]
322
+ } else {
323
+ if (component.dynamicFilters[0] === 3) {
324
+ if (component.filterMultiple.isHomeTeam) {
325
+ countEquipo += component.dynamicFilters[1]
326
+ } else {
327
+ countRival += component.dynamicFilters[1]
328
+ }
329
+ }
309
330
  }
310
331
  }
311
332
  }
@@ -317,6 +317,10 @@ const props = defineProps({
317
317
  type: Object,
318
318
  required: false,
319
319
  },
320
+ showError409OnMount: {
321
+ type: Boolean,
322
+ default: false,
323
+ },
320
324
  })
321
325
 
322
326
  const emit = defineEmits(['close', 'generar', 'switch-to-reports', 'open-configurar-contenido'])
@@ -681,7 +685,10 @@ function tieneComponenteFortalezas() {
681
685
  // Verificar si la page tiene components
682
686
  if (page.components && Array.isArray(page.components)) {
683
687
  // Buscar si existe algún componente con id = 15
684
- const tieneFortalezas = page.components.some((component) => component.name === 'Fortalezas')
688
+ const tieneFortalezas = page.components.some(
689
+ (component) =>
690
+ component.name === 'Fortalezas' || component.componentName === 'GSCStrengths',
691
+ )
685
692
  if (tieneFortalezas) {
686
693
  return true
687
694
  }
@@ -794,7 +801,21 @@ function restaurarScroll() {
794
801
  document.body.style.overflow = ''
795
802
  }
796
803
 
804
+ // Watcher para el prop showError409OnMount
805
+ watch(
806
+ () => props.showError409OnMount,
807
+ (newValue) => {
808
+ showError409.value = newValue
809
+ },
810
+ { immediate: true },
811
+ )
812
+
797
813
  onMounted(() => {
814
+ // Si se debe mostrar el error 409 desde el inicio, configurarlo
815
+ if (props.showError409OnMount) {
816
+ showError409.value = true
817
+ }
818
+
798
819
  cargarTorneos()
799
820
  bloquearScroll()
800
821
  cargarUltimosJuegos()