import { Head, Link, router, useForm } from '@inertiajs/react'; import { FormErrors, PageTitle, Panel, controlClass, } from '@/components/procurement'; import { Button } from '@/components/ui/button'; import { Label } from '@/components/ui/label'; import { date, roleLabels } from '@/types/procurement'; type Adoption = { id: number; revision: number; recommendation_policy_id: number; reason: string; snapshot: { roles: string[]; required_count: number; policy_revision: number; }; }; type Row = { id: number; reference: string; supplier_name: string; currency: string; total_minor: number; score_minor: number | null; eligible: boolean; ineligibility_reasons: string[]; evaluation_count: number; }; type Review = { id: number; verdict: string; reason: string; created_at: string; snapshot: { name: string; purchasing_role: string }; }; type Attempt = { id: number; revision: number; quotation_id: number; reason: string; status: string; current: boolean; canReview: boolean; created_at: string; basis_hash: string; snapshot: { proponent: { name: string }; basis: { rows: Row[] } }; reviews: Review[]; }; type Props = { requisition: { id: number; number: string }; policy: { id: number; revision: number; enabled: boolean } | null; adoption: Adoption | null; selected: Adoption | null; adoptions: Adoption[]; hasAdmission: boolean; basis: { hash: string; ready: boolean; top_ids: number[]; rows: Row[] }; previousId: number; history: { data: Attempt[]; prev_page_url: string | null; next_page_url: string | null; }; canAdopt: boolean; canPropose: boolean; closed: boolean; }; const statuses: Record = { pending: 'A aguardar conferência', confirmed: 'Recomendação confirmada', returned: 'Tentativa devolvida', }; const amount = (minor: number) => (minor / 100).toLocaleString('pt-PT', { minimumFractionDigits: 2, maximumFractionDigits: 2, }); function Reason({ id, value, onChange, }: { id: string; value: string; onChange: (value: string) => void; }) { return (