@foreach ($article_natures as $nature)
    <div class="btn products" data-id="{{ $nature }}">
        @if ($article_nature == $nature)
            @php
                $iconType = 'icon_selection';
                $iconClass = 'badge-success';
            @endphp
        @else
            @php
                $iconType = 'icon';
                $iconClass = 'badge-secondary';
            @endphp
        @endif

        @php
            $icon = App\Repositories\Shop\ArticleNatures::getIconBySlug($nature, 'normal', $iconType);
        @endphp
        @if ($icon)
            <img src="{{ $icon }}" alt="{{ $nature }}">
        @else
            <span class="badge {{ $iconClass }}" style="font-size: 1.2em;">{{ $nature }}</span>
        @endif
    </div>
@endforeach

@push('js')
    <script>
        $('#by_rows').click(function() {
            $('#display_by_rows').val(1);
            $('#category-form').submit();
        });
        $('#by_cards').click(function() {
            $('#display_by_rows').val(0);
            $('#category-form').submit();
        });
        $('.products').click(function() {
            $('#article_nature').val($(this).data('id'));
            $('#category-form').submit();
        });
    </script>
@endpush
