<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
    <h4 class="modal-title caption-subject font-blue-secondary sbold uppercase">Registrar nueva encuesta</h4>
</div>
{{ Form::open(['route' => 'encuesta.crear','class'=>'form-horizontal','id' => 'form-validation','style'=>'padding: 5px 5px 5px 5px;','enctype'=> 'multipart/form-data']) }}
{{ csrf_field() }}
<div class="modal-body">
    <div class="form-group">
        <div class="col-md-3 col-xs-12">
            <label class = "caption-subject font-blue-secondary sbold">
                Nombre
            </label>
        </div>
        <div class="col-md-9 col-xs-12">
            {!! Form::text('nombre', null, ['class' => 'form-control', 'required' => 'required']) !!}
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-3 col-xs-12">
            <label class = "caption-subject font-blue-secondary sbold">
                Descripci&oacute;n
            </label>
        </div>
        <div class="col-md-9 col-xs-12">
            {!! Form::textarea('descripcion', null, ['class' => 'form-control', 'required' => 'required', 'style' => 'height: 120px; resize: none;']) !!}
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-3 col-xs-12">
            <label class = "caption-subject font-blue-secondary sbold">
                Fecha Publicaci&oacute;n
            </label>
        </div>
        <div class="col-md-9 col-xs-12">
            {!! Form::text  ('fecha_publicacion', null, ['id' => 'fecha_publicacion','class' => 'form-control', 'required' => 'required']) !!}
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-3 col-xs-12">
            <label class = "caption-subject font-blue-secondary sbold">
                Fecha Finalizaci&oacute;n
            </label>
        </div>
        <div class="col-md-9 col-xs-12">
            {!! Form::text('fecha_finalizacion', null, ['id' => 'fecha_finalizacion', 'class' => 'form-control', 'required' => 'required']) !!}
        </div>
    </div>
    <div class="form-actions text-right">
        <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
        <button id="submitBtn" type="submit" class="btn btn-primary ladda-button" data-style="slide-down">
            <span class="ladda-label">Guardar</span>
            <span class="ladda-spinner"></span>
        </button>
    </div>
</div>
{!! Form::close() !!}
<script>
    $('#fecha_publicacion').datepicker({
        language: 'es',
        autoclose: true,
        startDate: new Date()
    })
        .on('changeDate', function(e) {
            $('#fecha_finalizacion').datepicker('setStartDate', e.date);
        });

    $('#fecha_finalizacion').datepicker({
        language: 'es',
        autoclose: true,
        startDate: new Date()
    })
        .on('changeDate', function(e) {
            $('#fecha_publicacion').datepicker('setEndDate', e.date);
        });

    $("#form-validation").validate({
        submitHandler: function (form) {
            var l = Ladda.create(document.querySelector('#submitBtn'));
            l.start();
            form.submit();
        }
    });
</script>