ldc-cocotte/resources/views/bo/ranges/form.blade.php

142 lines
6.1 KiB
PHP

<div class="row">
<div class="col">
<fieldset class="mb-3 border p-3">
<legend>{{ __('Range information') }}</legend>
<div class="row mb-3">
<!-- Titre -->
<div class="col-12 col-md-6 form-group">
<label class="col-form-label" for="range-name"><b>{{ Str::ucfirst(__('validation.attributes.name')) }}</b></label>
<div class="word-counter" data-json='@json(['for' => 'range-name'])'></div>
<input class="form-control" id="range-name" name="name" type="text" value="{{ old('name', $range->name ?? '') }}"
aria-describedby="range-name-help" placeholder="{{ Str::ucfirst(__('validation.attributes.name')) }}" required>
@include('bo.modules.input-error', [
'inputName' => 'name',
'helperId' => 'range-name-help',
'helper' =>
__('Give your range a title.') .
' ' .
__('validation.between.string', [
'attribute' => __(':field :inter:model', [
'field' => __('validation.attributes.name'),
'inter' => __('validation.custom.of_the.female'),
'model' => trans_choice('models.classes.ranges', 1),
]),
'min' => 4,
'max' => 75,
]),
])
</div>
</div>
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset class="mb-3 border p-3">
<legend>{{ Str::ucfirst(__('validation.attributes.description')) }}</legend>
<div class="row">
<div class="col form-group">
<label class="col-form-label" for="range-description"><b>{{ Str::ucfirst(__('Description (HTML)')) }}</b></label>
@include('bo.modules.input-error', [
'inputName' => 'description',
'helper' => __('Complete content of the range.'),
])
@php
$editor = [
'id' => 'range-description',
'csrf' => csrf_token(),
'name' => 'description',
'text' => old('description', $range->description ?? '') ?? '',
];
@endphp
<div class="ck-editor" data-json='@json($editor)'></div>
</div>
</div>
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset class="mb-3 border p-3">
<legend><label class="h4" for="range-picture">{{ Str::ucfirst(__('validation.attributes.image')) }}</label></legend>
<div class="row">
@include('bo.modules.input-error', [
'inputName' => 'picture',
])
@php
$json = \App\Lib\Helpers\RequestHelper::imageInputConfig(
name: 'picture',
width: \App\Http\Requests\Bo\Ranges\StoreRangeRequest::PICTURE_WIDTH,
height: \App\Http\Requests\Bo\Ranges\StoreRangeRequest::PICTURE_HEIGHT,
maxSizeKb: \App\Http\Requests\Bo\Ranges\StoreRangeRequest::MAX_FILE_SIZE_KB,
allowedExtensions: \App\Http\Requests\Bo\Ranges\StoreRangeRequest::ALLOWED_EXTENSIONS,
value: $range->picture ?? '',
);
@endphp
<div class="image-input" data-json='@json($json)'></div>
</div>
<!-- ALT -->
<div class="col-12 col-md-6 form-group">
<label class="col-form-label" for="range-alt"><b>{{ Str::ucfirst(__('validation.custom.attributes.picture_alt')) }}</b></label>
<div class="word-counter" data-json='@json(['for' => 'picture-alt'])'></div>
<input class="form-control" id="picture-alt" name="picture_alt" type="text"
value="{{ old('picture_alt', $range->picture_alt ?? '') }}" aria-describedby="range-alt-help"
placeholder="{{ __('Artist cat') }}">
@include('bo.modules.input-error', [
'inputName' => 'picture_alt',
'helperId' => 'range-alt-help',
'helper' => __('validation.between.string', [
'attribute' => __(':field :inter:model', [
'field' => __('validation.custom.attributes.picture_alt'),
'inter' => __('validation.custom.of_the.male'),
'model' => trans_choice('models.classes.ranges', 1),
]),
'min' => 4,
'max' => 75,
]),
])
</div>
<!-- PICTURE -->
<div class="col-12 col-md-6 form-group">
<label class="col-form-label" for="range-title"><b>{{ Str::ucfirst(__('validation.custom.attributes.picture_title')) }}</b></label>
<div class="word-counter" data-json='@json(['for' => 'picture-title'])'></div>
<input class="form-control" id="picture-title" name="picture_title" type="text"
value="{{ old('picture_title', $range->picture_title ?? '') }}" aria-describedby="range-picture-title-help"
placeholder="{{ __('Image of a cat playing a grand piano') }}">
@include('bo.modules.input-error', [
'inputName' => 'picture_title',
'helperId' => 'range-picture-title-help',
'helper' => __('validation.between.string', [
'attribute' => __(':field :inter:model', [
'field' => __('validation.custom.attributes.picture_title'),
'inter' => __('validation.custom.of_the.male'),
'model' => trans_choice('models.classes.ranges', 1),
]),
'min' => 4,
'max' => 75,
]),
])
</div>
</fieldset>
</div>
</div>
<div class="row">
<!-- Publication -->
<div class="col-12 form-group pt-3">
<input class="form-check-input mt-2" id="range-status" name="status" type="checkbox" value="1"
aria-describedby="range-status-help" @checked(old('status', $range->status ?? ''))>
<label class="col-form-label pt-1" class="form-check-label"
for="range-status"><b>{{ Str::ucfirst(__('validation.custom.attributes.status')) }}</b></label><br>
@include('bo.modules.input-error', [
'inputName' => 'status',
'helperId' => 'range-status-help',
'helper' => __('Check to publish the range'),
])
</div>
</div>