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; 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} ·{' '} {roleLabels[notice.role] ?? notice.role} {notice.kind === 'outcome' && (

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

)}

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

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