This commit is contained in:
58
resources/views/shop/account.blade.php
Normal file
58
resources/views/shop/account.blade.php
Normal file
@@ -0,0 +1,58 @@
|
||||
@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>
|
||||
<p>Управляйте данными профиля и просматривайте историю заказов.</p>
|
||||
</div>
|
||||
|
||||
<div class="pc-grid pc-grid-2">
|
||||
<div class="pc-card">
|
||||
<form class="pc-form" method="post" action="{{ route('account.update') }}">
|
||||
@csrf
|
||||
<h3>Данные аккаунта</h3>
|
||||
<label>
|
||||
Имя
|
||||
<input type="text" name="name" value="{{ old('name', $user->name) }}" required>
|
||||
</label>
|
||||
<label>
|
||||
Email
|
||||
<input type="email" name="email" value="{{ old('email', $user->email) }}" required>
|
||||
</label>
|
||||
<div class="pc-product-actions">
|
||||
<button class="pc-btn primary" type="submit">Сохранить</button>
|
||||
</div>
|
||||
</form>
|
||||
<form method="post" action="{{ route('logout') }}">
|
||||
@csrf
|
||||
<button class="pc-btn ghost" type="submit">Выйти</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="pc-card">
|
||||
<h3>Мои заказы</h3>
|
||||
@if ($orders->isEmpty())
|
||||
<p>Пока нет заказов.</p>
|
||||
<a class="pc-btn ghost" href="{{ route('catalog.index') }}">Перейти в каталог</a>
|
||||
@else
|
||||
<div class="pc-account-orders">
|
||||
@foreach ($orders as $order)
|
||||
<a class="pc-account-order" href="{{ route('account.orders.show', $order) }}">
|
||||
<span>Заказ #{{ $order->id }}</span>
|
||||
<strong>{{ number_format($order->total, 0, '.', ' ') }} {{ config('shop.currency_symbol', '₽') }}</strong>
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
41
resources/views/shop/auth/login.blade.php
Normal file
41
resources/views/shop/auth/login.blade.php
Normal file
@@ -0,0 +1,41 @@
|
||||
@extends('layouts.shop')
|
||||
|
||||
@section('content')
|
||||
@include('partials.breadcrumbs', [
|
||||
'items' => [
|
||||
['label' => 'Главная', 'url' => route('home')],
|
||||
['label' => 'Вход', 'url' => null],
|
||||
],
|
||||
])
|
||||
|
||||
<section class="pc-section pc-auth-section">
|
||||
<div class="pc-section-title">
|
||||
<h2>Вход</h2>
|
||||
<p>Введите email и пароль для доступа к заказам и профилю.</p>
|
||||
</div>
|
||||
|
||||
<form class="pc-card pc-form pc-auth-form" method="post" action="{{ route('login.attempt') }}">
|
||||
@csrf
|
||||
<label>
|
||||
Email
|
||||
<input type="email" name="email" value="{{ old('email') }}" required>
|
||||
</label>
|
||||
<label>
|
||||
Пароль
|
||||
<input type="password" name="password" required>
|
||||
</label>
|
||||
<label>
|
||||
Капча: решите пример {{ $captchaQuestion }}
|
||||
<input type="text" name="captcha" inputmode="numeric" autocomplete="off" required>
|
||||
</label>
|
||||
<label class="pc-checkbox">
|
||||
<input type="checkbox" name="remember" value="1" @checked(old('remember'))>
|
||||
<span>Запомнить меня</span>
|
||||
</label>
|
||||
<div class="pc-product-actions">
|
||||
<button class="pc-btn primary" type="submit">Войти</button>
|
||||
<a class="pc-btn ghost" href="{{ route('register') }}">Создать аккаунт</a>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
@endsection
|
||||
45
resources/views/shop/auth/register.blade.php
Normal file
45
resources/views/shop/auth/register.blade.php
Normal file
@@ -0,0 +1,45 @@
|
||||
@extends('layouts.shop')
|
||||
|
||||
@section('content')
|
||||
@include('partials.breadcrumbs', [
|
||||
'items' => [
|
||||
['label' => 'Главная', 'url' => route('home')],
|
||||
['label' => 'Регистрация', 'url' => null],
|
||||
],
|
||||
])
|
||||
|
||||
<section class="pc-section pc-auth-section">
|
||||
<div class="pc-section-title">
|
||||
<h2>Регистрация</h2>
|
||||
<p>Создайте аккаунт, чтобы отслеживать заказы и сохранять избранное.</p>
|
||||
</div>
|
||||
|
||||
<form class="pc-card pc-form pc-auth-form" method="post" action="{{ route('register.store') }}">
|
||||
@csrf
|
||||
<label>
|
||||
Имя
|
||||
<input type="text" name="name" value="{{ old('name') }}" required>
|
||||
</label>
|
||||
<label>
|
||||
Email
|
||||
<input type="email" name="email" value="{{ old('email') }}" required>
|
||||
</label>
|
||||
<label>
|
||||
Пароль
|
||||
<input type="password" name="password" required>
|
||||
</label>
|
||||
<label>
|
||||
Подтверждение пароля
|
||||
<input type="password" name="password_confirmation" required>
|
||||
</label>
|
||||
<label>
|
||||
Капча: решите пример {{ $captchaQuestion }}
|
||||
<input type="text" name="captcha" inputmode="numeric" autocomplete="off" required>
|
||||
</label>
|
||||
<div class="pc-product-actions">
|
||||
<button class="pc-btn primary" type="submit">Зарегистрироваться</button>
|
||||
<a class="pc-btn ghost" href="{{ route('login') }}">Уже есть аккаунт</a>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
@endsection
|
||||
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
|
||||
92
resources/views/shop/catalog.blade.php
Normal file
92
resources/views/shop/catalog.blade.php
Normal file
@@ -0,0 +1,92 @@
|
||||
@extends('layouts.shop')
|
||||
|
||||
@php
|
||||
$searchQuery = trim((string) request('q', ''));
|
||||
$hasCatalogQuery = $searchQuery !== '' || request()->filled('category') || request()->filled('page');
|
||||
$catalogCategoryList = collect($categories ?? [])
|
||||
->values()
|
||||
->map(fn ($category, $index) => [
|
||||
'@type' => 'ListItem',
|
||||
'position' => $index + 1,
|
||||
'url' => route('catalog.category', $category),
|
||||
'name' => $category->name,
|
||||
])
|
||||
->all();
|
||||
$catalogSchema = [
|
||||
'@context' => 'https://schema.org',
|
||||
'@type' => 'CollectionPage',
|
||||
'name' => 'Каталог товаров',
|
||||
'url' => route('catalog.index'),
|
||||
'description' => 'Каталог компьютерных комплектующих и техники.',
|
||||
'mainEntity' => [
|
||||
'@type' => 'ItemList',
|
||||
'numberOfItems' => count($catalogCategoryList),
|
||||
'itemListElement' => $catalogCategoryList,
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
@section('meta_title', $searchQuery !== '' ? "Поиск: {$searchQuery}" : 'Каталог товаров')
|
||||
@section(
|
||||
'meta_description',
|
||||
$searchQuery !== ''
|
||||
? "Результаты поиска по запросу «{$searchQuery}». Подберите нужные комплектующие по наименованию."
|
||||
: 'Каталог компьютерных комплектующих: процессоры, материнские платы, видеокарты, память, накопители и ноутбуки.'
|
||||
)
|
||||
@section('meta_keywords', 'каталог комплектующих, поиск товаров, процессоры, материнские платы, видеокарты')
|
||||
@section('meta_canonical', route('catalog.index'))
|
||||
@section('meta_robots', $hasCatalogQuery ? 'noindex,follow' : 'index,follow')
|
||||
|
||||
@push('structured_data')
|
||||
<script type="application/ld+json">
|
||||
@json($catalogSchema, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@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>
|
||||
|
||||
<div class="pc-grid pc-grid-4 pc-category-grid">
|
||||
@forelse ($categories as $category)
|
||||
<a class="pc-card pc-category-card pc-category-link" href="{{ route('catalog.category', $category) }}">
|
||||
<div class="pc-category-image" role="img" aria-label="{{ $category->name }}"></div>
|
||||
<h3 class="pc-category-title">{{ $category->name }}</h3>
|
||||
</a>
|
||||
@empty
|
||||
<div class="pc-card">Категории пока не добавлены.</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@if (request()->filled('q'))
|
||||
<section class="pc-section">
|
||||
<div class="pc-category-toolbar">
|
||||
<div class="pc-section-title">
|
||||
<h2>Результаты по запросу: "{{ request('q') }}"</h2>
|
||||
</div>
|
||||
<p class="pc-muted">Найдено: <strong>{{ $products->total() }}</strong></p>
|
||||
</div>
|
||||
|
||||
<div class="pc-products-grid">
|
||||
@forelse ($products as $product)
|
||||
@include('partials.product-card', ['product' => $product])
|
||||
@empty
|
||||
<div class="pc-card">По вашему запросу ничего не найдено.</div>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
<div class="pc-pagination">
|
||||
{{ $products->links('partials.pagination') }}
|
||||
</div>
|
||||
</section>
|
||||
@endif
|
||||
@endsection
|
||||
266
resources/views/shop/category.blade.php
Normal file
266
resources/views/shop/category.blade.php
Normal file
@@ -0,0 +1,266 @@
|
||||
@extends('layouts.shop')
|
||||
|
||||
@php
|
||||
$hasSeoFilters = request()->filled('q')
|
||||
|| request()->filled('sort')
|
||||
|| request()->filled('page')
|
||||
|| request()->filled('price_from')
|
||||
|| request()->filled('price_to')
|
||||
|| collect((array) request('filters', []))
|
||||
->contains(fn ($value) => is_scalar($value) && trim((string) $value) !== '')
|
||||
|| collect(request()->query())
|
||||
->keys()
|
||||
->contains(fn ($key) => is_string($key) && (str_ends_with($key, '_from') || str_ends_with($key, '_to')));
|
||||
|
||||
$categoryItemList = collect($products->items())
|
||||
->values()
|
||||
->map(fn ($product, $index) => [
|
||||
'@type' => 'ListItem',
|
||||
'position' => $index + 1,
|
||||
'url' => route('products.show', $product),
|
||||
'name' => $product->name,
|
||||
])
|
||||
->all();
|
||||
$categorySchema = [
|
||||
'@context' => 'https://schema.org',
|
||||
'@type' => 'CollectionPage',
|
||||
'name' => $category->name,
|
||||
'url' => route('catalog.category', $category),
|
||||
'description' => $category->description ?: 'Категория товаров ' . $category->name,
|
||||
'mainEntity' => [
|
||||
'@type' => 'ItemList',
|
||||
'numberOfItems' => $products->total(),
|
||||
'itemListElement' => $categoryItemList,
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
|
||||
@section('meta_title', $category->name)
|
||||
@section('meta_description', ($category->description ?: 'Товары категории ' . $category->name . '.') . ' Фильтры и сортировка для быстрого подбора.')
|
||||
@section('meta_keywords', $category->name . ', комплектующие, купить, фильтры товаров')
|
||||
@section('meta_canonical', route('catalog.category', $category))
|
||||
@section('meta_robots', $hasSeoFilters ? 'noindex,follow' : 'index,follow')
|
||||
|
||||
@push('structured_data')
|
||||
<script type="application/ld+json">
|
||||
@json($categorySchema, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
@include('partials.breadcrumbs', [
|
||||
'items' => [
|
||||
['label' => 'Главная', 'url' => route('home')],
|
||||
['label' => 'Каталог', 'url' => route('catalog.index')],
|
||||
['label' => $category->name, 'url' => null],
|
||||
],
|
||||
])
|
||||
|
||||
<section class="pc-section pc-category-page">
|
||||
<div class="pc-section-title">
|
||||
<h2>{{ $category->name }}</h2>
|
||||
</div>
|
||||
|
||||
@php
|
||||
$activeFilters = collect((array) ($appliedFilters ?? []))
|
||||
->filter(fn ($value) => is_scalar($value) && trim((string) $value) !== '')
|
||||
->values();
|
||||
|
||||
if (request()->filled('price_from') || request()->filled('price_to')) {
|
||||
$priceFromLabel = trim((string) request('price_from', ''));
|
||||
$priceToLabel = trim((string) request('price_to', ''));
|
||||
$activeFilters->push("Цена: {$priceFromLabel} - {$priceToLabel}");
|
||||
}
|
||||
|
||||
foreach ((array) ($filters ?? []) as $filter) {
|
||||
if ((string) ($filter['filter'] ?? 'select') !== 'range') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$rangeKey = (string) ($filter['key'] ?? '');
|
||||
if ($rangeKey === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fromParam = $rangeKey . '_from';
|
||||
$toParam = $rangeKey . '_to';
|
||||
if (!request()->filled($fromParam) && !request()->filled($toParam)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fromLabel = trim((string) request($fromParam, ''));
|
||||
$toLabel = trim((string) request($toParam, ''));
|
||||
$activeFilters->push(($filter['label'] ?? $rangeKey) . ": {$fromLabel} - {$toLabel}");
|
||||
}
|
||||
@endphp
|
||||
|
||||
<div class="pc-category-toolbar">
|
||||
<p class="pc-muted">Найдено товаров: <strong>{{ $products->total() }}</strong></p>
|
||||
<div class="pc-category-toolbar-controls">
|
||||
<form class="pc-sort-form" method="get">
|
||||
@foreach ((array) ($appliedFilters ?? []) as $key => $value)
|
||||
@if (is_scalar($value) && trim((string) $value) !== '')
|
||||
<input type="hidden" name="filters[{{ $key }}]" value="{{ $value }}">
|
||||
@endif
|
||||
@endforeach
|
||||
@if (request()->filled('price_from'))
|
||||
<input type="hidden" name="price_from" value="{{ request('price_from') }}">
|
||||
@endif
|
||||
@if (request()->filled('price_to'))
|
||||
<input type="hidden" name="price_to" value="{{ request('price_to') }}">
|
||||
@endif
|
||||
@foreach ((array) ($filters ?? []) as $filter)
|
||||
@php
|
||||
$rangeKey = (string) ($filter['key'] ?? '');
|
||||
@endphp
|
||||
@continue($rangeKey === '' || (string) ($filter['filter'] ?? 'select') !== 'range')
|
||||
@if (request()->filled($rangeKey . '_from'))
|
||||
<input type="hidden" name="{{ $rangeKey }}_from" value="{{ request($rangeKey . '_from') }}">
|
||||
@endif
|
||||
@if (request()->filled($rangeKey . '_to'))
|
||||
<input type="hidden" name="{{ $rangeKey }}_to" value="{{ request($rangeKey . '_to') }}">
|
||||
@endif
|
||||
@endforeach
|
||||
@if (request()->filled('q'))
|
||||
<input type="hidden" name="q" value="{{ request('q') }}">
|
||||
@endif
|
||||
<label for="sort">Сортировка:</label>
|
||||
<select id="sort" name="sort" onchange="this.form.submit()">
|
||||
<option value="newest" @selected($sort === 'newest')>Сначала новые</option>
|
||||
<option value="price_asc" @selected($sort === 'price_asc')>Сначала дешевле</option>
|
||||
<option value="price_desc" @selected($sort === 'price_desc')>Сначала дороже</option>
|
||||
<option value="name_asc" @selected($sort === 'name_asc')>По названию</option>
|
||||
</select>
|
||||
</form>
|
||||
<button
|
||||
class="pc-filter-inline-toggle"
|
||||
type="button"
|
||||
data-filter-toggle
|
||||
aria-controls="pc-category-filters"
|
||||
aria-expanded="{{ $activeFilters->isNotEmpty() ? 'true' : 'false' }}"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M4 6h16v2H4V6zm3 5h10v2H7v-2zm3 5h4v2h-4v-2z"></path>
|
||||
</svg>
|
||||
<span>Фильтр</span>
|
||||
@if ($activeFilters->isNotEmpty())
|
||||
<span class="pc-filter-toggle-count">{{ $activeFilters->count() }}</span>
|
||||
@endif
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@if ($activeFilters->isNotEmpty())
|
||||
<div class="pc-filter-tags">
|
||||
@foreach ($activeFilters as $key => $value)
|
||||
<span class="pc-filter-chip">{{ $value }}</span>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="pc-catalog-layout">
|
||||
<aside class="pc-filters">
|
||||
<div id="pc-category-filters" class="pc-filter-details {{ $activeFilters->isNotEmpty() ? 'is-open' : '' }}">
|
||||
<form method="get">
|
||||
<div class="pc-filter-title">Фильтры</div>
|
||||
@if ($sort !== 'newest')
|
||||
<input type="hidden" name="sort" value="{{ $sort }}">
|
||||
@endif
|
||||
@if (request()->filled('q'))
|
||||
<input type="hidden" name="q" value="{{ request('q') }}">
|
||||
@endif
|
||||
<label class="pc-filter-block">
|
||||
<span>Цена</span>
|
||||
<div class="pc-range-fields">
|
||||
<input
|
||||
type="number"
|
||||
name="price_from"
|
||||
step="1"
|
||||
value="{{ $priceFilter['from'] ?? '' }}"
|
||||
@if (!empty($priceFilter['min'])) min="{{ $priceFilter['min'] }}" @endif
|
||||
@if (!empty($priceFilter['max'])) max="{{ $priceFilter['max'] }}" @endif
|
||||
placeholder="От"
|
||||
>
|
||||
<input
|
||||
type="number"
|
||||
name="price_to"
|
||||
step="1"
|
||||
value="{{ $priceFilter['to'] ?? '' }}"
|
||||
@if (!empty($priceFilter['min'])) min="{{ $priceFilter['min'] }}" @endif
|
||||
@if (!empty($priceFilter['max'])) max="{{ $priceFilter['max'] }}" @endif
|
||||
placeholder="До"
|
||||
>
|
||||
</div>
|
||||
</label>
|
||||
@forelse ($filters as $filter)
|
||||
@php
|
||||
$filterKey = (string) ($filter['key'] ?? '');
|
||||
$isRangeFilter = (string) ($filter['filter'] ?? 'select') === 'range';
|
||||
$rangeData = (array) ($rangeFilters[$filterKey] ?? []);
|
||||
@endphp
|
||||
@continue($filterKey === '')
|
||||
@if ($isRangeFilter)
|
||||
<label class="pc-filter-block">
|
||||
<span>{{ $filter['label'] }}</span>
|
||||
<div class="pc-range-fields">
|
||||
<input
|
||||
type="number"
|
||||
name="{{ $filterKey }}_from"
|
||||
step="1"
|
||||
value="{{ $rangeData['from'] ?? '' }}"
|
||||
@if (!empty($rangeData['min'])) min="{{ $rangeData['min'] }}" @endif
|
||||
@if (!empty($rangeData['max'])) max="{{ $rangeData['max'] }}" @endif
|
||||
placeholder="От"
|
||||
>
|
||||
<input
|
||||
type="number"
|
||||
name="{{ $filterKey }}_to"
|
||||
step="1"
|
||||
value="{{ $rangeData['to'] ?? '' }}"
|
||||
@if (!empty($rangeData['min'])) min="{{ $rangeData['min'] }}" @endif
|
||||
@if (!empty($rangeData['max'])) max="{{ $rangeData['max'] }}" @endif
|
||||
placeholder="До"
|
||||
>
|
||||
</div>
|
||||
</label>
|
||||
@else
|
||||
<label class="pc-filter-block">
|
||||
<span>{{ $filter['label'] }}</span>
|
||||
<select name="filters[{{ $filterKey }}]">
|
||||
<option value="">Все</option>
|
||||
@foreach ($filterOptions[$filterKey] ?? [] as $option)
|
||||
@php
|
||||
$optionValue = trim((string) $option);
|
||||
@endphp
|
||||
@continue($optionValue === '')
|
||||
<option value="{{ $optionValue }}" @selected(($appliedFilters[$filterKey] ?? '') === $optionValue)>
|
||||
{{ $optionValue }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</label>
|
||||
@endif
|
||||
@empty
|
||||
<p class="pc-muted">Для этой категории фильтры пока не заданы.</p>
|
||||
@endforelse
|
||||
<div class="pc-filter-actions">
|
||||
<button type="submit" class="pc-btn primary">Показать</button>
|
||||
<a class="pc-btn ghost" href="{{ route('catalog.category', $category) }}">Сбросить</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<div class="pc-products-grid">
|
||||
@forelse ($products as $product)
|
||||
@include('partials.product-card', ['product' => $product])
|
||||
@empty
|
||||
<div class="pc-card">Пока нет товаров в этой категории.</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pc-pagination">
|
||||
{{ $products->links('partials.pagination') }}
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
69
resources/views/shop/checkout-payment.blade.php
Normal file
69
resources/views/shop/checkout-payment.blade.php
Normal file
@@ -0,0 +1,69 @@
|
||||
@extends('layouts.shop')
|
||||
|
||||
@section('content')
|
||||
@include('partials.breadcrumbs', [
|
||||
'items' => [
|
||||
['label' => 'Главная', 'url' => route('home')],
|
||||
['label' => 'Корзина', 'url' => route('cart.index')],
|
||||
['label' => 'Данные получателя', 'url' => route('checkout.show')],
|
||||
['label' => 'Реквизиты для оплаты', 'url' => null],
|
||||
],
|
||||
])
|
||||
|
||||
<section class="pc-section">
|
||||
<div class="pc-section-title">
|
||||
<h2>Реквизиты для оплаты</h2>
|
||||
<p>Переведите сумму заказа по реквизитам ниже и подтвердите оформление.</p>
|
||||
</div>
|
||||
|
||||
<div class="pc-cart-layout">
|
||||
<div class="pc-card">
|
||||
<h3>Данные получателя</h3>
|
||||
<p><strong>{{ $customer['customer_name'] }}</strong></p>
|
||||
<p>{{ $customer['email'] }}</p>
|
||||
@if (!empty($customer['phone']))
|
||||
<p>{{ $customer['phone'] }}</p>
|
||||
@endif
|
||||
<p>{{ $customer['address'] }}</p>
|
||||
@if (!empty($customer['comment']))
|
||||
<p>Комментарий: {{ $customer['comment'] }}</p>
|
||||
@endif
|
||||
|
||||
<div class="pc-product-actions">
|
||||
<a class="pc-btn ghost" href="{{ route('checkout.show') }}">Изменить данные</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<aside class="pc-card pc-cart-summary">
|
||||
<h3>Ваш заказ</h3>
|
||||
<div class="pc-account-orders">
|
||||
@foreach ($items as $item)
|
||||
<div class="pc-account-order">
|
||||
<span>{{ $item['product']->name }} × {{ $item['quantity'] }}</span>
|
||||
<strong>{{ number_format($item['subtotal'], 0, '.', ' ') }} {{ config('shop.currency_symbol', '₽') }}</strong>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<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>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
@include('partials.payment-requisites', [
|
||||
'amount' => $total,
|
||||
'purpose' => 'Номер заказа будет присвоен после подтверждения',
|
||||
'showHelp' => true,
|
||||
])
|
||||
|
||||
<form method="post" action="{{ route('checkout.store') }}">
|
||||
@csrf
|
||||
<button class="pc-btn primary" type="submit">Подтвердить оформление заказа</button>
|
||||
</form>
|
||||
</section>
|
||||
@endsection
|
||||
32
resources/views/shop/checkout-success.blade.php
Normal file
32
resources/views/shop/checkout-success.blade.php
Normal file
@@ -0,0 +1,32 @@
|
||||
@extends('layouts.shop')
|
||||
|
||||
@section('content')
|
||||
@include('partials.breadcrumbs', [
|
||||
'items' => [
|
||||
['label' => 'Главная', 'url' => route('home')],
|
||||
['label' => 'Заказ оформлен', 'url' => null],
|
||||
],
|
||||
])
|
||||
|
||||
<section class="pc-section">
|
||||
<div class="pc-card">
|
||||
<h2>Заказ №{{ $order->id }} успешно оформлен</h2>
|
||||
<p>Мы приняли заказ в обработку. Статус заказа: <strong>{{ $order->status }}</strong>.</p>
|
||||
<p>Способ оплаты: <strong>{{ $order->payment_method_label }}</strong>.</p>
|
||||
<p>Сумма заказа: <strong>{{ number_format($order->total, 0, '.', ' ') }} {{ config('shop.currency_symbol', '₽') }}</strong>.</p>
|
||||
|
||||
@include('partials.payment-requisites', [
|
||||
'amount' => $order->total,
|
||||
'purpose' => 'Заказ #' . $order->id,
|
||||
'showHelp' => true,
|
||||
])
|
||||
|
||||
<div class="pc-product-actions">
|
||||
<a class="pc-btn primary" href="{{ route('catalog.index') }}">Продолжить покупки</a>
|
||||
@auth
|
||||
<a class="pc-btn ghost" href="{{ route('account.orders.show', $order) }}">Открыть заказ</a>
|
||||
@endauth
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
65
resources/views/shop/checkout.blade.php
Normal file
65
resources/views/shop/checkout.blade.php
Normal file
@@ -0,0 +1,65 @@
|
||||
@extends('layouts.shop')
|
||||
|
||||
@section('content')
|
||||
@include('partials.breadcrumbs', [
|
||||
'items' => [
|
||||
['label' => 'Главная', 'url' => route('home')],
|
||||
['label' => 'Корзина', 'url' => route('cart.index')],
|
||||
['label' => 'Данные получателя', 'url' => null],
|
||||
],
|
||||
])
|
||||
|
||||
<section class="pc-section">
|
||||
<div class="pc-section-title">
|
||||
<h2>Данные получателя</h2>
|
||||
<p>Заполните контакты и перейдите на страницу с реквизитами для оплаты.</p>
|
||||
</div>
|
||||
|
||||
<div class="pc-cart-layout">
|
||||
<form class="pc-card pc-form" method="post" action="{{ route('checkout.prepare') }}">
|
||||
@csrf
|
||||
<label>
|
||||
Имя получателя
|
||||
<input type="text" name="customer_name" value="{{ old('customer_name', session('checkout.customer.customer_name', auth()->user()->name ?? '')) }}" required>
|
||||
</label>
|
||||
<label>
|
||||
Email
|
||||
<input type="email" name="email" value="{{ old('email', session('checkout.customer.email', auth()->user()->email ?? '')) }}" required>
|
||||
</label>
|
||||
<label>
|
||||
Телефон
|
||||
<input type="text" name="phone" value="{{ old('phone', session('checkout.customer.phone')) }}">
|
||||
</label>
|
||||
<label>
|
||||
Адрес доставки
|
||||
<textarea name="address" required>{{ old('address', session('checkout.customer.address')) }}</textarea>
|
||||
</label>
|
||||
<label>
|
||||
Комментарий к заказу
|
||||
<textarea name="comment">{{ old('comment', session('checkout.customer.comment')) }}</textarea>
|
||||
</label>
|
||||
<button class="pc-btn primary" type="submit">Перейти к реквизитам</button>
|
||||
</form>
|
||||
|
||||
<aside class="pc-card pc-cart-summary">
|
||||
<h3>Ваш заказ</h3>
|
||||
<div class="pc-account-orders">
|
||||
@foreach ($items as $item)
|
||||
<div class="pc-account-order">
|
||||
<span>{{ $item['product']->name }} × {{ $item['quantity'] }}</span>
|
||||
<strong>{{ number_format($item['subtotal'], 0, '.', ' ') }} {{ config('shop.currency_symbol', '₽') }}</strong>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<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>
|
||||
</aside>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
65
resources/views/shop/compare.blade.php
Normal file
65
resources/views/shop/compare.blade.php
Normal file
@@ -0,0 +1,65 @@
|
||||
@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
|
||||
30
resources/views/shop/favorites.blade.php
Normal file
30
resources/views/shop/favorites.blade.php
Normal file
@@ -0,0 +1,30 @@
|
||||
@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-products-grid">
|
||||
@foreach ($products as $product)
|
||||
@include('partials.product-card', ['product' => $product])
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</section>
|
||||
@endsection
|
||||
71
resources/views/shop/home.blade.php
Normal file
71
resources/views/shop/home.blade.php
Normal file
@@ -0,0 +1,71 @@
|
||||
@extends('layouts.shop')
|
||||
|
||||
@section('meta_title', 'Главная')
|
||||
@section('meta_description', 'Интернет-магазин комплектующих для ПК: процессоры, материнские платы, видеокарты, ноутбуки и периферия.')
|
||||
@section('meta_keywords', 'интернет-магазин пк, комплектующие, процессоры, видеокарты, ноутбуки')
|
||||
@section('meta_canonical', route('home'))
|
||||
|
||||
@section('content')
|
||||
<section class="pc-home-sliders">
|
||||
@include('partials.home-slider', [
|
||||
'slides' => $leftSlides,
|
||||
'sliderClass' => 'is-main',
|
||||
'fallbackTitle' => 'Собирайте ПК быстрее',
|
||||
'fallbackText' => 'Процессоры, материнские платы, видеокарты, ноутбуки и периферия в одном каталоге.',
|
||||
'fallbackUrl' => route('catalog.index'),
|
||||
'fallbackButton' => 'Перейти в каталог',
|
||||
])
|
||||
@include('partials.home-slider', [
|
||||
'slides' => $rightSlides,
|
||||
'sliderClass' => 'is-side',
|
||||
'fallbackTitle' => 'Доставка и оплата',
|
||||
'fallbackText' => 'Узнайте сроки доставки и способы оплаты заказа.',
|
||||
'fallbackUrl' => route('pages.shipping-payment'),
|
||||
'fallbackButton' => 'Подробнее',
|
||||
])
|
||||
</section>
|
||||
|
||||
<section class="pc-section">
|
||||
<div class="pc-section-title">
|
||||
<h2>Категории</h2>
|
||||
</div>
|
||||
<div class="pc-grid pc-grid-4 pc-category-grid">
|
||||
@foreach ($categories as $category)
|
||||
<a class="pc-card pc-category-card pc-category-link" href="{{ route('catalog.category', $category) }}">
|
||||
<div class="pc-category-image" role="img" aria-label="{{ $category->name }}"></div>
|
||||
<h3 class="pc-category-title">{{ $category->name }}</h3>
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@include('partials.product-carousel', [
|
||||
'title' => 'Популярные товары',
|
||||
'products' => $featured,
|
||||
'emptyText' => 'Пока нет популярных товаров.',
|
||||
])
|
||||
|
||||
@include('partials.product-carousel', [
|
||||
'title' => 'Новые товары',
|
||||
'products' => $newProducts,
|
||||
'emptyText' => 'Пока нет новых товаров.',
|
||||
])
|
||||
|
||||
<section class="pc-grid pc-grid-3">
|
||||
<a class="pc-card pc-category-link" href="{{ route('pages.shipping-payment') }}">
|
||||
<div class="pc-card-meta">Сервис</div>
|
||||
<h3>Доставка и оплата</h3>
|
||||
<p>Условия доставки, способы оплаты и сроки отправки.</p>
|
||||
</a>
|
||||
<a class="pc-card pc-category-link" href="{{ route('pages.about') }}">
|
||||
<div class="pc-card-meta">Компания</div>
|
||||
<h3>О нас</h3>
|
||||
<p>Чем занимаемся и как помогаем выбрать комплектующие.</p>
|
||||
</a>
|
||||
<a class="pc-card pc-category-link" href="{{ route('pages.contacts') }}">
|
||||
<div class="pc-card-meta">Поддержка</div>
|
||||
<h3>Контакты</h3>
|
||||
<p>Свяжитесь с нами для консультации по вашей сборке.</p>
|
||||
</a>
|
||||
</section>
|
||||
@endsection
|
||||
60
resources/views/shop/order.blade.php
Normal file
60
resources/views/shop/order.blade.php
Normal file
@@ -0,0 +1,60 @@
|
||||
@extends('layouts.shop')
|
||||
|
||||
@section('content')
|
||||
@include('partials.breadcrumbs', [
|
||||
'items' => [
|
||||
['label' => 'Главная', 'url' => route('home')],
|
||||
['label' => 'Личный кабинет', 'url' => route('account')],
|
||||
['label' => 'Заказ #' . $order->id, 'url' => null],
|
||||
],
|
||||
])
|
||||
|
||||
<section class="pc-section">
|
||||
<div class="pc-section-title">
|
||||
<h2>Заказ #{{ $order->id }}</h2>
|
||||
<p>Статус: <strong>{{ $order->status }}</strong></p>
|
||||
<p>Способ оплаты: <strong>{{ $order->payment_method_label }}</strong></p>
|
||||
</div>
|
||||
|
||||
<div class="pc-grid pc-grid-2">
|
||||
<div class="pc-card">
|
||||
<h3>Состав заказа</h3>
|
||||
<div class="pc-account-orders">
|
||||
@foreach ($order->items as $item)
|
||||
<div class="pc-account-order">
|
||||
<span>{{ $item->name }} × {{ $item->quantity }}</span>
|
||||
<strong>{{ number_format($item->subtotal, 0, '.', ' ') }} {{ config('shop.currency_symbol', '₽') }}</strong>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="pc-cart-summary-row">
|
||||
<span>Итого</span>
|
||||
<strong>{{ number_format($order->total, 0, '.', ' ') }} {{ config('shop.currency_symbol', '₽') }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pc-card">
|
||||
<h3>Данные получателя</h3>
|
||||
<p><strong>{{ $order->customer_name }}</strong></p>
|
||||
<p>{{ $order->email }}</p>
|
||||
@if ($order->phone)
|
||||
<p>{{ $order->phone }}</p>
|
||||
@endif
|
||||
@if ($order->address)
|
||||
<p>{{ $order->address }}</p>
|
||||
@endif
|
||||
@if ($order->comment)
|
||||
<p>Комментарий: {{ $order->comment }}</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (!in_array($order->status, ['paid', 'shipped', 'completed'], true))
|
||||
@include('partials.payment-requisites', [
|
||||
'amount' => $order->total,
|
||||
'purpose' => 'Заказ #' . $order->id,
|
||||
'showHelp' => true,
|
||||
])
|
||||
@endif
|
||||
</section>
|
||||
@endsection
|
||||
221
resources/views/shop/product.blade.php
Normal file
221
resources/views/shop/product.blade.php
Normal file
@@ -0,0 +1,221 @@
|
||||
@extends('layouts.shop')
|
||||
|
||||
@php
|
||||
$productGallery = $product->gallery_urls;
|
||||
$productImage = $productGallery[0] ?? ($product->image_url ?: config('seo.default_image'));
|
||||
$productImageUrl = str_starts_with($productImage, 'http://') || str_starts_with($productImage, 'https://')
|
||||
? $productImage
|
||||
: url($productImage);
|
||||
$productSchemaImages = array_map(
|
||||
fn (string $image) => str_starts_with($image, 'http://') || str_starts_with($image, 'https://')
|
||||
? $image
|
||||
: url($image),
|
||||
$productGallery !== [] ? array_values($productGallery) : [$productImageUrl]
|
||||
);
|
||||
|
||||
$manufacturer = trim((string) ($product->specs['manufacturer'] ?? ''));
|
||||
$conditionRaw = mb_strtolower(trim((string) ($product->specs['condition'] ?? '')));
|
||||
$itemCondition = str_contains($conditionRaw, 'б/у') || str_contains($conditionRaw, 'used')
|
||||
? 'https://schema.org/UsedCondition'
|
||||
: 'https://schema.org/NewCondition';
|
||||
|
||||
$productSchema = [
|
||||
'@context' => 'https://schema.org',
|
||||
'@type' => 'Product',
|
||||
'name' => $product->name,
|
||||
'description' => $product->short_description ?: ($product->description ?: "Купить {$product->name} по выгодной цене."),
|
||||
'sku' => $product->sku ?: null,
|
||||
'category' => $product->category?->name,
|
||||
'image' => $productSchemaImages,
|
||||
'url' => route('products.show', $product),
|
||||
'offers' => [
|
||||
'@type' => 'Offer',
|
||||
'priceCurrency' => config('shop.currency_code', 'RUB'),
|
||||
'price' => (string) $product->price,
|
||||
'availability' => $product->stock > 0 ? 'https://schema.org/InStock' : 'https://schema.org/OutOfStock',
|
||||
'itemCondition' => $itemCondition,
|
||||
'url' => route('products.show', $product),
|
||||
],
|
||||
];
|
||||
|
||||
if ($manufacturer !== '') {
|
||||
$productSchema['brand'] = [
|
||||
'@type' => 'Brand',
|
||||
'name' => $manufacturer,
|
||||
];
|
||||
}
|
||||
@endphp
|
||||
|
||||
@section('meta_title', $product->name)
|
||||
@section('meta_description', \Illuminate\Support\Str::limit(strip_tags($product->short_description ?: ($product->description ?: "Купить {$product->name} по выгодной цене.")), 160))
|
||||
@section('meta_keywords', $product->name . ', ' . ($product->category?->name ?? 'товар') . ', купить')
|
||||
@section('meta_canonical', route('products.show', $product))
|
||||
@section('meta_image', $productImageUrl)
|
||||
@section('meta_image_alt', $product->name)
|
||||
@section('meta_og_type', 'product')
|
||||
|
||||
@push('structured_data')
|
||||
<script type="application/ld+json">
|
||||
@json($productSchema, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
@php
|
||||
$favoriteIds = array_map('intval', (array) session('favorites', []));
|
||||
$compareIds = array_map('intval', (array) session('compare', []));
|
||||
$isFavorite = in_array($product->id, $favoriteIds, true);
|
||||
$isCompared = in_array($product->id, $compareIds, true);
|
||||
$cartItems = (array) session('cart', []);
|
||||
$isInCart = isset($cartItems[$product->id]);
|
||||
@endphp
|
||||
|
||||
@include('partials.breadcrumbs', [
|
||||
'items' => [
|
||||
['label' => 'Главная', 'url' => route('home')],
|
||||
['label' => 'Каталог', 'url' => route('catalog.index')],
|
||||
['label' => $product->category?->name ?? 'Категория', 'url' => $product->category ? route('catalog.category', $product->category) : null],
|
||||
['label' => $product->name, 'url' => null],
|
||||
],
|
||||
])
|
||||
|
||||
<section class="pc-section pc-product-page">
|
||||
<div class="pc-product-hero">
|
||||
<div class="pc-product-gallery" data-product-gallery>
|
||||
@if ($productGallery !== [])
|
||||
<img
|
||||
class="pc-product-image-lg"
|
||||
src="{{ $productGallery[0] }}"
|
||||
alt="{{ $product->name }}"
|
||||
loading="eager"
|
||||
decoding="async"
|
||||
data-product-gallery-main
|
||||
>
|
||||
@else
|
||||
<div class="pc-product-image-lg" role="img" aria-label="{{ $product->name }}"></div>
|
||||
@endif
|
||||
|
||||
@if (count($productGallery) > 1)
|
||||
<div class="pc-product-thumbs" aria-label="Дополнительные изображения товара">
|
||||
@foreach ($productGallery as $imageUrl)
|
||||
<button
|
||||
class="pc-product-thumb {{ $loop->first ? 'is-active' : '' }}"
|
||||
type="button"
|
||||
data-product-gallery-thumb
|
||||
data-image-src="{{ $imageUrl }}"
|
||||
data-image-alt="{{ $product->name }} - фото {{ $loop->iteration }}"
|
||||
aria-label="Показать фото {{ $loop->iteration }}"
|
||||
aria-pressed="{{ $loop->first ? 'true' : 'false' }}"
|
||||
>
|
||||
<img
|
||||
src="{{ $imageUrl }}"
|
||||
alt="{{ $product->name }} - миниатюра {{ $loop->iteration }}"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
>
|
||||
</button>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="pc-product-info">
|
||||
<h1>{{ $product->name }}</h1>
|
||||
<p class="pc-muted">{{ $product->short_description }}</p>
|
||||
<div class="pc-product-badges">
|
||||
@if ($product->sku)
|
||||
<span class="pc-sku">Артикул: {{ $product->sku }}</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="pc-product-price">
|
||||
<strong>{{ number_format($product->price, 0, '.', ' ') }} {{ config('shop.currency_symbol', '₽') }}</strong>
|
||||
@if (!empty($product->old_price))
|
||||
<span class="pc-product-old">{{ number_format($product->old_price, 0, '.', ' ') }} {{ config('shop.currency_symbol', '₽') }}</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="pc-product-actions">
|
||||
@if ($product->stock > 0)
|
||||
<form method="post" action="{{ route('cart.add', $product) }}" data-preserve-scroll="true">
|
||||
@csrf
|
||||
<button class="pc-btn primary {{ $isInCart ? 'is-active' : '' }}" type="submit">
|
||||
{{ $isInCart ? 'В корзине' : 'В корзину' }}
|
||||
</button>
|
||||
</form>
|
||||
@else
|
||||
<button class="pc-btn primary" type="button" disabled>Нет в наличии</button>
|
||||
@endif
|
||||
<form method="post" action="{{ route('favorites.toggle', $product) }}" data-preserve-scroll="true">
|
||||
@csrf
|
||||
<button class="pc-btn ghost {{ $isFavorite ? 'is-active' : '' }}" type="submit">
|
||||
{{ $isFavorite ? 'Убрать из избранного' : 'В избранное' }}
|
||||
</button>
|
||||
</form>
|
||||
<form method="post" action="{{ route('compare.toggle', $product) }}" data-preserve-scroll="true">
|
||||
@csrf
|
||||
<button class="pc-btn ghost {{ $isCompared ? 'is-active' : '' }}" type="submit">
|
||||
{{ $isCompared ? 'Убрать из сравнения' : 'В сравнение' }}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pc-tabs">
|
||||
<input type="radio" name="product-tabs" id="tab-specs" checked>
|
||||
<input type="radio" name="product-tabs" id="tab-desc">
|
||||
<input type="radio" name="product-tabs" id="tab-shipping">
|
||||
<input type="radio" name="product-tabs" id="tab-payment">
|
||||
|
||||
<div class="pc-tab-labels">
|
||||
<label for="tab-specs">Характеристики</label>
|
||||
<label for="tab-desc">Описание</label>
|
||||
<label for="tab-shipping">Доставка</label>
|
||||
<label for="tab-payment">Оплата</label>
|
||||
</div>
|
||||
|
||||
<div class="pc-tab-content">
|
||||
<section class="pc-tab-panel pc-tab-specs">
|
||||
<div class="pc-specs-grid">
|
||||
@forelse (($product->specs ?? []) as $key => $value)
|
||||
<div class="pc-spec-row">
|
||||
<span>{{ $specLabels[$key] ?? str_replace('_', ' ', $key) }}</span>
|
||||
<strong>{{ $value }}</strong>
|
||||
</div>
|
||||
@empty
|
||||
<p class="pc-muted">Характеристики еще не добавлены.</p>
|
||||
@endforelse
|
||||
</div>
|
||||
</section>
|
||||
<section class="pc-tab-panel pc-tab-desc">
|
||||
<p class="pc-muted">{{ $product->description ?? 'Описание товара будет добавлено позже.' }}</p>
|
||||
</section>
|
||||
<section class="pc-tab-panel pc-tab-shipping">
|
||||
<ul class="pc-list">
|
||||
<li>Доставка курьером по городу</li>
|
||||
<li>Самовывоз из пункта выдачи</li>
|
||||
<li>Отправка по стране 1-3 дня</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section class="pc-tab-panel pc-tab-payment">
|
||||
<ul class="pc-list">
|
||||
<li>Оплата картой онлайн</li>
|
||||
<li>Банковский перевод</li>
|
||||
<li>Рассрочка на крупные заказы</li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@if ($related->isNotEmpty())
|
||||
<section class="pc-section">
|
||||
<div class="pc-section-title">
|
||||
<h2>Что еще посмотреть в этой категории</h2>
|
||||
</div>
|
||||
<div class="pc-products-grid">
|
||||
@foreach ($related as $item)
|
||||
@include('partials.product-card', ['product' => $item])
|
||||
@endforeach
|
||||
</div>
|
||||
</section>
|
||||
@endif
|
||||
@endsection
|
||||
112
resources/views/shop/search.blade.php
Normal file
112
resources/views/shop/search.blade.php
Normal file
@@ -0,0 +1,112 @@
|
||||
@extends('layouts.shop')
|
||||
|
||||
@php
|
||||
$searchItemList = collect($products->items())
|
||||
->values()
|
||||
->map(fn ($product, $index) => [
|
||||
'@type' => 'ListItem',
|
||||
'position' => $index + 1,
|
||||
'url' => route('products.show', $product),
|
||||
'name' => $product->name,
|
||||
])
|
||||
->all();
|
||||
$searchSchema = $searchQuery !== ''
|
||||
? [
|
||||
'@context' => 'https://schema.org',
|
||||
'@type' => 'SearchResultsPage',
|
||||
'name' => "Результаты поиска: {$searchQuery}",
|
||||
'url' => route('search.index', ['q' => $searchQuery]),
|
||||
'mainEntity' => [
|
||||
'@type' => 'ItemList',
|
||||
'numberOfItems' => $products->total(),
|
||||
'itemListElement' => $searchItemList,
|
||||
],
|
||||
]
|
||||
: null;
|
||||
@endphp
|
||||
|
||||
@section('meta_title', $searchQuery !== '' ? "Поиск: {$searchQuery}" : 'Поиск товаров')
|
||||
@section(
|
||||
'meta_description',
|
||||
$searchQuery !== ''
|
||||
? "Найденные товары по запросу «{$searchQuery}». Выберите подходящий товар и откройте подробную карточку."
|
||||
: 'Поиск товаров по наименованию: процессоры, видеокарты, материнские платы, ноутбуки и периферия.'
|
||||
)
|
||||
@section('meta_keywords', 'поиск товаров, результаты поиска, комплектующие пк, ноутбуки')
|
||||
@section('meta_canonical', route('search.index'))
|
||||
@section('meta_robots', 'noindex,follow')
|
||||
|
||||
@push('structured_data')
|
||||
@if ($searchSchema !== null)
|
||||
<script type="application/ld+json">
|
||||
@json($searchSchema, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)
|
||||
</script>
|
||||
@endif
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
@include('partials.breadcrumbs', [
|
||||
'items' => [
|
||||
['label' => 'Главная', 'url' => route('home')],
|
||||
['label' => 'Поиск', 'url' => null],
|
||||
],
|
||||
])
|
||||
|
||||
<section class="pc-section">
|
||||
<div class="pc-category-toolbar">
|
||||
<div class="pc-section-title">
|
||||
<h2>{{ $searchQuery !== '' ? 'Результаты поиска' : 'Поиск товаров' }}</h2>
|
||||
<p>
|
||||
@if ($searchQuery !== '')
|
||||
Запрос: "{{ $searchQuery }}"
|
||||
@else
|
||||
Введите название товара, чтобы увидеть найденные позиции.
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@if ($searchQuery !== '')
|
||||
<form class="pc-sort-form" method="get" action="{{ route('search.index') }}">
|
||||
<input type="hidden" name="q" value="{{ $searchQuery }}">
|
||||
<label for="sort">Сортировка:</label>
|
||||
<select id="sort" name="sort" onchange="this.form.submit()">
|
||||
<option value="newest" @selected($sort === 'newest')>Сначала новые</option>
|
||||
<option value="price_asc" @selected($sort === 'price_asc')>Сначала дешевле</option>
|
||||
<option value="price_desc" @selected($sort === 'price_desc')>Сначала дороже</option>
|
||||
<option value="name_asc" @selected($sort === 'name_asc')>По названию</option>
|
||||
</select>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<form class="pc-search-page-form" method="get" action="{{ route('search.index') }}">
|
||||
<div class="pc-search">
|
||||
<input type="text" name="q" placeholder="Например, Ryzen 7 или RTX 4060" value="{{ $searchQuery }}">
|
||||
</div>
|
||||
<button class="pc-btn primary" type="submit">Найти</button>
|
||||
@if ($searchQuery !== '')
|
||||
<a class="pc-btn ghost" href="{{ route('search.index') }}">Очистить</a>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
@if ($searchQuery === '')
|
||||
<div class="pc-card">
|
||||
Введите запрос в строку поиска, чтобы открыть список найденных товаров.
|
||||
</div>
|
||||
@else
|
||||
<p class="pc-muted">Найдено товаров: <strong>{{ $products->total() }}</strong></p>
|
||||
|
||||
<div class="pc-products-grid">
|
||||
@forelse ($products as $product)
|
||||
@include('partials.product-card', ['product' => $product])
|
||||
@empty
|
||||
<div class="pc-card">По вашему запросу ничего не найдено.</div>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
<div class="pc-pagination">
|
||||
{{ $products->links('partials.pagination') }}
|
||||
</div>
|
||||
@endif
|
||||
</section>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user