Delimitar a v1 ao núcleo de compras com interruptores por módulo

Decisão de 30/11/2026: a v1 é só o núcleo (requisições, aprovações, cotações,
adjudicação e ordens, fornecedores, recepções, stock básico, facturas,
pagamentos externos, orçamentos, empresa, conflitos, auditoria, relatórios).

- config/modules.php: pessoas, armazem_avancado e fornecimento, desligados
  por omissão (SGC_MODULE_*), sem apagar código.
- EnsureModuleEnabled: rotas de módulos desligados respondem 404.
- Menus escondem as entradas desses módulos (disabledModulePaths partilhado);
  contextos people.* deixam de ser oferecidos; /avaliar sem ligações mortas.
- Testes: suite corre com os módulos ligados; ProductModulesTest e
  product-modules.test.tsx verificam núcleo disponível e módulos desligados.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-30 23:23:50 +02:00
co-authored by Claude Opus 5.5
parent 2f2f40b47e
commit f9558d4563
13 changed files with 358 additions and 20 deletions
+3 -1
View File
@@ -4,6 +4,7 @@ use App\Enums\PurchasingRole;
use App\Models\User;
use App\Services\EvaluationAccess;
use App\Services\EvaluationNavigation;
use App\Services\ProductModules;
use App\Services\RequisitionWorkflow;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
@@ -37,7 +38,8 @@ Route::get('/avaliar', function (Request $request) use ($evaluationScope, $evalu
$html = '<!doctype html><html lang="pt"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Explorar SGC</title><style>body{font:18px system-ui;background:#f4f6f5;color:#183d35;margin:0}main{max-width:1000px;margin:auto;padding:28px}section{background:white;padding:24px;border-radius:12px;margin:20px 0}button{font:inherit;padding:14px;border:0;border-radius:8px;background:#125a4b;color:white;cursor:pointer}a{color:#125a4b}li{margin:12px 0}form{margin:12px 0}</style><main><h1>Explorar SGC</h1><p>Entrada local sem palavra-passe. Os exemplos e alterações ficam guardados nesta instalação de testes.</p><section><h2>Acesso de proprietário</h2><form method="post" action="/avaliar/entrar"><input type="hidden" name="_token" value="'.$token.'"><input type="hidden" name="role" value="admin"><button>Entrar como proprietário</button></form><p>Abre a administração e as páginas dos módulos abaixo. As regras dos processos e as funções operacionais continuam visíveis.</p></section>';
if ($request->user()) {
$html .= '<section><h2>Áreas da aplicação</h2><ul>';
foreach ($evaluationPages as $path => $label) {
$disabledPaths = app(ProductModules::class)->disabledPaths();
foreach (array_filter($evaluationPages, fn ($path) => ! in_array($path, $disabledPaths, true), ARRAY_FILTER_USE_KEY) as $path => $label) {
$html .= '<li><a href="'.$path.'">'.$label.'</a></li>';
}
$html .= '</ul></section>';