File size: 1,985 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
from navigation import make_sidebar
import streamlit as st
from time import sleep
import yaml

make_sidebar()

# Sample job data

with open(f'data/jobs/jobs.yaml', 'r') as file:
    jobs = yaml.safe_load(file)
# job = {
#     "ssc1": {"description": "This is a new job...", "qualification": "class 10"},
#     "ssc2": {"description": "Another exciting job...", "qualification": "class 12"},
#     "engineer": {"description": "Engineering job...", "qualification": "B.E/B.Tech"},
# }

st.title("Job Listings")

hide_st_style = """
            <style>
            #MainMenu {visibility: hidden;}
            footer {visibility: hidden;}
            header {visibility: hidden;}
            </style>
            """
st.markdown(hide_st_style, unsafe_allow_html=True)
# Initialize session state to keep track of which job's details to show
if 'selected_job' not in st.session_state:
    st.session_state.selected_job = None

# Loop through all jobs and display them as buttons with title and description
for title, details in jobs.items():
    # Format title and description in one string
    button_label = "more details"
    st.markdown(f"""
    <div style="border: 2px solid #4CAF50; padding: 15px; border-radius: 6px;">
        <p style="font-size:18px; color:black; text-align:center;">
            <h2> {title} </h2>
            Description: {details["description"]}
        </p>
    </div>
    """, unsafe_allow_html=True)


    if st.button(button_label,key=f"know{title}"):
        # Set the selected job when the button is clicked
        st.session_state.selected_job = title
        sleep(0.5)
        st.switch_page("pages/job_details.py")

# # Show job details if a button was clicked
# if st.session_state.selected_job:
#     selected_title = st.session_state.selected_job
#     st.subheader(f"Details for {selected_title}")
#     st.write(f"**Description**: {job[selected_title]['description']}")
#     st.write(f"**Qualification**: {job[selected_title]['qualification']}")