<?php $__env->startSection('title'); ?>
    <title>Application Users</title>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('banner'); ?>
    <?php echo $__env->make('backend.partials.banner', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('menu'); ?>
    <div class="col-md-10 col-md-offset-1" style="background-color: #7ebb7b">
        <div class="breadcrumbs">
            <div class="container">
                <div class="row">
                    <div class="col-sm-8">
                        <ul>
                            <li><a href="<?php echo url('admin/home'); ?>">Home</a></li>
                            <li class="active">Print Requisitions</li>
                        </ul><!-- end breadcrumb -->
                    </div><!-- end col -->
                </div><!-- end row -->
            </div><!-- end container -->
        </div><!-- end breadcrumbs -->
    </div>
<?php $__env->stopSection(); ?>

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

    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-3-typeahead/4.0.1/bootstrap3-typeahead.min.js"></script>

    <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">

    <div>

        <div class="container spark-screen">
            <div class="row">
                <div class="col-md-4 col-md-offset-4 col-sm-4 text-center">
                    <br/>
                    <div><h3>PRINT PRODUCT REQUISITIONS</h3></div>
                    <div style="background-color: #ff0000;height: 2px">&nbsp;</div>
                    <br/>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-10 col-md-offset-1" style="overflow-x:auto;">
            <table class="table table-striped table-bordered" id="requsistion-table">
                <thead style="background-color: #b0b0b0">
                <tr>
                    <th>Req No</th>
                    <th>Req Date</th>
                    <th>Req Type</th>
                    <th>product</th>
                    <th>Quantity</th>
                    <th>Action</th>
                </tr>
                </thead>
            </table>
        </div>
    </div>


    <!-- editCategoryModal -->

    <div class="modal fade" id="edit-modal" role="dialog" data-backdrop="false" style="background-color: rgba(0, 0, 0, 0.5);">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">Edit Requisitions Data</h4>
                </div>

                <form class="form-horizontal" role="form" action="<?php echo e(url('requisition.edit.post')); ?>" method="POST" >
                    <?php echo e(csrf_field()); ?>

                    <div class="modal-body">

                        <table id="edittable" class="table table-striped edittable">
                            <thead style="background-color: #8eb4cb">
                            <tr>
                                <th>Req No</th>
                                <th>product</th>
                                <th>Quantity</th>
                            </tr>
                            </thead>
                            <tbody>

                            </tbody>
                        </table>
                    </div>
                    <div class="modal-footer">
                        <div class="col-md-10 col-md-offset-1">
                            <button type="submit" class="btn btn-primary pull-right">Submit</button>
                            <button type="button" class="btn btn-danger pull-left" data-dismiss="modal">Cancel</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>


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

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

<script>
    $(function() {
        var table= $('#requsistion-table').DataTable({
            processing: true,
            serverSide: true,
            autoWidth: false,
            responsive: true,
            ajax: 'report.requisition.data',
            columns: [
                { data: 'refno', name: 'requisitions.refno' },
                { data: 'reqdate', name: 'requisitions.reqdate' },
                { data: 'reqtype', name: 'requisitions.reqtype', orderable: false, searchable: false },
                { data: 'product', name: 'product' },
                { data: 'quantity', name: 'quantity' },
                { data: 'action', name: 'action', orderable: false, searchable: false, printable: false}
            ]
        });

    });

    $('#requsistion-table').on('click', '.btn-print[data-remote]', function (e) {
        e.preventDefault();

//        $.ajaxSetup({
//            headers: {
//                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
//            }
//        });
        var url = $(this).data('remote');

        window.location.href = url;
//        // confirm then
//        $.ajax({
//            url: url,
//            type: 'POST',
//            dataType: 'json',
//            data: {method: '_POST', submit: true},
//
//            error: function (request, status, error) {
//                alert(request.responseText);
//            }
//
//        }).always(function (data) {
//            $('#requsistion-table').DataTable().draw(false);
//        });
    });

</script>

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

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