<div class="row">
    <div class="col-sm-12 col-md-12">
        <div class="panel panel-bd ">
            <div class="panel-heading">
                <div class="panel-title">
                    <h4><?php echo (!empty($title)?$title:null) ?></h4>
                </div>
            </div>
            <?php echo form_open("dashboard/role/save_create") ?>
            <div class="panel-body">

                    <div class="form-group row">
                        <label for="role_name" class="col-xs-3 col-form-label"><?php echo display('role_name') ?> <i class="text-danger">*</i></label>
                        <div class="col-xs-9">
                            <input name="role_name" type="text" class="form-control" id="role_name" placeholder="<?php echo display('role_name') ?>"  >
                        </div>
                    </div>

                    <div class="form-group row">
                        <label for="role_description" class="col-xs-3 col-form-label"><?php echo display('description') ?> <i class="text-danger">*</i></label>
                        <div class="col-xs-9">
                            <textarea class="form-control" rows="2" name="role_description" id="role_description"></textarea>
                        </div>
                    </div>
<?php $m = 0; ?>                  
<?php foreach ($modules as $value) {

$menu_item = $this->db->select('*')->from('sec_menu_item')->where('module',$value->module)->get()->result();
    ?>
    <input type="hidden" name="module[]" value="<?php echo $value->module;?>">
                    <table class="table table-bordered table-hover" id="RoleTbl">
                        <h2><?php echo display($value->module)?></h2>
                        <thead>
                            <tr>
                                <th><?php echo display('sl_no') ?></th>
                                <th>Menue Title</th>
                                <th>Can Create(<input type="checkbox" onclick="checkallcreate(<?php echo $m?>)" id="checkAllcreate<?php echo $m?>"  name="" > all)</th>
                                <th>Can read(<input type="checkbox" onclick="checkallread(<?php echo $m?>)" id="checkAllread<?php echo $m?>"  name="" > all)</th>
                                <th>Can Edit(<input type="checkbox" onclick="checkalledit(<?php echo $m?>)" id="checkAlledit<?php echo $m?>"  name="" > all)</th>
                                <th>Can Delete(<input type="checkbox" onclick="checkalldelete(<?php echo $m?>)" id="checkAlldelete<?php echo $m?>"  name="" > all)</th>
                            </tr>
                        </thead>

                        <tbody>
                            <?php if (!empty($menu_item)) ?>
                            <?php $sl = 0; ?>
                            <?php foreach ($menu_item as $value) { ?>
                            <tr>
                                <td><?php echo $sl+1; ?></td>
                                <td class="text-<?php echo ($value->parent_menu?'right':'')?>"><?php echo display($value->menu_title); ?></td>
                                <td>
                                    <div class="checkbox checkbox-success text-center">
                                        <input type="checkbox" name="create[<?php echo $m?>][<?php echo $sl ?>][]" class="create<?php echo $m?>" value="1" id="create[<?php echo $m?>]<?php echo $sl?>">
                                        <label for="create[<?php echo $m?>]<?php echo $sl ?>"></label>
                                    </div>
                                </td>

                                <td>
                                    <div class="checkbox checkbox-success text-center">
                                        <input type="checkbox" name="read[<?php echo $m?>][<?php echo $sl ?>][]" class="read<?php echo $m?>" value="1" id="read[<?php echo $m?>]<?php echo $sl?>">
                                        <label for="read[<?php echo $m?>]<?php echo $sl ?>"></label>
                                    </div>
                                </td> 
                                <td>
                                    <div class="checkbox checkbox-success text-center">
                                       <input type="checkbox" name="edit[<?php echo $m?>][<?php echo $sl ?>][]" class="edit<?php echo $m?>" value="1" id="edit[<?php echo $m?>]<?php echo $sl?>">
                                        <label for="edit[<?php echo $m?>]<?php echo $sl ?>"></label>
                                    </div>
                                </td> 
                                <td>
                                    <div class="checkbox checkbox-success text-center">
                                        <input type="checkbox" name="delete[<?php echo $m?>][<?php echo $sl ?>][]" class="delete<?php echo $m?>" value="1" id="delete[<?php echo $m?>]<?php echo $sl?>">
                                        <label for="delete[<?php echo $m?>]<?php echo $sl ?>"></label>
                                    </div>
                                </td>

                                <input type="hidden" name="menu_id[<?php echo $m?>][<?php echo $sl ?>][]" value="<?php echo $value->menu_id?>">
                               
                            </tr>
                            <?php $sl++ ?>
                            <?php } ?>
                            
                        </tbody>
                    </table>
                    <?php $m++ ?>
                    <?php } ?>

                    <div class="form-group form-group-margin text-right">
                       <button type="submit" class="btn btn-success w-md m-b-5"><?php echo display('save') ?></button>
                    </div>


            </div>
            <?php echo form_close();?>
        </div>
    </div>
</div>


 