Skip to content

Commit

Permalink
fix(dashboard): edit medical file
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud AMBROSELLI committed Sep 29, 2023
1 parent f4ce657 commit e6d392e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/src/scenes/Persons/MedicalFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const MedicalFile = ({ navigation, person, personDB, onUpdatePerson, updating, e

const treatments = useMemo(() => (allTreatments || []).filter((t) => t.person === personDB._id), [allTreatments, personDB._id]);

const medicalFileDB = useMemo(() => (allMedicalFiles || []).find((m) => m.person === personDB._id), [allMedicalFiles, personDB._id]);
const medicalFileDB = personDB.medicalFile;
const [medicalFile, setMedicalFile] = useState(medicalFileDB);
const [writingComment, setWritingComment] = useState('');

Expand Down
6 changes: 3 additions & 3 deletions dashboard/src/scenes/person/components/EditModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { outOfBoundariesDate } from '../../../services/date';
import SelectTeamMultiple from '../../../components/SelectTeamMultiple';
import { currentTeamState, userState } from '../../../recoil/auth';
import { useRecoilState, useRecoilValue } from 'recoil';
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
import CustomFieldInput from '../../../components/CustomFieldInput';
import { useMemo, useState } from 'react';
import ButtonCustom from '../../../components/ButtonCustom';
Expand All @@ -31,8 +31,8 @@ export default function EditModal({ person, selectedPanel, onClose, isMedicalFil
const team = useRecoilValue(currentTeamState);
const [persons, setPersons] = useRecoilState(personsState);
const customFieldsMedicalFile = useRecoilValue(customFieldsMedicalFileSelector);
const [allMedicalFiles, setAllMedicalFiles] = useRecoilState(medicalFileState);
const medicalFile = useMemo(() => (allMedicalFiles || []).find((m) => m.person === person._id), [allMedicalFiles, person._id]);
const setAllMedicalFiles = useSetRecoilState(medicalFileState);
const medicalFile = person.medicalFile;

const customFieldsMedicalFileWithLegacyFields = useMemo(() => {
const c = [...customFieldsMedicalFile];
Expand Down
5 changes: 2 additions & 3 deletions dashboard/src/scenes/person/components/MedicalFilePrint.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ import CustomFieldDisplay from '../../../components/CustomFieldDisplay';
import { sortActionsOrConsultations } from '../../../recoil/actions';
import { arrayOfitemsGroupedByConsultationSelector } from '../../../recoil/selectors';
import { treatmentsState } from '../../../recoil/treatments';
import { medicalFileState, customFieldsMedicalFileSelector } from '../../../recoil/medicalFiles';
import { customFieldsMedicalFileSelector } from '../../../recoil/medicalFiles';
import { useLocalStorage } from '../../../services/useLocalStorage';

export function MedicalFilePrint({ person }) {
const organisation = useRecoilValue(organisationState);
const allConsultations = useRecoilValue(arrayOfitemsGroupedByConsultationSelector);
const allTreatments = useRecoilValue(treatmentsState);
const allMedicalFiles = useRecoilValue(medicalFileState);
const team = useRecoilValue(currentTeamState);

const [consultationTypes] = useLocalStorage('consultation-types', []);
Expand All @@ -39,7 +38,7 @@ export function MedicalFilePrint({ person }) {

const treatments = useMemo(() => (allTreatments || []).filter((t) => t.person === person._id), [allTreatments, person._id]);

const medicalFile = useMemo(() => (allMedicalFiles || []).find((m) => m.person === person._id), [allMedicalFiles, person._id]);
const medicalFile = person.medicalFile;

return (
<div className="printonly">
Expand Down

0 comments on commit e6d392e

Please sign in to comment.