{{ csrf_field() }}
<div class="box box-primary">
    <div class="box-header with-border">
        <h3 class="box-title"></h3>
    </div>

    <div class="box-body">
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    {!! Form::label('title', 'Titolo:') !!} 
                    {!! Form::text('title', null, array('class' => 'form-control title')) !!}
                </div>                
            </div>
            <div class="col-md-6">    
                <div class="form-group">
                    {!! Form::label('image', 'Immagine (300x200px):') !!}<br>
                    <div class="custom-file-upload">{!! Form::file('image', null, array('class' => 'form-control')) !!}</div>
                    @if (isset($video) && $video->image != '')
                        <br><img src="/files/videos/{{$video->image}}" style="max-width:250px" />
                    @endif
                </div>            
            </div>
            
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    {!! Form::label('type', 'Piattaforma:') !!}
                    {!! Form::select('type', ['Youtube' => 'Youtube', 'Vimeo' => 'Vimeo', 'Facebook' => 'Facebook'] , null, array('class' => 'form-control')) !!}
                </div>                
            </div>
            <div class="col-md-6" style="display:none">
                <div class="form-group">
                    {!! Form::label('url', 'Codice embed:') !!}
                    {!! Form::text('url', null, array('class' => 'form-control')) !!}
                </div>                
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    {!! Form::label('embed', 'Codice embed:') !!}
                    {!! Form::textarea('embed', null, array('class' => 'form-control', 'rows' => '10')) !!}
                </div>                
            </div>
            <div class="col-md-6">    
                <div class="form-group">
                    {!! Form::label('file', 'Video:') !!}<br>
                    <div class="custom-file-upload">{!! Form::file('file', null, array('class' => 'form-control')) !!}</div>
                    @if (isset($video) && $video->file != '')
                        <br><a href="/files/videos/{{$video->file}}">{{$video->file}}</a>
                    @endif
                </div>            
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    {!! Form::label('date', 'Data:') !!}
                    {!! Form::text('date', null, array('class' => 'form-control')) !!}
                </div>                
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    {!! Form::label('online', 'Online:') !!}<br>
                    {!! Form::checkbox('online', 'on', null) !!}
                </div>                
            </div>
        </div>
    </div>

    <div class="box-footer">
        {!! Form::submit($submit_text, ['class'=>'btn btn-success', 'name' => 'save']) !!}
        {!! link_to_route('videos.index', 'Annulla', null, array('class' => 'btn btn-info')) !!}
    </div>
</div>

@section('extra_css')

    <link rel="stylesheet" href="/backend/plugins/daterangepicker/daterangepicker.css">

@stop

@section('extra_js')

    <script src="/backend/plugins/input-mask/jquery.inputmask.js"></script>
    <script src="/backend/plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
    <script src="/backend/plugins/input-mask/jquery.inputmask.extensions.js"></script>

    <script src="/backend/plugins/moment/moment.min.js"></script>
    <script src="/backend/plugins/daterangepicker/daterangepicker.js"></script>

    <script>
        
        $(function () {

            $("[name='date']").daterangepicker({ singleDatePicker: true, timePicker: true, timePicker24Hour: true, locale: { format: 'DD/MM/YYYY HH:mm' }})            
            
        });

    </script>
@stop