refactor(tickets): reuse dynamic columns in exports

This commit is contained in:
2026-08-31 12:31:32 -03:00
parent bda94d02af
commit 636e39e98e
4 changed files with 90 additions and 87 deletions

View File

@@ -18,16 +18,6 @@
.number { text-align: right; }
.ticket-id { font-size: 6.8px; word-break: break-all; }
.empty { color: #66736b; padding: 24px; text-align: center; }
.order { width: 7%; }
.category { width: 9%; }
.product { width: 10%; }
.type { width: 9%; }
.amount { width: 8%; }
.client { width: 14%; }
.identifier { width: 17%; }
.date { width: 10%; }
.status { width: 7%; }
.scanner { width: 9%; }
</style>
</head>
<body>
@@ -43,34 +33,26 @@
<table>
<thead>
<tr>
<th class="order"> de orden</th>
<th class="category">Categoría</th>
<th class="product">Producto</th>
<th class="type">Tipo</th>
<th class="amount number">Importe</th>
<th class="client">Cliente</th>
<th class="identifier">ID</th>
<th class="date">Fecha</th>
<th class="status">Estado</th>
<th class="scanner">Escaneado por</th>
@foreach ($columns as $column)
<th
style="width: {{ $column['width'] }}"
@class(['number' => $column['type'] === 'currency'])
>{{ $column['label'] }}</th>
@endforeach
</tr>
</thead>
<tbody>
@forelse ($tickets as $ticket)
<tr>
<td>{{ $ticket['order_number'] === null ? '-' : '#'.$ticket['order_number'] }}</td>
<td>{{ $ticket['category'] }}</td>
<td>{{ $ticket['product'] }}</td>
<td>{{ $ticket['type'] }}</td>
<td class="number">{{ $ticket['amount'] === null ? '-' : '$'.number_format($ticket['amount'], 2, ',', '.') }}</td>
<td>{{ $ticket['client'] }}</td>
<td class="ticket-id">{{ $ticket['ticket'] }}</td>
<td>{{ $ticket['date']?->copy()->timezone($timeZone)->format('d/m/Y H:i') ?? '-' }}</td>
<td>{{ $ticket['status'] }}</td>
<td>{{ $ticket['scanned_by'] }}</td>
@foreach ($columns as $column)
<td @class([
'number' => $column['type'] === 'currency',
'ticket-id' => $column['key'] === 'ticket',
])>{{ $ticket[$column['key']] }}</td>
@endforeach
</tr>
@empty
<tr><td class="empty" colspan="10">No hay tickets para los criterios seleccionados.</td></tr>
<tr><td class="empty" colspan="{{ count($columns) }}">No hay tickets para los criterios seleccionados.</td></tr>
@endforelse
</tbody>
</table>