Skip to content

Commit

Permalink
Show camera feed only for admin and doctor (#6453)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Ashesh3 authored Oct 25, 2023
1 parent 30aa4df commit b499b90
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
32 changes: 18 additions & 14 deletions src/Components/Assets/AssetManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -432,20 +432,24 @@ const AssetManage = (props: AssetManageProps) => {
<CareIcon className="care-l-pen mr-1 h-4" />
{t("update")}
</ButtonV2>
{asset?.asset_class && (
<ButtonV2
onClick={() =>
navigate(
`/facility/${asset?.location_object.facility.id}/assets/${asset?.id}/configure`
)
}
id="configure-asset"
data-testid="asset-configure-button"
>
<CareIcon className="care-l-setting h-4" />
{t("configure")}
</ButtonV2>
)}
{asset?.asset_class &&
(asset?.asset_class !== "ONVIF" ||
["DistrictAdmin", "StateAdmin", "Doctor"].includes(
authUser.user_type
)) && (
<ButtonV2
onClick={() =>
navigate(
`/facility/${asset?.location_object.facility.id}/assets/${asset?.id}/configure`
)
}
id="configure-asset"
data-testid="asset-configure-button"
>
<CareIcon className="care-l-setting h-4" />
{t("configure")}
</ButtonV2>
)}
{checkAuthority(authUser.user_type, "DistrictAdmin") && (
<ButtonV2
authorizeFor={NonReadOnlyUsers}
Expand Down
9 changes: 6 additions & 3 deletions src/Components/Facility/ConsultationDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,13 @@ export const ConsultationDetails = (props: any) => {
{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 (
<Link
Expand Down

0 comments on commit b499b90

Please sign in to comment.