59 lines
2.6 KiB
PHP
59 lines
2.6 KiB
PHP
@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>
|
|
<div class="pc-product-actions">
|
|
<a class="pc-btn primary" href="{{ route('admin.products.create') }}">Добавить товар</a>
|
|
<a class="pc-btn ghost" href="{{ route('admin.products.export') }}">Экспорт CSV</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="pc-card">
|
|
<h3>Импорт из CSV</h3>
|
|
<p class="pc-muted">Загрузите CSV файл (UTF-8). Поддерживаются колонки category_slug/category_name, name, price, stock и дополнительные характеристики.</p>
|
|
<form class="pc-product-actions" method="post" action="{{ route('admin.products.import') }}" enctype="multipart/form-data">
|
|
@csrf
|
|
<input class="pc-file-input" type="file" name="csv_file" accept=".csv,text/csv" required>
|
|
<button class="pc-btn ghost" type="submit">Импорт CSV</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="pc-card">
|
|
@if ($products->isEmpty())
|
|
<p>Товары пока не созданы.</p>
|
|
@else
|
|
<div class="pc-account-orders">
|
|
@foreach ($products as $product)
|
|
<div class="pc-account-order">
|
|
<span>{{ $product->name }} ({{ $product->category?->name ?? 'Без категории' }})</span>
|
|
<div class="pc-product-actions">
|
|
<a class="pc-btn ghost" href="{{ route('admin.products.edit', $product) }}">Редактировать</a>
|
|
<form method="post" action="{{ route('admin.products.destroy', $product) }}">
|
|
@csrf
|
|
@method('delete')
|
|
<button class="pc-btn ghost" type="submit">Удалить</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="pc-pagination">
|
|
{{ $products->links() }}
|
|
</div>
|
|
</section>
|
|
@endsection
|