{{-- resources/views/news/show.blade.php --}} @extends('layouts.app') @section('css') @endsection @section('js') ww @endsection @push('pageTitle') {{ __('labels.post') }} @endpush @section('content') @include('components.common.page-header', [ 'pageTitle' => __('labels.post'), 'actionButton' => [ 'url' => isset($selectedGroupId) ? route('groups.show', ['group' => $selectedGroupId]) : route('posts.index'), 'text' => isset($selectedGroupId) ? __('labels.back_to_group') : __('labels.back_to_posts'), ], ]) @php $borderClass = ''; if ($post->is_locked) { $borderClass = 'border-left-danger border-start border-4 border-danger'; } elseif (!$post->is_approved) { $borderClass = 'border-left-warning border-start border-4 border-warning'; } elseif ($post->is_solved) { $borderClass = 'border-left-success border-start border-4 border-success'; } @endphp
@if ($post->is_locked || !$post->is_approved) @endif

{{ $post->title }}

{{-- Quick Actions --}}
@can('update', $post) @endcan @can('delete', $post) @endcan {{-- Admin action buttons (with text labels) --}} @if (Gate::allows('admin-action')) @endif
{{-- Type and Category Badges --}} @if ($post->type || $post->category)
@if ($post->type) {{ __('labels.' . $post->type) }} @endif @if ($post->category) {{ $post->category?->title }} @endif
@endif {{-- METADATA CARDS --}}
{{-- Type Card --}} @if ($post->type)
{{ __('labels.type') }}
{{ __('labels.' . $post->type) }} {{-- {{ __('labels.' . $post->type . '_desc') }} --}}
@endif {{-- Category Card --}} @if ($post->category)
{{ __('labels.category') }}
{{ $post->category?->title }} {{-- @if ($post->category?->description) {{ Str::limit($post->category?->description, 30, '...') }} @endif --}}
@endif {{-- Status Card --}}
{{ __('labels.status') }}
@if ($post->is_locked) {{ __('labels.locked') }} @elseif(!$post->is_approved) {{ __('labels.pending_approval') }} @else
{{ $post->is_published ? __('labels.published') : __('labels.draft') }}
@if ($post->is_published && $post->published_at) {{ __('labels.since') }} {{ date('d.m.Y H:i', strtotime($post->published_at)) }} @endif @endif
@include('components.common.saveable', [ 'saveableType' => 'post', 'saveableId' => $post->id, 'isSaved' => auth()->check() ? $post->isSavedByUser(auth()->id()) : false, 'saveCounts' => $post->saves_count ?? $post->saves()->count(), ]) @include('components.common.favorable', [ 'favorableType' => 'post', 'favorableId' => $post->id, 'isFavorited' => auth()->check() ? $post->isFavoritedByUser(auth()->id()) : false, 'favoriteCounts' => $post->favorites_count ?? $post->favorites()->count(), ])
@if ($post->description)
{{ __('labels.description') }}
{!! nl2br(e($post->description)) !!}
@endif @if (isset($selectedUrls) && count($selectedUrls)) @include('components.form.url-links-manage', [ 'readonly' => isset($readonly) && $readonly ? 1 : 0, 'urlList' => old('urls', isset($selectedUrls) && count($selectedUrls) ? $selectedUrls : null), ]) @endif {{-- Attachments Section --}} @isset($post->assets) @include('components.form.file-manager.uploaded-files', [ 'readonly' => isset($readonly) && $readonly, 'assets' => $post->assets, ]) @endisset {{-- Groups Section --}} {{-- @if ($post->groups->count() > 0) @include('components.form.view-selected-groups',[ 'groups' => $post->groups ]) @endif --}} {{-- Comments Section --}}
{{ __('labels.comments') }} {{ $post->comments_count ?? 0 }}
@include('components.comments.index', [ 'commentsCount' => $post->comments()->approved()->count(), 'comments' => $post->comments ?? null, 'commentableId' => $post->id ?? null, 'commentableType' => 'App\Models\Post', 'loadCommentsUrl' => route('comments.index', [ 'commentableType' => 'posts', 'commentableId' => $post->id, ]), 'isDisabled' => $post->is_locked, 'isMarkAsAnswerDisabled' => true, ])
@include('components.meta.stats', [ 'created_at' => $post->created_at ?? null, 'updated_at' => $post->updated_at ?? null, 'published_at' => $post->published_at ?? null, 'is_published' => $post->is_published ?? null, 'creater' => $post->author_name ?? null, ]) @endsection