-
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-15483] assign an user when scheduling an enrollment event #3419
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a0ec795
feat: assign an user when scheduling an enrollment event
simonadomnisoru 7807410
Merge branch 'master' into DHIS2-15483
simonadomnisoru e692db3
Merge branch 'master' into DHIS2-15483
simonadomnisoru 74f12d8
feat: no match found message
simonadomnisoru 2be6deb
feat: save all assigned user properties into enrollmentDomain
simonadomnisoru 13c172b
Merge branch 'master' into DHIS2-15483
simonadomnisoru f6b0b59
Merge branch 'master' into DHIS2-15483
simonadomnisoru File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/core_modules/capture-core/components/FormFields/UserField/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
// @flow | ||
export { UserField } from './UserField.component'; | ||
export type { User as UserFormField } from './types'; |
38 changes: 38 additions & 0 deletions
38
src/core_modules/capture-core/components/WidgetEventSchedule/Assignee/Assignee.component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// @flow | ||
import React from 'react'; | ||
import i18n from '@dhis2/d2-i18n'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import { UserField } from '../../FormFields/UserField/UserField.component'; | ||
import type { Props } from './Assignee.types'; | ||
|
||
const getStyles = () => ({ | ||
container: { | ||
display: 'flex', | ||
alignItems: 'center', | ||
padding: '8px 8px 8px 12px', | ||
}, | ||
label: { | ||
fontSize: 14, | ||
flexBasis: 200, | ||
color: '#212934', | ||
}, | ||
field: { | ||
flexBasis: 150, | ||
flexGrow: 1, | ||
}, | ||
}); | ||
|
||
const AssigneePlain = (props: Props) => { | ||
const { classes, assignee, ...passOnProps } = props; | ||
return ( | ||
<div className={classes.container}> | ||
<div className={classes.label}>{i18n.t('Assignee')}</div> | ||
<div className={classes.field}> | ||
{/* $FlowFixMe[cannot-spread-inexact] automated comment */} | ||
<UserField inputPlaceholderText={i18n.t('Search for user')} value={assignee} {...passOnProps} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export const Assignee = withStyles(getStyles)(AssigneePlain); |
7 changes: 7 additions & 0 deletions
7
src/core_modules/capture-core/components/WidgetEventSchedule/Assignee/Assignee.types.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// @flow | ||
import type { UserFormField } from '../../FormFields/UserField'; | ||
|
||
export type Props = { | ||
...CssClasses, | ||
assignee?: UserFormField, | ||
}; |
2 changes: 2 additions & 0 deletions
2
src/core_modules/capture-core/components/WidgetEventSchedule/Assignee/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// @flow | ||
export { Assignee } from './Assignee.component'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do you think this field would benefit from having a
No suggestions
-state.If a user types in a user that does not exist in the system, you should get a message that says something like
Could not find...
orNo user found...
etc. In the current functionality, it looks that it has not searched if you type quickly enough. Do you think this could be implemented?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.
Hey @eirikhaugstulen
I agree that the users will benefit from a
No suggestions
-state (the design team also liked the idea). I added it in the last commits.Regarding the second point, if the user types very fast, the search is prevented on purpose. Within the UserField.component, the DebounceField is used to introduce a delay between search requests. Input debouncing serves the purpose of limiting the frequency of API calls and enhancing overall performance.
Thanks!