feat: add brand mark component and dashboard page
- Introduced a new `BrandMark` component for branding purposes. - Created a `DashboardPage` component with a responsive layout, including sections for user profile, apartment management, and API demo. - Added styles for the dashboard page to enhance user experience. - Implemented a settings page with theme preferences and session management features. - Developed a sign-in page with branding and user-friendly design. - Established a workspace navigation component for easy access to different sections of the application. - Implemented an `ApartmentService` for managing apartment data with corresponding unit tests. - Created a `ConfigService` for loading application configuration. - Added a `ThemeService` to manage user theme preferences dynamically.
This commit is contained in:
1 parent
3e552cad90
commit
26ab037084
37 files changed
+1877
-1650
No files matched your search
@@ -0,0 +1,50 @@
|
||||
import { Component, effect, input, output, signal } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { Apartment } from '../../services/apartment.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-apartment-form',
|
||||
imports: [FormsModule, MatButtonModule, MatFormFieldModule, MatInputModule],
|
||||
templateUrl: './apartment-form.html',
|
||||
styleUrl: './apartment-form.css',
|
||||
})
|
||||
export class ApartmentForm {
|
||||
readonly apartment = input<Apartment | null>(null);
|
||||
readonly closed = output<void>();
|
||||
readonly saved = output<Apartment>();
|
||||
|
||||
readonly name = signal('');
|
||||
readonly address = signal('');
|
||||
readonly purchasePrice = signal(0);
|
||||
readonly description = signal('');
|
||||
readonly error = signal('');
|
||||
|
||||
constructor() {
|
||||
effect(() => this.resetForm(this.apartment()));
|
||||
}
|
||||
|
||||
save(): void {
|
||||
if (!this.name().trim() || !this.address().trim() || this.purchasePrice() <= 0) {
|
||||
this.error.set('Veuillez remplir tous les champs obligatoires (Nom, Adresse, Prix > 0).');
|
||||
return;
|
||||
}
|
||||
|
||||
this.saved.emit({
|
||||
name: this.name().trim(),
|
||||
address: this.address().trim(),
|
||||
purchasePrice: this.purchasePrice(),
|
||||
description: this.description().trim(),
|
||||
});
|
||||
}
|
||||
|
||||
private resetForm(apartment: Apartment | null): void {
|
||||
this.name.set(apartment?.name ?? '');
|
||||
this.address.set(apartment?.address ?? '');
|
||||
this.purchasePrice.set(apartment?.purchasePrice ?? 0);
|
||||
this.description.set(apartment?.description ?? '');
|
||||
this.error.set('');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user