diff --git a/resources/js/components/simulation-form.tsx b/resources/js/components/simulation-form.tsx index 04a19aff..47f02b06 100644 --- a/resources/js/components/simulation-form.tsx +++ b/resources/js/components/simulation-form.tsx @@ -1107,6 +1107,9 @@ export function SimulationForm() { [ 'project_title', 'project_summary', + 'plan_objectives', + 'plan_mission', + 'plan_success_keys', 'project_problem', 'value_proposition', ].includes(field.key), @@ -1119,6 +1122,9 @@ export function SimulationForm() { ![ 'project_title', 'project_summary', + 'plan_objectives', + 'plan_mission', + 'plan_success_keys', 'project_problem', 'value_proposition', 'target_customers', diff --git a/resources/js/lib/form-help.ts b/resources/js/lib/form-help.ts index 60c19036..ca566f65 100644 --- a/resources/js/lib/form-help.ts +++ b/resources/js/lib/form-help.ts @@ -161,6 +161,28 @@ export function formFieldGuidance(field: HelpField): { 'Introduza a ligação completa para a página ou documento pedido.', example: 'https://exemplo.co.mz/documento', }; + // Business plan executive summary (model of the investor report). + if (/^objectivos do negocio/.test(label)) + return { + instruction: + 'Indique o que o negócio pretende atingir, de preferência com números e prazos, para bancos e parceiros poderem medir o progresso.', + example: + 'Lucro líquido de pelo menos 30% no primeiro ano; crescer de 24 para 35 clientes no ano seguinte.', + }; + if (/^missao/.test(label)) + return { + instruction: + 'Resuma em uma ou duas frases para quem o negócio existe e como pretende servir os clientes.', + example: + 'Servir os clientes com a lealdade de um parceiro de negócio, com resposta rápida e de qualidade.', + }; + if (/^chaves para o sucesso/.test(label)) + return { + instruction: + 'Indique os três a cinco factores de que o negócio depende para resultar.', + example: + 'Qualidade do serviço, boas relações com os clientes, equipa com experiência complementar.', + }; if (field.type === 'textarea') return { instruction: diff --git a/resources/js/lib/simulation-form.ts b/resources/js/lib/simulation-form.ts index 7eab1c28..2e2e8d2b 100644 --- a/resources/js/lib/simulation-form.ts +++ b/resources/js/lib/simulation-form.ts @@ -57,6 +57,9 @@ export function simulationFieldsForSection( [ 'project_title', 'project_summary', + 'plan_objectives', + 'plan_mission', + 'plan_success_keys', 'products_services', 'sector_id', 'activity_id', @@ -78,6 +81,9 @@ export function simulationFieldsForSection( ![ 'project_title', 'project_summary', + 'plan_objectives', + 'plan_mission', + 'plan_success_keys', 'products_services', 'sector_id', 'activity_id', diff --git a/tests/frontend/investor-decision-report.test.mjs b/tests/frontend/investor-decision-report.test.mjs index 0d8abe6a..23c12611 100644 --- a/tests/frontend/investor-decision-report.test.mjs +++ b/tests/frontend/investor-decision-report.test.mjs @@ -145,3 +145,39 @@ void test("the same missing classification for many months is one line with the assert.equal(lines.length, 1); assert.match(lines[0].message, /— meses 1 a 36:/); }); + +void test("the executive summary fields follow the summary in step 1 of the guided journey, with their own help (Criar Hotel)", async () => { + const { simulationFieldsForSection } = await import("../../resources/js/lib/simulation-form.ts"); + const { formFieldGuidance } = await import("../../resources/js/lib/form-help.ts"); + // Guided investment journey: steps come from the library. + const draft = { + journey_type: "investor", + detail_level: "simple", + purpose: "own_investment", + preferred_language: "pt-MZ", + project_title: "Criar Hotel", + }; + const step1 = simulationFieldsForSection(draft, "purpose").map((f) => f.key); + const at = step1.indexOf("project_summary"); + assert.deepEqual(step1.slice(at, at + 4), [ + "project_summary", + "plan_objectives", + "plan_mission", + "plan_success_keys", + ]); + const step2 = simulationFieldsForSection(draft, "market").map((f) => f.key); + assert.ok(!step2.some((k) => k.startsWith("plan_"))); + for (const label of ["Objectivos do negócio", "Missão", "Chaves para o sucesso"]) + assert.doesNotMatch( + formFieldGuidance({ label, type: "textarea", required: false }).instruction, + /Explique a informação pedida/, + ); + // Small-business journey: the component lists step 1 and step 2 itself. + const fs = await import("node:fs"); + const component = fs.readFileSync( + new URL("../../resources/js/components/simulation-form.tsx", import.meta.url), + "utf8", + ); + const lists = [...component.matchAll(/'project_summary',\s*'plan_objectives',\s*'plan_mission',\s*'plan_success_keys',/g)]; + assert.equal(lists.length, 2); +});