@extends('layouts.site')
@section('meta_title', __('Catalog::theme.catalog.heading'))

@section('content')
@include('partials._catalog.toolbar.toolbar')

<section class="container mt-2 catalog-page">
        @if (isset($page) && $page->hasContent())
            <div class="content-rich mb-4">
                {!! $page->getContent() !!}
            </div>
        @endif

        @if (session('error'))
            <div class="alert alert-warning mb-4">
                {{ session('error') }}
            </div>
        @endif

        <div class="row catalog-home-grid">
            @php $catalogCount = $catalogs->count(); @endphp
            @if ($catalogCount > 0)
                @foreach($catalogs as $catalog)
                    <div class="col-xs-12 col-md-6">
                        <a class="catalog-card block" href="{{ $catalog->url() }}">
                            <img class="catalog-card__image" src="{{ Theme::image("{$catalog->code}.jpg") }}" alt="{{ $catalog->name }}" />
                            <div class="catalog-card__body">
                                <h2 class="catalog-card__title">{{ $catalog->name }}</h2>
                                <p class="catalog-card__copy">{{ __('Catalog::theme.catalog.heading') }}</p>
                            </div>
                        </a>
                    </div>
                @endforeach
            @else
                <div class="col-xs-12">
                    <div class="alert alert-danger">
                    {{ __('Catalog::theme.catalog.error.unsupported_country') }}
                    </div>
                </div>
            @endif
        </div>
</section>
@endsection
