<?php $__env->startSection('content'); ?>
    <div class="col-md-12 content-header" >
        <h1><i class="fa fa-credit-card"></i> <?php echo e(trans('application.expenses')); ?></h1>
    </div>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box  box-primary">
                <?php if(hasPermission('add_expense')): ?>
                    <div class="box-header with-border">
                        <h3 class="box-title pull-right">
                            <div class="box-tools ">
                                <a href="<?php echo e(route('expenses.create')); ?>" class="btn btn-primary btn-xs pull-right" data-toggle="ajax-modal"> <i class="fa fa-plus"></i> <?php echo e(trans('application.new_expense')); ?></a>
                                <a href="<?php echo e(route('expense_category.index')); ?>" class="btn btn-info btn-xs pull-right" style="margin-right: 10px;"><i class="fa fa-bars"></i> <?php echo e(trans('application.categories')); ?></a>
                            </div>
                        </h3>
                    </div>
                <?php endif; ?>
                <div class="box-body">
                    <div class="table-responsive">
                    <table class="table table-bordered table-striped table-hover ajax_datatable">
                        <thead>
                        <tr>
                            <th><?php echo e(trans('application.name')); ?></th>
                            <th><?php echo e(trans('application.date')); ?></th>
                            <th><?php echo e(trans('application.category')); ?></th>
                            <th><?php echo e(trans('application.amount')); ?></th>
                            <th><?php echo e(trans('application.action')); ?></th>
                        </tr>
                        </thead>
                        <tbody></tbody>
                    </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('scripts'); ?>
    <script type="text/javascript">
        $(document).ready(function() {
            $('.ajax_datatable').DataTable({
                processing: true,
                serverSide: true,
                stateSave: true,
                ajax: '<?php echo e(route('expenses.index')); ?>',
                order: [],
                columnDefs: [{
                    "orderable": false,
                    "targets": 0
                }],
                oLanguage: {
                    "sProcessing":"<?php echo e(trans('application.processing')); ?>"
                },
                columns:[
                    {data: 'name',orderable:false},
                    {data: 'expense_date', orderable:false},
                    {data: 'category',name:"expense_categories.name",orderable:false},
                    {data: 'amount', 'searchable':false,className: "text-right",orderable:false},
                    {data: 'action', 'searchable':false,orderable:false,className: "text-right"}
                ]
            });
            $('div.dataTables_filter input').addClass('form-control input-sm');
            $('div.dataTables_length select').addClass('form-control input-sm');
        });
    </script>
<?php $__env->stopSection(); ?>


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