<?php
$level->id = $_GET[id];
$u = $level->level();

if($u[aktif]=='Y'){
    $aktif = 'Ya';
}elseif($u[aktif]=='N'){
    $aktif = 'Tidak';
}
?>
<div class="page-content">
    <div class="row">
        <div class="col-xs-12">
            <div class="page-header">
                <h1>
                    Level Otoritas
                    <small>
                        <i class="ace-icon fa fa-angle-double-right"></i>
                        Edit Level Otoritas
                    </small>
                </h1>
            </div><!-- /.page-header -->
        </div>
        <form class="form-horizontal" role="form" action="view/view/modul/mod_petugas/aksi_petugas.php?aksi=edit" method="post" >
            <div class="col-xs-12">
                <input type="hidden" name="id" value="<?php echo $_GET[id]; ?>">
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Nama Level </label>
                    <div class="col-sm-9">
                        <input type="text" id="form-field-1" placeholder="Nama Level" name="nama" class="col-xs-10 col-sm-5" value="<?php echo $u[level]; ?>" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Aktif </label>
                    <div class="col-sm-9">
                        <select id="form-field-select-1" class="col-xs-10 col-sm-5" name="blokir">
                            <option value="<?php echo $u[aktif]; ?>" selected><?php echo $aktif; ?></option>
                            <option value="Y">Ya</option>
                            <option value="N">Tidak</option>
                        </select>
                    </div>
                </div>
                <div>
                    <table id="dynamic-table" class="table table-striped table-bordered table-hover">
                        <thead>
                            <tr>
                                <th></th>
                                <th>Menu</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                                $m = $menu->menu('admin','','admin');
                                $no = 1;
                                while($i<count($m)){
                            ?>
                                    <tr>
                                        <td><input type="hidden" name="<?php echo check.$no; ?>" value="<?php echo $m[$i][id]; ?>" /></td>
                                        <td>
                                            <b><?php echo $m[$i][nama]; ?></b>    
                                        </td>
                                    </tr>
                                    <?php
                                        $s = $menu->submenu($m[$i][id],'','admin');
                                        $nos=1;
                                        while($n<count($s)){
                                            $o = $level->otoritas($m[$i][id], $s[$n][id]);
                                            if(isset($o[id_otoritas])){
                                            ?>
                                                <tr>
                                                    <td><input type="checkbox" name="<?php echo check.$no.$nos; ?>" value="<?php echo $s[$n][id]; ?>" /></td>
                                                    <td>
                                                        <b><?php echo $s[$n][nama]; ?></b>    
                                                    </td>
                                                </tr>
                                            <?php 
                                            }else{
                                            ?>
                                                <tr>
                                                    <td><input type="checkbox" name="<?php echo check.$no.$nos; ?>" value="<?php echo $s[$n][id]; ?>" /></td>
                                                    <td>
                                                        <b><?php echo $s[$n][nama]; ?></b>    
                                                    </td>
                                                </tr>
                                            <?php
                                            }    
                                            $n++; 
                                            $nos++;
                                        }
                                        unset($n);
                                                    
                                        $i++;
                                        $no++;
                                    }
                                    unset($i);
                                ?>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="clearfix form-actions">
                    <div class="col-md-offset-3 col-md-9">
                        <button class="btn btn-info" type="button">
                            <i class="ace-icon fa fa-check bigger-110"></i>
                            Submit
                        </button>
                        &nbsp; &nbsp; &nbsp;
                        <button class="btn" type="reset">
                            <i class="ace-icon fa fa-undo bigger-110"></i>
                            Reset
                        </button>
                        &nbsp; &nbsp; &nbsp;
                        <a href="index.php?module=otoritas">
                            <button class="btn" type="button">
                                <i class="ace-icon fa fa-undo bigger-110"></i>
                                Cancel
                            </button>
                        </a>
                    </div>
                </div>
            </div>                            
        </form>
    </div><!-- /.row -->
</div><!-- /.page-content -->