Skip to content

Commit

Permalink
update: Show patient full name in patient input and fix field being r…
Browse files Browse the repository at this point in the history
…eset after filter submitted
  • Loading branch information
SteveGT96 committed Sep 28, 2023
1 parent 39f4743 commit a4653a4
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 11 deletions.
4 changes: 1 addition & 3 deletions src/components/accessories/laboratory/Exams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ export const Exams: FC = () => {
}, []);

useEffect(() => {
if (!isEmpty(filter.patientCode)) {
dispatch(getPatientThunk(filter.patientCode?.toString() ?? "0"));
}
console.log(JSON.stringify(filter));
dispatch(searchLabs({ ...filter, paged: true }));
}, [filter]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ export const ExamFilterForm: FC<IExamFilterProps> = ({
const [expanded, setExpanded] = useState(true);
const [openResetConfirmation, setOpenResetConfirmation] = useState(false);

const patient = useSelector(
(state: IState) => state.patients.selectedPatient.data
);

const validationSchema = object({
examName: string(),
dateFrom: string()
Expand Down Expand Up @@ -266,9 +262,6 @@ export const ExamFilterForm: FC<IExamFilterProps> = ({
isValid={isValid("patientCode")}
errorText={getErrorText("patientCode")}
onBlur={onBlurCallback("patientCode")}
initialValue={
isEmpty(formik.values.patientCode) ? undefined : patient
}
/>
</div>
</Permission>
Expand Down
2 changes: 1 addition & 1 deletion src/components/accessories/patientPicker/PatientPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ const PatientPicker: FC<IProps> = ({
label={label}
name={fieldName}
variant="outlined"
value={value.firstName ?? ""}
value={value.name ?? ""}
type={"text"}
onBlur={handleOnBlur}
onMouseDown={handleCriteriaChange}
Expand Down
1 change: 1 addition & 0 deletions src/libraries/formDataHandling/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ export const updateFilterFields = (
Object.keys(values!).forEach((key) => {
let value = values![key];
if (key === "status") return (draft[key as string].value = value);
if (key === "patientCode") return (draft[key as string].value = value);
if (draft[key as string]) {
return (draft[key as string].value = moment(value).isValid()
? parseDate(value as string, withTimezone)
Expand Down
1 change: 1 addition & 0 deletions src/mockServer/fixtures/patientDTO.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a4653a4

Please sign in to comment.