From b499b9008c32da162649d0b1b50281d770721604 Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Wed, 25 Oct 2023 19:42:09 +0530 Subject: [PATCH] Show camera feed only for admin and doctor (#6453) * Show camera feed only for admin and doctor * Fix issue with hiding config button * Hide configure button for assets without class * Refactor conditional rendering logic for configure button in AssetManage component --- src/Components/Assets/AssetManage.tsx | 32 +++++++++++-------- .../Facility/ConsultationDetails/index.tsx | 9 ++++-- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/Components/Assets/AssetManage.tsx b/src/Components/Assets/AssetManage.tsx index 23098bff22f..4f65bc6a569 100644 --- a/src/Components/Assets/AssetManage.tsx +++ b/src/Components/Assets/AssetManage.tsx @@ -432,20 +432,24 @@ const AssetManage = (props: AssetManageProps) => { {t("update")} - {asset?.asset_class && ( - - navigate( - `/facility/${asset?.location_object.facility.id}/assets/${asset?.id}/configure` - ) - } - id="configure-asset" - data-testid="asset-configure-button" - > - - {t("configure")} - - )} + {asset?.asset_class && + (asset?.asset_class !== "ONVIF" || + ["DistrictAdmin", "StateAdmin", "Doctor"].includes( + authUser.user_type + )) && ( + + navigate( + `/facility/${asset?.location_object.facility.id}/assets/${asset?.id}/configure` + ) + } + id="configure-asset" + data-testid="asset-configure-button" + > + + {t("configure")} + + )} {checkAuthority(authUser.user_type, "DistrictAdmin") && ( { {CONSULTATION_TABS.map((p: OptionsType) => { if (p.text === "FEED") { if ( - !consultationData?.current_bed?.bed_object?.id ?? - consultationData?.discharge_date !== null + consultationData?.discharge_date || // Discharged + !consultationData?.current_bed?.bed_object?.id || // Not admitted to bed + !["DistrictAdmin", "StateAdmin", "Doctor"].includes( + authUser.user_type + ) // Not admin or doctor ) - return null; + return null; // Hide feed tab } return (