<?php $__env->startSection('addCss'); ?>
    <style media="screen">
        #example2_filter input[type=search] {
            width: 200px;
        }
        table td { vertical-align: middle !important; }
        td > .label { padding: 5px !important; font-weight: normal !important; }
    </style>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
    <section class="content-header">
        <h1>
            <?php echo Trans("installments.menu"); ?>

            <small><?php echo trans("dashboard.others.show_all"); ?></small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="/"><i class="fa fa-dashboard"></i> Home</a></li>
            <li><a href="<?php echo Route('installments.index'); ?>"><i class="fa fa-calendar-o"></i> <?php echo Trans('installments.menu'); ?></a></li>
            <li class="active"><?php echo Trans("dashboard.others.show_all"); ?></li>
        </ol>
    </section>
    <!-- Main content -->

    <section class="content">
        <?php echo $__env->make('layouts.includes.message', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
        <div class="row">
            <div class="col-md-12">
                <div class="box box-info">
                    <div class="box-header with-border">
                        <?php echo $__env->make("installments.inc.search_form", array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                    </div>
                    <div class="box-body">
                    <div class="table-responsive">
                        <table class="table table-bordered table-striped">
                            <thead>
                                <tr>
                                    <th><?php echo trans('installments.code'); ?></th>
                                    <th><?php echo trans('installments.customer_id'); ?></th>
                                    <th><?php echo trans('installments.date'); ?></th>
                                    <th><?php echo trans('installments.duration'); ?></th>
                                    <th><?php echo trans('installments.total_price'); ?></th>
                                    <th><?php echo trans('dashboard.others.status'); ?></th>
                                    <th><?php echo trans('dashboard.crud.actions'); ?></th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php if(count($installments) > 0): ?>
                                <?php foreach($installments as $installment): ?>
                                <tr>
                                    <td><?php echo convertInvoiceNumber($installment->id); ?> <?php if($installment->loan_type == "emi"): ?> <span class="label label-primary">(EMI)</span> <?php endif; ?></td>
                                    <td><a href="<?php echo route('loan_customers.show', $installment->customer_id); ?>"><?php echo $installment->full_name_kh; ?> - <?php echo $installment->tel; ?></a></td>
                                    <td><?php echo get_day_week($installment->in_date); ?> <?php echo d_format($installment->in_date); ?></td>
                                    <td><?php echo $installment->duration; ?></td>
                                    <td><?php echo money($installment->total_price); ?></td>
                                    <td>
                                    <?php
                                        $status = "label-warning";
                                        if ($installment->status == "proccessing") {
                                            $status = "label-info";
                                        } elseif ($installment->status == "completed") {
                                            $status = 'label-success';
                                        }
                                    ?>
                                    <span class="label <?php echo $status; ?>">
                                        <?php echo trans('installments.status.'.$installment->status); ?></td>
                                    </span>
                                    <td>
                                        <a href="<?php echo route('installments.show', $installment->id); ?>" class="btn btn-sm btn-default"><i class="fa fa-th-list"></i> <?php echo trans('dashboard.others.show'); ?></a>
                                    </td>
                                </tr>
                            <?php endforeach; ?>
                        <?php else: ?>
                            <tr>
                                <td colspan="7" class="text-center">No record.........</td>
                            </tr>
                        <?php endif; ?>
                        </tbody>
                    </table>
                </div>
                        <?php if(empty(Input::get("paginate")) || Input::get("paginate") != "all"): ?>
                            <div class="row">
                                <div class="col-md-4">
                                    <p style="margin-top: 10px;">Total Records : <?php echo $installments->getTotal(); ?> Page <?php echo $installments->getCurrentPage(); ?> of <?php echo $installments->getLastPage(); ?></p>
                                </div>
                                <div class="col-md-8 text-right">
                                    <?php echo $installments->appends(Request::except('page'))->links(); ?>

                                </div>
                            </div>
                        <?php else: ?>
                            <?php if($installments->count() > 0): ?>
                                Total Records : <?php echo $installments->count(); ?>

                            <?php endif; ?>
                        <?php endif; ?>
            </div>
        </div>
    </div>
  </div>
</section>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('addJs'); ?>
  <?php echo HTML::script('plugins/datepicker/bootstrap-datepicker.js'); ?>

  <?php echo HTML::script('plugins/datepicker/locales/bootstrap-datepicker.kh.js'); ?>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.production', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>