@extends('layouts.master')

@section('navigation')
    @if ($role == 1)
        @include('local.managers.admins._new_navigation')
    @elseif($role == 2)
        @include('local.managers.sCoords._new_navigation')
    @elseif($role == 3)
        @include('local.managers.pCoords._new_navigation')
    @endif
@stop

@section('main')
    <button class="btn btn-lg btn-primary pull-right" id='show'>Custom Report</button>
    <div class="" id='make_report'>
        <hr>
        <b>
            <h3>Report Options</h3><br>
        </b>
        {{-- For for adding a new outcome --}}
        {{ Form::open(['action' => 'ProgramsController@showReport']) }}
        <div class="row">
            <div class="col-md-1">
            </div>
            <div class="col-md-5">
                {{ Form::label('name', 'Select which semesters to report on') }}<br>
                @foreach ($semesters as $semester)
                    @if ($semester->is_visible)
                        <div class="form-group">
                            <input type="checkbox" id="semester{{ $semester->id }}" name="semester{{ $semester->id }}"
                                value="semester{{ $semester->id }}">
                            <label for="semester{{ $semester->id }}">{{ $semester->name }}({{ $semester->code }})</label>
                            {{-- {{ Form::checkbox('semester'.$semester->id, $semester->name, array('class' => 'form-control', 'id'=>$semester->id)) }}
                {{ Form::label('semester'.$semester->id, $semester->name.'('.$semester->code.')') }}<br> --}}
                        </div>
                    @endif
                @endforeach
            </div>
            <div class="col-md-6">
                {{ Form::label('divulgacion', 'Select metodos de divulgacion') }}<br>
                <div class="form-group">
                    <input type="checkbox" id="profesores" name="profesores" value="Profesores (pares)">
                    <label for="profesores">Profesores (pares)</label>
                </div>
                <div class="form-group">
                    <input type="checkbox" id="comiteDepartamental" name="comiteDepartamental"
                        value="Comites de curriculo departamental">
                    <label for="comiteDepartamental">Comites de curriculo departamental</label>
                </div>
                <div class="form-group">
                    <input type="checkbox" id="comiteFacultadEscuela" name="comiteFacultadEscuela"
                        value="Comites de curriculo  de Facultad o Escuela">
                    <label for="comiteFacultadEscuela">Comites de curriculo de Facultad o Escuela</label>
                </div>
                <div class="form-group">
                    <input type="checkbox" id="pleno" name="pleno" value="Pleno de la Facultad">
                    <label for="pleno">Pleno de la Facultad</label>
                </div>
                <div class="form-group">
                    <input type="checkbox" id="estudiantes" name="estudiantes" value="Estudiantes">
                    <label for="estudiantes">Estudiantes</label>
                </div>
                <div class="form-group">
                    <input type="checkbox" id="administrativos" name="administrativos" value="Administrativos">
                    <label for="administrativos">Administrativos</label>
                </div>
                <div class="form-group">
                    <input type="checkbox" id="senado" name="senado" value="Senado">
                    <label for="senado">Senado</label>
                </div>
                <div class="form-group">
                    <input type="checkbox" id="comunidadWeb" name="comunidadWeb" value="Comunidad (pagina web)">
                    <label for="comunidadWeb">Comunidad (pagina web)</label>
                </div>
                <div class="form-group">
                    <input type="checkbox" id="otros" name="otros" value="Otros">
                    <label for="otros">Otro- <input type="text" id='otherBox'></label>
                </div>
            </div>
        </div>
        <div class="row">
            <div class=""><button type="submit" id='submit' class="btn btn-lg btn-primary center-block">Create
                    Report</button></div>
        </div>
        {{ Form::close() }}
        <hr>
        <button class="btn btn-lg btn-primary pull-right" id='hide'>Hide Form</button>
    </div>

    <div class="row">
        <div class="col-md-12">
            <table class="table table-condensed table-stripedd datatable">
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>School</th>
                    </tr>
                </thead>
                <tfoot>
                    <tr class="column-search">
                        <th><input class="column-search-bar form-control" type="text" placeholder="Buscar" /></th>
                        <th><select class="column-search-select form-control">
                                <option value=""></option>
                            </select></th>
                    </tr>
                </tfoot>
                <tbody>
                    @foreach ($programs as $program)
                        <tr>
                            <td>{{ HTML::linkAction('ProgramsController@show', $program->name, [$program->id]) }}
                            </td>
                            <td>{{ $program->school->name }}</td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
    </div>

@stop


@section('included-js')

    <!-- Datatables -->
    @include('global._datatables_js')

@stop

@section('javascript')

    $('#make_report').hide();

    //show form
    $('#show').on('click', function(e)
    {
    $('#make_report').show();
    $('#show').hide();
    });

    //hide form
    $('#hide').on('click', function(e)
    {
    $('#make_report').hide();
    $('#show').show();
    });

    //on submit, change value of the checkbox input of id 'other'
    $('#submit').click(function(){
    $('#otros').val('Otro- '+$('#otherBox').val());
    });
@stop
