-
Notifications
You must be signed in to change notification settings - Fork 249
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
O3-1041: Make list of HFE forms configurable #542
Conversation
function useCountOfFormsAvailableOffline(htmlFormEntryForms: Array<HtmlFormEntryForm>) { | ||
const { data: forms } = useValidOfflineFormEncounters(htmlFormEntryForms); |
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 use hooks in hooks. Put the useConfig
call here.
|
||
/** | ||
* Returns an `SWRResult` of those form encounters that work with offline mode. | ||
*/ | ||
export function useValidOfflineFormEncounters() { | ||
export function useValidOfflineFormEncounters(htmlFormEntryForms: Array<HtmlFormEntryForm>) { |
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.
Call useConfig
within this hook and make this hook nullary again.
Generally looks good! A couple requests. And don't delete the |
const headerTitle = t('forms', 'Forms'); | ||
const isTablet = useLayoutType() === 'tablet'; | ||
const [formsCategory, setFormsCategory] = useState(FormsCategory.All); | ||
const { isValidating, data, error } = useForms(patientUuid, undefined, undefined, isOffline); | ||
const formsToDisplay = data?.filter((formInfo) => isValidOfflineFormEncounter(formInfo.form)); |
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.
To be reviewed - Do we really never want to include non offline valid forms within this list?
All HTML forms are currently considered invalid for offline so, they'll never show up, thus making the new configurable Configurable list of HFE forms useless.
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, no, that is not intended. I created a PR to address this.
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.
Oh, makes sense. Thanks!
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.
@icrc-psousa Could you update this branch? I've merged the PR @manuelroemer mentioned and I think that's causing a conflict.
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.
@ibacher I've now resolved the conflicts and updated the PR
Thanks for the feedback @brandones, I've made the suggested changes. There's also some pending points regarding the list of forms to display or, I may be just missing something... I'll keep this on draft for now until further feedback is gathered |
encounterUuid?: string, | ||
) { | ||
if (currentVisit) { | ||
const htmlForm = findHtmlForm(formUuid); | ||
if (isEmpty(htmlForm)) { | ||
const htmlFormCfg = htmlFormEntryForms.find((form) => form.formUuid === formUuid); |
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.
Wouldn't this variable be better named htmlForm
?
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.
Agreed. Renamed.
(FYI @makombe) |
Requirements
Summary
Refactored so that the list of HTMLFormEntry forms can be configured by an implementation.
Issue
O3-1041