<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale = 1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>

<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="<?php echo base_url(); ?>/assets/admin/bootstrap/css/bootstrap.min.css">

<!--
<link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/default/easyui.css">

<link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/color.css">
<link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/demo/demo.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>/assets/admin/plugins/Font-Awesome/css/all.min.css">
-->

<script type="text/javascript" src="https://www.jeasyui.com/easyui/jquery.min.js"></script>
<script type="text/javascript" src="https://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
<script src="<?php echo base_url(); ?>/assets/admin/bootstrap/js/bootstrap.min.js"></script>

<body>
    <div class="container">
    <center>
        <br/>
        <img src="/assets/images/<?php echo FLD_APP; ?>/swa_banhub_logo.png" width="100%">
        <div style="margin-top:10px;"></div>

        <h3>Masukkan<br/>Nomor WA dan NIK<br/>untuk cek Status</h3>
    </center>
    <form id="fmswas" method="post" enctype="multipart/form-data">
        <label for="nowad">Nomor WA:</label>
        <input type="text" min="3" max="20" id="nowad" name="nowad" placeholder="nomor WA terdaftar" style="width:100%" onkeypress="return (event.charCode !=8 && event.charCode ==0 || (event.charCode >= 48 && event.charCode <= 57))">
        <span class="info" id="ikoded"></span><br/>
        <label for="niks">NIK:</label>
        <input type="text" min="16" max="16" id="niks" name="niks" placeholder="NIK terdaftar" style="width:100%" onkeypress="return (event.charCode !=8 && event.charCode ==0 || (event.charCode >= 48 && event.charCode <= 57))">

        <span class="info" id="iniks"></span>
        <div style="margin-top:20px;"></div>
        <div class="lds-hourglass"></div>

        <center>
            <div class="row">
                <div class="col-sm-2"></div>
                <div class="col-sm-8">
                    <img src="/swa/kodekapkz" id='captchaimg' width="200">
                    <br />
                    <label for='message'>Ketikkan kode di atas disini :</label>
                    <input type="text" min="3" max="3" id="captcha_code" name="captcha_code" placeholder="masukkan captcha" style="width:50%">





                    <br />Gambar tak terbaca ? Klik <a href='javascript: refreshCaptcha();'>disini</a> untuk merefresh.</td>
                </div>
                <div clsss="col-sm-2"></div>
            </div>
            <div style="margin-top:20px"></div>
            <div id="istatus"></div>
            <a href="#" onclick="cekstatus()">
                <button type="button" onclick="cekstatus()" class="btn btn-danger" style="font-size:15px;width:125px;border-radius:5px;">CEK STATUS</button></a>
            <br />
            <div style="margin-bottom:5px"></div>
            <a href="/swa" onclick="batalkan()">
                <button id="batal" type="button" class="btn btn-info" style="font-size:15px;width:125px;border-radius:5px;">Kembali</button></a>
        </center>
    </form>

    <form id="tolengkapi" method="post" action="/lengkapi" class="inline">
        <input type="hidden" name="koded" value="1555">
    </form>
</div>
</body>


<script>
    $(document).ready(function() {});


    // if using synchronous loading, will be called once the DOM is ready
    /*
    turnstile.ready(function() {
        turnstile.render('#example-container', {
            sitekey: '0x4AAAAAAARhla0IfGgBVrBv',
            callback: function(token) {
                console.log(`Challenge Success ${token}`);
            },
        });
    });
    */

    function refreshCaptcha() {
        var img = document.images['captchaimg'];
        img.src = img.src.substring(0, img.src.lastIndexOf("z")) + "z/" + Math.random() * 1000;
        //img.src = img.src.substring(0, img.src.lastIndexOf("?")) + "?rand=" + Math.random() * 1000;

    }


    function cekstatus() {
        $('#istatus').hide(100);

        $('.lds-hourglass').css('display', 'inline-block');
        //check status pendaftar
        thenik = $('#niks').val();
        thenowa = $('#nowad').val();
        thecap = $('#captcha_code').val();
        $.ajax({
            type: 'post',
            url: "/cekkoded",
            data: {
                thenik: thenik,
                thenowa: thenowa,
                thecap: thecap,
                j : '1',
                "<?= csrf_token() ?>": "<?= csrf_hash() ?>"
            },
            success: function(data) {
                var respon = $.parseJSON(data);
                if (respon.thecap == 0) {
                    $('.lds-hourglass').css('display', 'none');
                    alert('Masukkan kode Captcha / Kode Captcha Salah');
                } else {
                    if (respon.adadata == 1) {
                        if (respon.status == 1) {
                            //daftardetilu(respon.pemudik);
                            window.location.replace("<?php echo base_url(); ?>/swadaftarsuksestest/" + respon.pemudik[0]['koded'] + '/1');

                        } else if (respon.status == 2) {
                            window.location.replace("<?php echo base_url(); ?>/swastatus2test/" + respon.pemudik[0]['nowa'] + "/" + respon.pemudik[0]['nik']);
                        } else if (respon.status == 3) {
                            window.location.replace("<?php echo base_url(); ?>/swastatus2test/" + respon.pemudik[0]['nowa'] + "/" + respon.pemudik[0]['nik']);

                        } else if (respon.status == 4) {
                            //cetak e-Tiket
                            //status 3 diganti menjadi 4 (artinya complete dan publish)
                            window.location.replace("<?php echo base_url(); ?>/swastatus3test/" + respon.pemudik[0]['nowa'] + "/" + respon.pemudik[0]['nik']);



                        } else if (respon.status == 9) {
                            cinfo = '<center><b>INFORMASI PENGISIAN</b></center><br/>';
                            cinfo += 'Mohon Maaf, anda tidak lolos Verifikasi dan Validasi<br/>';
                            cinfo += 'Terimakasih';
                            $('#istatus').html(cinfo);
                            $('#istatus').show();


                        }
                        $('.lds-hourglass').css('display', 'none');

                    } else {
                        $('.lds-hourglass').css('display', 'none');

                        cinfo = '<center><b>INFORMASI PENGISIAN</b></center><br/>';
                        cinfo += 'Kombinasi NIK dan NOMOR WA tidak dikenal<br/>';
                        cinfo += 'Terimakasih';
                        $('#istatus').html(cinfo);
                        $('#istatus').show();

                    }

                }
            }

        });


    }
</script>
<script>
    function daftardetilu(p) {
        $('#status').hide();
        $('#daftardetilok').hide();
        $('.boxinfod').hide();
        $('.dl').show();
        $('#daftardetil').show();
        $('#jdldaftardetil').html('<h4><b>STATUS : Status masih menunggu di Verifikasi, silakan cek kembali dalam 3x24 jam</b></h4>');

        $('#kd').val(p[0]['koded']);
        $('#nik1').val(p[0]['nik']);
        $('#nama1').val(p[0]['nama']);
        $('#usia1').val(p[0]['usia']);
        $('#ifilektp1').html(p[0]['ddukung']);
        $('#ifilektp1').show(1);
        if (p[1]) {
            $('#k2').val(p[1]['warga_id']);
            $('#nik2').val(p[1]['nik']);
            $('#nama2').val(p[1]['nama']);
            $('#usia2').val(p[1]['usia']);
            if (p[1]['usia'] >= 17) $('#ktp2').show();
            $('#ifilektp2').html(p[1]['ddukung']);
            $('#ifilektp2').show(1);

        }
        if (p[2]) {
            $('#k3').val(p[2]['warga_id']);
            $('#nik3').val(p[2]['nik']);
            $('#nama3').val(p[2]['nama']);
            $('#usia3').val(p[2]['usia']);
            if (p[2]['usia'] >= 17) $('#ktp3').show();
            $('#ifilektp3').html(p[2]['ddukung']);
            $('#ifilektp3').show(1);

        }
        if (p[3]) {
            $('#k4').val(p[3]['warga_id']);
            $('#nik4').val(p[3]['nik']);
            $('#nama4').val(p[3]['nama']);
            $('#usia4').val(p[3]['usia']);
            if (p[3]['usia'] >= 17) $('#ktp4').show();
            $('#ifilektp4').html(p[3]['ddukung']);
            $('#ifilektp4').show(1);

        }

    }
</script>
<style>
    body {
        font-family: 'Marcellus', serif;
        font-size: 18px;
        background-color: #B90049 !important;
        /* The image used */
        /* Full height */
        height: 100%;

        background: url("/assets/images/<?php echo FLD_APP; ?>/swa_bg.jpg") no-repeat center center fixed;
        -webkit-background-size: cover;
        -moz-background-size: cover;
        -o-background-size: cover;
        background-size: cover;

    }

    @media (max-width: 1000px) {
        body {
            background-image: none;
        }
    }



    #hdaftar {
        background-color: black;
        color: white;
    }



    .boxlogin {
        position: relative;
        margin-top: 150px;
        border-radius: 5px;
        border-style: dotted;
        background-color: #e1eae6;
        border-width: 2px;
        border-color: #FFA3D1 !important;
        padding: 10px;
        box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;
    }

    .boxdaftar {
        position: relative;
        margin-top: 0px;
        margin-left: 15px;
        min-height: 550px;
        padding: 10px;
        /*        background-color: rgba(225, 234, 230, 0.9);*/
        /*        box-shadow: rgba(60, 64, 67, 0.6) 0px 1px 2px 0px, rgba(60, 64, 67, 0.45) 0px 2px 6px 2px;*/
    }

    .boxdaftardetil {
        position: relative;
        margin-top: 0px;
        margin-left: 20px;
        min-height: 550px;
        padding: 5px;
        /*        background-color: rgba(225, 234, 230, 0.9);*/
        /*        box-shadow: rgba(60, 64, 67, 0.6) 0px 1px 2px 0px, rgba(60, 64, 67, 0.45) 0px 2px 6px 2px;*/
    }


    .info {
        font-size: 12px;
        font-weight: bold;
        color: crimson;
        padding: 5px;
    }

    #daftar {
        /*visibility:hidden;*/
        display: none;

    }

    input {
        margin-top: 3px;
        margin-bottom: 3px;
        height: 35px;
        padding: 5px;
        border-radius: 5px;
        border-style: solid;
        border-width: 1px;
        border-color: #FFA3D1 !important;

        font-size: 18px;
        background-color: rgba(255, 255, 255, 0.7);
    }

    label {
        font-weight: 400;
    }



    .loginft {
        font-size: 10px;
    }

    .card-body {
        padding: 20px;
    }

    input {
        color:#000 !important;
    }

    input[type="file"] {
        font-size: 17px;
        /*color: #b8b8b8;*/
        color: #888;
        /*color: transparent;*/
        width: 300px;


    }

    #awal {
        margin: 0;
        position: absolute;
        top: 350px;
        left: 50%;
        font-size: 25px;
        color: #666;
        width: 80%;
        transform: translate(-50%, -50%);
    }

    .boxinfo {
        /*display: none;*/
        position: absolut;
        margin-top: 50%;
        margin-left: auto;
        margin-right: auto;
        margin-top: 150px;
        border-radius: 5px;
        border-style: dotted;
        background-color: #EFCF84;
        opacity: .8;
        border-width: 1px;
        border-color: #FFA3D1 !important;

        padding: 10px;
        width: 50%;
        box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;

    }

    .boxinfod {
        display: none;
        position: absolut;
        margin-top: 15px;
        border-radius: 5px;
        border-style: dotted;
        background-color: #EFCF84;
        opacity: .9;
        border-width: 1px;
        border-color: #FFA3D1 !important;

        padding: 10px;
        margin-bottom: 30px;
        margin-left: 20px;
        width: 95%;
        box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;

    }

    #sukses {
        display: none;
        position: absolut;
        margin-top: 20%;
        border-radius: 2px;
        border-style: solid;
        background-color: #EFCF84;
        opacity: .9;
        border-width: 0px;
        border-color: #FFA3D1 !important;

        padding: 30px;
        margin-bottom: 30px;
        margin-left: 20px;
        min-height: 500px;
        width: 95%;
        box-shadow: rgba(60, 64, 67, 0.4) 0px 1px 2px 0px, rgba(60, 64, 67, 0.25) 0px 2px 6px 2px;

    }

    #istatus {
        display: none;
        position: absolut;
        margin-top: 5%;
        border-radius: 2px;
        border-style: solid;
        background-color: #EFCF84;
        opacity: .9;
        border-width: 0px;
        border-color: #FFA3D1 !important;
        padding: 30px;
        margin-bottom: 30px;
        margin-left: auto;
        margin-right:auto;
        min-height: 200px;
        width: 100%;
        box-shadow: rgba(60, 64, 67, 0.4) 0px 1px 2px 0px, rgba(60, 64, 67, 0.25) 0px 2px 6px 2px;

    }

    .lds-hourglass {
        /*display: inline-block;*/
        display: none;
        position: relative;
        width: 30px;
        height: 30px;
    }

    .lds-hourglass:after {
        content: " ";
        display: block;
        border-radius: 50%;
        width: 0;
        height: 0;
        margin: 2px;
        box-sizing: border-box;
        border: 16px solid #fff;
        border-color: #88f transparent #88f transparent;
        animation: lds-hourglass 1.2s infinite;
    }

    @keyframes lds-hourglass {
        0% {
            transform: rotate(0);
            animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
        }

        50% {
            transform: rotate(900deg);
            animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
        }

        100% {
            transform: rotate(1800deg);
        }
    }

    .container {
        color:#fff !important;
    }
</style>