<?php 
		require("header.php");
		if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $email = $_POST['email'];
    $address = $_POST['address'];
    $phoneNumber=$_POST['phone'];
    $city = $_POST['city'];
    $country = $_POST['country'];
    $code = $_POST['code'];
    $about = $_POST['about'];
    $privacy = $_POST['privacy'];
    $terms=$_POST['terms'];

    $sql1 = "UPDATE a_aboutus SET A_Description = ?, Email = ?,PhoneNumber=?, Address = ?, City = ?, Country = ?, PostalCode = ?, PrivacyAndPolicy = ?,Terms=?";
    $stmt = $con->prepare($sql1);
    
    $stmt->bind_param("sssssssss", $about, $email,$phoneNumber, $address, $city, $country, $code, $privacy,$terms);

    if ($stmt->execute()) {
        echo "Updated";
    } 
    
    $stmt->close();
}

?>
  <div class="main-content position-relative max-height-vh-100 h-100">
    <!-- Navbar -->
     <nav class="navbar navbar-main navbar-expand-lg px-0 mx-4 shadow-none border-radius-xl " id="navbarBlur" data-scroll="false">
      <div class="container-fluid py-1 px-3">
        <nav aria-label="breadcrumb">
          <ol class="breadcrumb bg-transparent mb-0 pb-0 pt-1 px-0 me-sm-6 me-5">
            <li class="breadcrumb-item text-sm"><a class="opacity-5 text-white" href="javascript:;">Pages</a></li>
            <li class="breadcrumb-item text-sm text-white active" aria-current="page">About</li>
          </ol>
          <h6 class="font-weight-bolder text-white mb-0">Profile</h6>
        </nav>
        <div class="collapse navbar-collapse mt-sm-0 mt-2 me-md-0 me-sm-4" id="navbar">
          <ul class="navbar-nav  justify-content-end">
          
            <li class="nav-item d-xl-none ps-3 d-flex align-items-center">
              <a href="javascript:;" class="nav-link text-white p-0" id="iconNavbarSidenav">
                <div class="sidenav-toggler-inner">
                  <i class="sidenav-toggler-line bg-white"></i>
                  <i class="sidenav-toggler-line bg-white"></i>
                  <i class="sidenav-toggler-line bg-white"></i>
                </div>
              </a>
            </li>
          </ul>
        </div>
      </div>
    </nav>
    <!-- End Navbar -->
    <div class="card shadow-lg mx-4 card-profile-bottom">
      <div class="card-body p-3">
        <div class="row gx-4">
          <div class="col-auto">
            <div class="avatar avatar-xl position-relative">
              <img src="assets/img/team-1.jpg" alt="profile_image" class="w-100 border-radius-lg shadow-sm">
            </div>
          </div>
          <div class="col-auto my-auto">
            <div class="h-100">
              <h5 class="mb-1">
                Alaa Al Abdallah
              </h5>
              <p class="mb-0 font-weight-bold text-sm">
                Ngos Leader
              </p>
            </div>
          </div>

        </div>
      </div>
    </div>
    <div class="container-fluid py-4">
      <div class="row">
        <div class="col-md-10">
          <div class="card">
            <div class="card-header pb-0">
              <div class="d-flex align-items-center">
                <p class="mb-0">Edit Application Profile</p>
              </div>
            </div>
            <div class="card-body">
              <form action="profile.php" method="POST">
                <p class="text-uppercase text-sm">User Information</p>
                <div class="row">
                  <?php
                  $sql = "SELECT*FROM a_aboutus";
                  $result = mysqli_query($con,$sql);
                  $row = mysqli_fetch_assoc($result);
                  $email = $row['Email'];
                  $address = $row['Address'];
                  $phoneNum=$row['PhoneNumber'];
                  $city = $row['City'];
                  $country = $row['Country'];
                  $code = $row['PostalCode'];
                  $about = $row['A_Description'];
                  $privacy = $row['PrivacyAndPolicy'];
                  $termsAndCon=$row['Terms'];
                  ?>
                  <div class="col-md-12">
                    <div class="form-group">
                      <label for="example-text-input" class="form-control-label">Email address</label>
                      <input class="form-control" name="email" type="email" value="<?php echo $email ?>" required>
                    </div>
                  </div>

                </div>
                <hr class="horizontal dark">
                <p class="text-uppercase text-sm">Contact Information</p>
                <div class="row">
                  <div class="col-md-12">
                    <div class="form-group">
                      <label for="example-text-input" class="form-control-label">Address</label>
                      <input class="form-control" name="address" type="text" value="<?php echo $address ?>" required>
                    </div>
                  </div>
                   <div class="col-md-3">
                    <div class="form-group">
                      <label for="example-text-input" class="form-control-label">Phone Number</label>
                      <input class="form-control" name="phone" type="text" value="<?php echo $phoneNum ?>" required>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                      <label for="example-text-input" class="form-control-label">City</label>
                      <input class="form-control" name="city" type="text" value="<?php echo $city ?>" required>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                      <label for="example-text-input" class="form-control-label">Country</label>
                      <input class="form-control" name="country" type="text" value="<?php echo $country ?>" required>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                      <label for="example-text-input" class="form-control-label">Postal code</label>
                      <input class="form-control" name="code" type="text" value="<?php echo $code ?>" required>
                    </div>
                  </div>
                </div>
                <hr class="horizontal dark">
                <p class="text-uppercase text-sm">About The Application</p>
                <div class="row">
                  <div class="col-md-12">
                    <div class="form-group">
                      <label for="About" class="form-control-label">Namleyet Setti</label>
                      <textarea name="about" id="" cols="10" rows="5" class="form-control" required><?php echo $about ?></textarea>
                    </div>
                  </div>
                </div>
                <div class="row">
                  <div class="col-md-12">
                    <div class="form-group">
                      <label for="Privacy" class="form-control-label">Privacy and policy of the Application</label>
                      <textarea name="privacy" id="" cols="10" rows="5" class="form-control" required><?php echo $privacy ?></textarea>
                    </div>
                  </div>
                </div>
                
                 <div class="row">
                  <div class="col-md-12">
                    <div class="form-group">
                      <label for="Terms" class="form-control-label">Terms and conditions of the Application</label>
                      <textarea name="terms" id="" cols="10" rows="5" class="form-control" required><?php echo $termsAndCon ?></textarea>
                    </div>
                  </div>
                </div>
                <button type="submit" class="btn btn-success">Save</button>
              </form>
            </div>
          </div>
        </div>

      </div>
    </div>
  </div>

  <!--   Core JS Files   -->
  <script src="assets/js/core/popper.min.js"></script>
  <script src="assets/js/core/bootstrap.min.js"></script>
  <script src="assets/js/plugins/perfect-scrollbar.min.js"></script>
  <script src="assets/js/plugins/smooth-scrollbar.min.js"></script>
  <script>
    var win = navigator.platform.indexOf('Win') > -1;
    if (win && document.querySelector('#sidenav-scrollbar')) {
      var options = {
        damping: '0.5'
      }
      Scrollbar.init(document.querySelector('#sidenav-scrollbar'), options);
    }
  </script>
  <!-- Github buttons -->
  <script async defer src="https://buttons.github.io/buttons.js"></script>
  <!-- Control Center for Soft Dashboard: parallax effects, scripts for the example pages etc -->
  <script src="assets/js/argon-dashboard.min.js?v=2.0.4"></script>
</body>

</html>