fix(tickets): show numeric id and remove date column

This commit is contained in:
2026-09-01 11:53:47 -03:00
parent 58b15f3026
commit 80b8707771
6 changed files with 25 additions and 36 deletions

View File

@@ -251,8 +251,7 @@ class AdminAppTicketFilterFormControllerTest extends TestCase
['key' => 'product', 'label' => 'Producto', 'type' => 'text', 'sortable' => true, 'sort_param' => 'product', 'width' => '15%'],
['key' => 'amount', 'label' => 'Importe', 'type' => 'currency', 'sortable' => true, 'sort_param' => 'amount', 'width' => '10%'],
['key' => 'client', 'label' => 'Cliente', 'type' => 'text', 'sortable' => true, 'sort_param' => 'client', 'width' => '15%'],
['key' => 'ticket', 'label' => 'ID', 'type' => 'text', 'sortable' => true, 'sort_param' => 'ticket', 'width' => '19%'],
['key' => 'date', 'label' => 'Fecha', 'type' => 'date', 'sortable' => true, 'sort_param' => 'date', 'width' => '11%'],
['key' => 'id', 'label' => 'ID', 'type' => 'text', 'sortable' => true, 'sort_param' => 'id', 'width' => '8%'],
['key' => 'status', 'label' => 'Estado', 'type' => 'status', 'sortable' => true, 'sort_param' => 'status', 'width' => '8%'],
['key' => 'scanned_by', 'label' => 'Escaneado por', 'type' => 'text', 'sortable' => true, 'sort_param' => 'scanned_by', 'width' => '11%'],
];

View File

@@ -70,8 +70,11 @@ class AdminAppTicketControllerTest extends TestCase
->assertJsonCount(1, 'data')
->assertJsonPath('data.0.id', $ticket->id)
->assertJsonPath('data.0.tenant_code', $tenant->codigo)
->assertJsonPath('data.0.values.ticket', $ticket->ticket)
->assertJsonPath('data.0.values.id', $ticket->id)
->assertJsonPath('data.0.values.status', Ticket::STATUS_ACTIVE)
->assertJsonMissingPath('data.0.values.ticket')
->assertJsonMissingPath('data.0.values.date')
->assertJsonMissingPath('data.0.date')
->assertJsonPath('meta.total', 1);
}
@@ -96,34 +99,34 @@ class AdminAppTicketControllerTest extends TestCase
->assertJsonPath('data.0.ticket', $matching->ticket);
}
public function test_it_sorts_the_complete_filtered_result_before_paginating(): void
public function test_it_sorts_by_ticket_id_before_paginating(): void
{
$tenant = $this->createTenant('fiesta_futbol_infantil');
$admin = $this->createAdminAppUser($tenant);
$this->grantTicketsMenu($tenant);
Sanctum::actingAs($admin);
foreach (['ticket-c', 'ticket-a', 'ticket-d', 'ticket-b'] as $value) {
$this->createTicket($tenant, $admin)->update(['ticket' => $value]);
}
$ids = collect(range(1, 4))
->map(fn (): int => $this->createTicket($tenant, $admin)->id)
->all();
$query = http_build_query([
'sort_by' => 'ticket',
'sort_by' => 'id',
'sort_direction' => 'asc',
'per_page' => 2,
]);
$this->getJson('/api/v1/adminapp/tenant/tickets?'.$query)
->assertOk()
->assertJsonPath('data.0.values.ticket', 'ticket-a')
->assertJsonPath('data.1.values.ticket', 'ticket-b')
->assertJsonPath('data.0.values.id', $ids[0])
->assertJsonPath('data.1.values.id', $ids[1])
->assertJsonPath('meta.total', 4)
->assertJsonPath('meta.last_page', 2);
$this->getJson('/api/v1/adminapp/tenant/tickets?'.$query.'&page=2')
->assertOk()
->assertJsonPath('data.0.values.ticket', 'ticket-c')
->assertJsonPath('data.1.values.ticket', 'ticket-d');
->assertJsonPath('data.0.values.id', $ids[2])
->assertJsonPath('data.1.values.id', $ids[3]);
}
public function test_it_rejects_sort_columns_not_enabled_for_the_tenant(): void

View File

@@ -55,8 +55,8 @@ class AdminAppTicketExportServiceTest extends TestCase
$this->assertSame('#15', $sheet->getCell('A2')->getValue());
$this->assertSame('Cena', $sheet->getCell('D2')->getValue());
$this->assertSame(8000.0, $sheet->getCell('E2')->getValue());
$this->assertSame('00000000-0000-0000-0000-000000000001', $sheet->getCell('G2')->getValue());
$this->assertSame('Usado', $sheet->getCell('I2')->getValue());
$this->assertSame('25', $sheet->getCell('G2')->getValue());
$this->assertSame('Usado', $sheet->getCell('H2')->getValue());
} finally {
@unlink($path);
}
@@ -91,9 +91,9 @@ class AdminAppTicketExportServiceTest extends TestCase
])->render();
$this->assertStringContainsString('Generado el 24/08/2026 13:53', $html);
$this->assertStringContainsString('00000000-0000-0000-0000-000000000001', $html);
$this->assertStringContainsString('25', $html);
$this->assertStringNotContainsString('00000000-0000-0000-0000-000000000001', $html);
$this->assertStringContainsString('Cena', $html);
$this->assertStringContainsString('24/08/2026 13:53', $html);
}
private function reportService(): AdminAppTicketReportService
@@ -114,8 +114,7 @@ class AdminAppTicketExportServiceTest extends TestCase
'type' => 'Cena',
'amount' => 8000.0,
'client' => 'Cliente Test',
'ticket' => '00000000-0000-0000-0000-000000000001',
'date' => now(),
'id' => 25,
'status' => 'used',
'scanned_by' => 'Admin Test',
];