Files
Laucha1312 cc049c6cb6 3
2026-06-04 15:20:26 -03:00

151 lines
6.7 KiB
PHP

<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reporte Semanal ONAPB</title>
<style>
body { font-family: Arial, sans-serif; background: #f5f5f5; margin: 0; padding: 20px; color: #333; }
.container { max-width: 700px; margin: 0 auto; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.header { background: #b00000; color: white; padding: 28px 32px; }
.header h1 { margin: 0; font-size: 24px; }
.header p { margin: 6px 0 0; opacity: 0.85; font-size: 14px; }
.section { padding: 20px 32px; border-bottom: 1px solid #eee; }
.section h2 { font-size: 16px; color: #b00000; margin: 0 0 14px; border-left: 4px solid #b00000; padding-left: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: #f0f0f0; text-align: left; padding: 8px 10px; font-size: 12px; text-transform: uppercase; color: #666; }
td { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; }
tr:last-child td { border-bottom: none; }
.stat-row { display: flex; gap: 16px; flex-wrap: wrap; }
.stat-box { flex: 1; min-width: 120px; background: #f9f9f9; border-radius: 6px; padding: 14px 16px; text-align: center; border: 1px solid #eee; }
.stat-box .num { font-size: 28px; font-weight: bold; color: #b00000; }
.stat-box .lbl { font-size: 12px; color: #666; margin-top: 4px; }
.footer { padding: 16px 32px; font-size: 12px; color: #999; text-align: center; }
.empty { color: #aaa; font-style: italic; padding: 10px 0; font-size: 13px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: bold; }
.badge-win { background: #e8f5e9; color: #2e7d32; }
.badge-lose { background: #ffebee; color: #c62828; }
.badge-draw { background: #fff3e0; color: #e65100; }
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>📊 Reporte Semanal ONAPB</h1>
<p>Semana del {{ $semanaAnteriorDesde->format('d/m/Y') }} al {{ $semanaAnteriorHasta->format('d/m/Y') }}</p>
</div>
{{-- Estadísticas rápidas --}}
<div class="section">
<h2>Resumen</h2>
<div class="stat-row">
<div class="stat-box">
<div class="num">{{ $jugados->count() }}</div>
<div class="lbl">Partidos jugados</div>
</div>
<div class="stat-box">
<div class="num">{{ $proximos->count() }}</div>
<div class="lbl">Próximos partidos</div>
</div>
<div class="stat-box">
<div class="num">{{ $qrsSemana }}</div>
<div class="lbl">QRs generados</div>
</div>
<div class="stat-box">
<div class="num">{{ $qrsValidados }}</div>
<div class="lbl">QRs validados</div>
</div>
</div>
</div>
{{-- Resultados de la semana --}}
<div class="section">
<h2>Resultados de la Semana</h2>
@if($jugados->isEmpty())
<p class="empty">No hubo partidos con resultado cargado esta semana.</p>
@else
<table>
<thead>
<tr>
<th>Fecha</th>
<th>Local</th>
<th>Resultado</th>
<th>Visitante</th>
</tr>
</thead>
<tbody>
@foreach($jugados as $e)
@php
$ml = $e->marcador_local;
$mv = $e->marcador_visitante;
$badgeLocal = $ml > $mv ? 'badge-win' : ($ml < $mv ? 'badge-lose' : 'badge-draw');
$badgeVisitante= $mv > $ml ? 'badge-win' : ($mv < $ml ? 'badge-lose' : 'badge-draw');
@endphp
<tr>
<td>{{ $e->fecha_evento->format('d/m') }}</td>
<td><span class="badge {{ $badgeLocal }}">{{ $e->equipoLocal->club->nombre ?? '?' }}</span></td>
<td style="text-align:center; font-weight:bold;">{{ $ml }} {{ $mv }}</td>
<td><span class="badge {{ $badgeVisitante }}">{{ $e->equipoVisitante->club->nombre ?? '?' }}</span></td>
</tr>
@endforeach
</tbody>
</table>
@endif
</div>
{{-- Próximos partidos --}}
<div class="section">
<h2>Próximos Partidos (7 días)</h2>
@if($proximos->isEmpty())
<p class="empty">No hay partidos programados para los próximos 7 días.</p>
@else
<table>
<thead>
<tr><th>Fecha</th><th>Hora</th><th>Partido</th><th>Sede</th></tr>
</thead>
<tbody>
@foreach($proximos as $e)
<tr>
<td>{{ $e->fecha_evento->format('d/m') }}</td>
<td>{{ $e->hora_inicio ? \Carbon\Carbon::parse($e->hora_inicio)->format('H:i') : '—' }}</td>
<td>{{ $e->equipoLocal->club->nombre ?? '?' }} vs {{ $e->equipoVisitante->club->nombre ?? '?' }}</td>
<td>{{ $e->sede ?: '—' }}</td>
</tr>
@endforeach
</tbody>
</table>
@endif
</div>
{{-- Top goleadores --}}
<div class="section">
<h2>🏆 Top Goleadores</h2>
@if($topGoleadores->isEmpty())
<p class="empty">Sin estadísticas de puntos cargadas aún.</p>
@else
<table>
<thead>
<tr><th>#</th><th>Jugador</th><th>Pts totales</th><th>Partidos</th></tr>
</thead>
<tbody>
@foreach($topGoleadores as $i => $g)
<tr>
<td>{{ $i + 1 }}</td>
<td>{{ $g->apellido }}, {{ $g->nombre }}</td>
<td><strong>{{ $g->total_puntos }}</strong></td>
<td>{{ $g->partidos }}</td>
</tr>
@endforeach
</tbody>
</table>
@endif
</div>
<div class="footer">
Este reporte fue generado automáticamente por el sistema OnAPB el {{ now()->format('d/m/Y H:i') }}.<br>
<a href="https://onapb.com/admin" style="color:#b00000;">Ir al panel de administración</a>
</div>
</div>
</body>
</html>