321 lines
16 KiB
PHP
321 lines
16 KiB
PHP
<div class="row">
|
|
{{-- TYPE --}}
|
|
<div class="col-12 col-md-6 mb-3">
|
|
<fieldset class="h-100 border p-3">
|
|
<legend>{{ Str::ucfirst(__('validation.custom.slider')) }}</legend>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
@include('bo.partials.inputs.tinyint-enum', [
|
|
'id' => 'slideType',
|
|
'label' => __('Associer un type'),
|
|
'name' => 'type',
|
|
'model' => $slideModel ?? null,
|
|
'required' => true,
|
|
'associatedModels' => \App\Enums\Slides\SliderTypeEnum::toArray(),
|
|
'helper' => __('Sélectionnez un type de slider dans la liste déroulante.'),
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- TITLE --}}
|
|
<div class="col-12 col-md-6 mb-3" id="divTitle">
|
|
<fieldset class="h-100 border p-3">
|
|
<legend>{{ Str::ucfirst(__('validation.attributes.title')) }}</legend>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
@include('bo.partials.inputs.varchar', [
|
|
'id' => 'slideTitle',
|
|
'label' => __(':field :inter:model', [
|
|
'field' => Str::ucfirst(__('validation.attributes.title')),
|
|
'inter' => __('validation.custom.of_the.female'),
|
|
'model' => trans_choice('models.classes.slide', 1),
|
|
]),
|
|
'hasWordCounter' => true,
|
|
'name' => 'title',
|
|
'required' => false,
|
|
'model' => $slideModel ?? null,
|
|
'helper' => __('validation.between.string', [
|
|
'attribute' => __(':field :inter:model', [
|
|
'field' => __('validation.attributes.title'),
|
|
'inter' => __('validation.custom.of_the.female'),
|
|
'model' => trans_choice('models.classes.slide', 1),
|
|
]),
|
|
'min' => 3,
|
|
'max' => 100,
|
|
]),
|
|
'placeholder' => __('Un titre clair et concis'),
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- CONTENT --}}
|
|
<div class="col-12 mb-3" id="divContent">
|
|
<fieldset class="h-100 border p-3">
|
|
<legend>{{ Str::ucfirst(__('validation.attributes.content')) }}</legend>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
@include('bo.partials.inputs.text-html', [
|
|
'id' => 'slideContent',
|
|
'label' => __(':field :inter:model', [
|
|
'field' => Str::ucfirst(__('validation.attributes.content')),
|
|
'inter' => __('validation.custom.of_the.female'),
|
|
'model' => trans_choice('models.classes.slide', 1),
|
|
]),
|
|
'name' => 'content',
|
|
'model' => $slideModel ?? null,
|
|
'required' => false,
|
|
'editorConfig' => \App\Enums\CkEditorConfigName::minimal->label(),
|
|
'helper' => __('validation.between.string', [
|
|
'attribute' => __(':field :inter:model', [
|
|
'field' => __('validation.attributes.content'),
|
|
'inter' => __('validation.custom.of_the.female'),
|
|
'model' => trans_choice('models.classes.slide', 1),
|
|
]),
|
|
'min' => 3,
|
|
'max' => 275,
|
|
]),
|
|
'placeholder' => __('Contenu textuel de la slide'),
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- VIDEO ID --}}
|
|
<div class="col-12 col-md-6 mb-3" id="divVideo">
|
|
<fieldset class="h-100 border p-3">
|
|
<legend>{{ Str::ucfirst(__('validation.custom.youtube_video')) }}</legend>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
@include('bo.partials.inputs.varchar', [
|
|
'id' => 'slideVideo',
|
|
'label' => __(':field :inter:model', [
|
|
'field' => Str::ucfirst(__('validation.custom.video_id')),
|
|
'inter' => __('validation.custom.of_the.female'),
|
|
'model' => trans_choice('models.classes.slide', 1),
|
|
]),
|
|
'hasWordCounter' => true,
|
|
'name' => 'video_id',
|
|
'required' => false,
|
|
'model' => $slideModel ?? null,
|
|
'helper' =>
|
|
__('validation.between.string', [
|
|
'attribute' => __(':field :inter:model', [
|
|
'field' => __('validation.custom.video_id'),
|
|
'inter' => __('validation.custom.of_the.female'),
|
|
'model' => trans_choice('models.classes.slide', 1),
|
|
]),
|
|
'min' => 3,
|
|
'max' => 11,
|
|
]) . __(' Doit être l\'id de la vidéo.'),
|
|
'placeholder' => __('ex: 6B4O-_1CQoI'),
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- PICTURE --}}
|
|
<div class="col-12 pb-3" id="divPicture">
|
|
<fieldset class="h-100 border p-3">
|
|
<legend>{{ Str::ucfirst(__('validation.attributes.image')) }}</legend>
|
|
<div class="row mb-3">
|
|
{{-- PICTURE_ALT --}}
|
|
<div class="col-12 col-md-6 m-md-0 mb-3">
|
|
@include('bo.partials.inputs.varchar', [
|
|
'id' => 'slidePictureAlt',
|
|
'label' => __(':field1 :inter1:field2 :inter2:model', [
|
|
'field1' => Str::ucfirst(__('validation.custom.alt_attribute')),
|
|
'inter1' => __('validation.custom.of_the.male'),
|
|
'field2' => __('validation.attributes.image'),
|
|
'inter2' => __('validation.custom.of_the.male'),
|
|
'model' => trans_choice('models.classes.slide', 1),
|
|
]),
|
|
'hasWordCounter' => true,
|
|
'name' => 'picture_alt',
|
|
'required' => false,
|
|
'model' => $slideModel ?? null,
|
|
'helper' => __('crud.minicrud.picture_alt_helper'),
|
|
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
|
|
'field1' => Str::ucfirst(__('validation.custom.alt_attribute')),
|
|
'inter1' => __('validation.custom.of_the.male'),
|
|
'field2' => __('validation.attributes.image'),
|
|
'inter2' => __('validation.custom.of_the.male'),
|
|
'model' => trans_choice('models.classes.slide', 1),
|
|
]),
|
|
])
|
|
</div>
|
|
{{-- PICTURE_TITLE --}}
|
|
<div class="col-12 col-md-6 mb-3">
|
|
@include('bo.partials.inputs.varchar', [
|
|
'id' => 'slidePictureTitle',
|
|
'label' => __(':field1 :inter1:field2 :inter2:model', [
|
|
'field1' => Str::ucfirst(__('validation.custom.title_attribute')),
|
|
'inter1' => __('validation.custom.of_the.male'),
|
|
'field2' => __('validation.attributes.image'),
|
|
'inter2' => __('validation.custom.of_the.male'),
|
|
'model' => trans_choice('models.classes.slide', 1),
|
|
]),
|
|
'hasWordCounter' => true,
|
|
'name' => 'picture_title',
|
|
'required' => false,
|
|
'model' => $slideModel ?? null,
|
|
'helper' => __('crud.minicrud.picture_title_helper'),
|
|
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
|
|
'field1' => Str::ucfirst(__('validation.custom.title_attribute')),
|
|
'inter1' => __('validation.custom.of_the.male'),
|
|
'field2' => __('validation.attributes.image'),
|
|
'inter2' => __('validation.custom.of_the.male'),
|
|
'model' => trans_choice('models.classes.slide', 1),
|
|
]),
|
|
])
|
|
</div>
|
|
{{-- PICTURE --}}
|
|
<div class="col-12">
|
|
@include('bo.partials.inputs.varchar-picture', [
|
|
'id' => 'slidePicture',
|
|
'name' => 'picture',
|
|
'width' => 1920,
|
|
'height' => 1080,
|
|
'model' => $slideModel ?? null,
|
|
'helper' => __('crud.minicrud.dimensions_must_be', [
|
|
'widthpx' => '1920px',
|
|
'heightpx' => '1080px',
|
|
]),
|
|
'required' => true,
|
|
'preview' => true,
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- BUTTON --}}
|
|
<div class="col-12 pb-3" id="divButton">
|
|
<fieldset class="h-100 border p-3">
|
|
<legend>{{ Str::ucfirst(__('validation.custom.button')) }}</legend>
|
|
<div class="row mb-3">
|
|
{{-- BUTTON_LABEL --}}
|
|
<div class="col-12 col-md-6 mb-3">
|
|
@include('bo.partials.inputs.varchar', [
|
|
'id' => 'slideButtonLabel',
|
|
'label' => __(':field :inter:model', [
|
|
'field' => Str::ucfirst(__('validation.custom.label')),
|
|
'inter' => __('validation.custom.of_the.male'),
|
|
'model' => __('validation.custom.button'),
|
|
]),
|
|
'hasWordCounter' => true,
|
|
'name' => 'button_label',
|
|
'required' => false,
|
|
'model' => $slideModel ?? null,
|
|
'helper' => __('validation.between.string', [
|
|
'attribute' => __(':field :inter:model', [
|
|
'field' => __('validation.custom.label'),
|
|
'inter' => __('validation.custom.of_the.male'),
|
|
'model' => __('validation.custom.button'),
|
|
]),
|
|
'min' => 3,
|
|
'max' => 35,
|
|
]),
|
|
'placeholder' => __(':field :inter:model', [
|
|
'field' => Str::ucfirst(__('validation.custom.label')),
|
|
'inter' => __('validation.custom.of_the.male'),
|
|
'model' => __('validation.custom.button'),
|
|
]),
|
|
])
|
|
</div>
|
|
{{-- BUTTON_URL --}}
|
|
<div class="col-12 col-md-6 mb-3">
|
|
@include('bo.partials.inputs.varchar-url', [
|
|
'id' => 'slideButtonUrl',
|
|
'label' => __(':field :inter:model', [
|
|
'field' => Str::ucfirst(__('validation.custom.url')),
|
|
'inter' => __('validation.custom.of_the.male'),
|
|
'model' => __('validation.custom.button'),
|
|
]),
|
|
'hasWordCounter' => true,
|
|
'name' => 'button_url',
|
|
'required' => false,
|
|
'model' => $slideModel ?? null,
|
|
'helper' => __('validation.custom.button_url'),
|
|
'placeholder' => __(':field :inter:model', [
|
|
'field' => Str::ucfirst(__('validation.custom.url')),
|
|
'inter' => __('validation.custom.of_the.male'),
|
|
'model' => __('validation.custom.button'),
|
|
]),
|
|
])
|
|
</div>
|
|
{{-- BUTTON_NEW_TAB --}}
|
|
<div class="col-12 col-md-6 mb-3">
|
|
<label class="col-form-label mb-3 p-0" for="slideButtonNewTab" type="button">
|
|
<b>{{ Str::ucfirst(__('validation.custom.target')) }}</b>
|
|
</label>
|
|
@include('bo.partials.inputs.tinyint-boolean', [
|
|
'id' => 'slideButtonNewTab',
|
|
'name' => 'button_new_tab',
|
|
'model' => $slideModel ?? null,
|
|
'label' => Str::of(__('validation.custom.button_new_tab'))->ucFirst(),
|
|
'helper' => __('validation.boolean', ['attribute' => __('validation.custom.button_new_tab')]),
|
|
])
|
|
</div>
|
|
{{-- BUTTON_STATUS --}}
|
|
<div class="col-12 col-md-6 mb-3">
|
|
<label class="col-form-label mb-3 p-0" for="slideButtonStatus" type="button">
|
|
<b>{{ __('crud.minicrud.visibility_label') }}</b>
|
|
</label>
|
|
@include('bo.partials.inputs.tinyint-boolean', [
|
|
'id' => 'slideButtonStatus',
|
|
'name' => 'button_status',
|
|
'model' => $slideModel ?? null,
|
|
'label' => __(':field1 :inter:field2', [
|
|
'field1' => __('crud.minicrud.visibility_label'),
|
|
'inter' => __('validation.custom.of_the.male'),
|
|
'field2' => __('validation.custom.button'),
|
|
]),
|
|
'helper' => __('crud.minicrud.visibility_helper'),
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
<div class="col-12 text-center">
|
|
<p><b>{{ __('validation.custom.required_fields') }}</b></p>
|
|
</div>
|
|
</div>
|
|
|
|
@push('scripts')
|
|
<script nonce="{{ $nonce }}">
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
// Update inputs for sliders other than 'home'.
|
|
const sliderSelectType = document.getElementById('slideType');
|
|
const fieldsetVideo = document.getElementById('divVideo');
|
|
const fieldsetTitle = document.getElementById('divTitle');
|
|
const fieldsetContent = document.getElementById('divContent');
|
|
const fieldsetPicture = document.getElementById('divPicture');
|
|
const fieldsetButton = document.getElementById('divButton');
|
|
checkSelectValue()
|
|
sliderSelectType.addEventListener('input', checkSelectValue);
|
|
|
|
function checkSelectValue() {
|
|
if (sliderSelectType.value === "{{ \App\Enums\Slides\SliderTypeEnum::home->value() }}") {
|
|
fieldsetVideo.hidden = false;
|
|
fieldsetTitle.required = false;
|
|
fieldsetContent.hidden = false;
|
|
fieldsetPicture.hidden = false;
|
|
fieldsetButton.hidden = false;
|
|
} else if (sliderSelectType.value === "{{ \App\Enums\Slides\SliderTypeEnum::team->value() }}") {
|
|
fieldsetVideo.hidden = true;
|
|
fieldsetTitle.required = true;
|
|
fieldsetContent.hidden = false;
|
|
fieldsetPicture.hidden = true;
|
|
fieldsetButton.hidden = true;
|
|
} else {
|
|
fieldsetVideo.hidden = true;
|
|
fieldsetTitle.required = true;
|
|
fieldsetContent.hidden = true;
|
|
fieldsetPicture.hidden = false;
|
|
fieldsetButton.hidden = true;
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
@endpush
|