<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">        
    <section class="content-header">
        <h1>
            Layanan
            <small>Edit Layanan</small>
        </h1>            
    </section>

    <section class="content">
        <a href="<?php echo base_url('dashboard/layanan'); ?>" class="btn btn-sm btn-primary">Kembali</a>

        <br/><br/>

        <?php foreach($layanan as $l): ?>
        <form method="post" action="<?php echo base_url('dashboard/layanan_update'); ?>" enctype="multipart/form-data" novalidate>
            <!-- CSRF Protection -->
            <input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
            <input type="hidden" name="id" value="<?php echo $l->layanan_id; ?>">

            <div class="row">
                <div class="col-md-8">                            
                    <div class="box box-primary">                                
                        <div class="box-body">                                   
                            <div class="form-group">
                                <label>Judul</label>
                                <input type="text" name="judul" id="judul" class="form-control" placeholder="Masukkan judul layanan .." required value="<?php echo set_value('judul', $l->layanan_judul); ?>">
                                <?php echo form_error('judul', '<div class="text-danger">', '</div>'); ?>
                            </div>

                            <div class="form-group">
                                <label>Deskripsi</label>
                                <textarea id="editor1" name="konten" rows="10" cols="80" required><?php echo set_value('konten', $l->layanan_konten); ?></textarea>
                                <?php echo form_error('konten', '<div class="text-danger">', '</div>'); ?>
                            </div>
                        </div>                                                        
                    </div>
                </div>

                <div class="col-md-4">
                    <div class="box box-primary">
                        <div class="box-body">
                            <div class="form-group">
                                <label>Kategori</label>
                                <select class="form-control" name="kategori" required>
                                    <option value="">- Pilih Kategori -</option>
                                    <?php foreach($kategori_layanan as $k): ?>
                                        <option value="<?php echo $k->kategori_layanan_id; ?>" <?php echo set_select('kategori_layanan', $k->kategori_layanan_id, ($l->layanan_kategori == $k->kategori_layanan_id)); ?>>
                                            <?php echo $k->kategori_layanan_nama; ?>
                                        </option>
                                    <?php endforeach; ?>
                                </select>
                                <?php echo form_error('kategori_layanan', '<div class="text-danger">', '</div>'); ?>
                            </div>

                            <div class="form-group">
                                <label>Gambar Sampul</label>
                                <input type="file" name="sampul">
                                <p class="help-block">Silakan upload Gambar...!</p>
                                <?php if(isset($gambar_error)): ?>
                                    <div class="text-danger"><?php echo $gambar_error; ?></div>
                                <?php endif; ?>
                                <?php echo form_error('sampul', '<div class="text-danger">', '</div>'); ?>
                            </div>

                            <input type="submit" name="status" value="Draft" class="btn btn-warning btn-block">
                            <input type="submit" name="status" value="Publish" class="btn btn-success btn-block">
                        </div>
                    </div>
                </div>
            </div>
        </form>
        <?php endforeach; ?>
    </section>
</div>
