<form id="generalForm" data-form="general">
    @csrf
    @method('PUT')

    <x-admin.card>
        <div class="row mb-3">
            <div class="col-md-6">
                <label class="form-label">
                    {{ __('admin/product-config-option-groups.fields_name') }}
                    <span class="text-danger">*</span>
                </label>
                <div class="input-group">
                    <input type="text" class="form-control" id="configGroupName" name="name"
                           value="{{ old('name', $productConfigOptionGroup->name) }}"
                           {{ $productConfigOptionGroup->isArchived() ? 'disabled' : '' }} required>
                    @unless($productConfigOptionGroup->isArchived())
                        <button type="button" class="btn btn-outline-info"
                                data-translate="name"
                                data-translate-model="ProductConfigOptionGroup"
                                data-translate-id="{{ $productConfigOptionGroup->id }}"
                                data-translate-name="{{ __('admin/product-config-option-groups.fields_name') }}"
                                data-translate-target="#configGroupName"
                                title="{{ __('admin/common.translations_manage_translations') }}">
                            <i class="fas fa-language"></i>
                        </button>
                    @endunless
                </div>
            </div>
            <div class="col-md-3">
                <label class="form-label">{{ __('admin/product-config-option-groups.fields_order') }}</label>
                <input type="number" class="form-control" name="order"
                       value="{{ old('order', $productConfigOptionGroup->order) }}" min="0"
                       {{ $productConfigOptionGroup->isArchived() ? 'disabled' : '' }}>
            </div>
            <div class="col-md-3 d-flex align-items-end">
                @php
                    $statusKey = $productConfigOptionGroup->isArchived()
                        ? 'archived'
                        : ($productConfigOptionGroup->hidden ? 'hidden' : 'active');
                    $statusColor = ['active' => 'success', 'hidden' => 'secondary', 'archived' => 'warning'][$statusKey];
                @endphp
                <span class="badge bg-{{ $statusColor }} fs-6">
                    {{ __('admin/product-config-option-groups.status_'.$statusKey) }}
                </span>
            </div>
        </div>

        <div class="mb-3">
            <label class="form-label">{{ __('admin/product-config-option-groups.fields_description') }}</label>
            <div class="input-group">
                <textarea class="form-control" id="configGroupDescription" name="description" rows="3"
                          {{ $productConfigOptionGroup->isArchived() ? 'disabled' : '' }}>{{ old('description', $productConfigOptionGroup->description) }}</textarea>
                @unless($productConfigOptionGroup->isArchived())
                    <button type="button" class="btn btn-outline-info"
                            data-translate="description"
                            data-translate-model="ProductConfigOptionGroup"
                            data-translate-id="{{ $productConfigOptionGroup->id }}"
                            data-translate-name="{{ __('admin/product-config-option-groups.fields_description') }}"
                            data-translate-target="#configGroupDescription"
                            title="{{ __('admin/common.translations_manage_translations') }}">
                        <i class="fas fa-language"></i>
                    </button>
                @endunless
            </div>
        </div>

        <div class="form-check mb-3">
            <input type="hidden" name="hidden" value="0">
            <input class="form-check-input" type="checkbox" name="hidden" value="1" id="hidden"
                   {{ old('hidden', $productConfigOptionGroup->hidden) ? 'checked' : '' }}
                   {{ $productConfigOptionGroup->isArchived() ? 'disabled' : '' }}>
            <label class="form-check-label" for="hidden">
                {{ __('admin/product-config-option-groups.fields_hidden') }}
            </label>
        </div>

        @if ($productConfigOptionGroup->isArchived())
            <div class="alert alert-warning mb-3">
                <i class="fas fa-archive me-2"></i>
                {{ __('admin/product-config-option-groups.archived_readonly_notice') }}
            </div>
        @endif

        <x-slot:footer>
            @if (! $productConfigOptionGroup->isArchived())
                <x-admin.form-actions
                    :cancel-url="route('admin.product-config-option-groups.index')"
                    :submit-text="__('admin/product-config-option-groups.buttons_update')"
                />
            @endif
        </x-slot:footer>
    </x-admin.card>

</form>
