<div class="list-product col-lg-12">
    @if(@$stock_item && count($stock_item) > 0)
        @foreach ($stock_item as $row)
            <?php
            $product_unit = \App\Model\product\ProductUnitModel::where(['product_id' => $row->product_id])->pluck('unit_id');
            $p_unit = \App\Model\product\ProductUnitModel::where(['product_id' => $row->product_id])->where('type', 'parent')->first();
            $c_unit = \App\Model\product\ProductUnitModel::where(['product_id' => $row->product_id])->where('type', 'child')->first();
            $unit = \App\Model\product\UnitModel::whereIn('id', $product_unit)->pluck('unit', 'id');
            $unit_html = '';
            foreach ($unit as $key => $u) {
                $unit_html .= '<option value="' . $key . '">' . $u . '</option>';
            }
            $id = $row->product_id;
            $my_p = getProductById($id);
            $product_name = $my_p ? $my_p->product_name : "";
            $barcode = $my_p ? $my_p->barcode : "";
            $stock_qty = getStockQty($id, $row->stock_qty);
            ?>
            <div class="col-lg-3 col-md-6 po-box" title="{{$product_name}}">
                <div class="btn btn-default">
                    <a class="listings cursor"
                       data-name="{{  $product_name}}"
                       data-barcode="{{$barcode}}"
                       data-unit="{{$unit_html}}"
                       data-id="{{ $id }}">
                        <img src="{{findImg($my_p)}}">
                        <ul class="item-show-name">
                            <li>{{ str_limit($product_name,25) }}</li>
                            <li>{{$barcode}}</li>
                        </ul>
                        <span style="
                        left:10px;
                        top: 10px;
                                background: #337ab7;
                                font-weight: 100;
                                border-radius: 0 0 4px 0;
                                position: absolute;"
                              class="label text-left">{{  $stock_qty}}
                                   ក្នុងស្តុក</span>
                    </a>
                </div>
            </div>
        @endforeach
    @endif
</div>
<div class="col-sm-12 col-xs-12">
    <div class="pagin">
        @if(@$stock_item)
            {!! $stock_item->render() !!}
        @endif
    </div>
</div>

