feat(desfile): associate tickets menu with desfile tenant and add migration test
This commit is contained in:
@@ -4,15 +4,19 @@ namespace App\Shared\Forms\Services;
|
||||
|
||||
use App\Domains\Core\Tenant\Models\Tenant;
|
||||
use App\Domains\Ticketing\Ticket\Models\Ticket;
|
||||
use App\Domains\Ticketing\Ticket\Services\AdminAppTicketAttributeService;
|
||||
use App\Domains\Ticketing\Ticket\Services\AdminAppTicketColumnService;
|
||||
|
||||
class TicketFilterFormService
|
||||
{
|
||||
private const FIESTA_FUTBOL_INFANTIL = 'fiesta_futbol_infantil';
|
||||
|
||||
private const DESFILE_PURA_TENDENCIA = 'desfile_pura_tendencia';
|
||||
|
||||
public function __construct(
|
||||
private readonly TicketFormService $ticketFormService,
|
||||
private readonly AdminAppTicketColumnService $columnService,
|
||||
private readonly AdminAppTicketAttributeService $attributeService,
|
||||
) {}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
@@ -27,6 +31,13 @@ class TicketFilterFormService
|
||||
];
|
||||
}
|
||||
|
||||
if ($tenant->codigo === self::DESFILE_PURA_TENDENCIA) {
|
||||
$fields = [
|
||||
...$this->desfileFields($tenant),
|
||||
...$this->commonFields(),
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'code' => 'tickets_filter',
|
||||
'action' => '/api/v1/adminapp/tenant/tickets',
|
||||
@@ -36,6 +47,21 @@ class TicketFilterFormService
|
||||
];
|
||||
}
|
||||
|
||||
/** @return list<array<string, mixed>> */
|
||||
private function desfileFields(Tenant $tenant): array
|
||||
{
|
||||
return array_map(fn (array $attribute): array => [
|
||||
'name' => $attribute['code'],
|
||||
'query_param' => $attribute['code'],
|
||||
'label' => $attribute['label'],
|
||||
'type' => 'select',
|
||||
'required' => false,
|
||||
'default' => null,
|
||||
'placeholder' => $attribute['label'],
|
||||
'options' => $attribute['options'],
|
||||
], $this->attributeService->attributes($tenant));
|
||||
}
|
||||
|
||||
/** @return list<array<string, mixed>> */
|
||||
private function fiestaFutbolInfantilFields(Tenant $tenant): array
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user