Refactor application structure to use WorkspaceService for state management

- Removed direct state management from components and centralized it in WorkspaceService.
- Updated ApartmentsPage, TenantsPage, LeasesPage, and DashboardPage to utilize WorkspaceService for data handling.
- Introduced SessionService to manage user session state and authentication.
- Simplified component templates to reflect new service-based architecture.
- Removed unused ConfigService and its tests.
- Added lease.html template for lease document generation.
- Created app.routes.spec.ts for route mapping tests.
This commit is contained in:
nessar authored and Nessar committed 2026-08-17 14:18:15 +02:00
1 parent be1f680a62
commit 82f339e209
33 files changed
+292 -929

No files matched your search

@@ -1,10 +1,9 @@
import { Component, input, output, signal } from '@angular/core';
import { Component, inject, signal } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { Tenant } from '../../services/tenant.service';
import { TenantCard, TenantAttachmentRequest } from '../tenant-card/tenant-card';
import { TenantForm, TenantSaveRequest } from '../tenant-form/tenant-form';
export type { TenantAttachmentRequest, TenantSaveRequest };
import { WorkspaceService } from '../../services/workspace.service';
import { TenantCard } from '../tenant-card/tenant-card';
import { TenantForm } from '../tenant-form/tenant-form';
@Component({
selector: 'app-tenants-page',
@@ -13,16 +12,13 @@ export type { TenantAttachmentRequest, TenantSaveRequest };
styleUrl: './tenants-page.css',
})
export class TenantsPage {
readonly tenants = input.required<Tenant[]>();
readonly attachmentError = input('');
readonly tenantSaved = output<TenantSaveRequest>();
readonly deleteRequested = output<string>();
readonly attachmentUploadRequested = output<{ tenantId: string; file: File }>();
readonly attachmentDownloadRequested = output<TenantAttachmentRequest>();
readonly workspace = inject(WorkspaceService);
readonly showForm = signal(false);
readonly editingTenant = signal<Tenant | null>(null);
constructor() { this.workspace.loadTenants(); }
openAddForm(): void {
this.editingTenant.set(null);
this.showForm.set(true);