<?php Fun::lang() ?>
<div class="print_this_form">
    <h3>{{__('administrator.purchase_history')}}</h3>
    <table id="print_table" width="100%" class="table table-striped table-hover " style="margin-top: 30px">
        <thead>
        <tr>
            <th>#</th>
            <th>{{__('administrator.purchase_date')}}</th>
            <th>{{__('administrator.invoice')}}</th>
            <th>{{__('administrator.supplier_name')}}</th>
            <th>{{__('administrator.supplier_phone')}}</th>
            <th>{{__('administrator.products')}}</th>
            <th>{{__('administrator.barcode')}}</th>
            <th>{{__('administrator.qty')}}</th>
        </tr>
        </thead>
        <tbody class="tbody">
        @foreach($data as $key=>$row)
            <?php
            $supplier = findSupplier($row->supplier_id);
            $product = getProductById($row->product_id);
            ?>
            <tr>
                <td>{{$key+1}}</td>
                <td>{{date('d-m-Y',strtotime($row->purchase_date))}}</td>
                <td><a class="under-line cursor text-primary btn_purchase_invoice_public" data-href="{{route("purchases.show", $row->purchase_id)}}">{{$row->invoice_number}}</a></td>
                <td><a class="under-line cursor text-primary btn_supplier_info_public" data-href="{{route("suppliers.show", $row->supplier_id)}}">{{$supplier->supplier_name}}</a></td>
                <td>{{$supplier->supplier_phone}}</td>
                <td>{{$product->product_name}}</td>
                <td>{{$row->barcode}}</td>
                <td>{{$row->qty}}</td>
            </tr>
        @endforeach
        </tbody>
    </table>
    <div class="col-sm-12 col-xs-12">
        <div class="pagin">
            {!! Form::hidden('barcode_hide', @$row?$row->barcode:'') !!}
            {!! Form::hidden('warehouse_hide', @$row?$row->warehouse_id:'') !!}
            @if(@$data)
                {!! $data->render() !!}
            @endif
        </div>
    </div>
</div>
