@foreach($fields as $field)
@if($field->type == "input")
@elseif($field->type == "number")
@elseif($field->type == "textarea")
@elseif($field->type == "upload")
@elseif($field->type == "date_picker")
@elseif($field->type == "toggle")
@error($field->id)
{{ $message }}
@enderror
@elseif($field->type == "dropdown")
@if(!empty($field->options) and count($field->options))
@endif
@elseif($field->type == "checkbox")
@if(!empty($field->options) and count($field->options))
@php
$checkboxValues = [];
if (!empty($values) and !empty($values[$field->id])) {
$checkboxValues = json_decode($values[$field->id], true);
} else if (!empty(old('fields.'.$field->id)) and is_array(old('fields.'.$field->id))) {
$checkboxValues = old('fields.'.$field->id);
}
@endphp
@endif
@elseif($field->type == "radio")
@if(!empty($field->options) and count($field->options))
@endif
@endif
@endforeach