ldc-boutique-cnc/resources/views/bo/slides/edit.blade.php
2022-03-24 20:59:26 +01:00

129 lines
6.8 KiB
PHP

@extends('layouts.bo-layout')
@section('content')
<form action="{{route('bo.slides.update', $slide->id)}}" method="POST" enctype="multipart/form-data">
@method('PUT')
@csrf
<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"><a href="{{route('bo.slides.index')}}" class="h2 text-decoration-none"><</a> Slides <small class="text-muted">Création</small></h1>
@if (session('success'))
<span class="float-center text-success">{{ session('success') }}</span>
@endif
<div class="btn-toolbar mb-2 mb-md-0">
<button type="submit" class="btn btn-sm btn-primary">Enregistrer</a>
</div>
</div>
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="form-group">
<label for="name">Titre *</label>
<input type="text" id="title" name="title" class="form-control" placeholder="Titre * " value="{{ old('title', $slide->title) }}" required>
</div>
<div class="form-group">
<label for="name">Texte</label>
<textarea class="form-control" id="text" name="text" placeholder="Texte">{{ old('text', $slide->text) }}</textarea>
</div>
<div class="form-group">
<label for="picture">Image <small class="text-muted">- JPEG/PNG, 2Mo max. Dimensions {{ Config::get('theme.slide_image_maxwidth') }} px par {{ Config::get('theme.slide_image_maxheight') }} px</small></label></br>
<input type="file" id="picture" name="picture" accept="image/png, image/jpeg">
@if ($slide->picture !== null)
<br/>
<br/>
<img src="/images/slides/{{$slide->picture}}" alt="{{$slide->title}}" style="max-height: 100px;">
@endif
</div>
<div class="row">
<div class="form-group col">
<label for="slider_id">Slider de regroupement</label>
<select class="form-select" id="slider_id" name="slider_id">
@foreach($sliders as $slider)
<option value="{{$slider->id}}" @if ($slider->id === $slide->slider_id) selected @endif>{{$slider->label}}</option>
@endforeach
</select>
</div>
<div class="form-group col"></div>
<div class="form-group col"></div>
<div class="form-group col"></div>
</div>
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h2><small class="text-muted">Période de parution</small></h2>
</div>
<div class="row">
<div class="form-group col">
<label for="date_start_date">Début <small class="text-muted"> de l'affichage</small></label>
@if($slide->date_start !== null)
<input type="date" id="date_start_date" name="date_start_date" class="form-control" value="{{ old('date_start_date', date_format($slide->date_start, "Y-m-d")) }}">
<input type="time" id="date_start_time" name="date_start_time" class="form-control" value="{{ old('date_start_time', date_format($slide->date_start, "H:i")) }}">
@else
<input type="date" id="date_start_date" name="date_start_date" class="form-control" value="{{ old('date_start_date') }}">
<input type="time" id="date_start_time" name="date_start_time" class="form-control" value="{{ old('date_start_time') }}">
@endif
<small class="text-muted">Laisser vide pour un affichage immédiat</small>
</div>
<div class="form-group col">
<label for="date_end_date">Fin <small class="text-muted"> de l'affichage' </small></label>
@if($slide->date_end !== null)
<input type="date" id="date_end_date" name="date_end_date" class="form-control" value="{{ old('date_end_date', date_format($slide->date_end, "Y-m-d")) }}">
<input type="time" id="date_end_time" name="date_end_time" class="form-control" value="{{ old('date_end_time', date_format($slide->date_end, "H:i")) }}">
@else
<input type="date" id="date_end_date" name="date_end_date" class="form-control" value="{{ old('date_end_date') }}">
<input type="time" id="date_end_time" name="date_end_time" class="form-control" value="{{ old('date_end_time') }}">
@endif
<small class="text-muted">Laisser vide pour un affichage permanent</small>
</div>
</div>
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h2><small class="text-muted">Options de lien</small></h2>
</div>
<div class="form-group">
<label for="name">Texte du lien</label>
<input type="text" class="form-control" name="link_label" placeholder="Texte du lien" value="{{ old('link_label', $slide->link_label) }}">
</div>
<div class="form-group">
<label for="name">Cible du lien</label>
<input type="text" class="form-control" name="link" placeholder="Cible du Lien" value="{{ old('link', $slide->link) }}">
</div>
<div class="form-group text-center">
<input class="form-check-input" type="checkbox" id="new_tab_cb" name="link_new_tab" @if (old('link_new_tab', $slide->link_new_tab) !== 0)checked @endif>
<label class="form-check-label" for="new_tab_cb">Ouvrir dans un nouvel onglet</label>
</div>
</form>
@endsection
@section('scripts')
<script type="text/javascript">
var editorConfig = {
removePlugins: ["Image", "ImageCaption", "ImageStyle", "ImageToolbar", "ImageUpload"],
toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', '|', 'blockQuote', 'insertTable', '|', 'undo', 'redo' ],
heading: {
options: [
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
{ model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
{ model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
{ model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
{ model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' }
]
},
table: {
contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ]
}
};
ClassicEditor
.create( document.querySelector( '#text' ), editorConfig)
.catch( error => {
console.error( error );
} );
</script>
@endsection