-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
45 lines (39 loc) · 1.62 KB
/
main.py
File metadata and controls
45 lines (39 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Import necessary modules for the main functionality
from admin import Admin
from cart import Cart
from colors import c
from customer import Customer
from inventory import Inventory
# Define the main function to run the application
def main():
# Initialize inventory and cart objects
inventory = Inventory()
cart = Cart()
# Main loop for user selection
while True:
# Display the main menu options
print(f"{c.OKBLUE}\nSelection ==========================================={c.ENDC}")
print(f"{c.OKCYAN}[1]{c.ENDC} Order as a Customer")
print(f"{c.OKCYAN}[2]{c.ENDC} Access Inventory as Admin")
print(f"{c.OKCYAN}[3]{c.ENDC} Exit")
print(f"{c.OKBLUE}====================================================={c.ENDC}")
# Get user command
command = input(f"{c.OKGREEN}>> {c.ENDC}Enter command: ").strip()
if command == "3":
# Exit the program if command is 3
break
elif command == "1":
# Create a Customer object and enter customer selection if command is 1
customer = Customer(inventory, cart)
customer.customer_selection()
break # Exiting after customer selection; might need to loop instead
elif command == "2":
# Create an Admin object and enter admin management if command is 2
admin = Admin(inventory)
admin.manage_inventory()
else:
# Handle invalid command input
print(f"{c.FAIL}>> Invalid choice{c.ENDC}")
# Check if the script is run directly and call main function
if __name__ == "__main__":
main()