<form class="row g-3 auto-width edit-settings" action="{{ route('advance-settings.update', $field->id)}}" method="post" enctype='multipart/form-data'>
    @csrf
    @method('patch')

    @if($field->type != 'hidden')
    <div class="col-md-12">
        <label for="{!! $field->id !!}" class="form-label"><strong>{!! $field->field !!}</strong></label>
    @endif
    @php
        $default_value = $field->advance_setting->value ?? $field->default_value;
    @endphp

    @if($field->type == 'text')
        <input type="text" class="form-control" maxlength="{!! $field->length != '' ? $field->length : '' !!}" name="value" id="{{ $field->field }}" value="{!! $default_value !!}" {!! $field->is_readonly == 1 ? 'readonly' : '' !!} {!! $field->is_menditory == 1 ? 'required' : '' !!}/>
    @elseif($field->type == 'textarea')
        <textarea class="form-control" name="value" id="{{ $field->field }}" {!! $field->is_readonly == 1 ? 'readonly' : '' !!} maxlength="{!! $field->length != '' ? $field->length : '' !!}" {!! $field->is_menditory == 1 ? 'required' : '' !!}>{!! $default_value !!}</textarea>
    @elseif($field->type == 'radio')
        <br>
        @php
            $options = [];
            $options = explode(',', $field->select_options);
        @endphp
        @foreach($options as $option)
            <input type="radio" id="{!! $field->id !!}_{{ $option }}" name="value" value="{{ $option }}" {!! $default_value == $option ? 'selected checked' : '' !!} {!! $field->is_readonly == 1 ? 'readonly' : '' !!} {!! $field->is_menditory == 1 ? 'required' : '' !!}>
            <label for="{!! $field->id !!}_{{ $option }}">{{ $option }}</label>
            <br>
        @endforeach
    @elseif($field->type == 'checkbox')
        <input type="checkbox" class="checkbox_input" id="{{ $field->id }}" {!! $default_value == true || $default_value == 1 || $default_value == 'on' ? 'checked' : '' !!} {!! $field->is_readonly == 1 ? 'readonly' : '' !!}/>
        <input type="hidden" name="value" class="checkbox_value" value="{!! $default_value == true || $default_value == 1 || $default_value == 'on' ? '1' : '0' !!}">
    @elseif($field->type == 'select')
        @php
            $options = [];
            $options = explode(',', $field->select_options);
        @endphp
        <select class="form-control" name="value" id="{{ $field->field }}" {!! $field->is_readonly == 1 ? 'readonly' : '' !!} {!! $field->is_menditory == 1 ? 'required' : '' !!}>
            <option value="">Select</option>
            @foreach($options as $option)
                <option value="{{ $option }}" {!! $default_value == $option ? 'selected' : '' !!}>{{ $option }}</option>
            @endforeach
        </select>
    @elseif($field->type == 'hidden')
        <input type="hidden" name="value" value="{!! $default_value !!}" {!! $field->is_readonly == 1 ? 'readonly' : '' !!}>
    @elseif($field->type == 'date')
        <input type="date" class="form-control" name="value" id="{{ $field->field }}" value="{!! $default_value !!}" {!! $field->is_readonly == 1 ? 'readonly' : '' !!} {!! $field->is_menditory == 1 ? 'required' : '' !!}>
    @endif

    @if($field->type != 'hidden')
    </div>
    @endif
    <span class="text-danger error_input" style="display:none;">This field is required.</span>
</form>