@php $optionGroups = $child_category->optionGroups() ->with(['translate', 'options.translate', 'options' => fn ($q) => $q->orderBy('sort_order')]) ->orderBy('sort_order') ->get(); $optionFieldTypeLabels = [ 'select' => __('translate.Option field select'), 'text' => __('translate.Option field text'), 'number' => __('translate.Option field number'), ]; @endphp

{{ __('translate.Category option groups') }}

{{ __('translate.Category option groups help') }}

@foreach ($optionGroups as $group)
{{ $group->translate?->label ?? $group->key }} ({{ $group->key }} ยท {{ $optionFieldTypeLabels[$group->type] ?? $group->type }}) @if ($group->is_required) {{ __('translate.Required') }} @endif
@csrf @method('DELETE')
@if ($group->type === 'select')
    @foreach ($group->options->whereNull('parent_option_id') as $option)
  • {{ $option->translate?->name ?? $option->slug }}
    @csrf @method('DELETE')
  • @endforeach
@csrf @if ($group->parent_group_id) @php $parentOptions = \Modules\Category\Entities\CategoryOption::where('category_option_group_id', $group->parent_group_id) ->whereNull('parent_option_id') ->orderBy('sort_order') ->with('translate') ->get(); @endphp
@else
@endif
@if ($group->parent_group_id)
    @foreach ($group->options->whereNotNull('parent_option_id') as $childOption)
  • {{ $childOption->translate?->name }} ({{ __('translate.Parent group') }} #{{ $childOption->parent_option_id }})
  • @endforeach
@endif @endif
@endforeach
{{ __('translate.Add option group') }}
@csrf