add old formularyModel values
This commit is contained in:
parent
fff06d743a
commit
cfeb53a017
4 changed files with 24 additions and 12 deletions
|
|
@ -45,8 +45,6 @@ class StoreFormularyRequest extends FormRequest
|
|||
*/
|
||||
public function rules()
|
||||
{
|
||||
|
||||
|
||||
$rules = [
|
||||
'type' => ['required', new EnumIsValidRule(InputTypeEnum::class)],
|
||||
'placeholder' => 'present|array',
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div>
|
||||
<!-- SELECT INPUT TYPE -->
|
||||
<fieldset
|
||||
v-if="!intModel?.type"
|
||||
v-if="!intModel?.id"
|
||||
class="border h-100 bg-white p-3 mb-3"
|
||||
>
|
||||
<legend>{{ __('Type du champs') }}</legend>
|
||||
|
|
@ -12,6 +12,8 @@
|
|||
name="type"
|
||||
aria-label="Default select example"
|
||||
@change="updateSelectValue()"
|
||||
role="button"
|
||||
required
|
||||
>
|
||||
<option
|
||||
:selected="(intModel != null) ? false : true"
|
||||
|
|
@ -66,6 +68,9 @@
|
|||
placeholder="Nom du champs"
|
||||
:value="intModel?.name"
|
||||
>
|
||||
<p class="text-danger m-0">
|
||||
{{ parseValidationInput(`name`, allErrors) }}
|
||||
</p>
|
||||
<small class="form-text text-muted">{{ __('Doit posséder 3 caractères minimum, 255 maximum.') }}</small>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -96,7 +101,7 @@
|
|||
:value="(intPlaceholder) ? intPlaceholder['fr' as unknown as number] : ''"
|
||||
>
|
||||
<p class="text-danger m-0">
|
||||
{{ parseValidationInput(`details.fr`, allErrors) }}
|
||||
{{ parseValidationInput(`placeholder.fr`, allErrors) }}
|
||||
</p>
|
||||
<small class="form-text text-muted">{{ __('Doit posséder 3 caractères minimum, 255 maximum.') }}</small>
|
||||
</div>
|
||||
|
|
@ -120,7 +125,7 @@
|
|||
:value="(intPlaceholder) ? intPlaceholder['en' as unknown as number] : ''"
|
||||
>
|
||||
<p class="text-danger m-0">
|
||||
{{ parseValidationInput(`details.en`, allErrors) }}
|
||||
{{ parseValidationInput(`placeholder.en`, allErrors) }}
|
||||
</p>
|
||||
<small class="form-text text-muted">{{ __('Doit posséder 3 caractères minimum, 255 maximum.') }}</small>
|
||||
</div>
|
||||
|
|
@ -144,7 +149,7 @@
|
|||
:value="(intPlaceholder) ? intPlaceholder['de' as unknown as number] : ''"
|
||||
>
|
||||
<p class="text-danger m-0">
|
||||
{{ parseValidationInput(`details.de`, allErrors) }}
|
||||
{{ parseValidationInput(`placeholder.de`, allErrors) }}
|
||||
</p>
|
||||
<small class="form-text text-muted">{{ __('Doit posséder 3 caractères minimum, 255 maximum.') }}</small>
|
||||
</div>
|
||||
|
|
@ -168,7 +173,7 @@
|
|||
:value="(intPlaceholder) ? intPlaceholder['nl' as unknown as number] : ''"
|
||||
>
|
||||
<p class="text-danger m-0">
|
||||
{{ parseValidationInput(`details.nl`, allErrors) }}
|
||||
{{ parseValidationInput(`placeholder.nl`, allErrors) }}
|
||||
</p>
|
||||
<small class="form-text text-muted">{{ __('Doit posséder 3 caractères minimum, 255 maximum.') }}</small>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,12 +2,21 @@
|
|||
{{-- SELECT INPUT COMPONENT --}}
|
||||
<div class="col-12 mb-3">
|
||||
@php
|
||||
if(old('type') || old('name') || old('placeholder') || old('details') || old('is_visible') || old('required')) {
|
||||
$oldModel = [];
|
||||
$oldModel["type"] = intval(old('type'));
|
||||
$oldModel["name"] = old('name');
|
||||
$oldModel["placeholder"] = old('placeholder');
|
||||
$oldModel["details"] = old('details');
|
||||
$oldModel["is_visible"] = old('is_visible');
|
||||
$oldModel["required"] = old('required');
|
||||
}
|
||||
$data = [
|
||||
'id' => 'FormulariesSelectInput',
|
||||
'inputType' => \App\Enums\Formularies\InputTypeEnum::toArray(),
|
||||
'id' => 'FormulariesSelectInput',
|
||||
'inputType' => \App\Enums\Formularies\InputTypeEnum::toArray(),
|
||||
'inputStatus' => \App\Enums\Formularies\InputStatusEnum::toArray(),
|
||||
'model' => $formularyModel ?? null,
|
||||
'errors' => $errors->getBag('default')->getMessages() ?? []
|
||||
'model' => $oldModel ?? $formularyModel ?? null,
|
||||
'errors' => $errors->getBag('default')->getMessages() ?? []
|
||||
];
|
||||
@endphp
|
||||
<div class="formularies-select-input" data-json='@json($data)'></div>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
@if ($errors->any())
|
||||
<div class="alert alert-danger alert-dismissible fade show m-0" role="alert">
|
||||
@if ($errors->any())
|
||||
<ul class="list-unstyled">
|
||||
<ul class="list-unstyled m-0">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue