Skip to content

Commit

Permalink
Merge branch 'master' of github-chisom:dhis2/maintenance-app-beta int…
Browse files Browse the repository at this point in the history
…o DHIS2-18143/category-option-group-set
  • Loading branch information
Chisomchima committed Oct 29, 2024
2 parents 2fe3a97 + 9fa40dc commit af8daec
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 11 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [0.10.1](https://github.com/dhis2/maintenance-app-beta/compare/v0.10.0...v0.10.1) (2024-10-24)


### Bug Fixes

* **orgUnit:** add reference assignment fields ([#428](https://github.com/dhis2/maintenance-app-beta/issues/428)) ([215a99f](https://github.com/dhis2/maintenance-app-beta/commit/215a99fbfe45df8ab295dbb0636b8a036d1d6745))

# [0.10.0](https://github.com/dhis2/maintenance-app-beta/compare/v0.9.0...v0.10.0) (2024-10-23)


Expand Down
55 changes: 47 additions & 8 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"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-10-23T13:30:57.424Z\n"
"PO-Revision-Date: 2024-10-23T13:30:57.424Z\n"
"POT-Creation-Date: 2024-10-23T11:07:53.225Z\n"
"PO-Revision-Date: 2024-10-23T11:07:53.225Z\n"

msgid "schemas"
msgstr "schemas"
Expand Down Expand Up @@ -123,6 +123,21 @@ msgstr "Failed to load {{label}}"
msgid "Failed to load"
msgstr "Failed to load"

msgid "Download"
msgstr "Download"

msgid "Merge"
msgstr "Merge"

msgid "Delete source data element values"
msgstr "Delete source data element values"

msgid "Last updated"
msgstr "Last updated"

msgid "Discard"
msgstr "Discard"

msgid "Aggregation level(s)"
msgstr "Aggregation level(s)"

Expand Down Expand Up @@ -222,9 +237,6 @@ msgstr "Created"
msgid "Last updated by"
msgstr "Last updated by"

msgid "Last updated"
msgstr "Last updated"

msgid "Id"
msgstr "Id"

Expand All @@ -246,9 +258,6 @@ msgstr "Details"
msgid "Failed to load details"
msgstr "Failed to load details"

msgid "Download"
msgstr "Download"

msgid "Download {{section}}"
msgstr "Download {{section}}"

Expand Down Expand Up @@ -1173,6 +1182,36 @@ msgstr "Latitude"
msgid "Longitude"
msgstr "Longitude"

msgid "Reference assignments"
msgstr "Reference assignments"

msgid "Assign the organisation unit to related models."
msgstr "Assign the organisation unit to related models."

msgid "Available data sets"
msgstr "Available data sets"

msgid "Selected data sets"
msgstr "Selected data sets"

msgid "Filter available data sets"
msgstr "Filter available data sets"

msgid "Filter selected data sets"
msgstr "Filter selected data sets"

msgid "Available programs"
msgstr "Available programs"

msgid "Selected programs"
msgstr "Selected programs"

msgid "Filter available programs"
msgstr "Filter available programs"

msgid "Filter selected programs"
msgstr "Filter selected programs"

msgid "New organisation unit will be created inside {{displayName}}"
msgstr "New organisation unit will be created inside {{displayName}}"

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maintenance-app",
"version": "0.10.0",
"version": "0.10.1",
"description": "",
"license": "BSD-3-Clause",
"private": true,
Expand Down
51 changes: 50 additions & 1 deletion src/pages/organisationUnits/form/OrganisationUnitFormFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React from 'react'
import { Field as FieldRFF } from 'react-final-form'
import {
CustomAttributesSection,
ModelTransferField,
StandardFormField,
StandardFormSection,
StandardFormSectionDescription,
Expand All @@ -14,13 +15,17 @@ import {
DescriptionField,
} from '../../../components/form'
import { DateField } from '../../../components/form/fields/DateField'
import { SCHEMA_SECTIONS } from '../../../lib'
import { SCHEMA_SECTIONS, useSystemSetting } from '../../../lib'
import { ImageField } from './ImageField'
import { OrganisationUnitSelector } from './OrganisationUnitSelector'

const schemaSection = SCHEMA_SECTIONS.organisationUnit

export function OrganisationUnitFormField() {
const allowReferenceAssignments = useSystemSetting(
'keyAllowObjectAssignment'
)

return (
<>
<StandardFormSection>
Expand Down Expand Up @@ -142,6 +147,50 @@ export function OrganisationUnitFormField() {
max="180"
/>
</StandardFormSection>
{allowReferenceAssignments && (
<StandardFormSection>
<StandardFormSectionTitle>
{i18n.t('Reference assignment')}
</StandardFormSectionTitle>
<StandardFormSectionDescription>
{i18n.t(
'Assign the organisation unit to related objects.'
)}
</StandardFormSectionDescription>
<StandardFormField>
<ModelTransferField
name="dataSets"
query={{
resource: 'dataSets',
}}
leftHeader={i18n.t('Available data sets')}
rightHeader={i18n.t('Selected data sets')}
filterPlaceholder={i18n.t(
'Filter available data sets'
)}
filterPlaceholderPicked={i18n.t(
'Filter selected data sets'
)}
/>
</StandardFormField>
<StandardFormField>
<ModelTransferField
name="programs"
query={{
resource: 'programs',
}}
leftHeader={i18n.t('Available programs')}
rightHeader={i18n.t('Selected programs')}
filterPlaceholder={i18n.t(
'Filter available programs'
)}
filterPlaceholderPicked={i18n.t(
'Filter selected programs'
)}
/>
</StandardFormField>
</StandardFormSection>
)}

<CustomAttributesSection />
</>
Expand Down
5 changes: 4 additions & 1 deletion src/pages/organisationUnits/form/organisationUnitSchema.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { z } from 'zod'
import { getDefaults, modelFormSchemas } from '../../../lib'

const { withAttributeValues, identifiable } = modelFormSchemas
const { withAttributeValues, identifiable, referenceCollection } =
modelFormSchemas

export const organisationUnitSchema = identifiable
.merge(withAttributeValues)
Expand All @@ -24,6 +25,8 @@ export const organisationUnitSchema = identifiable
latitude: z.string().optional(),
})
.optional(),
programs: referenceCollection.optional().default([]),
dataSets: referenceCollection.optional().default([]),
})

export const initialValues = getDefaults(
Expand Down

0 comments on commit af8daec

Please sign in to comment.