This commit is contained in:
seb
2026-10-15 11:17:04 +02:00
parent a90776bb8b
commit 657d184d1c
2 changed files with 54 additions and 27 deletions

View File

@@ -13,6 +13,7 @@ import CheckCircleOutlineOutlinedIcon from '@mui/icons-material/CheckCircleOutli
import { PanelTile } from 'dashgui/panels'; import { PanelTile } from 'dashgui/panels';
import { formatDate } from './manifestConfig'; import { formatDate } from './manifestConfig';
import { formatPrice } from '../../utils/price'; import { formatPrice } from '../../utils/price';
import { typeLabel, typeIcon } from './OrderPaymentList';
import { import {
GREEN_PANEL, GREEN_PANEL,
YELLOW_PANEL, YELLOW_PANEL,
@@ -220,29 +221,55 @@ export class OrderDocumentsTiles extends PureComponent {
{payments.length > 0 ? ( {payments.length > 0 ? (
<Stack spacing={1}> <Stack spacing={1}>
{payments.map((pay) => ( {payments.map((pay) => {
const pType = pay.type || pay.paymentType || pay.payment_type;
return (
<Card <Card
key={pay.id} key={pay.id}
variant="outlined" variant="outlined"
onClick={this.handleOpenPayments}
sx={{ sx={{
p: 1, p: 1.25,
bgcolor: WHITE, bgcolor: WHITE,
display: 'flex', cursor: 'pointer',
justifyContent: 'space-between', transition: 'all 0.15s ease',
alignItems: 'center', '&:hover': {
boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
borderColor: 'primary.main',
},
}} }}
> >
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 0.25 }}>
<Stack direction="row" spacing={0.75} alignItems="center"> <Stack direction="row" spacing={0.75} alignItems="center">
<CheckCircleOutlineOutlinedIcon sx={{ fontSize: 16, color: 'success.main' }} /> <CheckCircleOutlineOutlinedIcon sx={{ fontSize: 16, color: 'success.main' }} />
<Typography variant="caption" sx={{ fontWeight: 600 }}> <Typography variant="subtitle2" sx={{ fontWeight: 700, fontSize: '0.85rem' }}>
#{pay.id} #{pay.id}
</Typography> </Typography>
</Stack> </Stack>
<Typography variant="caption" sx={{ fontWeight: 700, color: 'success.dark' }}> <Typography
variant="subtitle2"
sx={{ fontWeight: 700, color: 'success.dark', fontVariantNumeric: 'tabular-nums' }}
>
+{formatPrice(pay.amount)} +{formatPrice(pay.amount)}
</Typography> </Typography>
</Box>
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<Stack direction="row" spacing={0.5} alignItems="center">
{typeIcon(pType, { fontSize: 15, color: 'text.secondary' })}
<Typography variant="caption" color="text.secondary" sx={{ fontWeight: 600 }}>
{typeLabel(pType)}
</Typography>
</Stack>
{pay.date ? (
<Typography variant="caption" color="text.secondary">
{formatDate(pay.date)}
</Typography>
) : null}
</Box>
</Card> </Card>
))} );
})}
</Stack> </Stack>
) : ( ) : (
<Box <Box

View File

@@ -44,7 +44,7 @@ import {
const cfg = manifestConfig('order'); const cfg = manifestConfig('order');
const PAYMENT_TYPES = [ export const PAYMENT_TYPES = [
{ value: 'transfer', label: 'Banküberweisung', icon: AccountBalanceIcon }, { value: 'transfer', label: 'Banküberweisung', icon: AccountBalanceIcon },
{ value: 'cash', label: 'Barzahlung', icon: PointOfSaleIcon }, { value: 'cash', label: 'Barzahlung', icon: PointOfSaleIcon },
{ value: 'card', label: 'EC- / Kreditkarte', icon: CreditCardIcon }, { value: 'card', label: 'EC- / Kreditkarte', icon: CreditCardIcon },
@@ -54,15 +54,15 @@ const PAYMENT_TYPES = [
{ value: 'other', label: 'Sonstige', icon: PaymentsIcon }, { value: 'other', label: 'Sonstige', icon: PaymentsIcon },
]; ];
function typeLabel(val) { export function typeLabel(val) {
const match = PAYMENT_TYPES.find((t) => t.value === val); const match = PAYMENT_TYPES.find((t) => t.value === val);
return match?.label || val || 'Zahlung'; return match?.label || val || 'Zahlung';
} }
function typeIcon(val) { export function typeIcon(val, sx = { fontSize: 18 }) {
const match = PAYMENT_TYPES.find((t) => t.value === val); const match = PAYMENT_TYPES.find((t) => t.value === val);
const IconComp = match?.icon || PaymentsIcon; const IconComp = match?.icon || PaymentsIcon;
return <IconComp sx={{ fontSize: 18 }} />; return <IconComp sx={sx} />;
} }
const rowSx = { const rowSx = {