diff --git a/i18n/en.pot b/i18n/en.pot
new file mode 100644
index 0000000..25d6bff
--- /dev/null
+++ b/i18n/en.pot
@@ -0,0 +1,18 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: i18next-conv\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+"POT-Creation-Date: 2024-04-17T11:48:54.313Z\n"
+"PO-Revision-Date: 2024-04-17T11:48:54.313Z\n"
+
+msgid "Home"
+msgstr "Home"
+
+msgid "DHIS2 Web App Academy 2024"
+msgstr "DHIS2 Web App Academy 2024"
+
+msgid "Made by Edson"
+msgstr "Made by Edson"
diff --git a/i18n/fr.po b/i18n/fr.po
new file mode 100644
index 0000000..bb08a43
--- /dev/null
+++ b/i18n/fr.po
@@ -0,0 +1,21 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: i18next-conv\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+"POT-Creation-Date: 2024-04-16T16:25:40.484Z\n"
+"PO-Revision-Date: 2024-04-16T16:25:40.484Z\n"
+
+msgid "Form"
+msgstr "Formulario"
+
+msgid "Home"
+msgstr "Casa"
+
+msgid "DHIS2 Web App Academy 2024"
+msgstr "DHIS2 Web App Academy 2024"
+
+msgid "Made by Edson"
+msgstr "Made by Edson"
diff --git a/package.json b/package.json
index 0c33cfc..e25a4b5 100644
--- a/package.json
+++ b/package.json
@@ -18,6 +18,8 @@
},
"dependencies": {
"@dhis2/app-runtime": "^3.10.3",
+ "@dhis2/d2-i18n": "^1.1.3",
+ "@dhis2/ui": "9.4.3",
"react-router-dom": "^6.22.3"
}
}
diff --git a/src/App.js b/src/App.js
index be72803..e402bb1 100644
--- a/src/App.js
+++ b/src/App.js
@@ -3,6 +3,7 @@ import { HashRouter, Navigate, Route, Routes } from 'react-router-dom'
import styles from './App.module.css'
import { Navigation } from './navigation/index.js'
import { Form, Home, Attributes } from './views/index.js'
+import i18n from './locales/index.js'
const MyApp = () => (
+
+ case "select":
+ return
+
+ case "boolean":
+ return
+
+ default:
+ Type not mapped
+ }
+}
+
+export default GenericFields
\ No newline at end of file
diff --git a/src/components/fields/fieldsComponent/Select.js b/src/components/fields/fieldsComponent/Select.js
new file mode 100644
index 0000000..0bd43e7
--- /dev/null
+++ b/src/components/fields/fieldsComponent/Select.js
@@ -0,0 +1,9 @@
+import React from 'react'
+
+function Select() {
+ return (
+
Select
+ )
+}
+
+export default Select
\ No newline at end of file
diff --git a/src/components/fields/fieldsComponent/Text.js b/src/components/fields/fieldsComponent/Text.js
new file mode 100644
index 0000000..f1259eb
--- /dev/null
+++ b/src/components/fields/fieldsComponent/Text.js
@@ -0,0 +1,9 @@
+import React from 'react'
+
+function Text() {
+ return (
+ Text
+ )
+}
+
+export default Text
\ No newline at end of file
diff --git a/src/components/fields/fieldsComponent/TrueOrFalse.js b/src/components/fields/fieldsComponent/TrueOrFalse.js
new file mode 100644
index 0000000..0c53838
--- /dev/null
+++ b/src/components/fields/fieldsComponent/TrueOrFalse.js
@@ -0,0 +1,9 @@
+import React from 'react'
+
+function TrueOrFalse() {
+ return (
+ TrueOrFalse
+ )
+}
+
+export default TrueOrFalse
\ No newline at end of file
diff --git a/src/views/Form.module.css b/src/components/form/Form.module.css
similarity index 100%
rename from src/views/Form.module.css
rename to src/components/form/Form.module.css
diff --git a/src/components/form/GroupForm.js b/src/components/form/GroupForm.js
new file mode 100644
index 0000000..eea2ba7
--- /dev/null
+++ b/src/components/form/GroupForm.js
@@ -0,0 +1,147 @@
+import {
+ ReactFinalForm,
+ InputFieldFF,
+ SingleSelectFieldFF,
+ SwitchFieldFF,
+ composeValidators,
+ createEqualTo,
+ email,
+ hasValue,
+ Button,
+ dhis2Password
+} from '@dhis2/ui'
+import React from 'react'
+import styles from './Form.module.css'
+import useAlerts from '../../hooks/useAlert'
+
+function GroupForm() {
+ const { hide, show } = useAlerts()
+
+ const alertValues = (values) => {
+ const formattedValuesString = JSON.stringify(values, null, 2)
+ // console.log(values, formattedValuesString);
+
+ show({
+ message: formattedValuesString,
+ type: { critical: true }
+ });
+
+ }
+
+ setTimeout(() => {
+ console.log('hide', hide)
+ hide();
+ }, 3000);
+
+
+ return (
+
+
+ {({ handleSubmit }) => (
+
+ )}
+
+
+ )
+}
+
+export default GroupForm
diff --git a/src/components/table/Table.js b/src/components/table/Table.js
new file mode 100644
index 0000000..e385034
--- /dev/null
+++ b/src/components/table/Table.js
@@ -0,0 +1,48 @@
+import React from 'react'
+import { CircularLoader, DataTable, CenteredContent, DataTableRow, DataTableCell, DataTableColumnHeader, TableHead, TableBody } from '@dhis2/ui'
+
+
+function Table({ data = [], loading }) {
+ const header = data?.length > 0 && Object.keys(data[0])
+
+ if (loading) {
+ return (
+
+
+
+ )
+ }
+
+ return (
+
+
+
+ {header && header.map(head => {
+ return (
+
+ {head}
+
+ )
+ })}
+
+
+
+ {data.length > 0 && data.map(row => {
+ return (
+
+ {header.map(head =>
+ (
+
+ {row[head]}
+
+ )
+ )}
+
+ )
+ })}
+
+
+ )
+}
+
+export default Table
\ No newline at end of file
diff --git a/src/components/table/index.js b/src/components/table/index.js
new file mode 100644
index 0000000..e7594bb
--- /dev/null
+++ b/src/components/table/index.js
@@ -0,0 +1 @@
+export * from './Table.js'
diff --git a/src/constants/rosources.json b/src/constants/rosources.json
new file mode 100644
index 0000000..02ee145
--- /dev/null
+++ b/src/constants/rosources.json
@@ -0,0 +1,538 @@
+{
+ "resources": [
+ {
+ "displayName": "Program Indicators",
+ "singular": "programIndicator",
+ "plural": "programIndicators",
+ "href": "https://dev.im.dhis2.org/academy-web/api/programIndicators"
+ },
+ {
+ "displayName": "Event Visualizations",
+ "singular": "eventVisualization",
+ "plural": "eventVisualizations",
+ "href": "https://dev.im.dhis2.org/academy-web/api/eventVisualizations"
+ },
+ {
+ "displayName": "Min Max Data Elements",
+ "singular": "minMaxDataElement",
+ "plural": "minMaxDataElements",
+ "href": "https://dev.im.dhis2.org/academy-web/api/minMaxDataElements"
+ },
+ {
+ "displayName": "Job Configurations",
+ "singular": "jobConfiguration",
+ "plural": "jobConfigurations",
+ "href": "https://dev.im.dhis2.org/academy-web/api/jobConfigurations"
+ },
+ {
+ "displayName": "Relationships",
+ "singular": "relationship",
+ "plural": "relationships",
+ "href": "https://dev.im.dhis2.org/academy-web/api/relationships"
+ },
+ {
+ "displayName": "Attributes",
+ "singular": "attribute",
+ "plural": "attributes",
+ "href": "https://dev.im.dhis2.org/academy-web/api/attributes"
+ },
+ {
+ "displayName": "Program Notification Templates",
+ "singular": "programNotificationTemplate",
+ "plural": "programNotificationTemplates",
+ "href": "https://dev.im.dhis2.org/academy-web/api/programNotificationTemplates"
+ },
+ {
+ "displayName": "Option Groups",
+ "singular": "optionGroup",
+ "plural": "optionGroups",
+ "href": "https://dev.im.dhis2.org/academy-web/api/optionGroups"
+ },
+ {
+ "displayName": "Proposals",
+ "singular": "proposal",
+ "plural": "proposals",
+ "href": "https://dev.im.dhis2.org/academy-web/api/metadata/proposals"
+ },
+ {
+ "displayName": "Option Sets",
+ "singular": "optionSet",
+ "plural": "optionSets",
+ "href": "https://dev.im.dhis2.org/academy-web/api/optionSets"
+ },
+ {
+ "displayName": "Program Sections",
+ "singular": "programSection",
+ "plural": "programSections",
+ "href": "https://dev.im.dhis2.org/academy-web/api/programSections"
+ },
+ {
+ "displayName": "Tracked Entity Instances",
+ "singular": "trackedEntityInstance",
+ "plural": "trackedEntityInstances",
+ "href": "https://dev.im.dhis2.org/academy-web/api/trackedEntityInstances"
+ },
+ {
+ "displayName": "Visualizations",
+ "singular": "visualization",
+ "plural": "visualizations",
+ "href": "https://dev.im.dhis2.org/academy-web/api/visualizations"
+ },
+ {
+ "displayName": "Validation Rule Groups",
+ "singular": "validationRuleGroup",
+ "plural": "validationRuleGroups",
+ "href": "https://dev.im.dhis2.org/academy-web/api/validationRuleGroups"
+ },
+ {
+ "displayName": "Category Option Combos",
+ "singular": "categoryOptionCombo",
+ "plural": "categoryOptionCombos",
+ "href": "https://dev.im.dhis2.org/academy-web/api/categoryOptionCombos"
+ },
+ {
+ "displayName": "Maps",
+ "singular": "map",
+ "plural": "maps",
+ "href": "https://dev.im.dhis2.org/academy-web/api/maps"
+ },
+ {
+ "displayName": "Validation Results",
+ "singular": "validationResult",
+ "plural": "validationResults",
+ "href": "https://dev.im.dhis2.org/academy-web/api/validationResults"
+ },
+ {
+ "displayName": "Category Options",
+ "singular": "categoryOption",
+ "plural": "categoryOptions",
+ "href": "https://dev.im.dhis2.org/academy-web/api/categoryOptions"
+ },
+ {
+ "displayName": "Organisation Unit Groups",
+ "singular": "organisationUnitGroup",
+ "plural": "organisationUnitGroups",
+ "href": "https://dev.im.dhis2.org/academy-web/api/organisationUnitGroups"
+ },
+ {
+ "displayName": "Data Sets",
+ "singular": "dataSet",
+ "plural": "dataSets",
+ "href": "https://dev.im.dhis2.org/academy-web/api/dataSets"
+ },
+ {
+ "displayName": "File Resources",
+ "singular": "fileResource",
+ "plural": "fileResources",
+ "href": "https://dev.im.dhis2.org/academy-web/api/fileResources"
+ },
+ {
+ "displayName": "Category Option Group Sets",
+ "singular": "categoryOptionGroupSet",
+ "plural": "categoryOptionGroupSets",
+ "href": "https://dev.im.dhis2.org/academy-web/api/categoryOptionGroupSets"
+ },
+ {
+ "displayName": "Data Elements",
+ "singular": "dataElement",
+ "plural": "dataElements",
+ "href": "https://dev.im.dhis2.org/academy-web/api/dataElements"
+ },
+ {
+ "displayName": "Option Group Sets",
+ "singular": "optionGroupSet",
+ "plural": "optionGroupSets",
+ "href": "https://dev.im.dhis2.org/academy-web/api/optionGroupSets"
+ },
+ {
+ "displayName": "Program Stage Sections",
+ "singular": "programStageSection",
+ "plural": "programStageSections",
+ "href": "https://dev.im.dhis2.org/academy-web/api/programStageSections"
+ },
+ {
+ "displayName": "Predictors",
+ "singular": "predictor",
+ "plural": "predictors",
+ "href": "https://dev.im.dhis2.org/academy-web/api/predictors"
+ },
+ {
+ "displayName": "Predictor Groups",
+ "singular": "predictorGroup",
+ "plural": "predictorGroups",
+ "href": "https://dev.im.dhis2.org/academy-web/api/predictorGroups"
+ },
+ {
+ "displayName": "Validation Rules",
+ "singular": "validationRule",
+ "plural": "validationRules",
+ "href": "https://dev.im.dhis2.org/academy-web/api/validationRules"
+ },
+ {
+ "displayName": "Tracked Entity Attributes",
+ "singular": "trackedEntityAttribute",
+ "plural": "trackedEntityAttributes",
+ "href": "https://dev.im.dhis2.org/academy-web/api/trackedEntityAttributes"
+ },
+ {
+ "displayName": "Data Stores",
+ "singular": "dataStore",
+ "plural": "dataStores",
+ "href": "https://dev.im.dhis2.org/academy-web/api/dataStore"
+ },
+ {
+ "displayName": "Event Charts",
+ "singular": "eventChart",
+ "plural": "eventCharts",
+ "href": "https://dev.im.dhis2.org/academy-web/api/eventCharts"
+ },
+ {
+ "displayName": "Tracked Entity Types",
+ "singular": "trackedEntityType",
+ "plural": "trackedEntityTypes",
+ "href": "https://dev.im.dhis2.org/academy-web/api/trackedEntityTypes"
+ },
+ {
+ "displayName": "Dashboards",
+ "singular": "dashboard",
+ "plural": "dashboards",
+ "href": "https://dev.im.dhis2.org/academy-web/api/dashboards"
+ },
+ {
+ "displayName": "Reports",
+ "singular": "report",
+ "plural": "reports",
+ "href": "https://dev.im.dhis2.org/academy-web/api/reports"
+ },
+ {
+ "displayName": "Users",
+ "singular": "user",
+ "plural": "users",
+ "href": "https://dev.im.dhis2.org/academy-web/api/users"
+ },
+ {
+ "displayName": "Programs",
+ "singular": "program",
+ "plural": "programs",
+ "href": "https://dev.im.dhis2.org/academy-web/api/programs"
+ },
+ {
+ "displayName": "Data Entry Forms",
+ "singular": "dataEntryForm",
+ "plural": "dataEntryForms",
+ "href": "https://dev.im.dhis2.org/academy-web/api/dataEntryForms"
+ },
+ {
+ "displayName": "Dashboard Items",
+ "singular": "dashboardItem",
+ "plural": "dashboardItems",
+ "href": "https://dev.im.dhis2.org/academy-web/api/dashboardItems"
+ },
+ {
+ "displayName": "Data Set Notification Templates",
+ "singular": "dataSetNotificationTemplate",
+ "plural": "dataSetNotificationTemplates",
+ "href": "https://dev.im.dhis2.org/academy-web/api/dataSetNotificationTemplates"
+ },
+ {
+ "displayName": "Data Approval Workflows",
+ "singular": "dataApprovalWorkflow",
+ "plural": "dataApprovalWorkflows",
+ "href": "https://dev.im.dhis2.org/academy-web/api/dataApprovalWorkflows"
+ },
+ {
+ "displayName": "Event Filters",
+ "singular": "eventFilter",
+ "plural": "eventFilters",
+ "href": "https://dev.im.dhis2.org/academy-web/api/eventFilters"
+ },
+ {
+ "displayName": "O Auth2 Clients",
+ "singular": "oAuth2Client",
+ "plural": "oAuth2Clients",
+ "href": "https://dev.im.dhis2.org/academy-web/api/oAuth2Clients"
+ },
+ {
+ "displayName": "Sms Commands",
+ "singular": "smsCommand",
+ "plural": "smsCommands",
+ "href": "https://dev.im.dhis2.org/academy-web/api/smsCommands"
+ },
+ {
+ "displayName": "Validation Notification Templates",
+ "singular": "validationNotificationTemplate",
+ "plural": "validationNotificationTemplates",
+ "href": "https://dev.im.dhis2.org/academy-web/api/validationNotificationTemplates"
+ },
+ {
+ "displayName": "Data Element Groups",
+ "singular": "dataElementGroup",
+ "plural": "dataElementGroups",
+ "href": "https://dev.im.dhis2.org/academy-web/api/dataElementGroups"
+ },
+ {
+ "displayName": "Push Analysis",
+ "singular": "pushAnalysis",
+ "plural": "pushAnalysis",
+ "href": "https://dev.im.dhis2.org/academy-web/api/pushAnalysis"
+ },
+ {
+ "displayName": "Category Option Groups",
+ "singular": "categoryOptionGroup",
+ "plural": "categoryOptionGroups",
+ "href": "https://dev.im.dhis2.org/academy-web/api/categoryOptionGroups"
+ },
+ {
+ "displayName": "Program Rule Actions",
+ "singular": "programRuleAction",
+ "plural": "programRuleActions",
+ "href": "https://dev.im.dhis2.org/academy-web/api/programRuleActions"
+ },
+ {
+ "displayName": "Options",
+ "singular": "option",
+ "plural": "options",
+ "href": "https://dev.im.dhis2.org/academy-web/api/options"
+ },
+ {
+ "displayName": "Metadata Versions",
+ "singular": "metadataVersion",
+ "plural": "metadataVersions",
+ "href": "https://dev.im.dhis2.org/academy-web/api/metadata/version"
+ },
+ {
+ "displayName": "Analytics Table Hooks",
+ "singular": "analyticsTableHook",
+ "plural": "analyticsTableHooks",
+ "href": "https://dev.im.dhis2.org/academy-web/api/analyticsTableHooks"
+ },
+ {
+ "displayName": "Categories",
+ "singular": "category",
+ "plural": "categories",
+ "href": "https://dev.im.dhis2.org/academy-web/api/categories"
+ },
+ {
+ "displayName": "User Roles",
+ "singular": "userRole",
+ "plural": "userRoles",
+ "href": "https://dev.im.dhis2.org/academy-web/api/userRoles"
+ },
+ {
+ "displayName": "Sections",
+ "singular": "section",
+ "plural": "sections",
+ "href": "https://dev.im.dhis2.org/academy-web/api/sections"
+ },
+ {
+ "displayName": "Data Approval Levels",
+ "singular": "dataApprovalLevel",
+ "plural": "dataApprovalLevels",
+ "href": "https://dev.im.dhis2.org/academy-web/api/dataApprovalLevels"
+ },
+ {
+ "displayName": "Indicator Groups",
+ "singular": "indicatorGroup",
+ "plural": "indicatorGroups",
+ "href": "https://dev.im.dhis2.org/academy-web/api/indicatorGroups"
+ },
+ {
+ "displayName": "Program Stages",
+ "singular": "programStage",
+ "plural": "programStages",
+ "href": "https://dev.im.dhis2.org/academy-web/api/programStages"
+ },
+ {
+ "displayName": "Map Views",
+ "singular": "mapView",
+ "plural": "mapViews",
+ "href": "https://dev.im.dhis2.org/academy-web/api/mapViews"
+ },
+ {
+ "displayName": "Data Element Group Sets",
+ "singular": "dataElementGroupSet",
+ "plural": "dataElementGroupSets",
+ "href": "https://dev.im.dhis2.org/academy-web/api/dataElementGroupSets"
+ },
+ {
+ "displayName": "Indicator Group Sets",
+ "singular": "indicatorGroupSet",
+ "plural": "indicatorGroupSets",
+ "href": "https://dev.im.dhis2.org/academy-web/api/indicatorGroupSets"
+ },
+ {
+ "displayName": "Indicators",
+ "singular": "indicator",
+ "plural": "indicators",
+ "href": "https://dev.im.dhis2.org/academy-web/api/indicators"
+ },
+ {
+ "displayName": "Relationship Types",
+ "singular": "relationshipType",
+ "plural": "relationshipTypes",
+ "href": "https://dev.im.dhis2.org/academy-web/api/relationshipTypes"
+ },
+ {
+ "displayName": "Sql Views",
+ "singular": "sqlView",
+ "plural": "sqlViews",
+ "href": "https://dev.im.dhis2.org/academy-web/api/sqlViews"
+ },
+ {
+ "displayName": "Organisation Unit Levels",
+ "singular": "organisationUnitLevel",
+ "plural": "organisationUnitLevels",
+ "href": "https://dev.im.dhis2.org/academy-web/api/organisationUnitLevels"
+ },
+ {
+ "displayName": "Api Token",
+ "singular": "apiToken",
+ "plural": "apiToken",
+ "href": "https://dev.im.dhis2.org/academy-web/api/apiToken"
+ },
+ {
+ "displayName": "Interpretations",
+ "singular": "interpretation",
+ "plural": "interpretations",
+ "href": "https://dev.im.dhis2.org/academy-web/api/interpretations"
+ },
+ {
+ "displayName": "Icons",
+ "singular": "icon",
+ "plural": "icons",
+ "href": "https://dev.im.dhis2.org/academy-web/api/icons"
+ },
+ {
+ "displayName": "Program Rule Variables",
+ "singular": "programRuleVariable",
+ "plural": "programRuleVariables",
+ "href": "https://dev.im.dhis2.org/academy-web/api/programRuleVariables"
+ },
+ {
+ "displayName": "Program Stage Working Lists",
+ "singular": "programStageWorkingList",
+ "plural": "programStageWorkingLists",
+ "href": "https://dev.im.dhis2.org/academy-web/api/programStageWorkingLists"
+ },
+ {
+ "displayName": "Event Reports",
+ "singular": "eventReport",
+ "plural": "eventReports",
+ "href": "https://dev.im.dhis2.org/academy-web/api/eventReports"
+ },
+ {
+ "displayName": "Documents",
+ "singular": "document",
+ "plural": "documents",
+ "href": "https://dev.im.dhis2.org/academy-web/api/documents"
+ },
+ {
+ "displayName": "Data Element Operands",
+ "singular": "dataElementOperand",
+ "plural": "dataElementOperands",
+ "href": "https://dev.im.dhis2.org/academy-web/api/dataElementOperands"
+ },
+ {
+ "displayName": "Tracked Entity Instance Filters",
+ "singular": "trackedEntityInstanceFilter",
+ "plural": "trackedEntityInstanceFilters",
+ "href": "https://dev.im.dhis2.org/academy-web/api/trackedEntityInstanceFilters"
+ },
+ {
+ "displayName": "External Map Layers",
+ "singular": "externalMapLayer",
+ "plural": "externalMapLayers",
+ "href": "https://dev.im.dhis2.org/academy-web/api/externalMapLayers"
+ },
+ {
+ "displayName": "Event Hooks",
+ "singular": "eventHook",
+ "plural": "eventHooks",
+ "href": "https://dev.im.dhis2.org/academy-web/api/eventHooks"
+ },
+ {
+ "displayName": "Constants",
+ "singular": "constant",
+ "plural": "constants",
+ "href": "https://dev.im.dhis2.org/academy-web/api/constants"
+ },
+ {
+ "displayName": "User Groups",
+ "singular": "userGroup",
+ "plural": "userGroups",
+ "href": "https://dev.im.dhis2.org/academy-web/api/userGroups"
+ },
+ {
+ "displayName": "Organisation Unit Group Sets",
+ "singular": "organisationUnitGroupSet",
+ "plural": "organisationUnitGroupSets",
+ "href": "https://dev.im.dhis2.org/academy-web/api/organisationUnitGroupSets"
+ },
+ {
+ "displayName": "External File Resources",
+ "singular": "externalFileResource",
+ "plural": "externalFileResources",
+ "href": "https://dev.im.dhis2.org/academy-web/api/externalFileResources"
+ },
+ {
+ "displayName": "Routes",
+ "singular": "route",
+ "plural": "routes",
+ "href": "https://dev.im.dhis2.org/academy-web/api/routes"
+ },
+ {
+ "displayName": "Organisation Units",
+ "singular": "organisationUnit",
+ "plural": "organisationUnits",
+ "href": "https://dev.im.dhis2.org/academy-web/api/organisationUnits"
+ },
+ {
+ "displayName": "Indicator Types",
+ "singular": "indicatorType",
+ "plural": "indicatorTypes",
+ "href": "https://dev.im.dhis2.org/academy-web/api/indicatorTypes"
+ },
+ {
+ "displayName": "Aggregate Data Exchanges",
+ "singular": "aggregateDataExchange",
+ "plural": "aggregateDataExchanges",
+ "href": "https://dev.im.dhis2.org/academy-web/api/aggregateDataExchanges"
+ },
+ {
+ "displayName": "Category Combos",
+ "singular": "categoryCombo",
+ "plural": "categoryCombos",
+ "href": "https://dev.im.dhis2.org/academy-web/api/categoryCombos"
+ },
+ {
+ "displayName": "Legend Sets",
+ "singular": "legendSet",
+ "plural": "legendSets",
+ "href": "https://dev.im.dhis2.org/academy-web/api/legendSets"
+ },
+ {
+ "displayName": "Program Indicator Groups",
+ "singular": "programIndicatorGroup",
+ "plural": "programIndicatorGroups",
+ "href": "https://dev.im.dhis2.org/academy-web/api/programIndicatorGroups"
+ },
+ {
+ "displayName": "Program Data Elements",
+ "singular": "programDataElement",
+ "plural": "programDataElements",
+ "href": "https://dev.im.dhis2.org/academy-web/api/programDataElements"
+ },
+ {
+ "displayName": "Program Rules",
+ "singular": "programRule",
+ "plural": "programRules",
+ "href": "https://dev.im.dhis2.org/academy-web/api/programRules"
+ },
+ {
+ "displayName": "Message Conversations",
+ "singular": "messageConversation",
+ "plural": "messageConversations",
+ "href": "https://dev.im.dhis2.org/academy-web/api/messageConversations"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/hooks/index.js b/src/hooks/index.js
index 143b357..e69de29 100644
--- a/src/hooks/index.js
+++ b/src/hooks/index.js
@@ -1 +0,0 @@
-export { useGetAttributes } from './useGetAttributes.js'
diff --git a/src/hooks/useAlert.js b/src/hooks/useAlert.js
new file mode 100644
index 0000000..278a763
--- /dev/null
+++ b/src/hooks/useAlert.js
@@ -0,0 +1,15 @@
+import { useAlert } from '@dhis2/app-runtime';
+
+const useAlerts = () => {
+ const { show, hide } = useAlert(({ message }) => message, ({ type }) => ({
+ ...type,
+ duration: 3000
+ }))
+
+ return {
+ show,
+ hide
+ }
+}
+
+export default useAlerts
diff --git a/src/hooks/useGetAttributes.js b/src/hooks/useGetAttributes.js
deleted file mode 100644
index 91baf46..0000000
--- a/src/hooks/useGetAttributes.js
+++ /dev/null
@@ -1,83 +0,0 @@
-import { useEffect, useState } from 'react'
-
-const ATTRIBUTES = {
- attributes: {
- attributes: [
- {
- unique: false,
- displayName: 'Alternative name',
- id: 'DnrLSdo4hMl',
- },
- {
- unique: false,
- displayName: 'Catchment area',
- id: 'ihn1wb9eho8',
- },
- {
- unique: false,
- displayName: 'Classification',
- id: 'Z4X3J7jMLYV',
- },
- {
- unique: false,
- displayName: 'Collection method',
- id: 'qXS2NDUEAOS',
- },
- {
- unique: true,
- displayName: 'HR identifier',
- id: 'UKNKz1H10EE',
- },
- {
- unique: true,
- displayName: 'KE code',
- id: 'l1VmqIHKk6t',
- },
- {
- unique: false,
- displayName: 'NGO ID',
- id: 'n2xYlNbsfko',
- },
- {
- unique: false,
- displayName: 'PEPFAR ID',
- id: 'dLHLR5O4YFI',
- },
- {
- unique: false,
- displayName: 'Rationale',
- id: 'AhsCAtM3L0g',
- },
- {
- unique: true,
- displayName: 'TZ code',
- id: 'xqWyz9jNCA5',
- },
- {
- unique: false,
- displayName: 'Unit of measure',
- id: 'Y1LUDU8sWBR',
- },
- ],
- },
-}
-
-const sleep = (ms) => {
- return new Promise((resolve) => setTimeout(resolve, ms))
-}
-
-export const useGetAttributes = () => {
- const [loading, setLoading] = useState(true)
- const error = null
- const data = ATTRIBUTES
-
- useEffect(() => {
- const delayLoading = async () => {
- await sleep(1000)
- setLoading(false)
- }
- delayLoading()
- }, [])
-
- return { loading, error, data }
-}
diff --git a/src/hooks/useGetResourcesData.js b/src/hooks/useGetResourcesData.js
new file mode 100644
index 0000000..196ae68
--- /dev/null
+++ b/src/hooks/useGetResourcesData.js
@@ -0,0 +1,43 @@
+import { useAlert, useDataEngine, useDataQuery } from '@dhis2/app-runtime'
+import { useState } from 'react'
+import useAlerts from './useAlert'
+
+const INDICATORSQUERY = (resource) => ({
+ results: {
+ resource: resource,
+ params: {
+ order: 'created:desc',
+ pageSize: 10
+ }
+
+ }
+})
+
+export const useGetResourcesData = () => {
+ const engine = useDataEngine()
+ const [loading, setloading] = useState(false)
+ const [data, setdata] = useState({})
+ const { show } = useAlerts()
+
+ async function getData({ resource }) {
+ setloading(true)
+ await engine.query(INDICATORSQUERY(resource))
+ .catch(err => {
+ console.log(err);
+ show({
+ message: err.message,
+ critical: true
+ })
+ }).then((values) => {
+ setdata(values?.results[resource])
+ })
+
+ setloading(false)
+ }
+
+ return {
+ getData,
+ data,
+ loading
+ }
+}
diff --git a/src/navigation/Navigation.js b/src/navigation/Navigation.js
index 38b5781..0738987 100644
--- a/src/navigation/Navigation.js
+++ b/src/navigation/Navigation.js
@@ -1,6 +1,6 @@
+import { Menu, MenuItem } from "@dhis2/ui";
import PropTypes from 'prop-types'
import React from 'react'
-// @TODO: Import the `Menu` and `MenuItem` components
import { useNavigate, useMatch } from 'react-router-dom'
const NavigationItem = ({ path, label }) => {
@@ -16,8 +16,7 @@ const NavigationItem = ({ path, label }) => {
// eslint-disable-next-line no-unused-vars
const onClick = () => navigate(path)
- // @TODO: Use the `MenuItem` component instead of the `div`
- return {label}
+ return