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

@section('content')
    @component('components.card')
        @include('components.datatable', [
            'route' => route('Admin.Shop.Offers.index'),
            'model' => 'offers',
            'with_filters' => true,
            'callback' => 'handleOffer();',
        ])
        @component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-offers-filters'])
            @include('Admin.Shop.Offers.partials.filters', ['model' => 'offers'])
        @endcomponent
    @endcomponent
@endsection

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

@push('js')
    <script>
        function handleOffer() {
            initToggle("{{ route('Admin.Shop.Offers.toggleActive') }}");
        }

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