This commit is contained in:
seb
2026-10-28 00:08:45 +01:00
parent fab291f68e
commit 96d0ae6742
88 changed files with 3871 additions and 5334 deletions

View File

@@ -12,14 +12,14 @@ import { PanelTile, PanelTileGrid } from 'dashgui/panels';
import withNavigate from '../../components/withNavigate';
import { backendErrorFrom } from '../../utils/backendError';
import { notifyError } from '../../utils/notify';
import carrierAutomat from '../../automats/carrierAutomat';
import companyAutomat from '../../automats/companyAutomat';
import { CarrierItem } from '../../components/carrier';
import { GREEN_PANEL } from '../../colors';
class VersandartenSearchField extends PureComponent {
constructor(props) {
super(props);
const initial = carrierAutomat.state.filter || '';
const initial = companyAutomat.state.carrierFilter || '';
this.state = {
input: initial,
submitting: false,
@@ -28,8 +28,8 @@ class VersandartenSearchField extends PureComponent {
}
componentDidMount() {
this.unsub = carrierAutomat.subscribe(this, (state) => ({
input: state.filter,
this.unsub = companyAutomat.subscribe(this, (state) => ({
input: state.carrierFilter,
}));
}
@@ -39,7 +39,7 @@ class VersandartenSearchField extends PureComponent {
onInputChange(input) {
this.setState({ input });
carrierAutomat.actions.filter(input);
companyAutomat.actions.filterCarriers(input);
}
async handleSubmit() {
@@ -48,14 +48,14 @@ class VersandartenSearchField extends PureComponent {
this.setState({ submitting: true });
try {
const row = await carrierAutomat.actions.create({
const row = await companyAutomat.actions.createCarrier({
name,
hasPackages: true,
isReverse: false,
});
enqueueSnackbar(`Versandart „${row.name || name}“ angelegt.`, { variant: 'success' });
this.setState({ input: '', submitting: false });
carrierAutomat.actions.filter('');
companyAutomat.actions.filterCarriers('');
} catch (err) {
this.setState({ submitting: false });
notifyError(err);
@@ -118,12 +118,12 @@ class AuftragVersandartenPage extends PureComponent {
constructor(props) {
super(props);
const initialCarriers =
carrierAutomat.state.filteredCarriers ?? carrierAutomat.state.carriers ?? [];
companyAutomat.state.filteredCarriers ?? companyAutomat.state.carriers ?? [];
this.state = {
status: carrierAutomat.state.status === 'ready' ? 'ready' : 'loading',
error: carrierAutomat.state.error ? backendErrorFrom(carrierAutomat.state.error) : null,
status: companyAutomat.state.carriersStatus === 'ready' ? 'ready' : 'loading',
error: companyAutomat.state.carriersError ? backendErrorFrom(companyAutomat.state.carriersError) : null,
carriers: initialCarriers,
filter: carrierAutomat.state.filter ?? '',
filter: companyAutomat.state.carrierFilter ?? '',
};
this.searchRef = createRef();
this.listRef = createRef();
@@ -137,15 +137,15 @@ class AuftragVersandartenPage extends PureComponent {
componentDidMount() {
this._cancelled = false;
this.unsub = carrierAutomat.subscribe(this, (state) => ({
this.unsub = companyAutomat.subscribe(this, (state) => ({
carriers: state.filteredCarriers ?? state.carriers,
filter: state.filter ?? '',
status: state.status,
error: state.error ? backendErrorFrom(state.error) : null,
filter: state.carrierFilter ?? '',
status: state.carriersStatus,
error: state.carriersError ? backendErrorFrom(state.carriersError) : null,
}));
if (carrierAutomat.state.status !== 'ready') {
void carrierAutomat.actions.load().catch((err) => notifyError(err));
if (companyAutomat.state.carriersStatus !== 'ready') {
void companyAutomat.actions.loadCarriers().catch((err) => notifyError(err));
} else {
this._initSortable();
}
@@ -209,16 +209,16 @@ class AuftragVersandartenPage extends PureComponent {
async _persistOrder(carrierIds) {
try {
await carrierAutomat.actions.reorder(carrierIds);
await companyAutomat.actions.reorderCarriers(carrierIds);
} catch (err) {
if (this._cancelled) return;
notifyError(err);
void carrierAutomat.actions.reload();
void companyAutomat.actions.reloadCarriers();
}
}
handleRetry() {
void carrierAutomat.actions.load().catch((err) => notifyError(err));
void companyAutomat.actions.loadCarriers().catch((err) => notifyError(err));
}
render() {