@@ -36,8 +36,12 @@ export function SgcWorkspaceShell({ children }: { children: ReactNode }) {
|
||||
const [mobileOpen, setMobileOpen] = useState(false);
|
||||
const [search, setSearch] = useState('');
|
||||
const [expanded, setExpanded] = useState<Record<string, boolean>>({});
|
||||
const access = page.props.organizationAccess as {
|
||||
active: boolean;
|
||||
permissions: string[];
|
||||
} | null;
|
||||
const groups = procurementNavigation(
|
||||
user?.purchasing_role ?? '',
|
||||
access?.active ? access.permissions : (user?.purchasing_role ?? ''),
|
||||
page.props.payablesAvailable === true,
|
||||
);
|
||||
const activeId = activeProcurementEntry(groups, page.url);
|
||||
@@ -404,16 +408,18 @@ export function SgcWorkspaceShell({ children }: { children: ReactNode }) {
|
||||
</div>
|
||||
{searchField()}
|
||||
<div className="flex shrink-0 items-center gap-2">
|
||||
<Button
|
||||
asChild
|
||||
size="sm"
|
||||
className="hidden bg-[#ed1c24] text-white hover:bg-[#d01720] sm:inline-flex"
|
||||
>
|
||||
<Link href="/requisicoes/criar">
|
||||
<Plus className="size-4" />
|
||||
Nova requisição
|
||||
</Link>
|
||||
</Button>
|
||||
{page.props.canRequest === true && (
|
||||
<Button
|
||||
asChild
|
||||
size="sm"
|
||||
className="hidden bg-[#ed1c24] text-white hover:bg-[#d01720] sm:inline-flex"
|
||||
>
|
||||
<Link href="/requisicoes/criar">
|
||||
<Plus className="size-4" />
|
||||
Nova requisição
|
||||
</Link>
|
||||
</Button>
|
||||
)}
|
||||
{user && (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
@@ -438,10 +444,23 @@ export function SgcWorkspaceShell({ children }: { children: ReactNode }) {
|
||||
{user.name}
|
||||
</span>
|
||||
<span className="block text-[10px] text-muted-foreground">
|
||||
{roleLabels[
|
||||
user.purchasing_role ??
|
||||
''
|
||||
] ?? 'Utilizador'}
|
||||
{(
|
||||
page.props
|
||||
.organizationAccess as {
|
||||
active: boolean;
|
||||
profileLabel: string;
|
||||
} | null
|
||||
)?.active
|
||||
? (
|
||||
page.props
|
||||
.organizationAccess as {
|
||||
profileLabel: string;
|
||||
}
|
||||
).profileLabel
|
||||
: (roleLabels[
|
||||
user.purchasing_role ??
|
||||
''
|
||||
] ?? 'Utilizador')}
|
||||
</span>
|
||||
</span>
|
||||
<ChevronDown className="size-3 text-muted-foreground" />
|
||||
|
||||
Reference in New Issue
Block a user