This commit is contained in:
seb
2026-09-19 18:33:27 +02:00
parent d3b4743b66
commit 4011ebfc61
13 changed files with 290 additions and 24 deletions

View File

@@ -29,6 +29,7 @@ import {
import { preserveSearchFocus } from './searchFocus';
import { artikelDetailPath } from './articleRoute';
import withSearchParams from './withSearchParams';
import { setLastArticleSku } from '../../automats';
const resultRowSx = {
alignItems: 'center',
@@ -171,6 +172,7 @@ class ArtikelSearchPage extends Component {
componentDidMount() {
document.addEventListener('mousedown', preserveSearchFocus, true);
window.addEventListener('resize', this.handleWindowResize);
setLastArticleSku(null);
// Kick off initial search (empty input = show all products).
const { input } = this.state;

View File

@@ -53,6 +53,7 @@ import {
enableTerminalCategory,
disableTerminalCategory,
} from '../../store/posterminalSlice';
import { setLastArticleSku } from '../../automats';
const gridSx = {
display: 'grid',
@@ -72,6 +73,7 @@ class ArtikelKategorienPage extends Component {
}
componentDidMount() {
setLastArticleSku(null);
this.ensureTreeLoaded();
this.ensurePosterminalsLoaded();
this.syncCategoryFromUrl();

View File

@@ -1,6 +1,12 @@
import { useEffect } from 'react';
import Typography from '@mui/material/Typography';
import { setLastArticleSku } from '../../automats';
export default function ArtikelLagerPage() {
useEffect(() => {
setLastArticleSku(null);
}, []);
return (
<Typography color="text.secondary">Lager — Inhalt folgt.</Typography>
);

View File

@@ -2,6 +2,7 @@ import { Component } from 'react';
import { StorageManagerContext } from '../../api/storageManagerContext';
import { ArticleView } from '../../components/article';
import withSkuRoute from './withSkuRoute';
import { setLastArticleSku } from '../../automats';
class ArtikelSkuPage extends Component {
static contextType = StorageManagerContext;
@@ -17,11 +18,13 @@ class ArtikelSkuPage extends Component {
componentDidMount() {
this.installEscape();
setLastArticleSku(this.props.sku);
if (!this.state.ready) void this.ensureArticle();
}
componentDidUpdate(prevProps) {
if (prevProps.sku !== this.props.sku) {
setLastArticleSku(this.props.sku);
const ready =
this.context.getArticle(this.props.sku) != null &&
this.context.getCategoryState() != null;

View File

@@ -1,7 +1,12 @@
import { PureComponent } from 'react';
import { ManifestList } from '../../components/manifest';
import { setLastDeliveryPath } from '../../automats';
class LieferungListePage extends PureComponent {
componentDidMount() {
setLastDeliveryPath(null);
}
render() {
return <ManifestList kind="delivery" />;
}

View File

@@ -17,6 +17,7 @@ import { StorageManagerContext } from '../../api/storageManagerContext';
import { requireDefined, requireObject } from '../../utils/apiShape';
import { backendErrorFrom } from '../../utils/backendError';
import { notifyError } from '../../utils/notify';
import { setLastDeliveryPath } from '../../automats';
function sortSuppliers(suppliers) {
return [...suppliers].sort((a, b) =>
@@ -48,6 +49,7 @@ class LieferungLieferantenPage extends PureComponent {
}
componentDidMount() {
setLastDeliveryPath(null);
this._cancelled = false;
void this.loadSuppliers();
}

View File

@@ -30,6 +30,7 @@ import { notifyError } from '../../utils/notify';
import { generatePdfThumbnail } from '../../utils/pdfThumbnail';
import { extractPdfText } from '../../utils/pdfText';
import { getDeliveryEditorAutomat } from '../../automats/deliveryEditorAutomat';
import { setLastDeliveryPath } from '../../automats';
import { delivery as deliveryApi } from '../../api';
class LieferungNeuPage extends PureComponent {
@@ -85,8 +86,10 @@ class LieferungNeuPage extends PureComponent {
this.unsubscribe = this.automat.subscribe(this);
this._cancelled = false;
if (this.props.docId != null) {
setLastDeliveryPath(`/lieferung/${this.props.docId}`);
void this.loadEdit();
} else {
setLastDeliveryPath('/lieferung/neu');
void this.loadPartiesOnly();
if (this.props.initialDelivery) {
this.automat.actions.setDelivery(this.props.initialDelivery);