diff --git a/client/src/containers/Alerts/AccountDeleteAlert.js b/client/src/containers/Alerts/AccountDeleteAlert.js index 229de8e82..e68fac261 100644 --- a/client/src/containers/Alerts/AccountDeleteAlert.js +++ b/client/src/containers/Alerts/AccountDeleteAlert.js @@ -1,6 +1,6 @@ import React from 'react'; import intl from 'react-intl-universal'; -import { FormattedMessage as T, FormattedHTMLMessage } from 'components'; +import { FormattedMessage as T, FormattedHTMLMessage } from 'components'; import { Intent, Alert } from '@blueprintjs/core'; import { AppToaster } from 'components'; @@ -9,6 +9,7 @@ import { handleDeleteErrors } from 'containers/Accounts/utils'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertActions from 'containers/Alert/withAlertActions'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { useDeleteAccount } from 'hooks/query'; import { compose } from 'utils'; @@ -25,6 +26,9 @@ function AccountDeleteAlert({ // #withAlertActions closeAlert, + + // #withDrawerActions + closeDrawer, }) { const { isLoading, mutateAsync: deleteAccount } = useDeleteAccount(); @@ -41,11 +45,18 @@ function AccountDeleteAlert({ intent: Intent.SUCCESS, }); closeAlert(name); + closeDrawer('account-drawer'); }) - .catch(({ response: { data: { errors } } }) => { - handleDeleteErrors(errors); - closeAlert(name); - }); + .catch( + ({ + response: { + data: { errors }, + }, + }) => { + handleDeleteErrors(errors); + closeAlert(name); + }, + ); }; return ( @@ -71,4 +82,5 @@ function AccountDeleteAlert({ export default compose( withAlertStoreConnect(), withAlertActions, + withDrawerActions, )(AccountDeleteAlert); diff --git a/client/src/containers/Alerts/Bills/BillDeleteAlert.js b/client/src/containers/Alerts/Bills/BillDeleteAlert.js index 7b41e4762..38f7bf636 100644 --- a/client/src/containers/Alerts/Bills/BillDeleteAlert.js +++ b/client/src/containers/Alerts/Bills/BillDeleteAlert.js @@ -6,6 +6,7 @@ import { AppToaster } from 'components'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertActions from 'containers/Alert/withAlertActions'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { handleDeleteErrors } from 'containers/Purchases/Bills/BillForm/utils'; import { useDeleteBill } from 'hooks/query'; @@ -23,8 +24,10 @@ function BillDeleteAlert({ // #withAlertActions closeAlert, + + // #withDrawerActions + closeDrawer, }) { - const { isLoading, mutateAsync: deleteBillMutate } = useDeleteBill(); // Handle cancel Bill @@ -40,6 +43,8 @@ function BillDeleteAlert({ message: intl.get('the_bill_has_been_deleted_successfully'), intent: Intent.SUCCESS, }); + + closeDrawer('bill-drawer'); }) .catch( ({ @@ -76,4 +81,5 @@ function BillDeleteAlert({ export default compose( withAlertStoreConnect(), withAlertActions, + withDrawerActions, )(BillDeleteAlert); diff --git a/client/src/containers/Alerts/Estimates/EstimateDeleteAlert.js b/client/src/containers/Alerts/Estimates/EstimateDeleteAlert.js index 383d320b3..bf11b380a 100644 --- a/client/src/containers/Alerts/Estimates/EstimateDeleteAlert.js +++ b/client/src/containers/Alerts/Estimates/EstimateDeleteAlert.js @@ -1,6 +1,6 @@ import React, { useCallback } from 'react'; import intl from 'react-intl-universal'; -import { FormattedMessage as T, FormattedHTMLMessage } from 'components'; +import { FormattedMessage as T, FormattedHTMLMessage } from 'components'; import { Intent, Alert } from '@blueprintjs/core'; import { useDeleteEstimate } from 'hooks/query'; @@ -9,6 +9,7 @@ import { AppToaster } from 'components'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertActions from 'containers/Alert/withAlertActions'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { compose } from 'utils'; @@ -24,8 +25,10 @@ function EstimateDeleteAlert({ // #withAlertActions closeAlert, + + // #withDrawerActions + closeDrawer, }) { - const { mutateAsync: deleteEstimateMutate, isLoading } = useDeleteEstimate(); // handle cancel delete alert. @@ -41,6 +44,7 @@ function EstimateDeleteAlert({ message: intl.get('the_estimate_has_been_deleted_successfully'), intent: Intent.SUCCESS, }); + closeDrawer('estimate-detail-drawer'); }) .catch(({ errors }) => {}) .finally(() => { @@ -71,4 +75,5 @@ function EstimateDeleteAlert({ export default compose( withAlertStoreConnect(), withAlertActions, + withDrawerActions, )(EstimateDeleteAlert); diff --git a/client/src/containers/Alerts/Expenses/ExpenseDeleteAlert.js b/client/src/containers/Alerts/Expenses/ExpenseDeleteAlert.js index f8604be99..9d3fdaee7 100644 --- a/client/src/containers/Alerts/Expenses/ExpenseDeleteAlert.js +++ b/client/src/containers/Alerts/Expenses/ExpenseDeleteAlert.js @@ -6,6 +6,7 @@ import { AppToaster } from 'components'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertActions from 'containers/Alert/withAlertActions'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { useDeleteExpense } from 'hooks/query'; import { compose } from 'utils'; @@ -20,6 +21,9 @@ function ExpenseDeleteAlert({ // #withAlertStoreConnect isOpen, payload: { expenseId }, + + // #withDrawerActions + closeDrawer, }) { const { mutateAsync: deleteExpenseMutate, isLoading } = useDeleteExpense(); @@ -38,7 +42,7 @@ function ExpenseDeleteAlert({ }), intent: Intent.SUCCESS, }); - closeAlert('expense-delete'); + closeDrawer('expense-drawer'); }) .catch( ({ @@ -57,7 +61,10 @@ function ExpenseDeleteAlert({ }); } }, - ); + ) + .finally(() => { + closeAlert('expense-delete'); + }); }; return ( @@ -81,4 +88,5 @@ function ExpenseDeleteAlert({ export default compose( withAlertStoreConnect(), withAlertActions, + withDrawerActions, )(ExpenseDeleteAlert); diff --git a/client/src/containers/Alerts/Invoices/InvoiceDeleteAlert.js b/client/src/containers/Alerts/Invoices/InvoiceDeleteAlert.js index 241737c22..2d12b3080 100644 --- a/client/src/containers/Alerts/Invoices/InvoiceDeleteAlert.js +++ b/client/src/containers/Alerts/Invoices/InvoiceDeleteAlert.js @@ -1,6 +1,6 @@ import React from 'react'; import intl from 'react-intl-universal'; -import { FormattedMessage as T, FormattedHTMLMessage } from 'components'; +import { FormattedMessage as T, FormattedHTMLMessage } from 'components'; import { Intent, Alert } from '@blueprintjs/core'; import { AppToaster } from 'components'; import { useDeleteInvoice } from 'hooks/query'; @@ -9,6 +9,7 @@ import { handleDeleteErrors } from 'containers/Sales/Invoices/InvoicesLanding/co import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertActions from 'containers/Alert/withAlertActions'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { compose } from 'utils'; @@ -24,8 +25,10 @@ function InvoiceDeleteAlert({ // #withAlertActions closeAlert, + + // #withDrawerActions + closeDrawer, }) { - const { mutateAsync: deleteInvoiceMutate, isLoading } = useDeleteInvoice(); // handle cancel delete invoice alert. @@ -41,10 +44,17 @@ function InvoiceDeleteAlert({ message: intl.get('the_invoice_has_been_deleted_successfully'), intent: Intent.SUCCESS, }); + closeDrawer('invoice-detail-drawer'); }) - .catch(({ response: { data: { errors } } }) => { - handleDeleteErrors(errors); - }) + .catch( + ({ + response: { + data: { errors }, + }, + }) => { + handleDeleteErrors(errors); + }, + ) .finally(() => { closeAlert(name); }); @@ -73,4 +83,5 @@ function InvoiceDeleteAlert({ export default compose( withAlertStoreConnect(), withAlertActions, + withDrawerActions, )(InvoiceDeleteAlert); diff --git a/client/src/containers/Alerts/Items/InventoryAdjustmentDeleteAlert.js b/client/src/containers/Alerts/Items/InventoryAdjustmentDeleteAlert.js index 9959a2dfd..892330ecf 100644 --- a/client/src/containers/Alerts/Items/InventoryAdjustmentDeleteAlert.js +++ b/client/src/containers/Alerts/Items/InventoryAdjustmentDeleteAlert.js @@ -1,14 +1,13 @@ import React from 'react'; import intl from 'react-intl-universal'; -import { FormattedMessage as T, FormattedHTMLMessage } from 'components'; +import { FormattedMessage as T, FormattedHTMLMessage } from 'components'; import { Intent, Alert } from '@blueprintjs/core'; import { AppToaster } from 'components'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertActions from 'containers/Alert/withAlertActions'; -import { - useDeleteInventoryAdjustment -} from 'hooks/query'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; +import { useDeleteInventoryAdjustment } from 'hooks/query'; import { compose } from 'utils'; @@ -24,12 +23,12 @@ function InventoryAdjustmentDeleteAlert({ // #withAlertActions closeAlert, + + // #withDrawerActions + closeDrawer, }) { - - const { - mutateAsync: deleteInventoryAdjMutate, - isLoading - } = useDeleteInventoryAdjustment(); + const { mutateAsync: deleteInventoryAdjMutate, isLoading } = + useDeleteInventoryAdjustment(); // handle cancel delete alert. const handleCancelInventoryAdjustmentDelete = () => { @@ -44,6 +43,7 @@ function InventoryAdjustmentDeleteAlert({ message: intl.get('the_adjustment_has_been_deleted_successfully'), intent: Intent.SUCCESS, }); + closeDrawer('inventory-adjustment-drawer'); }) .catch((errors) => {}) .finally(() => { @@ -76,4 +76,5 @@ function InventoryAdjustmentDeleteAlert({ export default compose( withAlertStoreConnect(), withAlertActions, + withDrawerActions, )(InventoryAdjustmentDeleteAlert); diff --git a/client/src/containers/Alerts/Items/ItemDeleteAlert.js b/client/src/containers/Alerts/Items/ItemDeleteAlert.js index 7a81baa5e..51e1ac638 100644 --- a/client/src/containers/Alerts/Items/ItemDeleteAlert.js +++ b/client/src/containers/Alerts/Items/ItemDeleteAlert.js @@ -1,6 +1,6 @@ import React from 'react'; import intl from 'react-intl-universal'; -import { FormattedMessage as T, FormattedHTMLMessage } from 'components'; +import { FormattedMessage as T, FormattedHTMLMessage } from 'components'; import { Intent, Alert } from '@blueprintjs/core'; import { AppToaster } from 'components'; @@ -10,6 +10,7 @@ import { useDeleteItem } from 'hooks/query'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertActions from 'containers/Alert/withAlertActions'; import withItemsActions from 'containers/Items/withItemsActions'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { compose } from 'utils'; @@ -28,9 +29,11 @@ function ItemDeleteAlert({ // #withItemsActions setItemsTableState, + + // #withDrawerActions + closeDrawer, }) { const { mutateAsync: deleteItem, isLoading } = useDeleteItem(); - // Handle cancel delete item alert. const handleCancelItemDelete = () => { @@ -47,6 +50,7 @@ function ItemDeleteAlert({ }); // Reset to page number one. setItemsTableState({ page: 1 }); + closeDrawer('item-detail-drawer'); }) .catch( ({ @@ -86,4 +90,5 @@ export default compose( withAlertStoreConnect(), withAlertActions, withItemsActions, + withDrawerActions, )(ItemDeleteAlert); diff --git a/client/src/containers/Alerts/ManualJournals/JournalDeleteAlert.js b/client/src/containers/Alerts/ManualJournals/JournalDeleteAlert.js index 155506589..e0d4d9d7b 100644 --- a/client/src/containers/Alerts/ManualJournals/JournalDeleteAlert.js +++ b/client/src/containers/Alerts/ManualJournals/JournalDeleteAlert.js @@ -8,6 +8,7 @@ import { AppToaster } from 'components'; import withAlertActions from 'containers/Alert/withAlertActions'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { compose } from 'utils'; @@ -23,8 +24,10 @@ function JournalDeleteAlert({ // #withAlertActions closeAlert, + + // #withDrawerActions + closeDrawer, }) { - const { mutateAsync: deleteJournalMutate, isLoading } = useDeleteJournal(); // Handle cancel delete manual journal. @@ -37,13 +40,13 @@ function JournalDeleteAlert({ deleteJournalMutate(manualJournalId) .then(() => { AppToaster.show({ - message: intl.get( - 'the_journal_has_been_deleted_successfully', - { number: journalNumber }, - ), + message: intl.get('the_journal_has_been_deleted_successfully', { + number: journalNumber, + }), intent: Intent.SUCCESS, }); closeAlert(name); + closeDrawer('journal-drawer'); }) .catch(() => { closeAlert(name); @@ -71,4 +74,5 @@ function JournalDeleteAlert({ export default compose( withAlertStoreConnect(), withAlertActions, + withDrawerActions )(JournalDeleteAlert); diff --git a/client/src/containers/Alerts/PaymentMades/PaymentMadeDeleteAlert.js b/client/src/containers/Alerts/PaymentMades/PaymentMadeDeleteAlert.js index 109cf3f3a..e90e628c2 100644 --- a/client/src/containers/Alerts/PaymentMades/PaymentMadeDeleteAlert.js +++ b/client/src/containers/Alerts/PaymentMades/PaymentMadeDeleteAlert.js @@ -6,6 +6,7 @@ import { AppToaster } from 'components'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertActions from 'containers/Alert/withAlertActions'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { useDeletePaymentMade } from 'hooks/query'; @@ -23,12 +24,12 @@ function PaymentMadeDeleteAlert({ // #withAlertActions closeAlert, + + // #withDrawerActions + closeDrawer, }) { - - const { - mutateAsync: deletePaymentMadeMutate, - isLoading, - } = useDeletePaymentMade(); + const { mutateAsync: deletePaymentMadeMutate, isLoading } = + useDeletePaymentMade(); // Handle cancel payment made. const handleCancelPaymentMadeDelete = () => {}; @@ -41,6 +42,7 @@ function PaymentMadeDeleteAlert({ message: intl.get('the_payment_made_has_been_deleted_successfully'), intent: Intent.SUCCESS, }); + closeDrawer('payment-made-detail-drawer'); }) .finally(() => { closeAlert(name); @@ -68,4 +70,5 @@ function PaymentMadeDeleteAlert({ export default compose( withAlertStoreConnect(), withAlertActions, + withDrawerActions, )(PaymentMadeDeleteAlert); diff --git a/client/src/containers/Alerts/Receipts/ReceiptDeleteAlert.js b/client/src/containers/Alerts/Receipts/ReceiptDeleteAlert.js index 2e1660ac8..157dc856d 100644 --- a/client/src/containers/Alerts/Receipts/ReceiptDeleteAlert.js +++ b/client/src/containers/Alerts/Receipts/ReceiptDeleteAlert.js @@ -1,14 +1,14 @@ import React from 'react'; import intl from 'react-intl-universal'; -import { FormattedMessage as T, FormattedHTMLMessage } from 'components'; +import { FormattedMessage as T, FormattedHTMLMessage } from 'components'; import { Intent, Alert } from '@blueprintjs/core'; -import { queryCache } from 'react-query'; import { useDeleteReceipt } from 'hooks/query'; import { AppToaster } from 'components'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertActions from 'containers/Alert/withAlertActions'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { compose } from 'utils'; @@ -24,12 +24,11 @@ function NameDeleteAlert({ // #withAlertActions closeAlert, + + // #withDrawerActions + closeDrawer, }) { - - const { - mutateAsync: deleteReceiptMutate, - isLoading - } = useDeleteReceipt(); + const { mutateAsync: deleteReceiptMutate, isLoading } = useDeleteReceipt(); // Handle cancel delete alert. const handleCancelDeleteAlert = () => { @@ -44,6 +43,7 @@ function NameDeleteAlert({ message: intl.get('the_receipt_has_been_deleted_successfully'), intent: Intent.SUCCESS, }); + closeDrawer('receipt-detail-drawer'); }) .catch(() => {}) .finally(() => { @@ -74,4 +74,5 @@ function NameDeleteAlert({ export default compose( withAlertStoreConnect(), withAlertActions, + withDrawerActions )(NameDeleteAlert); diff --git a/client/src/containers/Customers/CustomersLanding/CustomersTable.js b/client/src/containers/Customers/CustomersLanding/CustomersTable.js index 9205ee93a..7cdf61560 100644 --- a/client/src/containers/Customers/CustomersLanding/CustomersTable.js +++ b/client/src/containers/Customers/CustomersLanding/CustomersTable.js @@ -92,7 +92,7 @@ function CustomersTable({ // Handle view detail contact. const handleViewDetailCustomer = ({ id }) => { - openDrawer('contact-detail-drawer', { customerId: id }); + openDrawer('customer-details-drawer', { customerId: id }); }; // Handle cell click. diff --git a/client/src/containers/Drawers/AccountDrawer/AccountDrawerActionBar.js b/client/src/containers/Drawers/AccountDrawer/AccountDrawerActionBar.js index 37f7b6a4e..cd4f11d90 100644 --- a/client/src/containers/Drawers/AccountDrawer/AccountDrawerActionBar.js +++ b/client/src/containers/Drawers/AccountDrawer/AccountDrawerActionBar.js @@ -12,7 +12,6 @@ import { FormattedMessage as T } from 'components'; import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; import withDialogActions from 'containers/Dialog/withDialogActions'; import withAlertsActions from 'containers/Alert/withAlertActions'; -import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { safeCallback } from 'utils'; @@ -28,9 +27,6 @@ function AccountDrawerActionBar({ // #withAlertsDialog openAlert, - - // #withDrawerActions - closeDrawer, }) { // Account drawer context. const { account } = useAccountDrawerContext(); @@ -52,7 +48,6 @@ function AccountDrawerActionBar({ // Handle delete action account. const onDeleteAccount = () => { openAlert('account-delete', { accountId: account.id }); - closeDrawer('account-drawer'); }; return ( @@ -85,5 +80,4 @@ function AccountDrawerActionBar({ export default compose( withDialogActions, withAlertsActions, - withDrawerActions, )(AccountDrawerActionBar); diff --git a/client/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js b/client/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js index e67562ccf..78947d9fb 100644 --- a/client/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js +++ b/client/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js @@ -36,16 +36,13 @@ function BillDetailActionsBar({ // Handle edit bill. const onEditBill = () => { - return billId - ? (history.push(`/bills/${billId}/edit`), closeDrawer('bill-drawer')) - : null; + history.push(`/bills/${billId}/edit`); + closeDrawer('bill-drawer'); }; // Handle delete bill. const onDeleteBill = () => { - return billId - ? (openAlert('bill-delete', { billId }), closeDrawer('bill-drawer')) - : null; + openAlert('bill-delete', { billId }); }; return ( diff --git a/client/src/containers/Drawers/EstimateDetailDrawer/EstimateDetailActionsBar.js b/client/src/containers/Drawers/EstimateDetailDrawer/EstimateDetailActionsBar.js index b732d1183..0c468be41 100644 --- a/client/src/containers/Drawers/EstimateDetailDrawer/EstimateDetailActionsBar.js +++ b/client/src/containers/Drawers/EstimateDetailDrawer/EstimateDetailActionsBar.js @@ -45,7 +45,6 @@ function EstimateDetailActionsBar({ // Handle delete sale estimate. const handleDeleteEstimate = () => { openAlert('estimate-delete', { estimateId }); - closeDrawer('estimate-detail-drawer'); }; // Handle print estimate. diff --git a/client/src/containers/Drawers/ExpenseDrawer/ExpenseDrawerActionBar.js b/client/src/containers/Drawers/ExpenseDrawer/ExpenseDrawerActionBar.js index dd2cc138c..f4472c86c 100644 --- a/client/src/containers/Drawers/ExpenseDrawer/ExpenseDrawerActionBar.js +++ b/client/src/containers/Drawers/ExpenseDrawer/ExpenseDrawerActionBar.js @@ -39,7 +39,6 @@ function ExpenseDrawerActionBar({ // Handle the expense delete action. const handleDeleteExpense = () => { openAlert('expense-delete', { expenseId: expense.id }); - closeDrawer('expense-drawer'); }; return ( diff --git a/client/src/containers/Drawers/InventoryAdjustmentDetailDrawer/InventoryAdjustmentDetailActionsBar.js b/client/src/containers/Drawers/InventoryAdjustmentDetailDrawer/InventoryAdjustmentDetailActionsBar.js index e97eee29c..e0231a3e9 100644 --- a/client/src/containers/Drawers/InventoryAdjustmentDetailDrawer/InventoryAdjustmentDetailActionsBar.js +++ b/client/src/containers/Drawers/InventoryAdjustmentDetailDrawer/InventoryAdjustmentDetailActionsBar.js @@ -6,7 +6,6 @@ import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; import { useInventoryAdjustmentDrawerContext } from './InventoryAdjustmentDrawerProvider'; import withAlertsActions from 'containers/Alert/withAlertActions'; -import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { Icon, FormattedMessage as T } from 'components'; @@ -18,16 +17,12 @@ import { compose } from 'utils'; function InventoryAdjustmentDetailActionsBar({ // #withAlertsActions openAlert, - - // #withDrawerActions - closeDrawer, }) { const { inventoryId } = useInventoryAdjustmentDrawerContext(); // Handle delete inventory adjustment. const handleDeleteInventoryAdjustment = () => { openAlert('inventory-adjustment-delete', { inventoryId }); - closeDrawer('inventory-adjustment-drawer'); }; return ( @@ -45,7 +40,4 @@ function InventoryAdjustmentDetailActionsBar({ ); } -export default compose( - withDrawerActions, - withAlertsActions, -)(InventoryAdjustmentDetailActionsBar); +export default compose(withAlertsActions)(InventoryAdjustmentDetailActionsBar); diff --git a/client/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailActionsBar.js b/client/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailActionsBar.js index 558db7592..c0c37b870 100644 --- a/client/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailActionsBar.js +++ b/client/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailActionsBar.js @@ -47,7 +47,6 @@ function InvoiceDetailActionsBar({ // Handle delete sale invoice. const handleDeleteInvoice = () => { openAlert('invoice-delete', { invoiceId }); - closeDrawer('invoice-detail-drawer'); }; // Handle print invoices. diff --git a/client/src/containers/Drawers/ReceiptDetailDrawer/ReceiptDetailActionBar.js b/client/src/containers/Drawers/ReceiptDetailDrawer/ReceiptDetailActionBar.js index eb2eae415..b6e17c191 100644 --- a/client/src/containers/Drawers/ReceiptDetailDrawer/ReceiptDetailActionBar.js +++ b/client/src/containers/Drawers/ReceiptDetailDrawer/ReceiptDetailActionBar.js @@ -34,18 +34,13 @@ function ReceiptDetailActionBar({ // Handle edit sale receipt. const onEditReceipt = () => { - return receiptId - ? (history.push(`/receipts/${receiptId}/edit`), - closeDrawer('receipt-detail-drawer')) - : null; + history.push(`/receipts/${receiptId}/edit`); + closeDrawer('receipt-detail-drawer'); }; // Handle delete sale receipt. const onDeleteReceipt = () => { - return receiptId - ? (openAlert('receipt-delete', { receiptId }), - closeDrawer('receipt-detail-drawer')) - : null; + openAlert('receipt-delete', { receiptId }); }; // Handle print receipt. const onPrintReceipt = () => { diff --git a/client/src/containers/Sales/Estimates/EstimateForm/EstimateForm.js b/client/src/containers/Sales/Estimates/EstimateForm/EstimateForm.js index 0c00f4706..4bb8f542b 100644 --- a/client/src/containers/Sales/Estimates/EstimateForm/EstimateForm.js +++ b/client/src/containers/Sales/Estimates/EstimateForm/EstimateForm.js @@ -113,8 +113,8 @@ function EstimateForm({ AppToaster.show({ message: intl.get( isNewMode - ? 'the_estimate_has_been_edited_successfully' - : 'the_estimate_has_been_created_successfully', + ? 'the_estimate_has_been_created_successfully' + : 'the_estimate_has_been_edited_successfully', { number: values.estimate_number }, ), intent: Intent.SUCCESS, diff --git a/client/src/containers/Sales/Invoices/InvoiceForm/InvoiceFloatingActions.js b/client/src/containers/Sales/Invoices/InvoiceForm/InvoiceFloatingActions.js index ecaa99018..d1dd532ca 100644 --- a/client/src/containers/Sales/Invoices/InvoiceForm/InvoiceFloatingActions.js +++ b/client/src/containers/Sales/Invoices/InvoiceForm/InvoiceFloatingActions.js @@ -25,10 +25,7 @@ export default function InvoiceFloatingActions() { const history = useHistory(); // Formik context. - const { isSubmitting } = useFormikContext(); - - // Formik context. - const { resetForm, submitForm } = useFormikContext(); + const { resetForm, submitForm, isSubmitting } = useFormikContext(); // Invoice form context. const { setSubmitPayload, invoice } = useInvoiceFormContext(); diff --git a/client/src/containers/Sales/Invoices/InvoiceForm/InvoiceForm.js b/client/src/containers/Sales/Invoices/InvoiceForm/InvoiceForm.js index 11d4d3371..f67a7dc52 100644 --- a/client/src/containers/Sales/Invoices/InvoiceForm/InvoiceForm.js +++ b/client/src/containers/Sales/Invoices/InvoiceForm/InvoiceForm.js @@ -177,7 +177,7 @@ export default compose( withSettings(({ invoiceSettings }) => ({ invoiceNextNumber: invoiceSettings?.nextNumber, invoiceNumberPrefix: invoiceSettings?.numberPrefix, - invoiceIncrementMode: invoiceSettings?.incrementMode, + invoiceIncrementMode: invoiceSettings?.autoIncrement, })), withCurrentOrganization(), )(InvoiceForm);