@foreach(old('product_attribute') ?? [] as $key => $attribute_old)
<tr id="attribute-row{{ $key }}">
<td class="text-left" style="width: 20%;">
<select name="product_attribute[{{ $key }}][attribute_id]" class="form-select" required>
@foreach($attributes as $attribute)
<optgroup label="{{$attribute['name'] }}">
@foreach($attribute['values'] as $value)
<option value="{{$value['id'] }}" name="product_attribute[{{ $key }}][id]"
{{ old('product_attribute.'.$key.'.attribute_id') == $value['id'] ? 'selected' : '' }}>{{ $value['name'] }}</option>
@endforeach
</optgroup>
@endforeach
</select>
</td>
<td class="text-left">
@foreach($langs as $lang)
<div class="input-group">
<span class="input-group-text">
{!! $lang['img'] !!}
</span>
<input name="product_attribute[{{ $key }}][text][{{ $lang['code']}}]" placeholder="Текст" class="form-control" required
value="{{ old('product_attribute.'.$key.'.text.'.$lang['code'], '') }}">
</div>
@endforeach
</td>
<td class="align-middle">
<button type="button" onclick="$('#attribute-row{{ $key }}').remove();" title="Удалить" class="btn btn-danger"><i class="bx bx-minus-circle"></i></button>
</td>
</tr>
@endforeach