<?php $__env->startSection('title'); ?>
    Unit  Page
<?php $__env->stopSection(); ?>
<?php $__env->startSection('css'); ?>

<?php $__env->stopSection(); ?>
<!-- page content -->
<?php $__env->startSection('content'); ?>
    <div class="right_col" role="main">
        <div class="">
            <div class="clearfix"></div>
            <?php if(Session::has('success')): ?>
                <div class="alert alert-success">
                    <?php echo e(Session::get('success')); ?>

                </div>
            <?php endif; ?>
            <?php if(Session::has('error')): ?>
                <div class="alert alert-danger">
                    <?php echo e(Session::get('error')); ?>

                </div>
            <?php endif; ?>
            <div class="row">
                <div class="col-md-7 col-sm-7 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>Manage Product Unit  
                                <!--<a href="<?php echo e(route('unit.create')); ?>" class="btn btn-xs btn-success">Create Unit</a>-->
                            </h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a>
                                        </li>
                                        <li><a href="#">Settings 2</a>
                                        </li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
                            <table class="table table-responsive table-bordered table-condensed">
                                <thead>
                                <tr class="bg-primary">
                                    <th>S.N.</th>
                                    <th>Unit Name</th>
                                    <th>Slug</th>
                                    <th>status</th>
                                   <!-- <th>Created_by</th>
                                    <th>Modified_by</th>-->
                                    <th>Action</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php $i=1 ?>
                                <?php $__currentLoopData = $units; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <th> <?php echo e($i++); ?></th>
                                        <td> <b><?php echo e($pc->name); ?></b></td>
                                        <td> <?php echo e($pc->slug); ?></td>
                                        <td>
                                            <?php if($pc->status == 1): ?>
                                                <span class="label label-success"> Active </span>
                                            <?php else: ?>
                                                <span class="label label-danger">DeActive</span>
                                            <?php endif; ?>
                                        </td>
                                       <!-- <td> <?php echo e($pc->created_by); ?></td>
                                        <td> <?php echo e($pc->modified_by); ?></td>-->
                                        <td>
                                            <div class="row">
                                                <div class="col-md-4">
                                                    <a href="<?php echo e(route('unit.edit',$pc->id)); ?>" class="btn btn-xs btn-warning"><i class="fa fa-pencil"></i> </a>
                                                </div>
                                             <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('unit-delete')): ?>   
                                                <div class="col-md-4">
                                                    <form action="<?php echo e(route('unit.delete' ,$pc->id)); ?>" method="post">
                                                        <input type="hidden" name="_method" value="DELETE">
                                                        <?php echo e(csrf_field()); ?>

                                                        <button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('are you sure to delete?')" ><i class="fa fa-trash-o"></i> </button>
                                                    </form>
                                                </div>
                                                <?php endif; ?>
                                            </div>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="col-md-5 col-sm-5 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>
                                <!--<a href="<?php echo e(route('unit.list')); ?>" class="btn btn-xs btn-success"> Unit List</a>-->
                                Unit Entry
                            </h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                                       aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a>
                                        </li>
                                        <li><a href="#">Settings 2</a>
                                        </li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
                            <div class="row">
                                <div class="col-sm-3"></div>
                                <div class="col-sm-6">
                                    <form action="<?php echo e(route('unit.store')); ?>" method="post">
                                        <?php echo e(csrf_field()); ?>

                                        <div class="form-group">
                                            <label for="name">Name*</label>
                                            <input type="text" class="form-control" id="name" name="name"
                                                   placeholder="Enter name">
                                            <span class="error"><b>
                                                   <?php if($errors->has('name')): ?>
                                                        <?php echo e($errors->first('name')); ?>

                                                    <?php endif; ?></b>
                                             </span>
                                        </div>
                                        <div class="form-group">
                                            <label for="slug">Slug*</label>
                                            <input type="text" class="form-control" id="slug" name="slug"
                                                   placeholder="Enter slug">
                                            <span class="error"><b>
                                                    <?php if($errors->has('slug')): ?>
                                                        <?php echo e($errors->first('slug')); ?>

                                                    <?php endif; ?></b>
                                                 </span>
                                        </div>
                                        <div class="form-group">
                                            <label>Status</label>

                                            <input type="radio" name="status" value="1" id="Active" checked=""><label
                                                    for="Active"> Active</label>
                                            <input type="radio" name="status" id="deactive" value="0"><label for="deactive">De
                                                Active</label>
                                        </div>
                                        <!-- /.box-body -->
                                        <div class="box-footer">
                                            <button type="submit" name="btnCreate" class="btn btn-primary" >Save Unit</button>
                                        </div>
                                    </form>
                                </div>
                                <div class="col-sm-3"></div>
                            </div>
                            
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /page content -->
<?php $__env->stopSection(); ?>

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

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