-
Notifications
You must be signed in to change notification settings - Fork 47
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
(refactor): KHP3 Add Dynamic Attribute Handling and enhance "Sync" & "Edit" Functionalities for Providers #565
base: main
Are you sure you want to change the base?
(refactor): KHP3 Add Dynamic Attribute Handling and enhance "Sync" & "Edit" Functionalities for Providers #565
Conversation
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.
thank @its-kios09 , seems good except for the small issues on translations
mutate((key) => { | ||
return typeof key === 'string' && key.startsWith('/ws/rest/v1/provider'); | ||
}); | ||
mutate((key) => typeof key === 'string' && key.startsWith('/ws/rest/v1/provider')); | ||
showSnackbar({ | ||
title: 'Success', |
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.
wouldnt it be better we made this translatable using trasnlation, simil to Failure
titles?
render={({ field }) => ( | ||
<TextInput | ||
{...field} | ||
placeholder="License number" |
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.
Make translatable
render={({ field }) => ( | ||
<TextInput | ||
{...field} | ||
placeholder="Registration number" |
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.
same here
showSnackbar({ | ||
title: 'Failure', | ||
kind: 'error', | ||
subtitle: t( | ||
'errorMsg', | ||
`Error ${provider ? 'upating' : 'creating'} provider! ${error?.responseBody?.error?.message}`, | ||
`Error ${provider ? 'updating' : 'creating'} provider! ${error?.responseBody?.error?.message}`, |
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.
This is not going to work well. We should be using the translate third parameter e.g
t('errorMessage' 'Error {{message}}' , {message: error.responseBody.error.message})
render={({ field }) => ( | ||
<TextInput | ||
{...field} | ||
id="form__national__id" |
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.
id="form__national__id" | |
id="form__national__id" |
We should be following standard convention here e.g formNationalId
{...field} | ||
id="form__national__id" | ||
placeholder={t('nationalIdPlaceholder', 'Enter National ID')} | ||
labelText={t('nationalID', 'National ID*')} |
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.
We should leverage this pattern from carbon
/> | ||
)} | ||
/> | ||
)} | ||
|
||
<Column> | ||
<span className={styles.form__gender}>{t('gender', 'Gender*')}</span> |
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.
<span className={styles.form__gender}>{t('gender', 'Gender*')}</span> | |
<span className={styles.formGender}>{t('gender', 'Gender*')}</span> |
mutate((key) => { | ||
return typeof key === 'string' && key.startsWith('/ws/rest/v1/provider'); | ||
}); | ||
mutate((key) => typeof key === 'string' && key.startsWith('/ws/rest/v1/provider')); |
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.
mutate((key) => typeof key === 'string' && key.startsWith('/ws/rest/v1/provider')); | |
import { restBaseUrl } from '@openmrs/esm-framework'; | |
mutate((key) => typeof key === 'string' && key.startsWith(`restBaseUrl/provider`)); |
@@ -221,7 +220,9 @@ const ProviderForm: React.FC<ProvideModalProps> = ({ closeWorkspace, provider, u | |||
person: personPayload, | |||
roles: data.roles, | |||
}; | |||
|
|||
let _user; |
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.
lets avoid naming variable like this
@@ -53,7 +57,7 @@ function CustomActionMenu({ provider }: CustomActionMenuProps) { | |||
<OverflowMenu flipped={document?.dir === 'rtl'} aria-label="overflow-menu"> | |||
<OverflowMenuItem itemText="Edit" onClick={() => handleUpdateProvider(provider)} /> | |||
<MenuItemDivider /> | |||
<OverflowMenuItem itemText="Sync" onClick={handleOpenModal} disabled={!providerNationalId} /> | |||
<OverflowMenuItem itemText="Sync" onClick={handleOpenModal} disabled={!canSync} /> |
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.
<OverflowMenuItem itemText="Sync" onClick={handleOpenModal} disabled={!canSync} /> | |
<OverflowMenuItem itemText="Sync" onClick={handleOpenModal} disabled={!isSyncEnabled} /> |
Requirements
Summary
The button is enabled only if at least one of the following provider attributes has a value:
Dynamic Provider Payload Construction:
Screenshots
None.
Related Issue
None.
Other
None.