@extends('layout.index', [
    'title' => __('shop.articles.title'),
    'subtitle' => __('shop.articles.list'),
    'breadcrumb' => [__('shop.articles.title')],
])

@section('content')
    <x-card>
        @include('components.datatable', [
            'route' => route('Admin.Shop.Articles.index'),
            'model' => 'articles',
            'with_filters' => true,
            'callback' => 'handleArticle()',
        ])
        @component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-articles-filters'])
            @include('Admin.Shop.Articles.partials.filters', ['model' => 'articles'])
        @endcomponent
    </x-card>
@endsection

@include('load.form.select2')
@include('load.form.toggle')

@push('js')
    <script>
        function handleArticle() {
            initToggle("{{ route('Admin.Shop.Articles.toggleVisible') }}", '.visible');
            initToggle("{{ route('Admin.Shop.Articles.toggleHomepage') }}", '.homepage');
        }

        $(document).ready(function() {
            initSelect2();
        });
    </script>
@endpush
