66 lines
2.7 KiB
PHP
66 lines
2.7 KiB
PHP
@extends('layouts.shop')
|
|
|
|
@section('content')
|
|
@include('partials.breadcrumbs', [
|
|
'items' => [
|
|
['label' => __('Главная'), 'url' => route('home')],
|
|
['label' => __('Сравнение'), 'url' => null],
|
|
],
|
|
])
|
|
|
|
<section class="pc-section">
|
|
<div class="pc-section-title">
|
|
<h2>{{ __('Сравнение товаров') }}</h2>
|
|
</div>
|
|
|
|
@if ($products->isEmpty())
|
|
<div class="pc-card">
|
|
<h3>{{ __('Список сравнения пуст') }}</h3>
|
|
<p>{{ __('Добавьте товары в сравнение из карточек каталога.') }}</p>
|
|
<a class="pc-btn primary" href="{{ route('catalog.index') }}">{{ __('Перейти в каталог') }}</a>
|
|
</div>
|
|
@else
|
|
<div class="pc-compare-actions">
|
|
<form method="post" action="{{ route('compare.clear') }}" data-preserve-scroll="true">
|
|
@csrf
|
|
@method('delete')
|
|
<button class="pc-btn ghost" type="submit">{{ __('Очистить сравнение') }}</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="pc-products-grid">
|
|
@foreach ($products as $product)
|
|
@include('partials.product-card', ['product' => $product])
|
|
@endforeach
|
|
</div>
|
|
|
|
@if ($specKeys->isNotEmpty())
|
|
<div class="pc-card pc-compare-table-wrap">
|
|
<div class="pc-table-scroll">
|
|
<table class="pc-compare-table">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ __('Характеристика') }}</th>
|
|
@foreach ($products as $product)
|
|
<th>{{ $product->name }}</th>
|
|
@endforeach
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($specKeys as $key)
|
|
<tr>
|
|
<th>{{ __($specLabels[$key] ?? $key) }}</th>
|
|
@foreach ($products as $product)
|
|
<td>{{ __(strval(data_get($product->specs, $key, '—'))) }}</td>
|
|
@endforeach
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
@endif
|
|
</section>
|
|
@endsection
|