Nachtragungen ohne Rechnung bezahlt setzen
This commit is contained in:
@@ -35,10 +35,6 @@ export async function POST(_: Request, { params }: Context) {
|
|||||||
return NextResponse.json({ error: "Bezahlt ist erst nach Freigabe moeglich." }, { status: 400 });
|
return NextResponse.json({ error: "Bezahlt ist erst nach Freigabe moeglich." }, { status: 400 });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!expense.proofUrl || !expense.invoiceDate || !expense.documentedAt) {
|
|
||||||
return NextResponse.json({ error: "Bitte zuerst Rechnung mit Rechnungsdatum abgeben." }, { status: 400 });
|
|
||||||
}
|
|
||||||
|
|
||||||
const updatedExpense = await prisma.expense.update({
|
const updatedExpense = await prisma.expense.update({
|
||||||
where: { id },
|
where: { id },
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
@@ -819,17 +819,24 @@ export function BudgetColumn({
|
|||||||
|
|
||||||
{!expense.paidAt &&
|
{!expense.paidAt &&
|
||||||
expense.approvalStatus === "APPROVED" &&
|
expense.approvalStatus === "APPROVED" &&
|
||||||
expense.proofUrl &&
|
|
||||||
expense.invoiceDate &&
|
|
||||||
expense.documentedAt &&
|
|
||||||
canMarkPaid(viewer.role) ? (
|
canMarkPaid(viewer.role) ? (
|
||||||
<Button
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
onClick={() => onMarkPaid(expense.id)}
|
onClick={() => {
|
||||||
|
if (
|
||||||
|
!window.confirm(
|
||||||
|
`Ausgabe "${expense.title}" ohne Rechnung als bezahlt markieren?\n\nNutze das nur fuer Nachtragungen.`
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
onMarkPaid(expense.id);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Bezahlt setzen
|
Ohne Rechnung bezahlt setzen
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
@@ -880,13 +887,6 @@ export function BudgetColumn({
|
|||||||
required
|
required
|
||||||
fullWidth
|
fullWidth
|
||||||
/>
|
/>
|
||||||
<TextField
|
|
||||||
label="Rechnungsdokument"
|
|
||||||
value={proofFileDrafts[expense.id]?.name ?? expense.proofUrl ?? ""}
|
|
||||||
InputProps={{ readOnly: true }}
|
|
||||||
size="small"
|
|
||||||
fullWidth
|
|
||||||
/>
|
|
||||||
<Stack direction="row" spacing={1}>
|
<Stack direction="row" spacing={1}>
|
||||||
<Button
|
<Button
|
||||||
component="label"
|
component="label"
|
||||||
@@ -934,6 +934,15 @@ export function BudgetColumn({
|
|||||||
/>
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
{proofFileDrafts[expense.id]?.name ? (
|
||||||
|
<Typography
|
||||||
|
variant="caption"
|
||||||
|
color="text.secondary"
|
||||||
|
sx={{ display: "block", overflowWrap: "anywhere" }}
|
||||||
|
>
|
||||||
|
{proofFileDrafts[expense.id]?.name}
|
||||||
|
</Typography>
|
||||||
|
) : null}
|
||||||
<Button
|
<Button
|
||||||
size="medium"
|
size="medium"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
|
|||||||
Reference in New Issue
Block a user