Preserva entrega A aceite de servicos em rascunho

This commit is contained in:
2026-10-25 22:02:44 +02:00
parent 26b80df545
commit ca13acb74e
31 changed files with 1152 additions and 17 deletions
@@ -0,0 +1,22 @@
<?php
namespace App\Modules\Services;
final class ServicePermissions
{
public const AREAS = ['clients', 'services', 'service_drafts', 'billing_drafts'];
public const ACTIONS = ['view', 'create', 'edit', 'manage'];
public const LABELS = ['clients' => 'Clientes', 'services' => 'Serviços', 'service_drafts' => 'Prestações em rascunho', 'billing_drafts' => 'Rascunhos de facturação'];
public static function unitScoped(string $area): bool { return in_array($area, ['service_drafts', 'billing_drafts'], true); }
public static function catalogue(bool $unit): array
{
$result = [];
foreach (self::AREAS as $area) {
if (self::unitScoped($area) === $unit) {
foreach (self::ACTIONS as $action) { $result[] = "$area.$action"; }
}
}
return $result;
}
}