Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
from datetime import datetime
|
| 4 |
+
|
| 5 |
+
# Initialize task database
|
| 6 |
+
if 'tasks' not in st.session_state:
|
| 7 |
+
st.session_state.tasks = pd.DataFrame(columns=[
|
| 8 |
+
'Title', 'Description', 'Assignee', 'Status', 'Due Date'
|
| 9 |
+
])
|
| 10 |
+
|
| 11 |
+
# Sidebar for new tasks
|
| 12 |
+
with st.sidebar:
|
| 13 |
+
st.header("➕ Add New Task")
|
| 14 |
+
title = st.text_input("Task Title")
|
| 15 |
+
description = st.text_area("Description")
|
| 16 |
+
assignee = st.text_input("Assignee")
|
| 17 |
+
status = st.selectbox("Status", ["To Do", "In Progress", "Done"])
|
| 18 |
+
due_date = st.date_input("Due Date")
|
| 19 |
+
|
| 20 |
+
if st.button("Add Task"):
|
| 21 |
+
new_task = {
|
| 22 |
+
'Title': title,
|
| 23 |
+
'Description': description,
|
| 24 |
+
'Assignee': assignee,
|
| 25 |
+
'Status': status,
|
| 26 |
+
'Due Date': due_date
|
| 27 |
+
}
|
| 28 |
+
st.session_state.tasks = pd.concat([
|
| 29 |
+
st.session_state.tasks,
|
| 30 |
+
pd.DataFrame([new_task])
|
| 31 |
+
], ignore_index=True)
|
| 32 |
+
|
| 33 |
+
# Main display
|
| 34 |
+
st.title("Company Task Board 🗒️")
|
| 35 |
+
st.divider()
|
| 36 |
+
|
| 37 |
+
# Display tasks
|
| 38 |
+
for idx, task in st.session_state.tasks.iterrows():
|
| 39 |
+
with st.expander(f"{task['Title']} - {task['Status']}"):
|
| 40 |
+
st.markdown(f"""
|
| 41 |
+
**Assignee:** {task['Assignee']}
|
| 42 |
+
**Due Date:** {task['Due Date']}
|
| 43 |
+
**Description:**
|
| 44 |
+
{task['Description']}
|
| 45 |
+
""")
|
| 46 |
+
|
| 47 |
+
# Status update
|
| 48 |
+
new_status = st.selectbox(
|
| 49 |
+
"Update Status",
|
| 50 |
+
["To Do", "In Progress", "Done"],
|
| 51 |
+
key=f"status_{idx}"
|
| 52 |
+
)
|
| 53 |
+
if new_status != task['Status']:
|
| 54 |
+
st.session_state.tasks.at[idx, 'Status'] = new_status
|
| 55 |
+
st.rerun()
|