Files
lmnp-organizer/frontend/src/app/components/tenants-page/tenants-page.ts
T
nessar 82f339e209 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.
2026-08-17 14:18:15 +02:00

35 lines
1.0 KiB
TypeScript

import { Component, inject, signal } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { Tenant } from '../../services/tenant.service';
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',
imports: [MatButtonModule, TenantCard, TenantForm],
templateUrl: './tenants-page.html',
styleUrl: './tenants-page.css',
})
export class TenantsPage {
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);
}
openEditForm(tenant: Tenant): void {
this.editingTenant.set(tenant);
this.showForm.set(true);
}
closeForm(): void {
this.showForm.set(false);
this.editingTenant.set(null);
}
}