шаг 3 завершен

This commit is contained in:
Alisa
2026-06-04 00:27:17 +03:00
parent 420e67c9bd
commit 62ce8c4d01
27 changed files with 1565 additions and 42 deletions
+121 -4
View File
@@ -3,14 +3,131 @@
declare(strict_types=1);
/** @var string $dbStatus */
/** @var array<int, array<string, mixed>> $categories */
/** @var array<int, array<string, mixed>> $catalogProducts */
/** @var array<int, array<string, mixed>> $popularProducts */
/** @var array<string, mixed> $settings */
/** @var string|null $notice */
/** @var string $buildVersion */
?>
<section class="start-screen">
<p class="eyebrow">Старт проекта</p>
<section class="start-screen wide">
<p class="eyebrow">Шаг 3</p>
<h1>Рыбсток</h1>
<p>Чистый PHP-проект подготовлен. Следующий шаг - схема базы данных и таблицы для каталога, фасовок, заказов и админки.</p>
<p>Каталог открывается уже на главной странице, чтобы покупатель сразу видел ассортимент и не делал лишних переходов.</p>
<p class="muted">Версия сборки: <?= e($buildVersion) ?></p>
<div class="status-box">
<span>MariaDB:</span>
<strong><?= htmlspecialchars($dbStatus, ENT_QUOTES, 'UTF-8') ?></strong>
<strong><?= e($dbStatus) ?></strong>
</div>
<?php if ($notice !== null): ?>
<div class="status-box danger"><?= e($notice) ?></div>
<?php endif; ?>
<div class="content-grid">
<section class="panel">
<h2>Категории</h2>
<?php if ($categories === []): ?>
<p class="muted">Категории пока не найдены. Если схема уже применена, проверьте `database/seed.sql`.</p>
<?php else: ?>
<?php
$items = $categories;
$depth = 0;
require base_path('views/partials/category-tree.php');
?>
<?php endif; ?>
</section>
<section class="panel">
<h2>Настройки доставки</h2>
<dl class="settings-list">
<div>
<dt>Внутри МКАД бесплатно от</dt>
<dd><?= e((string) ($settings['inside_mkad_free_from'] ?? '5000')) ?> руб.</dd>
</div>
<div>
<dt>Внутри МКАД платно</dt>
<dd><?= e((string) ($settings['inside_mkad_paid_price'] ?? '599')) ?> руб.</dd>
</div>
<div>
<dt>За МКАД расчет</dt>
<dd><?= e((string) ($settings['outside_mkad_base_price'] ?? '199')) ?> руб. + <?= e((string) ($settings['outside_mkad_km_price'] ?? '60')) ?> руб./км</dd>
</div>
<div>
<dt>Подъем</dt>
<dd><?= e((string) ($settings['lift_price'] ?? '390')) ?> руб.</dd>
</div>
</dl>
</section>
</div>
<section class="panel products-panel">
<div class="section-heading">
<div>
<p class="eyebrow">Каталог продукции</p>
<h2>Товары на главной</h2>
</div>
<a class="subtle-link" href="/catalog">Весь каталог</a>
</div>
<?php if ($catalogProducts === []): ?>
<p class="muted">После наполнения базы товары будут отображаться здесь сразу на главной странице.</p>
<?php else: ?>
<div class="product-grid">
<?php foreach ($catalogProducts as $product): ?>
<article class="product-card">
<p class="product-category"><?= e($product['category_name'] ?? 'Каталог') ?></p>
<h3><?= e($product['name']) ?></h3>
<p><?= e($product['variant_name'] ?? 'Выберите доступную фасовку') ?></p>
<?php if ($product['price_per_unit'] !== null): ?>
<span class="price-line">за <?= e($product['unit'] ?? 'ед.') ?>: <?= e((string) $product['price_per_unit']) ?> руб.</span>
<?php endif; ?>
<?php if ($product['package_price'] !== null): ?>
<strong><?= e((string) $product['package_price']) ?> руб. за фасовку</strong>
<?php endif; ?>
<?php if (!empty($product['price_tiers'])): ?>
<ul class="price-tiers">
<?php foreach ($product['price_tiers'] as $tier): ?>
<li>
<span><?= e($tier['label']) ?></span>
<strong><?= e((string) $tier['price']) ?> руб.</strong>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</article>
<?php endforeach; ?>
</div>
<?php endif; ?>
</section>
<section class="panel products-panel">
<h2>Популярные товары</h2>
<?php if ($popularProducts === []): ?>
<p class="muted">Товары появятся здесь после наполнения каталога и публикации фасовок.</p>
<?php else: ?>
<div class="product-grid">
<?php foreach ($popularProducts as $product): ?>
<article class="product-card">
<h3><?= e($product['name']) ?></h3>
<p><?= e($product['variant_name'] ?? 'Фасовка не выбрана') ?></p>
<?php if ($product['package_price'] !== null): ?>
<strong><?= e((string) $product['package_price']) ?> руб.</strong>
<?php endif; ?>
<?php if (!empty($product['price_tiers'])): ?>
<ul class="price-tiers">
<?php foreach ($product['price_tiers'] as $tier): ?>
<li>
<span><?= e($tier['label']) ?></span>
<strong><?= e((string) $tier['price']) ?> руб.</strong>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</article>
<?php endforeach; ?>
</div>
<?php endif; ?>
</section>
</section>