Skip to content

Commit

Permalink
feat add delete button
Browse files Browse the repository at this point in the history
  • Loading branch information
samplecode17 committed Dec 15, 2024
1 parent 9111f5f commit 1a2607e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/room/room-list/room-list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h4 class="mb-1">List of Rooms</h4>
<thead class="thead-dark">
<tr>
<th>ID</th>
<th>Apartment Id</th>
<th>Apartment Name</th>
<th>Bed</th>
<th>Window</th>
<th>Desk</th>
Expand All @@ -23,6 +23,7 @@ <h4 class="mb-1">List of Rooms</h4>
<td>{{ room.hasDesk }}</td>
<td>{{ room.isOccupied }}</td>
<td>{{ room.surface}}</td>
<td><button class="deleteButton" (click)="deleteRoom(room.getRoomIdFromLinks())"><span class="deleteSpan">Delete</span></button></td>
</tr>
</tbody>
</table>
Expand Down
8 changes: 8 additions & 0 deletions src/app/room/room-list/room-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,12 @@ export class RoomListComponent implements OnInit {
getAparmentName(Apart: Apartment): string {
return Apart.getName();
}
deleteApartment(roomId: string): void {
if (roomId) {
console.log('Room ID:', roomId);
this.router.navigate([`/room/${roomId}/delete`]);
} else {
console.error('Invalid room ID');
}
}
}

0 comments on commit 1a2607e

Please sign in to comment.