Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -61,6 +61,10 @@ def submit_attendance(name, day, date, status):
|
|
61 |
def generate_fees():
|
62 |
return calculate_fees()
|
63 |
|
|
|
|
|
|
|
|
|
64 |
with gr.Blocks() as app:
|
65 |
gr.Markdown("# Attendance Tracker")
|
66 |
|
@@ -73,10 +77,15 @@ with gr.Blocks() as app:
|
|
73 |
submit_button = gr.Button("Submit Attendance")
|
74 |
submit_message = gr.Textbox(label="Message", interactive=False)
|
75 |
|
76 |
-
calculate_button = gr.Button("Calculate Fees")
|
77 |
calculate_message = gr.Textbox(label="Fees Calculation Message", interactive=False)
|
78 |
|
79 |
submit_button.click(submit_attendance, inputs=[name, day, date, status], outputs=[submit_message])
|
80 |
calculate_button.click(generate_fees, outputs=[calculate_message])
|
81 |
|
|
|
|
|
|
|
|
|
|
|
82 |
app.launch()
|
|
|
61 |
def generate_fees():
|
62 |
return calculate_fees()
|
63 |
|
64 |
+
def is_month_end():
|
65 |
+
today = datetime.now()
|
66 |
+
return (today.day == (pd.Period(today.strftime("%Y-%m")).days_in_month))
|
67 |
+
|
68 |
with gr.Blocks() as app:
|
69 |
gr.Markdown("# Attendance Tracker")
|
70 |
|
|
|
77 |
submit_button = gr.Button("Submit Attendance")
|
78 |
submit_message = gr.Textbox(label="Message", interactive=False)
|
79 |
|
80 |
+
calculate_button = gr.Button("Calculate Fees", interactive=is_month_end())
|
81 |
calculate_message = gr.Textbox(label="Fees Calculation Message", interactive=False)
|
82 |
|
83 |
submit_button.click(submit_attendance, inputs=[name, day, date, status], outputs=[submit_message])
|
84 |
calculate_button.click(generate_fees, outputs=[calculate_message])
|
85 |
|
86 |
+
def update_calculate_button():
|
87 |
+
return gr.update(interactive=is_month_end())
|
88 |
+
|
89 |
+
app.load(update_calculate_button, None, [calculate_button])
|
90 |
+
|
91 |
app.launch()
|