<script type="text/javascript">
    $(function() {
        $('.date').pikaday({ firstDay: 1, format:'YYYY-MM-DD', autoclose:true });
        $(".date").pikaday({ firstDay: 1, format:'YYYY-MM-DD', autoclose:true });
        $('.datatable').DataTable({
            "columnDefs": [ {
                "searchable": false,
                "orderable": false,
                "targets": 0
            } ],
            "order": [[ 1, 'asc' ]],
            "bLengthChange": false,
            "bInfo" : false,
            "filter" : true,
            "oLanguage": { "sSearch": ""}
        });
        $('div.dataTables_filter input').addClass('form-control input-sm');
    });
</script>
<div class="col-md-3">
    <div class="form-group">
        <?php echo Form::label('client_id', trans('application.client')); ?>

        <?php echo Form::select('client',$clients,$client, ['class' => 'form-control input-sm chosen', 'id' => 'client_id', 'required']); ?>

    </div>
</div>
<div class="col-md-3">
    <label><?php echo e(trans('application.from')); ?> : </label>
    <div class="form-group input-group">
        <input class="form-control input-sm date" size="16" type="text" name="from_date" readonly id="from_date"/>
        <span class="input-group-addon input-sm add-on"><i class="fa fa-calendar" style="display: inline"></i></span>
    </div>
</div>
<div class="col-md-3">
    <label><?php echo e(trans('application.to')); ?> : </label>
    <div class="form-group input-group" style="margin-left:0;">
        <input class="form-control input-sm date" size="16" type="text" name="to_date" readonly id="to_date"/>
        <span class="input-group-addon input-sm add-on"><i class="fa fa-calendar" style="display: inline"></i></span>
    </div>
</div>
<div class="col-md-3">
    <label> </label>
    <div class="form-group">
        <a href="javascript: void(0);" onclick="javascript: payments_summary();" class="btn btn-large btn-sm btn-success"  style="margin:6px"><i class="fa fa-check"></i> <?php echo e(trans('application.generate_report')); ?></a>
    </div>
</div>
<div class="col-md-12">
    <table class="table table-bordered">
        <thead>
        <tr class="table_header">
            <th><?php echo e(trans('application.date')); ?> </th>
            <th><?php echo e(trans('application.invoice_number')); ?></th>
            <th><?php echo e(trans('application.payment_method')); ?></th>
            <th><?php echo e(trans('application.client')); ?></th>
            <th class="text-right"><?php echo e(trans('application.amount')); ?></th>
        </tr>
        </thead>
        <tbody>
        <?php ($total = 0); ?>
        <?php $__currentLoopData = $payments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $payment): $__env->incrementLoopIndices(); $loop = $__env->getFirstLoop(); ?>
            <?php ($payment_amount_converted = currency_convert(getCurrencyId($payment->currency),$payment->amount)); ?>
            <?php ($total += $payment_amount_converted); ?>
            <tr>
                <td><?php echo e(format_date($payment->payment_date)); ?></td>
                <td><a href="<?php echo e(route('invoices.show', $payment->invoice_id)); ?>"><?php echo e($payment->number); ?></a></td>
                <td><?php echo e($payment->method_name); ?></td>
                <td><a href="<?php echo e(route('clients.show', $payment->client_id)); ?>"><?php echo e($payment->client_name); ?></a></td>
                <td class="text-right text-bold"><?php echo e(defaultCurrency().' '.format_amount($payment_amount_converted)); ?></td>
            </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getFirstLoop(); ?>
        <tr>
            <td class="text-bold"><?php echo e(trans('application.total')); ?></td>
            <td class="text-right text-bold text-green" colspan="4"><?php echo e(defaultCurrency().' '.format_amount($total)); ?></td>
        </tr>
        </tbody>
    </table>
</div>