<?php Fun::lang()?>
<?php
$master = \App\Model\payment\PaymentModel::where(['invoice_id' => $packing->id, 'type' => 'packing'])->first();


?>
{!! Form::open(array('route' => ['production-packing-add-payment',$packing->id],'method'=>'POST','class'=>'jform','enctype'=>'multipart/form-data')) !!}
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    <h3 style="margin-bottom: 5px">{{__('administrator.payment')}}</h3>
</div>
<div class="text-left" style="line-height: 25px">
    <b>{{__('administrator.date')}}
        :</b> {{ date('d-m-Y',strtotime($packing->date))}}
    <br>
    <b>{{__('administrator.reference_number')}}
        :</b> {{$packing->invoice_number}}
    <br>
    <?php
    $packer = \App\Model\setup\PackerModel::find($packing->packer_id);
    ?>
    <b>{{__('administrator.packer')}}
        :</b>
    {{ $packer->name??'' }}
    <br>
    <b>{{__('administrator.phone')}}
        :</b> {{ $packer->contact??'' }}
</div>
<br>
<table class="table table-striped">
    <thead>
    <tr>
        <th width="6%">#</th>
        <th>{{__('administrator.date')}}</th>
        <th>{{__('administrator.amount')}}</th>
        <th>{{__('administrator.note')}}</th>
    </tr>
    </thead>
    <tbody>
    <?php  $subtotal = 0; ?>
    @forelse ($master->detail as  $key => $row)
        <?php
        $currency = findCurrency($row->currency_id);
        $currency = $currency ? $currency->symbol : '';
        ?>
        <tr role="row">
            <td>{{ $key+1 }}</td>
            <td>{{ date('d-m-Y',strtotime($row->payment_date)) }}</td>
            <td>{{ number_format($row->paid_amount,2)." $currency" }}</td>
            <td>{{  $row->note }}</td>
        </tr>

    @empty
        <tr>
            <td colspan="4" class="text-center">មិនមានទិន្នន័យ</td>
        </tr>
    @endforelse
    </tbody>

</table>
{!! Form::close() !!}

