@extends('layouts.nova')

@section('content')
<div class="container">
    <h2>Edit Artwork: {{ $artwork->title }}</h2>

    <form enctype="multipart/form-data" method="post" action="{{ route('manage.update', $artwork->id) }}">
        @csrf

        <div class="row">
            <div class="col-md-7">
                <label class="label-control">Title:</label>
                <input type="text" name="title" class="form-control" value="{{ old('title', $artwork->title) }}">

                <label class="label-control">Section:</label>
                <select name="section" class="form-control">
                    @foreach($categories as $cat)
                        <option value="{{ $cat->category_id }}" {{ $cat->category_id == $artwork->category ? 'selected' : '' }}>{{ $cat->category_name }}</option>
                    @endforeach
                </select>

                <label class="label-control">Description:</label>
                <textarea name="description" class="form-control summernote_lite" style="width:100%;height:100px">{{ old('description', $artwork->description) }}</textarea>
            </div>

            <div class="col-md-5">
                <label class="label-control">Thumbnail</label>
                <div style="clear:both;" id="quickPreviewShot">
                    @if($artwork->picture)
                        <img src="/storage/uploads/artworks/{{ $artwork->picture }}" class="img-responsive" style="padding:5px;border:solid 1px #999;box-shadow:1px 1px 3px #999">
                    @else
                        <div class="alert alert-warning">No thumbnail</div>
                    @endif
                </div>

                <hr>
                <label class="label-control">Upload new artwork</label><br>
                <div class="btn btn-primary ulBtn">
                    <span class="fa fa-photo"></span>
                    <input type="file" name="artwork" data-preview_id="quickPreviewShot" class="uploadImage quickThumbShow">
                    Choose Artwork
                </div>

                <br style="clear:both;"><br><hr>
                <label class="label-control">Attachment file (*.zip)</label><br>
                <div class="btn btn-primary ulBtn">
                    <span class="fa fa-upload"></span>
                    <input type="file" name="attachment" class="uploadImage">
                    Choose Attachment
                </div>

            </div>
        </div>

        <input type="hidden" name="id" value="{{ $artwork->id }}">
        <br>
        <button type="submit" class="btn btn-success"><i class="fa fa-save fa-fw"></i> Update Artwork</button>
    </form>
</div>
@endsection

@push('scripts')
<script>
    $(document).ready(function(){
        $('.summernote_lite').summernote({
            toolbar: [
                ['style', ['bold', 'italic', 'underline', 'clear']],
                ['font', ['strikethrough']],
                ['fontsize', ['fontsize']],
                ['color', ['color']],
            ]
        });
    });
</script>
@endpush
