ldc-doux/resources/views/back/posts/index.blade.php
2022-01-23 15:25:17 +01:00

49 lines
1.9 KiB
PHP

@extends('layouts.backend')
@section('content')
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">{{ __('Actualités') }} <small class="text-muted">{{ __('Liste') }}</small></h1>
@if ($errors->any())
@foreach($errors->all() as $error)
<span class="float-center text-danger">{{ $error }}</span>
@endforeach
@endif
<a href="{{route('bo.posts.create')}}" class="btn btn-primary float-right">{{ __('Créer une actualité') }}</a>
</div>
<table class="table">
<thead>
<th scope="col">{{ __('Image') }}</th>
<th class="wdt50" scope="col">{{ __('Titre') }}</th>
<th scope="col">{{ __('A la une') }}</th>
<th scope="col">{{ __('Date de publication') }}</th>
<th scope="col">{{ __('Date d\'archivage') }}</th>
<th></th>
</thead>
<tbody>
@foreach ($posts as $post)
<tr>
@if (!empty($post->picture_news))
<th>
<img src="{{$post->picture_news}}" alt="{{$post->title}}" style="max-height: 50px;">
</th>
@else
<th></th>
@endif
<td>{{$post->title}}</td>
<td>{{$post->on_top ? 'Oui' : 'Non'}}</td>
<td>{{date_format($post->date_start, "d/m/Y H:i")}}</td>
<td>{{date_format($post->date_end, "d/m/Y H:i")}}</td>
<td class="text-center">
<a href="{{route('bo.posts.edit', $post->id)}}" class="btn btn-sm btn-primary">{{ __('Éditer') }}</a>
<form action="{{route('bo.posts.destroy', $post->id)}}" method="POST" class="d-inline">
@method('DELETE')
@csrf
<input type="submit" class="btn btn-sm btn-danger" value="Supprimer" onclick="return confirm('Êtes-vous sûr(e) ?')">
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
@endsection