feat: enhance lease and rent payment management

- Added methods in LeaseRepository to find leases by apartment ID and exclude a specific lease ID.
- Introduced a method in RentPaymentRepository to delete all payments by lease ID.
- Updated LeaseService to handle overlapping leases and generate rent payments upon lease creation.
- Implemented rent payment deletion in LeaseService when a lease is deleted.
- Enhanced RentPaymentService to generate rent payments with pro-rata calculations for partial months.
- Modified RentPaymentController to accept rent and charges when marking payments as paid.
- Created RentPaymentPaidRequest DTO for validating rent payment requests.
- Added a RentPaymentValidationDialog for confirming payment amounts before processing.
- Updated frontend components to support new rent payment features, including validation and date filtering for leases.
- Adjusted tests to cover new functionalities and ensure proper integration of rent payment management.
This commit is contained in:
nessar committed 2026-08-17 14:18:15 +02:00
1 parent 479012d661
commit 9cfb55d79c
25 files changed
+389 -175

No files matched your search

@@ -4,15 +4,19 @@ import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { RentPayment, RentPaymentStatus } from '../../services/rent-payment.service';
import { WorkspaceService } from '../../services/workspace.service';
import { MatDialog } from '@angular/material/dialog';
import { RentPaymentValidationDialog } from '../rent-payment-validation-dialog/rent-payment-validation-dialog';
import { DatePipe } from '@angular/common';
@Component({
selector: 'app-rent-payments-page',
imports: [MatButtonModule, MatProgressBarModule, MatProgressSpinnerModule],
imports: [MatButtonModule, MatProgressBarModule, MatProgressSpinnerModule, DatePipe],
templateUrl: './rent-payments-page.html',
styleUrl: './rent-payments-page.css',
})
export class RentPaymentsPage {
readonly workspace = inject(WorkspaceService);
private readonly dialog = inject(MatDialog);
readonly contentReady = computed(
() =>
this.workspace.rentPaymentLoadState().loaded &&
@@ -56,4 +60,18 @@ export class RentPaymentsPage {
this.workspace.loadLeases();
this.workspace.loadApartments();
}
markPaid(payment: RentPayment): void {
this.dialog
.open(RentPaymentValidationDialog, {
data: { rent: payment.rent, charges: payment.charges },
width: '400px',
})
.afterClosed()
.subscribe((result) => {
if (result) {
this.workspace.markRentPaymentPaid(payment.id, result.rent, result.charges);
}
});
}
}