Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,9 +58,35 @@ if not st.session_state.is_logged_in:
|
|
| 58 |
# -----------------------------------------
|
| 59 |
# ู
ูุฏู
ุงูุดููู
|
| 60 |
elif st.session_state.user_type == "sender":
|
| 61 |
-
st.
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
st.session_state["complaint_input"] = ""
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
complaint_text = st.text_area("๐ ูุตู ุงูุดููู", key="complaint_input")
|
| 66 |
if st.button("๐ค ุฅุฑุณุงู ุงูุดููู"):
|
|
|
|
| 58 |
# -----------------------------------------
|
| 59 |
# ู
ูุฏู
ุงูุดููู
|
| 60 |
elif st.session_state.user_type == "sender":
|
| 61 |
+
complaint_text = st.text_area("๐ ูุตู ุงูุดููู", key="complaint_input")
|
| 62 |
+
|
| 63 |
+
if st.button("๐ค ุฅุฑุณุงู ุงูุดููู"):
|
| 64 |
+
existing_user_complaints = df[df["username"] == st.session_state.username]
|
| 65 |
+
if st.session_state["complaint_input"].strip() in existing_user_complaints["complaint_text"].values:
|
| 66 |
+
st.warning("โ ๏ธ ุชู
ุฅุฑุณุงู ูุฐู ุงูุดููู ู
ุณุจููุง!")
|
| 67 |
+
elif st.session_state["complaint_input"].strip() == "":
|
| 68 |
+
st.warning("โ ๏ธ ุงูุฑุฌุงุก ุฅุฏุฎุงู ูุต ุงูุดููู.")
|
| 69 |
+
else:
|
| 70 |
+
prefix = st.session_state.username[:4].lower()
|
| 71 |
+
next_id = len(existing_user_complaints) + 1
|
| 72 |
+
complaint_id = f"{prefix}_{next_id:06}"
|
| 73 |
+
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
| 74 |
+
new_complaint = {
|
| 75 |
+
"complaint_id": complaint_id,
|
| 76 |
+
"username": st.session_state.username,
|
| 77 |
+
"complaint_text": st.session_state["complaint_input"].strip(),
|
| 78 |
+
"status": "Pending",
|
| 79 |
+
"response": "",
|
| 80 |
+
"timestamp": timestamp
|
| 81 |
+
}
|
| 82 |
+
df = pd.concat([df, pd.DataFrame([new_complaint])], ignore_index=True)
|
| 83 |
+
df.to_csv(file_path, index=False, encoding='utf-8-sig')
|
| 84 |
+
st.success("โ
ุชู
ุชูุฏูู
ุงูุดููู ุจูุฌุงุญ")
|
| 85 |
+
# ุฅุนุงุฏุฉ ุชุนููู ุงูููู
ุฉ ุนุจุฑ ุทุฑููุฉ rerun ุงูุขู
ูุฉ:
|
| 86 |
st.session_state["complaint_input"] = ""
|
| 87 |
+
st.rerun()
|
| 88 |
+
|
| 89 |
+
|
| 90 |
|
| 91 |
complaint_text = st.text_area("๐ ูุตู ุงูุดููู", key="complaint_input")
|
| 92 |
if st.button("๐ค ุฅุฑุณุงู ุงูุดููู"):
|