<ul class="list-product">
    @if(@$stock_item && count($stock_item) > 0)
        @foreach ($stock_item as $row)
            <?php
                $pro_unit = \App\Model\ProductUnitModel::where(
                    ['product_id'=>$row->product_id,'color_id'=>$row->color_id,'size_id'=>$row->size_id]
                )->first();
                $my_p = getProductById($row->product_id);
                $id             = $pro_unit ? $pro_unit->id : "";
                $product_name   = $my_p ? $my_p->product_name : "";
                $barcode        = $row ? $row->barcode : "";
                $color = findColor($row->color_id);
                $size = findSize($row->size_id);
                $category_name  = $my_p ? optional($my_p->get_category)->category_name : "";
                $convert_ = convert_to_user_currency($pro_unit->product_id,$pro_unit->wholesale_price);
                $user_currency = user_currency();
            ?>
            @if($pro_unit)
                <li class="listings cursor" title="{{$product_name}} (Size:{{$size?$size->size:''}} , Color:{{$color?$color->name:''}})"
                    data-name="{{  $product_name}}"
                    data-stock="{{  $row->stock_qty}}"
                    data-code="{{  $barcode}}"
                    data-price="{{$convert_}}"
                    data-currency="{{$user_currency->id}}"
                    data-symbol="{{$user_currency->symbol}}"
                    data-color="{{  $color?$color->name:''}}"
                    data-size="{{  $size?$size->size:''}}"
                    data-unit="{{  findUnit($pro_unit->unit_id)->unit}}"
                    data-id="{{ $id }}" 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->stock_qty}} {{  findUnit($pro_unit->unit_id)->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) }}</span>
                    </div>

                </li>
            @endif

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