2023-12-12 22:27:50 -08:00
|
|
|
<span>
|
|
|
|
|
2021-06-28 22:40:18 -07:00
|
|
|
<div class="form-group{{ $errors->has('custom_fieldset') ? ' has-error' : '' }}">
|
2023-12-12 22:27:50 -08:00
|
|
|
<label for="custom_fieldset" class="col-md-3 control-label">
|
|
|
|
{{ trans('admin/models/general.fieldset') }}
|
|
|
|
</label>
|
|
|
|
<div class="col-md-5">
|
2024-05-30 16:12:52 -07:00
|
|
|
{{ Form::select('fieldset_id', Helper::customFieldsetList(), old('fieldset_id', $fieldset_id), array('class'=>'select2 js-fieldset-field livewire-select2', 'style'=>'width:100%; min-width:350px', 'aria-label'=>'custom_fieldset', 'data-livewire-component' => $this->getId())) }}
|
2023-12-12 22:27:50 -08:00
|
|
|
{!! $errors->first('custom_fieldset', '<span class="alert-msg" aria-hidden="true"><br><i class="fas fa-times"></i> :message</span>') !!}
|
|
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
|
|
<label class="form-control">
|
2024-05-30 16:12:52 -07:00
|
|
|
{{ 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']) }}
|
2023-12-12 22:27:50 -08:00
|
|
|
{{ trans('admin/models/general.add_default_values') }}
|
|
|
|
</label>
|
|
|
|
</div>
|
2021-03-18 16:12:39 -07:00
|
|
|
</div>
|
2023-12-12 22:27:50 -08:00
|
|
|
|
2024-08-13 17:01:35 -07:00
|
|
|
@if ($add_default_values ) {{-- 'if the checkbox is enabled *AND* there are more than 0 fields in the fieldsset' --}}
|
2024-08-13 17:30:53 -07:00
|
|
|
@if ($this->fields)
|
2023-12-12 22:27:50 -08:00
|
|
|
|
2024-08-13 17:30:53 -07:00
|
|
|
@foreach ($this->fields as $field)
|
2024-08-15 10:32:33 -07:00
|
|
|
<div class="form-group" wire:key="field-{{ $field->id }}">
|
2021-09-30 16:21:23 -07:00
|
|
|
|
2023-12-12 22:27:50 -08:00
|
|
|
<label class="col-md-3 control-label{{ $errors->has($field->name) ? ' has-error' : '' }}">{{ $field->name }}</label>
|
|
|
|
|
|
|
|
<div class="col-md-7">
|
|
|
|
|
2022-06-22 19:37:11 -07:00
|
|
|
@if ($field->format == "DATE")
|
2023-12-12 22:27:50 -08:00
|
|
|
|
2022-06-22 19:37:11 -07:00
|
|
|
<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">
|
2022-06-22 19:47:08 -07:00
|
|
|
<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) }}">
|
2022-06-22 19:37:11 -07:00
|
|
|
<span class="input-group-addon"><i class="fas fa-calendar" aria-hidden="true"></i></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-12-12 22:27:50 -08:00
|
|
|
|
2022-06-22 19:37:11 -07:00
|
|
|
@elseif ($field->element == "text")
|
2023-12-12 22:27:50 -08:00
|
|
|
|
|
|
|
|
2024-08-15 10:32:33 -07:00
|
|
|
<input
|
|
|
|
class="form-control"
|
|
|
|
type="text"
|
|
|
|
value="{{ $this->getValueForField($field) }}"
|
|
|
|
id="default-value{{ $field->id }}"
|
|
|
|
name="default_values[{{ $field->id }}]"
|
|
|
|
x-on:blur="(e) => $wire.$call(
|
|
|
|
'updateFieldValue',
|
|
|
|
'{{ $field->db_column }}',
|
|
|
|
e.target.value
|
|
|
|
)"
|
|
|
|
/>
|
2023-12-12 22:27:50 -08:00
|
|
|
|
|
|
|
|
2021-09-30 16:21:23 -07:00
|
|
|
@elseif($field->element == "textarea")
|
2023-12-12 22:27:50 -08:00
|
|
|
|
|
|
|
|
|
|
|
<textarea class="form-control" style="width: 100%;" id="default-value{{ $field->id }}" name="default_values[{{ $field->id }}]">{{ $field->defaultValue($model_id) }}</textarea>
|
|
|
|
|
|
|
|
|
2021-09-30 16:21:23 -07:00
|
|
|
@elseif($field->element == "listbox")
|
|
|
|
|
2023-12-12 22:27:50 -08:00
|
|
|
|
|
|
|
<select class="form-control" name="default_values[{{ $field->id }}]">
|
|
|
|
<option value=""></option>
|
|
|
|
@foreach(explode("\r\n", $field->field_values) as $field_value)
|
|
|
|
<option value="{{$field_value}}" {{ $field->defaultValue($model_id) == $field_value ? 'selected="selected"': '' }}>{{ $field_value }}</option>
|
|
|
|
@endforeach
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
2021-10-04 20:02:27 -07:00
|
|
|
@elseif($field->element == "radio")
|
2023-12-12 22:30:08 -08:00
|
|
|
|
2021-10-04 20:02:27 -07:00
|
|
|
@foreach(explode("\r\n", $field->field_values) as $field_value)
|
2023-12-12 22:30:08 -08:00
|
|
|
<label class="col-md-3 form-control" for="{{ str_slug($field_value) }}">
|
|
|
|
<input id="{{ str_slug($field_value) }}" aria-label="{{ str_slug($field->name) }}" type='radio' name="default_values[{{ $field->id }}]" value="{{$field_value}}" {{ $field->defaultValue($model_id) == $field_value ? 'checked="checked"': '' }} />{{ $field_value }}
|
2023-12-13 05:52:31 -08:00
|
|
|
</label>
|
2021-10-04 20:02:27 -07:00
|
|
|
@endforeach
|
2023-12-12 22:27:50 -08:00
|
|
|
|
2021-09-30 16:21:23 -07:00
|
|
|
@elseif($field->element == "checkbox")
|
2023-12-12 22:27:50 -08:00
|
|
|
|
|
|
|
@foreach(explode("\r\n", $field->field_values) as $field_value)
|
|
|
|
<label class="col-md-3 form-control" for="{{ str_slug($field_value) }}">
|
2023-12-12 22:30:08 -08:00
|
|
|
<input id="{{ str_slug($field_value) }}" type="checkbox" aria-label="{{ str_slug($field->name) }}" name="default_values[{{ $field->id }}][]" value="{{ $field_value }}"{{ in_array($field_value, explode(', ',$field->defaultValue($model_id))) ? ' checked="checked"': '' }}> {{ $field_value }}
|
2023-12-12 22:27:50 -08:00
|
|
|
</label>
|
2022-09-15 09:18:54 -07:00
|
|
|
@endforeach
|
2023-12-12 22:27:50 -08:00
|
|
|
|
|
|
|
|
2021-09-30 16:21:23 -07:00
|
|
|
@else
|
|
|
|
<span class="help-block form-error">
|
|
|
|
Unknown field element: {{ $field->element }}
|
|
|
|
</span>
|
|
|
|
@endif
|
|
|
|
</div>
|
2024-08-15 10:32:33 -07:00
|
|
|
</div>
|
2021-09-30 16:21:23 -07:00
|
|
|
|
|
|
|
@endforeach
|
2024-08-15 10:32:33 -07:00
|
|
|
|
2021-11-15 21:09:35 -08:00
|
|
|
@endif
|
2021-09-30 16:21:23 -07:00
|
|
|
|
2021-03-18 16:12:39 -07:00
|
|
|
@endif
|
2021-10-04 20:02:27 -07:00
|
|
|
</span>
|