Get datepicker working

This commit is contained in:
Marcus Moore 2024-08-20 16:41:24 -07:00
parent 5d1f98bf93
commit 6c5ec6a16c
No known key found for this signature in database
2 changed files with 11 additions and 3 deletions

View file

@ -2,7 +2,6 @@
namespace App\Livewire;
use Illuminate\Support\Collection;
use Livewire\Attributes\Computed;
use Livewire\Component;
@ -16,7 +15,6 @@ class CustomFieldSetDefaultValuesForModel extends Component
public $fieldset_id;
public $model_id;
public Collection $cachedValues;
public array $selectedValues = [];
public function mount($model_id = null)

View file

@ -30,7 +30,17 @@
<div class="input-group col-md-4" style="padding-left: 0px;">
<div class="input-group date" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-autoclose="true">
<input type="text" class="form-control" placeholder="{{ trans('general.select_date') }}" name="default_values[{{ $field->id }}]" id="default-value{{ $field->id }}" value="{{ $field->defaultValue($model_id) }}">
<input
type="text"
class="form-control"
placeholder="{{ trans('general.select_date') }}"
name="default_values[{{ $field->id }}]"
id="default-value{{ $field->id }}"
wire:model="selectedValues.{{ $field->db_column }}"
{{-- catch the onchange event and dispatch an InputEvent ourselves... --}}
{{-- https://laracasts.com/discuss/channels/livewire/livewire-and-bootstrap-datepicker?page=1&replyId=623122--}}
onchange="this.dispatchEvent(new InputEvent('input'))"
>
<span class="input-group-addon"><i class="fas fa-calendar" aria-hidden="true"></i></span>
</div>
</div>