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

236 lines
10 KiB
PHP

<div class="row">
<div class="col">
<fieldset class="mb-3 border p-3">
<legend>{{ __('Slide information') }}</legend>
<div class="row mb-3">
<!-- Titre -->
<div class="col-12 col-md-6 form-group">
<label class="col-form-label" for="slide-title"><b>{{ Str::ucfirst(__('validation.attributes.title')) }}</b></label>
<div class="word-counter" data-json='@json(['for' => 'slide-title'])'></div>
<input class="form-control" id="slide-title" name="title" type="text" value="{{ old('title', $slide->title ?? '') }}"
aria-describedby="slide-title-help" placeholder="{{ Str::ucfirst(__('validation.attributes.title')) }}" required>
@include('bo.modules.input-error', [
'inputName' => 'title',
'helperId' => 'slide-title-help',
'helper' =>
__('Give your slide a title.') .
' ' .
__('validation.between.string', [
'attribute' => __(':field :inter:model', [
'field' => __('validation.attributes.title'),
'inter' => __('validation.custom.of_the.female'),
'model' => trans_choice('models.classes.slides', 1),
]),
'min' => 4,
'max' => 75,
]),
])
</div>
<!-- Visibilité utilisateurs connectés -->
<div class="col-12 form-group pt-3">
<input class="form-check-input mt-2" id="slide-connected" name="connected" type="checkbox" value="1"
aria-describedby="slide-connected-help" @checked(old('connected', $slide->connected ?? ''))>
<label class="col-form-label pt-1" class="form-check-label"
for="slide-connected"><b>{{ Str::ucfirst(__('validation.custom.attributes.connected')) }}</b></label><br>
@include('bo.modules.input-error', [
'inputName' => 'connected',
'helperId' => 'slide-connected-help',
'helper' => __('Check to restrict display to logged-in members.'),
])
</div>
</div>
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset class="mb-3 border p-3">
<legend><label class="h4" for="slide-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\Slides\StoreSlideRequest::PICTURE_WIDTH,
height: \App\Http\Requests\Bo\Slides\StoreSlideRequest::PICTURE_HEIGHT,
maxSizeKb: \App\Http\Requests\Bo\Slides\StoreSlideRequest::MAX_FILE_SIZE_KB,
allowedExtensions: \App\Http\Requests\Bo\Slides\StoreSlideRequest::ALLOWED_EXTENSIONS,
value: $slide->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="slide-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', $slide->picture_alt ?? '') }}" aria-describedby="slide-alt-help"
placeholder="{{ __('Artist cat') }}">
@include('bo.modules.input-error', [
'inputName' => 'picture_alt',
'helperId' => 'slide-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.slides', 1),
]),
'min' => 4,
'max' => 75,
]),
])
</div>
<!-- PICTURE -->
<div class="col-12 col-md-6 form-group">
<label class="col-form-label" for="slide-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', $slide->picture_title ?? '') }}" aria-describedby="slide-picture-title-help"
placeholder="{{ __('Image of a cat playing a grand piano') }}">
@include('bo.modules.input-error', [
'inputName' => 'picture_title',
'helperId' => 'slide-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.slides', 1),
]),
'min' => 4,
'max' => 75,
]),
])
</div>
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset class="mb-3 border p-3">
<legend><label class="h4" for="slide-text">{{ Str::ucfirst(__('validation.attributes.text')) }}</label></legend>
<div class="row">
<div class="col form-group">
@include('bo.modules.input-error', [
'inputName' => 'text',
'helper' =>
__('The text that will accompany your slide image.') .
' ' .
__('validation.min.string', [
'attribute' => __(':field :inter:model', [
'field' => __('validation.attributes.text'),
'inter' => __('validation.custom.of_the.male'),
'model' => trans_choice('models.classes.slides', 1),
]),
'min' => 4,
]),
])
@php
$editor = [
'id' => 'slide-text',
'csrf' => csrf_token(),
'name' => 'text',
'text' => old('text', $slide->text ?? '') ?? '',
];
@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>{{ __('Publication period') }}</legend>
<div class="row mb-3">
<!-- Début -->
<div class="col-12 col-md-6 form-group">
<label class="col-form-label"
for="date-start"><b>{{ Str::ucfirst(__('validation.custom.attributes.date_start_show')) }}</b></label>
<div class="d-flex gap-2">
<input class="form-control" id="date-start" name="date_start" type="datetime-local"
value="{{ old('date_start', Date::toLocalInput($slide->date_start ?? '')) }}">
</div>
@include('bo.modules.input-error', [
'inputName' => 'date_start',
'helper' => __('Leave empty for immediate display'),
])
</div>
<!-- Fin -->
<div class="col-12 col-md-6 form-group">
<label class="col-form-label" for="date-end"><b>{{ Str::ucfirst(__('validation.custom.attributes.date_end_show')) }}</b></label>
<div class="d-flex gap-2">
<input class="form-control" id="date-end" name="date_end" type="datetime-local"
value="{{ old('date_end', Date::toLocalInput($slide->date_end ?? '')) }}">
</div>
@include('bo.modules.input-error', [
'inputName' => 'date_end',
'helper' => __('Leave empty for permanent display'),
])
</div>
</div>
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset class="mb-3 border p-3">
<legend>{{ __('Link options') }}</legend>
<div class="row mb-3">
<!-- Texte du lien -->
<div class="col-12 col-md-6 form-group">
<label class="col-form-label" for="link-label"><b>{{ Str::ucfirst(__('validation.custom.attributes.link_label')) }}</b></label>
<div class="word-counter" data-json='@json(['for' => 'link-label'])'></div>
<input class="form-control" id="link-label" name="link_label" type="text"
value="{{ old('link_label', $slide->link_label ?? '') }}" placeholder="{{ __('Learn more...') }}">
@include('bo.modules.input-error', [
'inputName' => 'link_label',
])
</div>
<!-- Cible du lien -->
<div class="col-12 col-md-6 form-group">
<label class="col-form-label" for="link-target"><b>{{ Str::ucfirst(__('validation.custom.attributes.link')) }}</b></label>
<div class="word-counter" data-json='@json(['for' => 'link-target'])'></div>
<input class="form-control" id="link-target" name="link" type="text" value="{{ old('link', $slide->link ?? '') }}"
placeholder="{{ __('https://...') }}">
@include('bo.modules.input-error', [
'inputName' => 'link',
])
</div>
<!-- Nouvel onglet -->
<div class="col-12 form-group pt-3">
<input class="form-check-input mt-2" id="new-tab-cb" name="link_new_tab" type="checkbox" @checked(old('link_new_tab', $slide->link_new_tab ?? ''))>
<label class="col-form-label pt-1" class="form-check-label"
for="new-tab-cb"><b>{{ Str::ucfirst(__('validation.custom.attributes.link_new_tab')) }}</b></label><br>
@include('bo.modules.input-error', [
'inputName' => 'link_new_tab',
])
</div>
</div>
</fieldset>
</div>
</div>
<input id="client-timezone" name="client_timezone" type="hidden">
@push('scripts')
<script nonce="{{ Vite::cspNonce() }}">
document.addEventListener('DOMContentLoaded', function() {
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
document.getElementById('client-timezone').value = tz;
});
</script>
@endpush