feat: preserve grounded sector ideas through private investment dossiers in QA
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import SectorContentAnalysis, {
|
||||
type SectorAnalysis,
|
||||
} from '@/components/sector-content-analysis';
|
||||
import { router } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import CatalogueChoiceSelect from '@/components/catalogue-choice-select';
|
||||
@@ -20,6 +23,7 @@ function DemographySelection({
|
||||
filters,
|
||||
territories,
|
||||
sectors,
|
||||
sectorReadings = [],
|
||||
}: {
|
||||
evidence: DemographicAnalysis;
|
||||
filters: {
|
||||
@@ -35,6 +39,11 @@ function DemographySelection({
|
||||
parent_id: string | null;
|
||||
}[];
|
||||
sectors: Record<string, string>;
|
||||
sectorReadings?: {
|
||||
title: string;
|
||||
href: string;
|
||||
analysis: SectorAnalysis;
|
||||
}[];
|
||||
}) {
|
||||
const [selected, setSelected] = useState(filters.territories ?? []);
|
||||
const [province, setProvince] = useState('');
|
||||
@@ -226,6 +235,15 @@ function DemographySelection({
|
||||
))}
|
||||
</section>
|
||||
)}
|
||||
{sectorReadings.map((reading) => (
|
||||
<section key={reading.href} className="space-y-3">
|
||||
<h2 className="text-xl font-semibold">{reading.title}</h2>
|
||||
<a href={reading.href} className="underline">
|
||||
Consultar contexto provincial completo
|
||||
</a>
|
||||
<SectorContentAnalysis data={reading.analysis} />
|
||||
</section>
|
||||
))}
|
||||
</Frame>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ export type InvestmentContext = {
|
||||
export default function InvestmentContexts({
|
||||
contexts,
|
||||
contentSource,
|
||||
sectorIdea,
|
||||
analysisAction,
|
||||
sectorSource,
|
||||
resourceSource,
|
||||
zoneSource,
|
||||
@@ -30,6 +32,15 @@ export default function InvestmentContexts({
|
||||
companyComparisonAnswers?: CompanyAnswers | null;
|
||||
guideSelection?: GuideSelection | null;
|
||||
contentSource?: LegacyArticle;
|
||||
sectorIdea?: {
|
||||
title: string;
|
||||
quote: string;
|
||||
location_label: string | null;
|
||||
evidence_key: string;
|
||||
source_sha256: string;
|
||||
source_version: number;
|
||||
} | null;
|
||||
analysisAction?: 'prepare' | 'compare';
|
||||
zoneSource?: {
|
||||
zone_id: string;
|
||||
consulted_public_version: number;
|
||||
@@ -44,10 +55,14 @@ export default function InvestmentContexts({
|
||||
zone_id: zoneSource?.zone_id,
|
||||
consulted_public_version: zoneSource?.consulted_public_version,
|
||||
confirm: !!zoneSource,
|
||||
title: '',
|
||||
title: sectorIdea?.title ?? '',
|
||||
client_key: key,
|
||||
reuse_consent: false,
|
||||
content_resource_id: contentSource?.id,
|
||||
evidence: sectorIdea?.evidence_key,
|
||||
source_sha256: sectorIdea?.source_sha256,
|
||||
source_version: sectorIdea?.source_version,
|
||||
idea: sectorIdea?.title,
|
||||
sector_slug: sectorSource?.slug,
|
||||
sector_reference: resourceSource
|
||||
? {
|
||||
@@ -101,9 +116,15 @@ export default function InvestmentContexts({
|
||||
{resourceSource && (
|
||||
<section className="rounded border p-4">
|
||||
<h2>{resourceSource.title}</h2>
|
||||
<p>{resourceSource.location_label ?? resourceSource.locations_text}</p>
|
||||
<p>
|
||||
{resourceSource.location_label ??
|
||||
resourceSource.locations_text}
|
||||
</p>
|
||||
<p>{resourceSource.value_chain}</p>
|
||||
<p>Esta referência será guardada apenas no dossier que escolher.</p>
|
||||
<p>
|
||||
Esta referência será guardada apenas no dossier que
|
||||
escolher.
|
||||
</p>
|
||||
</section>
|
||||
)}
|
||||
{contentSource && (
|
||||
@@ -115,6 +136,25 @@ export default function InvestmentContexts({
|
||||
.
|
||||
</p>
|
||||
)}
|
||||
{sectorIdea && (
|
||||
<section className="space-y-2 rounded border p-4">
|
||||
<h2>Hipótese a preparar: {sectorIdea.title}</h2>
|
||||
<p>
|
||||
{sectorIdea.location_label ??
|
||||
'Localização por escolher'}
|
||||
. Confirme a implantação no passo seguinte.
|
||||
</p>
|
||||
<details>
|
||||
<summary>Fundamento seleccionado</summary>
|
||||
<blockquote>{sectorIdea.quote}</blockquote>
|
||||
</details>
|
||||
<p>
|
||||
{analysisAction === 'compare'
|
||||
? 'Continue no seu dossier, guarde a localização e consulte a análise de mercado e oferta existente.'
|
||||
: 'A ideia e a fonte ficam no mesmo dossier. Complete apenas os dados em falta.'}
|
||||
</p>
|
||||
</section>
|
||||
)}
|
||||
<p>
|
||||
Prepare cada investimento no seu dossier. Pode trabalhar em
|
||||
várias etapas em paralelo.
|
||||
@@ -174,7 +214,13 @@ export default function InvestmentContexts({
|
||||
{
|
||||
version: item.version,
|
||||
sector_slug: sectorSource.slug,
|
||||
...(resourceSource ? { sector_reference: form.data.sector_reference } : {}),
|
||||
...(resourceSource
|
||||
? {
|
||||
sector_reference:
|
||||
form.data
|
||||
.sector_reference,
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -192,6 +238,12 @@ export default function InvestmentContexts({
|
||||
{
|
||||
version: item.version,
|
||||
resource_id: contentSource.id,
|
||||
evidence: sectorIdea?.evidence_key,
|
||||
source_sha256:
|
||||
sectorIdea?.source_sha256,
|
||||
source_version:
|
||||
sectorIdea?.source_version,
|
||||
idea: sectorIdea?.title,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { SectorAnalysisSnapshot } from '@/lib/investor-dossier-report';
|
||||
import type { SectorResourceSelection } from '@/components/sector-resource-reference';
|
||||
import { InvestorDossierReports } from '@/components/investor-dossier-reports';
|
||||
import type { InvestorDossierReportInput } from '@/lib/investor-dossier-report';
|
||||
@@ -120,6 +121,8 @@ type Path = {
|
||||
tools: Record<string, string | null>;
|
||||
results: PathResult[];
|
||||
content_sources: {
|
||||
analyses?: SectorAnalysisSnapshot[];
|
||||
analysis_review_required?: boolean;
|
||||
resource_id: number;
|
||||
title: string;
|
||||
return_href: string;
|
||||
@@ -375,7 +378,9 @@ function Stage({ step, path }: { step: Step; path: Path }) {
|
||||
}));
|
||||
form.post(
|
||||
`/investimentos/${path.case.id}/etapas/${step.code}`,
|
||||
{ preserveScroll: true },
|
||||
{
|
||||
preserveScroll: true,
|
||||
},
|
||||
);
|
||||
}}
|
||||
>
|
||||
@@ -851,6 +856,44 @@ export default function InvestmentPath(path: Path) {
|
||||
>
|
||||
Exemplar e origem
|
||||
</Link>
|
||||
{source.analysis_review_required && (
|
||||
<p role="status">
|
||||
A fonte foi alterada ou deixou de estar
|
||||
disponível. Reveja a hipótese; o trecho
|
||||
guardado foi preservado.
|
||||
</p>
|
||||
)}
|
||||
{(source.analyses ?? []).map((analysis) => (
|
||||
<details
|
||||
className="my-2 rounded border p-3"
|
||||
key={analysis.key}
|
||||
>
|
||||
<summary>
|
||||
Hipótese guardada: {analysis.title}
|
||||
</summary>
|
||||
<p>
|
||||
{analysis.location_label ??
|
||||
'Implantação por definir'}
|
||||
. Contexto da fonte, sem atribuição
|
||||
distrital automática.
|
||||
</p>
|
||||
<blockquote>
|
||||
{analysis.quote}
|
||||
</blockquote>
|
||||
<p>
|
||||
Edição: {analysis.source_date}.
|
||||
Preserve este fundamento e reveja-o
|
||||
se a fonte mudar.
|
||||
</p>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/investimentos/${path.case.id}/contexto/editar`}
|
||||
>
|
||||
Continuar a preparação no mesmo
|
||||
dossier
|
||||
</Link>
|
||||
</details>
|
||||
))}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
@@ -910,7 +953,9 @@ export default function InvestmentPath(path: Path) {
|
||||
}));
|
||||
facts.post(
|
||||
`/investimentos/${path.case.id}/aplicabilidade`,
|
||||
{ preserveScroll: true },
|
||||
{
|
||||
preserveScroll: true,
|
||||
},
|
||||
);
|
||||
}}
|
||||
>
|
||||
@@ -1252,7 +1297,9 @@ export default function InvestmentPath(path: Path) {
|
||||
}));
|
||||
task.post(
|
||||
`/investimentos/${path.case.id}/tarefas`,
|
||||
{ preserveScroll: true },
|
||||
{
|
||||
preserveScroll: true,
|
||||
},
|
||||
);
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import SectorContentAnalysis, {
|
||||
type SectorAnalysis,
|
||||
} from '@/components/sector-content-analysis';
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import EducationalArticleCard, {
|
||||
type EducationalArticle,
|
||||
} from '@/components/educational-article-card';
|
||||
|
||||
export type LegacyArticle = {
|
||||
sector_analysis?: SectorAnalysis;
|
||||
summary: string;
|
||||
opportunities_href?: string | null;
|
||||
opportunities_label?: string | null;
|
||||
@@ -72,6 +76,9 @@ export default function LegacySector({
|
||||
.legacy-article ol { list-style: decimal; padding-inline-start: 1.6em; }
|
||||
.legacy-article a { text-decoration: underline; }
|
||||
`}</style>
|
||||
{article.sector_analysis && (
|
||||
<SectorContentAnalysis data={article.sector_analysis} />
|
||||
)}
|
||||
<nav
|
||||
className="flex flex-wrap gap-4"
|
||||
aria-label={article.group.label}
|
||||
|
||||
Reference in New Issue
Block a user