Files
my-projects-website/app/application/resources/views/admin/projects/documentation-versions/show.blade.php
T
kor-elf d3a84bad04 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.
2026-07-22 01:01:53 +05:00

163 lines
11 KiB
PHP

@section('meta_title', __('admin-sections.Documentation version'))
@section('h1', __('admin-sections.Project') . ': ' . $project->name)
@php
$categoryId = null;
if (!empty($category) && $category->id) {
$categoryId = $category->id;
}
@endphp
<x-admin.layout>
@include('admin.projects.documentation-versions._top')
<div class="card border-0 shadow mb-4">
<div class="card-body">
<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">
<table class="table table-centered table-nowrap mb-0 rounded">
<thead class="thead-light">
<tr>
<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>
</thead>
<tbody>
@forelse($categories as $category)
<tr>
<td>
@can('view', $category)
<a href="{{ route('admin.projects.documentation-versions.category.show', ['project' => $project->id, 'version' => $version->id, 'category' => $category->id]) }}" class="text-decoration-none text-dark">
{{ $category->content?->title }}
</a>
@else
{{ $category->content?->title }}
@endcan
</td>
<td>
{{ $category->slug }}
</td>
<td>
@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>
</a>
@endcan
@can('delete', $category)
<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>
</table>
</div>
</div>
</div>
@push('scripts')
@include('admin._scripts._click-confirm', ['alert' => __('Do you want to delete?')])
@endpush
</x-admin.layout>