File size: 2,569 Bytes
3f2d5fb
 
c728863
 
6768f40
3f2d5fb
 
6768f40
 
3f2d5fb
 
6768f40
3f2d5fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6768f40
 
 
3f2d5fb
 
 
6768f40
 
 
3f2d5fb
 
 
6768f40
 
 
3f2d5fb
 
 
6768f40
 
 
3f2d5fb
6768f40
 
 
3f2d5fb
 
 
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
import streamlit as st
import pandas as pd
from task_operations import TaskManager
from task_visualization import TaskVisualizer


def main():
    
    st.title("Daily Task Tracker")

    task_manager = TaskManager()
    task_visualizer = TaskVisualizer()

    task_name = st.text_input("Task Name")
    task_time = st.time_input("Task Time")
    task_duration_hours = st.number_input("Task Duration (Hours)", min_value=0, step=1, format="%d")
    task_duration_minutes = st.number_input("Task Duration (Minutes)", min_value=0, max_value=59, step=1, format="%d")
    task_category = st.selectbox("Task Category", TaskManager.CATEGORIES)

    if st.button("Add Task"):
        task_manager.add_task(task_name, task_time, task_duration_hours, task_duration_minutes, task_category)
        st.success(f"Task '{task_name}' added!")

    if st.session_state.tasks:
        st.write("Today's Tasks:")
        df = pd.DataFrame(st.session_state.tasks)
        df['Task Duration (hours)'] = df['Task Duration (hours)'].astype(int)
        df['Task Duration (minutes)'] = df['Task Duration (minutes)'].astype(int)
        st.table(df[['Task Name', 'Task Time', 'Task Duration (hours)', 'Task Duration (minutes)', 'Category']])

        task_to_delete = st.text_input("Enter Task Name to Delete")
        if st.button("Delete Task"):
            if task_manager.delete_task_by_name(task_to_delete):
                st.success(f"Task '{task_to_delete}' deleted!")
            else:
                st.error(f"Task '{task_to_delete}' not found.")

    if st.button("Daily Report"):
        report = task_manager.generate_report('daily')
        st.write("Daily Report:")
        st.dataframe(report)
        task_visualizer.plot_category_performance('daily')

    if st.button("Weekly Report"):
        report = task_manager.generate_report('weekly')
        st.write("Weekly Report:")
        st.dataframe(report)
        task_visualizer.plot_category_performance('weekly')

    if st.button("Monthly Report"):
        report = task_manager.generate_report('monthly')
        st.write("Monthly Report:")
        st.dataframe(report)
        task_visualizer.plot_category_performance('monthly')

    if st.button("Yearly Report"):
        report = task_manager.generate_report('yearly')
        st.write("Yearly Report:")
        st.dataframe(report)
        task_visualizer.plot_category_performance('yearly')

    task_visualizer.plot_performance()
    task_visualizer.plot_overall_category_performance()
    task_manager.download_report()

if __name__ == "__main__":
    main()