From 3d83d6d9470d3588e4a58fc74c213ac2fbea5e3a Mon Sep 17 00:00:00 2001 From: khavinshankar Date: Tue, 19 Dec 2023 13:25:21 +0530 Subject: [PATCH] consolidated multiple view artefact buttons into one --- src/Components/ABDM/ABDMFacilityRecords.tsx | 39 +++++++++++++-------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/Components/ABDM/ABDMFacilityRecords.tsx b/src/Components/ABDM/ABDMFacilityRecords.tsx index 823d8905e27..d8aa87c68a1 100644 --- a/src/Components/ABDM/ABDMFacilityRecords.tsx +++ b/src/Components/ABDM/ABDMFacilityRecords.tsx @@ -67,7 +67,12 @@ export default function ABDMFacilityRecords({ facilityId }: IProps) { - {consent.status} + {new Date( + consent.consent_artefacts?.[0]?.expiry ?? + consent.expiry + ) > new Date() + ? "EXPIRED" + : consent.status} @@ -115,20 +120,24 @@ export default function ABDMFacilityRecords({ facilityId }: IProps) {
- {consent.consent_artefacts?.map((artefact, i) => - artefact.status === "GRANTED" ? ( - - View Artefact {i + 1} - - ) : ( -

- Artefact {i + 1} -

- ) + {consent.status === "GRANTED" && + new Date( + consent.consent_artefacts?.[0]?.expiry ?? + consent.expiry + ) > new Date() ? ( + + View + + ) : ( +

+ View +

)}