This commit is contained in:
2026-04-06 18:44:02 +05:00
commit d775fbb9ba
431 changed files with 31234 additions and 0 deletions

View File

@@ -0,0 +1,160 @@
@extends('layouts.admin')
@section('content')
<div class="container-fluid">
@if(session('success'))
<div class="alert alert-success alert-dismissible fade show" role="alert">
<i class="bi bi-check-circle-fill me-2"></i> {{ session('success') }}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
@endif
@if(session('error'))
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<i class="bi bi-exclamation-triangle-fill me-2"></i> {{ session('error') }}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
@endif
<div class="brands-table col-12">
<div class="card">
<div class="card-header">
<h5>Бренды</h5>
</div>
<div class="card-body">
<table class="table">
<thead>
<th>Название</th>
<th>Описание</th>
<th>Лого</th>
<th>Сайт</th>
<th>Страна</th>
<th class="text-center">Активен?</th>
<th class="text-center">Действия</th>
</thead>
<tbody>
<tr class="bg-light">
<form action="{{ route('admin.brands.store') }}" method="POST" enctype="multipart/form-data">
@csrf
<td>
<input type="text" name="name"
class="form-control form-control-sm @error('name') is-invalid @enderror"
placeholder="Название" value="{{ old('name') }}">
@error('name')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</td>
<td>
<textarea name="description"
class="form-control form-control-sm @error('description') is-invalid @enderror"
rows="2" placeholder="Описание">{{ old('description') }}</textarea>
@error('description')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</td>
<td>
<input type="file" name="logo"
class="form-control form-control-sm @error('logo') is-invalid @enderror"
accept="image/*">
@error('logo')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</td>
<td>
<input type="url" name="website"
class="form-control form-control-sm @error('website') is-invalid @enderror"
placeholder="https://" value="{{ old('website') }}">
@error('website')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</td>
<td>
<input type="text" name="country"
class="form-control form-control-sm @error('country') is-invalid @enderror"
placeholder="Страна" value="{{ old('country') }}">
@error('country')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</td>
<td class="text-center">
<input type="checkbox" name="is_active" value="1" class="form-check-input"
{{ old('is_active', true) ? 'checked' : '' }}>
</td>
<td class="text-center">
<button type="submit" class="btn btn-dark-green p-1" title="Добавить">
<img src="{{ asset('assets/images/icons/add-folder-svgrepo-com.svg') }}" alt="Добавить" width="20" height="20">
</button>
</td>
</form>
</tr>
@foreach ($brands as $brand)
<tr>
<td>{{ $brand->name }}</td>
<td style="max-width: 200px;">
@if ($brand->description)
{{ Str::limit($brand->description, 50) }}
@else
<span class="text-muted"></span>
@endif
</td>
<td>
@if ($brand->logo)
<img src="{{ asset('assets/images/brands/' . $brand->logo) }}"
alt="{{ $brand->name }}"
style="max-height: 40px;">
@else
<span class="text-muted"></span>
@endif
</td>
<td>
@if ($brand->website)
<a href="{{ $brand->website }}" target="_blank">{{ Str::limit($brand->website, 30) }}</a>
@else
<span class="text-muted"></span>
@endif
</td>
<td>
@if ($brand->country)
{{ $brand->country }}
@else
<span class="text-muted"></span>
@endif
</td>
<td class="text-center">
@if ($brand->is_active)
<i class="bi bi-check-circle text-success"></i>
@else
<i class="bi bi-x-circle text-danger"></i>
@endif
</td>
<td class="text-center">
<div class="d-flex gap-2 justify-content-center">
<a href="{{ route('admin.brands.edit', $brand->id) }}" class="btn btn-orange p-1" title="Редактировать">
<img src="{{ asset('assets/images/icons/edit-svgrepo-com.svg') }}" alt="Редактировать" width="20" height="20">
</a>
<form action="{{ route('admin.brands.destroy', $brand->id) }}" method="post"
onsubmit="return confirm('Удалить бренд «{{ $brand->name }}»?');">
@csrf
@method('DELETE')
<button class="btn btn-danger p-1" type="submit" title="Удалить">
<img src="{{ asset('assets/images/icons/delete-svgrepo-com.svg') }}" alt="Удалить" width="20" height="20">
</button>
</form>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="ps-2 pe-2">
@if(method_exists($brands, 'hasPages') && $brands->hasPages())
{{ $brands->links() }}
@endif
</div>
@endsection

View File

@@ -0,0 +1,101 @@
@extends('layouts.admin')
@section('content')
<div class="container-fluid">
<div class="card">
<div class="card-header">
<h5>Редактирование бренда: {{ $brand->name }}</h5>
</div>
<div class="card-body">
<form action="{{ route('admin.brands.update', $brand->id) }}" method="POST" enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label">Название <span class="text-danger">*</span></label>
<input type="text" name="name"
class="form-control @error('name') is-invalid @enderror"
value="{{ old('name', $brand->name) }}" required>
@error('name')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="col-md-6 mb-3">
<label class="form-label">Страна</label>
<input type="text" name="country"
class="form-control @error('country') is-invalid @enderror"
value="{{ old('country', $brand->country) }}">
@error('country')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
</div>
<div class="mb-3">
<label class="form-label">Описание</label>
<textarea name="description"
class="form-control @error('description') is-invalid @enderror"
rows="4">{{ old('description', $brand->description) }}</textarea>
@error('description')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label">Сайт</label>
<input type="url" name="website"
class="form-control @error('website') is-invalid @enderror"
value="{{ old('website', $brand->website) }}"
placeholder="https://">
@error('website')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
<div class="col-md-6 mb-3">
<label class="form-label">Логотип</label>
@if($brand->logo)
<div class="mb-2">
<img src="{{ asset('assets/images/brands/' . $brand->logo) }}"
alt="{{ $brand->name }}"
style="max-height: 60px;">
</div>
@endif
<input type="file" name="logo"
class="form-control @error('logo') is-invalid @enderror"
accept="image/*">
<small class="text-muted">Оставьте пустым, чтобы не менять</small>
@error('logo')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
</div>
<div class="mb-3">
<div class="form-check">
<input type="checkbox" name="is_active" value="1"
class="form-check-input" id="is_active"
{{ old('is_active', $brand->is_active) ? 'checked' : '' }}>
<label class="form-check-label" for="is_active">
Активен
</label>
</div>
</div>
<div class="d-flex gap-2">
<button type="submit" class="btn btn-orange p-2">
<img src="{{ asset('assets/images/icons/save-svgrepo-com.svg') }}" alt="Обновить" width="20" height="20">
</button>
<a href="{{ route('admin.brands') }}" class="btn btn-dark-green p-2 d-flex gap-2 align-items-center">
<img src="{{ asset('assets/images/icons/delete-svgrepo-com.svg') }}" alt="Обновить" width="20" height="20">
Отмена
</a>
</div>
</form>
</div>
</div>
</div>
@endsection