This commit is contained in:
69
resources/views/shop/cart.blade.php
Normal file
69
resources/views/shop/cart.blade.php
Normal file
@@ -0,0 +1,69 @@
|
||||
@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
|
||||
Reference in New Issue
Block a user