feat(tickets): extend FFI ticket column presentation

This commit is contained in:
2026-09-01 14:29:18 -03:00
parent 5e541f7cd0
commit 6896646c54
3 changed files with 37 additions and 19 deletions

View File

@@ -12,14 +12,14 @@ class AdminAppTicketColumnService
public function columns(Tenant $tenant): array public function columns(Tenant $tenant): array
{ {
$keys = $tenant->codigo === self::FIESTA_FUTBOL_INFANTIL $keys = $tenant->codigo === self::FIESTA_FUTBOL_INFANTIL
? ['order_number', 'category', 'product', 'type', 'amount', 'client', 'id', 'status', 'scanned_by'] ? ['order_number', 'category', 'product', 'type', 'date', 'size', 'amount', 'client', 'id', 'status', 'scanned_by']
: ['order_number', 'product', 'amount', 'client', 'id', 'status', 'scanned_by']; : ['order_number', 'product', 'amount', 'client', 'id', 'status', 'scanned_by'];
$columns = array_map(fn (string $key): array => $this->definitions()[$key], $keys); $columns = array_map(fn (string $key): array => $this->definitions()[$key], $keys);
if ($tenant->codigo === self::FIESTA_FUTBOL_INFANTIL) { if ($tenant->codigo === self::FIESTA_FUTBOL_INFANTIL) {
$columns = array_map(function (array $column): array { $columns = array_map(function (array $column): array {
if (in_array($column['key'], ['product', 'type'], true)) { if (in_array($column['key'], ['product', 'type', 'date', 'size'], true)) {
$column['sortable'] = false; $column['sortable'] = false;
} }
@@ -72,11 +72,13 @@ class AdminAppTicketColumnService
'category' => $this->column('category', 'Categoría', 'text', '11%', 18), 'category' => $this->column('category', 'Categoría', 'text', '11%', 18),
'product' => $this->column('product', 'Producto', 'text', '11%', 22), 'product' => $this->column('product', 'Producto', 'text', '11%', 22),
'type' => $this->column('type', 'Tipo', 'text', '8%', 18), 'type' => $this->column('type', 'Tipo', 'text', '8%', 18),
'amount' => $this->column('amount', 'Importe', 'currency', '9%', 15), 'date' => $this->column('date', 'Fecha', 'text', '7%', 14),
'client' => $this->column('client', 'Cliente', 'text', '13%', 30), 'size' => $this->column('size', 'Talle', 'text', '6%', 12),
'id' => $this->column('id', 'ID', 'text', '7%', 12), 'amount' => $this->column('amount', 'Importe', 'currency', '8%', 15),
'client' => $this->column('client', 'Cliente', 'text', '11%', 30),
'id' => $this->column('id', 'ID', 'text', '6%', 12),
'status' => $this->column('status', 'Estado', 'status', '7%', 13), 'status' => $this->column('status', 'Estado', 'status', '7%', 13),
'scanned_by' => $this->column('scanned_by', 'Escaneado por', 'text', '9%', 28), 'scanned_by' => $this->column('scanned_by', 'Escaneado por', 'text', '8%', 28),
]; ];
} }

View File

@@ -12,12 +12,12 @@ class AdminAppTicketRowService
private const FIESTA_FUTBOL_INFANTIL = 'fiesta_futbol_infantil'; private const FIESTA_FUTBOL_INFANTIL = 'fiesta_futbol_infantil';
private const CATEGORY_PRESENTATIONS = [ private const CATEGORY_PRESENTATIONS = [
'alojamientos' => ['category' => 'Camping', 'product' => 'tipo_alojamiento', 'type' => null], 'alojamientos' => ['category' => 'Camping', 'product' => 'tipo_alojamiento', 'type' => null, 'date' => null, 'size' => null],
'camping' => ['category' => null, 'product' => 'tipo_alojamiento', 'type' => null], 'camping' => ['category' => null, 'product' => 'tipo_alojamiento', 'type' => null, 'date' => null, 'size' => null],
'entradas' => ['category' => null, 'product' => 'product', 'type' => null], 'entradas' => ['category' => null, 'product' => 'product', 'type' => null, 'date' => null, 'size' => null],
'comidas' => ['category' => 'Comida', 'product' => 'event_date', 'type' => 'horario'], 'comidas' => ['category' => 'Comida', 'product' => 'horario', 'type' => 'servicio', 'date' => 'event_date', 'size' => null],
'comida' => ['category' => null, 'product' => 'event_date', 'type' => 'horario'], 'comida' => ['category' => null, 'product' => 'horario', 'type' => 'servicio', 'date' => 'event_date', 'size' => null],
'merchandising' => ['category' => null, 'product' => 'product', 'type' => 'color'], 'merchandising' => ['category' => null, 'product' => 'product', 'type' => 'color', 'date' => null, 'size' => 'talle'],
]; ];
/** @return array<string, mixed> */ /** @return array<string, mixed> */
@@ -50,6 +50,8 @@ class AdminAppTicketRowService
'category' => $presentation['category'], 'category' => $presentation['category'],
'product' => $presentation['product'], 'product' => $presentation['product'],
'type' => $presentation['type'], 'type' => $presentation['type'],
'date' => $presentation['date'],
'size' => $presentation['size'],
'amount' => $details['amount'] === null ? null : (float) $details['amount'], 'amount' => $details['amount'] === null ? null : (float) $details['amount'],
'client' => $details['client'] ?? 'Sin nombre', 'client' => $details['client'] ?? 'Sin nombre',
'id' => $ticket->id, 'id' => $ticket->id,
@@ -113,6 +115,8 @@ class AdminAppTicketRowService
'category' => $sourceCategory, 'category' => $sourceCategory,
'product' => (string) ($details['product'] ?: $ticket->name ?: '-'), 'product' => (string) ($details['product'] ?: $ticket->name ?: '-'),
'type' => $this->allPropertyLabels($details) ?: '-', 'type' => $this->allPropertyLabels($details) ?: '-',
'date' => '-',
'size' => '-',
]; ];
} }
@@ -122,6 +126,8 @@ class AdminAppTicketRowService
'category' => $sourceCategory, 'category' => $sourceCategory,
'product' => (string) ($details['product'] ?: $ticket->name ?: '-'), 'product' => (string) ($details['product'] ?: $ticket->name ?: '-'),
'type' => $this->allPropertyLabels($details) ?: '-', 'type' => $this->allPropertyLabels($details) ?: '-',
'date' => '-',
'size' => '-',
]; ];
} }
@@ -133,6 +139,12 @@ class AdminAppTicketRowService
'type' => $configuration['type'] === null 'type' => $configuration['type'] === null
? '-' ? '-'
: ($this->propertyLabels($details, $configuration['type']) ?: '-'), : ($this->propertyLabels($details, $configuration['type']) ?: '-'),
'date' => $configuration['date'] === null
? '-'
: ($this->propertyLabels($details, $configuration['date']) ?: '-'),
'size' => $configuration['size'] === null
? '-'
: ($this->propertyLabels($details, $configuration['size']) ?: '-'),
]; ];
} }

View File

@@ -53,10 +53,11 @@ class AdminAppTicketExportServiceTest extends TestCase
$this->assertSame('Tickets', $sheet->getTitle()); $this->assertSame('Tickets', $sheet->getTitle());
$this->assertSame('N° de orden', $sheet->getCell('A1')->getValue()); $this->assertSame('N° de orden', $sheet->getCell('A1')->getValue());
$this->assertSame('#15', $sheet->getCell('A2')->getValue()); $this->assertSame('#15', $sheet->getCell('A2')->getValue());
$this->assertSame('Cena', $sheet->getCell('D2')->getValue()); $this->assertSame('Vianda', $sheet->getCell('D2')->getValue());
$this->assertSame(8000.0, $sheet->getCell('E2')->getValue()); $this->assertSame('12/10', $sheet->getCell('E2')->getValue());
$this->assertSame('25', $sheet->getCell('G2')->getValue()); $this->assertSame(8000.0, $sheet->getCell('G2')->getValue());
$this->assertSame('Usado', $sheet->getCell('H2')->getValue()); $this->assertSame('25', $sheet->getCell('I2')->getValue());
$this->assertSame('Usado', $sheet->getCell('J2')->getValue());
} finally { } finally {
@unlink($path); @unlink($path);
} }
@@ -93,7 +94,8 @@ class AdminAppTicketExportServiceTest extends TestCase
$this->assertStringContainsString('Generado el 24/08/2026 13:53', $html); $this->assertStringContainsString('Generado el 24/08/2026 13:53', $html);
$this->assertStringContainsString('25', $html); $this->assertStringContainsString('25', $html);
$this->assertStringNotContainsString('00000000-0000-0000-0000-000000000001', $html); $this->assertStringNotContainsString('00000000-0000-0000-0000-000000000001', $html);
$this->assertStringContainsString('Cena', $html); $this->assertStringContainsString('Almuerzo', $html);
$this->assertStringContainsString('Vianda', $html);
} }
private function reportService(): AdminAppTicketReportService private function reportService(): AdminAppTicketReportService
@@ -110,8 +112,10 @@ class AdminAppTicketExportServiceTest extends TestCase
return [ return [
'order_number' => 15, 'order_number' => 15,
'category' => 'Comida', 'category' => 'Comida',
'product' => '12/10', 'product' => 'Almuerzo',
'type' => 'Cena', 'type' => 'Vianda',
'date' => '12/10',
'size' => '-',
'amount' => 8000.0, 'amount' => 8000.0,
'client' => 'Cliente Test', 'client' => 'Cliente Test',
'id' => 25, 'id' => 25,