Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into hv/fix/DHIS2-16871_…
Browse files Browse the repository at this point in the history
…FixRequestsThatUseSemicolonAsSeparator
  • Loading branch information
henrikmv committed Feb 1, 2025
2 parents 8df126a + c5335c7 commit aa8c67e
Show file tree
Hide file tree
Showing 25 changed files with 447 additions and 220 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
## [101.24.1](https://github.com/dhis2/capture-app/compare/v101.24.0...v101.24.1) (2025-01-31)


### Bug Fixes

* [DHIS2-18582] Data element with number option set are not displayed in Stages and Events widget ([#3928](https://github.com/dhis2/capture-app/issues/3928)) ([e793240](https://github.com/dhis2/capture-app/commit/e79324029194f23c945b26cdd1f09f06bd27c213))

# [101.24.0](https://github.com/dhis2/capture-app/compare/v101.23.2...v101.24.0) (2025-01-31)


### Features

* [DHIS2-18329] Add org unit selector in schedule event form ([#3925](https://github.com/dhis2/capture-app/issues/3925)) ([4013d93](https://github.com/dhis2/capture-app/commit/4013d9326d17f93ff3b0ca11b7844764f92c6850))

## [101.23.2](https://github.com/dhis2/capture-app/compare/v101.23.1...v101.23.2) (2025-01-28)


### Bug Fixes

* [DHIS2-18902] keep program selection on unique id fallback search ([#3950](https://github.com/dhis2/capture-app/issues/3950)) ([6326f7a](https://github.com/dhis2/capture-app/commit/6326f7a134851a80352d6cf34ea2f8dbdb5b210d))

## [101.23.1](https://github.com/dhis2/capture-app/compare/v101.23.0...v101.23.1) (2025-01-28)


### Bug Fixes

* [DHIS2-18673] prevent saving in profile widget when validation errors are present ([#3943](https://github.com/dhis2/capture-app/issues/3943)) ([e341070](https://github.com/dhis2/capture-app/commit/e34107075678b78773d941bc1bca5dbf93f5088e))

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


Expand Down
34 changes: 17 additions & 17 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: 2025-01-02T13:08:32.303Z\n"
"PO-Revision-Date: 2025-01-02T13:08:32.303Z\n"
"POT-Creation-Date: 2025-01-24T15:26:19.128Z\n"
"PO-Revision-Date: 2025-01-24T15:26:19.128Z\n"

msgid "Choose one or more dates..."
msgstr "Choose one or more dates..."
Expand Down Expand Up @@ -1231,9 +1231,6 @@ 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"

Expand Down Expand Up @@ -1294,6 +1291,12 @@ msgstr "Write a note about this event"
msgid "This event doesn't have any notes"
msgstr "This event doesn't have any notes"

msgid "after"
msgstr "after"

msgid "before"
msgstr "before"

msgid "Schedule date info"
msgstr "Schedule date info"

Expand All @@ -1308,29 +1311,29 @@ msgid_plural "The scheduled date is {{count}} days {{position}} the suggested da
msgstr[0] "The scheduled date is {{count}} day {{position}} the suggested date."
msgstr[1] "The scheduled date is {{count}} days {{position}} the suggested date."

msgid "after"
msgstr "after"

msgid "before"
msgstr "before"

msgid "There are {{count}} scheduled event in {{orgUnitName}} on this day."
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 "Schedule info"
msgstr "Schedule info"

msgid "Schedule date / Due date"
msgstr "Schedule date / Due date"

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

msgid "Schedule info"
msgstr "Schedule info"

msgid "Event notes"
msgstr "Event notes"

msgid "Write a note about this scheduled event"
msgstr "Write a note about this scheduled event"

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

msgid "Save note"
msgstr "Save note"

Expand Down Expand Up @@ -1430,9 +1433,6 @@ msgstr "Report date"
msgid "Please enter a date"
msgstr "Please enter a date"

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

msgid "Please select a valid event"
msgstr "Please select a valid event"

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "capture-app",
"homepage": ".",
"version": "101.23.0",
"version": "101.24.1",
"cacheVersion": "7",
"serverVersion": "38",
"license": "BSD-3-Clause",
Expand All @@ -10,7 +10,7 @@
"packages/rules-engine"
],
"dependencies": {
"@dhis2/rules-engine-javascript": "101.23.0",
"@dhis2/rules-engine-javascript": "101.24.1",
"@dhis2/app-runtime": "^3.9.3",
"@dhis2/d2-i18n": "^1.1.0",
"@dhis2/d2-icons": "^1.0.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.23.0",
"version": "101.24.1",
"license": "BSD-3-Clause",
"main": "./build/cjs/index.js",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export const saveCurrentSearchInfo = ({
}) => actionCreator(searchBoxActionTypes.CURRENT_SEARCH_INFO_SAVE)(
{ searchScopeType, searchScopeId, formId, currentSearchTerms });

export const searchViaUniqueIdOnScopeTrackedEntityType = ({ trackedEntityTypeId, formId }) =>
actionCreator(searchBoxActionTypes.VIA_UNIQUE_ID_ON_SCOPE_TRACKED_ENTITY_TYPE_SEARCH)({ trackedEntityTypeId, formId });
export const searchViaUniqueIdOnScopeTrackedEntityType = ({ trackedEntityTypeId, formId, programId }) =>
actionCreator(searchBoxActionTypes.VIA_UNIQUE_ID_ON_SCOPE_TRACKED_ENTITY_TYPE_SEARCH)({ trackedEntityTypeId, formId, programId });

export const searchViaUniqueIdOnScopeProgram = ({ programId, formId }) =>
actionCreator(searchBoxActionTypes.VIA_UNIQUE_ID_ON_SCOPE_PROGRAM_SEARCH)({ programId, formId });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const searchViaUniqueIdStream = ({
flatMap(({ trackedEntityInstanceContainers }) => {
const searchResults = trackedEntityInstanceContainers;
if (searchResults.length === 0 && queryArgs.program) {
return of(searchViaUniqueIdOnScopeTrackedEntityType({ trackedEntityTypeId: programTETId, formId }));
return of(searchViaUniqueIdOnScopeTrackedEntityType({ trackedEntityTypeId: programTETId, formId, programId }));
}
if (searchResults.length > 0) {
const { id, tei: { orgUnit: orgUnitId, enrollments } } = searchResults[0];
Expand Down Expand Up @@ -183,7 +183,7 @@ export const searchViaUniqueIdOnScopeTrackedEntityTypeEpic = (
) =>
action$.pipe(
ofType(searchBoxActionTypes.VIA_UNIQUE_ID_ON_SCOPE_TRACKED_ENTITY_TYPE_SEARCH),
flatMap(({ payload: { formId, trackedEntityTypeId } }) => {
flatMap(({ payload: { formId, trackedEntityTypeId, programId } }) => {
const {
formsValues,
} = store.value;
Expand All @@ -200,6 +200,7 @@ export const searchViaUniqueIdOnScopeTrackedEntityTypeEpic = (
return searchViaUniqueIdStream({
queryArgs,
attributes,
programId,
absoluteApiPath,
querySingleResource,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { Node } from 'react';

export type WidgetCollapsibleProps = {|
header: Node,
header?: Node,
children: Node,
open: boolean,
onOpen: () => void,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { Node } from 'react';

export type WidgetNonCollapsibleProps = {|
header: Node,
header?: Node,
children: Node,
color?: string,
borderless?: boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
}

.orgUnitLabel {
padding-top: 3px;
padding-top: 13px;
}

.selectLabel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ const styles = {
infoBox: {
marginTop: spacersNum.dp16,
padding: spacersNum.dp16,
width: 'fit-content',
},
};

const getDayDifference = (startDate: string, endDate: string): number =>
moment(startDate).diff(moment(endDate), 'days');

const InfoBoxPlain = ({
scheduleDate,
suggestedScheduleDate,
Expand All @@ -21,38 +25,54 @@ const InfoBoxPlain = ({
orgUnitName,
classes,
}: Props) => {
if (!scheduleDate || !suggestedScheduleDate) { return null; }
const differenceScheduleDateAndSuggestedDate = moment(scheduleDate).diff(moment(suggestedScheduleDate), 'days');
if (!scheduleDate || !suggestedScheduleDate) {
return null;
}

const dayDifference = getDayDifference(scheduleDate, suggestedScheduleDate);
const absoluteDifference = Math.abs(dayDifference);
const position = dayDifference > 0 ? i18n.t('after') : i18n.t('before');
const scheduledDateMatchesSuggested = scheduleDate === suggestedScheduleDate;

return (
<NoticeBox className={classes.infoBox} title={i18n.t('Schedule date info')}>
{hideDueDate ? <>
{i18n.t('Scheduled automatically for {{suggestedScheduleDate}}', { suggestedScheduleDate })}
</> : <>
{scheduleDate === suggestedScheduleDate ?
i18n.t('The scheduled date matches the suggested date, but can be changed if needed.')
:
i18n.t(
'The scheduled date is {{count}} days {{position}} the suggested date.',
{
position: differenceScheduleDateAndSuggestedDate > 0 ? i18n.t('after') : i18n.t('before'),
count: Math.abs(differenceScheduleDateAndSuggestedDate),
defaultValue: 'The scheduled date is {{count}} day {{position}} the suggested date.',
defaultValue_plural: 'The scheduled date is {{count}} days {{position}} the suggested date.',
})
}
{' '}
{i18n.t('There are {{count}} scheduled event in {{orgUnitName}} on this day.', {
count: eventCountInOrgUnit,
orgUnitName,
defaultValue: 'There are {{count}} scheduled event in {{orgUnitName}} on this day.',
defaultValue_plural: 'There are {{count}} scheduled events in {{orgUnitName}} on this day.',
interpolation: {
escapeValue: false,
},
})}</>}
{hideDueDate ? (
<>
{i18n.t('Scheduled automatically for {{suggestedScheduleDate}}', { suggestedScheduleDate })}
</>
) : (
<>
{scheduledDateMatchesSuggested
? i18n.t('The scheduled date matches the suggested date, but can be changed if needed.')
: i18n.t(
'The scheduled date is {{count}} days {{position}} the suggested date.',
{
position,
count: absoluteDifference,
defaultValue: 'The scheduled date is {{count}} day {{position}} the suggested date.',
defaultValue_plural: 'The scheduled date is {{count}} days {{position}} the suggested date.',
},
)
}
{!!orgUnitName && (
<>
{' '}
{i18n.t('There are {{count}} scheduled event in {{orgUnitName}} on this day.', {
count: eventCountInOrgUnit,
orgUnitName,
defaultValue: 'There are {{count}} scheduled event in {{orgUnitName}} on this day.',
defaultValue_plural: 'There are {{count}} scheduled events in {{orgUnitName}} on this day.',
interpolation: {
escapeValue: false,
},
})}
</>
)}
</>

)}
</NoticeBox>
);
};

export const InfoBox: ComponentType<$Diff<Props, CssClasses>> = (withStyles(styles)(InfoBoxPlain));
export const InfoBox: ComponentType<$Diff<Props, CssClasses>> = withStyles(styles)(InfoBoxPlain);
Loading

0 comments on commit aa8c67e

Please sign in to comment.