Added form input select, and fixes to date

This commit is contained in:
Deon George 2022-08-02 22:34:20 +10:00
parent 2e512cc3ed
commit 8e9ca4c531
2 changed files with 44 additions and 1 deletions

View File

@ -4,7 +4,7 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa-fw {{ $icon ?? 'fas fa-calendar' }}"></i></span> <span class="input-group-text"><i class="fa-fw {{ $icon ?? 'fas fa-calendar' }}"></i></span>
</div> </div>
<input type="date" class="form-control @error($id) is-invalid @enderror" id="{{ $id }}" name="{{ $name ?? $id}}" value="{{ old($id,$value) }}"> <input type="date" class="form-control @error($id) is-invalid @enderror" id="{{ $id }}" name="{{ $name ?? $id}}" value="{{ old($old,$value) }}">
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
@error($id) @error($id)
{{ $message }} {{ $message }}

View File

@ -0,0 +1,43 @@
<div class="form-group">
<label for="{{ $id }}">{{ $label }}</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa-fw {{ $icon ?? 'fas fa-list' }}"></i></span>
</div>
<select class="form-control @error($id) is-invalid @enderror" id="{{ $id }}" name="{{ $name ?? $id}}">
@if(! isset($addvalues) || ! $addvalues)
<option id="new"></option>
@endif
@foreach($options as $option)
@empty(Arr::get($option,'value')) @continue @endempty
<option value="{{ Arr::get($option,'id') }}" @if(Arr::get($option,'id') == old($old,$value))selected @endif>{{ Arr::get($option,'value') }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error($id)
{{ $message }}
@enderror
</span>
</div>
</div>
@section('page-scripts')
@css(select2)
@js(select2,autofocus)
<script type="text/javascript">
$(document).ready(function() {
$('#{{ $id }}').select2({
dropdownAutoWidth: true,
width: 'style',
@isset($addvalues)
tags: true,
placeholder: '',
allowClear: true,
@endisset
});
});
</script>
@append