<?php
    if (empty($_GET[id])) {
        $k = $katlist->katlisttag($_GET[tag]);
    }else{
        $katlist->id = $_GET[id];
        $k = $katlist->katlist();
    }

?>
<div class="page-content">
    <div class="row">
        <div class="col-xs-12">
            <div class="page-header">
                <h1>
                    Data Module List
                </h1>
            </div><!-- /.page-header -->
            <a href="index.php?module=list">
                <button class="btn" type="button">
                    <i class="ace-icon fa fa-undo bigger-110"></i>
                    Kembali
                </button>
            </a>
        </div>
        <form class="form-horizontal" role="form" action="view/view/modul/mod_list/aksi_list.php?aksi=edit" method="post" >
            <input type="hidden" name="id" value="<?php echo $k[id]; ?>">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Nama Kategori </label>
                    <div class="col-sm-9">
                        <input type="text" id="form-field-1" placeholder="Nama" name="nama" class="col-xs-10 col-sm-5" value="<?php echo $k[nama]; ?>" />
                    </div>
                </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="submit">
                            <i class="ace-icon fa fa-check bigger-110"></i>
                            Edit
                        </button>
                    </div>
                </div>
            </div>
        </form>
        <form class="form-horizontal" role="form" action="view/view/modul/mod_list/aksi_list.php?aksi=tambah_list" method="post" enctype="multipart/form-data" >
           <input type="hidden" name="id" value="<?php echo $_GET[id]; ?>">
            <div class="col-xs-12">
                <div class="row">
                    <div class="col-xs-12">
                        <h3 class="header smaller lighter blue">List</h3>
                        <div class="clearfix">
                            <div class="form-group">
                                <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Nama </label>
                                <div class="col-sm-9">
                                    <div class="col-sm-9">
                                        <input type="text" id="form-field-1" placeholder="Nama" name="nama" class="col-xs-10 col-sm-5" />
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Keterangan </label>
                                <div class="col-sm-9">
                                    <div class="col-sm-9">
                                        <textarea id="form-field-1" placeholder="Keterangan" name="keterangan" class="col-xs-10 col-sm-5"></textarea>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Gambar </label>
                                <div class="col-sm-9">
                                    <input type="file" id="id-input-file-2" name="gambar" class="col-xs-4" />
                                </div>
                            </div>
                            <div class="form-group">
                                <button class="btn btn-info" type="submit">
                                    <i class="ace-icon fa fa-check bigger-110"></i>
                                    Tambah
                                </button>
                            </div>
                            <div class="pull-right tableTools-container"></div>
                        </div>
                        <div>
                            <table id="simple-table" class="table table-striped table-bordered table-hover">
                                <thead>
                                    <tr>
                                        <th>Nama</th>
                                        <th>Keterangan</th>
                                        <th>Gambar</th>
                                        <th></th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php
                                        $p = $list->listdatakat($k[id]);
                                        while($i<count($p)){
                                            ?>
                                                <tr>
                                                    <td><?php echo"".$p[$i][nama].""; ?></td>
                                                    <td><?php echo"".$p[$i][keterangan].""; ?></td>
                                                    <td><img src="<?php echo $db->link(); ?>view/assets/img/list/<?php echo"".$p[$i][gambar].""; ?>" width=150></td>
                                                    <td>
                                                        <div class="hidden-sm hidden-xs action-buttons">
                                                            <a class="red" href="view/view/modul/mod_list/aksi_list.php?aksi=deletelist&idk=<?php echo $p[$i][id]; ?>&id=<?php echo $k[id]; ?>">
                                                                <i class="ace-icon fa fa-trash-o bigger-130"></i>
                                                            </a>
                                                        </div>
                                                    </td>
                                                </tr>
                                            <?php
                                            $i++;
                                        }
                                        unset($i);
                                    ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div><!-- /.col -->
        </form>
    </div><!-- /.row -->
</div><!-- /.page-content -->
