32 lines
865 B
PHP
32 lines
865 B
PHP
<?php
|
|
|
|
namespace App\Domains\Forms\Services;
|
|
|
|
use App\Domains\Purchase\Models\Purchase;
|
|
|
|
class SaleFormService
|
|
{
|
|
/** @return array{statuses: list<array{code: string, name: string}>} */
|
|
public function get(): array
|
|
{
|
|
$names = [
|
|
Purchase::STATUS_CREATED => 'Creada',
|
|
Purchase::STATUS_PENDING_PAYMENT => 'Esperando pago',
|
|
Purchase::STATUS_PAID => 'Confirmada',
|
|
Purchase::STATUS_CANCELLED => 'Cancelada',
|
|
Purchase::STATUS_REJECTED => 'Rechazada',
|
|
Purchase::STATUS_EXPIRED => 'Vencida',
|
|
];
|
|
|
|
return [
|
|
'statuses' => array_map(
|
|
fn (string $status): array => [
|
|
'code' => $status,
|
|
'name' => $names[$status],
|
|
],
|
|
Purchase::statuses(),
|
|
),
|
|
];
|
|
}
|
|
}
|