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)
.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}
>
<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>
);
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -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');

View File

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

View File

@@ -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": "جميع الاصناف ، بما في ذلك تلك الاصناف لديها رصيد صفر.",

View File

@@ -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."
}