<script type="text/javascript">
    $(document).ready(function () {

    });
</script>

<?php $__env->startSection("body"); ?>
    <div class="main-cont">
        <div class="new-pur">
            <h6>الاذونات الواردة الغير مستلمة</h6>
            <hr>
            <table id="example1" class="table table-striped table-bordered" style="width:100%">
                <thead>
                <tr>
                    <th>رقم الاذن</th>
                    <th>تاريخ الاذن</th>
                    <th>من فرع</th>
                    <th>مطابقة</th>
                </tr>
                </thead>
                <tbody>
                <?php $__currentLoopData = $pending; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $doc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td><?php echo e($doc->stock_doc_id); ?></td>
                        <td><?php echo e($doc->stock_doc_date); ?></td>
                        <td><?php echo e($doc->branchfrom->branch_name); ?></td>
                        <td>
                            <!-- Button trigger modal -->
                            <button type="button" class="btn btn-primary" data-toggle="modal"
                                    data-target="#exampleModal<?php echo e($doc->stock_doc_id); ?>">
                                مطابقة
                            </button>

                            <!-- Modal -->
                            <div class="modal fade bd-example-modal-lg" id="exampleModal<?php echo e($doc->stock_doc_id); ?>"
                                 tabindex="-1" role="dialog"
                                 aria-labelledby="exampleModalLabel" aria-hidden="true">
                                <div class="modal-dialog modal-lg" role="document">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <h5 class="modal-title" id="exampleModalLabel">مطابقة الاذن</h5>
                                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                <span aria-hidden="true">&times;</span>
                                            </button>
                                        </div>
                                        <form action="<?php echo e(url('/accept'.'/'.$doc->id)); ?>" method="get">
                                            <?php echo csrf_field(); ?>
                                            <div class="modal-body">
                                                <table class="table">
                                                    <thead>
                                                    <tr>
                                                        <th>رقم المنتج</th>
                                                        <th>الكمية</th>
                                                        <th>مطابقة</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    <?php $__currentLoopData = $doc ->details; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <tr>
                                                            <td id="serial<?php echo e($item->stock_doc_details_id); ?>"><?php echo e($item->item_serial); ?></td>
                                                            <td><?php echo e($item->item_quantity); ?></td>
                                                            <td>
                                                                <input onchange="check(<?php echo e($item->stock_doc_details_id); ?>)" type="text" id="item<?php echo e($item->stock_doc_details_id); ?>" name="item[<?php echo e($item->stock_doc_details_id); ?>]">
                                                                <span id="append"></span>
                                                            </td>
                                                        </tr>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                    </tbody>
                                                </table>
                                            </div>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-secondary" data-dismiss="modal">
                                                    Close
                                                </button>
                                                <button type="submit" class="btn btn-primary">Accept</button>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                </tbody>
                <tfoot>
                <tr>
                    <th>رقم الاذن</th>
                    <th>تاريخ الاذن</th>
                    <th>من فرع</th>
                    <th>مطابقة</th>
                </tr>
                </tfoot>
            </table>
        </div>
    </div>

    <div class="main-cont">
        <div class="new-pur">
            <h6>الاذونات الواردة</h6>
            <hr>
            <table id="example" class="table table-striped table-bordered" style="width:100%">
                <thead>
                <tr>
                    <th>رقم الاذن</th>
                    <th>تاريخ الاذن</th>
                    <th>من فرع</th>
                    <th>التفاصيل</th>
                </tr>
                </thead>
                <tbody>
                <?php $__currentLoopData = $docs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $doc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td><?php echo e($doc->stock_doc_id); ?></td>
                        <td><?php echo e($doc->stock_doc_date); ?></td>
                        <td><?php echo e($doc->branchfrom->branch_name); ?></td>
                        <td>
                            <!-- Button trigger modal -->
                            <button type="button" class="btn btn-primary" data-toggle="modal"
                                    data-target="#exampleModal<?php echo e($doc->id); ?>">
                                التفاصيل
                            </button>

                            <!-- Modal -->
                            <div class="modal fade" id="exampleModal<?php echo e($doc->id); ?>" tabindex="-1" role="dialog"
                                 aria-labelledby="exampleModalLabel" aria-hidden="true">
                                <div class="modal-dialog" role="document">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <h5 class="modal-title" id="exampleModalLabel">تفاصيل االاذن</h5>
                                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                <span aria-hidden="true">&times;</span>
                                            </button>
                                        </div>
                                        <div class="modal-body">
                                            <table class="table">
                                                <thead>
                                                <tr>
                                                    <th>رقم المنتج</th>
                                                    <th>الكمية</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                <?php $__currentLoopData = $doc->details; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <tr>
                                                        <td><?php echo e($item->item_serial); ?></td>
                                                        <td><?php echo e($item->item_quantity); ?></td>
                                                        
                                                    </tr>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </tbody>
                                            </table>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
                                            </button>
                                            
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                </tbody>
                <tfoot>
                <tr>
                    <th>رقم الاذن</th>
                    <th>تاريخ الاذن</th>
                    <th>من فرع</th>
                    <th>التفاصيل</th>
                </tr>
                </tfoot>
            </table>

        </div>

    </div>




    


    <!-- add adress popup -------------------------------------------------------------------------->

    <!-- Main Section ------------------------------------------------------------------------------->







    <script type="text/javascript">

        $(document).ready(function () {
            var table = $('#example').DataTable();

            $('#example tbody ').on('click', 'tr', function () {
                $(this).toggleClass('selected');
                var checkbox = $(this).find("input[type='checkbox']");
                checkbox.prop('checked', !checkbox.prop("checked"));


            });

            $('#button').click(function () {
                alert(table.rows('.selected').data().length + ' row(s) selected');
            });
        });


        $(document).ready(function () {
            var table = $('#example2').DataTable();

            $('#example tbody ').on('click', 'tr', function () {
                $(this).toggleClass('selected');
                var checkbox = $(this).find("input[type='checkbox']");
                checkbox.prop('checked', !checkbox.prop("checked"));


            });

            $('#button').click(function () {
                alert(table.rows('.selected').data().length + ' row(s) selected');
            });
        });
    </script>
<script type="text/javascript" src="<?php echo e(asset('Js/check.js')); ?>"></script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make("include", \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\Users\khaled nabawy\Desktop\macpos\resources\views/importDocs.blade.php ENDPATH**/ ?>