diff --git a/client/src/containers/Customers/CustomerFloatingActions.js b/client/src/containers/Customers/CustomerFloatingActions.js
index e390794d0..a22a9aefe 100644
--- a/client/src/containers/Customers/CustomerFloatingActions.js
+++ b/client/src/containers/Customers/CustomerFloatingActions.js
@@ -1,52 +1,97 @@
import React from 'react';
-import { Intent, Button } from '@blueprintjs/core';
+import {
+ Intent,
+ Button,
+ ButtonGroup,
+ Popover,
+ PopoverInteractionKind,
+ Position,
+ Menu,
+ MenuItem,
+} from '@blueprintjs/core';
import { FormattedMessage as T } from 'react-intl';
import classNames from 'classnames';
import { CLASSES } from 'common/classes';
+import { useFormikContext } from 'formik';
import { saveInvoke } from 'utils';
+import { Icon } from 'components';
+/**
+ * Customer floating actions bar.
+ */
export default function CustomerFloatingActions({
onSubmitClick,
- onSubmitAndNewClick,
onCancelClick,
-
isSubmitting,
customerId,
}) {
+ const { resetForm, submitForm } = useFormikContext();
+
+ const handleSubmitBtnClick = (event) => {
+ saveInvoke(onSubmitClick, event, {
+ noRedirect: false,
+ });
+ };
+
+ const handleCancelBtnClick = (event) => {
+ saveInvoke(onCancelClick, event);
+ };
+
+ const handleClearBtnClick = (event) => {
+ // saveInvoke(onClearClick, event);
+ resetForm();
+ };
+
+ const handleSubmitAndNewClick = (event) => {
+ submitForm();
+ saveInvoke(onSubmitClick, event, {
+ noRedirect: true,
+ });
+ };
+
return (
-
-
-
-
-
+
+ {/* ----------- Save and New ----------- */}
+ : }
+ />
+
+ }
+ onClick={handleSubmitAndNewClick}
+ />
+
+ }
+ minimal={true}
+ interactionKind={PopoverInteractionKind.CLICK}
+ position={Position.BOTTOM_LEFT}
+ >
+ }
+ />
+
+ {/* ----------- Clear & Reset----------- */}
+ : }
+ />
+ {/* ----------- Cancel ----------- */}
+ }
+ />
+
);
}
diff --git a/client/src/containers/Customers/CustomerForm.js b/client/src/containers/Customers/CustomerForm.js
index ffbddf34e..bf7d28fba 100644
--- a/client/src/containers/Customers/CustomerForm.js
+++ b/client/src/containers/Customers/CustomerForm.js
@@ -229,13 +229,19 @@ function CustomerForm({
[setDeletedFiles, deletedFiles],
);
- const handleCancelClick = () => {
- history.goBack();
- };
+ const handleCancelClick = useCallback(
+ (event) => {
+ history.goBack();
+ },
+ [history],
+ );
- const handleSubmitAndNewClick = () => {
- setSubmitPayload({ noRedirect: true });
- };
+ const handleSubmitClick = useCallback(
+ (event, payload) => {
+ setSubmitPayload({ ...payload });
+ },
+ [setSubmitPayload],
+ );
return (
@@ -261,8 +267,8 @@ function CustomerForm({
)}
diff --git a/client/src/containers/Sales/Estimate/EstimateFloatingActions.js b/client/src/containers/Sales/Estimate/EstimateFloatingActions.js
index f76709fdb..d56def74d 100644
--- a/client/src/containers/Sales/Estimate/EstimateFloatingActions.js
+++ b/client/src/containers/Sales/Estimate/EstimateFloatingActions.js
@@ -1,18 +1,37 @@
import React from 'react';
-import { Intent, Button } from '@blueprintjs/core';
+import {
+ Intent,
+ Button,
+ ButtonGroup,
+ Popover,
+ PopoverInteractionKind,
+ Position,
+ Menu,
+ MenuItem,
+} from '@blueprintjs/core';
import { FormattedMessage as T } from 'react-intl';
+import { CLASSES } from 'common/classes';
+import classNames from 'classnames';
+import { useFormikContext } from 'formik';
import { saveInvoke } from 'utils';
+import { Icon } from 'components';
+/**
+ * Estimate floating actions bar.
+ */
export default function EstimateFloatingActions({
isSubmitting,
onSubmitClick,
onCancelClick,
onClearClick,
- onSubmitAndNewClick,
estimateId,
}) {
+ const { resetForm, submitForm } = useFormikContext();
+
const handleSubmitBtnClick = (event) => {
- saveInvoke(onSubmitClick, event);
+ saveInvoke(onSubmitClick, event, {
+ redirect: true,
+ });
};
const handleCancelBtnClick = (event) => {
@@ -20,49 +39,60 @@ export default function EstimateFloatingActions({
};
const handleClearBtnClick = (event) => {
- saveInvoke(onClearClick, event);
+ // saveInvoke(onClearClick, event);
+ resetForm();
};
const handleSubmitAndNewClick = (event) => {
- saveInvoke(onSubmitAndNewClick, event);
- }
+ submitForm();
+ saveInvoke(onSubmitClick, event, {
+ redirect: false,
+ });
+ };
return (
-
-
-
-
-
-
-
-
+
+
+ {/* ----------- Save and New ----------- */}
+ : }
+ />
+
+ }
+ onClick={handleSubmitAndNewClick}
+ />
+
+ }
+ minimal={true}
+ interactionKind={PopoverInteractionKind.CLICK}
+ position={Position.BOTTOM_LEFT}
+ >
+ }
+ />
+
+ {/* ----------- Clear & Reset----------- */}
+ : }
+ />
+ {/* ----------- Cancel ----------- */}
+ }
+ />
+
);
}
diff --git a/client/src/containers/Sales/Estimate/EstimateForm.js b/client/src/containers/Sales/Estimate/EstimateForm.js
index ba1f06a67..98ef90428 100644
--- a/client/src/containers/Sales/Estimate/EstimateForm.js
+++ b/client/src/containers/Sales/Estimate/EstimateForm.js
@@ -216,13 +216,19 @@ const EstimateForm = ({
[changePageSubtitle],
);
- const handleSubmitClick = useCallback((event) => {
- setSubmitPayload({ redirect: true });
- }, [setSubmitPayload]);
+ const handleSubmitClick = useCallback(
+ (event, payload) => {
+ setSubmitPayload({ ...payload });
+ },
+ [setSubmitPayload],
+ );
- const handleCancelClick = useCallback((event) => {
- history.goBack();
- }, [history]);
+ const handleCancelClick = useCallback(
+ (event) => {
+ history.goBack();
+ },
+ [history],
+ );
return (
@@ -238,15 +244,16 @@ const EstimateForm = ({
-
+
+
)}
diff --git a/client/src/containers/Sales/Invoice/InvoiceFloatingActions.js b/client/src/containers/Sales/Invoice/InvoiceFloatingActions.js
index f52c278ca..0004df237 100644
--- a/client/src/containers/Sales/Invoice/InvoiceFloatingActions.js
+++ b/client/src/containers/Sales/Invoice/InvoiceFloatingActions.js
@@ -16,6 +16,10 @@ import classNames from 'classnames';
import { saveInvoke } from 'utils';
import { Icon } from 'components';
+
+/**
+ * Invoice floating actions bar.
+ */
export default function InvoiceFloatingActions({
isSubmitting,
onSubmitClick,
@@ -106,6 +110,7 @@ export default function InvoiceFloatingActions({
/>
}
+ minimal={true}
interactionKind={PopoverInteractionKind.CLICK}
position={Position.BOTTOM_LEFT}
>
@@ -141,6 +146,7 @@ export default function InvoiceFloatingActions({
/>
}
+ minimal={true}
interactionKind={PopoverInteractionKind.CLICK}
position={Position.BOTTOM_LEFT}
>
@@ -159,7 +165,6 @@ export default function InvoiceFloatingActions({
{/* ----------- Cancel ----------- */}