@extends('layouts.frontend')

@section('title'){{$metatags->title}} @endsection
@section('description'){{$metatags->desc}} @endsection
@section('keywords'){{$metatags->keyw}} @endsection
@section('h1'){{$metatags->h1}} @endsection

@section('content')

@if(count($slides))
@include('frontend.components.slider',$slides)
@endif

@php
    $carousel1 = NULL;
    $carousel2 = NULL;
    $additional_carousels = [];
    if(count($carousels)){

        foreach($carousels as $carousel){
            if($carousel->car_id < 3){
            ${'carousel'.$carousel->car_id} = $carousel;

            } else {
            $additional_carousels[] = $carousel;
            }

            //echo $carousel->car_id ;
        }
    }
@endphp
<section id="maincontent">
<div class="container-fluid">

<div class="ma-corporate-about">
    <div class="row">
        <div class="col-md-3 col-xs-6">
            <div class="block-wrapper wrapper1">
                <div class="text-des">
                    <h3>EXPRESS DELIVERY</h3>
                </div>
            </div>
        </div>
        <div class="col-md-3 col-xs-6">
            <div class="block-wrapper wrapper2">
                <div class="text-des">
                    <h3>ONLINE SUPPORT&nbsp;</h3>
                </div>
            </div>
        </div>
        <div class="col-md-3 col-xs-6">
            <div class="block-wrapper wrapper3">
                <div class="text-des">
                    <h3>WARRANTY</h3>
                    <p>1 year warranty</p>
                </div>
            </div>
        </div>
        <div class="col-md-3 col-xs-6">
            <div class="block-wrapper wrapper4">
                <div class="text-des">
                    <h3>EU STOCK</h3>
                    <p><br></p>
                </div>
            </div>
        </div>
    </div>
</div>

@php
    $ifads1 = (isset($ads[1]) && !empty($ads[1])) ? 1 : 0;
@endphp
@includeWhen($ifads1, 'frontend.components.homepage_ads', ['data' => collect($ads[1])])

@php
    $ifcarousel1 = (!is_null($carousel1)) ? 1 : 0;
@endphp
@includeWhen($ifcarousel1, 'frontend.components.homepage_carousel', ['carousel' => $carousel1, 'cid' => 1])

@php
    $ifads2 = (isset($ads[2]) && !empty($ads[2])) ? 1 : 0;
@endphp
@includeWhen($ifads2, 'frontend.components.homepage_ads', ['data' => collect($ads[2])])

@php
    $ifcarousel2 = (!is_null($carousel2)) ? 1 : 0;
@endphp
@includeWhen($ifcarousel2, 'frontend.components.homepage_carousel', ['carousel' => $carousel2, 'cid' => 2])

@php
    $ifads3 = (isset($ads[3]) && !empty($ads[3])) ? 1 : 0;
@endphp
@includeWhen($ifads3, 'frontend.components.homepage_ads', ['data' => collect($ads[3])])

@if(count($additional_carousels))
    @php $cid = 3 @endphp
    @foreach($additional_carousels as $carousel)
        @include('frontend.components.homepage_carousel', ['carousel' => $carousel, 'cid' => $cid])
        @php ++$cid; @endphp
    @endforeach
@endif

</div><!-- /.container -->
</section>


@endsection

@push('css')
    <link rel="stylesheet" href="{{asset('assets/owlcarousel/assets/owl.carousel.min.css')}}">
    <link rel="stylesheet" href="{{asset('assets/owlcarousel/assets/owl.theme.default.min.css')}}">
@endpush

@push('scripts')
    <script src="{{asset('assets/owlcarousel/owl.carousel.min.js')}}"></script>
    <script src="{{asset('assets/js/products.js')}}"></script>
@endpush
