шаг 4 завершен
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/** @var array<int, array<string, mixed>> $categories */
|
||||
/** @var array<int, array<string, mixed>> $flatCategories */
|
||||
/** @var string|null $message */
|
||||
/** @var string|null $error */
|
||||
?>
|
||||
<section class="admin-layout">
|
||||
<div class="panel">
|
||||
<p class="eyebrow">Админка</p>
|
||||
<h1>Категории</h1>
|
||||
<p class="muted">Первичная форма для добавления категории или подкатегории.</p>
|
||||
|
||||
<?php if ($message !== null): ?>
|
||||
<div class="status-box success"><?= e($message) ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($error !== null): ?>
|
||||
<div class="status-box danger"><?= e($error) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form class="admin-form" method="post">
|
||||
<label>
|
||||
Родительская категория
|
||||
<select name="parent_id">
|
||||
<option value="">Без родителя</option>
|
||||
<?php foreach ($flatCategories as $category): ?>
|
||||
<option value="<?= e((string) $category['id']) ?>"><?= e($category['name']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Название
|
||||
<input name="name" required>
|
||||
</label>
|
||||
<label>
|
||||
Slug
|
||||
<input name="slug" required>
|
||||
</label>
|
||||
<label>
|
||||
H1
|
||||
<input name="h1">
|
||||
</label>
|
||||
<label>
|
||||
Title
|
||||
<input name="seo_title">
|
||||
</label>
|
||||
<label>
|
||||
Description
|
||||
<textarea name="seo_description" rows="3"></textarea>
|
||||
</label>
|
||||
<label>
|
||||
Keywords
|
||||
<textarea name="seo_keywords" rows="2"></textarea>
|
||||
</label>
|
||||
<label>
|
||||
Сортировка
|
||||
<input name="sort_order" type="number" value="100">
|
||||
</label>
|
||||
<label class="checkbox-label">
|
||||
<input name="is_active" type="checkbox" checked>
|
||||
Активна
|
||||
</label>
|
||||
<button class="primary-button" type="submit">Добавить категорию</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<h2>Текущее дерево</h2>
|
||||
<?php
|
||||
$items = $categories;
|
||||
$depth = 0;
|
||||
$currentSlug = '';
|
||||
require base_path('views/partials/category-tree.php');
|
||||
?>
|
||||
</div>
|
||||
</section>
|
||||
Reference in New Issue
Block a user