js css
This commit is contained in:
@@ -6,6 +6,7 @@ declare(strict_types=1);
|
||||
/** @var array<int, array<string, mixed>> $categories */
|
||||
/** @var array<int, array<string, mixed>> $catalogProducts */
|
||||
/** @var array<int, array<string, mixed>> $popularProducts */
|
||||
/** @var array<int, array<string, mixed>> $homeCatalogSections */
|
||||
/** @var array<string, mixed> $settings */
|
||||
/** @var string|null $notice */
|
||||
/** @var string $buildVersion */
|
||||
@@ -230,6 +231,104 @@ $arrivalDate = $lastArrival->format('j') . ' ' . $months[(int) $lastArrival->for
|
||||
<div class="status-box danger"><?= e($notice) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<section class="home-catalog-showcase" aria-label="Витрина каталога Рыбсток">
|
||||
<div class="home-catalog-heading">
|
||||
<div>
|
||||
<p class="eyebrow">Каталог продукции</p>
|
||||
<h2>Подборки по категориям</h2>
|
||||
</div>
|
||||
<a class="subtle-link" href="/catalog">Весь каталог</a>
|
||||
</div>
|
||||
|
||||
<?php if (($homeCatalogSections ?? []) === []): ?>
|
||||
<div class="panel">
|
||||
<p class="muted">После наполнения каталога товары появятся здесь по категориям.</p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php $wishlistRequestRendered = false; ?>
|
||||
<?php foreach ($homeCatalogSections as $section): ?>
|
||||
<?php
|
||||
$sectionProducts = $section['products'] ?? [];
|
||||
if ($sectionProducts === []) {
|
||||
continue;
|
||||
}
|
||||
$sectionKind = (string) ($section['kind'] ?? 'category');
|
||||
?>
|
||||
<?php if (!$wishlistRequestRendered && ($section['key'] ?? '') === 'myaso'): ?>
|
||||
<?php require base_path('views/partials/wishlist-request-panel.php'); ?>
|
||||
<?php $wishlistRequestRendered = true; ?>
|
||||
<?php endif; ?>
|
||||
<section class="home-product-section is-<?= e($sectionKind) ?>" id="home-<?= e((string) ($section['key'] ?? 'section')) ?>">
|
||||
<div class="home-product-section-head">
|
||||
<h3><?= e((string) ($section['title'] ?? 'Категория')) ?></h3>
|
||||
<div class="home-product-section-actions">
|
||||
<?php if (!empty($section['url'])): ?>
|
||||
<a href="<?= e((string) $section['url']) ?>">Показать <?= e((string) ($section['count'] ?? count($sectionProducts))) ?> товаров</a>
|
||||
<?php endif; ?>
|
||||
<div class="home-strip-controls" aria-label="Прокрутка подборки">
|
||||
<button type="button" data-home-strip-prev aria-label="Назад">←</button>
|
||||
<button type="button" data-home-strip-next aria-label="Вперед">→</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="home-products-strip" aria-label="<?= e((string) ($section['title'] ?? 'Категория')) ?>">
|
||||
<?php foreach ($sectionProducts as $product): ?>
|
||||
<?php require base_path('views/partials/product-card.php'); ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php if (($section['key'] ?? '') === 'frukty-ovoschi-yagody-griby'): ?>
|
||||
<section class="home-delivery-separator" aria-label="Расчет доставки">
|
||||
<div>
|
||||
<p class="eyebrow">Доставка и самовывоз</p>
|
||||
<h3>Рассчитаем доставку до подъезда и подъем отдельно</h3>
|
||||
<p>Внутри МКАД бесплатно от <?= e((string) ($settings['inside_mkad_free_from'] ?? '5000')) ?> руб. За МКАД бесплатная доставка от 10000 руб. до 10 км, дальше сумма бесплатной доставки зависит от расстояния.</p>
|
||||
</div>
|
||||
<form class="home-delivery-mini" action="/delivery" method="get">
|
||||
<label>
|
||||
<span>Сумма заказа</span>
|
||||
<input type="number" name="amount" min="0" step="100" value="5000">
|
||||
</label>
|
||||
<label>
|
||||
<span>Получение</span>
|
||||
<select name="method">
|
||||
<option value="pickup">Самовывоз</option>
|
||||
<option value="inside" selected>Доставка внутри МКАД</option>
|
||||
<option value="outside">Доставка за МКАД</option>
|
||||
</select>
|
||||
</label>
|
||||
<button class="primary-button" type="submit">Открыть расчет</button>
|
||||
</form>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php if (!$wishlistRequestRendered): ?>
|
||||
<?php require base_path('views/partials/wishlist-request-panel.php'); ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
document.querySelectorAll('[data-home-strip-prev], [data-home-strip-next]').forEach((button) => {
|
||||
button.addEventListener('click', () => {
|
||||
const section = button.closest('.home-product-section');
|
||||
const strip = section ? section.querySelector('.home-products-strip') : null;
|
||||
|
||||
if (!strip) {
|
||||
return;
|
||||
}
|
||||
|
||||
const direction = button.hasAttribute('data-home-strip-prev') ? -1 : 1;
|
||||
strip.scrollBy({
|
||||
left: direction * Math.max(260, strip.clientWidth * 0.86),
|
||||
behavior: 'smooth',
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php if (false): ?>
|
||||
<div class="content-grid">
|
||||
<section class="panel">
|
||||
<h2>Каталог</h2>
|
||||
@@ -300,4 +399,5 @@ $arrivalDate = $lastArrival->format('j') . ' ' . $months[(int) $lastArrival->for
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user