From 382f9de2032990f27e40f17aa3db2ab5ed40effd Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sun, 12 Sep 2021 14:45:33 +0200 Subject: [PATCH 01/13] BIG-44: fix View Detail Customer. --- .../src/containers/Customers/CustomersLanding/CustomersTable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. From 0b6b7989acf8aaf5717d6856ca80bc374710c18d Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sun, 12 Sep 2021 15:44:49 +0200 Subject: [PATCH 02/13] BIG-48: fix message alert estimate . --- .../containers/Sales/Estimates/EstimateForm/EstimateForm.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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, From 7ce15cda3c9d66dab809911c26134b184ab063ea Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sun, 12 Sep 2021 15:45:56 +0200 Subject: [PATCH 03/13] BIG-28: fix close drawer when delete item. --- client/src/containers/Alerts/Items/ItemDeleteAlert.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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); From f1619b31e9a10d9f48a4384fe2aacc90cdb58b66 Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sun, 12 Sep 2021 15:46:26 +0200 Subject: [PATCH 04/13] BIG-29: fix close drawer when delete inventory. --- .../Items/InventoryAdjustmentDeleteAlert.js | 19 ++++++++++--------- .../InventoryAdjustmentDetailActionsBar.js | 10 +--------- 2 files changed, 11 insertions(+), 18 deletions(-) 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/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); From 8e262c79f5216cbe2947a18f97d09104474b823b Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sun, 12 Sep 2021 15:47:03 +0200 Subject: [PATCH 05/13] BIG-30: fix close drawer when delete sale invoice. --- .../Alerts/Invoices/InvoiceDeleteAlert.js | 21 ++++++++++++++----- .../InvoiceDetailActionsBar.js | 1 - 2 files changed, 16 insertions(+), 6 deletions(-) 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/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. From 823bbd94b79ee9b8e30e51794bcfe61fb4c4d695 Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sun, 12 Sep 2021 15:47:46 +0200 Subject: [PATCH 06/13] BIG-31: fix close drawer when delete sale estimate. --- .../containers/Alerts/Estimates/EstimateDeleteAlert.js | 9 +++++++-- .../EstimateDetailDrawer/EstimateDetailActionsBar.js | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) 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/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. From 0eccd4da8e922529d40600ec907cceff16a40ac0 Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sun, 12 Sep 2021 15:48:11 +0200 Subject: [PATCH 07/13] BIG-32: fix close drawer when delete sale receipt. --- .../Alerts/Receipts/ReceiptDeleteAlert.js | 15 ++++++++------- .../ReceiptDetailDrawer/ReceiptDetailActionBar.js | 11 +++-------- 2 files changed, 11 insertions(+), 15 deletions(-) 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/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 = () => { From 47c38a339ee9ad16de431a4a26b99a68cdc378fc Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sun, 12 Sep 2021 16:50:14 +0200 Subject: [PATCH 08/13] BIG-12: fix reset button with invoice number. --- .../Sales/Invoices/InvoiceForm/InvoiceFloatingActions.js | 5 +---- .../src/containers/Sales/Invoices/InvoiceForm/InvoiceForm.js | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) 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); From f7b29a260e09fa599b0057e23a8933c453e6aa83 Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sun, 12 Sep 2021 16:57:08 +0200 Subject: [PATCH 09/13] BIG-33: fix close drawer when delete bill. --- client/src/containers/Alerts/Bills/BillDeleteAlert.js | 8 +++++++- .../Drawers/BillDrawer/BillDetailActionsBar.js | 9 +++------ 2 files changed, 10 insertions(+), 7 deletions(-) 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/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 ( From 39bfdd1ce53ad60503b2b7247b9f97c8b23811a3 Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sun, 12 Sep 2021 17:00:07 +0200 Subject: [PATCH 10/13] BIG-37: fix close drawer when delete payment made. --- .../Alerts/PaymentMades/PaymentMadeDeleteAlert.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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); From 4711ab34d4f09bf04976a1f694b60631bfd43a8f Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sun, 12 Sep 2021 17:07:36 +0200 Subject: [PATCH 11/13] BIG-35: fix close drawer when delete expense. --- .../containers/Alerts/Expenses/ExpenseDeleteAlert.js | 12 ++++++++++-- .../Drawers/ExpenseDrawer/ExpenseDrawerActionBar.js | 1 - 2 files changed, 10 insertions(+), 3 deletions(-) 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/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 ( From d15c32cc8c7c01f6f5bb7b25fa1c85cb1a04ce1b Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sun, 12 Sep 2021 17:16:47 +0200 Subject: [PATCH 12/13] BIG-36: fix close drawer when delete Manual journals. --- .../Alerts/ManualJournals/JournalDeleteAlert.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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); From 3ff84b4b3cd8d8419176836cecc3d08ce7c991f8 Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sun, 12 Sep 2021 17:19:27 +0200 Subject: [PATCH 13/13] BIG-34: fix close drawer when delete accounts. --- .../containers/Alerts/AccountDeleteAlert.js | 22 ++++++++++++++----- .../AccountDrawer/AccountDrawerActionBar.js | 6 ----- 2 files changed, 17 insertions(+), 11 deletions(-) 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/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);