Skip to content

Commit f1381aa

Browse files
committed
add total money page in admin side
1 parent e1a26bf commit f1381aa

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

bank_managment_system/QTFrontend.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,37 @@ def show_employee_list_page(parent, title):
478478
main_layout.addWidget(content_frame)
479479

480480
return page
481+
def show_total_money(parent, title):
482+
page, main_layout = create_page_with_header(parent, title)
483+
484+
content_frame = create_styled_frame(page, style="background-color: #f9f9f9; border-radius: 10px; padding: 15px;")
485+
content_layout = QtWidgets.QVBoxLayout(content_frame)
486+
content_layout.setProperty("spacing", 10)
487+
all = backend.all_money()
488+
489+
# Total money label
490+
total_money_label = QtWidgets.QLabel(f"Total Money: ${all}", content_frame)
491+
total_money_label.setStyleSheet("font-size: 24px; font-weight: bold; color: #333333;")
492+
content_layout.addWidget(total_money_label, alignment=QtCore.Qt.AlignCenter)
493+
# Back button
494+
back_button = QtWidgets.QPushButton("Back", content_frame)
495+
back_button.setStyleSheet("""
496+
QPushButton {
497+
background-color: #6c757d;
498+
color: white;
499+
border: none;
500+
border-radius: 4px;
501+
padding: 8px 16px;
502+
font-size: 14px;
503+
}
504+
QPushButton:hover {
505+
background-color: #5a6268;
506+
}
507+
""")
508+
back_button.clicked.connect(lambda: parent.setCurrentIndex(3))
509+
content_layout.addWidget(back_button, alignment=QtCore.Qt.AlignCenter)
510+
main_layout.addWidget(content_frame)
511+
return page
481512

482513
def setup_main_window(main_window):
483514
"""Set up the main window with a stacked widget containing home, admin, and employee pages."""
@@ -578,6 +609,8 @@ def update_employee_data(name, password, salary, position, name_to_update):
578609
add_button.clicked.connect(lambda: stacked_widget.setCurrentIndex(4))
579610
update_button.clicked.connect(lambda: stacked_widget.setCurrentIndex(5))
580611
list_button.clicked.connect(lambda: stacked_widget.setCurrentIndex(7))
612+
back_button.clicked.connect(lambda: stacked_widget.setCurrentIndex(0))
613+
money_button.clicked.connect(lambda: stacked_widget.setCurrentIndex(8))
581614
# Create Add Employee Page
582615
add_employee_page, emp_name, emp_password, emp_salary, emp_position, emp_submit = create_add_employee_page(
583616
stacked_widget,
@@ -645,7 +678,6 @@ def update_employee_data(name, password, salary, position, name_to_update):
645678
)
646679
)
647680

648-
649681

650682
emp_submit.clicked.connect(
651683
lambda: add_employee_form_submit(
@@ -663,7 +695,7 @@ def update_employee_data(name, password, salary, position, name_to_update):
663695
stacked_widget,
664696
title="Employee Login"
665697
)
666-
698+
admin_total_money = show_total_money(stacked_widget,"Total Money")
667699

668700
# Add pages to stacked widget
669701
stacked_widget.addWidget(home_page)#0
@@ -674,6 +706,8 @@ def update_employee_data(name, password, salary, position, name_to_update):
674706
stacked_widget.addWidget(update_employee_page1)#5
675707
stacked_widget.addWidget(update_employee_page2)#6
676708
stacked_widget.addWidget(employee_list_page)#7
709+
stacked_widget.addWidget(admin_total_money)#8
710+
677711

678712

679713
main_layout.addWidget(stacked_widget)

0 commit comments

Comments
 (0)