Project Pizzeria is a web application that simulates a pizza ordering and reservation system. It is built using JavaScript, HTML, and CSS.
The application is structured around several key classes:
Represents a product, such as a pizza, with properties for id, name, price, and ingredients. It also has methods for rendering the product in the UI and handling user actions like adding to the cart.
Represents a shopping cart, with properties for the DOM element and the array of CartProduct instances. It has methods for adding products, updating the total price, and submitting the order.
Represents a booking, with properties for the DOM element, the booking details, and the array of Booking instances. It has methods for making a reservation, rendering it in the UI, and handling user actions like selecting a table.
Represents the home page, with properties for the DOM element and methods for rendering the page in the UI.
The application communicates with a server to retrieve and update data. Here are the key endpoints:
- GET /api/db: Retrieves the entire database, including the list of products and bookings.
- POST /api/:subpage: Sends a new order or booking to the server. The
:subpage
parameter can be eitherorder
orbooking
.
Please refer to the Project Pizzeria API Documentation for more details on the endpoints and how to use them.
activatePage(pageId: string)
: Activates the page with the givenpageId
. It adds the "active" class to the matching page and link, and removes it from all others.
id: string
: The unique identifier for the product.name: string
: The name of the product.price: number
: The price of the product.ingredients: array
: The ingredients of the product.
renderInUI()
: Renders the product in the user interface.
domElement: object
: The DOM element representing the cart.products: array
: An array of CartProduct instances representing the products in the cart.
addProduct(product: object)
: Adds a product to the cart.updateTotalPrice()
: Updates the total price of the cart.submitOrder()
: Submits the order.
domElement: object
: The DOM element representing the booking.bookingDetails: object
: The details of the booking.bookings: array
: An array of Booking instances representing all bookings.
makeReservation()
: Makes a reservation.renderInUI()
: Renders the booking in the user interface.
domElement: object
: The DOM element representing the home page.
renderInUI()
: Renders the home page in the user interface.
Version 2.4