Skip to content

Commit

Permalink
Merge pull request #110 from lklong709/PIM-80
Browse files Browse the repository at this point in the history
fixes #19 - Bulk action - Missing message notification when user use bulk action but not choose item
  • Loading branch information
lunguyenhat authored Jan 16, 2023
2 parents 0231def + 5677fa1 commit bad0b8c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
9 changes: 7 additions & 2 deletions src/containers/CategoriesPage/Component/ListCategories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Table from 'components/Table';
import Spinner from 'components/Spinner';
import SelectComponent from 'components/Select';
import history from 'routes/history';
import { notify } from 'components/Toast';

const ListCategories = observer((props) => {
const { t } = props;
Expand Down Expand Up @@ -213,8 +214,12 @@ const ListCategories = observer((props) => {
};

const deleteCategories = () => {
viewModel.isLoading();
viewModel.deleteCategories(listSelected);
if (listSelected.length < 1) {
notify(t('txt_row_select_error'), 'error');
} else {
viewModel.isLoading();
viewModel.deleteCategories(listSelected);
}
};

const selectCategoryHandler = (value) => {
Expand Down
9 changes: 7 additions & 2 deletions src/containers/FieldsPage/Component/ListFields.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Spinner from 'components/Spinner';
import history from 'routes/history';
import { Tab, Tabs } from 'react-bootstrap';
import SelectComponent from 'components/Select';
import { notify } from 'components/Toast';

const ListFields = observer((props) => {
const { t } = props;
Expand Down Expand Up @@ -124,8 +125,12 @@ const ListFields = observer((props) => {
};

const deleteFields = () => {
viewModel.isLoading();
viewModel.deleteFields(listSelected);
if (listSelected.length < 1) {
notify(t('txt_row_select_error'), 'error');
} else {
viewModel.isLoading();
viewModel.deleteFields(listSelected);
}
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Table from 'components/Table';
import '../index.scss';
import ActionsBar from 'components/ActionsBar';
import history from 'routes/history';
import { notify } from 'components/Toast';

const ListProductPrice = observer((props) => {
const { t } = props;
Expand Down Expand Up @@ -57,8 +58,12 @@ const ListProductPrice = observer((props) => {
};

const deleteProductPrices = () => {
viewModel.isLoading();
viewModel.deleteProductPrices(listSelected);
if (listSelected.length < 1) {
notify(t('txt_row_select_error'), 'error');
} else {
viewModel.isLoading();
viewModel.deleteProductPrices(listSelected);
}
};

const columnsTable = [
Expand Down
8 changes: 6 additions & 2 deletions src/containers/ProductsPage/Component/ListProducts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,12 @@ const ListProducts = observer((props) => {
};

const deleteProducts = () => {
viewModel.isLoading();
viewModel.deleteProducts(listSelected);
if (listSelected.length < 1) {
notify(t('txt_row_select_error'), 'error');
} else {
viewModel.isLoading();
viewModel.deleteProducts(listSelected);
}
};

return (
Expand Down

0 comments on commit bad0b8c

Please sign in to comment.