fix(tickets): disable inconsistent FFI product and type sorting
This commit is contained in:
@@ -17,7 +17,15 @@ class AdminAppTicketColumnService
|
|||||||
|
|
||||||
$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 {
|
||||||
|
if (in_array($column['key'], ['product', 'type'], true)) {
|
||||||
|
$column['sortable'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $column;
|
||||||
|
}, $columns);
|
||||||
|
} else {
|
||||||
$widths = [
|
$widths = [
|
||||||
'order_number' => '11%',
|
'order_number' => '11%',
|
||||||
'product' => '15%',
|
'product' => '15%',
|
||||||
|
|||||||
@@ -110,7 +110,9 @@ class AdminAppTicketFilterFormControllerTest extends TestCase
|
|||||||
->assertJsonPath('data.columns.0.sort_param', 'order_number')
|
->assertJsonPath('data.columns.0.sort_param', 'order_number')
|
||||||
->assertJsonPath('data.columns.1.key', 'category')
|
->assertJsonPath('data.columns.1.key', 'category')
|
||||||
->assertJsonPath('data.columns.2.key', 'product')
|
->assertJsonPath('data.columns.2.key', 'product')
|
||||||
->assertJsonPath('data.columns.3.key', 'type');
|
->assertJsonPath('data.columns.2.sortable', false)
|
||||||
|
->assertJsonPath('data.columns.3.key', 'type')
|
||||||
|
->assertJsonPath('data.columns.3.sortable', false);
|
||||||
|
|
||||||
$categories = collect($response->json('data.fields.0.options'));
|
$categories = collect($response->json('data.fields.0.options'));
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
|
|||||||
@@ -137,6 +137,19 @@ class AdminAppTicketControllerTest extends TestCase
|
|||||||
->assertJsonValidationErrors(['sort_by', 'sort_direction']);
|
->assertJsonValidationErrors(['sort_by', 'sort_direction']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_it_rejects_product_and_type_sorting_for_fiesta_futbol_infantil(): void
|
||||||
|
{
|
||||||
|
$tenant = $this->createTenant('fiesta_futbol_infantil');
|
||||||
|
$this->grantTicketsMenu($tenant);
|
||||||
|
Sanctum::actingAs($this->createAdminAppUser($tenant));
|
||||||
|
|
||||||
|
foreach (['product', 'type'] as $column) {
|
||||||
|
$this->getJson('/api/v1/adminapp/tenant/tickets?sort_by='.$column)
|
||||||
|
->assertUnprocessable()
|
||||||
|
->assertJsonValidationErrors('sort_by');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function test_it_includes_tenant_scanned_and_total_ticket_counts(): void
|
public function test_it_includes_tenant_scanned_and_total_ticket_counts(): void
|
||||||
{
|
{
|
||||||
$tenant = $this->createTenant('fiesta_futbol_infantil');
|
$tenant = $this->createTenant('fiesta_futbol_infantil');
|
||||||
|
|||||||
Reference in New Issue
Block a user