mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
feat(FE): Add submittedActionType state to track modal action type
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user