Skip to content

Commit

Permalink
Merge branch 'master' into hv/featDHIS2-16782_ChangelogSortingAndFilt…
Browse files Browse the repository at this point in the history
…eringByUserAndDataItem
  • Loading branch information
henrikmv authored Jan 25, 2025
2 parents 316c64c + 7343c7e commit 2f821b8
Show file tree
Hide file tree
Showing 103 changed files with 1,262 additions and 788 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# [101.23.0](https://github.com/dhis2/capture-app/compare/v101.22.0...v101.23.0) (2025-01-24)


### Features

* [DHIS2-18325] Show orgunit selector in the new event form ([#3879](https://github.com/dhis2/capture-app/issues/3879)) ([f07b4d4](https://github.com/dhis2/capture-app/commit/f07b4d47c219a21db2769cdc525135aa007ffe96))

# [101.22.0](https://github.com/dhis2/capture-app/compare/v101.21.6...v101.22.0) (2025-01-24)


### Features

* [DHIS2-17192] show related stages widget on registration page ([#3880](https://github.com/dhis2/capture-app/issues/3880)) ([03c156a](https://github.com/dhis2/capture-app/commit/03c156a8aa19708c5fc40140aa390ef547e18d25))

## [101.21.6](https://github.com/dhis2/capture-app/compare/v101.21.5...v101.21.6) (2025-01-16)


Expand Down
5 changes: 0 additions & 5 deletions cypress/e2e/ScopeSelector/ScopeSelector.feature
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,6 @@ Feature: User uses the ScopeSelector to navigate
When you reset the program selection
Then you see message explaining you need to select a program

Scenario: Enrollment event new page > resetting the org unit
Given you land on a enrollment page domain by having typed /#/enrollmentEventNew?programId=IpHINAT79UW&orgUnitId=UgYg0YW7ZIh&teiId=fhFQhO0xILJ&enrollmentId=gPDueU02tn8&stageId=A03MvHHogjR
When you reset the org unit selection
Then you see the enrollment event New page but there is no org unit id in the url

Scenario: Enrollment event new page > resetting the enrollment
Given you land on a enrollment page domain by having typed /#/enrollmentEventNew?programId=IpHINAT79UW&orgUnitId=UgYg0YW7ZIh&teiId=fhFQhO0xILJ&enrollmentId=gPDueU02tn8&stageId=A03MvHHogjR
When you reset the enrollment selection
Expand Down
5 changes: 0 additions & 5 deletions cypress/e2e/ScopeSelector/ScopeSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,6 @@ And('you see the enrollment event Edit page but there is no org unit id in the u
cy.get('[data-test="widget-enrollment-event-view"]').should('exist');
});

And('you see the enrollment event New page but there is no org unit id in the url', () => {
cy.url().should('eq', `${Cypress.config().baseUrl}/#/enrollmentEventNew?enrollmentId=gPDueU02tn8&programId=IpHINAT79UW&stageId=A03MvHHogjR&teiId=fhFQhO0xILJ`);
cy.contains('Choose an organisation unit to start reporting');
});

And('you see the enrollment event New page but there is no stage id in the url', () => {
cy.url().should('eq', `${Cypress.config().baseUrl}/#/enrollmentEventNew?enrollmentId=gPDueU02tn8&orgUnitId=UgYg0YW7ZIh&programId=IpHINAT79UW&teiId=fhFQhO0xILJ`);
cy.contains('Choose a stage for a new event');
Expand Down
35 changes: 22 additions & 13 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -709,9 +709,6 @@ msgstr "There was an error opening the Page"
msgid "There was an error loading the page"
msgstr "There was an error loading the page"

msgid "Choose an organisation unit to start reporting"
msgstr "Choose an organisation unit to start reporting"

msgid "Program stage is invalid"
msgstr "Program stage is invalid"

Expand Down Expand Up @@ -768,6 +765,9 @@ msgstr ""
"You don't have access to create a {{trackedEntityName}} in the current "
"selections"

msgid "Choose an organisation unit to start reporting"
msgstr "Choose an organisation unit to start reporting"

msgid "Choose the {{missingCategories}} to start reporting"
msgstr "Choose the {{missingCategories}} to start reporting"

Expand All @@ -792,6 +792,9 @@ msgstr "Save {{trackedEntityTypeName}}"
msgid "Save {{trackedEntityName}}"
msgstr "Save {{trackedEntityName}}"

msgid "Enter details now is not available when creating a relationship"
msgstr "Enter details now is not available when creating a relationship"

msgid "Save new {{trackedEntityTypeName}} and link"
msgstr "Save new {{trackedEntityTypeName}} and link"

Expand Down Expand Up @@ -1228,12 +1231,21 @@ msgstr "Add coordinates"
msgid "Add area"
msgstr "Add area"

msgid "Please add or cancel the note before saving the event"
msgstr "Please add or cancel the note before saving the event"

msgid "Please provide an valid organisation unit"
msgstr "Please provide an valid organisation unit"

msgid "organisation unit could not be retrieved. Please try again later."
msgstr "organisation unit could not be retrieved. Please try again later."

msgid "Saving to {{stageName}} for {{programName}} in {{orgUnitName}}"
msgstr "Saving to {{stageName}} for {{programName}} in {{orgUnitName}}"

msgid "Saving to {{stageName}} for {{programName}}"
msgstr "Saving to {{stageName}} for {{programName}}"

msgid "program or stage is invalid"
msgstr "program or stage is invalid"

Expand All @@ -1255,9 +1267,6 @@ msgstr "Warning"
msgid "stage not found in rules execution"
msgstr "stage not found in rules execution"

msgid "Please provide an valid organisation unit"
msgstr "Please provide an valid organisation unit"

msgid "Delete event"
msgstr "Delete event"

Expand Down Expand Up @@ -1310,9 +1319,6 @@ msgid_plural "There are {{count}} scheduled event in {{orgUnitName}} on this day
msgstr[0] "There are {{count}} scheduled event in {{orgUnitName}} on this day."
msgstr[1] "There are {{count}} scheduled events in {{orgUnitName}} on this day."

msgid "Scheduling an event in {{stageName}} for {{programName}} in {{orgUnitName}}"
msgstr "Scheduling an event in {{stageName}} for {{programName}} in {{orgUnitName}}"

msgid "Schedule info"
msgstr "Schedule info"

Expand Down Expand Up @@ -1391,8 +1397,8 @@ msgstr "{{trackedEntityTypeName}} profile"
msgid "tracked entity instance"
msgstr "tracked entity instance"

msgid "Link to an existing {{linkableStageLabel}}"
msgstr "Link to an existing {{linkableStageLabel}}"
msgid "Choose a {{linkableStageLabel}} event"
msgstr "Choose a {{linkableStageLabel}} event"

msgid "Choose a {{linkableStageLabel}}"
msgstr "Choose a {{linkableStageLabel}}"
Expand All @@ -1403,14 +1409,17 @@ msgstr "{{ linkableStageLabel }} is not repeatable"
msgid "{{ linkableStageLabel }} has no linkable events"
msgstr "{{ linkableStageLabel }} has no linkable events"

msgid "Actions - {{relationshipName}}"
msgstr "Actions - {{relationshipName}}"

msgid "Ambiguous relationships, contact system administrator"
msgstr "Ambiguous relationships, contact system administrator"

msgid "Enter details now"
msgstr "Enter details now"

msgid "Link to an existing"
msgstr "Link to an existing"
msgid "Link to an existing event"
msgstr "Link to an existing event"

msgid "Scheduled date"
msgstr "Scheduled date"
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "capture-app",
"homepage": ".",
"version": "101.21.6",
"version": "101.23.0",
"cacheVersion": "7",
"serverVersion": "38",
"license": "BSD-3-Clause",
Expand All @@ -10,7 +10,7 @@
"packages/rules-engine"
],
"dependencies": {
"@dhis2/rules-engine-javascript": "101.21.6",
"@dhis2/rules-engine-javascript": "101.23.0",
"@dhis2/app-runtime": "^3.9.3",
"@dhis2/d2-i18n": "^1.1.0",
"@dhis2/d2-icons": "^1.0.1",
Expand Down Expand Up @@ -115,7 +115,7 @@
"eslint-config-react-app": "^6.0.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-import-resolver-exports": "^1.0.0-beta.5",
"eslint-import-resolver-webpack": "^0.13.2",
"eslint-import-resolver-webpack": "^0.13.10",
"eslint-plugin-flowtype": "^5.10.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsx-a11y": "^5.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/rules-engine/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dhis2/rules-engine-javascript",
"version": "101.21.6",
"version": "101.23.0",
"license": "BSD-3-Clause",
"main": "./build/cjs/index.js",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
export type D2FunctionsInput = $ReadOnly<{|
dateUtils: IDateUtils,
variablesHash: RuleVariables,
selectedOrgUnit: OrgUnit,
selectedOrgUnit: ?OrgUnit,
selectedUserRoles: Array<string>,
|}>;

Expand Down
2 changes: 1 addition & 1 deletion packages/rules-engine/src/rulesEngine.types.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export type RulesEngineInput = {|
selectedEntity?: ?TEIValues,
trackedEntityAttributes?: ?TrackedEntityAttributes,
selectedEnrollment?: ?Enrollment,
selectedOrgUnit: OrgUnit,
selectedOrgUnit: ?OrgUnit,
selectedUserRoles?: ?Array<string>,
optionSets: OptionSets,
|}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type SourceData = {
selectedEntity: ?TEIValues,
selectedEnrollment: ?Enrollment,
optionSets: OptionSets,
selectedOrgUnit: OrgUnit,
selectedOrgUnit: ?OrgUnit,
};

const variableSourceTypesDataElementSpecific = {
Expand Down Expand Up @@ -516,7 +516,7 @@ export class VariableService {
return variables;
}

getOrganisationContextVariables(orgUnit: OrgUnit) {
getOrganisationContextVariables(orgUnit: ?OrgUnit) {
const variables = {};
variables.orgunit_code = this.buildContextVariable(orgUnit?.code, typeKeys.TEXT);
return variables;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export type VariableServiceInput = {|
selectedEntity: ?TEIValues,
trackedEntityAttributes: ?TrackedEntityAttributes,
selectedEnrollment: ?Enrollment,
selectedOrgUnit: OrgUnit,
selectedOrgUnit: ?OrgUnit,
optionSets: OptionSets,
constants: ?Constants,
|};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
withAOCFieldBuilder,
withDataEntryFields,
} from '../../DataEntryDhis2Helpers';
import type { RelatedStageRefPayload } from '../../WidgetRelatedStages';

const overrideMessagePropNames = {
errorMessage: 'validationError',
Expand Down Expand Up @@ -237,7 +238,7 @@ const getGeometrySettings = () => ({
dialogLabel: i18n.t('Area'),
required: false,
orientation: getOrientation(props.formHorizontal),
orgUnit: props.orgUnit,
orgUnitId: props.orgUnit?.id,
});
}

Expand All @@ -248,7 +249,7 @@ const getGeometrySettings = () => ({
required: false,
orientation: getOrientation(props.formHorizontal),
shrinkDisabled: props.formHorizontal,
orgUnit: props.orgUnit,
orgUnitId: props.orgUnit?.id,
});
},
getPropName: () => 'geometry',
Expand Down Expand Up @@ -329,10 +330,12 @@ type FinalTeiDataEntryProps = {
programId: string,
id: string,
orgUnitId: string,
orgUnit: OrgUnit,
onUpdateDataEntryField: Function,
onUpdateFormFieldAsync: Function,
onUpdateFormField: Function,
firstStageMetaData?: ?{ stage: ProgramStage },
relatedStageRef?: { current: ?RelatedStageRefPayload },
formFoundation: RenderFoundation,
};
// final step before the generic dataEntry is inserted
Expand Down Expand Up @@ -457,6 +460,7 @@ export class EnrollmentDataEntryComponent extends React.Component<PreEnrollmentD
onUpdateDataEntryField,
onStartAsyncUpdateField,
onGetUnsavedAttributeValues,
orgUnit,
...passOnProps
} = this.props;

Expand All @@ -467,6 +471,8 @@ export class EnrollmentDataEntryComponent extends React.Component<PreEnrollmentD
onUpdateFormField={this.handleUpdateField}
onUpdateDataEntryField={this.handleUpdateDataEntryField}
onUpdateFormFieldAsync={this.handleStartAsyncUpdateField}
orgUnit={orgUnit}
orgUnitId={orgUnit?.id}
{...passOnProps}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const getStageGeometrySettings = () => ({
dialogLabel: i18n.t('Area'),
required: false,
orientation: getOrientation(props.formHorizontal),
orgUnit: props.orgUnit,
orgUnitId: props.orgUnit?.id,
});
}

Expand All @@ -139,7 +139,7 @@ const getStageGeometrySettings = () => ({
required: false,
orientation: getOrientation(props.formHorizontal),
shrinkDisabled: props.formHorizontal,
orgUnit: props.orgUnit,
orgUnitId: props.orgUnit?.id,
});
},
getPropName: () => stageMainDataIds.GEOMETRY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import type { Props } from './EnrollmentWithFirstStageDataEntry.types';
import { FirstStageDataEntry } from './EnrollmentWithFirstStageDataEntry.component';
import { useDataEntrySections } from './hooks';
import { Section } from '../../../../metaData';
import { WidgetRelatedStages } from '../../../WidgetRelatedStages';

const getSectionId = sectionId =>
(sectionId === Section.MAIN_SECTION_ID ? `${Section.MAIN_SECTION_ID}-stage` : sectionId);

export const EnrollmentWithFirstStageDataEntry = (props: Props) => {
const { firstStageMetaData, ...passOnProps } = props;
const { firstStageMetaData, orgUnit, relatedStageRef, relatedStageActionsOptions, ...passOnProps } = props;
const {
stage: { stageForm: firstStageFormFoundation, name: stageName },
} = firstStageMetaData;
Expand All @@ -19,10 +20,20 @@ export const EnrollmentWithFirstStageDataEntry = (props: Props) => {
const dataEntrySections = useDataEntrySections(stageName, beforeSectionId);

return (
<FirstStageDataEntry
{...passOnProps}
firstStageMetaData={firstStageMetaData}
dataEntrySections={dataEntrySections}
/>
<>
<FirstStageDataEntry
{...passOnProps}
orgUnit={orgUnit}
orgUnitId={orgUnit?.id}
firstStageMetaData={firstStageMetaData}
dataEntrySections={dataEntrySections}
/>
<WidgetRelatedStages
ref={relatedStageRef}
programId={passOnProps.programId}
programStageId={firstStageMetaData.stage?.id}
actionsOptions={relatedStageActionsOptions}
/>
</>
);
};
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
// @flow
import type { OrgUnit } from '@dhis2/rules-engine-javascript';
import type { ProgramStage, RenderFoundation } from '../../../../metaData';
import type { RelatedStageRefPayload } from '../../../WidgetRelatedStages';
import { relatedStageActions } from '../../../WidgetRelatedStages';

export type Props = {
firstStageMetaData: {
stage: ProgramStage,
},
formFoundation: RenderFoundation,
orgUnit: ?OrgUnit,
programId: string,
relatedStageRef?: { current: ?RelatedStageRefPayload },
relatedStageActionsOptions?: {
[key: $Keys<typeof relatedStageActions>]: {
hidden?: boolean,
disabled?: boolean,
disabledMessage?: string
},
},
};
Loading

0 comments on commit 2f821b8

Please sign in to comment.