<ul class="list-product">
    <?php
    $type = request('postype');
    ?>
    @if(@$stock_item )
        @foreach ($stock_item as $row)
            @if($row)
                <?php
                $pro_unit = findProductUnitByCode($row->barcode, 'product');
                ?>
                @if($pro_unit)
                    <?php

                    $my_p = getProductById($row->product_id);
                    $id = $pro_unit ? $pro_unit->id : "";
                    $product_name = $my_p ? $my_p->product_name : "";
                    $barcode = $row->barcode;
                    $size = findSize($row->size_code);
                    $color = findColor($row->color_code);
                    $category_name = $my_p ? optional($my_p->get_category)->category_name : "";
                    $user_currency = user_currency();
                    $price = $user_currency->id===1?$row->price_riel:$row->price_usd;
                    ?>
                    <li class="listings cursor"
                        title="{{$product_name}} ( {{__('administrator.size')}}:{{$size?$size->size:''}},{{__('administrator.color')}}:{{$color?$color->name:''}})"
                        data-name="{{  $product_name}}"
                        data-stock="{{  $row?$row->stock_qty:0}}"
                        data-code="{{  $barcode}}"
                        data-price="{{$price}}"
                        data-currency="{{$user_currency->id}}"
                        data-symbol="{{$user_currency->symbol}}"
                        data-size="{{  $size->size??''}}"
                        data-color="{{ $color->name??''}}"
                        data-unit="{{  findUnit($pro_unit->unit_id)->unit}}"
                        data-id="{{ $id }}" style="border: 1px solid rgb(51, 122, 183);border-radius: 3px;overflow: hidden">
                        <div class="bg-img" style="
                            background: url({{findImgByCode($my_p->barcode)}});
                            height: 10.5vh;
                            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->stock_qty:0}} {{  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: 11px">
                            {{ $barcode }} <br>{{ str_limit($product_name,35)}}<br>({{$size->size??''}},{{$color->name??''}}) </span>
                        </div>

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