This commit is contained in:
seb
2026-08-03 07:13:42 +02:00
parent 4db4948090
commit f302eb9e67
9 changed files with 985 additions and 51 deletions

View File

@@ -21,6 +21,7 @@ import {
import withCategoryRoute from './withCategoryRoute';
import { artikelDetailPath, articleSku } from './articleRoute';
import { selectCompanyId } from '../../store/companySlice';
import { selectHasPosterminals, selectPosterminals } from '../../store/posterminalSlice';
import {
buildCategoryPath,
defaultCategoryPath,
@@ -36,6 +37,7 @@ import {
navigateToCategory,
renameCategory,
reorderCategories,
toggleCategoryPos,
selectCanNavigateBack,
selectCategoryArticles,
selectCategoryArticlesStatus,
@@ -46,6 +48,10 @@ import {
selectChildCategories,
selectRenameMode,
} from '../../store/categorySlice';
import {
enableTerminalCategory,
disableTerminalCategory,
} from '../../store/posterminalSlice';
const gridSx = {
display: 'grid',
@@ -266,6 +272,8 @@ class ArtikelKategorienPage extends Component {
childCategories,
articles,
renameMode,
hasTerminals,
terminals,
} = this.props;
if (!companyId) {
@@ -340,6 +348,19 @@ class ArtikelKategorienPage extends Component {
data-id={String(item.id)}
className="sortable-item"
label={draftName}
terminals={terminals}
categoryPosterminalIds={item.posterminalIds || []}
onTerminalToggle={(terminalId, enabled) => {
const thunk = enabled
? this.props.enableTerminalCategory
: this.props.disableTerminalCategory;
void thunk({ terminalId, categoryId: item.id })
.unwrap()
.then(() => this.props.loadCategoryTree())
.catch(notifyError);
}}
onOpen={() => this.navigateToCategoryById(item.id)}
hasTerminals={hasTerminals}
nameInput={
<TextField
value={draftName}
@@ -396,7 +417,7 @@ class ArtikelKategorienPage extends Component {
/>
))}
<NewCategoryTile parentId={currentCategoryId} />
{renameMode && <NewCategoryTile parentId={currentCategoryId} />}
{!renameMode && (
<NewArticleTile
parentId={currentCategoryId}
@@ -428,6 +449,8 @@ const mapStateToProps = (state) => ({
articles: selectCategoryArticles(state),
canGoBack: selectCanNavigateBack(state),
renameMode: selectRenameMode(state),
hasTerminals: selectHasPosterminals(state),
terminals: selectPosterminals(state),
});
const mapDispatchToProps = {
@@ -438,6 +461,9 @@ const mapDispatchToProps = {
deleteCategory,
moveCategory,
reorderCategories,
toggleCategoryPos,
enableTerminalCategory,
disableTerminalCategory,
};
export default withCategoryRoute(connect(mapStateToProps, mapDispatchToProps)(ArtikelKategorienPage));