This commit is contained in:
21
resources/views/admin/categories/_form.blade.php
Normal file
21
resources/views/admin/categories/_form.blade.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<label>
|
||||
Название
|
||||
<input type="text" name="name" value="{{ old('name', $category->name ?? '') }}" required>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
Slug
|
||||
<input type="text" name="slug" value="{{ old('slug', $category->slug ?? '') }}" placeholder="Можно оставить пустым">
|
||||
</label>
|
||||
|
||||
<label>
|
||||
Описание
|
||||
<textarea name="description">{{ old('description', $category->description ?? '') }}</textarea>
|
||||
</label>
|
||||
|
||||
<label class="pc-checkbox">
|
||||
<input type="checkbox" name="is_active" value="1" @checked(old('is_active', $category->is_active ?? true))>
|
||||
<span>Категория активна</span>
|
||||
</label>
|
||||
|
||||
<button class="pc-btn primary" type="submit">{{ $submitLabel ?? 'Сохранить' }}</button>
|
||||
22
resources/views/admin/categories/create.blade.php
Normal file
22
resources/views/admin/categories/create.blade.php
Normal file
@@ -0,0 +1,22 @@
|
||||
@extends('layouts.shop')
|
||||
|
||||
@section('content')
|
||||
@include('partials.breadcrumbs', [
|
||||
'items' => [
|
||||
['label' => 'Админка', 'url' => route('admin.dashboard')],
|
||||
['label' => 'Категории', 'url' => route('admin.categories.index')],
|
||||
['label' => 'Новая категория', 'url' => null],
|
||||
],
|
||||
])
|
||||
|
||||
<section class="pc-section">
|
||||
<div class="pc-section-title">
|
||||
<h2>Новая категория</h2>
|
||||
</div>
|
||||
|
||||
<form class="pc-card pc-form" method="post" action="{{ route('admin.categories.store') }}">
|
||||
@csrf
|
||||
@include('admin.categories._form', ['submitLabel' => 'Создать'])
|
||||
</form>
|
||||
</section>
|
||||
@endsection
|
||||
23
resources/views/admin/categories/edit.blade.php
Normal file
23
resources/views/admin/categories/edit.blade.php
Normal file
@@ -0,0 +1,23 @@
|
||||
@extends('layouts.shop')
|
||||
|
||||
@section('content')
|
||||
@include('partials.breadcrumbs', [
|
||||
'items' => [
|
||||
['label' => 'Админка', 'url' => route('admin.dashboard')],
|
||||
['label' => 'Категории', 'url' => route('admin.categories.index')],
|
||||
['label' => 'Редактирование', 'url' => null],
|
||||
],
|
||||
])
|
||||
|
||||
<section class="pc-section">
|
||||
<div class="pc-section-title">
|
||||
<h2>Редактирование категории</h2>
|
||||
</div>
|
||||
|
||||
<form class="pc-card pc-form" method="post" action="{{ route('admin.categories.update', $category) }}">
|
||||
@csrf
|
||||
@method('put')
|
||||
@include('admin.categories._form', ['category' => $category, 'submitLabel' => 'Сохранить'])
|
||||
</form>
|
||||
</section>
|
||||
@endsection
|
||||
45
resources/views/admin/categories/index.blade.php
Normal file
45
resources/views/admin/categories/index.blade.php
Normal file
@@ -0,0 +1,45 @@
|
||||
@extends('layouts.shop')
|
||||
|
||||
@section('content')
|
||||
@include('partials.breadcrumbs', [
|
||||
'items' => [
|
||||
['label' => 'Админка', 'url' => route('admin.dashboard')],
|
||||
['label' => 'Категории', 'url' => null],
|
||||
],
|
||||
])
|
||||
|
||||
<section class="pc-section">
|
||||
<div class="pc-category-toolbar">
|
||||
<div class="pc-section-title">
|
||||
<h2>Категории</h2>
|
||||
</div>
|
||||
<a class="pc-btn primary" href="{{ route('admin.categories.create') }}">Добавить категорию</a>
|
||||
</div>
|
||||
|
||||
<div class="pc-card">
|
||||
@if ($categories->isEmpty())
|
||||
<p>Категории пока не созданы.</p>
|
||||
@else
|
||||
<div class="pc-account-orders">
|
||||
@foreach ($categories as $category)
|
||||
<div class="pc-account-order">
|
||||
<span>{{ $category->name }} ({{ $category->slug }})</span>
|
||||
<div class="pc-product-actions">
|
||||
<a class="pc-btn ghost" href="{{ route('admin.categories.edit', $category) }}">Редактировать</a>
|
||||
<form method="post" action="{{ route('admin.categories.destroy', $category) }}">
|
||||
@csrf
|
||||
@method('delete')
|
||||
<button class="pc-btn ghost" type="submit">Удалить</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="pc-pagination">
|
||||
{{ $categories->links() }}
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user