File size: 4,305 Bytes
d03e822
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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 = """
            <style>
            #MainMenu {visibility: hidden;}
            footer {visibility: hidden;}
            header {visibility: hidden;}
            </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!! ")