<?php
use App\Model\product\ProductImageModel;
?>
@foreach($products as $key => $row)
    <?php

    $barcode = $row->barcode;
    if(user_currency()->id==1){
        $cost = $row->cost_riel;
    }else{
        $cost = $row->cost_usd;
    }
    $img = ProductImageModel::where('product_id',$row->id ??'')->first()->images??'';
    ?>
    <div class="col-lg-3 col-md-6 po-box" title="{{$row->product_name}} ({{  findUnit($row->unit_id)->unit}})">
        <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-currency="{{  $row->currency}}"
               data-symbol="{{  user_currency()->symbol}}"
               data-unit="{{  findUnit($row->unit_id)->unit}}"
               data-id="{{ $row->id }}">
                <div class="bg-img" style="
                    background: url({{findImg($img)}});
                    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>
                </ul>
            </a>
        </div>
    </div>
@endforeach
<div class="col-sm-12 col-xs-12">
    <div class="pagin">
        {!! $products->render() !!}
    </div>
</div>

