-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdmin_UI.py
79 lines (61 loc) · 2.95 KB
/
Admin_UI.py
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
67
68
69
70
71
72
73
74
75
76
77
78
79
from Bank import *
from Account import *
from AccountCreator import *
class Admin_UI:
def __init__(self, bank) -> None:
self.bank = bank
def admin_menu(self):
while True:
print("\n\n")
print("#############################################")
print("| Welcome Admin |")
print("#############################################")
print("1. Create an account\n2. Delete Account\n3. View All Accounts\n4. Check Total Balance\n5. Check Total Loan Amount\n6. Toggle Loan Feature\n7. Exit")
choice = input("Enter your choice: ")
if choice == '1':
print("---------------------------------")
print("Create a user account")
print("---------------------------------")
account = AccountCreator().create_account()
self.bank.create_account(account)
elif choice == '2':
print("---------------------------------")
print("Delete account")
print("---------------------------------")
account_number = int(input("Enter account number: "))
self.bank.delete_account(
account=self.bank.get_account(account_number))
elif choice == '3':
print("---------------------------------")
print("View all accounts")
print("---------------------------------")
print("All Accounts: ")
for account in self.bank.get_all_accounts():
print(account)
elif choice == '4':
print("---------------------------------")
print("Check total balance")
print("---------------------------------")
print("Total Balance: ", self.bank.get_total_balance())
elif choice == '5':
print("---------------------------------")
print("Check total loan amount")
print("---------------------------------")
print("Total Loan: ", self.bank.get_loan_amount())
elif choice == '6':
print("---------------------------------")
print("Toggle loan feature")
print("---------------------------------")
value = self.bank.get_loan_feature()
self.bank.set_loan_feature(value=not value)
print("Loan feature change to : ",
self.bank.get_loan_feature())
elif choice == '7':
print("---------------------------------")
print("Exiting Admin Panel.")
print("---------------------------------")
break
else:
print("---------------------------------")
print("Invalid choice. Please try again.")
print("---------------------------------")