File size: 5,035 Bytes
07ab4a7
 
 
 
 
 
 
567844e
 
 
 
 
07ab4a7
 
567844e
 
 
 
 
07ab4a7
 
 
 
 
 
 
 
 
 
 
 
567844e
 
 
 
 
07ab4a7
 
 
 
 
 
 
 
 
 
567844e
 
 
 
 
07ab4a7
 
 
 
 
 
 
 
 
 
567844e
 
 
 
 
07ab4a7
 
567844e
 
 
 
 
07ab4a7
 
567844e
07ab4a7
 
 
 
 
 
 
 
 
 
 
 
 
567844e
 
 
 
 
07ab4a7
 
 
 
 
 
 
 
567844e
 
 
 
 
07ab4a7
 
 
567844e
 
 
 
 
07ab4a7
 
 
 
 
 
 
 
 
 
 
567844e
07ab4a7
 
 
 
 
 
 
 
 
 
 
 
567844e
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import streamlit as st
import pandas as pd
import datetime
from PIL import Image

# Title and Description
st.markdown("""
<div style="text-align: center; font-family: Arial; padding: 10px; background-color: #4CAF50; color: white;">
    <h1>Smart Project Tracker</h1>
    <p>Keep your construction projects on track with real-time updates and insights.</p>
</div>
""", unsafe_allow_html=True)

# Sidebar for Navigation
st.sidebar.markdown("""
<div style="font-family: Arial; font-size: 16px;">
    <h2>Navigation</h2>
</div>
""", unsafe_allow_html=True)
page = st.sidebar.radio("Go to", ["Track Progress", "Monitor Milestones", "Generate Reports"])

# Data Containers
if "progress_data" not in st.session_state:
    st.session_state.progress_data = []
if "milestones_data" not in st.session_state:
    st.session_state.milestones_data = []
if "budget_data" not in st.session_state:
    st.session_state.budget_data = []

# Track Progress
if page == "Track Progress":
    st.markdown("""
    <div style="background-color: #f0f0f0; padding: 15px; border-radius: 5px;">
        <h2>Track Construction Progress</h2>
    </div>
    """, unsafe_allow_html=True)
    
    # Upload Section
    uploaded_file = st.file_uploader("Upload a photo or video of the site", type=["jpg", "jpeg", "png", "mp4", "mov"])
    if uploaded_file:
        file_type = "Video" if uploaded_file.type.startswith("video") else "Image"
        date = datetime.date.today()
        st.session_state.progress_data.append({"Date": date, "Type": file_type, "File": uploaded_file})
        st.success("File uploaded successfully!")

    # Display Progress Updates
    st.markdown("""
    <div style="background-color: #e8f5e9; padding: 10px; border-radius: 5px;">
        <h3>Progress Updates</h3>
    </div>
    """, unsafe_allow_html=True)
    for entry in st.session_state.progress_data:
        st.write(f"**Date:** {entry['Date']} | **Type:** {entry['Type']}")
        if entry['Type'] == "Image":
            image = Image.open(entry['File'])
            st.image(image, caption="Site Progress")
        else:
            st.video(entry['File'])

# Monitor Milestones
elif page == "Monitor Milestones":
    st.markdown("""
    <div style="background-color: #f0f0f0; padding: 15px; border-radius: 5px;">
        <h2>Monitor Milestones, Budgets, and Deadlines</h2>
    </div>
    """, unsafe_allow_html=True)
    
    # Add Milestones
    st.markdown("""
    <div style="background-color: #e3f2fd; padding: 10px; border-radius: 5px;">
        <h3>Add a Milestone</h3>
    </div>
    """, unsafe_allow_html=True)
    milestone_name = st.text_input("Milestone Name")
    milestone_date = st.date_input("Deadline")
    milestone_budget = st.number_input("Budget (in PKR)", min_value=0.0, step=100.0)
    
    if st.button("Add Milestone"):
        if milestone_name and milestone_date:
            st.session_state.milestones_data.append({
                "Name": milestone_name,
                "Deadline": milestone_date,
                "Budget": milestone_budget
            })
            st.success("Milestone added successfully!")
        else:
            st.error("Please provide all milestone details.")

    # Display Milestones
    st.markdown("""
    <div style="background-color: #fffde7; padding: 10px; border-radius: 5px;">
        <h3>Upcoming Milestones</h3>
    </div>
    """, unsafe_allow_html=True)
    milestones_df = pd.DataFrame(st.session_state.milestones_data)
    if not milestones_df.empty:
        st.table(milestones_df)
    else:
        st.write("No milestones added yet.")

# Generate Reports
elif page == "Generate Reports":
    st.markdown("""
    <div style="background-color: #f0f0f0; padding: 15px; border-radius: 5px;">
        <h2>Generate Automated Reports</h2>
    </div>
    """, unsafe_allow_html=True)
    
    # Generate Summary Report
    if st.button("Generate Report"):
        st.markdown("""
        <div style="background-color: #e8f5e9; padding: 10px; border-radius: 5px;">
            <h3>Project Summary Report</h3>
        </div>
        """, unsafe_allow_html=True)
        
        # Milestone Summary
        st.markdown("### Milestones")
        milestones_df = pd.DataFrame(st.session_state.milestones_data)
        if not milestones_df.empty:
            st.table(milestones_df)
        else:
            st.write("No milestones available.")
        
        # Budget Summary
        total_budget = milestones_df["Budget"].sum() if not milestones_df.empty else 0
        st.markdown(f"### Total Budget: PKR {total_budget}")
        
        # Progress Summary
        st.markdown("### Progress Updates")
        for entry in st.session_state.progress_data:
            st.write(f"**Date:** {entry['Date']} | **Type:** {entry['Type']}")
            if entry['Type'] == "Image":
                image = Image.open(entry['File'])
                st.image(image, caption="Site Progress")
            else:
                st.video(entry['File'])

st.sidebar.info("Developed for effective project management.")