feat(FE): Add submittedActionType state to track modal action type

This commit is contained in:
rstubryan
2026-02-20 10:11:16 +07:00
parent bbbd767cf2
commit b35b6c2ab8
2 changed files with 17 additions and 3 deletions
@@ -83,6 +83,9 @@ const TransferToLayingFormModal = () => {
TransferToLayingFormValues | undefined
>(undefined);
const [formErrorMessage, setFormErrorMessage] = useState<string | null>(null);
const [submittedActionType, setSubmittedActionType] = useState<
'add' | 'edit' | null
>(null);
// Flock Source
const {
@@ -203,6 +206,7 @@ const TransferToLayingFormModal = () => {
};
setFormikLastValues(values);
setSubmittedActionType(modalAction as 'add' | 'edit');
switch (modalAction) {
case 'add':
@@ -1059,10 +1063,17 @@ const TransferToLayingFormModal = () => {
<TransferToLayingConfirmationModal
ref={successModal.ref}
type='success'
text='Data Berhasil Ditambahkan'
subtitleText='Data transfer to laying telah berhasil disimpan.'
text={submittedActionType === 'edit' ? 'Data Berhasil Diperbarui' : 'Data Berhasil Ditambahkan'}
subtitleText={
submittedActionType === 'edit'
? 'Data transfer to laying telah berhasil diperbarui.'
: 'Data transfer to laying telah berhasil disimpan.'
}
transferToLayingForm={formikLastValues}
onClose={() => setFormikLastValues(undefined)}
onClose={() => {
setFormikLastValues(undefined);
setSubmittedActionType(null);
}}
secondaryButton={undefined}
/>
</>
@@ -680,6 +680,7 @@ const TransferToLayingsTable = () => {
subtitleText='Are you sure you want to delete this data? '
transferToLayingIds={selectedRowIds}
primaryButton={{
text: 'Delete',
isLoading: isDeleteLoading,
color: 'error',
onClick: confirmationModalDeleteClickHandler,
@@ -704,6 +705,7 @@ const TransferToLayingsTable = () => {
withNote
noteLabel='Notes Approval'
primaryButton={{
text: 'Approve',
isLoading: isApproveLoading,
onClick: confirmationModalApproveClickHandler,
}}
@@ -735,6 +737,7 @@ const TransferToLayingsTable = () => {
},
}}
primaryButton={{
text: 'Reject',
isLoading: isRejectLoading,
color: 'error',
onClick: confirmationModalRejectClickHandler,