<link rel="stylesheet" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css
">
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js
"></script>


<?php $__env->startSection("body"); ?>

    <div class="main-cont">
        <div class="new-pur">
            <h6>stock</h6>
            <hr>
            <div  data-addui='tabs'>
                <div class="tabs" role='tabs'>

                    <div><i class="far fa-file-alt"></i> branches</div>

                </div>
                <hr>
                <div role='contents'>



                    <div class="tab1">

                        <form action="/stockrequestsubmit" method="post">
                            <?php echo csrf_field(); ?>
                            <table id="example2" class="table table-striped table-bordered" style="width:100%">
                                <thead>
                                <tr>
                                    <th>Name</th>
                                    <th>Total quantity</th>
                                    <th>Branch Name</th>
                                    <th>Request quantity</th>
                                    <th>check box</th>
                                    <th style="display: none">id branch</th>
                                    <th style="display: none">product_id</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php $__currentLoopData = $allstockforallbranches; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $getbstock): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td><?php echo e($getbstock->products->name); ?></td>
                                        <td><?php echo e($getbstock->quntity); ?></td>
                                        <td><?php echo e($getbstock->branch->title); ?></td>
                                        <td><input type="text" name="quantity[]"></td>
                                        <td><input type="checkbox" value="<?php echo e($getbstock->id); ?>" name="idstock[]" ></td>
                                        <td style="display: none"><input type="hidden" class="x" value="<?php echo e($getbstock->branch->id); ?>" name="branchids[]" ></td>
                                        <td style="display: none"><input type="hidden" class="x" value="<?php echo e($getbstock->products->id); ?>" name="productids[]" ></td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>



                                </tbody>
                                <tfoot>
                                <tr>
                                    <th>Name</th>
                                    <th>Total quantity</th>
                                    <th>Branch Name</th>
                                    <th>Request quantity</th>
                                    <th>check box</th>
                                </tr>
                                </tfoot>
                                <input type="hidden" name="user_id" value="<?php echo e($user_id); ?>">
                            </table>


                            <input type="submit" name="submit">
                        </form>

                    </div>


                </div>
            </div>
        </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"));
            console.log( document.getElementsByName('branchids[]').values());
            console.log( $(this).childNodes[0].className=='x');



        } );

        $('#button').click( function () {
            alert( table.rows('.selected').data().length +' row(s) selected' );
        } );
    } );
</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/requestPackage.blade.php ENDPATH**/ ?>