<?php $page = "User"; $action="edit"; ?>
<?php include "../../routes/user.php"; ?>
<?php include "../layout/header.php"; ?>
<body>

    <?php include "../layout/navbar.php"; ?>

    <div class="container-fluid">
      <div class="row">
        <?php include "../layout/sidenav.php"; ?>
        
        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-4">
            <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
                <h1 class="h2">Edit <?php echo $page; ?></h1>
            </div>
            <form action="" method="POST" autocomplete="off" enctype="multipart/form-data">
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <span class="input-group-text" id="name">Full Name</span>
                    </div>
                    <input type="text" value="<?php echo $user->name; ?>" name="name" class="form-control" placeholder="Write the Full Name here" aria-label="Full Name" aria-describedby="Full Name" required>
                    <div class="input-group-prepend ml-3">
                        <span class="input-group-text" id="username">Username</span>
                    </div>
                    <input type="text" value="<?php echo $user->username; ?>" name="username" class="form-control" placeholder="Write the username here" aria-label="Username" aria-describedby="Username" required>
                    <input type="hidden" value="<?php echo $user->password; ?>" name="password" class="form-control" placeholder="Write the password here" aria-label="Password" aria-describedby="Password" required>
                </div>
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <span class="input-group-text" id="email">Email</span>
                    </div>
                    <input type="email" value="<?php echo $user->email; ?>" name="email" class="form-control" placeholder="Write the email here" aria-label="Email" aria-describedby="Email" required>
                    <select class="custom-select ml-3" name="access_level" id="access_level" required>
                        <option>Select role</option>
                        <option value="2" <?php if ($user->access_level == 2) {?> selected <?php } ?>>User</option>
                        <option value="1" <?php if ($user->access_level == 1) {?> selected <?php } ?>>Admin</option>
                    </select>
                </div>
                <div class="input-group mb-3">
                    <input type="submit" class="btn btn-sm btn-primary gsa-text-white" name="edit" value="Edit">
                </div>
            </form>
        </main>

      </div>
    </div>

</body>
</html>