<template>

	<div id='CONTAINER'>

		<input class='card instant-search neutral' type='text' @keyup='gstore.is_handler($event)' placeholder='Recherche instantannée' id='teacher_view_instant_search'>

		<div class='card container'>

			<section data-create>

				<select class='category'>
					<option selected='selected' disabled='disabled'>Catégorie d'enseignant</option>
					<option v-for='cat in gstore.categories' :value='cat.idCategorie'>{{ cat.labelCategorie }}</option>
				</select>
				<h1>
					<input type='text' placeholder='Prénom Nom' value='Prénom Nom'>
				</h1>

				<div class='table'>
					<div>
						<span><input type='text' placeholder='???' value='192'></span>
						<span>heures à faire</span>
					</div>
				</div>

				<button class='sub valid'>Créer l'enseignant</button>

				<div class='footer'>
					<span class='course'><span>Cours</span></span><hr>
					<span class='td'><span>TD</span></span><hr>
					<span class='tp'><span>TP</span></span>
				</div>
			</section>

			<section v-if='gstore.professors.length <= 0'>Aucun enseignant trouvé</section>

			<section v-for='prof in gstore.professors'
				:data-id='prof.idProfesseur'
				:data-category='prof.idCat'
				:data-lname='prof.lastName'
				:data-fname='prof.firstName'>

				<span class='category'>{{ prof.categorie }}</span>
				<h1>{{ prof.firstName }} {{ prof.lastName }}</h1>

				<div class='table'>
					<div>
						<span>{{prof.hoursToDo}}</span>
						<span>heures à faire</span>
					</div>
					<div>
						<span>{{ prof.equiTD }}</span>
						<span>heures prévues</span>
					</div>
				</div>

				<div class='sub'><strong>{{ prof.VHCours + prof.VHTd + prof.VHTp }}h</strong> physiques prévues</div>

				<div class='footer'>
					<span :class="(prof.VHCours == 0) ? 'course' : 'course active'">{{ prof.VHCours }}h <span>Cours</span></span><hr>
					<span :class="(prof.VHTd    == 0) ? 'td'     : 'td active'">{{ prof.VHTd }}h <span>TD</span></span><hr>
					<span :class="(prof.VHTp    == 0) ? 'tp'     : 'tp active'">{{ prof.VHTp }}h <span>TP</span></span>
				</div>
			</section>

		</div>



		<div class='card filter'>

			<div v-for='(filter_grp, gname) in gstore.filters' :title='gname'>

				<div class='fold' :data-show='gstore.filters[gname][0].visible ? 1 : 0' @click='gstore.filters[gname][0].visible = !gstore.filters[gname][0].visible'>{{ gname }}</div>

				<span v-for='(data, i) in filter_grp' v-if='i > 0' :class="data.active == true ? 'active' : ''" @click='data.active = !data.active; gstore.filter_handler();' :title='data.code'>{{ data.name }}</span>

			</div>

		</div>

	</div>

</template>




<script>

	export default {
		name: 'CONTAINER_VIEW',
		data(){
			return { gstore: gstore.get }
		}
	}

</script>