3
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@section('title', ($noticia ? 'Editar' : 'Nueva') . ' Noticia - Admin OnAPB')
|
||||
|
||||
@section('content')
|
||||
<div class="page-header">
|
||||
<h2><i class="bi bi-newspaper"></i> {{ $noticia ? 'Editar Noticia' : 'Nueva Noticia' }}</h2>
|
||||
<a href="{{ route('admin.noticias.index') }}" class="btn-admin-outline">
|
||||
<i class="bi bi-arrow-left"></i> Volver
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="admin-card">
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ $noticia ? route('admin.noticias.update', $noticia->id) : route('admin.noticias.store') }}" class="admin-form" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@if($noticia) @method('PUT') @endif
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="mb-4">
|
||||
<label class="form-label fw-bold">Título de la Noticia *</label>
|
||||
<input type="text" name="titulo" class="form-control form-control-lg" value="{{ old('titulo', $noticia->titulo ?? '') }}" required placeholder="Escribe un título impactante...">
|
||||
@error('titulo')
|
||||
<div class="text-danger small mt-1">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Categoría / Etiqueta</label>
|
||||
<input type="text" name="categoria" class="form-control" value="{{ old('categoria', $noticia->categoria ?? '') }}" placeholder="Ej: EFEMÉRIDES, TORNEO, CLUBES">
|
||||
<small class="text-muted">Aparecerá como una etiqueta sobre la noticia.</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Torneo Relacionado</label>
|
||||
<select name="id_torneo" class="form-select">
|
||||
<option value="">— Ninguno —</option>
|
||||
@foreach($torneos as $t)
|
||||
<option value="{{ $t->id }}" {{ old('id_torneo', $noticia->id_torneo ?? '') == $t->id ? 'selected' : '' }}>
|
||||
{{ $t->nombre }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Imagen de Portada</label>
|
||||
<input type="file" name="imagen_file" class="form-control" accept="image/*">
|
||||
@if($noticia && $noticia->imagen)
|
||||
<div class="mt-2">
|
||||
<small class="d-block text-muted mb-1">Imagen actual:</small>
|
||||
<img src="{{ asset($noticia->imagen) }}" alt="" class="img-thumbnail" style="height: 60px;">
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="form-label fw-bold">Contenido de la Noticia *</label>
|
||||
<textarea name="contenido" class="form-control" rows="15" required placeholder="Escribe el cuerpo de la noticia aquí...">{{ old('contenido', $noticia->contenido ?? '') }}</textarea>
|
||||
@error('contenido')
|
||||
<div class="text-danger small mt-1">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end gap-3 border-top pt-4">
|
||||
<a href="{{ route('admin.noticias.index') }}" class="btn btn-light px-4">Cancelar</a>
|
||||
<button type="submit" class="btn-admin-primary px-5">
|
||||
<i class="bi bi-check-lg me-2"></i> {{ $noticia ? 'ACTUALIZAR NOTICIA' : 'PUBLICAR NOTICIA' }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -0,0 +1,77 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@section('title', 'Noticias - Admin OnAPB')
|
||||
|
||||
@section('content')
|
||||
<div class="mb-5 d-flex justify-content-between align-items-end">
|
||||
<div>
|
||||
<span class="text-primary fw-bold text-uppercase tracking-widest d-block mb-2">Comunicación Oficial</span>
|
||||
<h1 class="display-4 fw-bold font-header mb-0">Noticias<span class="text-primary">.</span></h1>
|
||||
</div>
|
||||
<a href="{{ route('admin.noticias.create') }}" class="btn-admin-primary">
|
||||
<i class="bi bi-plus-lg me-2"></i> NUEVA NOTICIA
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="admin-card">
|
||||
@if($noticias->isEmpty())
|
||||
<div class="text-center py-5">
|
||||
<i class="bi bi-newspaper text-muted mb-3" style="font-size: 3rem;"></i>
|
||||
<p class="fs-5 text-muted">No hay noticias publicadas.</p>
|
||||
</div>
|
||||
@else
|
||||
<div class="table-responsive">
|
||||
<table class="kinetic-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Imagen</th>
|
||||
<th>Título / Categoría</th>
|
||||
<th>Publicación</th>
|
||||
<th class="text-end">Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($noticias as $n)
|
||||
<tr>
|
||||
<td><span class="badge bg-light text-dark px-2 py-1">#{{ $n->id }}</span></td>
|
||||
<td>
|
||||
@if($n->imagen)
|
||||
<img src="{{ asset($n->imagen) }}" alt="" class="rounded" style="width: 60px; height: 40px; object-fit: cover; border: 1px solid #eee;">
|
||||
@else
|
||||
<div class="bg-light rounded d-flex align-items-center justify-content-center text-muted" style="width: 60px; height: 40px; font-size: 0.8rem;">
|
||||
<i class="bi bi-image"></i>
|
||||
</div>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($n->categoria)
|
||||
<span class="badge bg-primary-subtle text-primary border-primary border-opacity-25 mb-1">{{ strtoupper($n->categoria) }}</span>
|
||||
@endif
|
||||
<span class="fw-bold fs-5 d-block">{{ $n->titulo }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="fw-bold d-block text-muted text-uppercase" style="font-size: 0.8rem;">
|
||||
<i class="bi bi-clock me-1"></i> {{ $n->fecha ? \Carbon\Carbon::parse($n->fecha)->format('d/m/Y H:i') : '—' }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<a href="{{ route('admin.noticias.edit', $n->id) }}" class="btn btn-sm btn-light border me-1">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</a>
|
||||
<form action="{{ route('admin.noticias.destroy', $n->id) }}" method="POST" class="d-inline delete-form confirm-submit" data-confirm-text="¿Eliminar esta noticia?">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-sm btn-outline-danger">
|
||||
<i class="bi bi-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user