<!-- TABLE: LATEST ORDERS -->
  <div class="box box-solid box-primary">
    <div class="box-header with-border">
      <h3 class="box-title"><i class="fa fa-calendar-o"></i> <?php echo Trans('installments.lates_installment'); ?></h3>
    </div>
    <!-- /.box-header -->
    <div class="box-body">
      <div class="table-responsive">
        <table class="table table-striped table-bordered">
              <thead>
                  <tr>
                      <th><?php echo trans('installments.id'); ?></th>
                      <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.price'); ?></th>
                  </tr>
              </thead>
              <tbody>
                  <?php if(count($installments) > 0): ?>
                      <?php
                        $i = 1;
                      ?>
                      <?php foreach($installments as $installment): ?>
                          <tr>
                              <td><?php echo $i; ?></td>
                              <td><a href="<?php echo $installment->loan_type == 'emi' ? route('emiloans.show', $installment->id) :route('installments.show', $installment->id); ?>"><?php echo convertInvoiceNumber($installment->id); ?> <?php if($installment->loan_type == "emi"): ?> <span class="label label-primary">(EMI)</span> <?php endif; ?></a></td>
                              <td><?php echo $installment->full_name_kh; ?> <a href="tel:<?php echo $installment->tel; ?>"><i class="fa fa-phone"></i> <?php echo $installment->tel; ?></a></td>
                              <td><?php echo get_day_week($installment->in_date); ?> <?php echo format_date_installment($installment->in_date); ?></td>
                              <td><?php echo $installment->duration; ?></td>
                              <td><?php echo money($installment->total_price); ?></td>
                          </tr>
                      <?php $i++; ?>
                      <?php endforeach; ?>
                  <?php else: ?>
                      <tr>
                          <td colspan="6">No record....</td>
                      </tr>
                  <?php endif; ?>
              </tbody>
          </table>
      </div>
      <!-- /.table-responsive -->
    </div>
    <!-- /.box-body -->
    <div class="box-footer clearfix">
      <a href="<?php echo route('installments.index'); ?>" class="btn btn-sm btn-default btn-flat pull-right"><i class="fa fa-th-list"></i> <?php echo Trans('dashboard.others.show_all'); ?></a>
    </div>
    <!-- /.box-footer -->
  </div>
<!-- /.box -->
