-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(feat) O3-3077: Add validation to restrict users from initiating future visit #1793
Conversation
Size Change: -31.1 kB (0%) Total Size: 11.1 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM. Two minor nits. Also we should try to ensure this behaves as expected when the client machines clock is slightly off the servers clock, especially around midnight.
? true | ||
: dayjs(value).isBefore(dayjs(), 'day') || dayjs(value).isSame(dayjs(), 'day'), | ||
t('invalidVisitStartDate', 'Start date needs to be on or before {{firstEncounterDatetime}}', { | ||
firstEncounterDatetime: new Date().toLocaleString(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use formatDatetime()
from esm-framework to ensure date display is consistent with the rest of the app. (toLocaleString()
is locale-aware, but it is not necessarily aware of the applications locale).
(value) => | ||
displayVisitStopDateTimeFields | ||
? true | ||
: dayjs(value).isBefore(dayjs(), 'day') || dayjs(value).isSame(dayjs(), 'day'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: The calls to dayjs()
here could be reduced doing something like:
// before this
import dayjs from 'dayjs';
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
dayjs.extend(isSameOrBefore);
// then here
value => {
const value_ = dayjs(value);
const today = dayjs();
return displayVisitStopDateTimeFields ? true : value_.isSameOrBefore(today, 'day') // etc.;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also call today.toDate()
and have the same date used in all places.
…ngine changes (#1821) * (fix) O3-3046: Updated the interpretation keys for vital signs matching table headers (#1791) * (fix) O3-2975: Encounter datetime should not be sent when saving vitals and biometrics form (#1790) * (chore) Bump Angular form engine (#1799) * (feat) O3-3084: Sort fetched tests alphabetically in the lab order search inside order basket (#1797) * Sort fetched tests alphabetically in the lab order search * Updated tests * (feat) Update Angular form engine translations (#1801) * (test) Refactor lab orders E2E test (#1803) * (test) Split lab test step for saving the form (#1805) * (fix) O3-3093: React form engine workspace should close after submitting a form (#1804) * Patient forms not passing the closeWorkspaceWithSavedChanges function * Passing closeWorkspaceWithSavedChanges to the forms * Passing 'markFormAsDirty' in the form engine * Bumped @openmrs/esm-form-engine-lib * Fixed the import * Reverted changes in form entry app * (chore) Bump `@openmrs/esm-form-engine-lib` (#1807) * Bumped @openmrs/esm-form-engine-lib * Updated yarn.lock * (chore) Bump @openmrs/openmrs-form-engine-lib (#1808) * (chore) O3-3114: Bump react form engine (#1809) (chore) Bump react form engine * (chore) clean up unused webpack config and bumps engine (#1810) * (chore) clean up unused webpack config and bumps engine * Bumping form-engine again --------- Co-authored-by: Vineet Sharma <[email protected]> * (chore) Bump form-engine with added translations (#1811) * Bump form-engine with added translations * Bump form-engine to latest pre-release * (fix) Use order reasons should correctly chunk concept references and load all of them (#1813) (fix) Use order reasons should correctly chunk concept references and load all of them * (feat) O3-3077: Add validation to restrict users from initiating future visit (#1793) * (fix) O3-3133: Clicking the cancel button should not close the workspace (#1815) * (feat) Conditionally repress browser-specific date; also updates the form engine * (feat) O3-3112: Add form collapse toggle to the `esm-form-engine-app` (#1814) * feat: form collapse * refactor: rename formCollapseToggle * refactor: remove redundant add lister * refactor: use usecallback for handleFormEmbedded --------- Co-authored-by: Dennis Kigen <[email protected]> * (feat) O3-3133: Adapt cancel logic in the react form engine workspace (#1816) * (chore) Bump react form engine (#1817) * (chore) Bump ejs from 3.1.9 to 3.1.10 (#1819) Bumps [ejs](https://github.com/mde/ejs) from 3.1.9 to 3.1.10. - [Release notes](https://github.com/mde/ejs/releases) - [Commits](mde/ejs@v3.1.9...v3.1.10) --- updated-dependencies: - dependency-name: ejs dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Vineet Sharma <[email protected]> Co-authored-by: Dennis Kigen <[email protected]> Co-authored-by: Daud Kakumirizi <[email protected]> Co-authored-by: CynthiaKamau <[email protected]> Co-authored-by: Pius Rubangakene <[email protected]> Co-authored-by: Ian <[email protected]> Co-authored-by: Donald Kibet <[email protected]> Co-authored-by: Ian <[email protected]> Co-authored-by: Usama Idriss Kakumba <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Requirements
Summary
This PR adds validation for start visit date time, to ensure visit aren't initiated in the future. This also maintains existing validation for editing visit start and end date time.
Screenshots
Kapture.2024-04-18.at.12.19.26.mp4
Related Issue
See https://openmrs.atlassian.net/browse/O3-3077
cc @ojwanganto @makombe
Other