This commit is contained in:
@@ -2,29 +2,38 @@ import { Link, router } from "@inertiajs/react";
|
||||
import { useState } from "react";
|
||||
import { Frame, button, card, input } from "./shared";
|
||||
import { TerritoryFields, type TerritoryOption } from "@/components/investment-territory";
|
||||
import { businessModalities } from "./business-types";
|
||||
|
||||
type PublicBusiness = {
|
||||
id: string; slug: string; title: string; objective?: string | null; stage?: string | null;
|
||||
id: string; slug: string; title: string; modality: string; objective?: string | null; stage?: string | null;
|
||||
amount_min?: string | null; amount_max?: string | null; currency?: string | null;
|
||||
sector?: { name: string; slug: string } | null; province?: string | null;
|
||||
};
|
||||
type PaginationLink = { url: string | null; label: string; active: boolean };
|
||||
type Props = { results: { data: PublicBusiness[]; links?: PaginationLink[] | { first: string | null; last: string | null; prev: string | null; next: string | null }; meta?: { links?: PaginationLink[]; total?: number } }; filters: { q?: string; province_id?: string; district_id?: string; admin_post_id?: string; locality_id?: string }; territorySelection?: TerritoryOption[] };
|
||||
type Props = { results: { data: PublicBusiness[]; links?: PaginationLink[] | { first: string | null; last: string | null; prev: string | null; next: string | null }; meta?: { links?: PaginationLink[]; total?: number } }; filters: { q?: string; modality?: string; province_id?: string; district_id?: string; admin_post_id?: string; locality_id?: string }; territorySelection?: TerritoryOption[] };
|
||||
|
||||
export default function BusinessMarketplace({ results, filters, territorySelection = [] }: Props) {
|
||||
const [query, setQuery] = useState(filters.q ?? "");
|
||||
const [modality, setModality] = useState(filters.modality ?? "");
|
||||
const [territory, setTerritory] = useState<Record<string, string>>({ province_id: filters.province_id ?? "", district_id: filters.district_id ?? "", admin_post_id: filters.admin_post_id ?? "", locality_id: filters.locality_id ?? "" });
|
||||
const returnQuery = new URLSearchParams({ ...(query ? { q: query } : {}), ...territory }).toString();
|
||||
const returnQuery = new URLSearchParams({ ...(query ? { q: query } : {}), ...(modality ? { modality } : {}), ...territory }).toString();
|
||||
const paginationLinks = results.meta?.links ?? (Array.isArray(results.links) ? results.links : []);
|
||||
return (
|
||||
<Frame title="Oportunidades de negócio">
|
||||
<p>Explore oportunidades aprovadas para publicação. A informação está sujeita a diligência independente.</p>
|
||||
<form className="flex flex-wrap gap-3" onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
router.get("/negocios", { q: query || undefined, ...territory }, { preserveState: true, preserveScroll: true });
|
||||
router.get("/negocios", { q: query || undefined, modality: modality || undefined, ...territory }, { preserveState: true, preserveScroll: true });
|
||||
}}>
|
||||
<label className="sr-only" htmlFor="business-search">Pesquisar negócios</label>
|
||||
<input id="business-search" className={input} value={query} maxLength={120} onChange={(event) => setQuery(event.target.value)} />
|
||||
<label className="grid gap-1">
|
||||
<span>Tipo de oportunidade</span>
|
||||
<select className={input} value={modality} onChange={(event) => setModality(event.target.value)}>
|
||||
<option value="">Todos os tipos</option>
|
||||
{Object.entries(businessModalities).map(([value, label]) => <option key={value} value={value}>{label}</option>)}
|
||||
</select>
|
||||
</label>
|
||||
<TerritoryFields initial={territorySelection} onChange={(path) => setTerritory({ province_id: path[0]?.id ?? "", district_id: path[1]?.id ?? "", admin_post_id: path[2]?.id ?? "", locality_id: path[3]?.id ?? "" })} />
|
||||
<button className={button}>Pesquisar</button>
|
||||
</form>
|
||||
@@ -33,6 +42,7 @@ export default function BusinessMarketplace({ results, filters, territorySelecti
|
||||
<ul className="grid gap-4 md:grid-cols-2">
|
||||
{results.data.map((record) => (
|
||||
<li className={card} key={record.id}>
|
||||
<p>{businessModalities[record.modality] ?? record.modality}</p>
|
||||
<h2 className="text-xl font-bold"><Link className="underline" href={`/negocios/${record.slug}${returnQuery ? `?${returnQuery}` : ""}`}>{record.title}</Link></h2>
|
||||
<p>{[record.sector?.name, record.province, record.stage].filter(Boolean).join(" · ")}</p>
|
||||
{(record.amount_min || record.amount_max) && <p>{record.amount_min ?? "—"} – {record.amount_max ?? "—"} {record.currency}</p>}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Link } from "@inertiajs/react";
|
||||
import { Frame, button, card } from "./shared";
|
||||
import { businessModalities } from "./business-types";
|
||||
|
||||
type Business = {
|
||||
slug: string; title: string; objective?: string | null; stage?: string | null; activity_code?: string | null;
|
||||
slug: string; title: string; modality: string; objective?: string | null; stage?: string | null; activity_code?: string | null;
|
||||
amount_min?: string | null; amount_max?: string | null; available_percentage?: string | null; currency?: string | null;
|
||||
province?: string | null; district?: string | null; locality?: string | null; sector?: { name: string; slug: string } | null;
|
||||
};
|
||||
@@ -12,6 +13,7 @@ export default function BusinessOpportunity({ record, returnUrl = "/negocios", i
|
||||
<Frame title={record.title}>
|
||||
<Link href={returnUrl} className="underline">Voltar às oportunidades</Link>
|
||||
<section className={`${card} space-y-4`}>
|
||||
<p>{businessModalities[record.modality] ?? record.modality}</p>
|
||||
<p>{[record.sector?.name, record.stage, record.activity_code].filter(Boolean).join(" · ")}</p>
|
||||
{(record.province || record.district || record.locality) && <p>{[record.locality, record.district, record.province].filter(Boolean).join(", ")}</p>}
|
||||
{(record.amount_min || record.amount_max) && <p>Montante indicativo: {record.amount_min ?? "—"} – {record.amount_max ?? "—"} {record.currency}</p>}
|
||||
|
||||
@@ -51,6 +51,7 @@ export const businessStates: Record<string, string> = {
|
||||
};
|
||||
export const businessModalities: Record<string, string> = {
|
||||
company_sale: 'Venda da empresa',
|
||||
company_purchase: 'Compra ou aquisição de empresa',
|
||||
participation_sale: 'Venda de participação',
|
||||
capital_increase: 'Aumento de capital',
|
||||
financial_investor: 'Investidor financeiro',
|
||||
|
||||
@@ -206,7 +206,11 @@ export default function Catalogue({
|
||||
<Link className={card} href="/zonas?category=zfi">Fichas de ZFI</Link>
|
||||
<Link className={card} href="/zonas?category=industrial_park">Parques industriais</Link>
|
||||
<Link className={card} href="/carteira?kind=project">Projectos âncora documentados</Link>
|
||||
<Link className={card} href="/negocios">Negócios e participações publicados</Link>
|
||||
<Link className={card} href="/negocios?modality=company_purchase">Comprar uma empresa</Link>
|
||||
<Link className={card} href="/negocios?modality=company_sale">Vender uma empresa</Link>
|
||||
<Link className={card} href="/negocios?modality=real_estate">Imobiliário</Link>
|
||||
<Link className={card} href="/negocios?modality=land_right">Terrenos e direitos fundiários</Link>
|
||||
<Link className={card} href="/negocios">Todos os negócios publicados</Link>
|
||||
</nav>
|
||||
<p>
|
||||
Combine contexto territorial, dimensão e necessidades. As fichas documentais e as
|
||||
@@ -308,6 +312,18 @@ export default function Catalogue({
|
||||
</select>
|
||||
</Field>
|
||||
</div>
|
||||
{(form.data.zee_id || form.data.zfi_id || form.data.park_id) && (() => {
|
||||
const selectedId = form.data.zee_id || form.data.zfi_id || form.data.park_id;
|
||||
const selectedZone = references.zones?.find((zone) => zone.id === selectedId);
|
||||
return selectedZone ? (
|
||||
<p role="status" className={card}>
|
||||
Enquadramento seleccionado: {selectedZone.name}.{' '}
|
||||
<Link className="underline" href={`/zonas/${selectedZone.id}`}>
|
||||
Abrir ficha e oportunidades associadas
|
||||
</Link>
|
||||
</p>
|
||||
) : null;
|
||||
})()}
|
||||
<section className="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
|
||||
<Field label="Estado de preparação">
|
||||
<select
|
||||
|
||||
@@ -32,7 +32,7 @@ type Zone = {
|
||||
area_value?: string | null;
|
||||
area_unit?: string | null;
|
||||
area_components?: unknown[];
|
||||
source_evidence?: unknown[];
|
||||
source_evidence?: { title: string; url: string; source_type: string; supports: string; source_date?: string | null }[];
|
||||
aliases?: string[];
|
||||
activities?: { name: string; status: string; source_reference?: string | null }[];
|
||||
resources?: { name: string; status: string; source_reference?: string | null }[];
|
||||
@@ -431,10 +431,11 @@ function Editor({
|
||||
}}>Guardar outra localização</button>
|
||||
</section>
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-bold">Revisão independente</h2>
|
||||
<h2 className="text-xl font-bold">Publicação informativa</h2>
|
||||
<p>
|
||||
Versão {z.version_no}. Outra pessoa gestora deve rever antes da
|
||||
publicação. Guarde primeiro as alterações.
|
||||
Versão {z.version_no}. Confirme os dados, a fonte e a localização antes
|
||||
de publicar. A publicação não confirma estado operacional, disponibilidade
|
||||
para investimento ou benefícios fiscais. Guarde primeiro as alterações.
|
||||
</p>
|
||||
<div className="flex gap-4">
|
||||
<button
|
||||
@@ -446,7 +447,7 @@ function Editor({
|
||||
})
|
||||
}
|
||||
>
|
||||
Validar e publicar
|
||||
Publicar zona
|
||||
</button>
|
||||
<button
|
||||
className={button}
|
||||
@@ -598,7 +599,7 @@ function Editor({
|
||||
<p>Categoria física: {z.physical_category ?? "Por confirmar"} · Regime jurídico: {z.legal_regime ?? "Por confirmar"}{zoneExtensionsAvailable ? ` · Desenvolvimento: ${z.development_status ?? "Por confirmar"} · Disponibilidade: ${z.availability_status ?? "Não informada"}` : ""}</p>
|
||||
{z.area_value && <p>Área documentada: {z.area_value} {z.area_unit}</p>}
|
||||
{zoneExtensionsAvailable && !!z.area_components?.length && <section className={card}><h2 className="font-bold">Áreas por âmbito</h2><ul>{z.area_components.map((area, index) => <li key={index}>{JSON.stringify(area)}</li>)}</ul></section>}
|
||||
{zoneExtensionsAvailable && !!z.source_evidence?.length && <section className={card}><h2 className="font-bold">Fontes e o que comprovam</h2><ul>{z.source_evidence.map((evidence, index) => <li key={index}>{JSON.stringify(evidence)}</li>)}</ul></section>}
|
||||
{zoneExtensionsAvailable && !!z.source_evidence?.length && <section className={card}><h2 className="font-bold">Fontes e o que comprovam</h2><ul>{z.source_evidence.map((evidence) => <li key={evidence.url}><a className="underline" href={evidence.url} target="_blank" rel="noreferrer">{evidence.title}</a>{evidence.source_date ? ` · ${evidence.source_date}` : " · data não indicada"} · {evidence.source_type} · {evidence.supports}</li>)}</ul><p>Esta informação descreve o que a fonte declara; não confirma vigência legal, benefícios, estado operacional ou disponibilidade para investimento.</p></section>}
|
||||
{z.historical_territory?.name && <p>Localização histórica: {z.historical_territory.name}{z.historical_territory.district ? ` · ${z.historical_territory.district}` : ""}{z.historical_territory.province ? ` · ${z.historical_territory.province}` : ""}</p>}
|
||||
{z.activities?.length ? <section className={card}><h2 className="text-xl font-bold">Actividades e sectores referidos</h2><ul>{z.activities.map((activity, index) => <li key={`${activity.name}-${index}`}>{activity.name} · {activity.status === "potential" ? "potencial referido; não confirmado como autorizado" : activity.status === "proposed" ? "proposto; não confirmado como autorizado" : activity.status === "authorized" ? "autorizado segundo a fonte indicada" : activity.status === "conditional" ? "condicionado segundo a fonte indicada" : "excluído segundo a fonte indicada"}{activity.source_reference ? ` · ${activity.source_reference}` : ""}</li>)}</ul></section> : null}
|
||||
{z.resources?.length ? <section className={card}><h2 className="text-xl font-bold">Infra-estruturas e recursos</h2>{z.resources.map((resource, index) => <p key={`${resource.name}-${index}`}>{resource.name} · {resource.status}{resource.source_reference ? ` · ${resource.source_reference}` : ""}</p>)}</section> : null}
|
||||
@@ -617,6 +618,8 @@ function Editor({
|
||||
{source && (
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-bold">Fonte e vigência</h2>
|
||||
{source.validation_status !== "validated" && <p role="status">Referência documental registada; validação jurídica da fonte pendente. A ficha não confirma vigência, benefício, operacionalidade ou disponibilidade.</p>}
|
||||
{source.validation_status !== "validated" && <p role="status">Referência documental registada; validação jurídica da fonte pendente. A ficha não confirma vigência, benefício fiscal, operacionalidade ou disponibilidade.</p>}
|
||||
<a
|
||||
className="underline"
|
||||
href={source.url}
|
||||
|
||||
@@ -26,6 +26,7 @@ type DocumentResource = {
|
||||
links: {
|
||||
target_type: string;
|
||||
target_key: string;
|
||||
target_label?: string | null;
|
||||
relationship: string;
|
||||
applicability: string;
|
||||
condition_text: string | null;
|
||||
@@ -83,6 +84,7 @@ export default function DocumentPage({
|
||||
<div><dt className="font-semibold">Situação documental</dt><dd>{legalStatusLabels[resource.legal_status] ?? resource.legal_status}</dd></div>
|
||||
<div><dt className="font-semibold">Fonte</dt><dd>{resource.source_confirmation === 'official_confirmed' ? 'Fonte oficial confirmada' : resource.source_confirmation === 'identified' ? 'Origem identificada' : 'Por confirmar'}</dd></div>
|
||||
</dl>
|
||||
{resource.source_confirmation === 'identified' && <p className="rounded border border-amber-300 bg-amber-50 p-3" role="note">A origem está identificada, mas a autenticidade desta cópia não foi confirmada independentemente. Consulte a fonte indicada.</p>}
|
||||
<p className="break-words text-sm">Referência: {resource.source_reference}</p>
|
||||
{resource.links.length > 0 && <section className="space-y-2">
|
||||
<h2 className="text-xl font-semibold">Base legal e documentos relacionados no portal</h2>
|
||||
@@ -90,7 +92,7 @@ export default function DocumentPage({
|
||||
{resource.links.map((link, index) => {
|
||||
const destination = link.target_type === 'module' ? modulePaths[link.target_key] : undefined;
|
||||
return <li key={`${link.target_type}-${link.target_key}-${index}`}>
|
||||
{destination ? <Link className="underline" href={destination.href}>{destination.label}</Link> : <span>{link.target_type === 'requirement' ? `Requisito documental: ${link.target_key}` : `${link.target_type}: ${link.target_key}`}</span>}
|
||||
{destination ? <Link className="underline" href={destination.href}>{destination.label}</Link> : <span>{link.target_type === 'requirement' ? `Requisito documental: ${link.target_label ?? link.target_key}` : `${link.target_type}: ${link.target_key}`}</span>}
|
||||
{' · '}{link.applicability === 'evidence' ? 'evidência documental' : link.applicability}
|
||||
{link.condition_text && <span> · Condição: {link.condition_text}</span>}
|
||||
{link.basis_reference && <span> · Referência documental (não é regra fiscal): {link.basis_reference}</span>}
|
||||
|
||||
@@ -80,6 +80,7 @@ type ResourceForm = Omit<
|
||||
| 'applicability'
|
||||
| 'condition_text'
|
||||
| 'basis_reference'
|
||||
| 'review_status'
|
||||
> & {
|
||||
document_id: string;
|
||||
title: string;
|
||||
@@ -158,10 +159,18 @@ export default function Manage({
|
||||
malwareHealth,
|
||||
malwareCounts,
|
||||
requirementCatalogue,
|
||||
requirementAssociationsEnabled,
|
||||
disclosureAuthorization,
|
||||
}: {
|
||||
documents: DocumentFile[];
|
||||
resources: Resource[];
|
||||
requirementCatalogue: { key: string; label: string; tax: string }[];
|
||||
requirementAssociationsEnabled: boolean;
|
||||
disclosureAuthorization: {
|
||||
external_id: string;
|
||||
occurred_at: string;
|
||||
resources: { id: number; title: string; published: boolean; rights_status: string }[];
|
||||
} | null;
|
||||
territories: { id: string; name: string; location_type: string }[];
|
||||
incompleteCount: number;
|
||||
possibleDuplicates: number;
|
||||
@@ -691,6 +700,7 @@ export default function Manage({
|
||||
Relacionar o mesmo documento a vários módulos não cria
|
||||
cópias.
|
||||
</p>
|
||||
{!requirementAssociationsEnabled && <p role="status" className="text-sm">As associações documentais a requisitos serão activadas após a migração de compatibilidade do catálogo.</p>}
|
||||
{form.data.associations.map((association, index) => (
|
||||
<div
|
||||
className="grid gap-2 rounded border p-3 sm:grid-cols-2"
|
||||
@@ -721,7 +731,7 @@ export default function Manage({
|
||||
'investment_type',
|
||||
'legal_source',
|
||||
'requirement',
|
||||
].map((v) => (
|
||||
].filter((v) => v !== 'requirement' || requirementAssociationsEnabled).map((v) => (
|
||||
<option key={v}>{v}</option>
|
||||
))}
|
||||
</select>
|
||||
@@ -891,6 +901,20 @@ export default function Manage({
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{disclosureAuthorization && (
|
||||
<section className="space-y-3 rounded border border-emerald-700 bg-emerald-50 p-5" aria-labelledby="disclosure-authorization-title">
|
||||
<h2 id="disclosure-authorization-title" className="text-xl font-bold">Autorização expressa de disponibilização documental</h2>
|
||||
<p>Registada em {new Date(disclosureAuthorization.occurred_at).toLocaleString()}; origem: instrução do utilizador, sem atribuição a gestor. Abrange consulta e download dos documentos listados e não certifica autenticidade ou vigência, nem activa cálculos fiscais.</p>
|
||||
<ul className="list-disc pl-6">
|
||||
{disclosureAuthorization.resources.map((resource) => <li key={resource.id}>#{resource.id} · {resource.title} · {resource.published ? 'já publicado' : `rascunho (${resource.rights_status})`}</li>)}
|
||||
</ul>
|
||||
<p className="text-sm">A acção mantém a autenticação de gestão e só publica ficheiros activos cujo hash corresponda ao resultado antimalware e que tenham fonte identificada. As situações de fonte e vigência são preservadas e apresentadas ao público. Registos que falhem estes controlos ficam pendentes individualmente.</p>
|
||||
<button type="button" className={button} disabled={disclosureAuthorization.resources.every((resource) => resource.published)} onClick={() => router.post('/management/portal-services/disclosure-authorization/apply', {}, { preserveScroll: true })}>
|
||||
Aplicar autorização e disponibilizar documentos elegíveis
|
||||
</button>
|
||||
</section>
|
||||
)}
|
||||
|
||||
<h2 className="text-xl font-bold">
|
||||
Registos, pendências e duplicados por rever
|
||||
</h2>
|
||||
|
||||
@@ -58,6 +58,7 @@ type Resource = {
|
||||
links: {
|
||||
target_type: string;
|
||||
target_key: string;
|
||||
target_label?: string | null;
|
||||
relationship: string;
|
||||
applicability: string;
|
||||
condition_text: string | null;
|
||||
@@ -1081,6 +1082,11 @@ export default function Services(p: Props) {
|
||||
: 'Fonte por confirmar'}
|
||||
</dd>
|
||||
</div>
|
||||
{r.source_confirmation === 'identified' && (
|
||||
<div className="sm:col-span-2 rounded border border-amber-300 bg-amber-50 p-3" role="note">
|
||||
A origem está identificada, mas a autenticidade desta cópia não foi confirmada independentemente. Consulte a fonte indicada.
|
||||
</div>
|
||||
)}
|
||||
<div>
|
||||
<dt className="font-semibold">
|
||||
Vigência
|
||||
@@ -1139,7 +1145,7 @@ export default function Services(p: Props) {
|
||||
</Link>
|
||||
) : (
|
||||
<>
|
||||
{link.target_type}: {link.target_key}
|
||||
{link.target_type === 'requirement' ? `Requisito documental: ${link.target_label ?? link.target_key}` : `${link.target_type}: ${link.target_key}`}
|
||||
</>
|
||||
)}{' '}
|
||||
· {link.relationship} ·{' '}
|
||||
|
||||
Reference in New Issue
Block a user