The exercise aims to develop a hotel management application that centralizes real-time tracking of room availability, check-ins/check-outs, and customer booking records to streamline operations.
The rooms are identified by number and have a floor and a type. A room cannot be rented to more customers at the same time.
The hotel manager will have access to view all available rooms and the dates they are open for booking.
When a customer checks in, the hotel manager will register the customer in the room for a specific interval of dates.
Both "booking_state" and "accommodation_state" are used to track the lifecycle of reservations and actual stays, respectively. Each state helps in managing the workflow efficiently and ensuring clarity in operations.
For example, "booking_state" can have: "Pending", "Canceled", "Confirmed", and "Completed". Also, the "accommodation_state" can have: "Checked-in" and "Checked-out".
In entities like "booking_state" and "accommodation_state", name represents the state that will be displayed on the screen, label represents the value that programmers will use to filter the states, and the uuid represents a value to uniquely distinguish the states.
Accommodations are completed bookings, tracking the actual check-in and check-out dates and calculating the total price based on the number of days stayed.
When the booking is created, it will automatically become "Pending".
The field "Booking state" from entity "booking" will be read-only in edit view.
Create a catalog for entities: "room", "customer", "room_type", "booking_state" and "accommodation_state".
Create event listeners for tables that need validations (e.g., adding a customer without a name, a room without a number, etc., should not be allowed).
In the room search view, modify the fetch to specify if the room is available or not.
When creating a booking:
Validate that the following fields are completed: "check_in_date", "check_out_date", and "room_type".
If these fields are completed, check if there is a room available with the specified room type for the given period:
If a room is available, assign the room (id_room) to the booking.
If no rooms are available → validation message.
Calculate the total price based on the room type and the number of nights.
Add a new entity action at the booking level (Confirm booking):
It will require to input the customer (with navigation to create a new customer if needed).
It will change the booking state to "Confirmed" and assign the customer to the booking.
Add a new entity action at the booking level (Cancel booking):
It will change the booking state to "Canceled".
A booking cannot be canceled if it is in the "Confirmed" state or if already canceled → validation message.
Add a new entity action at the booking level (Check-in):
Create an accommodation from the selected booking with the "check_in_date" set to the current date (check the datetime package).
Set the accommodation state to "Checked-in".
Change the booking state to "Completed".
Add a new entity action at the acommodation level (Check-out):
It will change the accommodation state to "Checked-out".
Room report: room situation at room level (total number of bookings on each room_type with possibility to be filtered by a period of time).
Customer report: Booking situation at customer level (total number of bookings with possibility to be filtered by a period of time, customer details).