Skip to content

Commit

Permalink
Merge pull request #117 from lklong709/PIM-19
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 17, 2023
2 parents 97fc458 + aef1539 commit 0644e71
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 10 deletions.
8 changes: 6 additions & 2 deletions src/containers/CategoriesPage/Component/ListCategories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,12 @@ const ListCategories = observer((props) => {
}, []);

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

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

const ListDebtorGroup = observer((props) => {
const { t } = props;
Expand Down Expand Up @@ -98,8 +99,12 @@ const ListDebtorGroup = observer((props) => {
];

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

const currentSelectHandler = (arr) => {
Expand Down
9 changes: 7 additions & 2 deletions src/containers/FieldsGroupPage/Component/ListFieldsGroup.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 ListFieldsGroup = observer((props) => {
const { t } = props;
Expand Down Expand Up @@ -73,8 +74,12 @@ const ListFieldsGroup = observer((props) => {
];

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

const currentSelectHandler = (arr) => {
Expand Down
8 changes: 6 additions & 2 deletions src/containers/FieldsPage/Component/ListFields.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,12 @@ const ListFields = observer((props) => {
};

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

const currentSelectHandler = (arr) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ const ListProductPrice = observer((props) => {
};

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

const deleteProductPrices = () => {
Expand Down

0 comments on commit 0644e71

Please sign in to comment.