<?php  //$moduleData = $this->dashboardMenu()->getAllMasterModule();

if(isset($this->roleData)){
     $roles = $this->roleData[0];
     $role_name = $roles['role_name'];
     $role_desc = $roles['description'];
    // $role_moduleid_arr = explode(',',$roles['module_id']);
     $role_status = $roles['status'];
}

?>

<section class="content-header">
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-home"></i>Home</a></li>
        <li class="active"><a href="index.html">Dashboard</a></li>
        <li class="active">Role List</li>
    </ol>
</section>

<!-- Main content -->
<section class="content">
    <div class="row">
        <div class="col-sm-12">
            <div class="tabbable">
                <div class="tab-content no-border padding-24">
                    <div class="tab-pane fade in active" id="faq-tab-1">
                        <div class="space-8"></div>
                        <div class="panel-group accordion-style1 accordion-style2" id="faq-list-1">
                            <div class="panel panel-default">

                                <?php
                                $form = $this->form;
                                $form->prepare();
                                $form->setAttribute('action', $this->url('userrolemanager', ['action' => 'edit-user-role']));
                                $form->setAttribute('method', 'post');
                                $form->setAttribute('id', 'user-search-form');
                                echo $this->form()->openTag($form);
                                ?>

                                <div class="panel-headingnew">Role Management Setting </div>




                                <div class="left_panel col-sm-12 padding_margin0 pull-left bg-white">

                                    <div class="col-sm-12  " align="right">

                                        <div class="tool-bar margin">
                                            <div class="row">



                                                <a href="<?php echo $this->url('userrolemanager', ['action' => 'index']); ?>" class="back_btn_link btn btn-primary"><i class="fa fa-chevron-left"></i> Back</a>
                                                <a href="javascript:%20%20void(0);" class="reset_btn btn btn-success"><i class="fa fa-retweet"></i> Reset</a>
                                                <a href="javascript:%20void(0);"><?php echo $this->FormElement($form->get('submit')); ?></a>
                                            </div>
                                        </div>
                                    </div>


                                    <div class="tab-content tab_editprofile col-sm-12 padding-left0 margintop10px margin-bttom10px">
                                        <div id="home" class="tab-pane fade in tab_editprofile tab_editprofile1 active">

                                            <div class="change_password tab_editprofile">

                                                <div class="tab-content" id="myTabContent">
                                                    <div id="home" class="tab-pane fade active in">
                                                        <div class="col-sm-col-sm-offset-1 margin-10auto0 paddingRL10px">

                                                            <div class="row">
                                                                <div class="col-sm-12">

                                                                    <div class="col-sm-10">

                                                                        <div class="form-group clearfix margintopbottom20">
                                                                            <label class="col-sm-3 control-label labelalign col-sm-3-new" id="Categorie Name"><?php echo $this->translate('Role Title *'); ?></label>
                                                                            <div class="col-sm-3 col-sm-4-new">
                                                                                    <?php echo $this->FormElement($form->get('role_id')->setValue($roleId)); ?>
                                                                                <?php echo $this->FormElement($form->get('title')->setValue($role_name)); ?>
                                                                                <?php echo $this->formElementErrors($form->get('title'), ['class' => 'error']); ?>
                                                                            </div>
                                                                            <label class="col-sm-3 control-label labelalign col-sm-3-new" id="Categorie Name"> <?php echo $this->translate('Role Description'); ?></label>
                                                                            <div class="col-sm-3 col-sm-4-new">
                                                                                <?php echo $this->FormElement($form->get('description')->setValue($role_desc)); ?>
                                                                                <?php echo $this->formElementErrors($form->get('description'), ['class' => 'error']); ?>

                                                                            </div>



                                                                        </div>


                                                                        <div class="form-group clearfix margintopbottom20">
                                                                            <label class="col-sm-3 control-label labelalign col-sm-3-new" id=""> Status  </label>

                                                                            <div class="col-sm-3 col-sm-4-new no-padding">

                                                                                <div class="col-sm-6">
                                                                                    <div class="carbooking">
                                                                                        <input type="radio" name="status" id="Active" <?php if($role_status==1){?>checked="checked"<?php }?> value="1">
                                                                                        <label for="Active"><span class="radio">Active</span></label>
                                                                                    </div>



                                                                                </div>

                                                                                <div class="col-sm-6">
                                                                                    <div class="carbooking">
                                                                                        <input type="radio" name="status" id="De-active" <?php if($role_status==0){?>checked="checked"<?php }?> value="0">
                                                                                        <label for="De-active"><span class="radio">De-Active</span></label>
                                                                                    </div>

                                                                                </div>


                                                                            </div>

                                                                        </div>

                                                                    </div>

                                                                    <!--<div class="col-sm-12">

                                                                        <div class="panel panel-default">
                                                                            <div class="panel-heading">
                                                                                <h3 class="panel-title">Permission Control</h3>
                                                                            </div>
                                                                            <div class="panel-body">
                                                                                <div class="col-md-4">
                                                                                    <ul>
                                                                                        <?php
                                                                                        foreach ($moduleData as $getModuleData) {

                                                                                           $moduleName = $getModuleData['module_name'];
                                                                                           $moduleId = $getModuleData['module_id'];

                                                                                            ?>

                                                                                            <li><label class="booking-check"><?php echo $moduleName ;?>
                                                                                                    <input type="checkbox"  name="modulenameid[]" <?php if(in_array($moduleId,$role_moduleid_arr)){?> checked="checked" <?php } ?> value="<?php echo $moduleId;?>" >
                                                                                                    <span class="checkmark"></span>
                                                                                                </label>

                                                                                                <?php if(!empty($getModuleData['submenu'])){
                                                                                                    foreach($getModuleData['submenu'] as $submenu){

                                                                                                        $submoduleName=$submenu['module_name'];
                                                                                                        $submoduleId=$submenu['module_id'];
                                                                                                        ?>
                                                                                                 <ul>
                                                                                                    <li> <label class="booking-check"><?php echo $submoduleName; ?>
                                                                                                    <input type="checkbox" name="modulenameid[]" <?php if(in_array($submoduleId,$role_moduleid_arr)){?> checked="checked" <?php } ?> value="<?php echo $submoduleId ;?>" >
                                                                                                    <span class="checkmark"></span>
                                                                                                  </label>
                                                                                                 </ul>
                                                                                                <?php }} ?>
                                                                                            </li>
                                                                                        <?php }?>

                                                                                        </ul>

                                                                                    </div>




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


                                                                    </div>

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

                                                    </div>

                                                </div>


                                            </div>



                                        </div>
    <?php echo $this->form()->closeTag(); ?>


                                        <div class="tool-bar margin text-right">


                                            <div class="row">

                                                <a href="<?php echo $this->url('userrolemanager', ['action' => 'index']); ?>" class="back_btn_link btn btn-primary"><i class="fa fa-chevron-left"></i> Back</a>
                                            <a href="javascript:%20%20void(0);" class="reset_btn btn btn-success"><i class="fa fa-retweet"></i> Reset</a>
                                            <a href="javascript:%20void(0);"> <?php echo $this->FormElement($form->get('submit')); ?></a>
                                        </div>




                                    </div>


                                </div>

                            </div>



                        </div>



                    </div>

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

    <!-- /.widget-box -->
</section>