supplierAutomat

This commit is contained in:
seb
2026-09-21 10:55:17 +02:00
parent 98080f0514
commit 2046f96768
9 changed files with 222 additions and 34 deletions

View File

@@ -23,6 +23,7 @@ import { enqueueSnackbar } from 'notistack';
import { StorageManagerContext } from '../../../api/storageManagerContext';
import { notifyError } from '../../../utils/notify';
import { formatPrice } from '../../../utils/price';
import supplierAutomat from '../../../automats/supplierAutomat';
import ArticleSupplierDialog from '../ArticleSupplierDialog';
export default class ArticleSupplierTab extends PureComponent {
@@ -80,7 +81,7 @@ export default class ArticleSupplierTab extends PureComponent {
// 2. Fetch available company suppliers and company metadata
try {
const [companySuppliers, company] = await Promise.all([
this.context.suppliers ?? this.context.supplierPromise,
supplierAutomat.actions.load(),
this.context.company ?? this.context.companyPromise,
]);
this.setState({

View File

@@ -346,13 +346,13 @@ class ManifestFormLine extends PureComponent {
</TableRow>
{/* Row 2: Matched Supplier Article Details */}
<TableRow sx={{ '& > td': { pt: 0, pb: 0.75, borderBottom: '1px solid', borderColor: 'divider' } }}>
<TableRow sx={{ '& > td': { pt: 0, pb: 0.75, borderBottom: 'none' } }}>
<TableCell
colSpan={columns.length + 1}
sx={{
py: 0.4,
px: 2,
bgcolor: 'rgba(248, 250, 252, 0.75)',
bgcolor: 'transparent',
}}
>
{this.renderSecondLine()}

View File

@@ -41,7 +41,7 @@ class ManifestLines extends PureComponent {
<TableContainer>
<Table size="small" stickyHeader>
<TableHead>
<TableRow>
<TableRow sx={{ '& th': { borderBottom: 'none', fontWeight: 700 } }}>
{columns.map((col) => (
<TableCell
key={col.id}
@@ -50,12 +50,13 @@ class ManifestLines extends PureComponent {
width: col.width,
whiteSpace: 'nowrap',
bgcolor: linesColor,
fontWeight: 700,
}}
>
{col.label}
</TableCell>
))}
<TableCell padding="checkbox" sx={{ bgcolor: linesColor }} />
<TableCell padding="checkbox" sx={{ bgcolor: linesColor, borderBottom: 'none' }} />
</TableRow>
</TableHead>
<TableBody>

View File

@@ -1,3 +1,5 @@
import supplierAutomat from '../../automats/supplierAutomat';
/** Groups that are not sales customers (filter client-side). */
export const EXCLUDED_CUSTOMER_GROUP_NAMES = new Set(['Lieferanten', 'POS']);
@@ -424,7 +426,10 @@ export const DELIVERY_LINE_COLUMNS = [
*/
export async function loadParties(kind, ctx) {
if (kind === 'delivery') {
const list = ctx.suppliers ?? (await ctx.supplierPromise);
if (supplierAutomat.state.status === 'ready') {
return sortSuppliers(supplierAutomat.state.suppliers);
}
const list = await supplierAutomat.actions.load();
return sortSuppliers(list);
}
const [entities, groups] = await Promise.all([