<?php
$this->output->set_header('X-FRAME-OPTIONS: DENY');
$this->output->set_header('X-XSS-Protection: 1; mode=block');
$this->output->set_header('Strict-Transport-Security: max-age=63072000; includeSubDomains; preload');
$this->output->set_header('X-Content-Type-Options: nosniff');
$this->db->select('*');
$this->db->from('web_management');
$this->db->join('web_style_2', 'web_management.style_web = web_style_2.id_web_style');
$wb_style = $this->db->get();
foreach ($wb_style->result() as $data) {
    $web_name = $data->nama_web;
    $web_description = $data->deskripsi;
    $web_meta_color = $data->meta_color;
    $web_navbar_color = $data->navbar_color;
    $web_box_color = $data->box_color;
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title><?= $web_name ?></title>
    <meta name="description" content="<?= $web_description ?>">
    <meta name="HandheldFriendly" content="True">
    <meta name="MobileOptimized" content="320">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui">
    <link rel="apple-touch-icon" sizes="144x144" href="<?= site_url('/public/assets/img/logo/logo.png') ?>">
    <link rel="apple-touch-icon" sizes="114x114" href="<?= site_url('/public/assets/img/logo/logo.png') ?>">
    <link rel="apple-touch-icon" sizes="72x72" href="<?= site_url('/public/assets/img/logo/logo.png') ?>">
    <link rel="apple-touch-icon" href="<?= site_url('/logo/public/assets/img/logo/logo.png') ?>">
    <link rel="shortcut icon" sizes="196x196" href="<?= site_url('/public/assets/img/logo/logo.png') ?>">
    <link rel="shortcut icon" href="<?= site_url('/public/assets/img/logo/logo.png') ?>">
    <meta name="msapplication-TileImage" content="<?= site_url('/public/assets/img/logo/logo.png') ?>">
    <meta name="msapplication-TileColor" content="<?= $web_meta_color; ?>">
    <meta name="theme-color" content="<?= $web_meta_color; ?>">
    <meta name="msapplication-navbutton-color" content="<?= $web_meta_color; ?>">
    <meta name="apple-mobile-web-app-status-bar-style" content="<?= $web_meta_color; ?>">
    <meta name="mobile-web-app-capable" content="yes">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

    <!-- ================== BEGIN BASE CSS STYLE ================== -->
    <link href="<?= base_url() ?>public/assets/css/apple/app.min.css" rel="stylesheet" />
    <link href="<?= base_url() ?>public/assets/plugins/ionicons/css/ionicons.min.css" rel="stylesheet" />
    <!-- ================== END BASE CSS STYLE ================== -->

</head>

<body class="pace-top">
    <!-- begin #page-loader -->
    <div id="page-loader" class="fade show"><span class="spinner"></span></div>
    <!-- end #page-loader -->
    <!-- begin #page-container -->
    <div class="container">
        <!-- begin login -->
        <div>
            <!-- begin brand -->
            <div style="padding: 15px;">
                <div style="text-align: center;">
                    <img src="<?= site_url('/public/assets/img/logo/logo.png') ?>" alt="logo" style="height: 100px;">
                    <br>
                    <h2><?= $web_description; ?></h2>
                </div>
            </div>
            <!-- end brand -->
            <!-- begin login-content -->
            <form action="<?= $action; ?>" method="post" enctype="multipart/form-data">
                <input type="text" hidden name="id_card" id="id_card" value="<?= $id_card; ?>" />
                <input type="date" hidden name="tanggal" id="tanggal" value="<?= $tanggal; ?>" />

                <div class='row'>

                    <div class='col-md-4'>
                        <div class='form-group'>
                            <label for='nik'>NIK : </label>
                            <input type="number" class="form-control" name="nik" id="nik" placeholder="NIK" value="<?= $nik; ?>" />
                            <?= form_error('nik') ?>
                        </div>
                    </div>

                    <div class='col-md-4'>
                        <div class='form-group'>
                            <label for='nama'>Nama : </label>
                            <input type="text" class="form-control" name="nama" id="nama" placeholder="Nama" value="<?= $nama; ?>" />
                            <?= form_error('nama') ?>
                        </div>
                    </div>

                    <div class='col-md-4'>
                        <div class='form-group'>
                            <label for='tempat_lahir'>Tempat Lahir : </label>
                            <input type="text" class="form-control" name="tempat_lahir" id="tempat_lahir" placeholder="Tempat Lahir" value="<?= $tempat_lahir; ?>" />
                            <?= form_error('tempat_lahir') ?>
                        </div>
                    </div>

                    <div class='col-md-4'>
                        <div class='form-group'>
                            <label for='tanggal_lahir'>Tanggal Lahir : </label>
                            <div class='input-group date'>
                                <div class='input-group-prepend'>
                                    <span class="input-group-text"><i class="fa fa-calendar"></i></span>
                                </div>
                                <input type="date" class="form-control" name="tanggal_lahir" id="tanggal_lahir" placeholder="Tanggal Lahir" value="<?= $tanggal_lahir; ?>" />
                            </div>
                            <?= form_error('tanggal_lahir') ?>
                        </div>
                    </div>

                    <div class='col-md-4'>
                        <div class='form-group'>
                            <label for='jenis_kelamin'>Jenis Kelamin : </label>
                            <?= cmb_enum('jenis_kelamin', 'kunjungan', 'jenis_kelamin', $jenis_kelamin); ?>
                            <?= form_error('jenis_kelamin') ?>
                        </div>
                    </div>

                    <div class='col-md-4'>
                        <div class='form-group'>
                            <label for='telepon'>Telepon : </label>
                            <input type="number" class="form-control" name="telepon" id="telepon" placeholder="Telepon" value="<?= $telepon; ?>" />
                            <?= form_error('telepon') ?>
                        </div>
                    </div>

                    <div class='col-lg-12'>
                        <div class='form-group'>
                            <label for='alamat'>Alamat : </label>
                            <input type="text" class="form-control" name="alamat" id="alamat" placeholder="Alamat" value="<?= $alamat; ?>" />
                            <?= form_error('alamat') ?>
                        </div>
                    </div>

                    <div class='col-md-4'>
                        <div class='form-group'>
                            <label for='dari'>Dari : </label>
                            <input type="text" class="form-control" name="dari" id="dari" placeholder="Dari" value="<?= $dari; ?>" />
                            <?= form_error('dari') ?>
                        </div>
                    </div>

                    <div class='col-md-4'>
                        <div class='form-group'>
                            <label for='tujuan'>Tujuan : </label>
                            <?= cmb_dinamis1('tujuan', 'tujuan', 'Tujuan', 'jabatan', 'nama_jabatan', 'id_jabatan', $tujuan); ?>
                            <!-- <input type="text" class="form-control" name="tujuan" id="tujuan" placeholder="Tujuan" value="<?= $tujuan; ?>" /> -->
                            <?= form_error('tujuan') ?>
                        </div>
                    </div>

                    <div class='col-md-4'>
                        <div class='form-group'>
                            <label for='sub_tujuan'>Sub Tujuan : </label>
                            <?= cmb_dinamis3('sub_tujuan', 'sub_tujuan', 'Sub Tujuan', 'jabatan', 'nama_jabatan', 'id_jabatan', $sub_tujuan); ?>
                            <!-- <input type="text" class="form-control" name="sub_tujuan" id="sub_tujuan" placeholder="Sub Tujuan" value="<?= $sub_tujuan; ?>" /> -->
                            <?= form_error('sub_tujuan') ?>
                        </div>
                    </div>

                    <div class='col-lg-12'>
                        <div class='form-group'>
                            <label for='keperluan'>Keperluan : </label>
                            <textarea class="form-control" name="keperluan" id="keperluan" placeholder="Keperluan" rows="3"><?= $keperluan; ?></textarea>
                            <?= form_error('keperluan') ?>
                        </div>
                    </div>

                </div>
                <div class='panel-footer'>
                    <button type="submit" class="btn btn-primary  pull-right"><?= $button ?></button>
                    <a href="javascript:window.history.go(-1);" class="btn btn-default">Batal</a>
                </div>
            </form>
            <!-- end login-content -->
        </div>

    </div>
    <!-- end page container -->

    <!-- ================== BEGIN BASE JS ================== -->
    <script src="<?= base_url('public/assets/js/app.min.js') ?>"></script>
    <script src="<?= base_url('public/assets/js/theme/apple.min.js') ?>"></script>
    <!-- ================== END BASE JS ================== -->

    <!-- ================== BEGIN ALERT JS ================== -->
    <script src="<?= base_url('public/assets/plugins/sweetalert/dist/sweetalert2.all.min.js') ?>"></script>
    <script src="<?= base_url('public/assets/js/myscript.js') ?>"></script>
    <!-- ================== END ALERT JS ================== -->

    <script>
        $(document).ready(function() {
            $('#tujuan').change(function() {
                var id = $(this).val();
                console.log(id);
                $.ajax({
                    url: "<?= base_url(); ?>home/get_sub_tujuan/" + id + "",
                    method: "GET",
                    // data : {id: id},
                    async: true,
                    dataType: 'json',
                    success: function(data) {
                        var html = '';
                        var i;
                        html +=
                            '<option value="" style="text-transform: uppercase;">-Pilih Sub Tujuan-</option>';
                        for (i = 0; i < data.length; i++) {
                            html += '<option value="' + data[i]
                                .id_jabatan + '">' + data[i]
                                .nama_jabatan + '</option>';
                        }
                        $('#sub_tujuan').html(html);
                    }
                });
            });
        });
    </script>
</body>

</html>