<ul class="list-product">
    @if(@$stock_item && count($stock_item) > 0)
        @foreach ($stock_item as $row)
            <?php
                $my_p = getProductById($row->product_id);
                $id             = $row ? $row->id : "";
                $product_name   = $my_p ? $my_p->product_name : "";
                $barcode        = $row ? $row->barcode : "";
                $color = findColor($row->color_code);
                $size = findSize($row->size_code);
                $unit = findUnit($my_p->unit_id)->unit??'';
            ?>
                <li class="listings cursor" title="{{$product_name}} (Size:{{$size?$size->size:''}} , Color:{{$color?$color->name:''}})"
                    data-name="{{$product_name}}"
                    data-stock="{{$row->total_stock}}"
                    data-code="{{$barcode}}"
                    data-product_id="{{$row->product_id}}"
                    data-color="{{$color?$color->name:''}}"
                    data-size="{{$size?$size->size:''}}"
                    data-unit="{{$unit}}"
                    style="border: 1px solid rgb(51, 122, 183)">
                    <div class="bg-img" style="
                            background: url({{findImg($my_p)}});
                            height: 13vh;
                            width: 100%;
                            background-position: center;
                            background-size: cover;
                            background-repeat: no-repeat;
                            ">
                       <span style="
                                background: #337ab7;
                                font-weight: 100;
                                border-radius: 0 0 4px 0;
                                position: absolute;
                    " class="label text-left">{{  $row?$row->total_stock:0}} {{$unit}} ក្នុងស្តុក</span>
                    </div>
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 text-center" style="
                                   padding: 0px;
                                   background: #337ab7;
                                   color: white;
                                   ">
                        <span style="font-size: 12px">{{ $barcode }} <br> {{ str_limit($product_name,15) }} ({{$size?$size->size:''}} , {{$color?$color->name:''}})</span>
                    </div>
                </li>

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