70 lines
3.6 KiB
PHP
70 lines
3.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 ($items->isEmpty())
|
|
<div class="pc-card">
|
|
<h3>{{ __('Корзина пустая') }}</h3>
|
|
<p>{{ __('Добавьте товары из каталога, чтобы оформить заказ.') }}</p>
|
|
<a class="pc-btn primary" href="{{ route('catalog.index') }}">{{ __('Перейти в каталог') }}</a>
|
|
</div>
|
|
@else
|
|
<div class="pc-cart-layout">
|
|
<div class="pc-cart-list">
|
|
@foreach ($items as $item)
|
|
@php($product = $item['product'])
|
|
<article class="pc-card pc-cart-item">
|
|
<div class="pc-cart-item-main">
|
|
<h3>
|
|
<a class="pc-product-link" href="{{ route('products.show', $product) }}">{{ $product->name }}</a>
|
|
</h3>
|
|
@if ($product->short_description)
|
|
<p>{{ $product->short_description }}</p>
|
|
@endif
|
|
</div>
|
|
<div class="pc-cart-item-side">
|
|
<form method="post" action="{{ route('cart.update', $product) }}" class="pc-cart-qty-form" data-preserve-scroll="true">
|
|
@csrf
|
|
@method('patch')
|
|
<input type="number" name="quantity" min="1" max="{{ max(1, $product->stock) }}" value="{{ $item['quantity'] }}">
|
|
<button class="pc-btn ghost" type="submit">{{ __('Обновить') }}</button>
|
|
</form>
|
|
<strong class="pc-cart-subtotal">{{ number_format($item['subtotal'], 0, '.', ' ') }} {{ config('shop.currency_symbol', '₽') }}</strong>
|
|
<form method="post" action="{{ route('cart.remove', $product) }}" data-preserve-scroll="true">
|
|
@csrf
|
|
@method('delete')
|
|
<button class="pc-btn ghost" type="submit">{{ __('Удалить') }}</button>
|
|
</form>
|
|
</div>
|
|
</article>
|
|
@endforeach
|
|
</div>
|
|
|
|
<aside class="pc-card pc-cart-summary">
|
|
<h3>{{ __('Итого') }}</h3>
|
|
<div class="pc-cart-summary-row">
|
|
<span>{{ __('Товаров') }}</span>
|
|
<strong>{{ $itemsCount }}</strong>
|
|
</div>
|
|
<div class="pc-cart-summary-row">
|
|
<span>{{ __('Сумма') }}</span>
|
|
<strong>{{ number_format($total, 0, '.', ' ') }} {{ config('shop.currency_symbol', '₽') }}</strong>
|
|
</div>
|
|
<a class="pc-btn primary" href="{{ route('checkout.show') }}">{{ __('Перейти к оформлению') }}</a>
|
|
</aside>
|
|
</div>
|
|
@endif
|
|
</section>
|
|
@endsection
|