Skip to content

Commit

Permalink
disableEdit for inactive patient
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashesh3 committed Jan 18, 2024
1 parent 8359aa3 commit c378683
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/Components/Facility/DoctorNote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ interface DoctorNoteProps {
state: PatientNoteStateType;
setReload: any;
handleNext: () => void;
disableEdit?: boolean;
}

const DoctorNote = (props: DoctorNoteProps) => {
const { state, handleNext, setReload } = props;
const { state, handleNext, setReload, disableEdit } = props;
return (
<div
className="m-2 flex h-[390px] grow flex-col-reverse overflow-auto bg-white"
Expand All @@ -36,6 +37,7 @@ const DoctorNote = (props: DoctorNoteProps) => {
note={note}
key={note.id}
setReload={setReload}
disableEdit={disableEdit}
/>
))}
</InfiniteScroll>
Expand Down
10 changes: 8 additions & 2 deletions src/Components/Facility/PatientConsultationNotesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ interface PatientNotesProps {
setState: any;
reload?: boolean;
setReload?: any;
disableEdit?: boolean;
}

const pageSize = RESULTS_PER_PAGE_LIMIT;

const PatientConsultationNotesList = (props: PatientNotesProps) => {
const { state, setState, reload, setReload } = props;
const { state, setState, reload, setReload, disableEdit } = props;
const consultationId = useSlug("consultation") ?? "";

const [isLoading, setIsLoading] = useState(true);
Expand Down Expand Up @@ -80,7 +81,12 @@ const PatientConsultationNotesList = (props: PatientNotesProps) => {
}

return (
<DoctorNote state={state} handleNext={handleNext} setReload={setReload} />
<DoctorNote
state={state}
handleNext={handleNext}
setReload={setReload}
disableEdit={disableEdit}
/>
);
};

Expand Down
4 changes: 3 additions & 1 deletion src/Components/Facility/PatientNoteCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ const PatientNoteCard = ({
state,
note,
setReload,
disableEdit,
}: {
state: PatientNoteStateType;
note: PatientNotesModel;
setReload: any;
disableEdit?: boolean;
}) => {
const [isEditing, setIsEditing] = useState(false);
const [noteField, setNoteField] = useState(note.note);
Expand Down Expand Up @@ -127,7 +129,7 @@ const PatientNoteCard = ({
}
</div>

{note.created_by_object.id === authUser.id && (
{!disableEdit && note.created_by_object.id === authUser.id && (
<ButtonV2
className="text-gray-500"
ghost
Expand Down
1 change: 1 addition & 0 deletions src/Components/Facility/PatientNotesSlideover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export default function PatientNotesSlideover(props: PatientNotesProps) {
setState={setState}
reload={reload}
setReload={setReload}
disableEdit={!patientActive}
/>
<div className="relative mx-4 flex items-center">
<TextFormField
Expand Down

0 comments on commit c378683

Please sign in to comment.