Repository navigation
Expand file tree
/
Copy pathmenu.py
More file actions
66 lines (57 loc) · 1.77 KB
/
Copy pathmenu.py
File metadata and controls
66 lines (57 loc) · 1.77 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from utisils import library, issued
import login, add, issue, display, search, stats, returnbook
print("\n-----WELCOME TO THE LIBRARY MENU-----")
print("""
Library Fine Rules:
- First week delay: ₹10/day
- Second week: ₹20/day
- Third week: ₹60/day
- Fine increases progressively each week
""")
# First login OUTSIDE loop
role, current_user = login.login()
while role:
print(f"\n===== Library Menu ({role.upper()}) =====")
if role == "admin":
print("1. Add Book")
print("2. View Books")
print("3. Search Books")
print("4. Check Stats")
print("5. Switch to User")
print("6. Exit")
elif role == "user":
print("1. View Books")
print("2. Search Books")
print("3. Issue Book")
print("4. Return Book")
print("5. Switch to Admin")
print("6. Exit")
choice = input("Enter choice: ")
# ADMIN MENU
if role == "admin":
if choice == "1":
add.add()
elif choice == "2":
display.display()
elif choice == "3":
search.search(library)
elif choice == "4":
stats.stats()
elif choice == "5":
role, current_user = login.login() # switch role properly
elif choice == "6":
break
# USER MENU
elif role == "user":
if choice == "1":
display.display()
elif choice == "2":
search.search(library)
elif choice == "3":
issue.issue(library)
elif choice == "4":
returnbook.return_book(library)
elif choice == "5":
role, current_user = login.login() # switch role properly
elif choice == "6":
break