Files
tehnobox/resources/views/shop/compare.blade.php
ssww23 93a655235a
Some checks failed
Deploy / deploy (push) Has been cancelled
Initial commit
2026-03-10 00:55:37 +03:00

66 lines
2.6 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>{{ data_get($product->specs, $key, '—') }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
@endif
</section>
@endsection