import { Head, Link, useForm } from '@inertiajs/react'; import { FormErrors, PageTitle, Panel, controlClass, } from '@/components/procurement'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { conflictScope } from '@/types/conflict'; import type { ConflictDeclaration } from '@/types/conflict'; import { date } from '@/types/procurement'; export default function DeclarationHistory({ history, canCorrect, }: { history: ConflictDeclaration[]; canCorrect: boolean; }) { const current = history[history.length - 1]; const form = useForm({ reason: current.reason, known_since: current.known_since.slice(0, 10), }); return ( <>
Voltar às declarações } />
    {history.map((d) => (
  1. Registo #{d.id} {d.previous_id ? ` · Correcção de #${d.previous_id}` : ' · Declaração inicial'}

    {d.author.name} · Registado em{' '} {date(d.declared_at)} às{' '} {d.declared_at.slice(11, 19)} UTC · Conhecimento em {date(d.known_since)}

    {d.reason}

  2. ))}
{canCorrect && (
{ e.preventDefault(); form.put(`/conflitos/${current.id}`, { preserveScroll: true, }); }} >
form.setData( 'known_since', e.target.value, ) } />