fix: share selected opportunity across simulator stages and land shortcuts
This commit is contained in:
@@ -45,6 +45,8 @@ export default function Detail({
|
||||
</Link>
|
||||
<PartnershipSourceLinks type="investment" id={r.id} />
|
||||
{auth.user&&dossierContext&&<nav aria-label="Preparar esta oportunidade" className="flex flex-wrap gap-4">
|
||||
<Link className="underline" href={`/simulador-fiscal?context=${encodeURIComponent(dossierContext)}&opportunity=opportunity%3A${r.id}`}>Simular esta oportunidade</Link>
|
||||
<Link className="underline" href={`/investimentos/${encodeURIComponent(dossierContext)}?opportunity=opportunity%3A${r.id}`}>Etapas e pedidos desta oportunidade</Link>
|
||||
<Link className="underline" href={`/investidor/terra-duat/novo?context=${encodeURIComponent(dossierContext)}&opportunity=opportunity%3A${r.id}`}>Terra/DUAT desta oportunidade</Link>
|
||||
<Link className="underline" href={`/balcao-virtual/dossiers/${encodeURIComponent(dossierContext)}?opportunity=opportunity%3A${r.id}`}>Balcão desta oportunidade</Link>
|
||||
</nav>}
|
||||
|
||||
@@ -34,6 +34,8 @@ type Step = {
|
||||
source_paragraph: number;
|
||||
};
|
||||
type Path = {
|
||||
context_opportunity: string | null;
|
||||
opportunity_options: NonNullable<DossierContext['opportunity_choices']>;
|
||||
private_investment?: Preparation | null;
|
||||
fintech: FintechView | null;
|
||||
investment_context: DossierContext | null;
|
||||
@@ -94,6 +96,7 @@ function Result({ result }: { result: PathResult }) {
|
||||
const values = recoverPathResult(result);
|
||||
return (
|
||||
<li className="space-y-1 rounded border p-3">
|
||||
{result.context_opportunity && <p>Oportunidade desta análise: {result.context_opportunity}</p>}
|
||||
{result.context_state === 'review_required' && (
|
||||
<p
|
||||
role="status"
|
||||
@@ -139,6 +142,7 @@ function Result({ result }: { result: PathResult }) {
|
||||
function Stage({ step, path }: { step: Step; path: Path }) {
|
||||
const form = useForm({
|
||||
version: path.case.version,
|
||||
context_opportunity: path.context_opportunity,
|
||||
context_revision: path.investment_context?.revision ?? 0,
|
||||
context_reviewed: false,
|
||||
state: path.canWrite ? 'preparing' : 'reviewing',
|
||||
@@ -411,6 +415,7 @@ export default function InvestmentPath(path: Path) {
|
||||
}>().props;
|
||||
const facts = useForm({
|
||||
version: path.case.version,
|
||||
context_opportunity: path.context_opportunity,
|
||||
...path.facts,
|
||||
reason: '',
|
||||
});
|
||||
@@ -439,6 +444,13 @@ export default function InvestmentPath(path: Path) {
|
||||
Os meus investimentos
|
||||
</Link>
|
||||
<h1 className="text-2xl font-semibold">{path.case.title}</h1>
|
||||
{!!path.opportunity_options?.length && <label className="block rounded border p-4">Oportunidade em tratamento
|
||||
<select className="ml-2 rounded border p-2" value={path.context_opportunity ?? ''} onChange={event => router.get(`/investimentos/${path.case.id}`, event.target.value ? {opportunity:event.target.value} : {}, {preserveState:false})}>
|
||||
<option value="">Escolha a oportunidade</option>
|
||||
{path.opportunity_options.map(choice => <option key={choice.opportunity.key} value={choice.opportunity.key}>{choice.opportunity.title} — {choice.territory?.title ?? 'Localização por definir'}</option>)}
|
||||
</select>
|
||||
{!path.context_opportunity && path.opportunity_options.length > 1 && <p>Escolha para consultar as etapas, os requisitos e o pedido de terra correspondentes. Os dados comuns conservam-se.</p>}
|
||||
</label>}
|
||||
<ContextDocuments
|
||||
source={path.investment_context?.selection.opportunity}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user