<template>

	<div id='CONTAINER' class='card'>

		<div class='card filter'>

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

				<div class='fold-toggle' :data-show='gstore.filters[gname][0].visible?1:0' @click='gstore.show_fgroup(gname)' :data-count='gstore.filters[gname][0].active.length'>{{ gname }}</div>

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

			</div>

		</div>

		<div class='card container'>

			<input class='card instant-search neutral' type='text' @keyup='gstore.is_handler($event)' placeholder='Recherche instantannée' id='teacher_view_instant_search'>
			<button class='card toggle valid' :data-active='gstore.create_card?1:0' @click='gstore.create_card=!gstore.create_card' title='Créer un enseignant'>+</button>

			<section class='valid' data-create='' v-show='gstore.create_card'>

				<select class='category' v-model='gstore.create_cat'>
					<option selected='selected' disabled='disabled' value='-'>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' v-model='gstore.create_name'>
					<span data-visible='1'>(<input type='text' placeholder='identifiant' v-model='gstore.create_cas'>)</span>
				</h1>

				<div class='table'>
					<div>
						<span><input type='text' placeholder='???' v-model='gstore.create_h'></span>
						<span>heures à faire</span>
					</div>
				</div>

				<div :class="gstore.create_err.length > 0 ? 'sub warning' : 'sub'" :data-valid='gstore.create_err_valid?1:0'>{{ gstore.create_err }}</div>

				<div class='footer'>
					<button class='valid' @click='gstore.ic_handler()'>Créer l'enseignant</button>
				</div>
			</section>

			<section>




				<h1 >{{ $route.params.code }}</h1>


				<div class='footer'>
					<button class='neutral' @click='$router.push(`/ue/view`)'>Retour</button>
				</div>
			</section>

		</div>


	</div>

</template>




<script>

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

</script>