@extends('template.layout')


@section('styles')
    <link href="{{asset('css/icheck/skins/all.css')}}" rel="stylesheet" type="text/css"/>

    <link href="{{asset('plugins/select2/css/select2.min.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{asset('plugins/select2/css/select2-bootstrap.min.css')}}" rel="stylesheet" type="text/css" />
    <style>
        .select2-selection.select2-selection--single{
            height: 34px !important;
        }

        .txe{

        }
        #tbPersonal_wrapper{
            padding-left: 2% !important;
            padding-right: 2% !important;
            padding-top: 1% !important;
        }
        .select2_TypeAsist{
            width: 100px !important;
            display: inline-block !important;
            margin-left: 10% !important;
            /*margin-right: 5px;*/
        }
        .form-control.input-md.marc-entrada,
        .form-control.input-md.marc-salida,
        .min-tardanza{
            text-align: center;
            width: 50%;
            margin-left: 25%;
        }
    </style>
@endsection

@section('content')
    <h1 class="page-title">
        Asistencia del Personal
    </h1>
    @if($menssage != "")
        <div class="alert alert-danger">
            <strong>Atenci&oacute;n: </strong>{{$menssage}}
        </div>
    @endif
    <div class="portlet light bordered">
        <div class="portlet-title">
            <div class="caption">
                <h1 class="caption-subject font-green sbold uppercase"> Lista del Personal </h1>
            </div>
            {!! Form::hidden('invisible', date_format( new DateTime($dia), 'Y-m-d' ), array('id' => 'invisible_id')) !!}
            <div class="actions">
                <div class="btn-group">
                    <a href="{{ route('descargar.formato.excel') }}" class="btn green btn-outline sbold" id="fm-excel">
                        Formato Excel
                    </a>
                </div>
                @if($verificar == 1)
                    <div class="btn-group carga_excel">
                        <button class="btn blue btn-outline sbold btnCarga"> Registro de asistencia del d&iacute;a</button>
                    </div>
                @endif
            </div>
        </div>
        <div class="portlet-body">
            <div class="row">
                <div class="col-md-6">
                    <div class="col-md-10">
                        <div class="col-md-6">
                            <h4><i class="glyphicon glyphicon-search"></i>  Busqueda avanzada</h4>
                        </div>
                        <div class="col-md-6">
                            <h6 style="margin-bottom: 0px; margin-top: 16px">Por: Codigo, Nombres y Apellidos</h6>
                        </div>
                        <input type="search" class="form-control input-md" id="text-filter" aria-controls="tbEncuestas">
                    </div>
                </div>

                <div class="col-md-3">
                    <div class="col-md-8">
                        <h4><i class="glyphicon glyphicon-user"></i>  Rol del Personal</h4>
                        {!! Form::select('lstType[]',$roles,null, ['class' => 'form-control select2 select2-hidden-accessible','id'=>'lstType','style'=>'width:100%','placeholder' => 'Todos']) !!}
                    </div>
                </div>

                <div class="col-md-2">
                    <div class="form-group">
                        <label class="control-label" for="fecha_inicio" style="margin-bottom: 8%">Fecha de asistencias pasadas</label>
                        <div id="fecha_inicio" class="input-group date date-picker" data-date-format="dd-mm-yyyy">
                            {!! Form::text('fecha_inicio', date_format( new DateTime($dia), 'd-m-Y' ) , array('class' => 'form-control fecha_inicioe','id' => 'fecha_inicioe' , 'required' => 'required')) !!}
                            <span class="input-group-btn">
                                <button class="btn default" type="button">
                                  <i class="fa fa-calendar"></i>
                                </button>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="Forum-ForumTopicList row" >
                <table class="table table-striped table-bordered table-hover table-bg" id="tbPersonal">
                    <thead class="thead-default" style="text-align: center !important;">
                    <tr style="text-align: center">
                        <th class="col-md-1 col-lg-1 col-xs-1" style="text-align: center !important;">C&oacute;digo</th>
                        <th class="col-md-2 col-lg-2 col-xs-2" style="text-align: center !important;">Personal</th>
                        <th class="col-md-2 col-lg-2 col-xs-2" style="text-align: center;">Roles</th>
                        <th style="text-align: center !important;">Fecha de Registro</th>
                        <th style="text-align: center !important;">Marcado de Entrada</th>
                        <th style="text-align: center !important;">Marcado de Salida</th>
                        <th style="text-align: center !important;">Estado de Asistencia</th>
                        <th style="text-align: center !important;">Minutos de Tardanza</th>
                        <th style="text-align: center !important;">Falta</th>
                    </tr>
                    </thead>
                    <tbody style="text-align: center !important;">

                    </tbody>
                </table>
                @if($verificar == 1)
                    <div class="col-md-12 carga_excel" style="text-align: left">
                        <button type="button" class="btn green confirm">Registrar Asistencia</button>
                    </div>
                @endif
            </div>
        </div>
    </div>


    <div id="EditarPersonalModal" class="modal fade modal-scroll" tabindex="-1" data-backdrop="static" data-keyboard="false" aria-hidden="true"  data-width="760" style="display: none;">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h3 class="modal-title">Cargar registro de Asistencia</h3>
                </div>
                <form id="f_cargar_datos_usuarios" name="f_cargar_datos_usuarios" method="post" class="formarchivo" enctype="multipart/form-data">
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-md-4" style="width: 27%">
                                <h4 class="modal-title">Subir archivo  <i class="fa fa-file-excel-o"></i></h4>
                            </div>
                            <div class="col-md-8">
                                <input type="file" name="archivo" id="archivo" class="col-md-12 form-control" />
                            </div>
                            <div class="col-md-offset-2 col-md-10">
                                <h5 id="smsred" style="margin-bottom: 0px; margin-top: 20px; text-align: center">Solo se puede subir archivos con formato Excel (.xls)</h5>
                            </div>
                        </div>
                    </div>

                    @include('alerts.index')
                    <div class="modal-footer" style="text-align: center">
                        <button type="button" data-dismiss="modal" class="btn btn-default">Cancelar</button>
                        <button type="submit" class="btn btn-primary">Registrar</button>
                    </div>
                </form>
            </div>

        </div>
    </div>

@endsection

@section('scripts')
    <script src="{{asset('css/icheck/icheck.min.js')}}" type="text/javascript"></script>
    <script src="{{asset('plugins/select2/js/select2.full.min.js')}}" type="text/javascript"></script>
    <script src="{{asset('plugins/select2/js/i18n/es.js')}}" type="text/javascript"></script>
    <script>
        var urlBase = "{{ url('asistencia/personal') }}";
        var urlData = "{{ route('listado.asistencia.personal') }}";
        var urlTomar = "{{ route('tomar.asistencia.personal') }}";
        var urlCarga = "{{ route('carga.masiva.excel') }}";
    </script>
    <script src="{{asset('js/pages/asistencia.personal.js')}}" type="text/javascript"></script>

@endsection

