<?php $__env->startSection('title',trans('front.Installments')); ?>
<?php $__env->startSection('content'); ?>
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <?php echo app('translator')->getFromJson('front.Installments'); ?>
         </h1>
    </section>

    <!-- Main content -->
    <section class="content">

        <div style="margin-bottom: 5px;" class="row hideprint">
            <form action="">
                <div class="col-md-12">
                    <div class="col-md-3">
                        <select name="filter1" id="category_id" class="form-control select2" style="width: 100% !important;height: 35px !important;">
                            <option value=""><?php echo app('translator')->getFromJson('front.all'); ?></option>
                            <option <?php echo e(request('filter1')=='delayed'?'selected':''); ?>  value="delayed"><?php echo app('translator')->getFromJson('front.Late installments'); ?></option>
                            <option <?php echo e(request('filter1')=="paid"?'selected':''); ?>  value="paid"><?php echo app('translator')->getFromJson('front.Installments paid'); ?></option>
                            <option <?php echo e(request('filter1')=="notpaid"?'selected':''); ?>  value="notpaid"><?php echo app('translator')->getFromJson('front.Unpaid installments'); ?></option>
                        </select>
                    </div>
                    <div class="col-md-3">
                        <div class="form-group ">
                            <input placeholder="<?php echo app('translator')->getFromJson('front.from'); ?>" autocomplete="off" style="direction: rtl;" name="fromdate" value="<?php echo e(request()->fromdate); ?>" type="text" class="form-control datepicker">
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="form-group">
                            <input placeholder="<?php echo app('translator')->getFromJson('front.dateto'); ?>" autocomplete="off" style="direction: rtl;" name="todate" value="<?php echo e(request()->todate); ?>" type="text" class="form-control datepicker">
                        </div>
                    </div>
                    <div class="col-md-3">
                        <button type="submit" style="width: 200px; " type="button" class="btn btn-info btn-flat"><?php echo app('translator')->getFromJson('front.search'); ?></button>
                    </div>
                </div>
            </form>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-body">
                        <table id="dataList" class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th>#</th>
                                <th><?php echo app('translator')->getFromJson('front.name'); ?></th>
                                <th><?php echo app('translator')->getFromJson('front.date'); ?></th>
                                <th><?php echo app('translator')->getFromJson('front.value'); ?></th>
                                <th><?php echo app('translator')->getFromJson('front.paid'); ?></th>
                                <th class="no-sort"></th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php $__currentLoopData = $calanders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cal): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td><?php echo e($loop->iteration); ?></td>
                                    <td><?php echo e($cal->order->client->name); ?></td>
                                    <td><?php echo e($cal->date); ?></td>
                                    <td><?php echo e($cal->value); ?></td>
                                    <td><?php echo $cal->is_paid?'<span class="btn btn-success"><i class="fa fa-check"></i></span>':'<span class="btn btn-danger"><i class="fa fa-times"></i></span>'; ?></td>
                                    <td class="actions">
                                        <?php if(!$cal->is_paid): ?>
                                        <a data-toggle="modal" data-target="#myModal" href="<?php echo e(route('persons.addPayment',['person'=>$cal->order->client,'calanderId'=>$cal->id])); ?>" class="btn btn-success btn-xs">
                                            <i class="fa fa-money fa-fw" aria-hidden="true"></i>
                                            تحصيل
                                        </a>
                                        <?php endif; ?>
                                        <a class="btn btn-xs btn-danger remove-record" data-url="<?php echo e(route('deleteInstalment',$cal)); ?>" data-id="<?php echo e($cal->id); ?>">
                                            <i class="fa fa-trash"></i>
                                            <?php echo app('translator')->getFromJson('front.delete'); ?>
                                        </a>

                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                        </table>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>
    <!-- /.content -->
    <div id="myModal" class="modal fade" style="overflow:hidden;" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title"></h4>
                </div>
                <div class="modal-body">
                    <p class="text-center"><div class="fa-3x text-center"><i class="fa fa-cog fa-spin"></i>                    جارى التحميل ....                </div>                </p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-outline pull-left" data-dismiss="modal">إغلاق</button>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>
    <script>
        $('.datepicker').datepicker({
            autoclose: true,
            rtl: true,
            format: 'yyyy-mm-dd',
            language: "<?php echo e(\Session::get('locale')); ?>",
        });
    </script>
<?php $__env->stopPush(); ?>

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