

<?php $__env->startSection('title'); ?>
    Cash Advance Payments
<?php $__env->stopSection(); ?>

<?php $__env->startSection('style'); ?>

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

<?php $__env->startSection('content'); ?>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                <span class="fa fa-trello"></span> Cash Advance Payments
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-users"></i> Admin Panel</a></li>
                <li class="active">Cash Advance Payments</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content" style=" padding-bottom: 100%;">
            <div class="page-header">
                <a href="<?php echo e(route('advances.payment.new')); ?>" class="btn btn-primary"><i class="fa fa-plus-circle"></i> New C/A Payment</a>
                <div class="btn-group dropdown">
                    <button type="button" class="btn btn-info">C/A Balance</button>
                    <button type="button" class="btn btn-info dropdown-toggle" id="mydp" data-toggle="dropdown" aria-haspopup="true" >
                        <span class="caret"></span>
                        <span class="sr-only">Action option</span>
                    </button>
                    <ul class="dropdown-menu" role="menu" aria-labelledby="mydp">
                        <li><a href="<?php echo e(route('reports.agents.ca-balances')); ?>" target="_blank">Agents Balance</a></li>
                        <li><a href="<?php echo e(route('reports.managers.ca-balances')); ?>" target="_blank">Managers Balance</a></li>
                    </ul>
                </div>
            </div>

            <table class="table table-hover" id="user_table" width="100%">
                <thead>
                <tr style="background: grey ;color:#fff; font-weight: bold">
                    <td>ID</td>
                    <td>Date</td>
                    <td>Agent/Manager Name</td>
                    <td>Amount</td>
                    <td>Remarks</td>
                    <td>Created By</td>                    
                    <td>Actions</td>
                </tr>
                </thead>
                <?php $__currentLoopData = $cas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ca): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr >
                        <td><?php echo e($ca->id); ?></td>
                        <td width="12%"><?php echo e(date("d-M-Y", strtotime($ca->payment_date))); ?></td>
                        <td width="22%"><a href="<?php echo e(route('advances.payment.edit',[$ca->id])); ?>"><?php echo e($ca->fullname); ?></a></td>
                        <td style="text-align: right"><?php echo e(number_format($ca->amount,2)); ?></td>
                        <td width="25%"><?php echo e($ca->remarks); ?></td>
                        <td style="text-align: center"><?php echo e($ca->user_name); ?></td>
                        <td class="btn btn-default ">
                            <a href="<?php echo e(route('advances.payment.edit',[$ca->id])); ?>" class="btn btn-primary btn-xs"><i class="fa fa-edit"></i></a>
                            <a href="#" data-toggle="modal" data-target="#d<?php echo e($ca->id); ?>" class="text-danger btn btn-danger btn-xs"><i class="fa fa-trash"></i></a>
                            <!-- Delete Modal -->
                            <div class="modal fade" id="d<?php echo e($ca->id); ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                                <div class="modal-dialog" role="document">
                                    <form method="post" action="<?php echo e(route('advances.payment.delete')); ?>">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                            <h4 class="modal-title" id="myModalLabel"><i class="fa fa-warning"></i> confirm deletion</h4>
                                        </div>
                                        <div class="modal-body text-danger">
                                            <input type="hidden" name="id" value="<?php echo e($ca->id); ?>">
                                            Are you sure want to delete record <?php echo e($ca->id); ?>?
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                            <button type="submit" class="btn btn-primary">Confirm</button>
                                        </div>
                                    </div>
                                        <?php echo e(csrf_field()); ?>

                                    </form>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </table>
            <?php if(Session('info')): ?>
                <div class="row">
                    <div class="col-md-6 col-md-offset-3 text-center">
                        <div class="tem alert alert-success navbar-fixed-bottom"><span class="glyphicon glyphicon-ok-circle"></span> <?php echo e(Session('info')); ?></div>
                    </div>
                </div>
            <?php endif; ?>
        </section>

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

<?php $__env->startSection('script'); ?>
<script>
        $(document).ready(function() {
            $('#user_table').DataTable( {
                "bDestroy": true,
                /*searching: true,
                paging: true,
                lengthChange: true,
                pageLength: 10,
                info: true,
                orderable: true,*/
                "order": [[ 0, "desc" ]]
            } );
        } );

        /*$("#btnAdd").on("click", function(){
            $('#addModal').modal('toggle');
        });*/
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>