- Implemented RentPaymentHistoryServiceTest to validate payment retrieval with refunds and reversals. - Created ReverseRentPaymentServiceTest to ensure correct handling of payment reversals and allocation releases. - Developed rent-payment-allocation-dialog component with form for surplus allocation. - Added rent-payment-refund-dialog component for processing refunds with validation. - Introduced rent-payment-reversal-dialog component for reversing payments with reason input. - Implemented utility functions for formatting Euro values and handling date formatting. - Enhanced rent-payment-dialogs.spec.ts to cover new dialog functionalities and error handling.
72 lines
2.6 KiB
HTML
72 lines
2.6 KiB
HTML
<h2 mat-dialog-title>Enregistrer un règlement</h2>
|
|
<form [formGroup]="form" (ngSubmit)="submit()">
|
|
<mat-dialog-content class="payment-dialog-content">
|
|
<p>
|
|
Règlement reçu pour <strong>{{ data.apartmentName }}</strong
|
|
>. Vérifiez la date et le montant avant de confirmer.
|
|
</p>
|
|
|
|
<dl class="due-summary">
|
|
<div>
|
|
<dt>Loyer</dt>
|
|
<dd>{{ formatEuro(data.rentDue.rent) }}</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Charges</dt>
|
|
<dd>{{ formatEuro(data.rentDue.charges) }}</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Déjà affecté</dt>
|
|
<dd>{{ formatEuro(data.rentDue.allocatedAmount) }}</dd>
|
|
</div>
|
|
<div>
|
|
<dt>Restant à régler</dt>
|
|
<dd>{{ formatEuro(data.rentDue.remainingAmount) }}</dd>
|
|
</div>
|
|
</dl>
|
|
|
|
<fieldset class="dialog-fieldset" [disabled]="saving()">
|
|
<mat-form-field appearance="outline">
|
|
<mat-label>Date de réception</mat-label>
|
|
<input matInput type="date" formControlName="receivedAt" [max]="today" required />
|
|
@if (form.controls.receivedAt.hasError('futureDate')) {
|
|
<mat-error>La date de réception ne peut pas être dans le futur.</mat-error>
|
|
}
|
|
</mat-form-field>
|
|
<mat-form-field appearance="outline">
|
|
<mat-label>Montant reçu</mat-label>
|
|
<input matInput type="number" step="0.01" min="0.01" formControlName="amount" required />
|
|
<span matTextSuffix>€</span>
|
|
@if (form.controls.amount.invalid) {
|
|
<mat-error>Le montant doit être strictement positif.</mat-error>
|
|
}
|
|
</mat-form-field>
|
|
</fieldset>
|
|
|
|
<div class="outcome-summary" aria-live="polite">
|
|
@if (surplus() > 0) {
|
|
<strong>L’échéance sera réglée.</strong>
|
|
<span>Surplus non affecté : {{ formatEuro(surplus()) }}</span>
|
|
} @else if (remainingAfter() > 0) {
|
|
<strong>L’échéance restera partiellement réglée.</strong>
|
|
<span>Solde après règlement : {{ formatEuro(remainingAfter()) }}</span>
|
|
} @else {
|
|
<strong>L’échéance sera entièrement réglée.</strong>
|
|
}
|
|
</div>
|
|
|
|
@if (error()) {
|
|
<p class="dialog-error" role="alert">{{ error() }}</p>
|
|
}
|
|
</mat-dialog-content>
|
|
<mat-dialog-actions align="end">
|
|
<button mat-button mat-dialog-close type="button" [disabled]="saving()">Annuler</button>
|
|
<button mat-flat-button type="submit" [disabled]="form.invalid || saving()">
|
|
@if (saving()) {
|
|
<mat-spinner diameter="18" aria-label="Enregistrement en cours" />
|
|
}
|
|
Confirmer le règlement
|
|
</button>
|
|
</mat-dialog-actions>
|
|
</form>
|