import { Link } from "@inertiajs/react"; import { cloneElement, isValidElement, useId, type ReactNode } from "react"; import { Layout } from "../portfolio/shared"; export type Option = { id: string | number; name: string }; export type Territory = { id: string; name: string; location_type: string; parent_id: string | null; }; export type Source = { type: string; target_id: string; title: string; href: string; }; export type Catalogues = { types: Record; criteria: Record; sectors: Option[]; territories: Territory[]; organizations: Option[]; sources?: Source[]; }; export type Partnership = { id: number; title: string; status: string; version: number; kind: string; partnership_type: string | null; sector_id: number | null; organization_id?: string | null; deadline: string | null; offer: string | null; seeking: string | null; payload: { summary?: string; requirements?: string; mandatory?: string[]; confidentiality?: string; consent?: boolean; availability?: string; }; }; export type Match = { score_min: number | null; score_max: number | null; eligibility: string; criteria: { code: string; label: string; weight: number; state: string; mandatory: boolean; evidence: string | null; explanation: string; }[]; }; export type Interest = { id: number; user_id: number; partnership_id: number; version: number; proposal: string; status: string; decision_reason: string | null; organization_id: string | null; payload: { capacity?: string; availability?: string; contribution?: string; conflicts?: string; consent?: boolean; }; assessment: Record; match: Match; room_id: number | null; }; export const labels: Record = { draft: "Rascunho", pending: "Submetida — legado", submitted: "Submetida", returned: "Devolvida", rejected: "Rejeitada", published: "Publicada", suspended: "Suspensa", archived: "Arquivada", withdrawn: "Retirada", clarification: "Em esclarecimento", shortlisted: "Lista curta", negotiation: "Em negociação", agreement_recorded: "Acordo registado", agreed: "Confirmado pelas partes", execution: "Em execução", closed: "Concluída", cancelled: "Cancelada", progress: "Em curso", completed: "Concluído", met: "Comprovadamente cumprido", unmet: "Comprovadamente incumprido", unknown: "Informação insuficiente", }; export const control = "w-full rounded border bg-background p-2"; export const button = "inline-flex rounded bg-emerald-800 px-4 py-2 text-white disabled:opacity-50"; export function Frame({ title, children, }: { title: string; children: ReactNode; }) { return ( {children} ); } export function Errors({ errors }: { errors: Record }) { return ( <> {Object.entries(errors).map(([key, message]) => (

{message}

))} ); } export function Field({ label, children, }: { label: string; children: ReactNode; }) { const id = useId(); return ( ); }