-
Notifications
You must be signed in to change notification settings - Fork 22
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: DHIS2-9652 with save buttons #1260
Conversation
…enrollment-data-entry
…llment-data-entry
…tration/11-shows-enrollment-section
…enrollment-data-entry
…tration/11-shows-enrollment-section
…gistration/12-DHIS2-9652-withbuttons
<EnrollmentRegistrationEntry | ||
id={dataEntryId} | ||
selectedScopeId={selectedScopeId} | ||
enrollmentMetadata={registrationMetaData} | ||
saveButtonText={'Save new'} | ||
onSave={() => alert('onSave will save in the future')} | ||
onGetUnsavedAttributeValues={() => console.log('onGetUnsavedAttributeValues will be here in the future in the future')} | ||
onPostProcessErrorMessage={() => console.log('onPostProcessErrorMessage will be here in the future in the future')} | ||
onUpdateField={() => console.log('onUpdateField will be here in the future in the future')} | ||
onStartAsyncUpdateField={() => console.log('onStartAsyncUpdateField will be here in the future in the future')} | ||
/> |
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.
Here I would say you will see the benefit of creating the EnrollmentRegistrationEntry
and TeiRegistrationEntry
components.
This pull request fixes 1 alert when merging 331529b into 4f01752 - view on LGTM.com fixed alerts:
|
…DHIS2-9652-withbuttons
…DHIS2-9652-withbuttons
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.
Looks good @paschalidi 👍 please have a look at my comments before you merge.
saveButtonText, | ||
classes, | ||
onSave, | ||
...rest |
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.
suggestion: passOnProps
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.
Right. I will make a PR in the end renaming all the rest
to onProps
.
onSave && | ||
<Button | ||
dataTest="dhis2-capture-create-and-link-button" | ||
primary | ||
onClick={onSave} | ||
className={classes.marginTop} | ||
> | ||
{saveButtonText} | ||
</Button> |
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.
Yep, this is fine 👍
id: string, | ||
enrollmentMetadata: RegistrationFormMetadata, | ||
selectedScopeId: string, | ||
id: string | ||
saveButtonText: string, | ||
fieldOptions?: Object, | ||
onSave: (dataEntryId: string, itemId: string, formFoundation: RenderFoundation) => void, | ||
onPostProcessErrorMessage: Function, | ||
onGetUnsavedAttributeValues: Function, | ||
onUpdateField: Function, | ||
onStartAsyncUpdateField: Function, |
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.
Yep, makes sense 👍 I did the same for the working lists. Let's settle on name though. I think I called it InterfaceProps
. If you don't like it, what about ModuleProps
or ConceptProps
? I'm not sure I like OwnProps
, but if you have some compelling arguments I might reconsider. Feel free to suggest alternatives.
classes, | ||
onPostProcessErrorMessage, | ||
onGetUnsavedAttributeValues, | ||
...rest |
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.
suggestion: passOnProps
<InfoOutlinedIconWithStyles /> | ||
</Grid> | ||
<Grid item className={classes.text}> | ||
{text} |
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.
maybe we could use children instead? Usage: <InfoIconText>text here</InfoIconText>
|
||
const translatedTextWithStylesForProgram = (trackedEntityName, programName, orgUnitName) => | ||
(<> | ||
{i18n.t('Saving a {{trackedEntityName}} in', { trackedEntityName })} <b>{programName}</b> | ||
{orgUnitName && <>{' '}{i18n.t('in')} <b>{orgUnitName}</b></>}. | ||
</>); | ||
|
||
|
||
const translatedTextWithStylesForTei = (trackedEntityName, orgUnitName) => | ||
(<> | ||
{i18n.t('Saving a {{trackedEntityName}}', { trackedEntityName })} <b>{i18n.t('without')}</b> {i18n.t('enrollment')} | ||
{orgUnitName && <>{' '}{i18n.t('in')} <b>{orgUnitName}</b></>}.{' '} | ||
{i18n.t('Enroll in a program by selecting a program from the top bar.')} | ||
</>); |
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.
I know I've used these bold parts in the new single event page, but I've later realised the concatenations will cause problems, at least for rtl languages. I suggest we keep it nonbold for now? @Bekkalizer , any insights?
…DHIS2-9652-withbuttons
…DHIS2-9652-withbuttons
* feat: adds the buttons * refactor: tei registration data entry * refactor: enrollment regisration data entry * refactor: using the components * chore: moves the info text on the component level * chore: lint * chore: rest needs to be here * chore: removes unused flow * chore: creates TEI * chore: saves * Merge remote-tracking branch 'origin/master' into cp/registration/13-DHIS2-9653-submiting * chore: reverts * chore: adds rollback action
🎉 This PR is included in version 1.4.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Hey here is the https://jira.dhis2.org/browse/DHIS2-9652👋 Again another not so small PR. Apologies I could see the best way to split this up. Will start with smaller chunks from the next one :)
What am I changing
What happens here is that we are reusing the components we created from the last two PRs and adding the buttons on the bottom. You can say it is this PR that the refactoring from the previous two PR comes together.
Now we are using the
EnrollmentRegistrationEntry
andTeiRegistrationEntry
across the new registration page and the add relationship part of the application.How it looks