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
{
$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'];
$columns = array_map(fn (string $key): array => $this->definitions()[$key], $keys);
if ($tenant->codigo === self::FIESTA_FUTBOL_INFANTIL) {
$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;
}
@@ -72,11 +72,13 @@ class AdminAppTicketColumnService
'category' => $this->column('category', 'Categoría', 'text', '11%', 18),
'product' => $this->column('product', 'Producto', 'text', '11%', 22),
'type' => $this->column('type', 'Tipo', 'text', '8%', 18),
'amount' => $this->column('amount', 'Importe', 'currency', '9%', 15),
'client' => $this->column('client', 'Cliente', 'text', '13%', 30),
'id' => $this->column('id', 'ID', 'text', '7%', 12),
'date' => $this->column('date', 'Fecha', 'text', '7%', 14),
'size' => $this->column('size', 'Talle', 'text', '6%', 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),
'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 CATEGORY_PRESENTATIONS = [
'alojamientos' => ['category' => 'Camping', 'product' => 'tipo_alojamiento', 'type' => null],
'camping' => ['category' => null, 'product' => 'tipo_alojamiento', 'type' => null],
'entradas' => ['category' => null, 'product' => 'product', 'type' => null],
'comidas' => ['category' => 'Comida', 'product' => 'event_date', 'type' => 'horario'],
'comida' => ['category' => null, 'product' => 'event_date', 'type' => 'horario'],
'merchandising' => ['category' => null, 'product' => 'product', 'type' => 'color'],
'alojamientos' => ['category' => 'Camping', 'product' => 'tipo_alojamiento', 'type' => null, 'date' => null, 'size' => null],
'camping' => ['category' => null, 'product' => 'tipo_alojamiento', 'type' => null, 'date' => null, 'size' => null],
'entradas' => ['category' => null, 'product' => 'product', 'type' => null, 'date' => null, 'size' => null],
'comidas' => ['category' => 'Comida', 'product' => 'horario', 'type' => 'servicio', 'date' => 'event_date', 'size' => null],
'comida' => ['category' => null, 'product' => 'horario', 'type' => 'servicio', 'date' => 'event_date', 'size' => null],
'merchandising' => ['category' => null, 'product' => 'product', 'type' => 'color', 'date' => null, 'size' => 'talle'],
];
/** @return array<string, mixed> */
@@ -50,6 +50,8 @@ class AdminAppTicketRowService
'category' => $presentation['category'],
'product' => $presentation['product'],
'type' => $presentation['type'],
'date' => $presentation['date'],
'size' => $presentation['size'],
'amount' => $details['amount'] === null ? null : (float) $details['amount'],
'client' => $details['client'] ?? 'Sin nombre',
'id' => $ticket->id,
@@ -113,6 +115,8 @@ class AdminAppTicketRowService
'category' => $sourceCategory,
'product' => (string) ($details['product'] ?: $ticket->name ?: '-'),
'type' => $this->allPropertyLabels($details) ?: '-',
'date' => '-',
'size' => '-',
];
}
@@ -122,6 +126,8 @@ class AdminAppTicketRowService
'category' => $sourceCategory,
'product' => (string) ($details['product'] ?: $ticket->name ?: '-'),
'type' => $this->allPropertyLabels($details) ?: '-',
'date' => '-',
'size' => '-',
];
}
@@ -133,6 +139,12 @@ class AdminAppTicketRowService
'type' => $configuration['type'] === null
? '-'
: ($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('N° de orden', $sheet->getCell('A1')->getValue());
$this->assertSame('#15', $sheet->getCell('A2')->getValue());
$this->assertSame('Cena', $sheet->getCell('D2')->getValue());
$this->assertSame(8000.0, $sheet->getCell('E2')->getValue());
$this->assertSame('25', $sheet->getCell('G2')->getValue());
$this->assertSame('Usado', $sheet->getCell('H2')->getValue());
$this->assertSame('Vianda', $sheet->getCell('D2')->getValue());
$this->assertSame('12/10', $sheet->getCell('E2')->getValue());
$this->assertSame(8000.0, $sheet->getCell('G2')->getValue());
$this->assertSame('25', $sheet->getCell('I2')->getValue());
$this->assertSame('Usado', $sheet->getCell('J2')->getValue());
} finally {
@unlink($path);
}
@@ -93,7 +94,8 @@ class AdminAppTicketExportServiceTest extends TestCase
$this->assertStringContainsString('Generado el 24/08/2026 13:53', $html);
$this->assertStringContainsString('25', $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
@@ -110,8 +112,10 @@ class AdminAppTicketExportServiceTest extends TestCase
return [
'order_number' => 15,
'category' => 'Comida',
'product' => '12/10',
'type' => 'Cena',
'product' => 'Almuerzo',
'type' => 'Vianda',
'date' => '12/10',
'size' => '-',
'amount' => 8000.0,
'client' => 'Cliente Test',
'id' => 25,