@if(count($combinations[0]) > 0)
    <table class="table table-borderless table--vertical-middle">
        <thead class="thead-light __bg-7">
            <tr>
                <th class="text-center border-0">
                    <span class="control-label m-0">{{translate('messages.Variant')}}</span>
                </th>
                <th class="text-center border-0">
                    <span class="control-label">{{translate('messages.Variant Price')}}</span>
                </th>
                @if($stock)
                    <th class="text-center border-0">
                        <span class="control-label text-capitalize">{{translate('messages.stock')}}</span>
                    </th>
                @endif
                <th class="text-center border-0">
                    <span class="control-label">{{ translate('Variant Image') }}</span>
                </th>
            </tr>
        </thead>
        <tbody>
            @foreach ($data as $key => $combination)
                @if(strlen($combination['name']) > 0)
                    @php($variationKey = str_replace('.', '_', $combination['name']))
                    <tr>
                        <td class="text-center">
                            <label class="control-label m-0">{{ $combination['name'] }}</label>
                        </td>
                        <td class="error-wrapper">
                            <input type="number" name="price_{{ $variationKey }}" value="{{ $combination['price'] }}" min="0"
                                step="0.01" class="form-control" required>
                        </td>
                        @if ($stock)
                            <td class="error-wrapper"><input type="number" name="stock_{{ $variationKey }}"
                                    value="{{ $combination['stock'] }}" min="0" class="form-control" required></td>
                        @endif
                        <td class="error-wrapper">
                            <input type="hidden" name="existing_variation_image_{{ $variationKey }}" value="{{ $combination['image'] ?? '' }}">
                            <input type="hidden" name="existing_variation_storage_{{ $variationKey }}" value="{{ $combination['storage'] ?? 'public' }}">
                            <div class="d-flex flex-column align-items-center gap-2">
                                @if(!empty($combination['image_full_url']))
                                    <img src="{{ $combination['image_full_url'] }}" alt="{{ $combination['name'] }}" style="width: 42px; height: 42px; object-fit: cover; border-radius: 6px;">
                                @endif
                                <input type="file" name="variation_image_{{ $variationKey }}" class="form-control" accept="image/*">
                            </div>
                        </td>
                    </tr>
                @endif
            @endforeach
        </tbody>
    </table>
@endif
