
<?php $__env->startSection('title', 'Module Edit'); ?>
<?php $__env->startPush('css'); ?>
<link rel="stylesheet" href="<?php echo e(asset('backend/plugins/select2.min.css')); ?>">
<?php $__env->stopPush(); ?>
<!-- page content -->
<!-- page content -->
<?php $__env->startSection('content'); ?>
    <div class="right_col" role="main">
        <div class="">
            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>Edit Module  <a href="<?php echo e(route('module.list')); ?>" class="btn btn-xs btn-success"> Module List</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">
                            <div class="row">
                                <div class="col-sm-3 col-md-3"></div>
                                <div class="col-sm-3 col-md-6">
                                    <form action="<?php echo e(route('module.update',$module->id)); ?>" method="post">
                                        <?php echo e(csrf_field()); ?>

                                        <div class="form-group">
                                            <label for="name">Module Group Name</label>
                                            <select name="group_name" class="form-control select2">
                                                <option>-- Select Group --</option>
                                                <?php $__currentLoopData = $groups; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $group): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($group->id); ?>" <?php echo e($module->module_group_id == $group->id ? 'selected' : ''); ?>><?php echo e($group->name); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                            <span class="error"><b><?php echo e($errors->first('group_name')); ?></b></span>
                                        </div>
                                        <div class="form-group">
                                            <label for="name">Module Name</label>
                                            <input type="text" class="form-control" id="name" name="name" placeholder="Enter name" value="<?php echo e(old('name') ?? $module->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="module_key">Module Key</label>
                                            <input type="text" class="form-control" id="module_key" name="module_key" placeholder="Enter module_key" value="<?php echo e(old('name') ?? $module->module_key); ?>">
                                            <span class="error"><b>
                                                 <?php if($errors->has('module_key')): ?>
                                                        <?php echo e($errors->first('module_key')); ?>

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

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

                                                    <?php endif; ?></b></span>
                                        </div>
                                        <div class="form-group">
                                            <label for="module_icon">Module Icon</label>
                                            <input type="text" class="form-control" id="module_icon" name="module_icon" value="<?php echo e(old('name') ?? $module->module_icon); ?>" placeholder="Enter module_icon (eg:- fa fa-dashboard)">
                                        </div>
                                        <div class="form-group">
                                            <label>Disply in Sidebar</label>
                                           <!-- <label>
                                                <input type="radio" name="view_sidebar" id="view_sidebar" checked="<?php echo e($module->view_sidebar == 1 ? 'checked' : ''); ?>" >
                                                <label for="view_sidebar">Yes </label>
                                            </label>                           
                                            <label>
                                                <input type="radio" name="view_sidebar" id="deactive"  checked="<?php echo e($module->view_sidebar == 1 ? 'checked' : ''); ?>" >
                                                <label for="deactive"> No</label>
                                            </label>-->
                                            <select class="form-control" name="view_sidebar">
                                                <option value="1" <?php echo e($module->view_sidebar == 1 ? 'selected' : ''); ?>> Yes</option>
                                                <option value="0" <?php echo e($module->view_sidebar == 0 ? 'selected' : ''); ?>> No</option>
                                            </select>
                                        </div>
                                        <div class="form-group">
                                            <label>Display For &nbsp;</label>
                                            <?php $__currentLoopData = $roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $r): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <?php ($check = ''); ?>
                                                <input type="hidden" name="roles[]" value="<?php echo e($r->id); ?>">
                                                <?php $__currentLoopData = $module->rm; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if($r->id == $cp->role_id): ?>
                                                        <?php ($check = 'Checked'); ?>
                                                        <?php 
                                                            break;
                                                         ?>
                                                    <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                <input type="checkbox" id="<?php echo e($r->name); ?>" name="rms[]" <?php echo e($check); ?> value="<?php echo e($r->id); ?>"> <label for="<?php echo e($r->name); ?>"> <?php echo e($r->name); ?> </label>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </div>
                                        <!-- /.box-body -->
                                        <hr>
                                        <div class="box-footer">
                                            <a href="<?php echo e(route('module.list')); ?>" class="btn btn-warning">Cancel</a>
                                            <button type="submit" name="btnCreate" class="btn btn-primary">Update Module</button>
                                        </div>
                                    </form>
                                </div>
                                <div class="col-sm-3 col-md-3"></div>
                            </div>
                            
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /page content -->
<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>
<script src="<?php echo e(asset('backend/plugins/select2.min.js')); ?>"></script>
    <script>
        $(document).ready(function(){
		    /*-----select2 section---------*/
		    $('.select2').select2();
        });
    </script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('backend.layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>