
<?php session_start(); ?>
<?php  if($_SESSION['roles'] != 'admin' && $_SESSION['roles'] != 'homeowner'  ){
    header('location: /stockmanagement/admin/login.php');
}?> 
<!DOCTYPE html>
<html lang="en">
<head>
    <?php 
        include('includes/header.php'); 
        include('includes/displaySuccessErrorSession.php');
    ?>
</head>
<body id="page-top">
      <!-- Page Wrapper -->
  <div id="wrapper">
  <?php include('includes/sidenav.php');  ?>
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">

    <!-- Main Content -->
    <div id="content">

        <?php include('includes/topnav.php');  ?>
       
        <!-- Begin Page Content -->
        <div class="container-fluid">
            <!-- Page Heading -->
            <div class="d-sm-flex align-items-center justify-content-between mb-4">
                <h1 class="h3 mb-0 text-gray-800">Profile</h1>
            </div>
            <!-- Content Row -->
          
            <div class="row">
                <!-- Area Chart -->
                <div class="col-md-6">
                    <div class="card shadow mb-4">
                        <!-- Card Body -->
                        <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
                            <h6 class="m-0 font-weight-bold text-primary">User Details</h6>
                        </div>
                        <div class="card-body">
                            <form action="api/update_admin_details.php" method="post">
                                <div class="form-group">
                                    <label for="" class="form-label">Username</label>
                                    <input type="text" class="form-control" placeholder="Enter Username" value="<?php echo $_SESSION['username']?>" name="username" required minlength="6">
                                    <input type="hidden" name="id" value="<?php echo $_SESSION['user_id']?>">
                                    <input type="hidden" name="type" value="username">
                                </div>
                                <div class="text-right">
                                    <button class="btn btn-primary" type="submit">Submit</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>

                <div class="col-md-6">
                    <div class="card shadow mb-4">
                        <!-- Card Body -->
                        <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
                            <h6 class="m-0 font-weight-bold text-primary">Reset Password</h6>
                        </div>
                        <div class="card-body">
                            <form action="api/update_admin_details.php" method="post">
                                <div class="form-group">
                                    <label for="" class="form-label">Password</label>
                                    <input type="password" class="form-control" placeholder="Enter passwrod" name="password" required>
                                </div>
                                <div class="form-group">
                                    <label for="" class="form-label">Confirm Password</label>
                                    <input type="password" class="form-control" placeholder="Enter confirm passwrod" name="confirm_password" required>
                                    <input type="hidden" name="id" value="<?php echo $_SESSION['user_id']?>">
                                    <input type="hidden" name="type" value="reset_password">
                                </div>
                                <div class="text-right">
                                    <button class="btn btn-primary" type="submit">Submit</button>
                                </div>
                            </form>
                            
                        </div>
                    </div>
                </div>
            </div>

            <!-- Content Row -->
        </div>
        <!-- /.container-fluid -->

    </div>
    <!-- End of Main Content -->
    <?php include('includes/footer.php') ?>
</div>
<!-- End of Content Wrapper -->
</div>
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
    <i class="fas fa-angle-up"></i>
</a>
<?php 
        include('includes/logout_modal.php');
        include('includes/footer_link.php');
        include('includes/unsetSuccessErrorSession.php');
    ?>
</body>

</html>