@php /** @var \V2\Modules\Publicacoes\Noticias\Models\News|null $news */ $isEditing = isset($news) && $news->exists; $status = $isEditing ? $news->status : 'draft'; $statusPublished = \V2\Modules\Publicacoes\Noticias\Models\News::STATUS_PUBLISHED; $pageTitle = $isEditing ? 'Editar: ' . $news->title : 'Criar Notícia'; $formAction = $isEditing ? route('v2.noticias.cms.update', ['id' => $news->id]) : route('v2.noticias.cms.store'); $coverMedia = $isEditing && $news->relationLoaded('coverImage') ? $news->coverImage : null; $authorName = $isEditing && $news->relationLoaded('author') && $news->author ? ($news->author->first_name ?? $news->author->name ?? $news->author->email) : null; @endphp @include('v2-noticias::cms.includes.styles') @if(session()->has('success') || session()->has('error') || session()->has('warning') || session()->has('info') || session()->has('flash_message')) @include('v2-cms::partials.alert') @endif {{-- Page header --}}
Voltar

{{ $pageTitle }}

{{ csrf_field() }} {{-- ======================================================================== BLOCO 1: DADOS CRÍTICOS (título, slug, categoria, data de publicação, tags) ======================================================================== --}}
Dados Críticos
{{-- Título --}}
{{-- Slug --}}
/ @if($isEditing && $news->status === $statusPublished && $news->getPublicUrl()) Ver no Portal @endif
Preenchido automaticamente a partir do título.
{{-- Categoria + Data de Publicação --}}
@php $selectedCategoryId = old('category_id', $isEditing ? $news->category_id : ($defaultCategoryId ?? '')); @endphp {{-- Seletor de unidade regional — visível quando a categoria é "Regional" --}} @php $isRegionalCategory = false; if ($isEditing && isset($news) && $news->category) { $isRegionalCategory = in_array(strtolower($news->category->slug), ['regionais', 'regional']); } @endphp
Obrigatório quando a categoria é "Regional".
@php $pubDate = old('published_at_date', $isEditing && $news->published_at ? $news->published_at->timezone('America/Sao_Paulo')->format('Y-m-d H:i') : ($now ?? now('America/Sao_Paulo')->format('Y-m-d H:i'))); @endphp @if($isEditing && $news->published_at)
Atual: {{ $news->published_at->timezone('America/Sao_Paulo')->format('d/m/Y H:i') }} @if($news->published_at->isFuture()) (futura) @else (publicada) @endif
@else
Data em que será exibida no portal. Vazio = data atual.
@endif
{{-- Tags --}}
@if($isEditing && $news->relationLoaded('tags')) @foreach($news->tags as $tag) {{ $tag->name }} @endforeach @endif
@if(isset($allTags)) @foreach($allTags as $tag) @endforeach @endif
{{-- ======================================================================== BLOCO 2: METADADOS (data do conteúdo, responsável, SEO) Container colapsado — expande ao interagir ======================================================================== --}}
@php $conDateDefault = $isEditing && $news->content_date ? $news->content_date->format('d/m/Y') : \Carbon\Carbon::parse($now ?? now('America/Sao_Paulo'))->format('d/m/Y'); $conDate = old('content_date', $conDateDefault); @endphp
Pode diferir da data de publicação.
Por padrão, o usuário logado.
Origem da informação.

{{-- SEO collapsible dentro do bloco de metadados --}}
@include('v2-service-seo::components.seo-input', [ 'model' => $isEditing ? $news : null, 'name' => 'metadata[seo]', 'ownerModule' => 'noticias', ])
@if($isEditing)
Criado por: {{ $authorName ?? 'Desconhecido' }} {{ $news->created_at->format('d/m/Y H:i') }}
Última edição: {{ $news->updated_at->format('d/m/Y H:i') }}
@if($news->status === $statusPublished && $news->published_at)
Publicado em: {{ $news->published_at->timezone('America/Sao_Paulo')->format('d/m/Y H:i') }}
@endif
@endif
{{-- ======================================================================== BLOCO 3: CONTEÚDO (2 colunas — capa+preview 40% direita, resumo+corpo 60% esquerda) ======================================================================== --}}
Conteúdo
{{-- Coluna esquerda (60%): Resumo + Corpo --}}
Usado como linha fina na página e meta description.
@include('v2-service-contentricheditor::components.forms.content-rich-editor', [ 'name' => 'content', 'label' => '', 'value' => old('content', $news->content ?? '{"type":"doc","content":[]}'), 'required' => false, ])
{{-- Coluna direita (40%): Imagem de Capa + Preview --}}
{{-- Imagem de Capa --}}
@include('v2-service-media::components.media-input', [ 'name' => 'cover_image_id', 'label' => '', 'accept' => 'image/*', 'currentId' => $coverMedia ? $coverMedia->id : ($isEditing ? $news->cover_image_id : ''), 'currentUrl' => $coverMedia ? v2_storage_url($coverMedia->file_path) : '', 'currentAlt' => $coverMedia ? ($coverMedia->alt_text ?? '') : '', 'ownerModule' => 'noticias', 'help' => 'Proporção 16:9.', 'noPicker' => false, ])
{{-- Preview ao vivo (iframe da tela final do portal) --}}
@if($isEditing) @else
Salve a notícia para ver o preview completo.
@endif
{{-- ======================================================================== BLOCO 4: GALERIA DE IMAGENS (upload múltiplo com crop e metadados) ======================================================================== --}} @php $galleryIds = []; $galleryUrls = []; if ($isEditing && $news->relationLoaded('gallery')) { foreach ($news->gallery as $galleryMedia) { $galleryIds[] = $galleryMedia->id; $galleryUrls[] = v2_storage_url($galleryMedia->file_path); } } @endphp @include('v2-service-media::components.media-group-input', [ 'name' => 'gallery', 'label' => 'Galeria de Imagens', 'accept' => 'image/*', 'maxFiles' => 20, 'ownerModule' => 'noticias', 'existingIds' => $galleryIds, 'existingUrls'=> $galleryUrls, ]) {{-- ======================================================================== AÇÕES ======================================================================== --}}
Cancelar @if($isEditing) @endif
{{-- Form de exclusão separado --}} @if($isEditing)
{{ csrf_field() }}
@endif {{-- Activity Log (collapsible) --}} @if($isEditing)
@include('v2-service-activitylogger::cms.timeline', [ 'model' => $news, 'title' => '', 'icon' => 'bi-clock-history', ])
@endif {{-- /news-page-layout --}} @include('v2-noticias::cms.includes._confirm-modal') @push('scripts') @include('v2-noticias::cms.includes.scripts') @endpush @push('scripts') @endpush