<?php $__env->startSection('css'); ?>
<?php echo Minify::stylesheet('/css/study.css')->withFullUrl(); ?>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('title'); ?>
<?php echo e(Lang::get('studies.bachelor.estudiar bachillerato')); ?>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<?php if($tipo == 1): ?>
<?php echo Breadcrumbs::render('study-semipresencial'); ?>

<?php elseif($tipo == 2): ?>
<?php echo Breadcrumbs::render('study-online'); ?>

<?php else: ?>
<?php echo Breadcrumbs::render('study-adaptado'); ?>

<?php endif; ?>

<div class="container" id="vueLibre" codIdioma=<?php echo e($codIdioma); ?> tipo=<?php echo e($tipo); ?> url=<?php echo e($url); ?>>
    <div class="titulo_categoria">
        <span><?php echo e(Lang::get('studies.aula abierta')); ?></span>
        <?php if($tipo == 1): ?>
        <div class="subtitulo_categoria"><?php echo e(Lang::get('studies.semipresenciales')); ?></div>
        <?php elseif($tipo == 2): ?>
        <div class="subtitulo_categoria"><?php echo e(Lang::get('studies.online')); ?></div>
        <?php else: ?>
        <div class="subtitulo_categoria"><?php echo e(Lang::get('studies.adaptado')); ?></div>
        <?php endif; ?>
    </div>
    <hr>
    <hr>
    <ul class="nav nav-tabs">
        <li class="active"><a data-toggle="tab" href="#cursos"><?php echo e(Lang::get('studies.cursos')); ?></a></li>
        <li><a data-toggle="tab" href="#matricularse"><?php echo e(Lang::get('studies.matricularse')); ?></a></li>
    </ul>
    <div class="tab-content">
        <div id="cursos" class="tab-pane fade in active">
            <div v-if="hasCursos()" >
            
                <div class="courseList" v-for="c in getCursos()" :key="c.idTitulacion">
                    <ul>
                        <li>
                            <a v-on:click="goto_curso(c.idTitulacion, c.nombreTitulacion)">- {{c.nombreTitulacion}}</a>
                        </li>
                    </ul>
                </div>
            </div>
            <div v-else>
            <?php if($tipo == 1): ?>
            <div>
                No existen cursos <?php echo e(Lang::get('studies.tipo semipresenciales')); ?> habilitados actualmente
            </div>
            <?php elseif($tipo == 2): ?>
            <div>
                No existen cursos <?php echo e(Lang::get('studies.tipo online')); ?> habilitados actualmente
            </div>
            <?php else: ?>
            <div>
                No existen cursos <?php echo e(Lang::get('studies.tipo adaptado')); ?> habilitados actualmente
            </div>
            <?php endif; ?>
            </div>
        </div>
    
        <div id="matricularse" class="tab-pane fade">            
            <h4 style="font-size: 19px">
                <?php if($tipo == 1): ?>
                <div>
                    Descripción de como matricularse para los tipo semipresenciales
                </div>
                <?php elseif($tipo == 2): ?>
                <div>
                    Descripción de como matricularse para los tipo onlines
                </div>
                <?php else: ?>
                <div>
                    Descripción de como matricularse para los tipo adaptados
                </div>
                <?php endif; ?>
            </h4>
        </div>
    </div>    
    <hr>
    <br>
</div>
<!-- /.row -->
<!-- 
    Componente Vue para cargar los datos
-->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script type="text/javascript">

    new Vue({
        el: '#vueLibre',
        props: {},
        data: { 
            cursos: [],
            codIdioma: null,
            tipo: null
        },
        computed: {},
        mounted () {
            this.codIdioma = this.$el.attributes.codIdioma.value
            this.tipo = this.$el.attributes.tipo.value
            var params = { params: { codIdioma: this.codIdioma } }
            if (this.tipo == 1) {
            axios
            .get(this.$el.attributes.url.value + '/getCursosSemipresenciales', params)
            .then(
                response => {
                    this.cursos = response.data
                })
            } else if (this.tipo == 2) {
                axios
            .get(this.$el.attributes.url.value + '/getCursosOnline', params)
            .then(
                response => {
                    this.cursos = response.data
                })
            } else {
                axios
            .get(this.$el.attributes.url.value + '/getCursosAdaptados', params)
            .then(
                response => {
                    this.cursos = response.data
                })
            }
        },
    
        methods: {
            hasCursos: function() {
                console.log("hasCursos: " + (this.cursos !== undefined) && (this.cursos.length > 0))
                return (this.cursos !== undefined) && (this.cursos.length > 0)
            },
            goto_curso: function(id, nombre) {
                route = "<?php echo e(route('study-libres', ['id' => '?id?', 'nombre' => '?nombre?'])); ?>"
                route = route.replace('?id?', id)
                route = route.replace('?nombre?', nombre)
                location.href = route
            },
            getCursos: function() {
                return this.cursos
            },
        },
    });

           
</script>
<?php $__env->stopSection(); ?>    
<?php echo $__env->make('layouts.base', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>