From ed96878ddacd12f5edd26a5d2e2df516c00b02fe Mon Sep 17 00:00:00 2001 From: R Date: Mon, 6 Mar 2023 02:22:11 +0700 Subject: [PATCH] [WIP] Update Show Hide Button --- frontend/dashboard/src/pages/Claims/Show.tsx | 50 +++++++++++++++----- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/frontend/dashboard/src/pages/Claims/Show.tsx b/frontend/dashboard/src/pages/Claims/Show.tsx index d2c941fe..6ea0ea8b 100644 --- a/frontend/dashboard/src/pages/Claims/Show.tsx +++ b/frontend/dashboard/src/pages/Claims/Show.tsx @@ -174,10 +174,14 @@ export default function ClaimsCreateUpdate() { }); }; + const handleDownloadFinalLog = () => { + enqueueSnackbar("Gagal Download Final LOG", { variant: 'error' }) + } + useEffect(() => { axios.get('/claims/' + id).then(({ data }) => { const claim = data.data; - const allFiles = [...claim.claim_request.files, ...claim.files]; + const allFiles = [...(claim.claim_request ? claim.claim_request.files : []), ...claim.files]; setCurrentClaim(claim); setDocuments(allFiles); @@ -243,7 +247,20 @@ export default function ClaimsCreateUpdate() { - Status : {currentClaim?.status} + + Status : {currentClaim?.status} + { currentClaim?.status == 'approved' && ( + { + handleDownloadFinalLog(); + }} + > + Download Final LOG + + )} + @@ -301,7 +318,7 @@ export default function ClaimsCreateUpdate() { Tipe Claim - {currentClaim?.claim_request.payment_type_name} + {currentClaim?.claim_request?.payment_type_name} @@ -342,16 +359,19 @@ export default function ClaimsCreateUpdate() { - { - handleSaveDiagnosis(); - }} - > - Simpan Claim Item - + {(currentClaim?.status == 'requested' || currentClaim?.status == 'received') && ( + + { + handleSaveDiagnosis(); +}} +> +Simpan Claim Item + + )} @@ -367,6 +387,9 @@ export default function ClaimsCreateUpdate() { + + {(currentClaim?.status == 'requested' || currentClaim?.status == 'received') && ( + Simpan Claim Item + )}