diff --git a/CHANGELOG.md b/CHANGELOG.md index 5629281a..1a60c6ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/i18n/en.pot b/i18n/en.pot index b986a7ad..fcdcdc0c 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -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" @@ -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)" @@ -222,9 +237,6 @@ msgstr "Created" msgid "Last updated by" msgstr "Last updated by" -msgid "Last updated" -msgstr "Last updated" - msgid "Id" msgstr "Id" @@ -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}}" @@ -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}}" diff --git a/package.json b/package.json index eccc174a..619f763c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "maintenance-app", - "version": "0.10.0", + "version": "0.10.1", "description": "", "license": "BSD-3-Clause", "private": true, diff --git a/src/pages/organisationUnits/form/OrganisationUnitFormFields.tsx b/src/pages/organisationUnits/form/OrganisationUnitFormFields.tsx index 9bb44bb9..8a660411 100644 --- a/src/pages/organisationUnits/form/OrganisationUnitFormFields.tsx +++ b/src/pages/organisationUnits/form/OrganisationUnitFormFields.tsx @@ -4,6 +4,7 @@ import React from 'react' import { Field as FieldRFF } from 'react-final-form' import { CustomAttributesSection, + ModelTransferField, StandardFormField, StandardFormSection, StandardFormSectionDescription, @@ -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 ( <> @@ -142,6 +147,50 @@ export function OrganisationUnitFormField() { max="180" /> + {allowReferenceAssignments && ( + + + {i18n.t('Reference assignment')} + + + {i18n.t( + 'Assign the organisation unit to related objects.' + )} + + + + + + + + + )} diff --git a/src/pages/organisationUnits/form/organisationUnitSchema.ts b/src/pages/organisationUnits/form/organisationUnitSchema.ts index 262e5df7..320f4ba7 100644 --- a/src/pages/organisationUnits/form/organisationUnitSchema.ts +++ b/src/pages/organisationUnits/form/organisationUnitSchema.ts @@ -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) @@ -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(