<?php $__env->startSection('title'); ?><?php echo e(__('adminforms.products.plural')); ?> <?php $__env->stopSection(); ?>
<?php $__env->startSection('header'); ?><?php echo e(__('adminforms.products.plural')); ?> <?php $__env->stopSection(); ?>
<?php $__env->startSection('header_desc'); ?> <?php $__env->stopSection(); ?>
<?php $__env->startSection('breadcumbs'); ?> <?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <!-- Main content -->
    <section class="content">

        <div class="row">
            <div class="col-xs-12">
                <?php if(session('result')): ?>
                    <div class="alert alert-success alert-dismissible">
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                        <i class="icon fa fa-check"></i> <strong>Info: </strong> &nbsp;  &nbsp;
                        <?php echo e(session('result')); ?>

                    </div>
                <?php endif; ?>
                <?php if(session('error')): ?>
                    <div class="alert alert-danger alert-dismissible">
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                        <i class="icon fa fa-exclamation-triangle"></i> <strong>Info: </strong> &nbsp;  &nbsp;
                        <?php echo e(session('error')); ?>

                    </div>
                <?php endif; ?>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <div class="box">

                <!-- /.box-header -->
                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('create', $product)): ?>
                        <div class="col-xs-12"><br></div>
                        <div class="col-xs-12 col-md-6">&nbsp;</div>
                        <div class="col-xs-12 col-md-6">
                            <div class="text-right">
                                <a class="btn btn-outline-success" href="<?php echo e(route('admin.product.create')); ?>">
                                    <i class="ionicons ion-ios-plus-outline"> <?php echo e(__('adminforms.products.btn_add')); ?></i>
                                </a>
                            </div>
                        </div>
                        <div class="col-xs-12"><hr></div>

                    <?php endif; ?>
                    <div class="box-body">
                        <table id="data-table" class="table table-hover">
                            <thead>
                            <tr>
                                <th><?php echo e(ucfirst(__('adminforms.products.prod_id'))); ?></th>
                                <th><?php echo e(ucfirst(__('adminforms.categories.cg_name'))); ?></th>
                                <th><?php echo e(ucfirst(__('adminforms.products.cat_name'))); ?></th>
                                <th><?php echo e(ucfirst(__('adminforms.products.brand_name'))); ?></th>
                                <th><?php echo e(ucfirst(__('adminforms.products.prod_sku'))); ?></th>
                                <th><?php echo e(ucfirst(__('adminforms.products.prod_name'))); ?></th>
                                <th><?php echo e(ucfirst(__('adminforms.products.prod_status'))); ?></th>
                                <th style="text-align: right;">&nbsp;</th>
                                <th style="text-align: right;">&nbsp;</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td><?php echo e($product->prod_id); ?></td>
                                    <td> <?php echo e($product->category->group->ctranslation->cg_name); ?></td>
                                    <td> <?php echo e($product->category->ctranslation->cat_name); ?></td>
                                    <td> <?php echo e($product->brand->brand_name); ?></td>
                                    <td> <?php echo e($product->prod_sku); ?></td>
                                    <td> <?php echo e($product->prod_name); ?></td>
                                    <td> <?php echo e(strtr($product->prod_status, [0 => __('adminforms.common.false'), 1 => __('adminforms.common.true')])); ?></td>
                                    <td style="text-align: right;">
                                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('update', $product)): ?>
                                            <a class="btn btn-outline-success btn-xsm" href="<?php echo e(route('admin.product.edit', ['product' => $product->prod_id])); ?>">
                                                <i class="fa fa-pencil-square-o"></i> <?php echo e(__('adminforms.common.edit_btn')); ?>

                                            </a>
                                        <?php else: ?>
                                            &nbsp;
                                        <?php endif; ?>
                                    </td>
                                    <td style="text-align: right;">
                                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('delete', $product)): ?>
                                            <?php echo e(Form::open(array('route' => array('admin.product.destroy', $product->prod_id), 'method' => 'DELETE', 'class'=>'form-inline', 'onsubmit' => 'return submitDeleteForm(this);'))); ?>

                                            <?php echo e(Form::hidden('product', $product->prod_id)); ?>

                                            <button type="submit" class="btn btn-outline-danger btn-xsm delete"><i class="fa fa-times-circle-o"></i> <?php echo e(__('adminforms.common.del_btn')); ?></button>
                                            <?php echo e(Form::close()); ?>

                                        <?php else: ?>
                                            &nbsp;
                                        <?php endif; ?>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                        </table>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->

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


<?php $__env->startPush('css'); ?>
<link rel="stylesheet" href="<?php echo e(asset('assets/components/datatables.net-bs/css/dataTables.bootstrap.min.css')); ?>">
<?php $__env->stopPush(); ?>

<?php $__env->startPush('primscripts'); ?>
<script src="<?php echo e(asset('assets/components/datatables.net/js/jquery.dataTables.min.js')); ?>"></script>
<script src="<?php echo e(asset('assets/components/datatables.net-bs/js/dataTables.bootstrap.js')); ?>"></script>
<?php $__env->stopPush(); ?>
<?php $__env->startPush('scripts'); ?>
<script>
    $(function () {
        $('#data-table').DataTable({
            'paging'      : true,
            'lengthChange': false,
            'searching'   : true,
            'ordering'    : true,
            'info'        : true,
            'autoWidth'   : false,
            "bStateSave"  : true,
            "pageLength"  : 50,
            "language": {
                "sProcessing":   "<?php echo e(__('adminforms.data_tables.sProcessing')); ?>",
                "sLengthMenu":   "<?php echo e(__('adminforms.data_tables.sLengthMenu')); ?>",
                "sZeroRecords":  "<?php echo e(__('adminforms.data_tables.sZeroRecords')); ?>",
                "sInfo":         "<?php echo e(__('adminforms.data_tables.sInfo')); ?>",
                "sInfoEmpty":    "<?php echo e(__('adminforms.data_tables.sInfoEmpty')); ?>",
                "sInfoFiltered": "<?php echo e(__('adminforms.data_tables.sInfoFiltered')); ?>",
                "sInfoPostFix":  "<?php echo e(__('adminforms.data_tables.sInfoPostFix')); ?>",
                "sSearch":       "<?php echo e(__('adminforms.data_tables.sSearch')); ?>",
                "sUrl":          "<?php echo e(__('adminforms.data_tables.sUrl')); ?>",
                "oPaginate": {
                    "sFirst":    "<?php echo e(__('adminforms.data_tables.sFirst')); ?>",
                    "sPrevious": "<?php echo e(__('adminforms.data_tables.sPrevious')); ?>",
                    "sNext":     "<?php echo e(__('adminforms.data_tables.sNext')); ?>",
                    "sLast":     "<?php echo e(__('adminforms.data_tables.sLast')); ?>",
                }
            }
        })
    })
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layouts.admin', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>