Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,29 +5,56 @@ from datetime import datetime
|
|
| 5 |
import base64
|
| 6 |
from io import BytesIO
|
| 7 |
from PIL import Image
|
|
|
|
| 8 |
|
| 9 |
-
# Initialize Firebase
|
| 10 |
if not firebase_admin._apps:
|
| 11 |
cred = credentials.Certificate("firebase_credentials.json")
|
| 12 |
firebase_admin.initialize_app(cred, {
|
| 13 |
'databaseURL': 'https://binsight-beda0-default-rtdb.asia-southeast1.firebasedatabase.app/'
|
| 14 |
})
|
| 15 |
|
|
|
|
|
|
|
| 16 |
|
| 17 |
st.title("Binsight Driver Dashboard")
|
| 18 |
-
st.sidebar.header("Driver Login")
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
st.sidebar.success(f"Logged in as {driver_email}")
|
| 26 |
|
| 27 |
-
|
| 28 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
st.stop()
|
| 30 |
|
|
|
|
| 31 |
dustbins_ref = db.reference("dustbins")
|
| 32 |
dustbins = dustbins_ref.get() or {}
|
| 33 |
|
|
@@ -63,20 +90,28 @@ for key, value in allocated_tasks.items():
|
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
# import streamlit as st
|
| 69 |
# import firebase_admin
|
| 70 |
# from firebase_admin import credentials, db
|
| 71 |
# from datetime import datetime
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
-
# # Initialize Firebase
|
| 74 |
# if not firebase_admin._apps:
|
| 75 |
-
# cred = credentials.Certificate("firebase_credentials.json")
|
| 76 |
# firebase_admin.initialize_app(cred, {
|
| 77 |
# 'databaseURL': 'https://binsight-beda0-default-rtdb.asia-southeast1.firebasedatabase.app/'
|
| 78 |
# })
|
| 79 |
|
|
|
|
| 80 |
# st.title("Binsight Driver Dashboard")
|
| 81 |
# st.sidebar.header("Driver Login")
|
| 82 |
|
|
@@ -105,7 +140,10 @@ for key, value in allocated_tasks.items():
|
|
| 105 |
# with st.expander(f"π Task at {value['address']}"):
|
| 106 |
# st.write(f"**Latitude**: {value['latitude']}")
|
| 107 |
# st.write(f"**Longitude**: {value['longitude']}")
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
# if st.button(f"Mark as Done", key=f"done_{key}"):
|
| 111 |
# dustbins_ref.child(key).update({
|
|
@@ -120,127 +158,187 @@ for key, value in allocated_tasks.items():
|
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
-
# import streamlit as st
|
| 124 |
-
# import firebase_admin
|
| 125 |
-
# from firebase_admin import credentials, db
|
| 126 |
-
# from datetime import datetime
|
| 127 |
|
| 128 |
-
# # Initialize Firebase
|
| 129 |
-
# if not firebase_admin._apps:
|
| 130 |
-
# cred = credentials.Certificate("firebase_credentials.json") # Path to your Firebase JSON
|
| 131 |
-
# firebase_admin.initialize_app(cred, {
|
| 132 |
-
# 'databaseURL': 'https://binsight-beda0-default-rtdb.asia-southeast1.firebasedatabase.app/' # Replace with your Firebase Realtime Database URL
|
| 133 |
-
# })
|
| 134 |
|
| 135 |
-
# # Streamlit App
|
| 136 |
-
# st.title("Binsight Driver Dashboard")
|
| 137 |
-
# st.sidebar.header("Driver Login")
|
| 138 |
|
| 139 |
-
# #
|
| 140 |
-
# driver_email = st.sidebar.text_input("Enter your email")
|
| 141 |
-
# login_button = st.sidebar.button("Login")
|
| 142 |
|
| 143 |
-
#
|
| 144 |
-
#
|
| 145 |
-
#
|
| 146 |
-
#
|
| 147 |
-
# dustbins = dustbins_ref.get()
|
| 148 |
|
| 149 |
-
#
|
| 150 |
-
#
|
| 151 |
-
#
|
| 152 |
-
#
|
| 153 |
-
#
|
| 154 |
-
#
|
| 155 |
|
| 156 |
-
#
|
| 157 |
-
#
|
| 158 |
-
# for key, value in allocated_tasks.items():
|
| 159 |
-
# with st.expander(f"π Task at {value['address']}"):
|
| 160 |
-
# st.write(f"**Latitude**: {value['latitude']}")
|
| 161 |
-
# st.write(f"**Longitude**: {value['longitude']}")
|
| 162 |
-
# st.write(f"**Classification**: {', '.join([f'{k} ({v:.2f})' for k, v in value['classification'].items()])}")
|
| 163 |
-
# st.write(f"**Allocated At**: {value.get('allocated_at', 'N/A')}")
|
| 164 |
|
| 165 |
-
#
|
| 166 |
-
#
|
| 167 |
-
# dustbins_ref.child(key).update({
|
| 168 |
-
# "status": "Completed",
|
| 169 |
-
# "completed_at": str(datetime.now()),
|
| 170 |
-
# "completed_by": driver_email
|
| 171 |
-
# })
|
| 172 |
-
# st.success(f"Task at {value['address']} marked as completed!")
|
| 173 |
-
# else:
|
| 174 |
-
# st.info("No allocated tasks found.")
|
| 175 |
-
# else:
|
| 176 |
-
# st.error("Please enter your email to login.")
|
| 177 |
|
|
|
|
|
|
|
|
|
|
| 178 |
|
|
|
|
|
|
|
|
|
|
| 179 |
|
|
|
|
|
|
|
| 180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
|
|
|
|
| 182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
-
# import streamlit as st
|
| 190 |
-
# import firebase_admin
|
| 191 |
-
# from firebase_admin import credentials, db
|
| 192 |
-
# from datetime import datetime
|
| 193 |
|
| 194 |
-
# #
|
| 195 |
-
#
|
| 196 |
-
#
|
| 197 |
-
#
|
| 198 |
-
|
| 199 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
|
| 201 |
-
# # Streamlit App
|
| 202 |
-
# st.title("Binsight Driver Dashboard")
|
| 203 |
-
# st.sidebar.header("Driver Login")
|
| 204 |
|
| 205 |
-
# # Driver Login
|
| 206 |
-
# driver_email = st.sidebar.text_input("Enter your email", help="Provide your registered email.")
|
| 207 |
-
# login_button = st.sidebar.button("Login")
|
| 208 |
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
#
|
| 219 |
-
#
|
| 220 |
-
#
|
| 221 |
-
#
|
| 222 |
-
|
| 223 |
-
#
|
| 224 |
-
|
| 225 |
-
#
|
| 226 |
-
#
|
| 227 |
-
#
|
| 228 |
-
#
|
| 229 |
-
|
| 230 |
-
#
|
| 231 |
-
#
|
| 232 |
-
#
|
| 233 |
-
|
| 234 |
-
#
|
| 235 |
-
#
|
| 236 |
-
#
|
| 237 |
-
|
| 238 |
-
#
|
| 239 |
-
#
|
| 240 |
-
#
|
| 241 |
-
#
|
| 242 |
-
#
|
| 243 |
-
|
| 244 |
-
#
|
| 245 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
|
|
|
|
| 5 |
import base64
|
| 6 |
from io import BytesIO
|
| 7 |
from PIL import Image
|
| 8 |
+
import requests
|
| 9 |
|
| 10 |
+
# Initialize Firebase Realtime Database
|
| 11 |
if not firebase_admin._apps:
|
| 12 |
cred = credentials.Certificate("firebase_credentials.json")
|
| 13 |
firebase_admin.initialize_app(cred, {
|
| 14 |
'databaseURL': 'https://binsight-beda0-default-rtdb.asia-southeast1.firebasedatabase.app/'
|
| 15 |
})
|
| 16 |
|
| 17 |
+
# Firebase Authentication REST API
|
| 18 |
+
FIREBASE_AUTH_URL = "https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=AIzaSyAj-0voQamIhPvnWZPd_SwkhlOR1pXynvg"
|
| 19 |
|
| 20 |
st.title("Binsight Driver Dashboard")
|
|
|
|
| 21 |
|
| 22 |
+
# Session state for authentication
|
| 23 |
+
if "authenticated" not in st.session_state:
|
| 24 |
+
st.session_state.authenticated = False
|
| 25 |
+
if "driver_email" not in st.session_state:
|
| 26 |
+
st.session_state.driver_email = None
|
| 27 |
|
| 28 |
+
# Authentication UI
|
| 29 |
+
st.sidebar.header("Driver Login")
|
|
|
|
| 30 |
|
| 31 |
+
def login():
|
| 32 |
+
email = st.sidebar.text_input("Enter your email")
|
| 33 |
+
password = st.sidebar.text_input("Enter your password", type="password")
|
| 34 |
+
if st.sidebar.button("Login"):
|
| 35 |
+
payload = {"email": email, "password": password, "returnSecureToken": True}
|
| 36 |
+
response = requests.post(FIREBASE_AUTH_URL, json=payload)
|
| 37 |
+
if response.status_code == 200:
|
| 38 |
+
st.session_state.authenticated = True
|
| 39 |
+
st.session_state.driver_email = email
|
| 40 |
+
st.sidebar.success(f"Logged in as {email}")
|
| 41 |
+
st.rerun()
|
| 42 |
+
else:
|
| 43 |
+
st.sidebar.error("Invalid credentials or user does not exist.")
|
| 44 |
+
|
| 45 |
+
# Logout functionality
|
| 46 |
+
def logout():
|
| 47 |
+
st.session_state.authenticated = False
|
| 48 |
+
st.session_state.driver_email = None
|
| 49 |
+
st.rerun()
|
| 50 |
+
|
| 51 |
+
if st.session_state.authenticated:
|
| 52 |
+
st.sidebar.button("Logout", on_click=logout)
|
| 53 |
+
else:
|
| 54 |
+
login()
|
| 55 |
st.stop()
|
| 56 |
|
| 57 |
+
# Fetch allocated tasks
|
| 58 |
dustbins_ref = db.reference("dustbins")
|
| 59 |
dustbins = dustbins_ref.get() or {}
|
| 60 |
|
|
|
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
## Below code is working but it is doesn't having login proper for user. anyone can login
|
| 97 |
+
|
| 98 |
|
| 99 |
# import streamlit as st
|
| 100 |
# import firebase_admin
|
| 101 |
# from firebase_admin import credentials, db
|
| 102 |
# from datetime import datetime
|
| 103 |
+
# import base64
|
| 104 |
+
# from io import BytesIO
|
| 105 |
+
# from PIL import Image
|
| 106 |
|
| 107 |
+
# # Initialize Firebase (Check if already initialized)
|
| 108 |
# if not firebase_admin._apps:
|
| 109 |
+
# cred = credentials.Certificate("firebase_credentials.json")
|
| 110 |
# firebase_admin.initialize_app(cred, {
|
| 111 |
# 'databaseURL': 'https://binsight-beda0-default-rtdb.asia-southeast1.firebasedatabase.app/'
|
| 112 |
# })
|
| 113 |
|
| 114 |
+
|
| 115 |
# st.title("Binsight Driver Dashboard")
|
| 116 |
# st.sidebar.header("Driver Login")
|
| 117 |
|
|
|
|
| 140 |
# with st.expander(f"π Task at {value['address']}"):
|
| 141 |
# st.write(f"**Latitude**: {value['latitude']}")
|
| 142 |
# st.write(f"**Longitude**: {value['longitude']}")
|
| 143 |
+
|
| 144 |
+
# if "image" in value:
|
| 145 |
+
# image_data = base64.b64decode(value["image"])
|
| 146 |
+
# st.image(Image.open(BytesIO(image_data)), caption="Dustbin Image", use_column_width=True)
|
| 147 |
|
| 148 |
# if st.button(f"Mark as Done", key=f"done_{key}"):
|
| 149 |
# dustbins_ref.child(key).update({
|
|
|
|
| 158 |
|
| 159 |
|
| 160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
|
|
|
|
|
|
|
|
|
| 163 |
|
| 164 |
+
# # Best without image
|
|
|
|
|
|
|
| 165 |
|
| 166 |
+
# # import streamlit as st
|
| 167 |
+
# # import firebase_admin
|
| 168 |
+
# # from firebase_admin import credentials, db
|
| 169 |
+
# # from datetime import datetime
|
|
|
|
| 170 |
|
| 171 |
+
# # # Initialize Firebase
|
| 172 |
+
# # if not firebase_admin._apps:
|
| 173 |
+
# # cred = credentials.Certificate("firebase_credentials.json")
|
| 174 |
+
# # firebase_admin.initialize_app(cred, {
|
| 175 |
+
# # 'databaseURL': 'https://binsight-beda0-default-rtdb.asia-southeast1.firebasedatabase.app/'
|
| 176 |
+
# # })
|
| 177 |
|
| 178 |
+
# # st.title("Binsight Driver Dashboard")
|
| 179 |
+
# # st.sidebar.header("Driver Login")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
|
| 181 |
+
# # driver_email = st.sidebar.text_input("Enter your email")
|
| 182 |
+
# # login_button = st.sidebar.button("Login")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
|
| 184 |
+
# # if login_button and driver_email:
|
| 185 |
+
# # st.session_state["driver_email"] = driver_email
|
| 186 |
+
# # st.sidebar.success(f"Logged in as {driver_email}")
|
| 187 |
|
| 188 |
+
# # if "driver_email" not in st.session_state:
|
| 189 |
+
# # st.warning("Please log in first.")
|
| 190 |
+
# # st.stop()
|
| 191 |
|
| 192 |
+
# # dustbins_ref = db.reference("dustbins")
|
| 193 |
+
# # dustbins = dustbins_ref.get() or {}
|
| 194 |
|
| 195 |
+
# # allocated_tasks = {
|
| 196 |
+
# # key: value for key, value in dustbins.items()
|
| 197 |
+
# # if value.get("allocated_truck") == st.session_state["driver_email"] and value.get("status") == "Allocated"
|
| 198 |
+
# # }
|
| 199 |
|
| 200 |
+
# # st.subheader(f"Allocated Tasks ({len(allocated_tasks)})")
|
| 201 |
|
| 202 |
+
# # for key, value in allocated_tasks.items():
|
| 203 |
+
# # with st.expander(f"π Task at {value['address']}"):
|
| 204 |
+
# # st.write(f"**Latitude**: {value['latitude']}")
|
| 205 |
+
# # st.write(f"**Longitude**: {value['longitude']}")
|
| 206 |
+
# # st.write(f"**Classification**: {', '.join([f'{k} ({v:.2f})' for k, v in value['classification'].items()])}")
|
| 207 |
|
| 208 |
+
# # if st.button(f"Mark as Done", key=f"done_{key}"):
|
| 209 |
+
# # dustbins_ref.child(key).update({
|
| 210 |
+
# # "status": "Completed",
|
| 211 |
+
# # "completed_at": str(datetime.now()),
|
| 212 |
+
# # "completed_by": st.session_state["driver_email"]
|
| 213 |
+
# # })
|
| 214 |
+
# # st.success(f"Task at {value['address']} marked as completed!")
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
|
| 221 |
+
# # import streamlit as st
|
| 222 |
+
# # import firebase_admin
|
| 223 |
+
# # from firebase_admin import credentials, db
|
| 224 |
+
# # from datetime import datetime
|
| 225 |
+
|
| 226 |
+
# # # Initialize Firebase
|
| 227 |
+
# # if not firebase_admin._apps:
|
| 228 |
+
# # cred = credentials.Certificate("firebase_credentials.json") # Path to your Firebase JSON
|
| 229 |
+
# # firebase_admin.initialize_app(cred, {
|
| 230 |
+
# # 'databaseURL': 'https://binsight-beda0-default-rtdb.asia-southeast1.firebasedatabase.app/' # Replace with your Firebase Realtime Database URL
|
| 231 |
+
# # })
|
| 232 |
+
|
| 233 |
+
# # # Streamlit App
|
| 234 |
+
# # st.title("Binsight Driver Dashboard")
|
| 235 |
+
# # st.sidebar.header("Driver Login")
|
| 236 |
+
|
| 237 |
+
# # # Driver Login
|
| 238 |
+
# # driver_email = st.sidebar.text_input("Enter your email")
|
| 239 |
+
# # login_button = st.sidebar.button("Login")
|
| 240 |
+
|
| 241 |
+
# # if login_button:
|
| 242 |
+
# # if driver_email:
|
| 243 |
+
# # # Fetch allocated tasks from Firebase
|
| 244 |
+
# # dustbins_ref = db.reference("dustbins")
|
| 245 |
+
# # dustbins = dustbins_ref.get()
|
| 246 |
+
|
| 247 |
+
# # # Filter tasks for the logged-in driver
|
| 248 |
+
# # allocated_tasks = {
|
| 249 |
+
# # key: value
|
| 250 |
+
# # for key, value in dustbins.items()
|
| 251 |
+
# # if value.get("allocated_truck") == driver_email and value.get("status") == "Allocated"
|
| 252 |
+
# # }
|
| 253 |
+
|
| 254 |
+
# # if allocated_tasks:
|
| 255 |
+
# # st.subheader(f"Allocated Tasks ({len(allocated_tasks)})")
|
| 256 |
+
# # for key, value in allocated_tasks.items():
|
| 257 |
+
# # with st.expander(f"π Task at {value['address']}"):
|
| 258 |
+
# # st.write(f"**Latitude**: {value['latitude']}")
|
| 259 |
+
# # st.write(f"**Longitude**: {value['longitude']}")
|
| 260 |
+
# # st.write(f"**Classification**: {', '.join([f'{k} ({v:.2f})' for k, v in value['classification'].items()])}")
|
| 261 |
+
# # st.write(f"**Allocated At**: {value.get('allocated_at', 'N/A')}")
|
| 262 |
+
|
| 263 |
+
# # # Submit Work Done
|
| 264 |
+
# # if st.button(f"Mark as Done", key=f"done_{key}"):
|
| 265 |
+
# # dustbins_ref.child(key).update({
|
| 266 |
+
# # "status": "Completed",
|
| 267 |
+
# # "completed_at": str(datetime.now()),
|
| 268 |
+
# # "completed_by": driver_email
|
| 269 |
+
# # })
|
| 270 |
+
# # st.success(f"Task at {value['address']} marked as completed!")
|
| 271 |
+
# # else:
|
| 272 |
+
# # st.info("No allocated tasks found.")
|
| 273 |
+
# # else:
|
| 274 |
+
# # st.error("Please enter your email to login.")
|
| 275 |
|
|
|
|
|
|
|
|
|
|
| 276 |
|
|
|
|
|
|
|
|
|
|
| 277 |
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
# # import streamlit as st
|
| 288 |
+
# # import firebase_admin
|
| 289 |
+
# # from firebase_admin import credentials, db
|
| 290 |
+
# # from datetime import datetime
|
| 291 |
+
|
| 292 |
+
# # # Initialize Firebase
|
| 293 |
+
# # if not firebase_admin._apps:
|
| 294 |
+
# # cred = credentials.Certificate("firebase_credentials.json") # Path to your Firebase JSON
|
| 295 |
+
# # firebase_admin.initialize_app(cred, {
|
| 296 |
+
# # 'databaseURL': 'https://binsight-beda0-default-rtdb.asia-southeast1.firebasedatabase.app/' # Replace with your Firebase Realtime Database URL
|
| 297 |
+
# # })
|
| 298 |
+
|
| 299 |
+
# # # Streamlit App
|
| 300 |
+
# # st.title("Binsight Driver Dashboard")
|
| 301 |
+
# # st.sidebar.header("Driver Login")
|
| 302 |
+
|
| 303 |
+
# # # Driver Login
|
| 304 |
+
# # driver_email = st.sidebar.text_input("Enter your email", help="Provide your registered email.")
|
| 305 |
+
# # login_button = st.sidebar.button("Login")
|
| 306 |
+
|
| 307 |
+
# # if login_button:
|
| 308 |
+
# # if driver_email:
|
| 309 |
+
# # # Fetch allocated tasks from Firebase
|
| 310 |
+
# # dustbins_ref = db.reference("dustbins")
|
| 311 |
+
# # dustbins = dustbins_ref.get()
|
| 312 |
+
|
| 313 |
+
# # if not dustbins:
|
| 314 |
+
# # st.info("No tasks available.")
|
| 315 |
+
# # else:
|
| 316 |
+
# # # Filter tasks for the logged-in driver
|
| 317 |
+
# # allocated_tasks = {
|
| 318 |
+
# # key: value
|
| 319 |
+
# # for key, value in dustbins.items()
|
| 320 |
+
# # if value.get("allocated_truck") == driver_email and value.get("status") == "Allocated"
|
| 321 |
+
# # }
|
| 322 |
+
|
| 323 |
+
# # if allocated_tasks:
|
| 324 |
+
# # st.subheader(f"Allocated Tasks ({len(allocated_tasks)})")
|
| 325 |
+
# # for key, value in allocated_tasks.items():
|
| 326 |
+
# # with st.expander(f"π Task at {value['address']}"):
|
| 327 |
+
# # st.write(f"**Latitude**: {value['latitude']}")
|
| 328 |
+
# # st.write(f"**Longitude**: {value['longitude']}")
|
| 329 |
+
# # st.write(f"**Classification**: {', '.join([f'{k} ({v:.2f})' for k, v in value['classification'].items()])}")
|
| 330 |
+
# # st.write(f"**Allocated At**: {value.get('allocated_at', 'N/A')}")
|
| 331 |
+
|
| 332 |
+
# # # Submit Work Done
|
| 333 |
+
# # if st.button(f"Mark as Done", key=f"done_{key}"):
|
| 334 |
+
# # dustbins_ref.child(key).update({
|
| 335 |
+
# # "status": "Completed",
|
| 336 |
+
# # "completed_at": str(datetime.now()),
|
| 337 |
+
# # "completed_by": driver_email,
|
| 338 |
+
# # })
|
| 339 |
+
# # st.success(f"Task at {value['address']} marked as completed!")
|
| 340 |
+
# # else:
|
| 341 |
+
# # st.info("No allocated tasks found for your account.")
|
| 342 |
+
# # else:
|
| 343 |
+
# # st.error("Please enter your email to login.")
|
| 344 |
|