@if (isset($customFields) && !empty($customFields))
@php $disabledFieldsTypes = ['file', 'video']; $clearFilterBtn = ''; $firstFieldFound = false; @endphp @foreach($customFields as $field) @continue(in_array(data_get($field, 'type'), $disabledFieldsTypes) || data_get($field, 'use_as_filter') != 1) @php // Fields parameters $fieldId = 'cf.' . data_get($field, 'id'); $fieldName = 'cf[' . data_get($field, 'id') . ']'; $fieldOld = 'cf.' . data_get($field, 'id'); // Get the default value $defaultValue = (request()->filled($fieldOld)) ? request()->input($fieldOld) : data_get($field, 'default_value'); // Field Query String $fieldQueryStringId = 'cf' . data_get($field, 'id') . 'QueryString'; $fieldQueryStringValue = \App\Helpers\Arr::query(request()->except(['page', $fieldId])); $fieldQueryString = ''; // Clear Filter Button $clearFilterBtn = \App\Helpers\UrlGen::getCustomFieldFilterClearLink($fieldOld, $cat ?? null, $city ?? null); @endphp @if (in_array(data_get($field, 'type'), ['text', 'textarea', 'url', 'number'])) {{-- text --}}
{!! $fieldQueryString !!}
@endif @if (data_get($field, 'type') == 'checkbox') {{-- checkbox --}}
{!! $fieldQueryString !!}
@endif @if (data_get($field, 'type') == 'checkbox_multiple') @if (!empty(data_get($field, 'options'))) {{-- checkbox_multiple --}}
@php $cmFieldStyle = (is_array(data_get($field, 'options')) && count(data_get($field, 'options')) > 12) ? ' style="height: 250px; overflow-y: scroll;"' : ''; @endphp
@foreach (data_get($field, 'options') as $option) @php $optionId = data_get($option, 'id'); // Get the default value $defaultValue = (request()->filled($fieldOld . '.' . $optionId)) ? request()->input($fieldOld . '.' . $optionId) : ( ( is_array(data_get($field, 'default_value')) && !empty($optionId) && !empty(data_get($field, 'default_value.' . $optionId . '.value')) ) ? data_get($field, 'default_value.' . $optionId . '.value') : data_get($field, 'default_value') ); // Field Query String $fieldQueryStringId = 'cf' . data_get($field, 'id') . $optionId . 'QueryString'; $fieldQueryStringValue = \App\Helpers\Arr::query(request()->except(['page', $fieldId . '.' . $optionId])); $fieldQueryString = ''; @endphp
{!! $fieldQueryString !!} @endforeach
@endif @endif @if (data_get($field, 'type') == 'radio') @if (!empty(data_get($field, 'options'))) {{-- radio --}}
@php $rFieldStyle = (is_array(data_get($field, 'options')) && count(data_get($field, 'options')) > 12) ? ' style="height: 250px; overflow-y: scroll;"' : ''; @endphp
@foreach (data_get($field, 'options') as $option) @php $optionId = data_get($option, 'id'); @endphp
@endforeach
{!! $fieldQueryString !!}
@endif @endif @if (data_get($field, 'type') == 'select') {{-- select --}}
@php $fieldOptions = is_array(data_get($field, 'options')) ? data_get($field, 'options') : []; $select2Type = (count($fieldOptions) <= 10) ? 'selecter' : 'large-data-selecter'; @endphp
{!! $fieldQueryString !!}
@endif @if (in_array(data_get($field, 'type'), ['date', 'date_time', 'date_range'])) {{-- date --}} @php $datePickerClass = ''; if (in_array(data_get($field, 'type'), ['date', 'date_time'])) { $datePickerClass = ' cf-date'; } if (data_get($field, 'type') == 'date_range') { $datePickerClass = ' cf-date_range'; } @endphp
{!! $fieldQueryString !!}
@endif @endforeach
@endif @section('after_styles') @endsection @section('after_scripts') @parent @endsection