from navigation import make_sidebar import streamlit as st import yaml import os make_sidebar() st.title( f'Hello {st.session_state.user}') hide_st_style = """ """ st.markdown(hide_st_style, unsafe_allow_html=True) folder_name = f"data/users/individuals/{st.session_state.user}" profile_pic = f'{folder_name}/profile.jpg' if os.path.exists(profile_pic): st.image(f'{folder_name}/profile.jpg', caption="Profile Picture", width=150) else: st.warning("Upload your profile picture") with open(f'data/users/individuals/{st.session_state.user}/status.yaml', 'r') as file: status = yaml.safe_load(file) personal = status[st.session_state.user] full_name = st.text_input("Enter your Full name",value=personal["full_name"]) phone_no = st.number_input("Enter your phone number",value=personal["phone_no"]) what_app_no = st.number_input("Enter your whatsapp number",value=personal["what_app_no"]) if st.button("Update Info"): personal["full_name"] = full_name personal["phone_no"] = phone_no personal["what_app_no"] = what_app_no status[st.session_state.user] = personal with open(f'data/users/individuals/{st.session_state.user}/status.yaml', 'w') as file: yaml.dump(status, file, default_flow_style=False) st.success("Data are updated successfully!! ") if st.button("show Details", type="primary"): with open(f'data/users/individuals/{st.session_state.user}/status.yaml', 'r') as file: status = yaml.safe_load(file) st.subheader("Applied Jobs") if "jobs" in list(status.keys()): for i,job_name in enumerate(list(status['jobs'].keys())): job = status['jobs'][job_name] time_ = job["applied_date"].date() stt = job["status"] # link = job["application"] st.write(f'{i+1}. {job_name} which is applied on {time_} is: ') st.info(stt) # st.write(f'You can check here: {link}') else: st.warning("Apply a job !!") st.subheader("Uploaded Documents:") if "documents" in list(status.keys()): for i,doc_name in enumerate(list(status["documents"])): doc = status['documents'][doc_name] if doc['status']=='done': st.write(f'{i+1}. {doc_name} was succesfully uploaded') else: st.warning("Upload your documents below") st.header("Update your documents") uploaded_profile = st.file_uploader("Upload your profile", type=["jpg", "jpeg", "png"]) uploaded_aadhar_f = st.file_uploader("Upload your aadhar front", type=["jpg", "jpeg", "png"]) uploaded_aadhar_b = st.file_uploader("Upload your aadhar back", type=["jpg", "jpeg", "png"]) uploaded_10 = st.file_uploader("Upload your 10 mark sheet", type=["jpg", "jpeg", "png"]) uploaded_12 = st.file_uploader("Upload your 12 mark sheet", type=["jpg", "jpeg", "png"]) ################################################## ### List of documents doc_list_names = {"profile.jpg":uploaded_profile, "aadhar_f.jpg":uploaded_aadhar_f, "aadhar_b.jpg":uploaded_aadhar_b, "class_10.jpg":uploaded_10, "class_12.jpg":uploaded_12} if st.button("Update"): with open(f'data/users/individuals/{st.session_state.user}/status.yaml', 'r') as file: status = yaml.safe_load(file) for docu in list(doc_list_names.keys()): if doc_list_names[docu] is not None: file_path = f'{folder_name}/{docu}' if os.path.exists(file_path): os.remove(file_path) with open(file_path, "wb") as f: f.write(doc_list_names[docu].getbuffer()) file_name = docu.split('.')[0] if "document" in list(status.keys()): status["documents"][file_name] = {"status":"done","link":docu} else: status["documents"] = {file_name:{"status":"done","link":docu}} with open(f'data/users/individuals/{st.session_state.user}/status.yaml', 'w') as file: yaml.dump(status, file, default_flow_style=False) st.success("Files are uploaded successfully!! ")