<?php $__env->startSection('content'); ?>
<!--/**
     * Vista para que el representanta ingrese los datos del nuevo aspirante(s)
     * @since      2017-11-12
     * @edit        2017-11-12<br />
     *          Fernando Salas <rfsalas@rutatec.com><br />
     *          Eliminación de placeholder y cambio de cédula a documento de aspirante<br/>
     *          #edit1
     */-->
<?php echo HTML::script('js/webAdmission/web_aspirant.js'); ?>

<?php echo Form::hidden('hdnSectionLevel', action('WebAspirantController@postSectionLevel', array()), array('id'=>'hdnSectionLevel')); ?>

<?php echo Form::hidden('hdnAddInstitution', action('WebAspirantController@postAddInst', array()), array('id'=>'hdnAddInstitution')); ?>

<?php echo Form::hidden('hdnUniqueCi', action('WebAspirantController@postUniqueCi', array()), array('id'=>'hdnUniqueCi')); ?>

<?php echo Form::open(['url' => 'webAdmission/update', 'id' => 'update', 'enctype'=>'multipart/form-data']); ?>

<div class="row text-center">
    <div class="page-header" id="encabezado">
        <h3>Proceso de admisiones</h3>
        <h4>Año Lectivo <?php echo $school_year->name_scy; ?></h4>
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        <p class="pull-right"><span style="color: red">*</span> Campos obligatorios </p>
    </div>
</div>
<div class="row" id="mySection">
    <div class="col-md-offset-1 col-md-9"> 
        <input type="hidden" id="actually_date" value="<?php echo $actually_date; ?>">
        <input type="hidden" id="numberSons" name="numberSons" value="<?php echo count($aspirants); ?>">
        <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
            <?php foreach($aspirants as $key => $aspirant): ?>
            <div class="panel panel-default">
                <div class="panel-heading" role="tab" id="heading<?php echo $aspirant->serial_asstu; ?>">
                    <h4 class="panel-title">
                        <a data-toggle="collapse" data-parent="#accordion"
                           href="#collapse<?php echo $aspirant->serial_asstu; ?>" aria-expanded="false"
                           aria-controls="collapse<?php echo $aspirant->serial_asstu; ?>">
                            <div>
                                <?php echo $aspirant->first_name_asstu . ' ' . $aspirant->last_name_asstu; ?> 
                                <i class="indicator glyphicon  pull-right glyphicon-plus"></i>
                            </div>
                        </a>
                    </h4>
                </div>
                <div id="collapse<?php echo $aspirant->serial_asstu; ?>" class="panel-collapse collapse" role="tabpanel"
                     aria-labelledby="heading<?php echo $aspirant->serial_asstu; ?>">
                    <div class="panel-body">
                        <div class="formulario" id="webAspirant<?php echo $aspirant->serial_asstu; ?>">
                            <?php echo Form::hidden('serial'.$aspirant->serial_asstu, $aspirant->serial_asstu, ['id' => 'serial'.$aspirant->serial_asstu]); ?>

                            <?php echo Form::hidden('hiddenSection'.$aspirant->serial_asstu, $aspirant->serial_set, ['id' => 'hiddenSection'.$aspirant->serial_asstu]); ?>

                            <?php echo Form::hidden('hiddenLevel'.$aspirant->serial_asstu, $aspirant->serial_lvl, ['id' => 'hiddenLevel'.$aspirant->serial_asstu]); ?>

                            <div class="panel panel-primary">
                                <div class="panel-heading text-center"><b>Informaci&oacute;n del aspirante</b>
                                </div>
                                <div class="panel-body">
                                    <div class="row">
                                        <div class="col-md-4 form-group">
                                            <?php echo Form::label('last_name_asstu_'.$aspirant->serial_asstu,'Apellidos'); ?><span style="color:red">*</span>
                                            <?php echo Form::text($aspirant->serial_asstu.'[last_name_asstu]', $aspirant->last_name_asstu, ['id' => 'last_name_asstu_' . $aspirant->serial_asstu, 'class'=>'form-control last_name_asstu']); ?>

                                        </div>
                                        <div class="col-md-4 form-group">
                                            <?php echo Form::label('first_name_asstu_'.$aspirant->serial_asstu,'Nombres'); ?><span style="color:red">*</span>
                                            <?php echo Form::text($aspirant->serial_asstu.'[first_name_asstu]', $aspirant->first_name_asstu, ['id' => 'first_name_asstu_' . $aspirant->serial_asstu, 'class'=>'form-control first_name_asstu']); ?>

                                        </div>
                                        <div class="col-md-4 form-group">
                                            <?php echo Form::label('aspirantAs_'.$aspirant->serial_asstu,'Nombre con el que se le conoce'); ?>

                                            <?php echo Form::text($aspirant->serial_asstu.'[alias_aspirant]', $aspirant->known_name, ['id' => 'aspirantAs_'.$aspirant->serial_asstu, 'class'=>'form-control alias_aspirant']); ?>

                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-6 form-group">
                                            <?php echo Form::label('ci_'.$aspirant->serial_asstu,'Número de documento de identificación'); ?>

                                            <?php echo Form::text($aspirant->serial_asstu.'[ci]', $aspirant->id_asstu, ['id' => 'ci_'.$aspirant->serial_asstu, 'class'=>'form-control ci','maxlength'=>'10',  'onblur' => 'unique_ci('.$aspirant->serial_asstu.')']); ?>

                                        </div>
                                        <div class="col-md-6 form-group">
                                            <?php echo Form::label('birtAsstu_'.$aspirant->serial_asstu,'Fecha de nacimiento'); ?><span style="color:red">*</span>
                                            <div class='input-group date' id='birthdate'>
                                                <input id="birtAsstu_<?php echo $aspirant->serial_asstu; ?>" type="text" name="<?php echo $aspirant->serial_asstu; ?>[birthday]"
                                                       class="form-control birthday" placeholder="yyyy-mm-dd" value="<?php echo $aspirant->birthdate_asstu; ?>">
                                                <span class="input-group-addon">
                                                    <span class="glyphicon glyphicon-calendar"></span>
                                                </span>
                                            </div>
                                        </div>
                                    </div>
                                    <?php if($schoolSetup->serial_sst == 16): ?>
                                    <div class="row">
                                        <div class="form-group col-md-6">
                                            <?php echo Form::label('nationality_'.$aspirant->serial_asstu,'Nacionalidad'); ?>

                                            <select id="nationality_<?php echo $aspirant->serial_asstu; ?>"
                                                    name="<?php echo $aspirant->serial_asstu; ?>[serial_nnt]"
                                                    class="form-control nationality">
                                                <option value="">- Ninguno -</option>
                                                <?php foreach($nationalities as $nationality): ?>
                                                    <option value="<?php echo $nationality->serial_nnt; ?>" <?php echo (($aspirant->serial_nnt != null) && ($aspirant->serial_nnt == $nationality->serial_nnt)) ? 'selected':($nationality->serial_nnt == 1 ? 'selected':''); ?>><?php echo $nationality->name_nnt; ?></option>
                                                <?php endforeach; ?>
                                            </select>
                                        </div>
                                    </div>
                                    <?php endif; ?>
                                    <?php if($schoolSetup->serial_sst == 9): ?>
                                    <div class="row">
                                        <div class="col-md-6 form-group">
                                            <?php echo Form::label('parent_ex_student_astu_'.$aspirant->serial_asstu,'Es hijo de ex-alumno'); ?><span style="color:red">*</span>
                                            <select class="form-control" name="<?php echo $aspirant->serial_asstu; ?>[parent_ex_student_astu]" id="parent_ex_student_astu_<?php echo $aspirant->serial_asstu; ?>">
                                                <option value="">Seleccione una opci&oacute;n</option>
                                                <option value="YES" <?php echo $aspirant->parent_ex_student_astu == 'YES' ? 'selected':''; ?>>SI</option>
                                                <option value="NO" <?php echo $aspirant->parent_ex_student_astu == 'NO' ? 'selected':''; ?>>NO</option>
                                            </select>
                                        </div>
                                        <div class="col-md-6 form-group">
                                            <?php echo Form::label('person_recommended_astu_'.$aspirant->serial_asstu,'Recomendado por alguien (Especifique)'); ?>

                                            <?php echo Form::text($aspirant->serial_asstu.'[person_recommended_astu]', $aspirant->person_recommended_astu, ['id' => 'person_recommended_astu_' . $aspirant->serial_asstu, 'class'=>'form-control person_recommended_astu']); ?>

                                        </div>
                                    </div>
                                        <div class="row">
                                            <div class="col-md-6 form-group">
                                                <?php echo Form::label('link_school_'.$aspirant->serial_asstu,'Vínculo con el Colegio'); ?>

                                                <select class="form-control" name="<?php echo $aspirant->serial_asstu; ?>[link_school]" id="link_school_<?php echo $aspirant->serial_asstu; ?>">
                                                    <option value="">Seleccione una opci&oacute;n</option>
                                                    <option value="ANY" <?php echo $aspirant->link_school == 'ANY' ? 'selected':''; ?>>Ninguno</option>
                                                    <option value="SONS AT SCHOOL" <?php echo $aspirant->link_school == 'SONS AT SCHOOL' ? 'selected':''; ?>>Hijos en el Colegio</option>
                                                    <option value="TEACHER AT SCHOOL" <?php echo $aspirant->link_school == 'TEACHER AT SCHOOL' ? 'selected':''; ?>>Profesor en el Colegio</option>
                                                    <option value="RE-ENTRY" <?php echo $aspirant->link_school == 'RE-ENTRY' ? 'selected':''; ?>>Reingreso</option>
                                                    <option value="BROTHER STUDENT" <?php echo $aspirant->link_school == 'BROTHER STUDENT' ? 'selected':''; ?>>Hermano Alumno</option>
                                                    <option value="SON EX STUDENT" <?php echo $aspirant->link_school == 'SON EX STUDENT' ? 'selected':''; ?>>Hijo exalumno</option>
                                                    <option value="OTHER" <?php echo $aspirant->link_school == 'OTHER' ? 'selected':''; ?>>Otro</option>
                                                </select>
                                            </div>
                                        </div>
                                    <?php endif; ?>
                                </div>
                            </div>
                            <hr>
                            <div class="panel panel-primary">
                                <div class="panel-heading text-center"><b>Alumno solicita cupo en</b></div>
                                <div class="panel-body">
                                    <div class="row">
                                        <div class="col-md-6 form-group">
                                            <?php echo Form::label('','Secci&oacute;n'); ?>

                                            <?php echo Form::text($aspirant->serial_asstu.'[section]', null, ['id' => 'requestSection'.$aspirant->serial_asstu, 'class'=>'form-control', 'disabled']); ?>

                                        </div>
                                        <div class="form-group col-md-6">
                                            <?php echo Form::label('','Nivel'); ?>

                                            <?php echo Form::text($aspirant->serial_asstu.'[level]', null, ['id' => 'requestLevel'.$aspirant->serial_asstu, 'class'=>'form-control', 'disabled']); ?>

                                        </div>
                                    </div>
                                </div>
                            </div>
                            <hr>
                            <div class="panel panel-primary">
                                <div class="panel-heading text-center"><b>Educaci&oacute;n Anterior</b></div>
                                <div class="panel-body">
                                    <?php echo Form::hidden('length_table'.$aspirant->serial_asstu, count($levelSectionLessAspirant[$aspirant->serial_asstu])+1, ['id' => 'length_table'.$aspirant->serial_asstu]); ?>

                                    <div class="row">
                                        <div class="col-md-offset-0 col-md-12">
                                            <div class="table-responsive">
                                                <table class="table table-striped"
                                                       id="tableEducation_<?php echo $aspirant->serial_asstu; ?>">
                                                    <thead>
                                                        <tr>
                                                            <th class="text-center"><label>Nivel</label></th>
                                                            <th class="text-center"><label>Plantel</label></th>
                                                            <th class="text-center" id="year_previous"><label>Año</label></th>
                                                            <th class="text-center"><label>Promedio</label></th>
                                                            <th class="text-center"><label>Disciplina</label></th>
                                                            <th class="text-center" colspan="2">Libretas</th>
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                        <?php if($schoolSetup->serial_sst != 13): ?>
                                                        <tr level="initial">
                                                            <td>
                                                                Centro Infantil
                                                                <?php echo Form::hidden($aspirant->serial_asstu.'[previous_school][zero][scy]', 0); ?>

                                                                <?php echo Form::hidden($aspirant->serial_asstu.'[previous_school][zero][set]', 0); ?>

                                                                <?php echo Form::hidden($aspirant->serial_asstu.'[previous_school][zero][lvl]', 0); ?>

                                                            </td>
                                                            <td>
                                                                <div class="form-group">
                                                                    <select name="<?php echo $aspirant->serial_asstu.'[previous_school][zero][school]'; ?>"
                                                                            id="<?php echo 'select_school'. $aspirant->serial_asstu . '_1'; ?>"
                                                                            class="form-control select_school">
                                                                        <option value="">- Seleccione -</option>
                                                                        <?php foreach($schools as $id => $school): ?>
                                                                        <option value="<?php echo $id; ?>" <?php echo $previousEducationAspirant[$aspirant->serial_asstu]['init']['serial_sch'] && ($previousEducationAspirant[$aspirant->serial_asstu]['init']['serial_sch'] == $id) ? 'selected' : empty($previousEducationAspirant[$aspirant->serial_asstu]['init']['serial_sch']) && $id==$aspirant->serial_school && (count($levelSectionLessAspirant[$aspirant->serial_asstu])==0)  ? 'selected':''; ?>><?php echo $school; ?></option>
                                                                        <?php endforeach; ?>
                                                                    </select>
                                                                    <?php if($schoolSetup->serial_sst==9): ?>
                                                                    <br/>
                                                                    <button type="button"
                                                                            class="btn btn-default btn-sm"
                                                                            data-toggle="modal"
                                                                            data-target="#myModal"
                                                                            title="Si no encuentra al instituto en la lista anterior lo puede agregar desde aquí.">
                                                                        Agregar Instituci&oacute;n
                                                                    </button>
                                                                    <?php endif; ?>
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <div class="form-group">
                                                                    <div class='input-group date' id='startDateD_k'>
                                                                        <input type="text"
                                                                               class="form-control year_kinder"
                                                                               id="previusYear<?php echo $aspirant->serial_asstu; ?>_999"
                                                                               name="<?php echo $aspirant->serial_asstu.'[previous_school][zero][year]'; ?>"
                                                                               value="<?php echo ($previousEducationAspirant[$aspirant->serial_asstu]['init']['previous_year_asstu']) ? $previousEducationAspirant[$aspirant->serial_asstu]['init']['previous_year_asstu'] : ''; ?>">
                                                                        <span id="dateS" name="dateS"
                                                                              class="input-group-addon">
                                                                            <span class="glyphicon glyphicon-calendar"></span>
                                                                        </span>
                                                                    </div>
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <div class="form-group">
                                                                    <input type="text"
                                                                           class="form-control"
                                                                           id="previusNote<?php echo $aspirant->serial_asstu; ?>_-1"
                                                                           name="<?php echo $aspirant->serial_asstu.'[previous_school][zero][previusNote]'; ?>"
                                                                           value="<?php echo $previousEducationAspirant[$aspirant->serial_asstu]['init']['previous_note_asstu']; ?>">
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <div class="form-group">
                                                                    <input type="text"
                                                                           class="form-control"
                                                                           id="previousDisciplineNote<?php echo $aspirant->serial_asstu; ?>_-1"
                                                                           name="<?php echo $aspirant->serial_asstu.'[previous_school][zero][previousDisciplineNote]'; ?>"
                                                                           value="<?php echo $previousEducationAspirant[$aspirant->serial_asstu]['init']['previous_note_disciplien_asstu']; ?>">
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <div class="form-group text-center">
                                                                    <input type="file"
                                                                           class="filestyle apply-tooltip"
                                                                           id="file_<?php echo $aspirant->serial_asstu; ?>_-1"
                                                                           name="<?php echo $aspirant->serial_asstu.'[previous_school][zero][file]'; ?>"
                                                                           data-input="false"
                                                                           data-buttonText=" Libreta">
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <?php if($previousEducationAspirant[$aspirant->serial_asstu]['init']['filename_dc']): ?>
                                                                <a id="file_<?php echo $aspirant->serial_asstu; ?>" target="_blank" class="btn btn-warning"
                                                                   <?php if($schoolYear): ?>
                                                                   href="<?php echo '../../../public/uploads/'.$aspirant->serial_asstu.'/'.$previousEducationAspirant[$aspirant->serial_asstu]['init']['filename_dc']; ?>">
                                                                   <?php else: ?>
                                                                   href="<?php echo '../../public/uploads/'.$aspirant->serial_asstu.'/'.$previousEducationAspirant[$aspirant->serial_asstu]['init']['filename_dc']; ?>">
                                                                   <?php endif; ?>
                                                                   <span class="fa fa-paperclip"></span> ver
                                                                </a>
                                                                <?php endif; ?>
                                                            </td>
                                                        </tr>
                                                        <?php endif; ?>
                                                        <?php $lessSectionNumber = 2; ?>
                                                        <?php foreach($levelSectionLessAspirant[$aspirant->serial_asstu] as $idAspirant => $lessSection): ?>
                                                        <tr level="<?php echo $lessSection->serial_scy.'-'.$lessSection->serial_set.'-'.$lessSection->serial_lvl; ?>">
                                                            <td>
                                                                <?php echo $lessSection->name_lvl; ?> <?php if($schoolSetup->serial_sst==9): ?>  <?php echo $lessSection->name_set; ?> <?php endif; ?>
                                                                <?php echo Form::hidden($aspirant->serial_asstu.'[previous_school]['.$lessSection->name_lvl.'][scy]',$lessSection->serial_scy); ?>

                                                                <?php echo Form::hidden($aspirant->serial_asstu.'[previous_school]['.$lessSection->name_lvl.'][set]',$lessSection->serial_set); ?>

                                                                <?php echo Form::hidden($aspirant->serial_asstu.'[previous_school]['.$lessSection->name_lvl.'][lvl]',$lessSection->serial_lvl); ?>

                                                            </td>
                                                            <td>
                                                                <div class="form-group">
                                                                    <select id="<?php echo 'select_school'. $aspirant->serial_asstu . '_' . $lessSectionNumber; ?>"
                                                                            name="<?php echo $aspirant->serial_asstu.'[previous_school]['.$lessSection->name_lvl.'][school]'; ?>"
                                                                            class=" form-control select_school"
                                                                            field="school">
                                                                        <option value="">- Seleccione -</option>
                                                                        <?php foreach($schools as $id => $school): ?>
                                                                        <option value="<?php echo $id; ?>"  <?php echo ($previousEducationAspirant[$aspirant->serial_asstu]['more'][$lessSection->serial_scy.'-'.$lessSection->serial_set.'-'.$lessSection->serial_lvl]['serial_sch'] && $previousEducationAspirant[$aspirant->serial_asstu]['more'][$lessSection->serial_scy.'-'.$lessSection->serial_set.'-'.$lessSection->serial_lvl]['serial_sch'] == $id) ? 'selected' : empty($previousEducationAspirant[$aspirant->serial_asstu]['more'][$lessSection->serial_scy.'-'.$lessSection->serial_set.'-'.$lessSection->serial_lvl]['serial_sch']) && $id==$aspirant->serial_school && (count($levelSectionLessAspirant[$aspirant->serial_asstu])-1)==$idAspirant  ? 'selected':''; ?>><?php echo $school; ?></option>
                                                                        <?php endforeach; ?>
                                                                    </select>
                                                                    <?php if($schoolSetup->serial_sst==9): ?>
                                                                    <br/>
                                                                    <button type="button"
                                                                            class="btn btn-default btn-sm"
                                                                            data-toggle="modal"
                                                                            data-target="#myModal" title="Si no encuentra al instituto en la lista anterior lo puede agregar desde aquí.">
                                                                        Agregar Instituci&oacute;n
                                                                    </button>
                                                                    <?php endif; ?>
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <div class="form-group">
                                                                    <div class="form-inline col-md-13">
                                                                        <div class='input-group date'
                                                                             id='startDateD_<?php echo $idAspirant; ?>'>
                                                                            <input type="text"
                                                                                   class="form-control year"
                                                                                   id="previusYear<?php echo $aspirant->serial_asstu; ?>_<?php echo $idAspirant; ?>"
                                                                                   name="<?php echo $aspirant->serial_asstu.'[previous_school]['.$lessSection->name_lvl.'][year]'; ?>"
                                                                                   field="year"
                                                                                   value="<?php echo $previousEducationAspirant[$aspirant->serial_asstu]['more'][$lessSection->serial_scy.'-'.$lessSection->serial_set.'-'.$lessSection->serial_lvl]['previous_year_asstu'] ? $previousEducationAspirant[$aspirant->serial_asstu]['more'][$lessSection->serial_scy.'-'.$lessSection->serial_set.'-'.$lessSection->serial_lvl]['previous_year_asstu'] : ''; ?>">
                                                                            <span id="dateS" name="dateS"
                                                                                  class="input-group-addon">
                                                                                <span class="glyphicon glyphicon-calendar"></span>
                                                                            </span>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <div class="form-group">
                                                                    <input type="text" class="form-control note"
                                                                           id="previusNote<?php echo $aspirant->serial_asstu; ?>_<?php echo $idAspirant; ?>"
                                                                           name="<?php echo $aspirant->serial_asstu.'[previous_school]['.$lessSection->name_lvl.'][previusNote]'; ?>"
                                                                           value="<?php echo $previousEducationAspirant[$aspirant->serial_asstu]['more'][$lessSection->serial_scy.'-'.$lessSection->serial_set.'-'.$lessSection->serial_lvl]['previous_note_asstu'] ? $previousEducationAspirant[$aspirant->serial_asstu]['more'][$lessSection->serial_scy.'-'.$lessSection->serial_set.'-'.$lessSection->serial_lvl]['previous_note_asstu'] : ''; ?>"
                                                                           field="score">
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <div class="form-group">
                                                                    <input type="text" class="form-control note"
                                                                           id="previusDisiplineNote<?php echo $aspirant->serial_asstu; ?>_<?php echo $idAspirant; ?>"
                                                                           name="<?php echo $aspirant->serial_asstu.'[previous_school]['.$lessSection->name_lvl.'][previousDisciplineNote]'; ?>"
                                                                           value="<?php echo $previousEducationAspirant[$aspirant->serial_asstu]['more'][$lessSection->serial_scy.'-'.$lessSection->serial_set.'-'.$lessSection->serial_lvl]['previous_note_disciplien_asstu'] ? $previousEducationAspirant[$aspirant->serial_asstu]['more'][$lessSection->serial_scy.'-'.$lessSection->serial_set.'-'.$lessSection->serial_lvl]['previous_note_disciplien_asstu'] : ''; ?>"
                                                                           field="discipline">
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <div class="form-group text-center">
                                                                    <input type="file" class="filestyle file"
                                                                           id="file_<?php echo $aspirant->serial_asstu; ?>_<?php echo $idAspirant; ?>"
                                                                           name="<?php echo $aspirant->serial_asstu.'[previous_school]['.$lessSection->name_lvl.'][file]'; ?>"
                                                                           data-input="false"
                                                                           data-buttonText="Libreta">
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <?php if($previousEducationAspirant[$aspirant->serial_asstu]['more'][$lessSection->serial_scy.'-'.$lessSection->serial_set.'-'.$lessSection->serial_lvl]['filename_dc']): ?>
                                                                <a id="file_<?php echo $aspirant->serial_asstu; ?>_<?php echo $idAspirant; ?>"  target="_blank" class="btn btn-warning"
                                                                   <?php if($schoolYear): ?>
                                                                   href="<?php echo '../../../public/uploads/'.$aspirant->serial_asstu.'/'.$previousEducationAspirant[$aspirant->serial_asstu]['more'][$lessSection->serial_scy.'-'.$lessSection->serial_set.'-'.$lessSection->serial_lvl]['filename_dc']; ?>">
                                                                   <?php else: ?>
                                                                   href="<?php echo '../../public/uploads/'.$aspirant->serial_asstu.'/'.$previousEducationAspirant[$aspirant->serial_asstu]['more'][$lessSection->serial_scy.'-'.$lessSection->serial_set.'-'.$lessSection->serial_lvl]['filename_dc']; ?>">
                                                                   <?php endif; ?>
                                                                   <span class="fa fa-paperclip"></span> ver
                                                            </a>
                                                            <?php endif; ?>
                                                        </td>
                                                    </tr>
                                                    <?php $lessSectionNumber++; ?>
                                                    <?php endforeach; ?>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="form-group col-md-12">
                                        <label class="control-label" style="color: red">
                                            Nota: Si repiti&oacute; alg&uacute;n grado o curso, por favor
                                            explique la razón
                                        </label>
                                    </div>
                                    <div class="form-group col-md-12">
                                        <textarea class="form-control" id="ReasonRepeat<?php echo $aspirant->serial_asstu; ?>"
                                                  name="<?php echo $aspirant->serial_asstu.'[reason_repeat]'; ?>"><?php echo $aspirant->reason_for_repeat; ?></textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="panel panel-primary">
                            <div class="panel-heading text-center"><b>Familia y Representante</b></div>
                            <div class="panel-body">
                                <div class="row">
                                    <div class="form-group col-md-6">
                                        <label class="control-label" for="Nombres"><span style="color: red">*</span> Los Padres viven</label>
                                        <div class="radio">
                                            <input type="radio"
                                                   id="fatherLivesTogether<?php echo $aspirant->serial_asstu; ?>"
                                                   name="<?php echo $aspirant->serial_asstu.'[fathersLives]'; ?>"
                                                   value="TOGETHER" 
                                                   class="lvv"
                                                   <?php echo $aspirant->Parents_live_asstu == 'TOGETHER' ? 'checked' : ''; ?>>

                                            <label for="fatherLivesTogether<?php echo $aspirant->serial_asstu; ?>">
                                                Juntos</label>
                                        </div>
                                        <div class="radio">
                                            <input type="radio"
                                                   id="fatherLivesSeparated<?php echo $aspirant->serial_asstu; ?>"
                                                   name="<?php echo $aspirant->serial_asstu.'[fathersLives]'; ?>"
                                                   value="SEPARATED"
                                                   class="lvv"
                                                   <?php echo $aspirant->Parents_live_asstu == 'SEPARATED' ? 'checked' : ''; ?>>
                                            <label for="fatherLivesSeparated<?php echo $aspirant->serial_asstu; ?>">Separados</label>
                                        </div>
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label class="control-label" for="Nombres">Con qui&eacute;n
                                            vive?</label>
                                        <div class="radio">
                                            <input type="radio"
                                                   id="livesWithParents<?php echo $aspirant->serial_asstu; ?>"
                                                   name="<?php echo $aspirant->serial_asstu.'[livesWith]'; ?>"
                                                   value="PARENTS"
                                                   <?php echo $aspirant->lives_with_asstu == 'PARENTS' ? 'checked' : ''; ?>>
                                            <label for="livesWithParents<?php echo $aspirant->serial_asstu; ?>">Padre y
                                                Madre</label>
                                        </div>
                                        <div class="radio">
                                            <input type="radio"
                                                   class="livesWith"
                                                   id="livesWithFather<?php echo $aspirant->serial_asstu; ?>"
                                                   name="<?php echo $aspirant->serial_asstu.'[livesWith]'; ?>"
                                                   serial_asstu="<?php echo $aspirant->serial_asstu; ?>"
                                                   value="FATHER"
                                                   <?php echo $aspirant->lives_with_asstu == 'FATHER' ? 'checked' : ''; ?>>
                                            <label for="livesWithFather<?php echo $aspirant->serial_asstu; ?>">Padre</label>
                                        </div>
                                        <div class="radio">
                                            <input type="radio"
                                                   id="livesWithMother<?php echo $aspirant->serial_asstu; ?>"
                                                   class="livesWith"
                                                   name="<?php echo $aspirant->serial_asstu.'[livesWith]'; ?>"
                                                   serial_asstu="<?php echo $aspirant->serial_asstu; ?>"
                                                   value="MOTHER"
                                                   <?php echo $aspirant->lives_with_asstu == 'MOTHER' ? 'checked' : ''; ?>>
                                            <label for="livesWithMother<?php echo $aspirant->serial_asstu; ?>">Madre</label>
                                        </div>
                                        <div class="radio">
                                            <input type="radio"
                                                   id="livesWithOther<?php echo $aspirant->serial_asstu; ?>"
                                                   class="livesWith"
                                                   name="<?php echo $aspirant->serial_asstu.'[livesWith]'; ?>"
                                                   serial_asstu="<?php echo $aspirant->serial_asstu; ?>"
                                                   value="OTHER"
                                                   <?php echo $aspirant->lives_with_asstu == 'OTHER' ? 'checked' : ''; ?>>
                                            <label for="livesWithOther<?php echo $aspirant->serial_asstu; ?>">Otro</label>
                                        </div>
                                    </div>
                                </div>
                                <hr>
                                <div class="row">
                                    <div class="form-group col-md-6">
                                        <?php echo Form::label('numberBrother'.$aspirant->serial_asstu, 'N&uacute;mero de Hermanos'); ?>

                                        <?php echo Form::text($aspirant->serial_asstu.'[numberBrother]', $aspirant->siblings_asstu,['id' =>' numberBrother'.$aspirant->serial_asstu, 'class'=>'form-control']); ?>

                                    </div>
                                    <div class="form-group col-md-6">
                                        <?php echo Form::label('brothers'.$aspirant->serial_asstu, '¿Qu&eacute; puesto ocupa entre sus
                                                        hermano?'); ?>

                                        <input type="number" class="form-control"
                                               id="brothers<?php echo $aspirant->serial_asstu; ?>"
                                               name="<?php echo $aspirant->serial_asstu.'[brothersPosition]'; ?>"
                                               value="<?php echo $aspirant->position_sibling_asstu; ?>">
                                    </div>
                                </div>
                                <!--la tabla que se hace aqui deberia ser dinamica y que se llame segun los datos guardados anteriormente-->
                                <div class="table-responsive" id="tableSibling<?php echo $aspirant->serial_asstu; ?>">

                                </div>
                                <hr>
                                <div class="row">
                                    <div class="form-group col-md-6">
                                        <label class="control-label" for="Nombres">Representante</label>
                                        <div class="radio">
                                            <input type="radio"
                                                   id="guardianFather<?php echo $aspirant->serial_asstu; ?>"
                                                   class="guardian"
                                                   name="<?php echo $aspirant->serial_asstu.'[guardian]'; ?>"
                                                   serial_asstu="<?php echo $aspirant->serial_asstu; ?>"
                                                   value="FATHER"
                                                   disabled
                                                   <?php echo $aspirant->legal_guardian=='FATHER' ? 'checked' :''; ?>>
                                                   <label for="guardianFather<?php echo $aspirant->serial_asstu; ?>">Padre</label>
                                        </div>
                                        <div class="radio">
                                            <input type="radio"
                                                   id="guardianMother<?php echo $aspirant->serial_asstu; ?>"
                                                   class="guardian"
                                                   name="<?php echo $aspirant->serial_asstu.'[guardian]'; ?>"
                                                   serial_asstu="<?php echo $aspirant->serial_asstu; ?>"
                                                   value="MOTHER"
                                                   disabled
                                                   <?php echo $aspirant->legal_guardian=='MOTHER' ? 'checked' :''; ?>>
                                                   <label for="guardianMother<?php echo $aspirant->serial_asstu; ?>">Madre</label>
                                        </div>
                                        <div class="radio">
                                            <input type="radio"
                                                   id="guardianOther<?php echo $aspirant->serial_asstu; ?>"
                                                   class="guardian"
                                                   name="<?php echo $aspirant->serial_asstu.'[guardian]'; ?>"
                                                   serial_asstu="<?php echo $aspirant->serial_asstu; ?>"
                                                   value="OTHER"
                                                   disabled=""
                                                   <?php echo $aspirant->legal_guardian=='OTHER' ? 'checked' :''; ?>>
                                            <label for="guardianOther<?php echo $aspirant->serial_asstu; ?>">Otro</label>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="panel panel-primary">
                            <div class="panel-heading text-center"><b>Documentos del aspirante</b></div>
                            <div class="panel-body">
                                <div class="row">
                                    <div class="col-md-4 text-center">
                                        <?php if($schoolSetup->serial_sst!=13): ?>
                                            <h5>C&eacute;dula de identidad del aspirante</h5>
                                        <?php else: ?>
                                            <h5>C&eacute;dula / pasaporte del aspirante</h5>
                                        <?php endif; ?>
                                        <p>Formato PDF máximo 1 MB</p>
                                        <input type="file"
                                               id="pdf_ci_<?php echo $aspirant->serial_asstu; ?>"
                                               class="filestyle apply-tooltip pdf_ci"
                                               name="<?php echo $aspirant->serial_asstu.'[files][pdf_ci]'; ?>"
                                               serial_asstu="<?php echo $aspirant->serial_asstu; ?>"
                                               accept="application/pdf"
                                               data-buttonText="Cargar archivo" <?php echo ($schoolSetup->serial_sst==13  && count($aspirant->files) == 0) ? 'required':''; ?>>
                                        <br/>
                                        <?php foreach($aspirant->files as $file): ?>
                                        <?php if($file->type_file == 'CI'): ?>
                                        <a id="pdf_ci_<?php echo $aspirant->serial_asstu; ?>"  target="_blank" class="btn btn-warning"
                                           <?php if($schoolYear): ?>
                                           href="<?php echo '../../../public/uploads/' . $aspirant->serial_asstu . '/' . $file->filename_dc; ?>"><span class="fa fa-file-pdf-o"></span> Ver archivo
                                            <?php else: ?>
                                            href="<?php echo '../../public/uploads/' . $aspirant->serial_asstu . '/' . $file->filename_dc; ?>"><span class="fa fa-file-pdf-o"></span> Ver archivo
                                            <?php endif; ?>
                                            actual</a>
                                        <?php endif; ?>
                                        <?php endforeach; ?>
                                    </div>
                                    <?php if($schoolSetup->serial_sst!=9 && $schoolSetup->serial_sst!=13): ?>
                                    <div class="col-md-4 text-center">
                                        <h5>Partida de nacimiento <?php if($schoolSetup->serial_sst==9): ?> (en caso de no disponer de cédula) <?php endif; ?> </h5>
                                        <p>Formato PDF máximo 1 MB</p>
                                        <input type="file"
                                               id="pdf_birthday_certified_<?php echo $aspirant->serial_asstu; ?>"
                                               class="filestyle apply-tooltip pdf_birthday_certified"
                                               name="<?php echo $aspirant->serial_asstu.'[files][pdf_birthday_certified]'; ?>"
                                               serial_asstu="<?php echo $aspirant->serial_asstu; ?>"
                                               data-buttonText="Cargar archivo"
                                               target="_blank">
                                        <br/>
                                        <?php foreach($aspirant->files as $file): ?>
                                        <?php if($file->type_file == 'BIRTHDAY-CERTIFIED'): ?>
                                        <a id="pdf_birthday_certified_<?php echo $aspirant->serial_asstu; ?>" target="_blank" class="btn btn-warning"
                                           <?php if($schoolYear): ?>
                                           href="<?php echo '../../../public/uploads/' . $aspirant->serial_asstu . '/' . $file->filename_dc; ?>"> <span class="fa fa-file-pdf-o "></span> Ver archivo
                                            <?php else: ?>
                                            href="<?php echo '../../public/uploads/' . $aspirant->serial_asstu . '/' . $file->filename_dc; ?>"> <span class="fa fa-file-pdf-o "></span> Ver archivo
                                            <?php endif; ?>
                                            actual</a>
                                        <?php endif; ?>
                                        <?php endforeach; ?>
                                    </div>
                                    <?php endif; ?>
                                    <?php if($schoolSetup->serial_sst==13): ?>
                                        <div class="col-md-4 text-center">
                                            <h5> Cédula / pasaporte de los padres de familia</h5>
                                            <p>Formato PDF máximo 1 MB</p>
                                            <input type="file"
                                                   id="pdf_ci_guardians_<?php echo $aspirant->serial_asstu; ?>"
                                                   class="filestyle apply-tooltip pdf_ci_guardians"
                                                   name="<?php echo $aspirant->serial_asstu.'[files][pdf_ci_guardians]'; ?>"
                                                   serial_asstu="<?php echo $aspirant->serial_asstu; ?>"
                                                   accept="application/pdf"
                                                   data-buttonText="Cargar archivo" <?php echo ($schoolSetup->serial_sst==13 && count($aspirant->files) == 0) ? 'required':''; ?>>
                                            <br/>
                                            <?php foreach($aspirant->files as $file): ?>
                                                <?php if($file->type_file == 'CI_GUARDIANS'): ?>
                                                    <a id="pdf_ci_<?php echo $aspirant->serial_asstu; ?>"  target="_blank" class="btn btn-warning"
                                                       <?php if($schoolYear): ?>
                                                       href="<?php echo '../../../public/uploads/' . $aspirant->serial_asstu . '/' . $file->filename_dc; ?>"><span class="fa fa-file-pdf-o"></span> Ver archivo
                                                        <?php else: ?>
                                                            href="<?php echo '../../public/uploads/' . $aspirant->serial_asstu . '/' . $file->filename_dc; ?>"><span class="fa fa-file-pdf-o"></span> Ver archivo
                                                        <?php endif; ?>
                                                        actual</a>
                                                <?php endif; ?>
                                            <?php endforeach; ?>
                                        </div>
                                    <?php endif; ?>
                                    <div class="col-md-4 text-center">
                                        <h5>Fotograf&iacute;a del aspirane </h5>
                                        <p>Formato .jpg|.jpeg|.png máximo 1 MB</p>
                                        <input type="file"
                                               id="photo_<?php echo $aspirant->serial_asstu; ?>"
                                               class="filestyle apply-tooltip photo"
                                               name="<?php echo $aspirant->serial_asstu.'[files][photo]'; ?>"
                                               serial_asstu="<?php echo $aspirant->serial_asstu; ?>"
                                               data-buttonText="Cargar archivo" <?php echo ($schoolSetup->serial_sst==13 && count($aspirant->files) == 0) ? 'required':''; ?>>
                                        <br/>
                                        <?php foreach($aspirant->files as $file): ?>
                                        <?php if($file->type_file == 'PHOTO'): ?>
                                        <a id="photo_<?php echo $aspirant->serial_asstu; ?>" target="_blank" class="btn btn-warning"
                                           <?php if($schoolYear): ?>
                                           href="<?php echo '../../../public/uploads/' . $aspirant->serial_asstu . '/' . $file->filename_dc; ?>"><span class="fa fa-picture-o "></span> Ver imagen
                                            <?php else: ?>
                                            href="<?php echo '../../public/uploads/' . $aspirant->serial_asstu . '/' . $file->filename_dc; ?>"><span class="fa fa-picture-o "></span> Ver imagen
                                            <?php endif; ?>
                                            actual</a>
                                        <?php endif; ?>
                                        <?php endforeach; ?>
                                    </div>
                                    <?php if($schoolSetup->serial_sst==13): ?>
                                        <div class="col-md-4 text-center">
                                            <h5> Certificado de NO adeudar colegio o guardería anterior</h5>
                                            <p>Formato PDF máximo 1 MB</p>
                                            <input type="file"
                                                   id="pdf_authorization_<?php echo $aspirant->serial_asstu; ?>"
                                                   class="filestyle apply-tooltip pdf_authorization"
                                                   name="<?php echo $aspirant->serial_asstu.'[files][pdf_authorization]'; ?>"
                                                   serial_asstu="<?php echo $aspirant->serial_asstu; ?>"
                                                   accept="application/pdf"
                                                   data-buttonText="Cargar archivo">
                                            <br/>
                                            <?php foreach($aspirant->files as $file): ?>
                                                <?php if($file->type_file == 'AUTHORIZATION'): ?>
                                                    <a id="pdf_ci_<?php echo $aspirant->serial_asstu; ?>"  target="_blank" class="btn btn-warning"
                                                       <?php if($schoolYear): ?>
                                                       href="<?php echo '../../../public/uploads/' . $aspirant->serial_asstu . '/' . $file->filename_dc; ?>"><span class="fa fa-file-pdf-o"></span> Ver archivo
                                                        <?php else: ?>
                                                            href="<?php echo '../../public/uploads/' . $aspirant->serial_asstu . '/' . $file->filename_dc; ?>"><span class="fa fa-file-pdf-o"></span> Ver archivo
                                                        <?php endif; ?>
                                                        actual</a>
                                                <?php endif; ?>
                                            <?php endforeach; ?>
                                        </div>
                                    <?php endif; ?>
                                </div>
                                <br/>
                                <div class="row">
                                    <?php if($schoolSetup->serial_sst==9): ?>
                                    <div>
                                        <div class="row">
                                            <label class="text-muted col-md-10 col-md-offset-1"  style="color: red" >AGRADECERÍAMOS LLEVAR ESTOS DOCUMENTOS FÍSICAMENTE AL COLEGIO, O SI DESEA TAMBIÉN, PUEDE LEVANTAR ESTA INFORMACIÓN DIGITALMENTE EN ESTE ESPACIO:</label>
                                        </div>
                                        <div class="row">
                                            <div class="text-muted col-md-10 col-md-offset-1">
                                                <ul>
                                                    <li style="color: red">Copia de cédula</li>
                                                    <li style="color: red">Fotografía</li>
                                                    <li style="color: red">Libreta del estudiante</li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                    <?php else: ?>
                                    <label class="text-muted col-md-10 col-md-offset-1" style="color: red">NOTA: PUEDE LEVANTAR LA INFORMACIÓN DIGITALMENTE EN ESTE ESPACIO O LLEVARLA FÍSICAMENTE AL COLEGIO</label>
                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <?php endforeach; ?>
    </div>
    <?php if(count($aspirants)>0): ?>
    <div class="row">
        <div class="text-center">
            <button type="submit" name="btnSave" id="btnSave" class="btn btn-primary">Siguiente</button>
            <a target='_self' href="<?php echo action('WebAspirantController@getCreateGuardian'); ?>">
                <button type="button" name="btnNext" id="btnNext" class="btn btn-default" hidden="true">
                    Siguiente
                </button>
            </a>
        </div>
    </div>
    <?php endif; ?>
</div>
</div>
<?php echo Form::hidden('serial_scy',$school_year->serial_scy); ?>

<?php echo Form::close(); ?>


<!--el modal-->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog modal-md">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel" style="text-align: center">Agregar Nueva Instituci&oacute;n</h4>
            </div>
            <div class="modal-body" id="modal-body">
                <div class="form-group">
                    <label>Nombre de la nueva Instituci&oacute;n: </label>
                    <input type="text" class="form-control" name="newInst" id="newInst">
                </div>
                <div id="message">

                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" id="saveInst" name="saveInst">Guardar</button>
                <button type="button" class="btn btn-default" data-dismiss="modal" id="exitInst">Salir</button>
            </div>
        </div>
    </div>
</div>
<!--fin modal modal-->

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout.sidebar', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>