This commit is contained in:
a.bouhuolia
2021-09-12 17:49:31 +02:00
21 changed files with 111 additions and 83 deletions

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; 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 { Intent, Alert } from '@blueprintjs/core';
import { AppToaster } from 'components'; import { AppToaster } from 'components';
@@ -9,6 +9,7 @@ import { handleDeleteErrors } from 'containers/Accounts/utils';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions'; import withAlertActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { useDeleteAccount } from 'hooks/query'; import { useDeleteAccount } from 'hooks/query';
import { compose } from 'utils'; import { compose } from 'utils';
@@ -25,6 +26,9 @@ function AccountDeleteAlert({
// #withAlertActions // #withAlertActions
closeAlert, closeAlert,
// #withDrawerActions
closeDrawer,
}) { }) {
const { isLoading, mutateAsync: deleteAccount } = useDeleteAccount(); const { isLoading, mutateAsync: deleteAccount } = useDeleteAccount();
@@ -41,11 +45,18 @@ function AccountDeleteAlert({
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeAlert(name); closeAlert(name);
closeDrawer('account-drawer');
}) })
.catch(({ response: { data: { errors } } }) => { .catch(
handleDeleteErrors(errors); ({
closeAlert(name); response: {
}); data: { errors },
},
}) => {
handleDeleteErrors(errors);
closeAlert(name);
},
);
}; };
return ( return (
@@ -71,4 +82,5 @@ function AccountDeleteAlert({
export default compose( export default compose(
withAlertStoreConnect(), withAlertStoreConnect(),
withAlertActions, withAlertActions,
withDrawerActions,
)(AccountDeleteAlert); )(AccountDeleteAlert);

View File

@@ -6,6 +6,7 @@ import { AppToaster } from 'components';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions'; import withAlertActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { handleDeleteErrors } from 'containers/Purchases/Bills/BillForm/utils'; import { handleDeleteErrors } from 'containers/Purchases/Bills/BillForm/utils';
import { useDeleteBill } from 'hooks/query'; import { useDeleteBill } from 'hooks/query';
@@ -23,8 +24,10 @@ function BillDeleteAlert({
// #withAlertActions // #withAlertActions
closeAlert, closeAlert,
}) {
// #withDrawerActions
closeDrawer,
}) {
const { isLoading, mutateAsync: deleteBillMutate } = useDeleteBill(); const { isLoading, mutateAsync: deleteBillMutate } = useDeleteBill();
// Handle cancel Bill // Handle cancel Bill
@@ -40,6 +43,8 @@ function BillDeleteAlert({
message: intl.get('the_bill_has_been_deleted_successfully'), message: intl.get('the_bill_has_been_deleted_successfully'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('bill-drawer');
}) })
.catch( .catch(
({ ({
@@ -76,4 +81,5 @@ function BillDeleteAlert({
export default compose( export default compose(
withAlertStoreConnect(), withAlertStoreConnect(),
withAlertActions, withAlertActions,
withDrawerActions,
)(BillDeleteAlert); )(BillDeleteAlert);

View File

@@ -1,6 +1,6 @@
import React, { useCallback } from 'react'; import React, { useCallback } from 'react';
import intl from 'react-intl-universal'; 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 { Intent, Alert } from '@blueprintjs/core';
import { useDeleteEstimate } from 'hooks/query'; import { useDeleteEstimate } from 'hooks/query';
@@ -9,6 +9,7 @@ import { AppToaster } from 'components';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions'; import withAlertActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { compose } from 'utils'; import { compose } from 'utils';
@@ -24,8 +25,10 @@ function EstimateDeleteAlert({
// #withAlertActions // #withAlertActions
closeAlert, closeAlert,
}) {
// #withDrawerActions
closeDrawer,
}) {
const { mutateAsync: deleteEstimateMutate, isLoading } = useDeleteEstimate(); const { mutateAsync: deleteEstimateMutate, isLoading } = useDeleteEstimate();
// handle cancel delete alert. // handle cancel delete alert.
@@ -41,6 +44,7 @@ function EstimateDeleteAlert({
message: intl.get('the_estimate_has_been_deleted_successfully'), message: intl.get('the_estimate_has_been_deleted_successfully'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('estimate-detail-drawer');
}) })
.catch(({ errors }) => {}) .catch(({ errors }) => {})
.finally(() => { .finally(() => {
@@ -71,4 +75,5 @@ function EstimateDeleteAlert({
export default compose( export default compose(
withAlertStoreConnect(), withAlertStoreConnect(),
withAlertActions, withAlertActions,
withDrawerActions,
)(EstimateDeleteAlert); )(EstimateDeleteAlert);

View File

@@ -6,6 +6,7 @@ import { AppToaster } from 'components';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions'; import withAlertActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { useDeleteExpense } from 'hooks/query'; import { useDeleteExpense } from 'hooks/query';
import { compose } from 'utils'; import { compose } from 'utils';
@@ -20,6 +21,9 @@ function ExpenseDeleteAlert({
// #withAlertStoreConnect // #withAlertStoreConnect
isOpen, isOpen,
payload: { expenseId }, payload: { expenseId },
// #withDrawerActions
closeDrawer,
}) { }) {
const { mutateAsync: deleteExpenseMutate, isLoading } = useDeleteExpense(); const { mutateAsync: deleteExpenseMutate, isLoading } = useDeleteExpense();
@@ -38,7 +42,7 @@ function ExpenseDeleteAlert({
}), }),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeAlert('expense-delete'); closeDrawer('expense-drawer');
}) })
.catch( .catch(
({ ({
@@ -57,7 +61,10 @@ function ExpenseDeleteAlert({
}); });
} }
}, },
); )
.finally(() => {
closeAlert('expense-delete');
});
}; };
return ( return (
@@ -81,4 +88,5 @@ function ExpenseDeleteAlert({
export default compose( export default compose(
withAlertStoreConnect(), withAlertStoreConnect(),
withAlertActions, withAlertActions,
withDrawerActions,
)(ExpenseDeleteAlert); )(ExpenseDeleteAlert);

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; 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 { Intent, Alert } from '@blueprintjs/core';
import { AppToaster } from 'components'; import { AppToaster } from 'components';
import { useDeleteInvoice } from 'hooks/query'; import { useDeleteInvoice } from 'hooks/query';
@@ -9,6 +9,7 @@ import { handleDeleteErrors } from 'containers/Sales/Invoices/InvoicesLanding/co
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions'; import withAlertActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { compose } from 'utils'; import { compose } from 'utils';
@@ -24,8 +25,10 @@ function InvoiceDeleteAlert({
// #withAlertActions // #withAlertActions
closeAlert, closeAlert,
}) {
// #withDrawerActions
closeDrawer,
}) {
const { mutateAsync: deleteInvoiceMutate, isLoading } = useDeleteInvoice(); const { mutateAsync: deleteInvoiceMutate, isLoading } = useDeleteInvoice();
// handle cancel delete invoice alert. // handle cancel delete invoice alert.
@@ -41,10 +44,17 @@ function InvoiceDeleteAlert({
message: intl.get('the_invoice_has_been_deleted_successfully'), message: intl.get('the_invoice_has_been_deleted_successfully'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('invoice-detail-drawer');
}) })
.catch(({ response: { data: { errors } } }) => { .catch(
handleDeleteErrors(errors); ({
}) response: {
data: { errors },
},
}) => {
handleDeleteErrors(errors);
},
)
.finally(() => { .finally(() => {
closeAlert(name); closeAlert(name);
}); });
@@ -73,4 +83,5 @@ function InvoiceDeleteAlert({
export default compose( export default compose(
withAlertStoreConnect(), withAlertStoreConnect(),
withAlertActions, withAlertActions,
withDrawerActions,
)(InvoiceDeleteAlert); )(InvoiceDeleteAlert);

View File

@@ -1,14 +1,13 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; 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 { Intent, Alert } from '@blueprintjs/core';
import { AppToaster } from 'components'; import { AppToaster } from 'components';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions'; import withAlertActions from 'containers/Alert/withAlertActions';
import { import withDrawerActions from 'containers/Drawer/withDrawerActions';
useDeleteInventoryAdjustment import { useDeleteInventoryAdjustment } from 'hooks/query';
} from 'hooks/query';
import { compose } from 'utils'; import { compose } from 'utils';
@@ -24,12 +23,12 @@ function InventoryAdjustmentDeleteAlert({
// #withAlertActions // #withAlertActions
closeAlert, closeAlert,
}) {
const { // #withDrawerActions
mutateAsync: deleteInventoryAdjMutate, closeDrawer,
isLoading }) {
} = useDeleteInventoryAdjustment(); const { mutateAsync: deleteInventoryAdjMutate, isLoading } =
useDeleteInventoryAdjustment();
// handle cancel delete alert. // handle cancel delete alert.
const handleCancelInventoryAdjustmentDelete = () => { const handleCancelInventoryAdjustmentDelete = () => {
@@ -44,6 +43,7 @@ function InventoryAdjustmentDeleteAlert({
message: intl.get('the_adjustment_has_been_deleted_successfully'), message: intl.get('the_adjustment_has_been_deleted_successfully'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('inventory-adjustment-drawer');
}) })
.catch((errors) => {}) .catch((errors) => {})
.finally(() => { .finally(() => {
@@ -76,4 +76,5 @@ function InventoryAdjustmentDeleteAlert({
export default compose( export default compose(
withAlertStoreConnect(), withAlertStoreConnect(),
withAlertActions, withAlertActions,
withDrawerActions,
)(InventoryAdjustmentDeleteAlert); )(InventoryAdjustmentDeleteAlert);

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; 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 { Intent, Alert } from '@blueprintjs/core';
import { AppToaster } from 'components'; import { AppToaster } from 'components';
@@ -10,6 +10,7 @@ import { useDeleteItem } from 'hooks/query';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions'; import withAlertActions from 'containers/Alert/withAlertActions';
import withItemsActions from 'containers/Items/withItemsActions'; import withItemsActions from 'containers/Items/withItemsActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { compose } from 'utils'; import { compose } from 'utils';
@@ -28,10 +29,12 @@ function ItemDeleteAlert({
// #withItemsActions // #withItemsActions
setItemsTableState, setItemsTableState,
// #withDrawerActions
closeDrawer,
}) { }) {
const { mutateAsync: deleteItem, isLoading } = useDeleteItem(); const { mutateAsync: deleteItem, isLoading } = useDeleteItem();
// Handle cancel delete item alert. // Handle cancel delete item alert.
const handleCancelItemDelete = () => { const handleCancelItemDelete = () => {
closeAlert(name); closeAlert(name);
@@ -47,6 +50,7 @@ function ItemDeleteAlert({
}); });
// Reset to page number one. // Reset to page number one.
setItemsTableState({ page: 1 }); setItemsTableState({ page: 1 });
closeDrawer('item-detail-drawer');
}) })
.catch( .catch(
({ ({
@@ -86,4 +90,5 @@ export default compose(
withAlertStoreConnect(), withAlertStoreConnect(),
withAlertActions, withAlertActions,
withItemsActions, withItemsActions,
withDrawerActions,
)(ItemDeleteAlert); )(ItemDeleteAlert);

View File

@@ -8,6 +8,7 @@ import { AppToaster } from 'components';
import withAlertActions from 'containers/Alert/withAlertActions'; import withAlertActions from 'containers/Alert/withAlertActions';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { compose } from 'utils'; import { compose } from 'utils';
@@ -23,8 +24,10 @@ function JournalDeleteAlert({
// #withAlertActions // #withAlertActions
closeAlert, closeAlert,
}) {
// #withDrawerActions
closeDrawer,
}) {
const { mutateAsync: deleteJournalMutate, isLoading } = useDeleteJournal(); const { mutateAsync: deleteJournalMutate, isLoading } = useDeleteJournal();
// Handle cancel delete manual journal. // Handle cancel delete manual journal.
@@ -37,13 +40,13 @@ function JournalDeleteAlert({
deleteJournalMutate(manualJournalId) deleteJournalMutate(manualJournalId)
.then(() => { .then(() => {
AppToaster.show({ AppToaster.show({
message: intl.get( message: intl.get('the_journal_has_been_deleted_successfully', {
'the_journal_has_been_deleted_successfully', number: journalNumber,
{ number: journalNumber }, }),
),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeAlert(name); closeAlert(name);
closeDrawer('journal-drawer');
}) })
.catch(() => { .catch(() => {
closeAlert(name); closeAlert(name);
@@ -71,4 +74,5 @@ function JournalDeleteAlert({
export default compose( export default compose(
withAlertStoreConnect(), withAlertStoreConnect(),
withAlertActions, withAlertActions,
withDrawerActions
)(JournalDeleteAlert); )(JournalDeleteAlert);

View File

@@ -6,6 +6,7 @@ import { AppToaster } from 'components';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions'; import withAlertActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { useDeletePaymentMade } from 'hooks/query'; import { useDeletePaymentMade } from 'hooks/query';
@@ -23,12 +24,12 @@ function PaymentMadeDeleteAlert({
// #withAlertActions // #withAlertActions
closeAlert, closeAlert,
}) {
const { // #withDrawerActions
mutateAsync: deletePaymentMadeMutate, closeDrawer,
isLoading, }) {
} = useDeletePaymentMade(); const { mutateAsync: deletePaymentMadeMutate, isLoading } =
useDeletePaymentMade();
// Handle cancel payment made. // Handle cancel payment made.
const handleCancelPaymentMadeDelete = () => {}; const handleCancelPaymentMadeDelete = () => {};
@@ -41,6 +42,7 @@ function PaymentMadeDeleteAlert({
message: intl.get('the_payment_made_has_been_deleted_successfully'), message: intl.get('the_payment_made_has_been_deleted_successfully'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('payment-made-detail-drawer');
}) })
.finally(() => { .finally(() => {
closeAlert(name); closeAlert(name);
@@ -68,4 +70,5 @@ function PaymentMadeDeleteAlert({
export default compose( export default compose(
withAlertStoreConnect(), withAlertStoreConnect(),
withAlertActions, withAlertActions,
withDrawerActions,
)(PaymentMadeDeleteAlert); )(PaymentMadeDeleteAlert);

View File

@@ -1,14 +1,14 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; 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 { Intent, Alert } from '@blueprintjs/core';
import { queryCache } from 'react-query';
import { useDeleteReceipt } from 'hooks/query'; import { useDeleteReceipt } from 'hooks/query';
import { AppToaster } from 'components'; import { AppToaster } from 'components';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions'; import withAlertActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { compose } from 'utils'; import { compose } from 'utils';
@@ -24,12 +24,11 @@ function NameDeleteAlert({
// #withAlertActions // #withAlertActions
closeAlert, closeAlert,
}) {
const { // #withDrawerActions
mutateAsync: deleteReceiptMutate, closeDrawer,
isLoading }) {
} = useDeleteReceipt(); const { mutateAsync: deleteReceiptMutate, isLoading } = useDeleteReceipt();
// Handle cancel delete alert. // Handle cancel delete alert.
const handleCancelDeleteAlert = () => { const handleCancelDeleteAlert = () => {
@@ -44,6 +43,7 @@ function NameDeleteAlert({
message: intl.get('the_receipt_has_been_deleted_successfully'), message: intl.get('the_receipt_has_been_deleted_successfully'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('receipt-detail-drawer');
}) })
.catch(() => {}) .catch(() => {})
.finally(() => { .finally(() => {
@@ -74,4 +74,5 @@ function NameDeleteAlert({
export default compose( export default compose(
withAlertStoreConnect(), withAlertStoreConnect(),
withAlertActions, withAlertActions,
withDrawerActions
)(NameDeleteAlert); )(NameDeleteAlert);

View File

@@ -92,7 +92,7 @@ function CustomersTable({
// Handle view detail contact. // Handle view detail contact.
const handleViewDetailCustomer = ({ id }) => { const handleViewDetailCustomer = ({ id }) => {
openDrawer('contact-detail-drawer', { customerId: id }); openDrawer('customer-details-drawer', { customerId: id });
}; };
// Handle cell click. // Handle cell click.

View File

@@ -12,7 +12,6 @@ import { FormattedMessage as T } from 'components';
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
import withDialogActions from 'containers/Dialog/withDialogActions'; import withDialogActions from 'containers/Dialog/withDialogActions';
import withAlertsActions from 'containers/Alert/withAlertActions'; import withAlertsActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { safeCallback } from 'utils'; import { safeCallback } from 'utils';
@@ -28,9 +27,6 @@ function AccountDrawerActionBar({
// #withAlertsDialog // #withAlertsDialog
openAlert, openAlert,
// #withDrawerActions
closeDrawer,
}) { }) {
// Account drawer context. // Account drawer context.
const { account } = useAccountDrawerContext(); const { account } = useAccountDrawerContext();
@@ -52,7 +48,6 @@ function AccountDrawerActionBar({
// Handle delete action account. // Handle delete action account.
const onDeleteAccount = () => { const onDeleteAccount = () => {
openAlert('account-delete', { accountId: account.id }); openAlert('account-delete', { accountId: account.id });
closeDrawer('account-drawer');
}; };
return ( return (
@@ -85,5 +80,4 @@ function AccountDrawerActionBar({
export default compose( export default compose(
withDialogActions, withDialogActions,
withAlertsActions, withAlertsActions,
withDrawerActions,
)(AccountDrawerActionBar); )(AccountDrawerActionBar);

View File

@@ -36,16 +36,13 @@ function BillDetailActionsBar({
// Handle edit bill. // Handle edit bill.
const onEditBill = () => { const onEditBill = () => {
return billId history.push(`/bills/${billId}/edit`);
? (history.push(`/bills/${billId}/edit`), closeDrawer('bill-drawer')) closeDrawer('bill-drawer');
: null;
}; };
// Handle delete bill. // Handle delete bill.
const onDeleteBill = () => { const onDeleteBill = () => {
return billId openAlert('bill-delete', { billId });
? (openAlert('bill-delete', { billId }), closeDrawer('bill-drawer'))
: null;
}; };
return ( return (

View File

@@ -45,7 +45,6 @@ function EstimateDetailActionsBar({
// Handle delete sale estimate. // Handle delete sale estimate.
const handleDeleteEstimate = () => { const handleDeleteEstimate = () => {
openAlert('estimate-delete', { estimateId }); openAlert('estimate-delete', { estimateId });
closeDrawer('estimate-detail-drawer');
}; };
// Handle print estimate. // Handle print estimate.

View File

@@ -39,7 +39,6 @@ function ExpenseDrawerActionBar({
// Handle the expense delete action. // Handle the expense delete action.
const handleDeleteExpense = () => { const handleDeleteExpense = () => {
openAlert('expense-delete', { expenseId: expense.id }); openAlert('expense-delete', { expenseId: expense.id });
closeDrawer('expense-drawer');
}; };
return ( return (

View File

@@ -6,7 +6,6 @@ import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
import { useInventoryAdjustmentDrawerContext } from './InventoryAdjustmentDrawerProvider'; import { useInventoryAdjustmentDrawerContext } from './InventoryAdjustmentDrawerProvider';
import withAlertsActions from 'containers/Alert/withAlertActions'; import withAlertsActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { Icon, FormattedMessage as T } from 'components'; import { Icon, FormattedMessage as T } from 'components';
@@ -18,16 +17,12 @@ import { compose } from 'utils';
function InventoryAdjustmentDetailActionsBar({ function InventoryAdjustmentDetailActionsBar({
// #withAlertsActions // #withAlertsActions
openAlert, openAlert,
// #withDrawerActions
closeDrawer,
}) { }) {
const { inventoryId } = useInventoryAdjustmentDrawerContext(); const { inventoryId } = useInventoryAdjustmentDrawerContext();
// Handle delete inventory adjustment. // Handle delete inventory adjustment.
const handleDeleteInventoryAdjustment = () => { const handleDeleteInventoryAdjustment = () => {
openAlert('inventory-adjustment-delete', { inventoryId }); openAlert('inventory-adjustment-delete', { inventoryId });
closeDrawer('inventory-adjustment-drawer');
}; };
return ( return (
@@ -45,7 +40,4 @@ function InventoryAdjustmentDetailActionsBar({
); );
} }
export default compose( export default compose(withAlertsActions)(InventoryAdjustmentDetailActionsBar);
withDrawerActions,
withAlertsActions,
)(InventoryAdjustmentDetailActionsBar);

View File

@@ -47,7 +47,6 @@ function InvoiceDetailActionsBar({
// Handle delete sale invoice. // Handle delete sale invoice.
const handleDeleteInvoice = () => { const handleDeleteInvoice = () => {
openAlert('invoice-delete', { invoiceId }); openAlert('invoice-delete', { invoiceId });
closeDrawer('invoice-detail-drawer');
}; };
// Handle print invoices. // Handle print invoices.

View File

@@ -34,18 +34,13 @@ function ReceiptDetailActionBar({
// Handle edit sale receipt. // Handle edit sale receipt.
const onEditReceipt = () => { const onEditReceipt = () => {
return receiptId history.push(`/receipts/${receiptId}/edit`);
? (history.push(`/receipts/${receiptId}/edit`), closeDrawer('receipt-detail-drawer');
closeDrawer('receipt-detail-drawer'))
: null;
}; };
// Handle delete sale receipt. // Handle delete sale receipt.
const onDeleteReceipt = () => { const onDeleteReceipt = () => {
return receiptId openAlert('receipt-delete', { receiptId });
? (openAlert('receipt-delete', { receiptId }),
closeDrawer('receipt-detail-drawer'))
: null;
}; };
// Handle print receipt. // Handle print receipt.
const onPrintReceipt = () => { const onPrintReceipt = () => {

View File

@@ -113,8 +113,8 @@ function EstimateForm({
AppToaster.show({ AppToaster.show({
message: intl.get( message: intl.get(
isNewMode 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 }, { number: values.estimate_number },
), ),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,

View File

@@ -25,10 +25,7 @@ export default function InvoiceFloatingActions() {
const history = useHistory(); const history = useHistory();
// Formik context. // Formik context.
const { isSubmitting } = useFormikContext(); const { resetForm, submitForm, isSubmitting } = useFormikContext();
// Formik context.
const { resetForm, submitForm } = useFormikContext();
// Invoice form context. // Invoice form context.
const { setSubmitPayload, invoice } = useInvoiceFormContext(); const { setSubmitPayload, invoice } = useInvoiceFormContext();

View File

@@ -177,7 +177,7 @@ export default compose(
withSettings(({ invoiceSettings }) => ({ withSettings(({ invoiceSettings }) => ({
invoiceNextNumber: invoiceSettings?.nextNumber, invoiceNextNumber: invoiceSettings?.nextNumber,
invoiceNumberPrefix: invoiceSettings?.numberPrefix, invoiceNumberPrefix: invoiceSettings?.numberPrefix,
invoiceIncrementMode: invoiceSettings?.incrementMode, invoiceIncrementMode: invoiceSettings?.autoIncrement,
})), })),
withCurrentOrganization(), withCurrentOrganization(),
)(InvoiceForm); )(InvoiceForm);