<?php

$udata = $this->isLogedin();
$name = $udata["name"];
$username = $udata["username"];
$email = $udata["email"];
$id = $udata["id"];


if ($message = @$_SESSION["message"]) {
    if ($message["type"] == "error") {
        $mclass = "alert-danger";
        $mtitle = "Error!!";
    }else{
        $mclass = "alert-success";
        $mtitle = "Success!!";
    }
    ?>
    <div class="alert alert-block <?php echo $mclass ?> fade in">
        <button type="button" class="close close-sm" data-dismiss="alert">
            <i class="fa fa-times"></i>
        </button>
        <h4><?php echo $mtitle ?></h4>
        <?php
        echo $message["message"];
        unset($_SESSION["message"])
        ?>
    </div>
<?php } ?>
<div class="col-sm-12 users">
    <section class="panel">
        <header class="panel-heading">
            Edit Your Profile
        </header>
        <div class="panel-body" style="display: block;">
            <div class="form">
                <form class="cmxform form-horizontal " id="signupForm" method="post" action="">
                    <div class="form-group ">
                        <label for="name" class="control-label col-lg-3">Name</label>
                        <div class="col-lg-6">
                            <input name="id" type="hidden" value="<?php echo $id ?>" >
                            <input class=" form-control" id="firstname" name="name" type="text" value="<?php echo $name ?>" required>
                        </div>
                    </div>                    
                    <div class="form-group ">
                        <label for="username" class="control-label col-lg-3">Username</label>
                        <div class="col-lg-6">
                            <input class="form-control " id="username" name="username" type="text" value="<?php echo $username ?>">
                        </div>
                    </div>
                    <div class="form-group ">
                        <label for="password" class="control-label col-lg-3">Password</label>
                        <div class="col-lg-6">
                            <input class="form-control transparent-color" autocomplete="off" value="" id="password" name="password" type="password">
                           </div>
                    </div>
                    <div class="form-group ">
                        <label for="confirm_password" class="control-label col-lg-3">Confirm Password</label>
                        <div class="col-lg-6">
                            <input class="form-control " id="confirm_password" name="confirm_password" id="cpwd" type="password">
                        </div>
                    </div>
                    <div class="form-group ">
                        <label for="email" class="control-label col-lg-3">Email</label>
                        <div class="col-lg-6">
                            <input class="form-control " id="email" name="email" type="email"  value="<?php echo $email ?>">
                        </div>
                    </div>
                    


                    <div class="form-group">
                        <div class="col-lg-offset-3 col-lg-6">
                            <button class="btn btn-success" type="submit">Save</button>
                            <a class="btn btn-default" href="<?php echo HelperAdmin::getUrlView("galleries") ?>">Cancel</a>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </section>
</div>

<script type="text/javascript" src="./template/js/jquery.validate.min.js"></script>

<script type="text/javascript">

jQuery(document).ready(function() {
	initEditUser();
});

</script>