Conditionally disable Add default values checkbox

This commit is contained in:
Marcus Moore 2024-08-22 13:58:31 -07:00
parent 10b45812c4
commit 7f3c86165b
No known key found for this signature in database

View file

@ -10,13 +10,13 @@
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label class="form-control"> <label class="form-control">
{{ Form::checkbox('add_default_values', 1, old('add_default_values', $add_default_values), ['data-livewire-component' => $this->getId(), 'id' => 'add_default_values', 'wire:model.live' => 'add_default_values']) }} {{ Form::checkbox('add_default_values', 1, old('add_default_values', $add_default_values), ['data-livewire-component' => $this->getId(), 'id' => 'add_default_values', 'wire:model.live' => 'add_default_values', 'disabled' => $this->fields->isEmpty()]) }}
{{ trans('admin/models/general.add_default_values') }} {{ trans('admin/models/general.add_default_values') }}
</label> </label>
</div> </div>
</div> </div>
@if ($add_default_values ) {{-- 'if the checkbox is enabled *AND* there are more than 0 fields in the fieldsset' --}} @if ($add_default_values )
@if ($this->fields) @if ($this->fields)
@foreach ($this->fields as $field) @foreach ($this->fields as $field)