This commit is contained in:
seb
2026-10-05 17:57:33 +02:00
parent f627ff5b5a
commit 0a1002227c
9 changed files with 548 additions and 69 deletions

View File

@@ -1,3 +1,4 @@
// #region Imports
import { Component, createRef } from 'react';
import FillSpace from 'dashgui/FillSpace';
import Box from '@mui/material/Box';
@@ -47,7 +48,9 @@ import {
categoryAutomat,
} from '../automats';
import { BrandLabel } from '../components/brand';
// #endregion
// #region Styles & Measure Sample
const resultRowSx = {
alignItems: 'center',
minHeight: 64,
@@ -106,7 +109,9 @@ function ResultRowMeasureSample() {
</ListItemButton>
);
}
// #endregion
// #region Helpers
function initialSearchState(searchParams) {
const query = queryFromParams(searchParams);
const stored = readArtikelQuery();
@@ -155,14 +160,22 @@ function getCategoryTreeOrder(categoriesMap, rootCategoryId) {
return order;
}
// #endregion
// #region ArtikelSearchPage
class ArtikelSearchPage extends Component {
state = initialSearchState(this.props.searchParams);
paginationRef = createRef();
filterHeaderRef = createRef();
fillSpaceRef = createRef();
categoryFillSpaceRef = createRef();
// #region Constructor & State
constructor(props) {
super(props);
this.state = initialSearchState(props.searchParams);
this.paginationRef = createRef();
this.filterHeaderRef = createRef();
this.fillSpaceRef = createRef();
this.categoryFillSpaceRef = createRef();
}
// #endregion
// #region Measurement & Query Persistence
toggleCategoryFilter = () => {
this.setState((prev) => ({ categoryFilterOpen: !prev.categoryFilterOpen }));
};
@@ -190,7 +203,9 @@ class ArtikelSearchPage extends Component {
offset: query.offset,
});
};
// #endregion
// #region Lifecycle
componentDidMount() {
document.addEventListener('mouseup', preserveSearchFocus, true);
setLastArticleSku(null);
@@ -263,7 +278,9 @@ class ArtikelSearchPage extends Component {
this.fetchResults();
}
}
// #endregion
// #region Search & Navigation Handlers
updateParams = (nextTarget, nextFilter, nextOffset = 0) => {
writeArtikelQuery({
target: nextTarget,
@@ -329,7 +346,9 @@ class ArtikelSearchPage extends Component {
const filterParam = this.props.searchParams.get('filter') ?? '';
this.updateParams(this.state.input, filterParam, nextOffset);
};
// #endregion
// #region Render
render() {
const {
input,
@@ -635,6 +654,9 @@ class ArtikelSearchPage extends Component {
</>
);
}
// #endregion
}
// #endregion
export default withSearchParams(ArtikelSearchPage);

View File

@@ -1321,6 +1321,7 @@ class LieferungNeuPage extends PureComponent {
</PanelTile>
)}
<ManifestLines
kind="delivery"
columns={DELIVERY_LINE_COLUMNS}
lines={lines}
saving={saving}
@@ -1379,6 +1380,7 @@ class LieferungNeuPage extends PureComponent {
<ArticleSearchDialog
open={this.state.articleSearchDialogOpen}
line={this.state.articleSearchLine}
kind="delivery"
onClose={this.handleCloseArticleSearch}
onAssign={this.handleAssignArticleForLine}
/>