feat(buchhaltung): add edit support for pending transactions

This commit is contained in:
Matthias Hochmeister
2026-04-14 13:46:07 +02:00
parent f403c73334
commit 967cad5922
2 changed files with 50 additions and 16 deletions

View File

@@ -4,7 +4,7 @@ import { useQuery } from '@tanstack/react-query';
import {
Box, Typography, Button, Grid, Card, CardContent,
Table, TableHead, TableBody, TableRow, TableCell,
LinearProgress, Chip, Alert, Skeleton, TableContainer, Paper,
Chip, Alert, Skeleton, TableContainer, Paper,
IconButton, CircularProgress,
} from '@mui/material';
import { ArrowBack, KeyboardArrowDown, KeyboardArrowUp } from '@mui/icons-material';
@@ -16,23 +16,13 @@ import type { AusgabenTyp, BuchhaltungAudit } from '../types/buchhaltung.types';
const fmtEur = (n: number) => new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(n);
function BudgetCard({ label, budget, spent }: { label: string; budget: number; spent: number }) {
const utilization = budget > 0 ? Math.min((spent / budget) * 100, 100) : 0;
const over = spent > budget && budget > 0;
return (
<Card>
<CardContent>
<Typography variant="subtitle2" color="text.secondary">{label}</Typography>
<Typography variant="h6">{fmtEur(Number(spent))}</Typography>
{budget > 0 && (
<>
<Typography variant="body2" color="text.secondary">Budget: {fmtEur(Number(budget))}</Typography>
<LinearProgress
variant="determinate"
value={utilization}
color={over ? 'error' : utilization > 80 ? 'warning' : 'primary'}
sx={{ mt: 1, height: 6, borderRadius: 3 }}
/>
</>
<Typography variant="body2" color="text.secondary">Budget: {fmtEur(Number(budget))}</Typography>
)}
</CardContent>
</Card>
@@ -204,7 +194,7 @@ export default function BuchhaltungKontoDetail() {
const childIsEinfach = (child.budget_typ || 'detailliert') === 'einfach';
const childTotal = childIsEinfach
? Number(child.budget_gesamt || 0)
: Number(child.budget_gwg) + Number(child.budget_anlagen) + Number(child.budget_instandhaltung);
: Number(child.budget_gwg || 0) + Number(child.budget_anlagen || 0) + Number(child.budget_instandhaltung || 0);
return (
<TableRow
key={child.id}