commit melhorias sgf

This commit is contained in:
2026-11-11 09:00:17 +02:00
parent 0b05a1192c
commit 1d11a5e57b
736 changed files with 40746 additions and 210 deletions
+21 -5
View File
@@ -6,13 +6,14 @@ use Illuminate\Support\Facades\DB;
final class ModuleNavigation
{
public const LABELS = ['commercial'=>'Comercial', 'purchasing'=>'Compras', 'stock'=>'Stock', 'workshop'=>'Oficinas', 'finance'=>'Financeiro', 'accounting'=>'Contabilidade'];
public const LABELS = ['commercial'=>'Comercial', 'purchasing'=>'Compras', 'stock'=>'Stock', 'workshop'=>'Oficinas', 'finance'=>'Financeiro', 'accounting'=>'Contabilidade', 'human_resources'=>'Recursos Humanos'];
private const RIGHTS = [
'commercial'=>['clients.', 'services.', 'service_drafts.', 'billing_drafts.', 'issuer_documents.', 'client_documents.', 'draft_documents.', 'service_invoices.'],
'human_resources'=>['human_resources.remunerations.','human_resources.contracts.','human_resources.attendance.','human_resources.leave.'],
'commercial'=>['commercial_quotes.','service_documents.','clients.', 'services.', 'service_drafts.', 'billing_drafts.', 'issuer_documents.', 'client_documents.', 'draft_documents.', 'service_invoices.'],
'purchasing'=>['purchasing_budget.', 'purchasing_requisitions.', 'purchasing_receipts.', 'purchasing_orders.', 'purchasing_sourcing.', 'purchasing_suppliers.', 'purchasing_requests.', 'purchasing_invoices.', 'purchasing_obligations.', 'supplier_payables.'],
'stock'=>['stock.'], 'workshop'=>['workshop.', 'workshop_billing.', 'workshop_corrections.'],
'finance'=>['direct_costs.', 'industrial_costs.', 'industrial_budgets.', 'industrial_budget_comparisons.', 'service_receivables.'],
'accounting'=>['catalogue_accounting.', 'service_fiscal.', 'general_ledger.'],
'finance'=>['financial_analysis.','bank_reconciliation.','cash.', 'direct_costs.', 'industrial_costs.', 'industrial_budgets.', 'industrial_budget_comparisons.', 'service_receivables.'],
'accounting'=>['fiscal_obligations.','fiscal_rules.','fiscal_assessments.','fiscal_forms.','catalogue_accounting.', 'service_fiscal.', 'general_ledger.'],
];
public function available(CompanyContext $context): array
@@ -50,6 +51,14 @@ final class ModuleNavigation
// Company, unit and access configuration are explicitly general.
public static function owner(string $path): ?string
{
if(preg_match('~^(stock/catalogue|api/stock-catalogue)(/|$)~',$path))return 'stock';
if(preg_match('~^(finance/cash|api/cash)(/|$)~',$path))return 'finance';
if(preg_match('~^api/(remunerations|hr-personnel)(/|$)~',$path))return 'human_resources';
if(preg_match('~^api/fiscal-obligations(/|$)~',$path))return 'accounting';
if(preg_match('~^api/finance/payable-positions(/|$)~',$path))return 'finance';
if(preg_match('~^api/finance/payable-due(/|$)~',$path))return 'finance';
if(preg_match('~^(finance/payables|api/finance/payables)(/|$)~',$path))return 'finance';
if (preg_match('~^api/v1/integration/sgc/invoices(?:/orders/[1-9][0-9]*)?$~D', $path)) return 'purchasing';
if (preg_match('~^(geography|geography/segments|api/geography/entities|api/geography/segments)/client(/|$)~', $path)) return 'commercial';
if (preg_match('~^(geography|geography/segments|api/geography/entities|api/geography/segments)/supplier(/|$)~', $path)) return 'purchasing';
if (preg_match('~^(purchasing/dossiers|api/purchasing-dossiers)(/|$)~', $path)) return 'purchasing';
@@ -63,10 +72,17 @@ final class ModuleNavigation
if (preg_match('~^(purchasing/receipts|api/purchasing-receipts)(/|$)~', $path)) return 'purchasing';
if (preg_match('~^api/stock-valuation-read(/|$)~', $path)) return 'accounting';
if (preg_match('~^(purchasing/internal-requisitions|api/internal-requisitions)(/|$)~', $path)) return 'purchasing';
if (preg_match('~^(commercial/documents|api/service-documents)(/|$)~', $path)) return 'commercial';
if(preg_match('~^(finance/indicators|api/financial-indicators)(/|$)~',$path))return 'finance';
if(preg_match('~^(finance/bank|api/bank-reconciliation)(/|$)~',$path))return 'finance';
if(preg_match('~^(fiscal/rules|api/fiscal-rules)(/|$)~',$path))return 'accounting';
if(preg_match('~^(fiscal/iva|api/fiscal-assessments)(/|$)~',$path))return 'accounting';
if (preg_match('~^(general-ledger|api/general-ledger)(/|$)~', $path)) return 'accounting';
if(preg_match('~^(api/commercial-quotes|commercial-quotes)(/|$)~',$path))return 'commercial';
if (preg_match('~^api/stock-read(/|$)~', $path)) return 'stock';
if (preg_match('~^(stock/(operations|final|completion)|api/(stock-operations|stock-final|stock-completion))(/|$)~', $path)) return 'stock';
if (preg_match('~^(supplier-payables|supplier-payments|api/(supplier-payables|supplier-payments|purchasing-budget))(/|$)~', $path)) return 'purchasing';
if (preg_match('~^api/(workshop|workshop-stock|workshop-billing|workshop-corrections)(/|$)~', $path)) return 'workshop';
if (preg_match('~^api/(workshop|workshop-schedule|workshop-equipment|workshop-stock|workshop-billing|workshop-corrections)(/|$)~', $path)) return 'workshop';
if (preg_match('~^api/(direct-costs|industrial-costs|industrial-budgets|service-receivables)(/|$)~', $path)) return 'finance';
if (preg_match('~^api/(catalogue-accounting|service-fiscal)(/|$)~', $path)) return 'accounting';
if (preg_match('~^api/(a|b1|service-invoices|service-calculations|document-preview|document-preparation)(/|$)~', $path)) return 'commercial';