Add category-specific documentation view and management

- Introduce routes and controller actions for displaying and managing documentation by category.
- Adjust views to incorporate category-specific information and actions.
- Update services to handle category retrieval and validation.
- Add localized strings for new functionality in English and Russian.
This commit is contained in:
2026-07-22 01:01:53 +05:00
parent 756cafdbff
commit d3a84bad04
9 changed files with 226 additions and 33 deletions
@@ -35,10 +35,10 @@ final class DocumentationVersionController extends Controller
return view('admin/projects/documentation-versions/index', $result->getData()); return view('admin/projects/documentation-versions/index', $result->getData());
} }
public function show(int $projectId, int $id, Request $request): View public function show(int $projectId, int $id, Request $request, ?int $category = null): View
{ {
$user = $request->user(); $user = $request->user();
$result = $this->documentationVersionService->show($projectId, $id, $user); $result = $this->documentationVersionService->show($projectId, $id, $category, $user);
if ($result->isError()) { if ($result->isError()) {
$this->errors($result); $this->errors($result);
} }
@@ -2,12 +2,17 @@
namespace App\Services\Admin\Project; namespace App\Services\Admin\Project;
use App\Dto\Builder\Documentation as DocumentationBuilderDto;
use App\Dto\Builder\DocumentationCategory as DocumentationCategoryBuilderDto;
use App\Dto\QuerySettingsDto; use App\Dto\QuerySettingsDto;
use App\Dto\Builder\DocumentationVersion as DocumentationVersionBuilderDto; use App\Dto\Builder\DocumentationVersion as DocumentationVersionBuilderDto;
use App\Dto\Service\Admin\Project\DocumentationVersion\StoreUpdate; use App\Dto\Service\Admin\Project\DocumentationVersion\StoreUpdate;
use App\Enums\DocumentationVersionStatus; use App\Enums\DocumentationVersionStatus;
use App\Models\DocumentationVersion; use App\Models\DocumentationVersion;
use App\Models\ProjectLanguage;
use App\Models\User; use App\Models\User;
use App\Repositories\DocumentationCategoryRepository;
use App\Repositories\DocumentationRepository;
use App\Repositories\DocumentationVersionRepository; use App\Repositories\DocumentationVersionRepository;
use App\Repositories\ProjectRepository; use App\Repositories\ProjectRepository;
use App\ServiceResults\ServiceResultArray; use App\ServiceResults\ServiceResultArray;
@@ -17,6 +22,8 @@ use App\ServiceResults\StoreUpdateResult;
use App\Services\ClearCacheCommandHandler; use App\Services\ClearCacheCommandHandler;
use App\Services\DocumentationVersion\DocumentationVersionCommandHandler; use App\Services\DocumentationVersion\DocumentationVersionCommandHandler;
use App\Services\Service; use App\Services\Service;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
final class DocumentationVersionService extends Service final class DocumentationVersionService extends Service
@@ -26,6 +33,9 @@ final class DocumentationVersionService extends Service
private readonly DocumentationVersionRepository $documentationVersionRepository, private readonly DocumentationVersionRepository $documentationVersionRepository,
private readonly DocumentationVersionCommandHandler $documentationVersionCommandHandler, private readonly DocumentationVersionCommandHandler $documentationVersionCommandHandler,
private readonly ClearCacheCommandHandler $clearCacheCommandHandler, private readonly ClearCacheCommandHandler $clearCacheCommandHandler,
private readonly DocumentationCategoryRepository $documentationCategoryRepository,
private readonly DocumentationRepository $documentationRepository
) { } ) { }
public function index(int $projectId, DocumentationVersionBuilderDto $documentationVersionBuilderDto, QuerySettingsDto $querySettingsDto, User $user): ServiceResultError | ServiceResultArray public function index(int $projectId, DocumentationVersionBuilderDto $documentationVersionBuilderDto, QuerySettingsDto $querySettingsDto, User $user): ServiceResultError | ServiceResultArray
@@ -54,7 +64,7 @@ final class DocumentationVersionService extends Service
]); ]);
} }
public function show(int $projectId, int $versionId, User $user): ServiceResultError | ServiceResultArray public function show(int $projectId, int $versionId, ?int $categoryId, User $user): ServiceResultError | ServiceResultArray
{ {
$project = $this->projectRepository->getProjectById($projectId); $project = $this->projectRepository->getProjectById($projectId);
if (\is_null($project)) { if (\is_null($project)) {
@@ -70,9 +80,48 @@ final class DocumentationVersionService extends Service
return $this->errFobidden(__('Access is denied')); return $this->errFobidden(__('Access is denied'));
} }
$category = null;
if (!\is_null($categoryId)) {
$category = $this->documentationCategoryRepository->getCategoryById($categoryId);
if (\is_null($category) || $category->version_id !== $version->id) {
return $this->errNotFound(__('Not Found'));
}
if ($user->cannot('view', $category)) {
return $this->errFobidden(__('Access is denied'));
}
}
$defaultLanguage = $project->languages()->where('is_default', 1)->first();
$with = [
'content' => function (HasOne $hasOne) use ($defaultLanguage) {
/** @var ?ProjectLanguage $defaultLanguage */
$hasOne->when($defaultLanguage, function (Builder $query, ProjectLanguage $defaultLanguage) {
$query->where('language_id', $defaultLanguage->id);
});
}
];
$categoryDto = new DocumentationCategoryBuilderDto\Category($category->id ?? null);
$categories = $this->documentationCategoryRepository
->getCategories(
$version->id,
new DocumentationCategoryBuilderDto(parentId: $categoryDto),
$with
)->all();
$documents = $this->documentationRepository
->getDocumentations(
$version->id,
new DocumentationBuilderDto(categoryId: $categoryDto),
$with
)->all();
return $this->result([ return $this->result([
'version' => $version, 'version' => $version,
'project' => $project, 'project' => $project,
'category' => $category,
'categories' => $categories,
'documentations' => $documents,
]); ]);
} }
+3
View File
@@ -38,6 +38,9 @@
"Connection Timed Out": "Connection Timed Out", "Connection Timed Out": "Connection Timed Out",
"Continue": "Continue", "Continue": "Continue",
"Create": "Create", "Create": "Create",
"Create documentation": "Create documentation",
"Create category": "Create category",
"Create version documentation": "Create a version of the documentation",
"Create :name": "Create :name", "Create :name": "Create :name",
"Created": "Created", "Created": "Created",
"Delete": "Delete", "Delete": "Delete",
@@ -17,4 +17,6 @@ return [
'Documentation' => 'Documentation', 'Documentation' => 'Documentation',
'Categories' => 'Categories', 'Categories' => 'Categories',
'Setting up automatic translation' => 'Setting up automatic translation', 'Setting up automatic translation' => 'Setting up automatic translation',
'Documentation not found' => 'Documentation not found',
'No categories found' => 'No categories found',
]; ];
+3
View File
@@ -38,6 +38,9 @@
"Connection Timed Out": "Соединение не отвечает", "Connection Timed Out": "Соединение не отвечает",
"Continue": "Продолжай", "Continue": "Продолжай",
"Create": "Создать", "Create": "Создать",
"Create documentation": "Создать документацию",
"Create category": "Создать категорию",
"Create version documentation": "Создать версию документации",
"Create :name": "Создать :name", "Create :name": "Создать :name",
"Created": "Создано", "Created": "Создано",
"Delete": "Удалить", "Delete": "Удалить",
@@ -17,4 +17,6 @@ return [
'Documentation' => 'Документация', 'Documentation' => 'Документация',
'Categories' => 'Категории', 'Categories' => 'Категории',
'Setting up automatic translation' => 'Настройка автоматического перевода', 'Setting up automatic translation' => 'Настройка автоматического перевода',
'Documentation not found' => 'Документация не найдена',
'No categories found' => 'Категории не найдены',
]; ];
@@ -1,18 +1,34 @@
<div class="mb-2">
<div class="mb-4">
@can('create', \App\Models\DocumentationVersion::class) @can('create', \App\Models\DocumentationVersion::class)
<a href="{{ route('admin.projects.documentation-versions.create', ['project' => $project->id]) }}" class="btn btn-secondary d-inline-flex align-items-center me-2"> <a href="{{ route('admin.projects.documentation-versions.create', ['project' => $project->id]) }}" class="btn btn-secondary d-inline-flex align-items-center me-2 mb-3">
<svg class="icon icon-xs me-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path></svg> <svg class="icon icon-xs me-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path></svg>
{{ __('Create') }} {{ __('Create version documentation') }}
</a> </a>
@endcan @endcan
@can('viewAny', \App\Models\DocumentationVersion::class) @can('viewAny', \App\Models\DocumentationVersion::class)
<a href="{{ route('admin.projects.documentation-versions.index', ['project' => $project->id]) }}" class="btn btn-secondary d-inline-flex align-items-center me-2"> <a href="{{ route('admin.projects.documentation-versions.index', ['project' => $project->id]) }}" class="btn btn-secondary d-inline-flex align-items-center me-2 mb-3">
<svg class="icon icon-xs me-2" data-slot="icon" fill="none" stroke-width="1.5" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"> <svg class="icon icon-xs me-2" data-slot="icon" fill="none" stroke-width="1.5" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M3.375 19.5h17.25m-17.25 0a1.125 1.125 0 0 1-1.125-1.125M3.375 19.5h7.5c.621 0 1.125-.504 1.125-1.125m-9.75 0V5.625m0 12.75v-1.5c0-.621.504-1.125 1.125-1.125m18.375 2.625V5.625m0 12.75c0 .621-.504 1.125-1.125 1.125m1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125m0 3.75h-7.5A1.125 1.125 0 0 1 12 18.375m9.75-12.75c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125m19.5 0v1.5c0 .621-.504 1.125-1.125 1.125M2.25 5.625v1.5c0 .621.504 1.125 1.125 1.125m0 0h17.25m-17.25 0h7.5c.621 0 1.125.504 1.125 1.125M3.375 8.25c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125m17.25-3.75h-7.5c-.621 0-1.125.504-1.125 1.125m8.625-1.125c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125M12 10.875v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 10.875c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125M13.125 12h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125M20.625 12c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5M12 14.625v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 14.625c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125m0 1.5v-1.5m0 0c0-.621.504-1.125 1.125-1.125m0 0h7.5"></path> <path stroke-linecap="round" stroke-linejoin="round" d="M3.375 19.5h17.25m-17.25 0a1.125 1.125 0 0 1-1.125-1.125M3.375 19.5h7.5c.621 0 1.125-.504 1.125-1.125m-9.75 0V5.625m0 12.75v-1.5c0-.621.504-1.125 1.125-1.125m18.375 2.625V5.625m0 12.75c0 .621-.504 1.125-1.125 1.125m1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125m0 3.75h-7.5A1.125 1.125 0 0 1 12 18.375m9.75-12.75c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125m19.5 0v1.5c0 .621-.504 1.125-1.125 1.125M2.25 5.625v1.5c0 .621.504 1.125 1.125 1.125m0 0h17.25m-17.25 0h7.5c.621 0 1.125.504 1.125 1.125M3.375 8.25c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125m17.25-3.75h-7.5c-.621 0-1.125.504-1.125 1.125m8.625-1.125c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125M12 10.875v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 10.875c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125M13.125 12h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125M20.625 12c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5M12 14.625v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 14.625c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125m0 1.5v-1.5m0 0c0-.621.504-1.125 1.125-1.125m0 0h7.5"></path>
</svg> </svg>
{{ __('List') }} {{ __('admin-sections.Documentation version') }}
</a> </a>
@endcan @endcan
@if(!empty($version) && $version->id)
@can('viewAny', \App\Models\Documentation::class)
<a href="{{ route('admin.projects.documentation-versions.documentations.index', ['project' => $project->id, 'version' => $version->id]) }}" class="btn btn-secondary d-inline-flex align-items-center me-2 mb-3">
<svg class="icon icon-xs me-2" data-slot="icon" fill="none" stroke-width="1.5" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M3.375 19.5h17.25m-17.25 0a1.125 1.125 0 0 1-1.125-1.125M3.375 19.5h7.5c.621 0 1.125-.504 1.125-1.125m-9.75 0V5.625m0 12.75v-1.5c0-.621.504-1.125 1.125-1.125m18.375 2.625V5.625m0 12.75c0 .621-.504 1.125-1.125 1.125m1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125m0 3.75h-7.5A1.125 1.125 0 0 1 12 18.375m9.75-12.75c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125m19.5 0v1.5c0 .621-.504 1.125-1.125 1.125M2.25 5.625v1.5c0 .621.504 1.125 1.125 1.125m0 0h17.25m-17.25 0h7.5c.621 0 1.125.504 1.125 1.125M3.375 8.25c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125m17.25-3.75h-7.5c-.621 0-1.125.504-1.125 1.125m8.625-1.125c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125M12 10.875v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 10.875c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125M13.125 12h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125M20.625 12c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5M12 14.625v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 14.625c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125m0 1.5v-1.5m0 0c0-.621.504-1.125 1.125-1.125m0 0h7.5"></path>
</svg>
{{ __('admin-sections.Documentation') }}
</a>
@endcan
@can('viewAny', \App\Models\DocumentationCategory::class)
<a href="{{ route('admin.projects.documentation-versions.categories.index', ['project' => $project->id, 'version' => $version->id]) }}" class="btn btn-secondary d-inline-flex align-items-center me-2 mb-3">
<svg class="icon icon-xs me-2" data-slot="icon" fill="none" stroke-width="1.5" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M3.375 19.5h17.25m-17.25 0a1.125 1.125 0 0 1-1.125-1.125M3.375 19.5h7.5c.621 0 1.125-.504 1.125-1.125m-9.75 0V5.625m0 12.75v-1.5c0-.621.504-1.125 1.125-1.125m18.375 2.625V5.625m0 12.75c0 .621-.504 1.125-1.125 1.125m1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125m0 3.75h-7.5A1.125 1.125 0 0 1 12 18.375m9.75-12.75c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125m19.5 0v1.5c0 .621-.504 1.125-1.125 1.125M2.25 5.625v1.5c0 .621.504 1.125 1.125 1.125m0 0h17.25m-17.25 0h7.5c.621 0 1.125.504 1.125 1.125M3.375 8.25c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125m17.25-3.75h-7.5c-.621 0-1.125.504-1.125 1.125m8.625-1.125c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125M12 10.875v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 10.875c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125M13.125 12h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125M20.625 12c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5M12 14.625v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 14.625c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125m0 1.5v-1.5m0 0c0-.621.504-1.125 1.125-1.125m0 0h7.5"></path>
</svg>
{{ __('admin-sections.Categories') }}
</a>
@endcan
@endif
</div> </div>
@@ -1,45 +1,162 @@
@section('meta_title', __('admin-sections.Documentation version')) @section('meta_title', __('admin-sections.Documentation version'))
@section('h1', __('admin-sections.Project') . ': ' . $project->name) @section('h1', __('admin-sections.Project') . ': ' . $project->name)
@php
$categoryId = null;
if (!empty($category) && $category->id) {
$categoryId = $category->id;
}
@endphp
<x-admin.layout> <x-admin.layout>
@include('admin.projects.documentation-versions._top') @include('admin.projects.documentation-versions._top')
<div class="card border-0 shadow mb-4"> <div class="card border-0 shadow mb-4">
<div class="card-body"> <div class="card-body">
<h3 id="category" class="mb-4">{{ __('admin-sections.Documentation version') }}: {{ $version->title }}</h3> <h3 id="category" class="mb-4">
{{ __('admin-sections.Documentation version') }}: {{ $version->title }}
</h3>
@if(!empty($category))
<h3 class="mb-4">
{{ __('admin-sections.Categories') }}: {{ $category->content?->title }}
</h3>
@endif
@can('create', \App\Models\Documentation::class)
<a href="{{ route('admin.projects.documentation-versions.documentations.create', ['project' => $project->id, 'version' => $version->id, 'category' => $categoryId]) }}" class="btn btn-secondary d-inline-flex align-items-center me-2 mb-3">
<svg class="icon icon-xs me-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path></svg>
{{ __('Create documentation') }}
</a>
@endcan
@can('create', \App\Models\DocumentationCategory::class)
<a href="{{ route('admin.projects.documentation-versions.categories.create', ['project' => $project->id, 'version' => $version->id, 'category' => $categoryId]) }}" class="btn btn-secondary d-inline-flex align-items-center me-2 mb-3">
<svg class="icon icon-xs me-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path></svg>
{{ __('Create category') }}
</a>
@endcan
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-centered table-nowrap mb-0 rounded"> <table class="table table-centered table-nowrap mb-0 rounded">
<thead class="thead-light"> <thead class="thead-light">
<tr> <tr>
<th class="border-0">{{ __('admin-sections.Sections') }}</th> <td><h5>{{ __('admin-sections.Categories') }}</h5></td>
</tr>
<tr>
<th class="border-0">{{ __('validation.attributes.title') }}</th>
<th class="border-0">{{ __('validation.attributes.slug') }}</th>
<th class="border-0">{{ __('validation.attributes.is_public') }}</th>
<th class="border-0 rounded-end" style="width: 150px"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@can('viewAny', \App\Models\Documentation::class) @forelse($categories as $category)
<tr> <tr>
<td> <td>
<a href="{{ route('admin.projects.documentation-versions.documentations.index', ['project' => $project->id, 'version' => $version->id]) }}" class="fw-bold"> @can('view', $category)
<svg width="16" height="16" class="align-text-top" data-slot="icon" fill="none" stroke-width="1.5" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"> <a href="{{ route('admin.projects.documentation-versions.category.show', ['project' => $project->id, 'version' => $version->id, 'category' => $category->id]) }}" class="text-decoration-none text-dark">
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12.75V12A2.25 2.25 0 0 1 4.5 9.75h15A2.25 2.25 0 0 1 21.75 12v.75m-8.69-6.44-2.12-2.12a1.5 1.5 0 0 0-1.061-.44H4.5A2.25 2.25 0 0 0 2.25 6v12a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9a2.25 2.25 0 0 0-2.25-2.25h-5.379a1.5 1.5 0 0 1-1.06-.44Z"></path> {{ $category->content?->title }}
</svg>
{{ __('admin-sections.Documentation') }}
</a> </a>
</td> @else
</tr> {{ $category->content?->title }}
@endcan @endcan
@can('viewAny', \App\Models\DocumentationCategory::class) </td>
<tr> <td>
<td> {{ $category->slug }}
<a href="{{ route('admin.projects.documentation-versions.categories.index', ['project' => $project->id, 'version' => $version->id]) }}" class="fw-bold"> </td>
<svg width="16" height="16" class="align-text-top" data-slot="icon" fill="none" stroke-width="1.5" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"> <td>
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12.75V12A2.25 2.25 0 0 1 4.5 9.75h15A2.25 2.25 0 0 1 21.75 12v.75m-8.69-6.44-2.12-2.12a1.5 1.5 0 0 0-1.061-.44H4.5A2.25 2.25 0 0 0 2.25 6v12a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9a2.25 2.25 0 0 0-2.25-2.25h-5.379a1.5 1.5 0 0 1-1.06-.44Z"></path> @if($category->is_public)
{{ __('Yes') }}
@else
{{ __('No') }}
@endif
</td>
<td>
@can('update', $category)
<a href="{{ route('admin.projects.documentation-versions.categories.edit', ['project' => $project->id, 'version' => $version->id, 'category' => $category->id]) }}" class="btn btn-primary" data-bs-toggle="tooltip" data-bs-placement="top" title="{{ __('Edit') }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="align-text-top" viewBox="0 0 16 16">
<path d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708l-3-3zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207l6.5-6.5zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.499.499 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11l.178-.178z"/>
</svg> </svg>
{{ __('admin-sections.Categories') }}
</a> </a>
</td> @endcan
</tr> @can('delete', $category)
@endcan <form method="post" class="d-inline-block" action="{{ route('admin.projects.documentation-versions.categories.destroy', ['project' => $project->id, 'version' => $version->id, 'category' => $category->id]) }}">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger click-confirm" data-bs-toggle="tooltip" data-bs-placement="top" title="{{ __('Delete') }}">
<svg data-slot="icon" fill="currentColor" width="20" height="20" class="align-text-center" stroke-width="1.5" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path>
</svg>
</button>
</form>
@endcan
</td>
</tr>
@empty
<tr>
<td colspan="3">
<div class="text-center">
{{ __('admin-sections.No categories found') }}
</div>
</td>
</tr>
@endforelse
</tbody>
<tbody>
<tr>
<td><h5>{{ __('admin-sections.Documentation') }}</h5></td>
</tr>
<tr class="thead-light">
<th class="border-0">{{ __('validation.attributes.title') }}</th>
<th class="border-0">{{ __('validation.attributes.slug') }}</th>
<th class="border-0">{{ __('validation.attributes.is_public') }}</th>
<th class="border-0 rounded-end" style="width: 150px"></th>
</tr>
@forelse($documentations as $documentation)
<tr>
<td>
{{ $documentation->content?->title }}
</td>
<td>
{{ $documentation->slug }}
</td>
<td>
@if($documentation->is_public)
{{ __('Yes') }}
@else
{{ __('No') }}
@endif
</td>
<td>
@can('update', $documentation)
<a href="{{ route('admin.projects.documentation-versions.documentations.edit', ['project' => $project->id, 'version' => $version->id, 'documentation' => $documentation->id]) }}" class="btn btn-primary" data-bs-toggle="tooltip" data-bs-placement="top" title="{{ __('Edit') }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="align-text-top" viewBox="0 0 16 16">
<path d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708l-3-3zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207l6.5-6.5zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.499.499 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11l.178-.178z"/>
</svg>
</a>
@endcan
@can('delete', $documentation)
<form method="post" class="d-inline-block" action="{{ route('admin.projects.documentation-versions.documentations.destroy', ['project' => $project->id, 'version' => $version->id, 'documentation' => $documentation->id]) }}">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger click-confirm" data-bs-toggle="tooltip" data-bs-placement="top" title="{{ __('Delete') }}">
<svg data-slot="icon" fill="currentColor" width="20" height="20" class="align-text-center" stroke-width="1.5" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path>
</svg>
</button>
</form>
@endcan
</td>
</tr>
@empty
<tr>
<td colspan="3">
<div class="text-center">
{{ __('admin-sections.Documentation not found') }}
</div>
</td>
</tr>
@endforelse
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
@push('scripts')
@include('admin._scripts._click-confirm', ['alert' => __('Do you want to delete?')])
@endpush
</x-admin.layout> </x-admin.layout>
+1
View File
@@ -38,6 +38,7 @@ Route::middleware(['auth', 'verified', \App\Http\Middleware\UserLocale::class])-
Route::resource('documentation-versions', \App\Http\Controllers\Admin\Projects\DocumentationVersionController::class)->where(['documentation_version' => '[0-9]+']); Route::resource('documentation-versions', \App\Http\Controllers\Admin\Projects\DocumentationVersionController::class)->where(['documentation_version' => '[0-9]+']);
Route::prefix('documentation-versions/{version}')->as('documentation-versions.')->group(function () { Route::prefix('documentation-versions/{version}')->as('documentation-versions.')->group(function () {
Route::get('category/{category}', [\App\Http\Controllers\Admin\Projects\DocumentationVersionController::class, 'show'])->where(['category' => '[0-9]+'])->name('category.show');
Route::resource('documentations', \App\Http\Controllers\Admin\Projects\DocumentationsController::class)->except(['show'])->where(['documentation' => '[0-9]+']); Route::resource('documentations', \App\Http\Controllers\Admin\Projects\DocumentationsController::class)->except(['show'])->where(['documentation' => '[0-9]+']);
Route::resource('categories', \App\Http\Controllers\Admin\Projects\DocumentationCategoriesController::class)->except(['show'])->where(['category' => '[0-9]+']); Route::resource('categories', \App\Http\Controllers\Admin\Projects\DocumentationCategoriesController::class)->except(['show'])->where(['category' => '[0-9]+']);
})->where(['version' => '[0-9]+']); })->where(['version' => '[0-9]+']);