@if ($product->serialized_product == 1)
@endif
@if (count($product->colorChild) > 0)
@if ($product->serialized_product != 1)
@endif
@elseif (count($product->sizeChild) > 0)
@if ($product->serialized_product != 1)
@endif
@else
@if ($product->serialized_product != 1)
@else
@endif
@endif
@if ($product->size_id > 0)
@php
$size_len = count($size);
$skey = 0;
@endphp
@foreach($grpBySize as $size_id => $szs)
@php
$index_i = $index.$i;
$sz = $size->where('id', $size_id)->first();
$ckey = 0;
$color = $szs->pluck('color')->unique('id')->flatten(1);
$clr_len = count($color);
$clr_center = intval($clr_len/2);
@endphp
@if ($product->color_id > 0)
@foreach($color as $clr)
@php
$index_j = $index.$j;
@endphp
@if ($product->serialized_product == 1)
{!! colorSizeSerialStock($product->storeSerial->where('size_id', $size_id)->where('color_id', $clr->id), $index_j, $product->serialized_product, $index) !!}
@endif
@php
$j++;
@endphp
@endforeach
@else
@if ($product->serialized_product == 1)
{!! colorSizeSerialStock($product->storeSerial->where('size_id', $size_id), $index_i, $product->serialized_product, $index) !!}
@endif
@endif
@php
$i++;
@endphp
@if($skey++ < ($size_len-1))
@endif
@endforeach
@else
{!! colorSizeSerialStock($product->storeSerial, $index_i, $product->serialized_product, $index) !!}
@endif