<?php
require ROOT . "/pages/start.php";
require ROOT . "/pages/header.php";
$columnNumber = 7;
?>
<link rel="stylesheet" type="text/css" href="/css/dataTable.css">
<style>
    .dt-buttons {
        text-align: end;
        margin-bottom: 15px
    }
</style>
<div class="page-header">
    <div class="page-header-left d-flex align-items-center">
        <div class="page-header-title">
            <h5 class="m-b-10 text-danger"><?= $this_on ?> ХИЧЭЭЛИЙН ЖИЛ</h5>
        </div>
        <ul class="breadcrumb">
            <li class="breadcrumb-item"><a href="/">Эхлэл</a></li>
            <li class="breadcrumb-item">Нууц үг солих</li>
        </ul>
    </div>
</div>
<div class="main-content">
    <div class="card stretch stretch-full">
        <div class="card-header">
            <h5 class="card-title">Нууц үг солих</h5>
        </div>
        <div class="card-body">
            <div class="row mb-4 align-items-center">
                <div class="col-lg-4">
                    <label for="old" class="fw-semibold">Одоогийн нууц үг: </label>
                </div>
                <div class="col-lg-8">
                    <div class="input-group">
                        <div class="input-group-text"><i class="feather-key"></i></div>
                        <input type="password" class="form-control" id="old" placeholder="Одоогийн нууц үгээ оруулна уу" required="">
                    </div>
                </div>
            </div>
            <div class="row mb-4 align-items-center">
                <div class="col-lg-4">
                    <label for="new" class="fw-semibold">Шинэ нууц үг: </label>
                </div>
                <div class="col-lg-8">
                    <div class="input-group">
                        <div class="input-group-text"><i class="feather-key"></i></div>
                        <input type="password" class="form-control" id="new" placeholder="Шинэ нууц үгээ оруулна уу" required="">
                    </div>
                </div>
            </div>
            <div class="row mb-4 align-items-center">
                <div class="col-lg-4">
                    <label for="newnew" class="fw-semibold">Шинэ нууц баталгаажуулах: </label>
                </div>
                <div class="col-lg-8">
                    <div class="input-group">
                        <div class="input-group-text"><i class="feather-key"></i></div>
                        <input type="password" class="form-control" id="newnew" placeholder="Шинэ нууц үгээ дахин оруулна уу" required="">
                    </div>
                </div>
            </div>
            <div class="row mb-3">
                <button class="btn btn-warning w-100" onclick="check()">СОЛИХ</button>
            </div>
            <div id="table"></div>
        </div>
    </div>
</div>
<?php require ROOT . "/pages/main-end.php"; ?>
<?php
require ROOT . "/pages/footer.php"; ?>
<script>
    function check() {
        $.ajax({
            url: "/profile/ajax",
            type: "POST",
            data: {
                mode: 2,
                old: $('#old').val(),
                newp: $('#new').val(),
                newpp: $('#newnew').val()
            },
            error: function(xhr, textStatus, errorThrown) {
                $("#table").html("<div class='alert alert-danger'>Алдаа гарлаа !</div>");
            },
            beforeSend: function() {
                $("#table").html("<div class='alert alert-warning'>Түр хүлээнэ үү ...</div>");
            },
            success: function(data) {
                $("#table").html(data);
            },
            async: true
        });

    }
</script>
<?php

require ROOT . "/pages/end.php";
?>