Skip to content

Commit

Permalink
project new fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mluena committed Oct 23, 2024
1 parent fb1edd5 commit a005d34
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 64 deletions.
79 changes: 69 additions & 10 deletions client/src/containers/projects/popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ const ProjectPopup = () => {
countries: {
fields: ["name"],
},
project_status: true,
project_type_of_funding: true,
status: {
fields: ["name"],
},
funding: {
fields: ["name"],
},
},
},
{
Expand All @@ -39,6 +43,12 @@ const ProjectPopup = () => {
const pillar = data?.data?.attributes?.pillar;
const sdgs = data?.data?.attributes?.sdgs;
const countries = data?.data?.attributes?.countries;
const projectStatus = data?.data?.attributes?.status?.data?.attributes?.name;
const projectTypeOfFunding = data?.data?.attributes?.funding?.data?.attributes?.name;
const organizationType = data?.data?.attributes?.organization_type;
const sourceCountry = data?.data?.attributes?.source_country;
const objective = data?.data?.attributes?.objective?.data?.attributes?.name;
const info = data?.data?.attributes?.info;

const { format } = Intl.NumberFormat("en-US", {
style: "currency",
Expand Down Expand Up @@ -79,14 +89,6 @@ const ProjectPopup = () => {
</div>
)}

{/* ACCOUNT */}
{!!data?.data?.attributes?.account && (
<div className="space-y-2.5">
<h3 className="text-xxs uppercase text-gray-500">Account</h3>
<div className="text-sm">{data?.data?.attributes?.account}</div>
</div>
)}

{/* AMOUNT */}
{!!data?.data?.attributes?.amount && (
<div className="space-y-2.5">
Expand All @@ -110,6 +112,7 @@ const ProjectPopup = () => {
</div>
</div>
)}

{/* SDGS */}
{!!sdgs?.data?.length && (
<div className="space-y-2.5">
Expand All @@ -127,6 +130,62 @@ const ProjectPopup = () => {
</ul>
</div>
)}

{/* ACCOUNT */}
{!!data?.data?.attributes?.account && (
<div className="space-y-2.5">
<h3 className="text-xxs uppercase text-gray-500">Account</h3>
<div className="text-sm">{data?.data?.attributes?.account}</div>
</div>
)}

{/* STATUS */}
{!!projectStatus && (
<div className="space-y-2.5">
<h3 className="text-xxs uppercase text-gray-500">Status</h3>
<div className="text-sm">{projectStatus}</div>
</div>
)}

{/* Source Country */}
{!!sourceCountry && (
<div className="space-y-2.5">
<h3 className="text-xxs uppercase text-gray-500">Source Country</h3>
<div className="text-sm">{sourceCountry}</div>
</div>
)}

{/* Organization Type */}
{!!organizationType && (
<div className="space-y-2.5">
<h3 className="text-xxs uppercase text-gray-500">Organization Type</h3>
<div className="text-sm">{organizationType}</div>
</div>
)}

{/* INFO */}
{!!info && (
<div className="space-y-2.5">
<h3 className="text-xxs uppercase text-gray-500">Info</h3>
<div className="text-sm">{info}</div>
</div>
)}

{/* Objective */}
{!!objective && (
<div className="space-y-2.5">
<h3 className="text-xxs uppercase text-gray-500">Objective</h3>
<div className="text-sm">{objective}</div>
</div>
)}

{/* TYPE OF FUNDING */}
{!!projectTypeOfFunding && (
<div className="space-y-2.5">
<h3 className="text-xxs uppercase text-gray-500">Type of funding</h3>
<div className="text-sm">{projectTypeOfFunding}</div>
</div>
)}
</section>
</div>
</Popup>
Expand Down
24 changes: 12 additions & 12 deletions cms/config/sync/admin-role.strapi-super-admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -995,13 +995,13 @@
"account",
"amount",
"sdgs",
"status",
"source_country",
"organization_type",
"objective",
"info",
"project_edit_suggestions",
"funding"
"funding",
"organization_type",
"source_country",
"status"
]
},
"conditions": []
Expand Down Expand Up @@ -1033,13 +1033,13 @@
"account",
"amount",
"sdgs",
"status",
"source_country",
"organization_type",
"objective",
"info",
"project_edit_suggestions",
"funding"
"funding",
"organization_type",
"source_country",
"status"
]
},
"conditions": []
Expand All @@ -1057,13 +1057,13 @@
"account",
"amount",
"sdgs",
"status",
"source_country",
"organization_type",
"objective",
"info",
"project_edit_suggestions",
"funding"
"funding",
"organization_type",
"source_country",
"status"
]
},
"conditions": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,103 +121,106 @@
"sortable": false
}
},
"status": {
"objective": {
"edit": {
"label": "status",
"label": "objective",
"description": "",
"placeholder": "",
"visible": true,
"editable": true
"editable": true,
"mainField": "type"
},
"list": {
"label": "status",
"label": "objective",
"searchable": true,
"sortable": true
}
},
"source_country": {
"info": {
"edit": {
"label": "source_country",
"label": "info",
"description": "",
"placeholder": "",
"visible": true,
"editable": true
},
"list": {
"label": "source_country",
"label": "info",
"searchable": true,
"sortable": true
}
},
"organization_type": {
"project_edit_suggestions": {
"edit": {
"label": "organization_type",
"label": "project_edit_suggestions",
"description": "",
"placeholder": "",
"visible": true,
"editable": true
"editable": true,
"mainField": "name"
},
"list": {
"label": "organization_type",
"searchable": true,
"sortable": true
"label": "project_edit_suggestions",
"searchable": false,
"sortable": false
}
},
"objective": {
"funding": {
"edit": {
"label": "objective",
"label": "funding",
"description": "",
"placeholder": "",
"visible": true,
"editable": true,
"mainField": "type"
"mainField": "name"
},
"list": {
"label": "objective",
"label": "funding",
"searchable": true,
"sortable": true
}
},
"info": {
"organization_type": {
"edit": {
"label": "info",
"label": "organization_type",
"description": "",
"placeholder": "",
"visible": true,
"editable": true
"editable": true,
"mainField": "name"
},
"list": {
"label": "info",
"label": "organization_type",
"searchable": true,
"sortable": true
}
},
"project_edit_suggestions": {
"source_country": {
"edit": {
"label": "project_edit_suggestions",
"label": "source_country",
"description": "",
"placeholder": "",
"visible": true,
"editable": true,
"mainField": "name"
"mainField": "code"
},
"list": {
"label": "project_edit_suggestions",
"searchable": false,
"sortable": false
"label": "source_country",
"searchable": true,
"sortable": true
}
},
"funding": {
"status": {
"edit": {
"label": "funding",
"label": "status",
"description": "",
"placeholder": "",
"visible": true,
"editable": true,
"mainField": "name"
},
"list": {
"label": "funding",
"label": "status",
"searchable": true,
"sortable": true
}
Expand Down
24 changes: 15 additions & 9 deletions cms/src/api/project/content-types/project/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@
"target": "api::sdg.sdg",
"inversedBy": "projects"
},
"status": {
"type": "string"
},
"source_country": {
"type": "string"
},
"organization_type": {
"type": "string"
},
"objective": {
"type": "relation",
"relation": "oneToOne",
Expand All @@ -69,6 +60,21 @@
"type": "relation",
"relation": "oneToOne",
"target": "api::types-of-funding.types-of-funding"
},
"organization_type": {
"type": "relation",
"relation": "oneToOne",
"target": "api::organization-type.organization-type"
},
"source_country": {
"type": "relation",
"relation": "oneToOne",
"target": "api::world-country.world-country"
},
"status": {
"type": "relation",
"relation": "oneToOne",
"target": "api::project-status.project-status"
}
}
}
18 changes: 15 additions & 3 deletions cms/types/generated/contentTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1312,9 +1312,6 @@ export interface ApiProjectProject extends Schema.CollectionType {
'manyToMany',
'api::sdg.sdg'
>;
status: Attribute.String;
source_country: Attribute.String;
organization_type: Attribute.String;
objective: Attribute.Relation<
'api::project.project',
'oneToOne',
Expand All @@ -1331,6 +1328,21 @@ export interface ApiProjectProject extends Schema.CollectionType {
'oneToOne',
'api::types-of-funding.types-of-funding'
>;
organization_type: Attribute.Relation<
'api::project.project',
'oneToOne',
'api::organization-type.organization-type'
>;
source_country: Attribute.Relation<
'api::project.project',
'oneToOne',
'api::world-country.world-country'
>;
status: Attribute.Relation<
'api::project.project',
'oneToOne',
'api::project-status.project-status'
>;
createdAt: Attribute.DateTime;
updatedAt: Attribute.DateTime;
publishedAt: Attribute.DateTime;
Expand Down

0 comments on commit a005d34

Please sign in to comment.