Methods
addExtra(items)
Adds extra items to the order and updates the bill amount.
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array | List of extra items to add. |
- Source:
addItems(item) → {void}
Adds a new item to the list of items and recalculates the bill amount.
This function pushes the provided item to the `items` array and invokes
the `calculateBillAmount()` method to ensure the total bill amount is updated
whenever a new item is added. It assumes the `items` array is an existing
array holding the list of items and `calculateBillAmount()` is a method
that performs the necessary calculation based on the current items.
Parameters:
| Name | Type | Description |
|---|---|---|
item |
Object | The item to be added to the bill. This should be an object representing the item, such as an item with properties like `name`, `price`, etc. |
- Source:
Returns:
- Type
- void
calculateBillAmount()
Calculates the total bill amount based on items and discount.
- Source:
cancelItem(item)
Cancels an item from the order and moves it to the canceled items list.
Parameters:
| Name | Type | Description |
|---|---|---|
item |
Objects | Item to be canceled. |
- Source:
cancelOrder()
Cancels the order by updating its status.
- Source:
confirmRequestedItems()
conforms the requested items and adds them to the main order items.
- Source:
setDiscount(amount)
Sets a discounts for the order and calculates the bill amount.
Parameters:
| Name | Type | Description |
|---|---|---|
amount |
number | Discount amount to apply. |
- Source: