From b24c9d833673c569ecf0080a42db078c22be7eb8 Mon Sep 17 00:00:00 2001 From: rstubryan Date: Thu, 6 Nov 2025 17:17:49 +0700 Subject: [PATCH] feat(FE-170): add approval logic to RecordingForm for detail view actions --- .../recording/form/RecordingForm.tsx | 80 +++++++++++-------- 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/src/components/pages/production/recording/form/RecordingForm.tsx b/src/components/pages/production/recording/form/RecordingForm.tsx index cf2256c3..dc9f4865 100644 --- a/src/components/pages/production/recording/form/RecordingForm.tsx +++ b/src/components/pages/production/recording/form/RecordingForm.tsx @@ -94,6 +94,14 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { const rejectModal = useModal(); const deleteModal = useModal(); + const isRecordingApproved = useCallback((recording?: Recording) => { + return ( + recording?.approval?.action === 'APPROVED' && + recording?.approval?.step_name === 'Disetujui' && + recording?.approval?.step_number === 3 + ); + }, []); + // ===== FORM HANDLERS ===== const createRecordingHandler = useCallback( async ( @@ -1281,7 +1289,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { Kembali - {type === 'detail' && ( + {type === 'detail' && !isRecordingApproved(initialValues) && (