import { Head, Link, useForm } from '@inertiajs/react'; import { FormErrors, Panel, PageTitle, controlClass, } from '@/components/procurement'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; type Detail = { id: number; revision: number; bank_name: string; country: string; currency: string; beneficiary: string; account_identifier: string; evidence_reference: string; reason: string; }; type Props = { supplier: { id: number; name: string }; current: Detail | null; currentId: number; state: string; history: { id: number; revision: number; created_by: number; created_at: string; }[]; reviews: { id: number; supplier_bank_detail_id: number; reviewed_by: number; decision: string; }[]; canPropose: boolean; canReview: boolean; }; export default function Bank({ supplier, current, currentId, state, history, reviews, canPropose, canReview, }: Props) { const form = useForm({ previous_id: currentId, bank_name: '', country: '', currency: '', beneficiary: '', account_identifier: '', evidence_reference: '', reason: '', }); const review = useForm({ decision: 'approved', reason: '', independently_verified: false, }); const labels = { bank_name: 'Banco', country: 'Código do país (2 letras)', currency: 'Moeda da conta (3 letras)', beneficiary: 'Titular / beneficiário', account_identifier: 'Identificador da conta fornecido pelo banco', evidence_reference: 'Referência da evidência e confirmação independente', reason: 'Fundamento da alteração', }; const states: Record = { missing: 'Sem dados', pending: 'Pendente de duas validações', approved: 'Duplamente validado', rejected: 'Rejeitado', blocked: 'Bloqueado por elegibilidade ou conflito', }; return ( <>
← Ficha do fornecedor {current && (
{Object.entries(labels).map(([key, label]) => (
{label}
{current[key as keyof typeof labels]}
))}
)} {!current && (

Os identificadores bancários são apresentados apenas a Procurement e Finanças. Administração consulta o estado e o histórico.

)}
{canReview && current && state === 'pending' && (
{ e.preventDefault(); review.post( `/fornecedores/${supplier.id}/dados-bancarios/${current.id}/validar`, ); }} >