{{ Form::open([
    'route' => 'Admin.Shop.Articles.store',
    'id' => 'article-form',
    'autocomplete' => 'off',
    'files' => true,
]) }}
<input type="hidden" name="id" id="id" value="{{ $article['id'] ?? null }}">

@php
    $articlePublicUrl = null;
    if (!empty($article['slug'] ?? null)) {
        $articlePublicUrl = route('Shop.Articles.slug', ['slug' => $article['slug']]);
    } elseif (!empty($article['id'] ?? null)) {
        $articlePublicUrl = route('Shop.Articles.show', ['id' => $article['id']]);
    }
@endphp

@if ($articlePublicUrl)
    <div class="d-flex justify-content-end mb-3">
        <a href="{{ $articlePublicUrl }}" class="btn btn-outline-primary" target="_blank" rel="noopener">
            Voir la page publique
            <i class="fa fa-external-link"></i>
        </a>
    </div>
@endif

@include('Admin.Shop.Articles.partials.characteristics')
{{ Form::close() }}

<x-save :cancel-url="$cancel_url ?? null" :duplicate-url="$duplicate_url ?? null" />

@include('load.form.appender')
@include('load.form.editor')
@include('load.form.save')
@include('load.form.select2')
@include('load.form.set_options')
@include('load.form.toggle')
@include('load.form.upload.fileinput')
@include('load.layout.chevron')
@include('load.layout.modal')

@push('js')
    {!! JsValidator::formRequest('App\Http\Requests\Admin\Shop\StoreArticlePost', '#article-form') !!}

    <script>
        $(function() {
            $('.active-checkbox').bootstrapToggle();
            $('.active-checkbox').off().change(function(e) {
                var id = $('#id').val();
            });

            initChevron();
            initEditor();
            initSaveForm('#article-form');
            initSelect2();
        });
    </script>
@endpush
