Atalho Nova requisição só no contexto de Compras, como o menu

This commit is contained in:
2026-12-02 13:59:29 +02:00
parent 1d76b6c588
commit 9a57bb1ac6
4 changed files with 95 additions and 14 deletions
+10 -2
View File
@@ -9,8 +9,10 @@ import {
} from 'lucide-react';
import { PageTitle, Panel, RequisitionTable } from '@/components/procurement';
import { Button } from '@/components/ui/button';
import { contextOffersPath } from '@/lib/work-context-paths';
import { money } from '@/types/procurement';
import type { Company, Requisition } from '@/types/procurement';
import type { WorkContextState } from '@/types/work-context';
type Props = {
company: Company | null;
@@ -30,8 +32,14 @@ export default function Dashboard({
recent,
approvals,
}: Props) {
const canRequest = usePage().props.canRequest === true;
const publicNavigation = !!usePage().props.publicNavigation;
const { props } = usePage();
const canRequest =
props.canRequest === true &&
contextOffersPath(
props.workContext as WorkContextState | null | undefined,
'/requisicoes/criar',
);
const publicNavigation = !!props.publicNavigation;
const cards = [
{
label: 'Requisições',