<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1>FORM TAMBAH DATA RUMAH TANGGA</h1>
                </div>
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a href="#">Home</a></li>
                        <li class="breadcrumb-item active">FORM TAMBAH DATA RUMAH TANGGA</li>
                    </ol>
                </div>
            </div>
        </div><!-- /.container-fluid -->
    </section>

    <!-- Main content -->
    <section class="content centered">
        <div class="container-fluid ">
            <div class="row">
                <!-- left column -->

                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="card card-primary">
                        <div class="card-header">
                            <h3 class="card-title">BLOK II - Keterangan Petugas dan Responden</h3>
                        </div>

                        <?php if (isset($blok1)) : ?>
                            <form method="post" action="<?= base_url() ?>tambah_ruta/blok2/<?= $blok1[0]->id  ?>">
                            <?php else : ?>
                                <form method="post" action="<?= base_url() ?>blok2">
                                <?php endif; ?>
                                <div class="card-body">
                                    <div class="form-group">
                                        <label for="tglcacah">Tanggal Pencacahan</label>
                                        <?php if (isset($blok1)) : ?>
                                            <input type="hidden" id="id2" name="id2" class="form-control col-md-7 col-xs-12" value="<?= $blok1[0]->id ?>">
                                            <input type="date" class="form-control" name="tglcacah" id="tglcacah" placeholder="Tanggal Pencacahan" value="<?= $blok1[0]->tglcacah ?>">
                                            <?= form_error('tglcacah', '<small class ="text-danger pl-3">', '</small>'); ?>
                                        <?php else : ?>
                                            <input disabled type="date" class="form-control" id="tglcacah" placeholder="Tanggal Pencacahan">
                                        <?php endif; ?>
                                    </div>
                                    <div class="form-group">
                                        <label for="namapencacah">Nama Pencacah</label>
                                        <?php if (isset($blok1)) : ?>
                                            <input type="text" class="form-control" name="namapencacah" id="namapencacah" placeholder="Nama Pencacah" value="<?= $blok1[0]->namapencacah ?>">
                                            <?= form_error('namapencacah', '<small class ="text-danger pl-3">', '</small>'); ?>
                                        <?php else : ?>
                                            <input disabled type="text" class="form-control" id="namapencacah" placeholder="Nama Pencacah">
                                        <?php endif; ?>
                                    </div>
                                    <div class="form-group">
                                        <label for="tglperiksa">Tanggal Pemeriksaan</label>
                                        <?php if (isset($blok1)) : ?>
                                            <input type="date" class="form-control" name="tglperiksa" id="tglperiksa" placeholder="Tanggal Pemeriksa" value="<?= $blok1[0]->tglperiksa ?>">
                                            <?= form_error('tglperiksa', '<small class ="text-danger pl-3">', '</small>'); ?>
                                        <?php else : ?>
                                            <input disabled type="date" class="form-control" id="tglperiksa" placeholder="Tanggal Pemeriksa">
                                        <?php endif; ?>
                                    </div>
                                    <div class="form-group">
                                        <label for="namaperiksa">Nama Pemeriksa</label>
                                        <?php if (isset($blok1)) : ?>
                                            <input type="text" class="form-control" name="namaperiksa" id="namaperiksa" placeholder="Nama Pemeriksa" value="<?= $blok1[0]->namaperiksa ?>">
                                            <?= form_error('namaperiksa', '<small class ="text-danger pl-3">', '</small>'); ?>
                                        <?php else : ?>
                                            <input disabled type="text" class="form-control" id="namaperiksa" placeholder="Nama Pemeriksa">
                                        <?php endif; ?>
                                    </div>
                                    <div class="form-group">
                                        <label for="hasil">Hasil Pencacahan</label>
                                        <?php if (isset($blok1)) : ?>
                                            <select class="form-control mr-2" id="hasil" name="hasil" value="<?= $blok1[0]->hasil ?>">
                                                <option disabled value="0">Silahkan dipilih</option>
                                                <option value="1" <?php if ($blok1[0]->hasil == 1) echo 'selected = "Selected"'; ?>>Selesai Dicacah</option>
                                                <option value="2" <?php if ($blok1[0]->hasil == 2) echo 'selected = "Selected"'; ?>>Tidak Bersedia Dicacah</option>

                                            </select>

                                        <?php else : ?>
                                            <select disabled class="form-control mr-2" id="hasil" name="hasil" ?>>
                                                <option value="1">Selesai Dicacah</option>
                                                <option value="2">Tidak Bersedia Dicacah</option>

                                            </select>
                                        <?php endif; ?>
                                    </div>


                                </div>
                                <!-- /.card-body -->

                                <div class="card-footer">
                                    <?php if (isset($blok1)) : ?>
                                        <button type="submit" class="btn btn-primary">Simpan</button>
                                    <?php else : ?>
                                        <button style="display: none;" type="submit" class="btn sblok2 btn-primary">Simpan</button>
                                    <?php endif; ?>
                                </div>
                                </form>
                    </div>
                </div>


            </div>



            <div class="row">
                <!-- <?= var_dump($blok1[0]->hasil); ?> -->
                <div class="col-12 mb-2">
                    <a href="<?= base_url() ?>tambah_ruta/blok123/<?= $blok1[0]->id ?>"" class=" btn bg-navy">Kembali</a>
                    <?php if ($blok1[0]->hasil != 1) : ?>
                        <!-- <a href="<?= base_url() ?>tambah_ruta/blok7/<?= $blok1[0]->id ?>" class="btn btn-success next float-right">Selanjutnya</a> -->
                    <?php else : ?>
                        <a href="<?= base_url() ?>tambah_ruta/blok3_halaman/<?= $blok1[0]->id ?>" class="btn btn-success next float-right">Selanjutnya</a>
                    <?php endif; ?>
                </div>
            </div>
        </div><!-- /.container-fluid -->
    </section>

    <!-- /.content -->
</div>
<?php
$error = $this->session->flashdata('error');
if (!empty($error)) {
    echo $error;
}
?>
<?= $this->session->flashdata("informasi") ?>