ldc-jeusselin/resources/views/bo/articles/edit.blade.php

88 lines
4.3 KiB
PHP

@extends('layouts.bo')
@section('content')
<div class="card">
<div class="card-header">
Modification d'un article
<a href="{{route('bo.articles.index')}}" class="btn btn-sm btn-primary float-end ml-2">Retour</a>
<form action="{{route('bo.articles.destroy', $a->id)}}" method="POST" class="d-inline">
@method('DELETE')
@csrf
<input type="submit" class="btn btn-sm btn-danger float-end" value="Supprimer"
onclick="return confirm('Êtes-vous sûr(e) ?')">
</form>
</div>
<div class="card-body">
<form action="{{route('bo.articles.update', $a->id)}}" method="POST" enctype="multipart/form-data">
@method('PUT')
@csrf
<div class="row">
<div class="col-md-8 offset-md-2">
<div class="form-group mb-3">
<input type="text" class="form-control" name="title" placeholder="Titre *" value="{{$a->title}}" required>
</div>
<div class="form-group mb-3">
<label>Visuel * de type JPEG/PNG - 2Mo max. - 340 x 340px</label>
<input type="file" name="picture" accept="image/png, image/jpeg">
</br>
</br>
<img src="{{ asset($a->picture) }}" style="max-height: 200px;">
</div>
<div class="form-group mb-3">
<label>Visuel * de type JPEG/PNG - 2Mo max. - 780 x 508px</label>
<input type="file" name="picture_r" accept="image/png, image/jpeg">
</br>
</br>
<img src="{{ asset($a->picture_r) }}" style="max-height: 200px;">
</div>
<div class="form-group mb-3">
<label class="col-form-label">Contenu *</label>
@php
$data = [
'modelName' => 'Article',
'name' => 'content',
'text' => $a->content,
'placeholder' => __('Un texte riche'),
'errors' => $errors->getBag('default')->getMessages() ?? [],
];
@endphp
<div class="ck-editor" data-json='@json($data)'></div>
</div>
<div class="form-group mb-3 row">
<label class="col-form-label col-md-3">Catégorie *</label>
<select class="custom-select col-md-9" id="category" name="category">
@foreach ($ac as $article_category)
@if ($article_category->id === $a->category_id)
<option value="{{$article_category->id}}" selected>{{$article_category->name}}</option>
@else
<option value="{{$article_category->id}}">{{$article_category->name}}</option>
@endif
@endforeach
</select>
</div>
<div class="form-group mb-3">
<label>
@if ($a->status === 1)
<input type="checkbox" name="status" value="1" checked>
@else
<input type="checkbox" name="status" value="1">
@endif
Publié ?
</label>
</div>
<div class="form-group mb-3 text-center">
<input type="submit" class="btn btn-secondary" value="Modifier">
</div>
</div>
</div>
</form>
</div>
</div>
@endsection
@section('scripts')
<script>
</script>
@endsection