diff --git a/src/app/apartment/apartment-create/apartment-create.component.html b/src/app/apartment/apartment-create/apartment-create.component.html index c82c2ca..f510c3f 100644 --- a/src/app/apartment/apartment-create/apartment-create.component.html +++ b/src/app/apartment/apartment-create/apartment-create.component.html @@ -30,11 +30,10 @@

Create Apartment

- - + +
+ +
diff --git a/src/app/apartment/apartment-create/apartment-create.component.ts b/src/app/apartment/apartment-create/apartment-create.component.ts index bb84eed..5edf12a 100644 --- a/src/app/apartment/apartment-create/apartment-create.component.ts +++ b/src/app/apartment/apartment-create/apartment-create.component.ts @@ -8,12 +8,12 @@ import { ErrorMessageService } from '../../error-handler/error-message.service'; import { CommonModule } from '@angular/common'; import { ApartmentService } from '../apartment.service'; import { ApartmentDetails } from '../apartment-details'; -/*import { RoomListComponent } from '../../room/room-list/room-list.component';*/ +import { RoomListComponent } from '../../room/room-list/room-list.component'; @Component({ selector: 'app-apartment-create', standalone: true, - imports: [FormsModule, CommonModule, /*RoomListComponent*/], + imports: [FormsModule, CommonModule, RoomListComponent], templateUrl: './apartment-create.component.html', styleUrls: ['./apartment-create.component.css'] }) diff --git a/src/app/apartment/apartment-list/apartment-list.component.html b/src/app/apartment/apartment-list/apartment-list.component.html index 1180e76..5ecd121 100644 --- a/src/app/apartment/apartment-list/apartment-list.component.html +++ b/src/app/apartment/apartment-list/apartment-list.component.html @@ -2,7 +2,7 @@

My apartments

-

No hay apartamentos disponibles.

+

There are no apartments

@@ -23,7 +23,7 @@

My apartments

- {{ apartment.getIdFromLinks() }} + {{ apartment.getIdFromLinks() }} {{ apartment.name }} {{ apartment.address }}, {{ apartment.city }}, {{ apartment.country }} {{ apartment.floor }} @@ -32,14 +32,20 @@

My apartments

{{ apartment.description || 'N/A' }} {{ apartment.note || 'N/A' }} - + - + - +
diff --git a/src/app/apartment/apartment-list/apartment-list.component.spec.ts b/src/app/apartment/apartment-list/apartment-list.component.spec.ts index 045d05c..9576928 100644 --- a/src/app/apartment/apartment-list/apartment-list.component.spec.ts +++ b/src/app/apartment/apartment-list/apartment-list.component.spec.ts @@ -1,5 +1,4 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; - import { ApartmentListComponent } from './apartment-list.component'; describe('ApartmentListComponent', () => { diff --git a/src/app/apartment/apartment-list/apartment-list.component.ts b/src/app/apartment/apartment-list/apartment-list.component.ts index a525351..7a63062 100644 --- a/src/app/apartment/apartment-list/apartment-list.component.ts +++ b/src/app/apartment/apartment-list/apartment-list.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { Apartment } from '../apartment'; import { ApartmentService } from '../apartment.service'; -import { Router } from '@angular/router'; +import { Router, RouterModule } from '@angular/router'; import { CommonModule } from '@angular/common'; import { User } from '../../login-basic/user'; import { AuthenticationBasicService } from '../../login-basic/authentication-basic.service'; @@ -10,13 +10,13 @@ import { ErrorMessageService } from '../../error-handler/error-message.service'; @Component({ selector: 'app-apartment-list', standalone: true, - imports: [CommonModule], + imports: [CommonModule, RouterModule], templateUrl: './apartment-list.component.html', styleUrls: ['./apartment-list.component.css'] }) export class ApartmentListComponent implements OnInit { - public apartments: Apartment[] = []; // Almacena la lista de apartamentos + public apartments: Apartment[] = []; public currentUser: User = new User(); public isShowed: boolean = false; @@ -38,20 +38,17 @@ export class ApartmentListComponent implements OnInit { } if (this.currentUser) { - // Llama al servicio para obtener los apartamentos del usuario actual this.apartmentService.findByOwner(this.currentUser).subscribe({ next: (resourceCollection) => { - - this.apartments = resourceCollection.resources || []; // Asegúrate de asignar un arreglo + this.apartments = resourceCollection.resources || []; }, - error: (err) => { - console.error('Error fetching apartments:', err); + error: () => { this.errorMessageService.showErrorMessage('Failed to load apartments'); }, }); } else { - console.log('User not authenticated'); + this.errorMessageService.showErrorMessage('Failed to load apartments'); } } @@ -63,25 +60,4 @@ export class ApartmentListComponent implements OnInit { this.errorMessageService.showErrorMessage('You are not an owner'); this.router.navigate(['/apartments']); } - - deleteApartment(apartmentId: string): void { - if (apartmentId) { - console.log('Apartment ID:', apartmentId); - this.router.navigate([`/apartment/${apartmentId}/delete`]); - } else { - console.error('Invalid apartment ID'); - } - } - - updateApartment(apartmentId: string): void { - if (apartmentId) { - console.log('Apartment ID:', apartmentId); - this.router.navigate([`/apartment/${apartmentId}/update`]); - } else { - console.error('Invalid apartment ID'); - } - } - createApartment(): void { - this.router.navigate(['/apartment/create']); - } } diff --git a/src/app/navbar/navbar.component.html b/src/app/navbar/navbar.component.html index 5b84722..7f193df 100644 --- a/src/app/navbar/navbar.component.html +++ b/src/app/navbar/navbar.component.html @@ -7,31 +7,21 @@ - \ No newline at end of file + diff --git a/src/app/room/room-list/room-list.component.html b/src/app/room/room-list/room-list.component.html index 6f8b71b..5d57468 100644 --- a/src/app/room/room-list/room-list.component.html +++ b/src/app/room/room-list/room-list.component.html @@ -23,14 +23,16 @@

List of Rooms

{{ room.hasDesk }} {{ room.isOccupied }} {{ room.surface}} - - + + - + diff --git a/src/app/room/room-list/room-list.component.ts b/src/app/room/room-list/room-list.component.ts index df10255..1b86bcf 100644 --- a/src/app/room/room-list/room-list.component.ts +++ b/src/app/room/room-list/room-list.component.ts @@ -42,8 +42,6 @@ export class RoomListComponent implements OnInit { } if (this.currentUser) { this.getAparments(); - } else { - console.log('User not authenticated'); } } @@ -64,8 +62,7 @@ export class RoomListComponent implements OnInit { this.loadRoomsForApartments(); } }, - error: (err) => { - console.error('Error fetching apartments:', err); + error: () => { this.errorMessageService.showErrorMessage('Failed to load apartments'); } }); @@ -83,8 +80,7 @@ export class RoomListComponent implements OnInit { this.rooms = roomsArray.flat(); console.log(this.rooms); }, - error: (err) => { - console.error('Error fetching rooms:', err); + error: () => { this.errorMessageService.showErrorMessage('Failed to load rooms'); } }); diff --git a/src/styles.css b/src/styles.css index 5aa193f..1fbe59b 100644 --- a/src/styles.css +++ b/src/styles.css @@ -23,95 +23,9 @@ } } +/* Buttons sytles */ -/*Create button style*/ - -.createButton { - border: 0; - background-image: linear-gradient( 150deg, #9500, #008000, #ADFF2F); - border-radius: 8px; - color: #008000; - display: flex; - font-size: 16px; - padding: 4px; - cursor: pointer; - transition: .3s; -} - -.createButton .createSpan { - background-color: #fff; - padding: 3px 16px; - border-radius: 6px; - transition: .3s; -} - -.createButton:hover .createSpan { - background: none; - color: #fff; -} - -.createButton:active { - transform: scale(0, 4) -} - - -/*Delete button style*/ - -.deleteButton { - border: 0; - background-image: linear-gradient( 150deg, #9500, #B22222, #FF8C00); - border-radius: 8px; - color: #B22222; - display: flex; - font-size: 16px; - padding: 4px; - cursor: pointer; - transition: .3s; -} - -.deleteButton .deleteSpan { - background-color: #fff; - padding: 3px 16px; - border-radius: 6px; - transition: .3s; -} - -.deleteButton:hover .deleteSpan { - background: none; - color: #fff; -} - -.deleteButton:active { - transform: scale(0, 4) -} - - -/*update button style*/ - -.updateButton { - border: 0; - background-image: linear-gradient( 150deg, #9500, #8B4513, #D2B48C); - border-radius: 8px; - color: #8B4513; - display: flex; - font-size: 16px; - padding: 4px; - cursor: pointer; - transition: .3s; -} - -.updateButton .updateSpan { - background-color: #fff; - padding: 3px 16px; - border-radius: 6px; - transition: .3s; -} - -.updateButton:hover .updateSpan { - background: none; - color: #fff; -} - -.updateButton:active { - transform: scale(0, 4) +.btn-secondary { + background-color: rgb(203, 203, 21); + border-color: #dff062; }