ldc-doux/resources/views/back/advice/edit.blade.php
Sebastien Hattry b60513fb72 Fix bugs sh01
2022-07-18 10:36:38 +00:00

134 lines
6.9 KiB
PHP

@extends('layouts.backend')
@section('content')
<form action="{{route('bo.advice.update', $advice->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.home')}}" class="h2 text-decoration-none">
< </a> {{ __('Présentation') }} <small class="text-muted">{{ __('Edition') }}</small></h1>
<div class="btn-toolbar mb-2 mb-md-0">
<button type="submit" class="btn btn-sm btn-primary">{{ __('Enregistrer') }}</a>
</div>
</div>
<div class="form-group">
<label for="picture1">{{ __('Image') }} *<small class="text-muted">- JPEG/PNG, 2Mo max. Dimensions {{ Config::get('bo.advice_image_maxwidth') }} px par {{ Config::get('bo.advice_image_maxheight') }} px</small></label><br/>
<input type="file" id="picture1" name="picture1" accept="image/png, image/jpeg">
@if (!empty($advice->picture1))
<br />
<br />
<img src="{{$advice->picture1}}" alt="{{$advice->title1}}" style="max-height: 100px;">
@endif
@include('back.modules.input-error', ['inputName'=>'picture1'])
</div>
<div class="form-group">
<label for="name">{{ __('Text alternatif de l\'image') }} *</label>
<input type="text" id="alt_text_picture1" name="alt_text_picture1" class="form-control" placeholder="{{ __('Texte alternatif de l\'image') }} *" value="{{ old('alt_text_picture1', $advice->alt_text_picture1 ?? '') }}" required>
@include('back.modules.input-error', ['inputName'=>'alt_text_picture1'])
</div>
<div class="form-group">
<label for="title1">{{ __('Titre 1er bloc') }} *</label>
<input type="text" id="title1" name="title1" class="form-control" placeholder="{{ __('Titre 1er bloc') }} *" value="{{ old('title1', $advice->title1 ?? '') }}" required>
@include('back.modules.input-error', ['inputName'=>'title1'])
</div>
<div class="form-group mb-5">
<label for="text1">{{ __('Texte 1er bloc') }} *</label>
<textarea class="form-control" id="text1" name="text1" placeholder="{{ __('Texte 1er bloc') }}" style="height: 300px; width: 50%;" required>{{ old('text1', $advice->text1) }}</textarea>
@include('back.modules.input-error', ['inputName'=>'text1'])
</div>
<div class="form-group me-5">
<label for="picture2">{{ __('Image') }} *<small class="text-muted">- JPEG/PNG, 1Mo max. Dimensions {{ Config::get('bo.advice_image_maxwidth') }} px par {{ Config::get('bo.advice_image_maxheight') }} px</small></label><br/>
<input type="file" id="picture2" name="picture2" accept="image/png, image/jpeg">
@if (!empty($advice->picture2))
<br />
<br />
<img src="{{$advice->picture2}}" alt="{{$advice->title2}}" style="max-height: 100px;">
@endif
@include('back.modules.input-error', ['inputName'=>'picture2'])
</div>
<div class="form-group">
<label for="name">{{ __('Text alternatif de l\'image') }} *</label>
<input type="text" id="alt_text_picture2" name="alt_text_picture2" class="form-control" placeholder="{{ __('Texte alternatif de l\'image') }} *" value="{{ old('alt_text_picture2', $advice->alt_text_picture2 ?? '') }}" required>
@include('back.modules.input-error', ['inputName'=>'alt_text_picture2'])
</div>
<div class="form-group">
<label for="picture3">{{ __('Image') }} *<small class="text-muted">- JPEG/PNG, 1Mo max. Dimensions {{ Config::get('bo.advice_image_maxwidth') }} px par {{ Config::get('bo.advice_image_maxheight') }} px</small></label><br/>
<input type="file" id="picture3" name="picture3" accept="image/png, image/jpeg">
@if (!empty($advice->picture3))
<br />
<br />
<img src="{{$advice->picture3}}" alt="{{$advice->title3}}" style="max-height: 100px;">
@endif
@include('back.modules.input-error', ['inputName'=>'picture3'])
</div>
<div class="form-group">
<label for="name">{{ __('Text alternatif de l\'image') }} *</label>
<input type="text" id="alt_text_picture3" name="alt_text_picture3" class="form-control" placeholder="{{ __('Texte alternatif de l\'image') }} *" value="{{ old('alt_text_picture3', $advice->alt_text_picture3 ?? '') }}" required>
@include('back.modules.input-error', ['inputName'=>'alt_text_picture3'])
</div>
<div class="form-group">
<label for="title2">{{ __('Titre 2ème bloc') }} *</label>
<input type="text" id="title2" name="title2" class="form-control" placeholder="{{ __('Titre 2ème bloc') }} *" value="{{ old('title2', $advice->title2 ?? '') }}" required>
@include('back.modules.input-error', ['inputName'=>'title2'])
</div>
<div class="form-group">
<label for="text2">{{ __('Texte 2ème bloc') }} *</label>
<textarea class="form-control" id="text2" name="text2" placeholder="{{ __('Texte 2ème bloc') }}" style="height: 300px; width: 50%;" required>{{ old('text2', $advice->text2) }}</textarea>
@include('back.modules.input-error', ['inputName'=>'text2'])
</div>
</form>
@endsection
@push('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('#text1'), editorConfig)
.catch(error => {
console.error(error);
});
ClassicEditor
.create(document.querySelector('#text2'), editorConfig)
.catch(error => {
console.error(error);
});
</script>
@endpush