import { InvestmentConsumerIdentity } from '@/components/investment-consumer-identity'; import { Link, router, useForm } from '@inertiajs/react'; import { useState } from 'react'; type Props = { case: { id: string; reference: string; version: number; status: string; payload: Record; updated_at: string; }; documents: { id: string; category: string; file_name: string; status: 'active' | 'quarantined'; }[]; events: { action: string; version: number; metadata: Record; created_at: string; }[]; disclaimer: string; management: boolean; returnDossier?: { id: string; title: string; url: string } | null; countryName: string; declaredOrigin: { code: string | null; name: string }; territoryPaths: { id: string; name: string; location_type: string }[][]; }; const statusLabels: Record = { draft: 'Rascunho privado', support_requested: 'Apoio solicitado ao InvestMoz', internal_review: 'Análise interna', waiting_applicant: 'A aguardar informação do requerente', referral_prepared: 'Encaminhamento preparado (não submetido)', closed: 'Encerrado no InvestMoz', }; const actionLabels: Record = { draft_created: 'Rascunho criado', draft_updated: 'Rascunho actualizado', support_requested: 'Pedido de apoio registado', status_changed: 'Estado interno actualizado', attachment_added: 'Documento anexado', applicant_update_recorded: 'Actualização comunicada pelo requerente', }; const categoryLabels: Record = { sketch: 'Planta/esboço', prior_right: 'Antecedente de direito', exploration_plan: 'Plano de exploração', official_receipt: 'Recibo/comunicação oficial', consultation_minutes: 'Acta/minuta', photo: 'Fotografia', other: 'Outro', }; export default function LandCase({ case: record, documents, events, disclaimer, management, countryName, declaredOrigin, territoryPaths, returnDossier, }: Props) { const [file, setFile] = useState(null); const [category, setCategory] = useState('other'); const [_status, _setStatus] = useState('internal_review'); const upload = useForm({ version: record.version, category, file: null as File | null, }); const report = useForm({ version: record.version, reported_status: '', official_reference: '', receiving_entity: '', reported_at: '', }); const change = useForm({ version: record.version, status: 'internal_review', evidence_reference: '', }); const canEdit = ['draft', 'waiting_applicant'].includes(record.status); const payload = record.payload ?? {}; const supportKinds: Record = { investment: 'Terra para investimento', home: 'Habitação', family_exploitation: 'Exploração familiar', recognition: 'Reconhecimento/titulação', regularization: 'Regularização cadastral', delimitation: 'Delimitação/demarcação', change_of_use: 'Alteração de uso/área', transfer: 'Transmissão/herança', existing_process: 'Processo existente', conflict_guidance: 'Orientação sobre conflito/restrição', other: 'Outro', }; return (
{returnDossier && ( Voltar ao dossier: {returnDossier.title} )} Os meus pedidos Terra e DUAT

Acompanhamento {record.reference}

Referência interna InvestMoz · versão {record.version} ·{' '} {statusLabels[record.status] ?? record.status}

{disclaimer}

{record.status === 'referral_prepared' && (

O encaminhamento foi preparado internamente. Não há confirmação de submissão nem de recepção por entidade pública.

)}
{!management && canEdit && ( Continuar preenchimento )} {!management && ( Imprimir / guardar cópia preenchida como PDF )}

Resumo informado pelo requerente

Tipo:{' '} {supportKinds[payload.support_kind] ?? 'Por indicar'}

Requerente:{' '} {payload.full_name ?? 'Por indicar'}

Categoria:{' '} {payload.applicant_category ?? 'Por indicar'}

País do requerente: {countryName}

Origem declarada da solicitação:{' '} {declaredOrigin.name}

Contacto preferido:{' '} {payload.preferred_contact ?? 'Por indicar'}

Descrição:{' '} {payload.request_description ?? 'Por indicar'}

Uso pretendido:{' '} {payload.purpose ?? 'Por indicar'}

Localização declarada:{' '} {(payload.parcels ?? []) .map((parcel: any) => parcel.place_description) .filter(Boolean) .join('; ') || 'Por localizar/confirmar'}

{territoryPaths.map( (path, index) => path.length > 0 && ( Parcela {index + 1}:{' '} {path .map((territory) => territory.name) .join(' → ')} ), )} Dados e situação geográfica aqui exibidos são declarações do requerente; não confirmam direitos ou disponibilidade cadastral.

{!management && (

Comunicar actualização

A informação fica identificada como comunicada por si e não é confirmada automaticamente pelo InvestMoz.