<!DOCTYPE html>
<html lang="en">
<!--begin::Head-->

<head>
    <?php require $_SERVER['DOCUMENT_ROOT'].'/hethong/head2.php';?>
    <title>Kiểm Tra Tên Miền | <?=$lxtdev['ten_web'];?></title>
    <?php require $_SERVER['DOCUMENT_ROOT'].'/hethong/nav.php';?>
</head>
<!--end::Head-->



<body id="kt_app_body" data-kt-app-layout="light-sidebar" data-kt-app-header-fixed="true"
    data-kt-app-sidebar-enabled="true" data-kt-app-sidebar-fixed="true" data-kt-app-sidebar-hoverable="true"
    data-kt-app-sidebar-push-header="true" data-kt-app-sidebar-push-toolbar="true"
    data-kt-app-sidebar-push-footer="true" data-kt-app-toolbar-enabled="true" class="app-default">
    <!--begin::Theme mode setup on page load-->
    <script>var defaultThemeMode = "light"; var themeMode; if (document.documentElement) { if (document.documentElement.hasAttribute("data-bs-theme-mode")) { themeMode = document.documentElement.getAttribute("data-bs-theme-mode"); } else { if (localStorage.getItem("data-bs-theme") !== null) { themeMode = localStorage.getItem("data-bs-theme"); } else { themeMode = defaultThemeMode; } } if (themeMode === "system") { themeMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; } document.documentElement.setAttribute("data-bs-theme", themeMode); }</script>
    <!--end::Theme mode setup on page load-->
    <!--begin::App-->
    <div class="d-flex flex-column flex-root app-root" id="kt_app_root">
        <!--begin::Page-->
        <div class="app-page flex-column flex-column-fluid" id="kt_app_page">
            <!--begin::Header-->

            <!--end::Header-->
            <!--begin::Wrapper-->
            <div class="app-wrapper flex-column flex-row-fluid" id="kt_app_wrapper">
                <!--begin::Sidebar-->
                <?php require $_SERVER['DOCUMENT_ROOT'].'/hethong/sider.php';?>
                <!--end::sidebar menu-->
                <!--begin::Footer-->
                
                <!--end::Footer-->
            </div>
            <!--end::Sidebar-->
            <!--begin::Main-->
            <div class="app-main flex-column flex-row-fluid" id="kt_app_main">
                <!--begin::Content wrapper-->
                <div class="d-flex flex-column flex-column-fluid">
                    <!--begin::Toolbar-->
                    <div id="kt_app_toolbar" class="app-toolbar py-3 py-lg-6">
                        <!--begin::Toolbar container-->
                        <div id="kt_app_toolbar_container" class="app-container container-fluid d-flex flex-stack">
                            <!--begin::Page title-->
                            <div class="page-title d-flex flex-column justify-content-center flex-wrap me-3">
                                <!--begin::Title-->
                                <h1
                                    class="page-heading d-flex text-dark fw-bold fs-3 flex-column justify-content-center my-0">
                                   Kiểm Tra Tên Miền</h1>
                                <!--end::Title-->
                                <!--begin::Breadcrumb-->
                                <ul class="breadcrumb breadcrumb-separatorless fw-semibold fs-7 my-0 pt-1">
                                    <!--begin::Item-->
                                    <li class="breadcrumb-item text-muted">
                                        <a href="/"
                                            class="text-muted text-hover-primary">Home</a>
                                    </li>
                                    <!--end::Item-->
                                    <!--begin::Item-->
                                    <li class="breadcrumb-item">
                                        <span class="bullet bg-gray-400 w-5px h-2px"></span>
                                    </li>
                                    <!--end::Item-->
                                    <!--begin::Item-->
                                    <li class="breadcrumb-item text-muted">Bảng Tính</li>
                                    <!--end::Item-->
                                </ul>
                                <!--end::Breadcrumb-->
                            </div>
                            <!--end::Page title-->
                            <!--begin::Actions-->
                            <div class="d-flex align-items-center gap-2 gap-lg-3">
                                <!--begin::Filter menu-->
                              <a href="#" class="btn btn-sm fw-bold btn-primary" data-bs-toggle="modal"
                                    data-bs-target="#kt_modal_create_app"><?=tien($user['money']);?>đ</a>
                                <!--end::Primary button-->
                            </div>
                            <!--end::Actions-->
                        </div>
                        <!--end::Toolbar container-->
                    </div>
            <div class="content d-flex flex-column flex-column-fluid" id="kt_content">
                    <!--begin::Container-->
                    <div class="container-xxl" id="kt_content_container">
                        <!--begin::Row-->
                        <div class="row gy-5 g-xl">
                            <div class="col-xl">

        <div class="row">
            <div class="container">
                <div class="main-grid">
                    <div class="main-content ">
                        <div class="card border">
                            <div class="card-body">
                                <div class="licensing-verification">
                                    <div class="alert alert-info text-center">
                                        <div class="row">
                                            <div class="col-12 pb-2">
                                                Công Cụ Kiểm Tra Tên Miền Xem Có Ai Mua Chưa
                                            </div>
                                            <div class="col-12">
                                                
                                            </div>
                                        </div>
                                    </div>

                                    <h3><strong>Chỉ nhập</strong> tên miền mà quý khách muốn mua</h3>


                                    <div class="row">
                                        <div class="col-sm-12">
                                            <div class="input-group input-group-lg">
                                                <input type="text" id="domain" name="domain" class="form-control" placeholder="Nhập tên miền cần kiểm tra" value="">
                                                <div class="input-group-btn input-group-append">
                                                  
                                            <button type="button" onclick="kiemtra()" class="btn btn-primary">
                                                <span id="button1" class="indicator-label">Kiểm Tra</span>
                                                <span id="button2" class="indicator-progress"
                                                    style="display: none;">Đang xử lý
                                                    <span
                                                        class="spinner-border spinner-border-sm align-middle ms-2"></span>
                                                </span>
                                            </button>
                                       
                                                </div>
                                            </div>
                                        </div>
                                    </div>
 <script>
                                        function kiemtra() {
                                            const button1 = document.getElementById("button1");
                                            const button2 = document.getElementById("button2");

                                            button1.style.display = "none";
                                            button2.style.display = "inline-block";
                                            button2.disabled = true;

                                            const username = "<?=$username?>";
                                            const domain = document.getElementById("domain").value;
                                          // Hiển thị sweet alert với nội dung xác nhận mua miền
                                            Swal.fire({
                                                title: 'Xác nhận check miền',
                                                text: "Bạn có chắc chắn muốn check miền này?",
                                                icon: 'warning',
                                                showCancelButton: true,
                                                confirmButtonColor: '#3085d6',
                                                cancelButtonColor: '#d33',
                                                confirmButtonText: 'Đồng ý',
                                                cancelButtonText: 'Hủy bỏ'
                                            }).then((result) => {
                                                if (result.isConfirmed) {
                                                    const xhr = new XMLHttpRequest();
                                                    xhr.open("POST", "/ajax/check/check.php");
                                                    xhr.setRequestHeader("Content-Type",
                                                        "application/x-www-form-urlencoded");
                                                    xhr.onload = function() {
                                                        button1.style.display = "inline-block";
                                                        button2.style.display = "none";
                                                        button2.disabled = false;

                                                        if (xhr.status === 200) {
                                                            const response = JSON.parse(xhr.responseText);
                                                            if (response.success) {
                                                                Swal.fire({
                                                                    icon: "success",
text: "Miền chưa được đăng ký",
                                                                }).then(function() {
                                                                    // Tải lại trang sau khi nhấn OK
                                                                    location.reload();
                                                                });
                                                            } else {
                                                                Swal.fire({
                                                                    icon: "error",
                                                                    text: response.message,
                                                                });
                                                            }
                                                        } else {
                                                            Swal.fire({
                                                                icon: "error",
                                                                text: "Error: " + xhr.statusText,
                                                            });
                                                        }
                                                    };
                                                    xhr.onerror = function() {
                                                        button1.style.display = "inline-block";
                                                        button2.style.display = "none";
                                                        button2.disabled = false;

                                                        Swal.fire({
                                                            icon: "error",
                                                            text: "Error: " + xhr.statusText,
                                                        });
                                                    };
                                                    xhr.send(
                                                        "username=" + encodeURIComponent(username) +
                                                   
                                                        "&domain=" + encodeURIComponent(domain)
                                                    );
                                                } else {
                                                    button1.style.display = "inline-block";
                                                    button2.style.display = "none";
                                                    button2.disabled = false;
                                                }
                                            });
                                        }
</script>
<br>
                                                            <h3>Cách sử dụng công cụ này:</h3>
                                                            <ul>
                                                                <li><strong>Chỉ nhập</strong> tên miền mà quý khách
                                                                    muốn mua
                                                                    của LXTDEV</li>
                                                                <li>Quý khách không nên bao gồm www. tiền tố trong
                                                                    trường hợp url trang web</li>
                                                            </ul>
                                                            <br>
                                               
                                                            </h2>
                                                            <br>
                                                            <br>
                                                            <br>
                                                        </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
</div>
                        <!--end::Row-->
                    </div>
                    <!--end::Container-->
                </div>
                </div>
                <!--end::Content wrapper-->
                <!--begin::Footer-->
                <?php require $_SERVER['DOCUMENT_ROOT'].'/hethong/foot.php';?>
                <!--end::Footer-->
            </div>
            <!--end:::Main-->
        </div>
        <!--end::Wrapper-->
    </div>
    <!--end::Page-->
    </div>



</body>
<!--end::Body-->

</html>