

<?php $__env->startSection('title','Item - Inventory WELL GROUP '); ?>

<?php $__env->startSection('content'); ?>
    <!-- Content Header (Page header) -->
    <div class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1 class="m-0 text-dark">Manage  Item  </h1>
                </div><!-- /.col -->
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a href="#">Item setup</a></li>
                        <li class="breadcrumb-item active">Manage Item</li>
                    </ol>
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->


    <!-- Main content -->
    <section class="content">
        <div class="col-lg-12">
            <div class="row">
                
                <div class="col-lg-4">
                    <div class=" bg-light">
                        <div class="card card-info card-outline">
                            <div class="card-header">
                                <h3 class="card-title">Add Item</h3>
                                <div class="card-tools">
                                    <button type="button" class="btn btn-tool" data-widget="collapse">
                                        <i class="fas fa-plus"></i>
                                    </button>
                                </div>
                            </div> <!-- /.card-header -->

                            <div class="card-body" style="display: block;">
                                <?php echo e(Form::open(['route'=>'inventory.item.store','method'=>'POST', 'class'=>'form-horizontal'])); ?>

                                    <?php echo $__env->make('inventory.item.form-item-inventory',['buttonText'=>'Save Item'], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                <?php echo e(Form::close()); ?>

                            </div>
                        </div>
                    </div>
                </div>
                

                
                <div class="col-md-8">
                    <div class="card card-warning card-outline">
                        <div class="card-header">
                            <div class="card-title">
                                <h5 class="text-info">Inventory Item list</h5>
                            </div>

                            <div class="card-tools">
                                <button type="button" class="btn btn-tool" data-widget="collapse">
                                    <i class="fas fa-minus"></i>
                                </button>
                            </div>
                            <!-- /.card-tools -->
                        </div>
                        <!-- /.card-header -->
                        <div class="card-body" style="display: block;">
                            <?php echo e(Form::label('','Show Product according to Category ')); ?>


                            <?php echo e(Form::select("searching",\App\Group::pluck('name','id'),null,['class'=>'form-control department_id','placeholder'=>'Select Category'])); ?>

                            <hr>
                            <div id="showTable">
                                 <?php echo $__env->make('inventory.item.items-inventory', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                            </div>

                        </div>
                        <!-- /.card-body -->
                    </div>
                </div>
                

            </div>
        </div>

    </section><!-- /.content -->
<?php $__env->stopSection(); ?>

<?php $__env->startSection('plugin'); ?>
    <!-- DataTables -->
    <script src="<?php echo e(asset('plugins/datatables/jquery.dataTables.js')); ?>"></script>
    <script src="<?php echo e(asset('plugins/datatables/dataTables.bootstrap4.js')); ?>"></script>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js'></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.4/jquery-confirm.min.js"></script>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('script'); ?>
    <!-- page script -->
    <script type="text/javascript">

        $('.select2').select2()
        var table;
        $(document).ready(function () {
            table = $("#productTable").DataTable();
        });

        $(document).on("change",".department_id",function () {
            var group_id = $(this).val();
            table.clear().draw();
            var row = "<tr> <td colspan='9' style='background: red;padding: 10px;color: #fff3cd;font-size: 1rem;text-align: center;'> Please wait item loading ............. </td>  </tr>";
            $("#tbodyItem").html(row);


            $.ajax({
                method:"post",
                url : "<?php echo e(route('groupwise.productList')); ?>",
                data : { group_id:group_id,_token:'<?php echo e(csrf_token()); ?>'},
                success:function (response) {
                    $('#showTable').html(response);
                    //var obj =  JSON.parse(response).length;
                    // console.log(response.success);

                    // for (var i=0;i<response.success.sl.length;i++){
                    //     table.row.add([
                    //         response.success.sl[i],
                    //         response.success.code[i],
                    //         response.success.name[i],
                    //         response.success.department[i],
                    //         response.success.group[i],
                    //         response.success.unit[i],
                    //         response.success.price[i],
                    //         response.success.description[i],
                    //         response.success.edit[i]
                    //     ]).draw();
                    // }

                }
            })
        });

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

<?php echo $__env->make('layouts.fixed', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/welluugs/purchase.wellgrouperp.com/resources/views/inventory/item/add-item.blade.php ENDPATH**/ ?>