diff --git a/packages/webapp/src/containers/Accounting/MakeJournal/MakeJournalEntriesFooter.tsx b/packages/webapp/src/containers/Accounting/MakeJournal/MakeJournalEntriesFooter.tsx
deleted file mode 100644
index 43e74a42d..000000000
--- a/packages/webapp/src/containers/Accounting/MakeJournal/MakeJournalEntriesFooter.tsx
+++ /dev/null
@@ -1,193 +0,0 @@
-// @ts-nocheck
-import React from 'react';
-import {
- Intent,
- Button,
- ButtonGroup,
- Popover,
- PopoverInteractionKind,
- Position,
- Menu,
- MenuItem,
-} from '@blueprintjs/core';
-import classNames from 'classnames';
-import { useFormikContext } from 'formik';
-import { FormattedMessage as T, If, Icon } from '@/components';
-import { CLASSES } from '@/constants/classes';
-import { useMakeJournalFormContext } from './MakeJournalProvider';
-import { useHistory } from 'react-router-dom';
-
-/**
- * Make Journal floating actions bar.
- */
-export default function MakeJournalEntriesFooter() {
- const history = useHistory();
-
- // Formik context.
- const { isSubmitting, submitForm } = useFormikContext();
-
- // Make journal form context.
- const {
- manualJournalId,
- setSubmitPayload,
- manualJournalPublished = false,
- } = useMakeJournalFormContext();
-
- // Handle `submit & publish` button click.
- const handleSubmitPublishBtnClick = (event) => {
- setSubmitPayload({ redirect: true, publish: true });
- submitForm();
- };
-
- // Handle `submit, publish & new` button click.
- const handleSubmitPublishAndNewBtnClick = (event) => {
- setSubmitPayload({ redirect: false, publish: true, resetForm: true });
- submitForm();
- };
-
- // Handle `submit, publish & continue editing` button click.
- const handleSubmitPublishContinueEditingBtnClick = (event) => {
- setSubmitPayload({ redirect: false, publish: true });
- submitForm();
- };
-
- // Handle `submit as draft` button click.
- const handleSubmitDraftBtnClick = (event) => {
- setSubmitPayload({ redirect: true, publish: false });
- };
-
- // Handle `submit as draft & new` button click.
- const handleSubmitDraftAndNewBtnClick = (event) => {
- setSubmitPayload({ redirect: false, publish: false, resetForm: true });
- submitForm();
- };
-
- // Handles submit as draft & continue editing button click.
- const handleSubmitDraftContinueEditingBtnClick = (event) => {
- setSubmitPayload({ redirect: false, publish: false });
- submitForm();
- };
-
- // Handle cancel button action click.
- const handleCancelBtnClick = (event) => {
- history.goBack();
- };
-
- const handleClearBtnClick = (event) => {};
-
- return (
-
- {/* ----------- Save And Publish ----------- */}
-
-
- }
- />
-
- }
- onClick={handleSubmitPublishAndNewBtnClick}
- />
- }
- onClick={handleSubmitPublishContinueEditingBtnClick}
- />
-
- }
- minimal={true}
- interactionKind={PopoverInteractionKind.CLICK}
- position={Position.BOTTOM_LEFT}
- >
- }
- />
-
-
- {/* ----------- Save As Draft ----------- */}
-
- }
- />
-
- }
- onClick={handleSubmitDraftAndNewBtnClick}
- />
- }
- onClick={handleSubmitDraftContinueEditingBtnClick}
- />
-
- }
- minimal={true}
- interactionKind={PopoverInteractionKind.CLICK}
- position={Position.BOTTOM_LEFT}
- >
- }
- />
-
-
-
- {/* ----------- Save and New ----------- */}
-
-
- }
- />
-
- }
- onClick={handleSubmitPublishAndNewBtnClick}
- />
-
- }
- minimal={true}
- interactionKind={PopoverInteractionKind.CLICK}
- position={Position.BOTTOM_LEFT}
- >
- }
- />
-
-
-
- {/* ----------- Clear & Reset----------- */}
-
:
}
- />
- {/* ----------- Cancel ----------- */}
-
}
- />
-
- );
-}
diff --git a/packages/webapp/src/containers/CashFlow/MoneyInDialog/MoneyInFloatingActions.tsx b/packages/webapp/src/containers/CashFlow/MoneyInDialog/MoneyInFloatingActions.tsx
index 40297f988..644aa9a7f 100644
--- a/packages/webapp/src/containers/CashFlow/MoneyInDialog/MoneyInFloatingActions.tsx
+++ b/packages/webapp/src/containers/CashFlow/MoneyInDialog/MoneyInFloatingActions.tsx
@@ -27,13 +27,10 @@ function MoneyInFloatingActions({
setSubmitPayload({ publish: false });
submitForm();
};
-
// Handle submit button click.
const handleSubmittBtnClick = (event) => {
setSubmitPayload({ publish: true });
- submitForm();
};
-
// Handle close button click.
const handleCloseBtnClick = (event) => {
closeDialog(dialogName);
diff --git a/packages/webapp/src/containers/CashFlow/MoneyOutDialog/MoneyOutFloatingActions.tsx b/packages/webapp/src/containers/CashFlow/MoneyOutDialog/MoneyOutFloatingActions.tsx
index 00e0e5692..a370d328d 100644
--- a/packages/webapp/src/containers/CashFlow/MoneyOutDialog/MoneyOutFloatingActions.tsx
+++ b/packages/webapp/src/containers/CashFlow/MoneyOutDialog/MoneyOutFloatingActions.tsx
@@ -32,7 +32,6 @@ function MoneyOutFloatingActions({
// Handle submit button click.
const handleSubmittBtnClick = (event) => {
setSubmitPayload({ publish: true });
- submitForm();
};
// Handle close button click.
diff --git a/packages/webapp/src/containers/Dialogs/InventoryAdjustmentFormDialog/InventoryAdjustmentFloatingActions.tsx b/packages/webapp/src/containers/Dialogs/InventoryAdjustmentFormDialog/InventoryAdjustmentFloatingActions.tsx
index f20f82494..6c3c28299 100644
--- a/packages/webapp/src/containers/Dialogs/InventoryAdjustmentFormDialog/InventoryAdjustmentFloatingActions.tsx
+++ b/packages/webapp/src/containers/Dialogs/InventoryAdjustmentFormDialog/InventoryAdjustmentFloatingActions.tsx
@@ -31,7 +31,6 @@ function InventoryAdjustmentFloatingActions({
// Handle submit make adjustment button click.
const handleSubmitMakeAdjustmentBtnClick = (event) => {
setSubmitPayload({ publish: true });
- submitForm();
};
// Handle close button click.
@@ -53,7 +52,6 @@ function InventoryAdjustmentFloatingActions({
@@ -84,4 +84,4 @@ export default function ItemFormFloatingActions({ onCancel }) {
const SaveButton = styled(Button)`
min-width: 100px;
-`;
\ No newline at end of file
+`;
diff --git a/packages/webapp/src/containers/Purchases/PaymentMades/PaymentForm/PaymentMadeFloatingActions.tsx b/packages/webapp/src/containers/Purchases/PaymentMades/PaymentForm/PaymentMadeFloatingActions.tsx
index cefc67779..970c25054 100644
--- a/packages/webapp/src/containers/Purchases/PaymentMades/PaymentForm/PaymentMadeFloatingActions.tsx
+++ b/packages/webapp/src/containers/Purchases/PaymentMades/PaymentForm/PaymentMadeFloatingActions.tsx
@@ -27,7 +27,7 @@ export default function PaymentMadeFloatingActions() {
const history = useHistory();
// Formik context.
- const { isSubmitting, resetForm } = useFormikContext();
+ const { isSubmitting, resetForm, submitForm } = useFormikContext();
// Payment made form context.
const { setSubmitPayload, paymentMadeId } = usePaymentMadeFormContext();
@@ -50,12 +50,15 @@ export default function PaymentMadeFloatingActions() {
// Handle submit & new button click.
const handleSubmitAndNewClick = (event) => {
setSubmitPayload({ redirect: false, resetForm: true });
+ submitForm();
};
- // handle submit & continue editing button click.
+ // Handle submit & continue editing button click.
const handleSubmitContinueEditingBtnClick = (event) => {
setSubmitPayload({ redirect: false, publish: true });
+ submitForm()
};
+
return (
{/* ----------- Save and New ----------- */}
diff --git a/packages/webapp/src/containers/Purchases/PaymentMades/PaymentForm/PaymentMadeForm.tsx b/packages/webapp/src/containers/Purchases/PaymentMades/PaymentForm/PaymentMadeForm.tsx
index b5633718b..792dd095e 100644
--- a/packages/webapp/src/containers/Purchases/PaymentMades/PaymentForm/PaymentMadeForm.tsx
+++ b/packages/webapp/src/containers/Purchases/PaymentMades/PaymentForm/PaymentMadeForm.tsx
@@ -87,18 +87,19 @@ function PaymentMadeForm({
message: intl.get('you_cannot_make_payment_with_zero_total_amount'),
intent: Intent.DANGER,
});
+ setSubmitting(false);
return;
}
// Transformes the form values to request body.
const form = transformFormToRequest(values);
// Triggers once the save request success.
- const onSaved = (response) => {
+ const onSaved = () => {
AppToaster.show({
message: intl.get(
isNewMode
- ? 'the_payment_made_has_been_edited_successfully'
- : 'the_payment_made_has_been_created_successfully',
+ ? 'the_payment_made_has_been_created_successfully'
+ : 'the_payment_made_has_been_edited_successfully',
),
intent: Intent.SUCCESS,
});
@@ -116,7 +117,6 @@ function PaymentMadeForm({
if (errors) {
transformErrors(errors, { setFieldError });
}
-
setSubmitting(false);
};
diff --git a/packages/webapp/src/containers/Sales/PaymentReceives/PaymentReceiveForm/PaymentReceiveFloatingActions.tsx b/packages/webapp/src/containers/Sales/PaymentReceives/PaymentReceiveForm/PaymentReceiveFloatingActions.tsx
index 435b6ce13..4289e056b 100644
--- a/packages/webapp/src/containers/Sales/PaymentReceives/PaymentReceiveForm/PaymentReceiveFloatingActions.tsx
+++ b/packages/webapp/src/containers/Sales/PaymentReceives/PaymentReceiveForm/PaymentReceiveFloatingActions.tsx
@@ -34,25 +34,20 @@ export default function PaymentReceiveFormFloatingActions() {
// Handle submit button click.
const handleSubmitBtnClick = (event) => {
setSubmitPayload({ redirect: true });
- submitForm();
};
-
// Handle clear button click.
const handleClearBtnClick = (event) => {
resetForm();
};
-
// Handle cancel button click.
const handleCancelBtnClick = (event) => {
history.goBack();
};
-
// Handle submit & new button click.
const handleSubmitAndNewClick = (event) => {
setSubmitPayload({ redirect: false, resetForm: true });
submitForm();
};
-
// Handle submit & continue editing button click.
const handleSubmitContinueEditingBtnClick = (event) => {
setSubmitPayload({ redirect: false, publish: true });
diff --git a/packages/webapp/src/containers/Sales/PaymentReceives/PaymentReceiveForm/PaymentReceiveForm.tsx b/packages/webapp/src/containers/Sales/PaymentReceives/PaymentReceiveForm/PaymentReceiveForm.tsx
index d0e75204e..a0c84bacb 100644
--- a/packages/webapp/src/containers/Sales/PaymentReceives/PaymentReceiveForm/PaymentReceiveForm.tsx
+++ b/packages/webapp/src/containers/Sales/PaymentReceives/PaymentReceiveForm/PaymentReceiveForm.tsx
@@ -110,6 +110,7 @@ function PaymentReceiveForm({
message: intl.get('you_cannot_make_payment_with_zero_total_amount'),
intent: Intent.DANGER,
});
+ setSubmitting(false);
return;
}
// Transformes the form values to request body.
diff --git a/packages/webapp/src/containers/Vendors/VendorForm/VendorFloatingActions.tsx b/packages/webapp/src/containers/Vendors/VendorForm/VendorFloatingActions.tsx
index 1bd97563c..0801cbf91 100644
--- a/packages/webapp/src/containers/Vendors/VendorForm/VendorFloatingActions.tsx
+++ b/packages/webapp/src/containers/Vendors/VendorForm/VendorFloatingActions.tsx
@@ -32,7 +32,6 @@ export default function VendorFloatingActions({ onCancel }) {
// Handle the submit button.
const handleSubmitBtnClick = (event) => {
setSubmitPayload({ noRedirect: false });
- submitForm();
};
// Handle the submit & new button click.
diff --git a/packages/webapp/src/containers/WarehouseTransfers/WarehouseTransferForm/WarehouseTransferFloatingActions.tsx b/packages/webapp/src/containers/WarehouseTransfers/WarehouseTransferForm/WarehouseTransferFloatingActions.tsx
index c9fb1fa98..7e4d1e6b0 100644
--- a/packages/webapp/src/containers/WarehouseTransfers/WarehouseTransferForm/WarehouseTransferFloatingActions.tsx
+++ b/packages/webapp/src/containers/WarehouseTransfers/WarehouseTransferForm/WarehouseTransferFloatingActions.tsx
@@ -35,7 +35,6 @@ export default function WarehouseTransferFloatingActions() {
// Handle submit initiate button click.
const handleSubmitInitiateBtnClick = (event) => {
setSubmitPayload({ redirect: true, initiate: true, deliver: false });
- submitForm();
};
// Handle submit transferred button click.