@if(count($combinations[0]) > 0)
<table class="table table-bordered aiz-table">
	<thead>
		<tr>
			<td class="text-center">
				Variant
			</td>
			<td class="text-center">
				Variant Price
			</td>
			<td class="text-center" data-breakpoints="lg">
				SKU
			</td>
			<td class="text-center" data-breakpoints="lg">
				Quantity
			</td>
			<td class="text-center" data-breakpoints="lg">
				Photo
			</td>
		</tr>
	</thead>
	<tbody>

	@foreach ($combinations as $key => $combination)
		@php
			$sku = '';
			foreach (explode(' ', $product_name) as $key => $value) {
				$sku .= substr($value, 0, 1);
			}

			$str = '';
			foreach ($combination as $key => $item){
				if($key > 0 ){
					$str .='-'.str_replace(' ', '', $item);
					$sku .='-'.str_replace(' ', '', $item);
				}
				else{
					if($colors_active == 1){
						$color_name = \App\Models\Color::where('code', $item)->first()->name;
						$str .= $color_name;
						$sku .='-'.$color_name;
					}
					else{
						$str .= str_replace(' ', '', $item);
						$sku .='-'.str_replace(' ', '', $item);
					}
				}
			}
		@endphp
		@if(strlen($str) > 0)
			<tr class="variant">
				<td>
					<label for="" class="control-label">{{ $str }}</label>
				</td>
				<td>
					<input type="number" lang="en" name="price_{{ $str }}" value="{{ $unit_price }}" min="0" step="0.01" class="form-control" required>
				</td>
				<td>
					<input type="text" name="sku_{{ $str }}" value="" class="form-control">
				</td>
				<td>
					<input type="number" lang="en" name="qty_{{ $str }}" value="10" min="0" step="1" class="form-control" required>
				</td>
				<td>
					<button type="button" 
                            class="btn btn-outline-primary open-uploader-sku"
                            data-input="img_{{ $str }}_hidden"
                            data-preview="img_{{ $str }}_preview"
                            data-multiple="false">
                        Choose File
                    </button>
                
                    <input type="hidden" name="img_{{ $str }}" id="img_{{ $str }}_hidden">
                
                    <div class="mt-2">
                        <img id="img_{{ $str }}_preview" class="img-fluid d-none" style="max-height:100px;">
                    </div>
				</td>
			</tr>
		@endif
	@endforeach
	</tbody>
</table>
@endif
