<?php
include("../classes/manager.class.php");
$m = new Manager();

if (!isset($_SESSION['sess_userid'])) {
    header("Location: " . PROJECT_ADMIN_URL);
    exit;
}

$action = array_key_exists("action", $_REQUEST) ? $_REQUEST['action'] : 0;

?>
<!DOCTYPE html>
<html lang="en">
<head>
    <?php include('includes/inc_head.php'); ?>
    <!--    <script language="JavaScript">-->
    <!--        function verify() {-->
    <!--            if (document.frm.old_pwd.value.length == 0) {-->
    <!--                alert("Incomplete information.");-->
    <!--                document.frm.old_pwd.focus();-->
    <!--                return false;-->
    <!--            }-->
    <!---->
    <!--            if (document.frm.new_pwd.value.length == 0) {-->
    <!--                alert("Incomplete information.");-->
    <!--                document.frm.new_pwd.focus();-->
    <!--                return false;-->
    <!--            }-->
    <!--            if (document.frm.new_pwd.value != document.frm.c_pwd.value) {-->
    <!--                alert("Confirm Password is not the same as New Password.");-->
    <!--                document.frm.new_pwd.value = "";-->
    <!--                document.frm.c_pwd.value = "";-->
    <!--                document.frm.new_pwd.focus();-->
    <!--                return false;-->
    <!--            }-->
    <!--            return true;-->
    <!--        }-->
    <!--    </script>-->
</head>

<body>
<!-- Start Page Loading -->
<div id="loader-wrapper">
    <div id="loader"></div>
    <div class="loader-section section-left"></div>
    <div class="loader-section section-right"></div>
</div>
<!-- End Page Loading -->
<div id="container">
    <?php include('includes/inc_top.php'); ?>
    <div class="row">
        <div class="col s12 m12">
            <div class="">
                <h3>Change Password</h3>
                <hr>
            </div>
            <div class="row">
                <?php if ($action == 10) { ?>
                    <div id='card-alert' class='card orange lighten-5'>
                        <div class='card-content orange-text'>
                            <p>WARNING : <strong>Attention! </strong>Invalid Old Password!</p>
                        </div>
                        <button type='button' class='close orange-text' data-dismiss='alert' aria-label='Close'>
                            <span aria-hidden='true'>x</span>
                        </button>
                    </div>
                <?php } ?>
                <div class="row">
                    <!--onSubmit="javascript: return verify()"-->
                    <form name="frm" id="change_pass_form" action="controller/login_ctl.php?action=3"
                          method="post"
                        >
                        <div class="col s12 form-group">
                            <div class="col s8">
                                <input type="hidden" name="param" value="<?= $param ?>">

                                <div class="row margin">
                                    <div class="input-field col s12">
                                        <input class="form-control" type="password" name="old_pwd" id="old_pwd">
                                        <label class="control-label" for="old_pwd">Old Password</label>
                                    </div>
                                </div>
                                <div class="row margin">
                                    <div class="input-field col s12">
                                        <input class="form-control" type="password" name="new_pwd" id="new_pwd">
                                        <label class="control-label" for="new_pwd">New Password</label>
                                    </div>
                                </div>
                                <div class="row margin">
                                    <div class="input-field col s12">
                                        <input class="form-control" type="password" name="c_pwd" id="c_pwd">
                                        <label class="control-label" for="c_pwd">Confirm Password</label>
                                    </div>
                                </div>
                                <div class="row margin">
                                    <div class="input-field col s12">
                                        <button type="submit" class="btn waves-effect waves-light">Submit</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <!--/row-->
            <!--/row-->
        </div>
        <!--/span-->
    </div>
    <!--/row-->
</div>
</div>
<?php include('includes/inc_footer.php'); ?>
<?php include('includes/inc_js.php'); ?>
</body>
</html>
