<?php $__env->startSection('title','Borrows'); ?>
<?php echo $__env->make('layouts.datatable', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php $__env->startSection('content'); ?>
<div class="row">
    <div class="col-lg-12">
        <div class="tile">
            <div class="tile-title-w-btn">
                <h3 class="title"><i class="bi bi-list-ul"></i> <?php echo e(__('lang.borrows')); ?></h3>
                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('borrows.create')): ?>
                <a href="<?php echo e(route('borrows.create')); ?>" class="btn btn-primary" title="<?php echo e(__('lang.new_borrow')); ?>">
                    <i class='bi bi-plus'></i>
                </a>
                <?php endif; ?>
            </div>
            <div class="tile-body">
                <div class="row my-3">
                    <div class="col-md-3">
                        <label for="is_returned"><?php echo e(__('messages.is_returned')); ?></label>
                        <select id="is_returned" class="form-control form-control-sm">
                            <option value=""><?php echo e(__('lang.select_option')); ?></option>
                            <option value="1"><?php echo e(__('lang.returned')); ?></option>
                            <option value="0"><?php echo e(__('lang.not_returned')); ?></option>
                        </select>
                    </div>
                    <div class="col-md-3">
                        <label for="from_date"><?php echo e(__('lang.returned_date_from')); ?></label>
                        <input type="date" class="form-control form-control-sm" id="from_date">
                    </div>
                    <div class="col-md-3">
                        <label for="to_date"><?php echo e(__('lang.returned_date_to')); ?></label>
                        <input type="date" class="form-control form-control-sm" id="to_date">
                    </div>
                    <div class="col-md-3">
                        <br>
                        <button class="btn btn-primary btn-sm" id="btn-filter"><?php echo e(__('lang.search')); ?></button>
                    </div>
                </div>
                <div class="table-responsive">
                    <table class="table table-hover table-bordered" id="my-table">
                        <thead class="table-primary">
                            <tr>
                                <th>#</th>
                                <th><?php echo e(__('lang.book')); ?></th>
                                <th><?php echo e(__('lang.member')); ?></th>
                                <th><?php echo e(__('lang.borrow_date')); ?></th>
                                <th><?php echo e(__('lang.return_date')); ?></th>
                                <th><?php echo e(__('lang.status')); ?></th>
                                <th><?php echo e(__('lang.action')); ?></th>
                            </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>

<script type="text/javascript">
    const table = new DataTable('#my-table', {
        processing: true,
        serverSide: true,
        "ordering": false,
        ajax: {
            url: '<?php echo e(route('borrows.dataTable')); ?>',
            data: function (d) {
                d.is_returned = $('#is_returned').val();
                d.from_date = $('#from_date').val();
                d.to_date = $('#to_date').val();
            }
        },
        columns: [
            { data: 'id', name: 'id' },
            { data: 'book', name: 'book' },
            { data: 'member', name: 'member' },
            { data: 'borrow_date', name: 'borrow_date' },
            { data: 'return_date', name: 'return_date' },
            { data: 'status', name: 'status' },
            { data: 'action', name: 'action', searchable: false }
        ],
    });

    $('#btn-filter').on('click', function () {
        table.ajax.reload();
    });

</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\Laravel\mohe_library\resources\views/borrow/index.blade.php ENDPATH**/ ?>