Skip to content

Commit

Permalink
Merge pull request #251 from swiftss-org/staging
Browse files Browse the repository at this point in the history
Added Recurrence option to Followups
  • Loading branch information
paolo7 authored Jul 23, 2024
2 parents 4312960 + b8d13bc commit 7518b7d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/hooks/api/patientHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ export const useFollowUp = (episodeID: string) => {
seroma: params?.seroma.label === 'Yes',
infection: params?.infection.label === 'Yes',
numbness: params?.numbness.label === 'Yes',
recurrence: params?.recurrence.label === 'Yes',
pain_severity: params?.pain_severity.label,
further_surgery_need: params?.further_surgery_need.label === 'Yes',
surgery_comments_box: params?.surgery_comments_box,
Expand Down
3 changes: 3 additions & 0 deletions src/models/apiTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export type FollowUpAPI = {
seroma: boolean;
infection: boolean;
numbness: boolean;
recurrence: boolean;
further_surgery_need: boolean;
surgery_comments_box?: string;
};
Expand All @@ -87,6 +88,7 @@ export type FollowUpPayload = {
seroma: boolean;
infection: boolean;
numbness: boolean;
recurrence: boolean;
};

export type FollowUpForm = {
Expand All @@ -100,6 +102,7 @@ export type FollowUpForm = {
seroma: SelectOption;
infection: SelectOption;
numbness: SelectOption;
recurrence: SelectOption;
further_surgery_need: SelectOption;
surgery_comments_box?: string;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,44 @@ const FollowUps: FC<{
}}
</Field>
</FieldWrapper>
<FieldWrapper>
<Field
name="recurrence"
initialValue={
followUp?.recurrence !== undefined
? BOOLEAN_OPTIONS.find((option) =>
followUp?.recurrence ? option.label === 'Yes' : option.label === 'No'
)
: undefined
}
>
{(props) => {
const hasError =
props.meta.touched && props.meta.invalid && !props.meta.active;

return (
<SelectWrapper>
<Select
locked={!canSubmit}
id="recurrence"
label="Recurrence"
styleType="outlined"
size="md"
required={canSubmit}
status={hasError ? 'error' : 'hint'}
hintMsg={hasError ? props.meta.error : undefined}
options={BOOLEAN_OPTIONS}
{...omit(props.input, ['onFocus'])}
selectedOption={BOOLEAN_OPTIONS.find(
(option) => option.value === props.input.value.value
)}
handleSelectedOption={props.input.onChange}
/>
</SelectWrapper>
);
}}
</Field>
</FieldWrapper>
<FieldWrapper>
<Field
name="further_surgery_need"
Expand Down

0 comments on commit 7518b7d

Please sign in to comment.