<?php $__env->startSection('section-title', 'Expense'); ?>
<?php $__env->startSection('page-title', 'Expense List'); ?>
<?php if(check_permission('expense.create')): ?>
    <?php $__env->startSection('action-button'); ?>
        <a href="<?php echo e(route('expense.create')); ?>" class="btn add_list_btn">
            <i class="mr-2 feather icon-plus"></i>
            Add Expense
        </a>
    <?php $__env->stopSection(); ?>
<?php endif; ?>
<?php $__env->startPush('css'); ?>
    <style>
        @media print {

            table,
            table th,
            table td {
                color: black !important;
            }

            .h-hide {
                display: none;
            }
        }
    </style>
<?php $__env->stopPush(); ?>
<?php $__env->startSection('content'); ?>
    <div class="row">
        <div class="col-lg-12">
            <div class="card m-b-30 card_style">
                <div class="card-body">
                    <form action="<?php echo e(route('expense.index')); ?>" method="GET">
                        <?php
                            $categorys = App\Models\ExpenseCategory::get();
                            $total_expense = 0 ;
                        ?>
                        <div class="row h-hide">
                            <div class="col-md-3 mt-2">
                                <input type="date" class="form-control" name="startDate" value="<?php echo e($startDate); ?>" />
                            </div>
                            <div class="col-md-3 mt-2">
                                <input type="date" class="form-control" name="endDate" value="<?php echo e($endDate); ?>" />
                            </div>
                            <div class="col-md-3 col-12 mt-2">
                                <select name="category_id" id="" class="select2">
                                    <option value="">Select Category</option>
                                    <?php $__currentLoopData = $categorys; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option
                                            value="<?php echo e($item->id); ?>"<?php echo e($category_id == $item->id ? 'selected' : ''); ?>>
                                            <?php echo e($item->name); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>
                            <div class="col-md-3 mt-2">
                                <div class="col-md-12 col-12">
                                    <button type="submit" class="btn add_list_btn" style="margin-left: -10px">Filter</button>
                                    <a href="<?php echo e(route('expense.index')); ?>" class="btn add_list_btn_reset">Reset</a>
                                    <a href="" class="btn add_list_btn float-right" onclick="window.print()">Print</a>
                                </div>
                            </div>
                        </div>
                    </form>
                    <div class="table-responsive mt-3">
                        <table id="datatable-buttons" class="table table-striped text-center">
                            <thead class="header_bg">
                                <tr>
                                    <th class="header_style_left">#SL</th>
                                    <th>Name</th>
                                    <th>Date</th>
                                    <th>Category</th>
                                    <th>Amount</th>
                                    <th>Note</th>
                                    <th class="h-hide header_style_right">Action</th>
                                </tr>
                            </thead>
                            <tbody>
                                
                                <?php $__empty_1 = true; $__currentLoopData = $expenses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <tr>
                                        <td class="table_data_style_left"><?php echo e($loop->index + 1); ?></td>
                                        <td><?php echo e($data->name); ?></td>
                                        <td><?php echo e($data->date); ?></td>
                                        <td><?php echo e($data->expense_category->name); ?></td>
                                        <td><?php echo e($data->amount); ?> - <?php echo e($data->bank_account->bank_name); ?></td>
                                        <td><?php echo e($data->note == null ? '--' : $data->note); ?></td>
                                        <td class="h-hide table_data_style_right">
                                            <div class="dropdown">
                                                <button class="btn add_list_btn btn-sm dropdown-toggle" type="button"
                                                    id="dropdownMenuButton" data-toggle="dropdown">
                                                    Action
                                                </button>
                                                <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">

                                                    
                                                    <?php if(check_permission('expense.update')): ?>
                                                        <a href="<?php echo e(route('expense.edit', $data->id)); ?>"
                                                            class="dropdown-item text-primary">
                                                            <i class="feather icon-edit"></i> Edit
                                                        </a>
                                                    <?php endif; ?>

                                                    
                                                    <?php if(check_permission('expense.destroy')): ?>
                                                        <a href="#" data-toggle="modal"
                                                            data-target="#deleteModal-<?php echo e($data->id); ?>"
                                                            class="dropdown-item text-danger">
                                                            <i class="feather icon-trash"></i> Delete
                                                        </a>
                                                    <?php endif; ?>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                    <?php
                                    
                                ?>
                                    
                                    <form action="<?php echo e(route('expense.destroy', $data->id)); ?>" method="POST">
                                        <?php echo csrf_field(); ?>
                                        <?php echo method_field('DELETE'); ?>
                                        <?php if (isset($component)) { $__componentOriginal37b7f052626c638ba0443fdb400d6f57 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal37b7f052626c638ba0443fdb400d6f57 = $attributes; } ?>
<?php $component = App\View\Components\DeleteModal::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('delete-modal'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\DeleteModal::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['title' => 'Expense','id' => ''.e($data->id).'']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal37b7f052626c638ba0443fdb400d6f57)): ?>
<?php $attributes = $__attributesOriginal37b7f052626c638ba0443fdb400d6f57; ?>
<?php unset($__attributesOriginal37b7f052626c638ba0443fdb400d6f57); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal37b7f052626c638ba0443fdb400d6f57)): ?>
<?php $component = $__componentOriginal37b7f052626c638ba0443fdb400d6f57; ?>
<?php unset($__componentOriginal37b7f052626c638ba0443fdb400d6f57); ?>
<?php endif; ?>
                                    </form>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td colspan="100%" class="text-center no_data_style text-danger">No Data Available</td>
                                    </tr>
                                <?php endif; ?>
                            </tbody>
                            
                            <tfoot>
                                <tr class="text-right header_bg">
                                    <td colspan="4" class="header_style_left"><strong style="font-size: 18px;color:rgb(255, 255, 255);">Total: </strong></td>
                                    <td> <strong style="font-size: 18px;color:rgb(255, 255, 255);"><?php echo e(number_format($total_amt, 2)); ?>TK</strong></td>
                                    <td colspan="2" class="header_style_right"></td>
                                </tr>
                            </tfoot>
                        </table>
                        <span class="h-hide"><?php echo e($expenses->onEachSide(1)->links()); ?></span>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('backend.layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/fastitco/nvs.fastit.com.bd/resources/views/backend/pages/expense/index.blade.php ENDPATH**/ ?>