feat: add lease end page and resolution forms with necessary services and components

- Implemented LeaseEndPage component for managing lease end processes.
- Created LeaseEndResolutionForms component for handling agreement and closure submissions.
- Added civil date formatting utilities for French date representation.
- Developed styles for lease end resolution forms and rent due correction components.
- Integrated HTTP service for lease end operations including notice recording, withdrawal acceptance, and closure.
- Added unit tests for new components and services to ensure functionality.
This commit is contained in:
nessar committed 2026-08-17 14:18:16 +02:00
1 parent 3d42c9a256
commit c1e6b905d5
114 files changed
+6582 -345

No files matched your search

@@ -194,6 +194,7 @@ describe('LeaseCard', () => {
fixture.componentInstance.finalizationRequested.subscribe(requested);
const text = fixture.nativeElement.textContent.replace(/\s+/g, ' ');
expect(text).toContain('Période initiale 1 janvier 2026 → 1 janvier 2027 · bail reconductible');
expect(text).toContain('Générer / télécharger le bail');
expect(text).toContain('Modifier');
expect(text).toContain('Supprimer');
@@ -215,6 +216,61 @@ describe('LeaseCard', () => {
expect(fixture.nativeElement.textContent).not.toContain('Finaliser le bail');
});
it('manages an active single lease and keeps read access for colocation and archives', () => {
const fixture = TestBed.createComponent(LeaseCard);
fixture.componentRef.setInput('apartments', []);
fixture.componentRef.setInput('tenants', []);
fixture.componentRef.setInput('lease', {
id: 'lease-1',
apartmentId: 'apartment-1',
tenantIds: ['tenant-1'],
guarantors: [],
specialClauses: [],
legalTerms: emptyLeaseLegalTerms(),
leaseType: 'STANDARD',
startDate: '2026-01-01',
endDate: '2028-12-31',
monthlyRent: 800,
monthlyCharges: 50,
securityDeposit: 800,
dueDay: 5,
chargeMethod: 'FLAT_RATE',
indexFlatRate: false,
status: 'ACTIVE',
});
const requested = vi.fn();
fixture.componentInstance.leaseEndRequested.subscribe(requested);
fixture.detectChanges();
const action: HTMLButtonElement = fixture.nativeElement.querySelector('.lease-end-action');
expect(action.textContent).toContain('Gérer la fin du bail');
action.click();
expect(requested).toHaveBeenCalledWith('lease-1');
expect(fixture.nativeElement.textContent).not.toContain('Archiver');
fixture.componentRef.setInput('lease', {
...fixture.componentInstance.lease(),
tenantIds: ['tenant-1', 'tenant-2'],
});
fixture.detectChanges();
const colocationAction: HTMLButtonElement =
fixture.nativeElement.querySelector('.lease-end-action');
expect(colocationAction.textContent).toContain('Voir la fin du bail');
expect(fixture.nativeElement.textContent).toContain(
'La fin de bail en colocation n’est pas encore prise en charge',
);
fixture.componentRef.setInput('lease', {
...fixture.componentInstance.lease(),
status: 'ARCHIVED',
});
fixture.detectChanges();
expect(fixture.nativeElement.querySelector('.lease-end-action').textContent).toContain(
'Voir la fin du bail',
);
});
it('offers an IRL preview only for an active lease with the revision clause enabled', () => {
TestBed.configureTestingModule({
providers: [