
    @if(@$stock_item && count($stock_item) > 0)
        @foreach ($stock_item as $row)
            <?php
            $p_unit = findProductUnitByCode($row->barcode, 'cut_piece');
            $my_p = getProductById($row->product_id);
            $id = $p_unit ? $p_unit->id : "";
            $product_name = $my_p ? $my_p->product_name : "";
            $barcode = $row ? $row->barcode : "";
            $size = findSize($p_unit->size_code)->size??'';
            $color = findColor($p_unit->color_code)->name??'';

            ?>
                <div class="col-lg-3 col-md-6 po-box cursor listings" title="{{$product_name}} ( {{$size.','.$color}} )"
                     data-name="{{$product_name}}"
                     data-stock="{{$row->stock_qty}}"
                     data-code="{{$barcode}}"
                     data-size="{{$size}}"
                     data-color="{{$color}}"
                     data-id="{{$id}}">
                    <div class="btn btn-default" style="width: 100%">
                    <span style="
                                left: 10px;
                                top: 10px;
                                background: #337ab7;
                                font-weight: 100;
                                border-radius: 0 0 4px 0;
                                position: absolute;
                    " class="label text-left">{{  $row->stock_qty }} ក្នុងស្តុក</span>
                        <div class="bg-img" style="
                            background: url({{findImgByCode($my_p->barcode)}});
                            height: 150px;
                            width: 100%;
                            background-position: center;
                            background-size: cover;
                            background-repeat: no-repeat;
                            ">
                        </div>
                        <ul class="item-show-name">
                            <li>{{$barcode}}</li>
                            <li>{{ str_limit($product_name,35) }}</li>
                            <li>( {{"$size , $color"}} )</li>
                        </ul>
                    </div>
                </div>
        @endforeach
    @endif

<div class="col-sm-12 col-xs-12">
    <div class="pagin">
        @if(@$stock_item)
            {!! $stock_item->render() !!}
        @endif
    </div>
</div>
