feat: add rent payment schedules and receipts

This commit is contained in:
nessar authored and Nessar committed 2026-08-17 14:18:15 +02:00
1 parent f876639c02
commit 47cb4bcdaf
26 files changed
+1118 -3

No files matched your search

@@ -0,0 +1,34 @@
import { HttpClient } from '@angular/common/http';
import { Injectable, inject } from '@angular/core';
import { Observable } from 'rxjs';
export type RentPaymentStatus = 'PAID' | 'LATE' | 'UPCOMING';
export interface RentPayment {
id: string;
leaseId: string;
month: string;
dueDate: string;
rent: number;
charges: number;
total: number;
status: RentPaymentStatus;
paidAt: string | null;
}
@Injectable({ providedIn: 'root' })
export class RentPaymentService {
private readonly http = inject(HttpClient);
getRentPayments(): Observable<RentPayment[]> {
return this.http.get<RentPayment[]>('/api/rent-payments');
}
markPaid(id: string): Observable<RentPayment> {
return this.http.put<RentPayment>(`/api/rent-payments/${id}/paid`, {});
}
downloadReceipt(id: string): Observable<Blob> {
return this.http.get(`/api/rent-payments/${id}/receipt`, { responseType: 'blob' });
}
}