-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
47 lines (42 loc) · 1.66 KB
/
Copy pathapp.py
File metadata and controls
47 lines (42 loc) · 1.66 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
import streamlit as st
import pandas as pd
from db import init_db, add_activity, get_all_activities
init_db()
st.set_page_config(page_title='Team Daily Activity Tracker', layout='wide')
PREDEFINED_TASK = {
"Admin": ["Email", "Documentation", "Internal Corordination", "Zoom"],
"Internal Meeting": ["Team Meeting", "121 Meeting", "Project Meeting"],
"Other": ["Other Task"]
}
CATEGORIES = list(PREDEFINED_TASK.keys())
st.title("Team Daily Activity Tracker")
tab1, tab2, tab3 = st.tabs(["Add Activity", "View Activity", "Summary"])
with tab1:
st.subheader("Add Daily Activity")
with st.form("activity_form"):
employee_name = st.text_input("Employee Name")
activity_date = st.date_input("Activity Date")
category = st.selectbox("Category", CATEGORIES)
task_type = st.selectbox("Task Type", ["Predefined Task", "Other"])
if task_type == "Predefined Task":
task_name = st.selectbox("Task Name", PREDEFINED_TASK[category])
else:
task_name = st.text_input("Task Name")
duration_hour = st.number_input("Duration Hours")
notes = st.text_area("Notes / Details")
submitted = st.form_submit_button("Save Activity")
if submitted:
add_activity(
employee_name = employee_name,
activity_date = str(activity_date),
category = category,
task_type = task_type,
task_name = task_name,
duration_hour = duration_hour,
notes = notes
)
st.success("Activity saved successfully!")
with tab3:
rows = get_all_activities()
df = pd.DataFrame([dict(row) for row in rows])
st.dataframe(df)