4d05a94681
Adds a payment step after document approval: PM_Freigabe approves (Field 15 = "freigegeben"), then PM_Zahlung can mark as paid (Field 16). - Backend: VIEW_ZAHLUNG permission mapped to PM_Zahlung OIDC group - Backend: ZahlungModule with endpoints to list documents by filter (ausstehend/freigegeben/alle), set Field 16, fetch options from Paperless - Backend: setZahlung() throws ForbiddenException if Field 15 ≠ "freigegeben" - Frontend: /zahlung route with 3-way filter, two status columns (Freigabe + Zahlung) - Frontend: "Zahlung verbuchen" button disabled with tooltip for non-approved docs - Frontend: Zahlung menu item with EuroOutlined icon Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import { Controller, Get, Put, Param, Body, Query } from '@nestjs/common';
|
|
import { RequirePermissions } from '../auth/permissions.decorator';
|
|
import { Permission } from '../auth/permissions.enum';
|
|
import { ZahlungService, type ZahlungFilter } from './zahlung.service';
|
|
|
|
@Controller('api/zahlung')
|
|
@RequirePermissions(Permission.VIEW_ZAHLUNG)
|
|
export class ZahlungController {
|
|
constructor(private readonly zahlungService: ZahlungService) {}
|
|
|
|
@Get('documents')
|
|
getDocuments(
|
|
@Query('page') page = '1',
|
|
@Query('pageSize') pageSize = '25',
|
|
@Query('filter') filter: ZahlungFilter = 'ausstehend',
|
|
) {
|
|
return this.zahlungService.getZahlungDocuments(
|
|
parseInt(page, 10),
|
|
Math.min(parseInt(pageSize, 10), 100),
|
|
filter,
|
|
);
|
|
}
|
|
|
|
@Put('documents/:id/zahlung')
|
|
setZahlung(
|
|
@Param('id') id: string,
|
|
@Body('value') value: string | null,
|
|
) {
|
|
return this.zahlungService.setZahlung(parseInt(id, 10), value ?? null);
|
|
}
|
|
|
|
@Get('options')
|
|
getOptions() {
|
|
return this.zahlungService.getZahlungOptions();
|
|
}
|
|
}
|