Commit 2e97e2ae authored by Oleksii Savran's avatar Oleksii Savran Committed by Matija Obreza

Added confirm for removing

parent efa21700
......@@ -309,7 +309,8 @@
"title": "List of inventory maintenance policy"
},
"details": {
"title": "Inventory maintenance policy"
"title": "Inventory maintenance policy",
"delete": "Do you really want to delete {{name}} maintenance policy?"
},
"edit": {
"title": "New inventory maintenance policy"
......@@ -598,10 +599,12 @@
"title": "New site location"
},
"browse": {
"title": "List of sites"
"title": "List of sites",
"delete": "Do you really want to delete {{count}} sites?"
},
"details": {
"title": "Site"
"title": "Site",
"delete": "Do you really want to delete {{name}} site?"
},
"edit": {
"title": "New site"
......
......@@ -5,7 +5,8 @@
"title": "List of inventory maintenance policy"
},
"details": {
"title": "Inventory maintenance policy"
"title": "Inventory maintenance policy",
"delete": "Do you really want to delete {{name}} maintenance policy?"
},
"edit": {
"title": "New inventory maintenance policy"
......
......@@ -20,6 +20,7 @@ import PageTitle from '@gringlobal/client/ui/common/PageTitle';
import { YesNoToBoolean } from '@gringlobal/client/utilities';
import Number from '@gringlobal/client/ui/common/Number';
import AuditDataDisplay from 'common/AuditDataDisplay';
import confirm from '@gringlobal/client/utilities/confirmAlert';
interface IInventoryPolicyDetailsPage extends React.ClassAttributes<any>, WithTranslation {
......@@ -57,8 +58,14 @@ class InventoryPolicyDetailsPage extends React.Component<IInventoryPolicyDetails
};
public handleRemove = () => {
const { removeInventoryPolicyAction, id } = this.props;
removeInventoryPolicyAction(+id);
const { removeInventoryPolicyAction, id, inventoryPolicyCall, t } = this.props;
confirm(t('inventorypolicy.admin.p.details.delete', { name: inventoryPolicyCall.data.maintenanceName }), {
confirmLabel: t('common:label.yes'),
abortLabel: t('common:label.no'),
}).then(() => {
removeInventoryPolicyAction(+id);
});
};
public render() {
......
......@@ -8,10 +8,12 @@
"title": "New site location"
},
"browse": {
"title": "List of sites"
"title": "List of sites",
"delete": "Do you really want to delete {{count}} sites?"
},
"details": {
"title": "Site"
"title": "Site",
"delete": "Do you really want to delete {{name}} site?"
},
"edit": {
"title": "New site"
......
......@@ -21,6 +21,7 @@ import Button from '@material-ui/core/Button/Button';
import { CodeValueDisplay } from 'common/CodeValue';
import Filters from './c/Filters';
import PageTitle from '@gringlobal/client/ui/common/PageTitle';
import confirm from '@gringlobal/client/utilities/confirmAlert';
interface IBrowsePageProps extends React.ClassAttributes<any>, WithTranslation, WithBrowsePageBase {
onSortChange: (sortBy: string, dir: SortDirection) => void;
......@@ -76,7 +77,14 @@ class BrowsePage extends React.Component<IBrowsePageProps> {
};
private remove = () => {
this.props.removeSitesAction(this.state.selected);
const { t, removeSitesAction } = this.props;
confirm(t('site.admin.p.browse.delete', { count: this.state.selected.length }), {
confirmLabel: t('common:label.yes'),
abortLabel: t('common:label.no'),
}).then(() => {
removeSitesAction(this.state.selected)
});
};
private rowToggled = (toggledRow: number, selectedRows: number[], rowData: Site) => {
......
......@@ -17,6 +17,7 @@ import Permissions from '@gringlobal/client/ui/common/permission/Permissions';
import { CodeValueDisplay } from 'common/CodeValue';
import PageTitle from '@gringlobal/client/ui/common/PageTitle';
import AuditDataDisplay from 'common/AuditDataDisplay';
import confirm from '@gringlobal/client/utilities/confirmAlert';
interface ISiteDetailsPage extends React.ClassAttributes<any>, WithTranslation {
......@@ -54,8 +55,14 @@ class SiteDetailsPage extends React.Component<ISiteDetailsPage> {
};
public handleRemove = () => {
const { removeSiteAction, id } = this.props;
removeSiteAction(+id);
const { removeSiteAction, id, t, siteCall } = this.props;
confirm(t('site.admin.p.details.delete', { name: siteCall.data.siteLongName }), {
confirmLabel: t('common:label.yes'),
abortLabel: t('common:label.no'),
}).then(() => {
removeSiteAction(+id);
});
};
public render() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment