BIG-123: alert delete showing in vendor & customer.

This commit is contained in:
elforjani13
2021-09-25 17:11:08 +02:00
parent 4e99607b06
commit 010b660318
7 changed files with 38 additions and 23 deletions

View File

@@ -35,7 +35,7 @@ function BillTransactionDeleteAlert({
deleteLandedCostMutate(BillId) deleteLandedCostMutate(BillId)
.then(() => { .then(() => {
AppToaster.show({ AppToaster.show({
message: intl.get('bill.action.delete_successfully.landed_cost'), message: intl.get('landed_cost.action.delete.success_message'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeAlert(name); closeAlert(name);
@@ -56,7 +56,11 @@ function BillTransactionDeleteAlert({
onConfirm={handleConfirmLandedCostDelete} onConfirm={handleConfirmLandedCostDelete}
loading={isLoading} loading={isLoading}
> >
<p><T id={`Once your delete this located landed cost, you won't be able to restore it later, Are your sure you want to delete this transaction?`}/></p> <p>
<T
id={`Once your delete this located landed cost, you won't be able to restore it later, Are your sure you want to delete this transaction?`}
/>
</p>
</Alert> </Alert>
); );
} }

View File

@@ -1,17 +1,17 @@
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 { AppToaster } from 'components'; import { AppToaster } from 'components';
import { transformErrors } from 'containers/Customers/utils'; import { transformErrors } from 'containers/Customers/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 { useDeleteCustomer } from 'hooks/query'; import { useDeleteCustomer } from 'hooks/query';
import { compose } from 'utils'; import { compose } from 'utils';
/** /**
* Customer delete alert. * Customer delete alert.
*/ */
@@ -24,12 +24,11 @@ function CustomerDeleteAlert({
// #withAlertActions // #withAlertActions
closeAlert, closeAlert,
// #withDrawerActions
closeDrawer,
}) { }) {
const { mutateAsync: deleteCustomerMutate, isLoading } = useDeleteCustomer();
const {
mutateAsync: deleteCustomerMutate,
isLoading
} = useDeleteCustomer();
// handle cancel delete alert. // handle cancel delete alert.
const handleCancelDeleteAlert = () => { const handleCancelDeleteAlert = () => {
@@ -44,10 +43,17 @@ function CustomerDeleteAlert({
message: intl.get('the_customer_has_been_deleted_successfully'), message: intl.get('the_customer_has_been_deleted_successfully'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('customer-details-drawer');
}) })
.catch(({ response: { data: { errors } } }) => { .catch(
transformErrors(errors); ({
}) response: {
data: { errors },
},
}) => {
transformErrors(errors);
},
)
.finally(() => { .finally(() => {
closeAlert(name); closeAlert(name);
}); });
@@ -76,4 +82,5 @@ function CustomerDeleteAlert({
export default compose( export default compose(
withAlertStoreConnect(), withAlertStoreConnect(),
withAlertActions, withAlertActions,
withDrawerActions,
)(CustomerDeleteAlert); )(CustomerDeleteAlert);

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 { AppToaster } from 'components'; import { AppToaster } from 'components';
@@ -9,6 +9,7 @@ import { useDeleteVendor } 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 withDrawerActions from 'containers/Drawer/withDrawerActions';
import { compose } from 'utils'; import { compose } from 'utils';
@@ -24,8 +25,10 @@ function VendorDeleteAlert({
// #withAlertActions // #withAlertActions
closeAlert, closeAlert,
// #withDrawerActions
closeDrawer,
}) { }) {
const { mutateAsync: deleteVendorMutate, isLoading } = useDeleteVendor(); const { mutateAsync: deleteVendorMutate, isLoading } = useDeleteVendor();
// Handle cancel delete the vendor. // Handle cancel delete the vendor.
@@ -41,6 +44,7 @@ function VendorDeleteAlert({
message: intl.get('the_vendor_has_been_deleted_successfully'), message: intl.get('the_vendor_has_been_deleted_successfully'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('vendor-details-drawer');
}) })
.catch( .catch(
({ ({
@@ -79,4 +83,5 @@ function VendorDeleteAlert({
export default compose( export default compose(
withAlertStoreConnect(), withAlertStoreConnect(),
withAlertActions, withAlertActions,
withDrawerActions,
)(VendorDeleteAlert); )(VendorDeleteAlert);

View File

@@ -61,8 +61,8 @@ function CustomerDetailsActionsBar({
const handleDeleteCustomer = () => { const handleDeleteCustomer = () => {
openAlert(`customer-delete`, { contactId: customerId }); openAlert(`customer-delete`, { contactId: customerId });
closeDrawer('customer-details-drawer');
}; };
const handleEditContact = () => { const handleEditContact = () => {
history.push(`/customers/${customerId}/edit`); history.push(`/customers/${customerId}/edit`);
closeDrawer('customer-details-drawer'); closeDrawer('customer-details-drawer');

View File

@@ -46,7 +46,6 @@ function VendorDetailsActionsBar({
// Handle delete vendor. // Handle delete vendor.
const onDeleteContact = () => { const onDeleteContact = () => {
openAlert(`vendor-delete`, { contactId: vendorId }); openAlert(`vendor-delete`, { contactId: vendorId });
closeDrawer('vendor-details-drawer');
}; };
const handleNewInvoiceClick = () => { const handleNewInvoiceClick = () => {

View File

@@ -1370,6 +1370,7 @@
"filter.value": "قيمة", "filter.value": "قيمة",
"payment_made.empty_status.title": "المنشأة لم تدفع اي اموال إلي الموردين ، إلي حد الأن!.", "payment_made.empty_status.title": "المنشأة لم تدفع اي اموال إلي الموردين ، إلي حد الأن!.",
"estimate.delete.error.estimate_converted_to_invoice":"لا يمكن حذف عملية عرض اسعار الذي تم تحويلها إلي فاتورة بيع.", "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.only_active": "Only active",
"items.option_all_items.hint": "جميع الاصناف ، بما في ذلك تلك الاصناف لديها رصيد صفر.", "items.option_all_items.hint": "جميع الاصناف ، بما في ذلك تلك الاصناف لديها رصيد صفر.",

View File

@@ -1347,18 +1347,17 @@
"items.option_without_zero_balance.hint": "Include items and exclude that ones have zero-balance.", "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.option_with_transactions.hint": "Include items that onces have transactions on the given date period only.",
"items.label_filter_items": "Filter items", "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.label_filter_customers": "Filter customers",
"customers.option_without_zero_balance": "Customers without zero-balance", "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": "Customers with transactions",
"customers.option_with_transactions.hint": "Include customers that onces have transactions on the given date period only.", "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.label_filter_vendors": "Filter Vendors",
"vendors.option_without_zero_balance": "Vendors without zero-balance", "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": "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."
} }