334 lines
17 KiB
PHP
334 lines
17 KiB
PHP
<div class="row">
|
|
{{-- TITLE --}}
|
|
<div class="col-12 col-md-6 mb-3">
|
|
<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' => 'localCommitmentTitle',
|
|
'label' => __(':field :inter:model', [
|
|
'field' => Str::ucfirst(__('validation.attributes.title')),
|
|
'inter' => __('validation.custom.of_the.vowel'),
|
|
'model' => trans_choice('models.classes.local_commitment', 1),
|
|
]),
|
|
'hasWordCounter' => true,
|
|
'name' => 'title',
|
|
'required' => true,
|
|
'model' => $localCommitmentModel ?? null,
|
|
'helper' => __('validation.between.string', [
|
|
'attribute' => __(':field :inter:model', [
|
|
'field' => __('validation.attributes.title'),
|
|
'inter' => __('validation.custom.of_the.vowel'),
|
|
'model' => trans_choice('models.classes.local_commitment', 1),
|
|
]),
|
|
'min' => 3,
|
|
'max' => 255,
|
|
]),
|
|
'placeholder' => __('Un titre clair et concis'),
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- STATUS --}}
|
|
<div class="col-12 col-md-6 mb-3">
|
|
<fieldset class="h-100 border p-3">
|
|
<legend>{{ __('crud.minicrud.visibility_label') }}</legend>
|
|
<div class="row">
|
|
@php
|
|
$disabled = App\Models\LocalCommitment::where('published', true)->count() === 2 &&
|
|
(!$localCommitmentModel->exists || $localCommitmentModel->published === false)
|
|
@endphp
|
|
@if ($disabled)
|
|
<p class="text-danger">{{ __('Seuls 2 engagements locaux peuvent être publiés en même temps.') }}</p>
|
|
@endif
|
|
<div class="col-12">
|
|
@include('bo.partials.inputs.tinyint-boolean', [
|
|
'id' => 'localCommitmentPublished',
|
|
'name' => 'published',
|
|
'label' => __('crud.minicrud.visibility_label'),
|
|
'helper' => __('crud.minicrud.visibility_helper'),
|
|
'model' => $localCommitmentModel ?? null,
|
|
'disabled' => $disabled ? true : false,
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- PICTURE1 --}}
|
|
<div class="col-12 pb-3">
|
|
<fieldset class="h-100 border p-3">
|
|
<legend>{{ Str::ucfirst(__('validation.custom.first_image')) }}</legend>
|
|
<div class="row mb-3">
|
|
{{-- PICTURE1_ALT --}}
|
|
<div class="col-12 col-md-6 m-md-0 mb-3">
|
|
@include('bo.partials.inputs.varchar', [
|
|
'id' => 'localCommitmentPicture1Alt',
|
|
'label' => __(':field1 :inter1:field2 :inter2:model', [
|
|
'field1' => Str::ucfirst(__('validation.custom.attribute_alt')),
|
|
'inter1' => __('validation.custom.of_the.female'),
|
|
'field2' => __('validation.custom.first_image'),
|
|
'inter2' => __('validation.custom.of_the.vowel'),
|
|
'model' => trans_choice('models.classes.local_commitment', 1),
|
|
]),
|
|
'hasWordCounter' => true,
|
|
'name' => 'picture1_alt',
|
|
'required' => true,
|
|
'model' => $localCommitmentModel ?? null,
|
|
'helper' => __('crud.minicrud.picture_alt_helper'),
|
|
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
|
|
'field1' => Str::ucfirst(__('validation.custom.attribute_alt')),
|
|
'inter1' => __('validation.custom.of_the.female'),
|
|
'field2' => __('validation.custom.first_image'),
|
|
'inter2' => __('validation.custom.of_the.vowel'),
|
|
'model' => trans_choice('models.classes.local_commitment', 1),
|
|
]),
|
|
])
|
|
</div>
|
|
{{-- PICTURE1_TITLE --}}
|
|
<div class="col-12 col-md-6 mb-3">
|
|
@include('bo.partials.inputs.varchar', [
|
|
'id' => 'localCommitmentPicture1Title',
|
|
'label' => __(':field1 :inter1:field2 :inter2:model', [
|
|
'field1' => Str::ucfirst(__('validation.custom.attribute_title')),
|
|
'inter1' => __('validation.custom.of_the.female'),
|
|
'field2' => __('validation.custom.first_image'),
|
|
'inter2' => __('validation.custom.of_the.vowel'),
|
|
'model' => trans_choice('models.classes.local_commitment', 1),
|
|
]),
|
|
'hasWordCounter' => true,
|
|
'name' => 'picture1_title',
|
|
'required' => true,
|
|
'model' => $localCommitmentModel ?? null,
|
|
'helper' => __('crud.minicrud.picture_title_helper'),
|
|
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
|
|
'field1' => Str::ucfirst(__('validation.custom.attribute_title')),
|
|
'inter1' => __('validation.custom.of_the.female'),
|
|
'field2' => __('validation.custom.first_image'),
|
|
'inter2' => __('validation.custom.of_the.vowel'),
|
|
'model' => trans_choice('models.classes.local_commitment', 1),
|
|
]),
|
|
])
|
|
</div>
|
|
{{-- PICTURE1 --}}
|
|
<div class="col-12">
|
|
@include('bo.partials.inputs.varchar-picture', [
|
|
'id' => 'localCommitmentPicture1',
|
|
'name' => 'picture1',
|
|
'width' => 587,
|
|
'height' => 429,
|
|
'model' => $localCommitmentModel ?? null,
|
|
'helper' => __('crud.minicrud.dimensions_must_be', [
|
|
'widthpx' => '587px',
|
|
'heightpx' => '429px',
|
|
]),
|
|
'required' => true,
|
|
'preview' => true,
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- PICTURE2 --}}
|
|
<div class="col-12 pb-3">
|
|
<fieldset class="h-100 border p-3">
|
|
<legend>{{ Str::ucfirst(__('validation.custom.second_image')) }}</legend>
|
|
<div class="row mb-3">
|
|
{{-- PICTURE2_ALT --}}
|
|
<div class="col-12 col-md-6 m-md-0 mb-3">
|
|
@include('bo.partials.inputs.varchar', [
|
|
'id' => 'localCommitmentPicture2Alt',
|
|
'label' => __(':field1 :inter1:field2 :inter2:model', [
|
|
'field1' => Str::ucfirst(__('validation.custom.attribute_alt')),
|
|
'inter1' => __('validation.custom.of_the.female'),
|
|
'field2' => __('validation.custom.second_image'),
|
|
'inter2' => __('validation.custom.of_the.vowel'),
|
|
'model' => trans_choice('models.classes.local_commitment', 1),
|
|
]),
|
|
'hasWordCounter' => true,
|
|
'name' => 'picture2_alt',
|
|
'required' => false,
|
|
'model' => $localCommitmentModel ?? null,
|
|
'helper' => __('crud.minicrud.picture_alt_helper'),
|
|
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
|
|
'field1' => Str::ucfirst(__('validation.custom.attribute_alt')),
|
|
'inter1' => __('validation.custom.of_the.female'),
|
|
'field2' => __('validation.custom.second_image'),
|
|
'inter2' => __('validation.custom.of_the.vowel'),
|
|
'model' => trans_choice('models.classes.local_commitment', 1),
|
|
]),
|
|
])
|
|
</div>
|
|
{{-- PICTURE2_TITLE --}}
|
|
<div class="col-12 col-md-6 mb-3">
|
|
@include('bo.partials.inputs.varchar', [
|
|
'id' => 'localCommitmentPicture2Title',
|
|
'label' => __(':field1 :inter1:field2 :inter2:model', [
|
|
'field1' => Str::ucfirst(__('validation.custom.attribute_title')),
|
|
'inter1' => __('validation.custom.of_the.female'),
|
|
'field2' => __('validation.custom.second_image'),
|
|
'inter2' => __('validation.custom.of_the.vowel'),
|
|
'model' => trans_choice('models.classes.local_commitment', 1),
|
|
]),
|
|
'hasWordCounter' => true,
|
|
'name' => 'picture2_title',
|
|
'required' => false,
|
|
'model' => $localCommitmentModel ?? null,
|
|
'helper' => __('crud.minicrud.picture_title_helper'),
|
|
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
|
|
'field1' => Str::ucfirst(__('validation.custom.attribute_title')),
|
|
'inter1' => __('validation.custom.of_the.female'),
|
|
'field2' => __('validation.custom.second_image'),
|
|
'inter2' => __('validation.custom.of_the.vowel'),
|
|
'model' => trans_choice('models.classes.local_commitment', 1),
|
|
]),
|
|
])
|
|
</div>
|
|
{{-- PICTURE2 --}}
|
|
<div class="col-12">
|
|
@include('bo.partials.inputs.varchar-picture', [
|
|
'id' => 'localCommitmentPicture2',
|
|
'name' => 'picture2',
|
|
'width' => 587,
|
|
'height' => 429,
|
|
'model' => $localCommitmentModel ?? null,
|
|
'helper' => __('crud.minicrud.dimensions_must_be', [
|
|
'widthpx' => '587px',
|
|
'heightpx' => '429px',
|
|
]),
|
|
'required' => false,
|
|
'preview' => true,
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- PICTURE3 --}}
|
|
<div class="col-12 pb-3">
|
|
<fieldset class="h-100 border p-3">
|
|
<legend>{{ Str::ucfirst(__('validation.custom.third_image')) }}</legend>
|
|
<div class="row mb-3">
|
|
{{-- PICTURE3_ALT --}}
|
|
<div class="col-12 col-md-6 m-md-0 mb-3">
|
|
@include('bo.partials.inputs.varchar', [
|
|
'id' => 'localCommitmentPicture3Alt',
|
|
'label' => __(':field1 :inter1:field2 :inter2:model', [
|
|
'field1' => Str::ucfirst(__('validation.custom.attribute_alt')),
|
|
'inter1' => __('validation.custom.of_the.female'),
|
|
'field2' => __('validation.custom.third_image'),
|
|
'inter2' => __('validation.custom.of_the.vowel'),
|
|
'model' => trans_choice('models.classes.local_commitment', 1),
|
|
]),
|
|
'hasWordCounter' => true,
|
|
'name' => 'picture3_alt',
|
|
'required' => false,
|
|
'model' => $localCommitmentModel ?? null,
|
|
'helper' => __('crud.minicrud.picture_alt_helper'),
|
|
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
|
|
'field1' => Str::ucfirst(__('validation.custom.attribute_alt')),
|
|
'inter1' => __('validation.custom.of_the.female'),
|
|
'field2' => __('validation.custom.third_image'),
|
|
'inter2' => __('validation.custom.of_the.vowel'),
|
|
'model' => trans_choice('models.classes.local_commitment', 1),
|
|
]),
|
|
])
|
|
</div>
|
|
{{-- PICTURE3_TITLE --}}
|
|
<div class="col-12 col-md-6 mb-3">
|
|
@include('bo.partials.inputs.varchar', [
|
|
'id' => 'localCommitmentPicture3Title',
|
|
'label' => __(':field1 :inter1:field2 :inter2:model', [
|
|
'field1' => Str::ucfirst(__('validation.custom.attribute_title')),
|
|
'inter1' => __('validation.custom.of_the.female'),
|
|
'field2' => __('validation.custom.third_image'),
|
|
'inter2' => __('validation.custom.of_the.vowel'),
|
|
'model' => trans_choice('models.classes.local_commitment', 1),
|
|
]),
|
|
'hasWordCounter' => true,
|
|
'name' => 'picture3_title',
|
|
'required' => false,
|
|
'model' => $localCommitmentModel ?? null,
|
|
'helper' => __('crud.minicrud.picture_title_helper'),
|
|
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
|
|
'field1' => Str::ucfirst(__('validation.custom.attribute_title')),
|
|
'inter1' => __('validation.custom.of_the.female'),
|
|
'field2' => __('validation.custom.third_image'),
|
|
'inter2' => __('validation.custom.of_the.vowel'),
|
|
'model' => trans_choice('models.classes.local_commitment', 1),
|
|
]),
|
|
])
|
|
</div>
|
|
{{-- PICTURE3 --}}
|
|
<div class="col-12">
|
|
@include('bo.partials.inputs.varchar-picture', [
|
|
'id' => 'localCommitmentPicture3',
|
|
'name' => 'picture3',
|
|
'width' => 587,
|
|
'height' => 429,
|
|
'model' => $localCommitmentModel ?? null,
|
|
'helper' => __('crud.minicrud.dimensions_must_be', [
|
|
'widthpx' => '587px',
|
|
'heightpx' => '429px',
|
|
]),
|
|
'required' => false,
|
|
'preview' => true,
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
{{-- TEXT --}}
|
|
<div class="col-12 mb-3">
|
|
<fieldset class="border p-3">
|
|
<legend>{{ Str::ucfirst(__('validation.attributes.text')) }}</legend>
|
|
<div class="row mb-3">
|
|
<div class="col-12">
|
|
@include('bo.partials.inputs.text-html', [
|
|
'id' => 'localCommitmentText',
|
|
'label' => __(':field :inter:model', [
|
|
'field' => Str::ucfirst(__('validation.attributes.text')),
|
|
'inter' => __('validation.custom.of_the.vowel'),
|
|
'model' => trans_choice('models.classes.local_commitment', 1),
|
|
]),
|
|
'name' => 'text',
|
|
'model' => $localCommitmentModel ?? null,
|
|
'required' => true,
|
|
'helper' => __('crud.minicrud.text_warning'),
|
|
])
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col text-center">
|
|
<p><b>{{ __('* Champs obligatoires') }}</b></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@push('scripts')
|
|
<script nonce="{{ $nonce }}">
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
// Submit button clone.
|
|
const submit = document.getElementById('formSubmit')
|
|
submitClone = document.getElementById('formSubmitClone');
|
|
submitClone.addEventListener('click', (event) => {
|
|
event.preventDefault();
|
|
submit.click('');
|
|
})
|
|
|
|
// If we edit the password, the confirmation is required.
|
|
const passwordInput = document.getElementById('pictoPassword');
|
|
const confirmPasswordInput = document.getElementById('pictoPassword_confirmation');
|
|
passwordInput.addEventListener('input', () => {
|
|
if (passwordInput.value !== '') {
|
|
confirmPasswordInput.required = true;
|
|
} else {
|
|
confirmPasswordInput.required = false;
|
|
}
|
|
})
|
|
});
|
|
</script>
|
|
@endpush
|