@@ -6,6 +6,7 @@ import {
|
||||
Users,
|
||||
Wallet,
|
||||
Warehouse,
|
||||
FileBarChart,
|
||||
} from 'lucide-react';
|
||||
import type { LucideIcon } from 'lucide-react';
|
||||
|
||||
@@ -27,7 +28,7 @@ const finance = ['admin', 'finance'];
|
||||
const inventory = [...readers, 'warehouse'];
|
||||
|
||||
export function procurementNavigation(
|
||||
role: string,
|
||||
role: string | string[],
|
||||
payables: boolean,
|
||||
): ProcurementGroup[] {
|
||||
const groups: ProcurementGroup[] = [
|
||||
@@ -205,6 +206,12 @@ export function procurementNavigation(
|
||||
path: '/empresa',
|
||||
roles: ['admin'],
|
||||
},
|
||||
{
|
||||
id: 'organization_parameters',
|
||||
label: 'Parametrização da aplicação',
|
||||
path: '/administracao/parametrizacao',
|
||||
roles: ['admin'],
|
||||
},
|
||||
{
|
||||
id: 'admission_policy',
|
||||
label: 'Política de admissão',
|
||||
@@ -224,12 +231,40 @@ export function procurementNavigation(
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'reports',
|
||||
label: 'Relatórios',
|
||||
icon: FileBarChart,
|
||||
entries: [
|
||||
{
|
||||
id: 'procurement_reports',
|
||||
label: 'Relatórios de compras',
|
||||
path: '/relatorios',
|
||||
roles: readers,
|
||||
},
|
||||
{
|
||||
id: 'supplier_improvement_reports',
|
||||
label: 'Medidas de melhoria',
|
||||
path: '/relatorios/medidas-fornecedores',
|
||||
roles: readers,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
return groups
|
||||
.map((group) => ({
|
||||
...group,
|
||||
entries: group.entries.filter(
|
||||
(entry) => !entry.roles || entry.roles.includes(role),
|
||||
(entry) =>
|
||||
(entry.id !== 'new_request' ||
|
||||
!Array.isArray(role) ||
|
||||
role.includes('requester')) &&
|
||||
(!entry.roles ||
|
||||
entry.roles.some((permission) =>
|
||||
(Array.isArray(role) ? role : [role]).includes(
|
||||
permission,
|
||||
),
|
||||
)),
|
||||
),
|
||||
}))
|
||||
.filter((group) => group.entries.length);
|
||||
|
||||
Reference in New Issue
Block a user