mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 23:35:45 +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
|
TransferToLayingFormValues | undefined
|
||||||
>(undefined);
|
>(undefined);
|
||||||
const [formErrorMessage, setFormErrorMessage] = useState<string | null>(null);
|
const [formErrorMessage, setFormErrorMessage] = useState<string | null>(null);
|
||||||
|
const [submittedActionType, setSubmittedActionType] = useState<
|
||||||
|
'add' | 'edit' | null
|
||||||
|
>(null);
|
||||||
|
|
||||||
// Flock Source
|
// Flock Source
|
||||||
const {
|
const {
|
||||||
@@ -203,6 +206,7 @@ const TransferToLayingFormModal = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
setFormikLastValues(values);
|
setFormikLastValues(values);
|
||||||
|
setSubmittedActionType(modalAction as 'add' | 'edit');
|
||||||
|
|
||||||
switch (modalAction) {
|
switch (modalAction) {
|
||||||
case 'add':
|
case 'add':
|
||||||
@@ -1059,10 +1063,17 @@ const TransferToLayingFormModal = () => {
|
|||||||
<TransferToLayingConfirmationModal
|
<TransferToLayingConfirmationModal
|
||||||
ref={successModal.ref}
|
ref={successModal.ref}
|
||||||
type='success'
|
type='success'
|
||||||
text='Data Berhasil Ditambahkan'
|
text={submittedActionType === 'edit' ? 'Data Berhasil Diperbarui' : 'Data Berhasil Ditambahkan'}
|
||||||
subtitleText='Data transfer to laying telah berhasil disimpan.'
|
subtitleText={
|
||||||
|
submittedActionType === 'edit'
|
||||||
|
? 'Data transfer to laying telah berhasil diperbarui.'
|
||||||
|
: 'Data transfer to laying telah berhasil disimpan.'
|
||||||
|
}
|
||||||
transferToLayingForm={formikLastValues}
|
transferToLayingForm={formikLastValues}
|
||||||
onClose={() => setFormikLastValues(undefined)}
|
onClose={() => {
|
||||||
|
setFormikLastValues(undefined);
|
||||||
|
setSubmittedActionType(null);
|
||||||
|
}}
|
||||||
secondaryButton={undefined}
|
secondaryButton={undefined}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -680,6 +680,7 @@ const TransferToLayingsTable = () => {
|
|||||||
subtitleText='Are you sure you want to delete this data? '
|
subtitleText='Are you sure you want to delete this data? '
|
||||||
transferToLayingIds={selectedRowIds}
|
transferToLayingIds={selectedRowIds}
|
||||||
primaryButton={{
|
primaryButton={{
|
||||||
|
text: 'Delete',
|
||||||
isLoading: isDeleteLoading,
|
isLoading: isDeleteLoading,
|
||||||
color: 'error',
|
color: 'error',
|
||||||
onClick: confirmationModalDeleteClickHandler,
|
onClick: confirmationModalDeleteClickHandler,
|
||||||
@@ -704,6 +705,7 @@ const TransferToLayingsTable = () => {
|
|||||||
withNote
|
withNote
|
||||||
noteLabel='Notes Approval'
|
noteLabel='Notes Approval'
|
||||||
primaryButton={{
|
primaryButton={{
|
||||||
|
text: 'Approve',
|
||||||
isLoading: isApproveLoading,
|
isLoading: isApproveLoading,
|
||||||
onClick: confirmationModalApproveClickHandler,
|
onClick: confirmationModalApproveClickHandler,
|
||||||
}}
|
}}
|
||||||
@@ -735,6 +737,7 @@ const TransferToLayingsTable = () => {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
primaryButton={{
|
primaryButton={{
|
||||||
|
text: 'Reject',
|
||||||
isLoading: isRejectLoading,
|
isLoading: isRejectLoading,
|
||||||
color: 'error',
|
color: 'error',
|
||||||
onClick: confirmationModalRejectClickHandler,
|
onClick: confirmationModalRejectClickHandler,
|
||||||
|
|||||||
Reference in New Issue
Block a user