import { Head, Link, router, useForm } from "@inertiajs/react"; import { PageTitle, Panel, controlClass } from "@/components/procurement"; import { Button } from "@/components/ui/button"; import { roleLabels, statusLabels } from "@/types/procurement"; type Props = { ready: boolean; unread: number; view: string; search: string; notices: { current_page: number; total: number; data: { id: number; reference: string; role: string; role_label?: string | null; kind: string; outcome: string | null; current_status: string; created_at: string; read_at: string | null; href: string; }[]; prev_page_url: string | null; next_page_url: string | null; }; }; export default function Notices({ ready, unread, view, search, notices, }: Props) { const form = useForm({ view, search }); return ( <>
Todos os visíveis Intervenções pendentes Resultados dos meus pedidos Por ler ({unread}) As minhas aprovações
Localizar por referência da requisição
{ event.preventDefault(); form.transform((data) => ({ ...data, view, })); form.get("/requisicoes/avisos", { preserveState: true, }); }} > Limpar pesquisa {form.errors.search && (

{form.errors.search}

)}

{notices.total} aviso(s) nesta consulta · Página{" "} {notices.current_page}

{!ready ? (

Instalação dos avisos internos pendente.

) : notices.data.length === 0 ? (

Sem avisos neste âmbito.

) : ( notices.data.map((notice) => (
{notice.reference} ·{" "} {notice.role_label ?? roleLabels[notice.role] ?? notice.role} {notice.kind === "outcome" && (

Resultado registado:{" "} {notice.outcome === "approved" ? "requisição aprovada" : notice.outcome === "expired" ? "pedido devolvido por expiração" : "requisição rejeitada"} . Estado actual:{" "} {statusLabels[notice.current_status] ?? notice.current_status} . Consulte o processo para conhecer o fundamento e os passos seguintes.

)} {notice.kind === "reminder" && (

Lembrete da etapa de aprovação pendente.

)} {notice.kind === "escalation" && (

Alerta de escalamento da etapa pendente. Consulte o processo e os responsáveis actuais.

)}

{notice.read_at ? "Lido" : "Por ler"} · Criado em {notice.created_at}

{!notice.read_at && ( )}
)) )}
{notices.prev_page_url && ( Anterior )} {notices.next_page_url && ( Seguinte )}
); }