From 021a4ef06828cfd7ba0b79203f3a0a76e3846907 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mar=C3=ADa?=
{r.description}
Date: Wed, 13 Nov 2024 10:40:30 +0100 Subject: [PATCH 3/3] example updated --- .../new-dataset/step-description/constants.ts | 9 +-- client/src/containers/projects/form/index.tsx | 56 ++++++++++++++++++- 2 files changed, 58 insertions(+), 7 deletions(-) diff --git a/client/src/components/new-dataset/step-description/constants.ts b/client/src/components/new-dataset/step-description/constants.ts index ce9b240..7bcf8da 100644 --- a/client/src/components/new-dataset/step-description/constants.ts +++ b/client/src/components/new-dataset/step-description/constants.ts @@ -2,6 +2,7 @@ export const PROJECTS_CSV_CONTENT = { title: "Project/s", columns: [ "name", + "highlight", "status", "objective", "amount", @@ -14,10 +15,10 @@ export const PROJECTS_CSV_CONTENT = { "funding", ], examples: [ - "Import test 1, In Execution, Seeking Collaborative Partnerships, 120000, Jamaica; Bahamas; Belize, The United States, SDG 12 - Responsible production and consumption; SDG 13 - Climate Action; SDG 17 - Partnership for the goals, 1.5% New Green Jobs for Physical & Economic Resilience, For-profit, example info 1, Grant", - "Import test 2, Completed, Building Public Awareness and Engagement, 120001, Trinidad and Tobago; Belize, Trinidad & Tobago, SDG 7 - Affordable and clean energy; SDG 8 - Decent work and economic growth; SDG 9 - Industry Innovation and Infrastructure; SDG 11 - Sustainable Cities and Communities; SDG 12 - Responsible production and consumption; SDG 13 - Climate Action; SDG 17 - Partnership for the goals, 90% Renewable Energy for All, For-profit, example info 2, Loan", - "Import test 3, Start-up to Early Stage, An Opportunity to Scale to New jurisdictions, 120002, Belize; Bahamas, Belize, SDG 7 - Affordable and clean energy; SDG 13 - Climate Action; SDG 17 - Partnership for the goals, 90% Renewable Energy for All, For-profit, example info 3, Venture Capital", - "Import test 4, Start-up to Early Stage, Attracting Investment and Securing Funding, 120003, Bahamas, Barbados, SDG 7 - Affordable and clean energy; SDG 8 - Decent work and economic growth; SDG 9 - Industry Innovation and Infrastructure; SDG 11 - Sustainable Cities and Communities; SDG 12 - Responsible production and consumption; SDG 13 - Climate Action; SDG 17 - Partnership for the goals, 90% Renewable Energy for All, For-profit, example info 3, Venture Debt", + "Import test 1, In Execution, Highlight 1, Seeking Collaborative Partnerships, 120000, Jamaica; Bahamas; Belize, The United States, SDG 12 - Responsible production and consumption; SDG 13 - Climate Action; SDG 17 - Partnership for the goals, 1.5% New Green Jobs for Physical & Economic Resilience, For-profit, example info 1, Grant", + "Import test 2, Highlight 2, Completed, Building Public Awareness and Engagement, 120001, Trinidad and Tobago; Belize, Trinidad & Tobago, SDG 7 - Affordable and clean energy; SDG 8 - Decent work and economic growth; SDG 9 - Industry Innovation and Infrastructure; SDG 11 - Sustainable Cities and Communities; SDG 12 - Responsible production and consumption; SDG 13 - Climate Action; SDG 17 - Partnership for the goals, 90% Renewable Energy for All, For-profit, example info 2, Loan", + "Import test 3, Highlight 3, Start-up to Early Stage, An Opportunity to Scale to New jurisdictions, 120002, Belize; Bahamas, Belize, SDG 7 - Affordable and clean energy; SDG 13 - Climate Action; SDG 17 - Partnership for the goals, 90% Renewable Energy for All, For-profit, example info 3, Venture Capital", + "Import test 4, Highlight 4, Start-up to Early Stage, Attracting Investment and Securing Funding, 120003, Bahamas, Barbados, SDG 7 - Affordable and clean energy; SDG 8 - Decent work and economic growth; SDG 9 - Industry Innovation and Infrastructure; SDG 11 - Sustainable Cities and Communities; SDG 12 - Responsible production and consumption; SDG 13 - Climate Action; SDG 17 - Partnership for the goals, 90% Renewable Energy for All, For-profit, example info 3, Venture Debt", ], }; diff --git a/client/src/containers/projects/form/index.tsx b/client/src/containers/projects/form/index.tsx index b0f4a03..f5c1b74 100644 --- a/client/src/containers/projects/form/index.tsx +++ b/client/src/containers/projects/form/index.tsx @@ -171,7 +171,7 @@ export default function ProjectForm() { select: (data) => data?.data?.map((status) => ({ label: status?.attributes?.name as string, - value: status?.attributes?.code as string, + value: status?.id as number, })), }, }, @@ -195,7 +195,28 @@ export default function ProjectForm() { const { data: projectData } = useGetProjectsId( +id, { - populate: "*", + populate: { + pillar: true, + sdgs: true, + countries: { + fields: ["name"], + }, + status: { + fields: ["name"], + }, + funding: { + fields: ["name"], + }, + objective: { + fields: ["type"], + }, + organization_type: { + fields: ["name"], + }, + source_country: { + fields: ["name"], + }, + }, }, { query: { @@ -285,6 +306,7 @@ export default function ProjectForm() { const formSchema = z.object({ name: z.string().min(1, { message: "Please enter project's details" }), + description: z.string().min(1, { message: "Please enter project's description" }), info: z.string().optional(), pillar: z.coerce.number().min(1, { message: "Please select at least one pillar", @@ -322,6 +344,7 @@ export default function ProjectForm() { ...(id && { values: { name: previousData?.name || "", + description: previousData?.highlight || "", info: previousData?.info || "", pillar: // previousData.updatedAt || @@ -507,6 +530,7 @@ export default function ProjectForm() { : getObjectDifferences(projectData?.data?.attributes, form.getValues()); const suggestionStatus = projectsSuggestedData?.data?.attributes?.review_status; + return ( <>