u
This commit is contained in:
@@ -40,17 +40,20 @@ import orderAutomat, {
|
||||
} from '../automats/orderAutomat';
|
||||
import quoteAutomat from '../automats/quoteAutomat';
|
||||
import shipmentAutomat from '../automats/shipmentAutomat';
|
||||
import deliveryAutomat from '../automats/deliveryAutomat';
|
||||
import { formatPrice } from '../utils/price';
|
||||
|
||||
function getAutomatFor(target) {
|
||||
if (target === 'quote') return quoteAutomat;
|
||||
if (target === 'shipment') return shipmentAutomat;
|
||||
if (target === 'delivery') return deliveryAutomat;
|
||||
return orderAutomat;
|
||||
}
|
||||
|
||||
function getInitialTarget() {
|
||||
if (typeof window !== 'undefined') {
|
||||
const p = window.location.pathname;
|
||||
if (p.startsWith('/lieferung')) return 'delivery';
|
||||
if (p.startsWith('/auftrag/ausliefern')) return 'shipment';
|
||||
if (p.startsWith('/auftrag/bestellung')) return 'order';
|
||||
if (p.startsWith('/auftrag')) return 'quote';
|
||||
@@ -296,6 +299,10 @@ class ChunkCacheMonitor extends PureComponent {
|
||||
if (p.onlyUnpaid) automat.actions.setOnlyUnpaid(true);
|
||||
if (p.onlyUndelivered) automat.actions.setOnlyUndelivered(true);
|
||||
}
|
||||
if (this.state.target === 'delivery') {
|
||||
if (p.onlyUnbooked) automat.actions.setOnlyUnbooked(true);
|
||||
if (p.supplierId) automat.actions.setSupplierId(p.supplierId);
|
||||
}
|
||||
if (this.state.target === 'shipment') {
|
||||
if (p.stateFilter) automat.actions.setStateFilter(p.stateFilter);
|
||||
}
|
||||
@@ -723,11 +730,15 @@ class ChunkCacheMonitor extends PureComponent {
|
||||
{chunkOrders.map(({ item: order, index }) => {
|
||||
const isOrd = this.state.target === 'order';
|
||||
const isShip = this.state.target === 'shipment';
|
||||
const isDeliv = this.state.target === 'delivery';
|
||||
const paid = isOrd ? isOrderPaid(order) : false;
|
||||
const delivered = isOrd ? isOrderDelivered(order) : false;
|
||||
const gross = order.grossTotal != null ? Number(order.grossTotal) : (order.lines ? orderGrossTotal(order.lines) : 0);
|
||||
const customer = order.customerName || (order.entityId ? `Kunde #${order.entityId}` : '–');
|
||||
const customer = isDeliv
|
||||
? (order.supplierName || (order.supplierId ? `Lieferant #${order.supplierId}` : '–'))
|
||||
: (order.customerName || (order.entityId ? `Kunde #${order.entityId}` : '–'));
|
||||
const posCount = order.positions != null ? order.positions : (order.lines?.length ?? 0);
|
||||
const unbooked = order.ledger?.unbookedPositions ?? 0;
|
||||
|
||||
return (
|
||||
<Box
|
||||
@@ -780,6 +791,14 @@ class ChunkCacheMonitor extends PureComponent {
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{isDeliv && (
|
||||
<Chip
|
||||
size="small"
|
||||
label={unbooked === 0 ? 'Gebucht' : `${unbooked} Ungebucht`}
|
||||
color={unbooked === 0 ? 'success' : 'warning'}
|
||||
sx={{ height: 20, fontSize: '0.7rem' }}
|
||||
/>
|
||||
)}
|
||||
{isShip && (
|
||||
<>
|
||||
<Chip
|
||||
@@ -1072,6 +1091,14 @@ class ChunkCacheMonitor extends PureComponent {
|
||||
onClick={() => this.switchTarget('order')}
|
||||
sx={{ cursor: 'pointer', height: 24, fontSize: '0.72rem', fontWeight: this.state.target === 'order' ? 700 : 500 }}
|
||||
/>
|
||||
<Chip
|
||||
size="small"
|
||||
color={this.state.target === 'delivery' ? 'primary' : 'default'}
|
||||
variant={this.state.target === 'delivery' ? 'filled' : 'outlined'}
|
||||
label="Lieferungen (deliveryAutomat)"
|
||||
onClick={() => this.switchTarget('delivery')}
|
||||
sx={{ cursor: 'pointer', height: 24, fontSize: '0.72rem', fontWeight: this.state.target === 'delivery' ? 700 : 500 }}
|
||||
/>
|
||||
<Chip
|
||||
size="small"
|
||||
color={this.state.target === 'shipment' ? 'primary' : 'default'}
|
||||
|
||||
Reference in New Issue
Block a user