This commit is contained in:
seb
2026-10-02 08:24:42 +02:00
parent 20e53fee04
commit be111e8f7c
4 changed files with 71 additions and 18 deletions

View File

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