
@foreach($products as $key => $row)
    <?php
    $barcode = $row->barcode;
    $color = \App\Model\product\ColorModel::where('code',$row->color_code)->first();
    $size = \App\Model\product\SizeModel::where('code',$row->size_code)->first();
    $product = getProductById($row->product_id);
    $cost = getProductPrice($row,'purchase');

    ?>
    <div class="col-lg-3 col-md-6 po-box" title="{{$row->product_name}} ({{($size?$size->size:'').','.($color?$color->name:'')}})">
        <div class="btn btn-default" style="width: 100%">
            <a class="add-product cursor"
               data-name="{{  $row->product_name}}"
               data-code="{{  $barcode }}"
               data-price = "{{  $cost }}"
               data-size="{{  $size?$size->size:''}}"
               data-color="{{$color->name??""}}"
               data-unit="{{  findUnit($row->unit_id)->unit??''}}"
               data-id="{{ $row->id }}">
                <div class="bg-img" style="
                    background: url({{findImgByCode($product->barcode)}});
                    height: 180px;
                    width: 100%;
                    background-position: center;
                    background-size: cover;
                    background-repeat: no-repeat;
                    ">
                </div>
                <ul class="item-show-name">
                    <li>{{$barcode}}</li>
                    <li>{{ str_limit($row->product_name,35) }}</li>
                    <li>({{($size?$size->size:'').','.($color?$color->name:'')}})</li>
                </ul>
            </a>
        </div>
    </div>
@endforeach
<div class="col-sm-12 col-xs-12">
    <div class="pagin">
        {!! $products->render() !!}
    </div>
</div>
