u
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Component, PureComponent, createRef } from 'react';
|
||||
import { PureComponent, createRef } from 'react';
|
||||
import Box from '@mui/material/Box';
|
||||
import CircularProgress from '@mui/material/CircularProgress';
|
||||
import TextField from '@mui/material/TextField';
|
||||
@@ -320,6 +320,17 @@ class ArtikelKategorienPage extends PureComponent {
|
||||
if (path) this.props.navigate(path);
|
||||
};
|
||||
|
||||
handleDeleteCategory = async (cat) => {
|
||||
const name = cat.name || `Kategorie #${cat.id}`;
|
||||
if (!window.confirm(`Kategorie „${name}“ wirklich löschen?`)) return;
|
||||
try {
|
||||
await categoryAutomat.actions.deleteCategory(cat.id);
|
||||
enqueueSnackbar(`Kategorie „${name}“ gelöscht.`, { variant: 'success' });
|
||||
} catch (err) {
|
||||
notifyError(err);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
companyId,
|
||||
@@ -462,6 +473,7 @@ class ArtikelKategorienPage extends PureComponent {
|
||||
void categoryAutomat.actions.deleteCategoryImage(item.id)
|
||||
.catch(notifyError);
|
||||
},
|
||||
onDelete: () => this.handleDeleteCategory(item),
|
||||
nameInput: (
|
||||
<TextField
|
||||
value={draftName}
|
||||
|
||||
Reference in New Issue
Block a user