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

@@ -35,10 +35,8 @@ import AutoAwesomeIcon from '@mui/icons-material/AutoAwesome';
import RequestQuoteIcon from '@mui/icons-material/RequestQuote';
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import BackendError from './BackendError';
import { company, number as numberApi } from '../api';
import { company } from '../api';
import authAutomat, { bootstrapAuthMe } from '../automats/authAutomat';
import companyAutomat from '../automats/companyAutomat';
import numberAutomat from '../automats/numberAutomat';
import {
defaultIso639,
ISO639_OPTIONS,
@@ -213,30 +211,10 @@ class CompanySetupDialog extends Component {
iso639,
taxrate: parsedTaxrate,
reducedtaxrate: parsedReducedtaxrate,
numbers,
});
// Apply initial number sequences if set
if (numbers) {
try {
const listRes = await numberApi.list();
const serverNumbers = listRes?.numbers ?? [];
for (const serverRow of serverNumbers) {
const userConfig = numbers[serverRow.type];
if (userConfig) {
const prefix = String(userConfig.prefix ?? '');
const padding = Math.max(0, Number(userConfig.padding) || 0);
const next = Math.max(1, Number(userConfig.next) || 1);
await numberApi.update(serverRow.id, { prefix, padding, next });
}
}
} catch (numErr) {
console.warn('Initial number sequences could not be saved:', numErr);
}
}
await bootstrapAuthMe();
await companyAutomat.actions.load();
await numberAutomat.actions.reload().catch(() => { });
} catch (err) {
this.setState({ error: backendErrorFrom(err) });
} finally {