@extends('layouts.frontend.app')
@push('meta')
    <meta property="og:image" content="{{ asset('uploads/setting/' . setting('auth_logo')) }}" />
@endpush

@section('content')
    @php
        $section_sort_db = setting('section_sort');
        $section_sort = !empty($section_sort_db) ? json_decode($section_sort_db, true) : [
            "slider" => ["status" => 1, "order" => 1, "view" => 'frontend.partial.index.slider'],
            "custom_notices" => ["status" => 1, "order" => 2, "view" => 'frontend.partial.index.custom_notice_section'],
            "custom_section" => ["status" => 1, "order" => 3, "view" => 'frontend.partial.index.custom_section'],
            "campaign_section" => ["status" => 1, "order" => 4, "view" => 'frontend.partial.index.campaign_section'],
            "top_categories" => ["status" => 1, "order" => 5, "view" => 'frontend.partial.index.top_categories'],
            "features_slider" => ["status" => 1, "order" => 6, "view" => 'frontend.partial.index.features_slider'],
            "vendor_seller" => ["status" => 1, "order" => 7, "view" => 'frontend.partial.index.vendor_seller'],
            "latest_products" => ["status" => 1, "order" => 8, "view" => 'frontend.partial.index.latest_product'],
            "advertisement_home_middle" => ["status" => 1, "order" => 9, "view" => 'frontend.partial.index.advertisement.home_middle'],
            "featured_products" => ["status" => 1, "order" => 10, "view" => 'frontend.partial.index.featured_products'],
            "sub_slider" => ["status" => 1, "order" => 11, "view" => 'frontend.partial.index.sub_slider'],
            "classified" => ["status" => 1, "order" => 12, "view" => 'frontend.partial.index.classified'],
            "brands" => ["status" => 1, "order" => 13, "view" => 'frontend.partial.index.brands'],
            "cat_small_summery" => ["status" => 1, "order" => 14, "view" => 'frontend.partial.index.cat_small_summery'],
            "newsletter_section" => ["status" => 1, "order" => 15, "view" => 'frontend.partial.index.newsletter_section'],
            "advertisement_home_bottom" => ["status" => 1, "order" => 16, "view" => 'frontend.partial.index.advertisement.home_bottom']
        ];
        uasort($section_sort, fn($a, $b) => $a['order'] <=> $b['order']);
        $section_sort_json = json_encode($section_sort);
    @endphp
    
    @foreach ($section_sort as $key => $section)
        @if ($section['status'] == 1)
            @if(isset($section['cat_id']) && isset($section['cat_type']))
                @include($section['view'], ['cat_id' => $section['cat_id'], 'cat_type' => $section['cat_type']])
            @else
                @include($section['view'])
            @endif
        @endif
    @endforeach

    {{-- Common grid js/css data etc --}}
    <x-add-cart-modal />
    @include('components.cart-modal-attri')
    {{-- Catgory Collups and Expand System --}}
    @push('internal_css')
        .superCatHomeToggle{height:335px;overflow-y:hidden;border-bottom-right-radius:3px;border-bottom-left-radius:3px;}.superCatHomeToggle
        #superCatViewAll{bottom:0;}#superCatViewAll{position:absolute;bottom:-1.5rem;left:0;right:0;background:var(--MAIN_MENU_BG);color:var(--MAIN_MENU_ul_li_color);z-index:999;outline:none;}
    @endpush
    {{-- /Common grid js/css data etc --}}

    
    @push('js')
        <script>
            document.addEventListener('DOMContentLoaded', function() {
                var superCatElement = document.getElementById('superCat');
                superCatElement.classList.add('superCatHomeToggle');
                superCatElement.addEventListener('mouseenter', function() {
                    superCatElement.classList.remove('superCatHomeToggle');
                });
                superCatElement.addEventListener('mouseleave', function() {
                    superCatElement.classList.add('superCatHomeToggle');
                });
            });
        </script>
    @endpush
@endsection