From ce2235dc915120ffbbf8e741331ee14db3482cf3 Mon Sep 17 00:00:00 2001 From: Mozafar Haider Date: Tue, 5 Mar 2024 12:57:26 +0000 Subject: [PATCH] fix(migration-trackedentity): change programStateDate to enrollmentEnrolledAfter and same for endDate to enrollmentEnrolledBefore --- src/components/Inputs/ProgramEndDate.js | 2 +- src/components/Inputs/ProgramStartDate.js | 2 +- src/pages/TEIExport/TEIExport.js | 4 ++-- src/pages/TEIExport/form-helper.js | 28 +++++++++++------------ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/components/Inputs/ProgramEndDate.js b/src/components/Inputs/ProgramEndDate.js index e2f65738d..f1dcd137a 100644 --- a/src/components/Inputs/ProgramEndDate.js +++ b/src/components/Inputs/ProgramEndDate.js @@ -5,7 +5,7 @@ import React from 'react' import { OPTIONAL_DATE_VALIDATOR } from '../DatePicker/DatePickerField.js' import { DatePickerField } from '../index.js' -const NAME = 'programEndDate' +const NAME = 'enrollmentEnrolledBefore' const DATATEST = 'input-program-end-date' const LABEL = i18n.t('End date') const VALIDATOR = composeValidators(OPTIONAL_DATE_VALIDATOR) diff --git a/src/components/Inputs/ProgramStartDate.js b/src/components/Inputs/ProgramStartDate.js index 35e035fb8..7757048c4 100644 --- a/src/components/Inputs/ProgramStartDate.js +++ b/src/components/Inputs/ProgramStartDate.js @@ -5,7 +5,7 @@ import React from 'react' import { OPTIONAL_DATE_VALIDATOR } from '../DatePicker/DatePickerField.js' import { DatePickerField } from '../index.js' -const NAME = 'programStartDate' +const NAME = 'enrollmentEnrolledAfter' const DATATEST = 'input-program-start-date' const LABEL = i18n.t('Start date') const VALIDATOR = composeValidators(OPTIONAL_DATE_VALIDATOR) diff --git a/src/pages/TEIExport/TEIExport.js b/src/pages/TEIExport/TEIExport.js index 02b0a6278..56c0dd08a 100644 --- a/src/pages/TEIExport/TEIExport.js +++ b/src/pages/TEIExport/TEIExport.js @@ -69,8 +69,8 @@ const initialValues = { teiTypeFilter: defaultTEITypeFilterOption, programStatus: defaultProgramStatusOption, followUpStatus: defaultFollowUpStatusOption, - programStartDate: '', - programEndDate: '', + enrollmentEnrolledAfter: '', + enrollmentEnrolledBefore: '', compression: '', // disable compression until it is properly implemented in the backend lastUpdatedFilter: defaultLastUpdatedFilterOption, updatedAfter: '', diff --git a/src/pages/TEIExport/form-helper.js b/src/pages/TEIExport/form-helper.js index 38daabef2..d74f0ed6b 100644 --- a/src/pages/TEIExport/form-helper.js +++ b/src/pages/TEIExport/form-helper.js @@ -26,8 +26,8 @@ const valuesToParams = ( teiTypeFilter, programStatus, followUpStatus, - programStartDate, - programEndDate, + enrollmentEnrolledAfter, + enrollmentEnrolledBefore, lastUpdatedFilter, updatedAfter, updatedBefore, @@ -72,12 +72,12 @@ const valuesToParams = ( minParams.followUpStatus = followUpStatus - if (programStartDate) { - minParams.programStartDate = programStartDate + if (enrollmentEnrolledAfter) { + minParams.enrollmentEnrolledAfter = enrollmentEnrolledAfter } - if (programEndDate) { - minParams.programEndDate = programEndDate + if (enrollmentEnrolledBefore) { + minParams.enrollmentEnrolledBefore = enrollmentEnrolledBefore } } @@ -127,16 +127,16 @@ const validate = (values) => { if ( values.teiTypeFilter == 'PROGRAM' && - values.programStartDate && - values.programEndDate + values.enrollmentEnrolledAfter && + values.enrollmentEnrolledBefore ) { - errors.programStartDate = DATE_BEFORE_VALIDATOR( - values.programStartDate, - values.programEndDate + errors.enrollmentEnrolledAfter = DATE_BEFORE_VALIDATOR( + values.enrollmentEnrolledAfter, + values.enrollmentEnrolledBefore ) - errors.programEndDate = DATE_AFTER_VALIDATOR( - values.programEndDate, - values.programStartDate + errors.enrollmentEnrolledBefore = DATE_AFTER_VALIDATOR( + values.enrollmentEnrolledBefore, + values.enrollmentEnrolledAfter ) }