diff --git a/resources/js/components/sgc-workspace-shell.tsx b/resources/js/components/sgc-workspace-shell.tsx
index 6c0c495..46a2fdb 100644
--- a/resources/js/components/sgc-workspace-shell.tsx
+++ b/resources/js/components/sgc-workspace-shell.tsx
@@ -7,7 +7,7 @@ import {
Search,
X,
} from 'lucide-react';
-import { Fragment, useEffect, useRef, useState } from 'react';
+import { useEffect, useRef, useState } from 'react';
import type { ReactNode } from 'react';
import { Button } from '@/components/ui/button';
import {
@@ -29,7 +29,10 @@ import {
activeProcurementEntry,
procurementNavigation,
} from '@/lib/procurement-navigation';
-import type { CommonFinanceNavigation } from '@/lib/procurement-navigation';
+import type {
+ CommonFinanceNavigation,
+ ProcurementEntry,
+} from '@/lib/procurement-navigation';
import { roleLabels } from '@/types/procurement';
import type { WorkContextState } from '@/types/work-context';
import { WorkContextChange } from '@/components/work-context-change';
@@ -40,6 +43,17 @@ import {
searchProcurementMenu,
} from '@/lib/procurement-menu-search';
+/** Agrupa entradas consecutivas pela secção, mantendo a ordem do menu. */
+function menuSections(entries: ProcurementEntry[]) {
+ const sections: { label?: string; entries: ProcurementEntry[] }[] = [];
+ for (const entry of entries) {
+ const last = sections[sections.length - 1];
+ if (last && last.label === entry.section) last.entries.push(entry);
+ else sections.push({ label: entry.section, entries: [entry] });
+ }
+ return sections;
+}
+
export function SgcWorkspaceShell({ children }: { children: ReactNode }) {
const page = usePage();
const user = page.props.auth?.user;
@@ -252,14 +266,14 @@ export function SgcWorkspaceShell({ children }: { children: ReactNode }) {
{group.entries.map((entry, index) => {
- const className = `block rounded-md px-3 py-2 text-[13px] leading-5 transition-colors focus-visible:outline-2 focus-visible:outline-white ${activeId === entry.id ? 'bg-red-500/15 font-medium text-red-300' : 'text-slate-400 hover:bg-white/5 hover:text-white'}`;
+ const className = `block rounded-md px-3 py-2 text-[13px] leading-5 transition-colors focus-visible:outline-2 focus-visible:outline-white ${activeId === entry.id ? 'bg-white/10 font-medium text-white shadow-[inset_2px_0_0_#ed1c24]' : 'text-slate-300 hover:bg-white/5 hover:text-white'}`;
return (
-
{entry.section &&
entry.section !==
group.entries[index - 1]
?.section && (
-
+
{entry.section}
)}
@@ -427,53 +441,89 @@ export function SgcWorkspaceShell({ children }: { children: ReactNode }) {
1 ? 'w-[min(34rem,calc(100vw-2rem))]' : 'w-72'}`}
>
- {group.entries.map((entry, index) => (
-
- {entry.section &&
- entry.section !==
- group.entries[index - 1]
- ?.section && (
-
- {entry.section}
-
- )}
-
- {entry.fullPage ? (
-
- {entry.label}
-
- ) : (
-
- {entry.label}
-
- )}
-
-
- ))}
+ 1
+ ? 'grid grid-cols-2 gap-x-4 gap-y-3'
+ : ''
+ }
+ >
+ {menuSections(group.entries).map(
+ (section) => (
+
+ {section.label && (
+
+ {section.label}
+
+ )}
+ {section.entries.map(
+ (entry) => (
+
+ {entry.fullPage ? (
+
+ {
+ entry.label
+ }
+
+ ) : (
+
+ {
+ entry.label
+ }
+
+ )}
+
+ ),
+ )}
+
+ ),
+ )}
+
))}
diff --git a/resources/js/lib/procurement-navigation.ts b/resources/js/lib/procurement-navigation.ts
index fc42505..15654a3 100644
--- a/resources/js/lib/procurement-navigation.ts
+++ b/resources/js/lib/procurement-navigation.ts
@@ -7,6 +7,7 @@ import {
Wallet,
Warehouse,
FileBarChart,
+ Settings,
} from 'lucide-react';
import type { LucideIcon } from 'lucide-react';
@@ -612,15 +613,11 @@ export function procurementNavigation(
],
},
];
- const purchasing = groups.filter((group) =>
- ['requests', 'approvals', 'sourcing', 'suppliers'].includes(group.id),
- );
- const compact = [
- {
- id: 'purchasing',
- label: 'Compras',
- icon: ClipboardList,
- entries: purchasing.flatMap((group) =>
+ // Agrupamento visível: pedir → comprar → receber → pagar → controlar.
+ const withSections = (ids: string[]) =>
+ groups
+ .filter((group) => ids.includes(group.id))
+ .flatMap((group) =>
(group.id === 'sourcing'
? [
...group.entries.filter(
@@ -639,29 +636,58 @@ export function procurementNavigation(
: group.id === 'sourcing' &&
entry.id.startsWith('supply_')
? 'Fornecimento e reposição'
- : group.label,
+ : group.id === 'sourcing'
+ ? 'Cotações e ordens'
+ : group.label,
})),
+ );
+ const byId = (id: string) =>
+ groups.find((group) => group.id === id) as ProcurementGroup;
+ const administration = byId('administration');
+ const audit = byId('audit');
+ const conflicts = administration.entries.filter(
+ (entry) => entry.id === 'conflicts',
+ );
+ const compact: ProcurementGroup[] = [
+ {
+ id: 'requests_area',
+ label: 'Pedidos',
+ icon: ClipboardList,
+ entries: withSections(['requests', 'approvals']),
+ },
+ {
+ id: 'purchasing',
+ label: 'Compras',
+ icon: Scale,
+ entries: withSections(['sourcing', 'suppliers']),
+ },
+ byId('people'),
+ { ...byId('receiving'), label: 'Armazém e activos' },
+ byId('finance'),
+ byId('reports'),
+ {
+ id: 'control',
+ label: 'Controlo',
+ icon: BadgeCheck,
+ entries: [
+ ...conflicts.map((entry) => ({
+ ...entry,
+ section: 'Integridade',
+ })),
+ ...audit.entries.map((entry) => ({
+ ...entry,
+ section: 'Auditoria',
+ })),
+ ],
+ },
+ {
+ ...administration,
+ label: 'Administração',
+ icon: Settings,
+ entries: administration.entries.filter(
+ (entry) => entry.id !== 'conflicts',
),
},
- ...groups
- .filter(
- (group) =>
- ![
- 'requests',
- 'approvals',
- 'sourcing',
- 'suppliers',
- ].includes(group.id),
- )
- .map((group) => ({
- ...group,
- label:
- group.id === 'administration'
- ? 'Administração'
- : group.id === 'receiving'
- ? 'Armazém e activos'
- : group.label,
- })),
];
return compact
.map((group) => ({