miguel456 2b1caeb80c
branch commit
Signed-off-by: miguel456 <me@nogueira.codes>
2023-06-29 18:21:58 +01:00

39 lines
817 B
PHP
Executable File

@extends('adminlte::components.form.input-group-component')
{{-- Set errors bag internallly --}}
@php($setErrorsBag($errors ?? null))
{{-- Set input group item section --}}
@section('input_group_item')
{{-- Select --}}
<select id="{{ $id }}" name="{{ $name }}"
{{ $attributes->merge(['class' => $makeItemClass()]) }}>
{{ $slot }}
</select>
@overwrite
{{-- Support to auto select the old submitted values --}}
@if($errors->any() && $enableOldSupport)
@push('js')
<script>
$(() => {
let oldOptions = @json(collect($getOldValue($errorKey)));
$('#{{ $id }} option').each(function()
{
let value = $(this).val() || $(this).text();
$(this).prop('selected', oldOptions.includes(value));
});
});
</script>
@endpush
@endif