Skip to content

Commit

Permalink
example updated
Browse files Browse the repository at this point in the history
  • Loading branch information
mluena committed Nov 13, 2024
1 parent a0ff1c8 commit 25bb0ef
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export const PROJECTS_CSV_CONTENT = {
title: "Project/s",
columns: [
"name",
"highlight",
"status",
"objective",
"amount",
Expand All @@ -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",
],
};

Expand Down
56 changes: 53 additions & 3 deletions client/src/containers/projects/form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})),
},
},
Expand All @@ -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: {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -322,6 +344,7 @@ export default function ProjectForm() {
...(id && {
values: {
name: previousData?.name || "",
description: previousData?.highlight || "",
info: previousData?.info || "",
pillar:
// previousData.updatedAt ||
Expand Down Expand Up @@ -507,6 +530,7 @@ export default function ProjectForm() {
: getObjectDifferences(projectData?.data?.attributes, form.getValues());

const suggestionStatus = projectsSuggestedData?.data?.attributes?.review_status;

return (
<>
<DashboardFormControls
Expand Down Expand Up @@ -561,7 +585,7 @@ export default function ProjectForm() {
render={({ field }) => (
<FormItem className="space-y-1.5">
<FormLabel className="text-xs font-semibold">
Project detail<sup className="pl-0.5">*</sup>
Name<sup className="pl-0.5">*</sup>
</FormLabel>
<FormControl>
<Input
Expand All @@ -581,6 +605,32 @@ export default function ProjectForm() {
</FormItem>
)}
/>
<FormField
control={form.control}
name="description"
render={({ field }) => (
<FormItem className="space-y-1.5">
<FormLabel className="text-xs font-semibold">
Description<sup className="pl-0.5">*</sup>
</FormLabel>
<FormControl>
<Input
{...field}
value={field.value}
className={cn({
"border-none bg-gray-300/20 placeholder:text-gray-300/95": true,
"bg-green-400 placeholder:text-gray-400": changes?.includes(field.name),
})}
placeholder="Description"
disabled={
ME_DATA?.role?.type === "authenticated" && suggestionStatus === "declined"
}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="info"
Expand Down

0 comments on commit 25bb0ef

Please sign in to comment.