{{ 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">
                    <label for="title">Titolo:</label> 
                    <input type="text" name="title" class="form-control title" value="{{ old('title') }}">
                </div>                
            </div>
            <div class="col-md-6">    
                <div class="form-group">
                    <label for="image">Immagine (300x200px):</label><br>
                    <div class="custom-file-upload"><input type="file" name="image" 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">
                    <label for="type">Piattaforma:</label>
                    {{-- TODO: Convert Form::select for type manually --}}
<select name="type" class="form-control">
    {{-- Add options manually --}}
</select>
                </div>                
            </div>
            <div class="col-md-6" style="display:none">
                <div class="form-group">
                    <label for="url">Codice embed:</label>
                    <input type="text" name="url" class="form-control" value="{{ old('url') }}">
                </div>                
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label for="embed">Codice embed:</label>
                    <textarea name="embed" class="form-control">{{ old('embed') }}</textarea>
                </div>                
            </div>
            <div class="col-md-6">    
                <div class="form-group">
                    <label for="file">Video:</label><br>
                    <div class="custom-file-upload"><input type="file" name="file" 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">
                    <label for="date">Data:</label>
                    <input type="text" name="date" class="form-control" value="{{ old('date') }}">
                </div>                
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label for="online">Online:</label><br>
                    <input type="checkbox" name="online" value="on" {{ old('online') ? 'checked' : '' }}>
                </div>                
            </div>
        </div>
    </div>

    <div class="box-footer">
        <button type="submit" class="btn btn-success" name="save">{{ $submit_text }}</button>
        <a href="{{ route('videos.index') }}" class="btn btn-info">Annulla</a>
    </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