<?php
$title = 'Kích Hoạt Bản Quyền| ' . $DVR->site('title');
$body['header'] = '
';
$body['footer'] = '

';
require_once __DIR__ . '/header.php';
?>
    <style>
        body {
            background: #d2d6de;
            font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif, Open Sans;
            font-size: 14px;
            line-height: 1.42857;
            height: 100vh;
            padding: 0;
            margin: 0;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            font-weight: 400;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .form-control {
            background-color: #ffffff;
            background-image: none;
            border: 1px solid #999999;
            border-radius: 0;
            box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
            color: #333333;
            display: block;
            font-size: 14px;
            height: 34px;
            line-height: 1.42857;
            padding: 6px 12px;
            transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
            width: 100%;
        }

        .login-box {
            width: 360px;
            background: #fff;
            padding: 20px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            border-radius: 5px;
        }

        .login-logo {
            font-size: 35px;
            text-align: center;
            margin-bottom: 25px;
            font-weight: 300;
        }

        .login-box-msg {
            margin: 0;
            text-align: center;
            padding: 0 20px 20px 20px;
        }

        .has-feedback {
            position: relative;
        }

        .form-group {
            margin-bottom: 15px;
        }

        .has-feedback .form-control {
            padding-right: 42.5px;
        }

        .form-control-feedback {
            position: absolute;
            top: 0;
            right: 0;
            z-index: 2;
            display: block;
            width: 34px;
            height: 34px;
            line-height: 34px;
            text-align: center;
            pointer-events: none;
        }

        .btn-primary {
            background-color: #007bff;
            border-color: #007bff;
            color: #fff;
            padding: 10px 20px;
            border-radius: 5px;
            cursor: pointer;
            text-align: center;
        }

        .d-flex {
            display: flex;
            align-items: center;
        }

        .fs-12 {
            font-size: 12px;
        }

        .fw-medium {
            font-weight: 500;
        }

        .fw-bolder {
            font-weight: bold;
        }

        .ms-2 {
            margin-left: 8px;
        }

        .text-primary {
            color: #007bff;
        }
    </style>
</head>
<body>
    <div class="login-box">
        <div class="login-logo">
            <a href="/"><img src="<?=($DVR->site('logo'));?>" height="40px"/></a>
        </div>
        <div class="login-box-body">
            <h4 class="login-box-msg">Vui Lòng Nhập Key Bản Quyền</h4>
            <div class="form-group has-feedback">
                <input type="text" name="key" value="" placeholder="Key Bản Quyền" class="form-control" id="key" maxlength="80" size="30" required>
                <span class="glyphicon glyphicon-user form-control-feedback"></span>
            </div>
            <div class="form-group has-feedback">
                <input type="submit" name="submit" value="Tiếp Tục" id="btnLogin" class="btn btn-primary btn-block btn-flat">
            </div>
            <div class="form-group has-feedback">
                <div class="d-flex align-items-center">
                    <p class="fs-12 mb-0 fw-medium">Mua Key Tại Đây:</p>
                    <a class="text-primary fw-bolder ms-2" href="https://www.facebook.com/g.phu2712">Tại Đây</a>
                </div>
            </div>
        </div>
    </div>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script type="text/javascript">
    $("#btnLogin").on("click", function() {
        $('#btnLogin').html('<i class="fa fa-spinner fa-spin"></i> Loading...').prop('disabled', true);
        $.ajax({
            url: "<?=base_url('ajaxs/client/kich_hoat_ban_quyen.php');?>",
            method: "POST",
            dataType: "JSON",
            data: {
                key: $("#key").val(),
            },
            success: function(response) {
                if (response.status == 'success') {
                    cuteToast({
                        type: "success",
                        message: response.msg,
                        timer: 5000
                    });
                    setTimeout("location.href = '<?=BASE_URL('');?>';", 500);
                } else {
                    cuteToast({
                        type: "error",
                        message: response.msg,
                        timer: 5000
                    });
                }
                $('#btnLogin').html('Login').prop('disabled', false);
            },
            error: function() {
                cuteToast({
                    type: "error",
                    message: 'Không thể xử lý',
                    timer: 5000
                });
            }
        });
    });
    </script>
</body>
</html>
