From d807434ca19bd484e702d959439c0bbf1a9379ef Mon Sep 17 00:00:00 2001 From: Alan Ansari Date: Tue, 7 May 2024 15:06:56 +0530 Subject: [PATCH] Disable multiple buttons for discharged patients (#7730) * UPDATE: reverted formatting changes to other files * UPDATE: requested code changes --- .../DailyRounds/DefaultLogUpdateCard.tsx | 1 + .../Investigations/InvestigationTable.tsx | 2 ++ .../Investigations/ShowInvestigation.tsx | 6 ++++++ src/Components/Patient/FileUpload.tsx | 19 +++++++++++++++++-- src/Utils/VoiceRecorder.tsx | 2 ++ 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/Components/Facility/Consultations/DailyRounds/DefaultLogUpdateCard.tsx b/src/Components/Facility/Consultations/DailyRounds/DefaultLogUpdateCard.tsx index 2043cc442c5..03a2c7088e5 100644 --- a/src/Components/Facility/Consultations/DailyRounds/DefaultLogUpdateCard.tsx +++ b/src/Components/Facility/Consultations/DailyRounds/DefaultLogUpdateCard.tsx @@ -49,6 +49,7 @@ const DefaultLogUpdateCard = ({ round, ...props }: Props) => { { export const InvestigationTable = ({ title, data, + isDischargedPatient, handleValueChange, changedFields, handleUpdateCancel, @@ -94,6 +95,7 @@ export const InvestigationTable = ({ Print Report { diff --git a/src/Components/Facility/Investigations/ShowInvestigation.tsx b/src/Components/Facility/Investigations/ShowInvestigation.tsx index 2adf97f8a5c..a7f74b98fde 100644 --- a/src/Components/Facility/Investigations/ShowInvestigation.tsx +++ b/src/Components/Facility/Investigations/ShowInvestigation.tsx @@ -80,6 +80,11 @@ export default function ShowInvestigation(props: any) { }, ); + const { data: consultation } = useQuery(routes.getConsultation, { + pathParams: { id: consultationId }, + prefetch: !!consultationId, + }); + const handleValueChange = (value: any, name: string) => { const changedFields = { ...state.changedFields }; set(changedFields, name, value); @@ -151,6 +156,7 @@ export default function ShowInvestigation(props: any) { { prefetch: !!patientId, }); + const { data: consultation } = useQuery(routes.getConsultation, { + pathParams: { id: consultationId }, + prefetch: !!consultationId, + }); + const captureImage = () => { setPreviewImage(webRef.current.getScreenshot()); const canvas = webRef.current.getCanvas(); @@ -1526,6 +1531,7 @@ export const FileUpload = (props: FileUploadProps) => { )}
{ {({ isAuthorized }) => isAuthorized ? ( - setModalOpenForCamera(true)} className="w-full" > diff --git a/src/Utils/VoiceRecorder.tsx b/src/Utils/VoiceRecorder.tsx index f087291ad9b..cd38d29773f 100644 --- a/src/Utils/VoiceRecorder.tsx +++ b/src/Utils/VoiceRecorder.tsx @@ -8,6 +8,7 @@ import { useTranslation } from "react-i18next"; export const VoiceRecorder = (props: any) => { const { t } = useTranslation(); const { + isDisabled, createAudioBlob, confirmAudioBlobExists, reset, @@ -75,6 +76,7 @@ export const VoiceRecorder = (props: any) => { {!audioURL && (