diff --git a/src/containers/Alerts/Bills/BillLocatedLandedCostDeleteAlert.js b/src/containers/Alerts/Bills/BillLocatedLandedCostDeleteAlert.js index 45b78e093..4dee8f29c 100644 --- a/src/containers/Alerts/Bills/BillLocatedLandedCostDeleteAlert.js +++ b/src/containers/Alerts/Bills/BillLocatedLandedCostDeleteAlert.js @@ -35,7 +35,7 @@ function BillTransactionDeleteAlert({ deleteLandedCostMutate(BillId) .then(() => { AppToaster.show({ - message: intl.get('bill.action.delete_successfully.landed_cost'), + message: intl.get('landed_cost.action.delete.success_message'), intent: Intent.SUCCESS, }); closeAlert(name); @@ -56,7 +56,11 @@ function BillTransactionDeleteAlert({ onConfirm={handleConfirmLandedCostDelete} loading={isLoading} > -

+

+ +

); } diff --git a/src/containers/Alerts/Customers/CustomerDeleteAlert.js b/src/containers/Alerts/Customers/CustomerDeleteAlert.js index 3be974cd6..3b6285df5 100644 --- a/src/containers/Alerts/Customers/CustomerDeleteAlert.js +++ b/src/containers/Alerts/Customers/CustomerDeleteAlert.js @@ -1,17 +1,17 @@ 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 { AppToaster } from 'components'; import { transformErrors } from 'containers/Customers/utils'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertActions from 'containers/Alert/withAlertActions'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { useDeleteCustomer } from 'hooks/query'; import { compose } from 'utils'; - /** * Customer delete alert. */ @@ -24,12 +24,11 @@ function CustomerDeleteAlert({ // #withAlertActions closeAlert, + + // #withDrawerActions + closeDrawer, }) { - - const { - mutateAsync: deleteCustomerMutate, - isLoading - } = useDeleteCustomer(); + const { mutateAsync: deleteCustomerMutate, isLoading } = useDeleteCustomer(); // handle cancel delete alert. const handleCancelDeleteAlert = () => { @@ -44,10 +43,17 @@ function CustomerDeleteAlert({ message: intl.get('the_customer_has_been_deleted_successfully'), intent: Intent.SUCCESS, }); + closeDrawer('customer-details-drawer'); }) - .catch(({ response: { data: { errors } } }) => { - transformErrors(errors); - }) + .catch( + ({ + response: { + data: { errors }, + }, + }) => { + transformErrors(errors); + }, + ) .finally(() => { closeAlert(name); }); @@ -76,4 +82,5 @@ function CustomerDeleteAlert({ export default compose( withAlertStoreConnect(), withAlertActions, + withDrawerActions, )(CustomerDeleteAlert); diff --git a/src/containers/Alerts/Vendors/VendorDeleteAlert.js b/src/containers/Alerts/Vendors/VendorDeleteAlert.js index b087d8985..47d3512fc 100644 --- a/src/containers/Alerts/Vendors/VendorDeleteAlert.js +++ b/src/containers/Alerts/Vendors/VendorDeleteAlert.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 { AppToaster } from 'components'; @@ -9,6 +9,7 @@ import { useDeleteVendor } from 'hooks/query'; 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 VendorDeleteAlert({ // #withAlertActions closeAlert, + + // #withDrawerActions + closeDrawer, }) { - const { mutateAsync: deleteVendorMutate, isLoading } = useDeleteVendor(); // Handle cancel delete the vendor. @@ -41,6 +44,7 @@ function VendorDeleteAlert({ message: intl.get('the_vendor_has_been_deleted_successfully'), intent: Intent.SUCCESS, }); + closeDrawer('vendor-details-drawer'); }) .catch( ({ @@ -79,4 +83,5 @@ function VendorDeleteAlert({ export default compose( withAlertStoreConnect(), withAlertActions, + withDrawerActions, )(VendorDeleteAlert); diff --git a/src/containers/Drawers/CustomerDetailsDrawer/CustomerDetailsActionsBar.js b/src/containers/Drawers/CustomerDetailsDrawer/CustomerDetailsActionsBar.js index 42763b866..504d3f366 100644 --- a/src/containers/Drawers/CustomerDetailsDrawer/CustomerDetailsActionsBar.js +++ b/src/containers/Drawers/CustomerDetailsDrawer/CustomerDetailsActionsBar.js @@ -61,8 +61,8 @@ function CustomerDetailsActionsBar({ const handleDeleteCustomer = () => { openAlert(`customer-delete`, { contactId: customerId }); - closeDrawer('customer-details-drawer'); }; + const handleEditContact = () => { history.push(`/customers/${customerId}/edit`); closeDrawer('customer-details-drawer'); diff --git a/src/containers/Drawers/VendorDetailsDrawer/VendorDetailsActionsBar.js b/src/containers/Drawers/VendorDetailsDrawer/VendorDetailsActionsBar.js index 81b001faa..5ed4a1c28 100644 --- a/src/containers/Drawers/VendorDetailsDrawer/VendorDetailsActionsBar.js +++ b/src/containers/Drawers/VendorDetailsDrawer/VendorDetailsActionsBar.js @@ -46,7 +46,6 @@ function VendorDetailsActionsBar({ // Handle delete vendor. const onDeleteContact = () => { openAlert(`vendor-delete`, { contactId: vendorId }); - closeDrawer('vendor-details-drawer'); }; const handleNewInvoiceClick = () => { diff --git a/src/lang/ar/index.json b/src/lang/ar/index.json index 416b10b34..8200dba9c 100644 --- a/src/lang/ar/index.json +++ b/src/lang/ar/index.json @@ -1370,6 +1370,7 @@ "filter.value": "قيمة", "payment_made.empty_status.title": "المنشأة لم تدفع اي اموال إلي الموردين ، إلي حد الأن!.", "estimate.delete.error.estimate_converted_to_invoice":"لا يمكن حذف عملية عرض اسعار الذي تم تحويلها إلي فاتورة بيع.", + "landed_cost.action.delete.success_message": "The landed cost has been deleted successfully.", "items.option.only_active": "Only active", "items.option_all_items.hint": "جميع الاصناف ، بما في ذلك تلك الاصناف لديها رصيد صفر.", diff --git a/src/lang/en/index.json b/src/lang/en/index.json index 41980f8ee..59df7bcd2 100644 --- a/src/lang/en/index.json +++ b/src/lang/en/index.json @@ -1347,18 +1347,17 @@ "items.option_without_zero_balance.hint": "Include items and exclude that ones have zero-balance.", "items.option_with_transactions.hint": "Include items that onces have transactions on the given date period only.", "items.label_filter_items": "Filter items", - "customers.option_all_customers.hint":"All customers, including that ones have zero-balance.", + "customers.option_all_customers.hint": "All customers, including that ones have zero-balance.", "customers.label_filter_customers": "Filter customers", "customers.option_without_zero_balance": "Customers without zero-balance", - "customers.option_without_zero_balance.hint":"Include customers and exclude that ones have zero-balance.", + "customers.option_without_zero_balance.hint": "Include customers and exclude that ones have zero-balance.", "customers.option_with_transactions": "Customers with transactions", "customers.option_with_transactions.hint": "Include customers that onces have transactions on the given date period only.", - "vendors.option_all_vendors.hint":"All vendors, including that ones have zero-balance.", + "vendors.option_all_vendors.hint": "All vendors, including that ones have zero-balance.", "vendors.label_filter_vendors": "Filter Vendors", "vendors.option_without_zero_balance": "Vendors without zero-balance", - "vendors.option_without_zero_balance.hint":"Include vendors and exclude that ones have zero-balance.", + "vendors.option_without_zero_balance.hint": "Include vendors and exclude that ones have zero-balance.", "vendors.option_with_transactions": "Vendors with transactions", - "vendors.option_with_transactions.hint": "Include vendors that onces have transactions on the given date period only." - - + "vendors.option_with_transactions.hint": "Include vendors that onces have transactions on the given date period only.", + "landed_cost.action.delete.success_message": "The landed cost has been deleted successfully." } \ No newline at end of file