<template> 
            <div class="job-listing">
            <div class="categories">
                <div class="category">
                    <label>Countries</label>
                    <select class="bluefire-selector" id="selHeaderCountry">
                        <option value="">All Countries</option>
                    </select>
                </div>
                <div class="category">
                    <label>Cities</label>
                    <select class="bluefire-selector" id="selHeaderCity">
                        <option value="">All Cities</option>
                    </select>
                </div>
            </div>
            <div class="listing" >
                <div class="job-item" v-for="(job,i) in jobs" :key="job.JobID">
                    <span class="job-no">{{ i+1 }}</span>
                    <h2 class="job-title">{{ job.JobName }}</h2>
                    <div class="job-location">
                        <div class="applicants">
                            <h2>Applicants</h2>
                            <p>{{ job.ApplicantCount }}</p>
                        </div>
                    </div>
                    <div class="see-detail">
                        <router-link :to="'/admin/applicants/'+job.JobID">See Detail...</router-link>
                    </div>
                </div>
                <!-- <div class="pagination">
                    <router-link class="page-link" to="./?page=1">1</router-link>
                    <router-link class="page-link" to="./?page=2">2</router-link>
                    <router-link class="page-link" to="./?page=3">3</router-link>
                    <router-link class="next" to="./?page=2"></router-link>
                </div> -->
            </div>
        </div>


</template>

<script>
import API from "../lib/API";
import { mapState} from 'vuex';

export default {
    computed: mapState(["countryId","cityId"]),
    props: {
        paginate: {
            default: false,
        },
        admin: {
            default: false,
        },
    },
    data() {
        return {
            jobs: [],
        }
    },
    methods: { 
        changeCountry(e) {
          this.$store.commit('setCountryId',e.target.value);
        },
        changeCity(e) {
            this.$store.commit('setCityId',e.target.value);
        },
    },
    mounted() {
        var APIpromise = null;
        APIpromise = API.get("/getListJob");
        if(APIpromise != null) {
            APIpromise.then((response) => {
                this.jobs = response.data;         
            });
        }
    }
}
</script>
<style>
.job-listing {
    display: flex;
    flex-direction: row;
}
.job-listing .categories {
    width: 25%;
}
.job-listing .listing {
    width: 75%;
}
.categories .category {
    background-color: rgba(242, 242, 242, 1);
    padding: 1.5rem;
    box-shadow: 5px 5px 14px rgba(0, 0, 0, 0.3);
    margin: 1rem 0.5rem;
}
.category label {
    font-size: 1.5rem;
    font-weight: bold;
    color: #322b6b;
}
.category .bluefire-selector {
    width: 100%;
    font-weight: bold;
    margin-top: 0.5rem;
}
.listing .job-item {
    background-color: rgba(242, 242, 242, 1);
    padding: 0.5rem 1.5rem;
    box-shadow: 5px 5px 14px rgba(0, 0, 0, 0.3);
    margin: 1rem 0.5rem;
    display: flex;
    flex-direction: row;
    font-size: 1rem;
    font-weight: bold;
}
.job-item .job-no {
    font-size: 1.5rem;
    color: #322b6b;
    margin-right: 1rem;
}
.job-item .job-title {
    font-size: 1.5rem;
    color: #333333;
    margin: 0;
}
.job-item .job-location {
    display: flex;
    flex-direction: row;
    margin-left: auto;
}
.job-item .job-location div {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.25rem;
    font-weight: normal;
    margin: 0.5rem 3rem;
}
.job-item .job-location h2 {
    font-size: 1.125rem;
    color: #322b6b;
    margin: 0 0 0.25rem 0 ;
}
.job-item .job-location p {
    font-size: 1.125rem;
    margin: 0;   
}
.job-item .bookmark img {
    height: 1.5rem;
    margin: 0.5rem 0;
}
.job-item .see-detail {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
.job-item .see-detail a {
    color: rgba(60,53,113,1);
    font-size: 1.25rem;
    font-weight: normal;
}
.pagination {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
}
.pagination .page-link {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 0.75rem;
    color: rgba(60,53,113,1);
}
.pagination .next {
    color: #444444;
}
</style>