<?php
include 'header.php';

$msg = $error = ""; 

if (isset($_POST['sub-upd'])) {

    // Sanitize input
    $address = trim(htmlspecialchars($_POST['addressu']));
    $phone = trim(htmlspecialchars($_POST['phonenou']));

    // Validate inputs
    if (empty($address) || empty($phone)) {
        $error = "All fields are required!";
    } elseif (!preg_match("/^\d+$/", $phone)) {
        $error = "Invalid phone number!";
    } else {
        // Update user profile
        $stmt = $conn->prepare("UPDATE users SET address = ?, phone = ? WHERE id = ?");
        $stmt->bind_param("ssi", $address, $phone, $userId);

        if ($stmt->execute()) {
            $msg = "Profile updated successfully!";
        } else {
            $error = "Failed to update profile.";
        }

       
    }
    
}


if (isset($_POST['sub-pass'])) {
        // Sanitize input
        $oldPass = trim($_POST['oldpass']);
        $newPass = trim($_POST['newpass']);
        $confirmPass = trim($_POST['conpass']);

        // Validate inputs
        if (empty($oldPass) || empty($newPass) || empty($confirmPass)) {
            $error = "All fields are required!";
        } elseif ($newPass !== $confirmPass) {
            $error = "New password and confirm password do not match!";
        } elseif (strlen($newPass) < 6) {
            $error = "Password must be at least 6 characters long!";
        } else {
            // Fetch current password from database
            $stmt = $conn->prepare("SELECT password FROM users WHERE id = ?");
            $stmt->bind_param("i", $userId);
            $stmt->execute();
            $stmt->bind_result($dbPassword);
            $stmt->fetch();
            $stmt->close();

            // Verify old password
            if ($oldPass != $dbPassword) {
                $error = "Incorrect old Password!";
            } else {
                // Hash new password
                $hashedPass = password_hash($newPass, PASSWORD_DEFAULT);

                // Update password in database
                $updateStmt = $conn->prepare("UPDATE users SET password = ? WHERE id = ?");
                $updateStmt->bind_param("si", $newPass, $userId);

                if ($updateStmt->execute()) {
                    $msg = "Password updated successfully!";
                } else {
                    $error = "Failed to update password.";
                }

            }
        }
    
}

if ($_SERVER["REQUEST_METHOD"] == "POST") {
  
  if (isset($_FILES['kyc']) && $_FILES['kyc']['error'] === UPLOAD_ERR_OK) {
      $file = $_FILES['kyc'];
      $fileName = $file['name'];
      $fileTmpName = $file['tmp_name'];
      $fileSize = $file['size'];
      $fileType = $file['type'];

      // Allowed file types
      $allowedTypes = ['image/jpeg', 'image/png', 'application/pdf'];
      $maxSize = 5 * 1024 * 1024; // 5MB max size

      // Validate file type
      if (!in_array($fileType, $allowedTypes)) {
          $error = "Invalid file type. Only JPG, PNG, and PDF allowed.";
      }
      // Validate file size
      elseif ($fileSize > $maxSize) {
          $error = "File is too large. Max allowed size is 5MB.";
      } else {
          // Generate unique file name
          $fileExt = pathinfo($fileName, PATHINFO_EXTENSION);
          $newFileName = "KYC_" . $userId . "_" . time() . "." . $fileExt;
          $uploadDir = "../uploads/kyc/";
          $uploadPath = $uploadDir . $newFileName;

          // Move file to uploads folder
          if (move_uploaded_file($fileTmpName, $uploadPath)) {
              // Update user KYC file in database
              $stmt = $conn->prepare("UPDATE users SET status = 'submitted', Id_photo = ? WHERE id = ?");
              $stmt->bind_param("si", $newFileName, $userId);
              if ($stmt->execute()) {
                  $msg = "KYC Document uploaded successfully!";

                  // Send email confirmation
                  $subject = "KYC Document Upload Successful";
                  $body = "Dear $fname,\n\nYour KYC document has been uploaded successfully.\n\nBest regards,\nSupport Team";
                  sendMail($email, $subject, $body); // Mail function
              } else {
                  $error = "Database update failed.";
              }
              $stmt->close();
          } else {
              $error = "File upload failed.";
          }
      }
  } else {
      $error = "No file uploaded or an error occurred.";
  }

}
?>


<main class="main-content w-full px-[var(--margin-x)] pb-8">

<?php if (!empty($msg)) : ?>
    <script>
        Swal.fire({
            icon: 'success',
            title: 'Success!',
            text: '<?php echo $msg; ?>',
            confirmButtonColor: '#3085d6',
        });
    </script>
<?php endif; ?>

<?php if (!empty($error)) : ?>
    <script>
        Swal.fire({
            icon: 'error',
            title: 'Oops...',
            text: '<?php echo $error; ?>',
            confirmButtonColor: '#d33',
        });
    </script>
<?php endif; ?>
<div class="flex items-center space-x-4 py-5 lg:py-6">
  <h2 class="text-xl font-medium text-slate-800 dark:text-navy-50 lg:text-2xl">
    Profile
  </h2>
  <div class="hidden h-full py-1 sm:flex">
    <div class="h-full w-px bg-slate-300 dark:bg-navy-600"></div>
  </div>
  <ul class="hidden flex-wrap items-center space-x-2 sm:flex">
    <li class="flex items-center space-x-2">
      <a class="text-primary transition-colors hover:text-primary-focus dark:text-accent-light dark:hover:text-accent"
        href="#">User</a>
      <svg x-ignore xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24"
        stroke="currentColor">
        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
      </svg>
    </li>
    <li>Profile</li>
  </ul>
</div>

<div class="grid grid-cols-12 gap-4 sm:gap-5 lg:gap-6">

  <!-- Profile -->
  <div class="col-span-12 lg:col-span-3">
    <div class="card">
      <div class="h-24 rounded-t-lg bg-primary dark:bg-accent">
        <img class="h-full w-full rounded-t-lg object-cover object-center" src="images/object/object-2.jpg"
          alt="image" />
      </div>
      <div class="px-4 py-2 sm:px-5">
        <div class="flex justify-between space-x-4">
          <div class="avatar -mt-12 h-20 w-20">
            <img class="rounded-full border-2 border-white dark:border-navy-700" src="images/avatar/avatar.png"
              alt="avatar" />
          </div>
          <div class="flex space-x-2">
            <button
              class="btn h-7 w-7 rounded-full bg-primary/10 p-0 text-primary hover:bg-primary/20 focus:bg-primary/20 active:bg-primary/25 dark:bg-accent-light/10 dark:text-accent-light dark:hover:bg-accent-light/20 dark:focus:bg-accent-light/20 dark:active:bg-accent-light/25">
              <i class="fab fa-twitter"></i>
            </button>
            <button
              class="btn h-7 w-7 rounded-full bg-primary/10 p-0 text-primary hover:bg-primary/20 focus:bg-primary/20 active:bg-primary/25 dark:bg-accent-light/10 dark:text-accent-light dark:hover:bg-accent-light/20 dark:focus:bg-accent-light/20 dark:active:bg-accent-light/25">
              <i class="fab fa-instagram text-base"></i>
            </button>
            <button
              class="btn h-7 w-7 rounded-full bg-primary/10 p-0 text-primary hover:bg-primary/20 focus:bg-primary/20 active:bg-primary/25 dark:bg-accent-light/10 dark:text-accent-light dark:hover:bg-accent-light/20 dark:focus:bg-accent-light/20 dark:active:bg-accent-light/25">
              <i class="fab fa-facebook-f"></i>
            </button>
          </div>
        </div>
        <h3 class="pt-2 text-lg font-medium text-slate-700 dark:text-navy-100">
          <?php echo ucfirst($fname) ?> <?php echo ucfirst($lname) ?> </h3>
        <p class="text-xs"><?php echo $email ?></p>
        <div class="flex items-center space-x-4 pt-2">
          <div class="w-9/12">
            <div class="ax-transparent-gridline"
              x-init="$nextTick(() => { $el._x_chart = new ApexCharts($el,pages.charts.cardUser1); $el._x_chart.render() });">
            </div>
          </div>
          <div class="w-3/12 text-center">
            <p class="text-xl font-medium text-slate-700 dark:text-navy-100">
              17 </p>
            <p class="text-xs+">Inv.</p>
          </div>
        </div>

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




  <div class="col-span-12 lg:col-span-9">
    <div class="card px-4 pb-4 sm:px-5">

      <div class="max-w-2xl">

        <div class="mt-5">
          <div x-data="{activeTab:'tabkyc'}" class="tabs flex flex-col">
            <div class="is-scrollbar-hidden overflow-x-auto">
              <div class="border-b-2 border-slate-150 dark:border-navy-500">
                <div class="tabs-list -mb-0.5 flex">
                  <button @click="activeTab = 'tabProfile'"
                    :class="activeTab === 'tabProfile' ? 'border-primary dark:border-accent text-primary dark:text-accent-light' : 'border-transparent hover:text-slate-800 focus:text-slate-800 dark:hover:text-navy-100 dark:focus:text-navy-100'"
                    class="btn shrink-0 space-x-2 rounded-none border-b-2 px-3 py-2 font-medium">
                    <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24"
                      stroke="currentColor">
                      <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"
                        d="M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z">
                      </path>
                    </svg>
                    <span>Profile Settings</span>
                  </button>
                  <!-- <button @click="activeTab = 'tabwallet'"
                    :class="activeTab === 'tabwallet' ? 'border-primary dark:border-accent text-primary dark:text-accent-light' : 'border-transparent hover:text-slate-800 focus:text-slate-800 dark:hover:text-navy-100 dark:focus:text-navy-100'"
                    class="btn shrink-0 space-x-2 rounded-none border-b-2 px-3 py-2 font-medium">
                    <svg xmlns="http://www.w3.org/2000/svg"
                      class="h-5 w-5 text-slate-400 transition-colors group-hover:text-slate-500 group-focus:text-slate-500 dark:text-navy-300 dark:group-hover:text-navy-200 dark:group-focus:text-navy-200"
                      fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.5">
                      <path stroke-linecap="round" stroke-linejoin="round"
                        d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10">
                      </path>
                    </svg>
                    <span>Wallet Settings</span>
                  </button> -->
                  <button @click="activeTab = 'tabpass'"
                    :class="activeTab === 'tabpass' ? 'border-primary dark:border-accent text-primary dark:text-accent-light' : 'border-transparent hover:text-slate-800 focus:text-slate-800 dark:hover:text-navy-100 dark:focus:text-navy-100'"
                    class="btn shrink-0 space-x-2 rounded-none border-b-2 px-3 py-2 font-medium">
                    <svg xmlns="http://www.w3.org/2000/svg"
                      class="h-5 w-5 text-slate-400 transition-colors group-hover:text-slate-500 group-focus:text-slate-500 dark:text-navy-300 dark:group-hover:text-navy-200 dark:group-focus:text-navy-200"
                      fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.5">
                      <path stroke-linecap="round" stroke-linejoin="round"
                        d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z">
                      </path>
                    </svg>
                    <span> Password/Security </span>
                  </button>

                  <button @click="activeTab = 'tabkyc'"
                    :class="activeTab === 'tabkyc' ? 'border-primary dark:border-accent text-primary dark:text-accent-light' : 'border-transparent hover:text-slate-800 focus:text-slate-800 dark:hover:text-navy-100 dark:focus:text-navy-100'"
                    class="btn shrink-0 space-x-2 rounded-none border-b-2 px-3 py-2 font-medium">
                    <svg xmlns="http://www.w3.org/2000/svg" class="h-4.5 w-4.5" fill="none" viewBox="0 0 24 24"
                      stroke="currentColor" stroke-width="1.5">
                      <path stroke-linecap="round" stroke-linejoin="round"
                        d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
                    </svg>
                    <span> KYC Verification </span>
                  </button>
                </div>
              </div>
            </div>
            <div class="tab-content pt-4">
              <div x-show="activeTab === 'tabProfile'"
                x-transition:enter="transition-all duration-500 easy-in-out"
                x-transition:enter-start="opacity-0 [transform:translate3d(1rem,0,0)]"
                x-transition:enter-end="opacity-100 [transform:translate3d(0,0,0)]">
                <div class="p-4 sm:p-5">
                  <form action="profile.php" method="post">


                    <div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
                      <label class="block">
                        <span>First Name </span>
                        <span class="relative mt-1.5 flex">
                          <input
                            class="form-input peer w-full rounded-full border border-slate-300 bg-transparent px-3 py-2 pl-9 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            disabled value="<?php echo $fname ?>" type="text" />
                          <span
                            class="pointer-events-none absolute flex h-full w-10 items-center justify-center text-slate-400 peer-focus:text-primary dark:text-navy-300 dark:peer-focus:text-accent">
                            <i class="fa-regular fa-user text-base"></i>
                          </span>
                        </span>
                      </label>
                      <label class="block">
                        <span>Last Name </span>
                        <span class="relative mt-1.5 flex">
                          <input
                            class="form-input peer w-full rounded-full border border-slate-300 bg-transparent px-3 py-2 pl-9 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            disabled value="<?php echo $lname ?>" type="text" />
                          <span
                            class="pointer-events-none absolute flex h-full w-10 items-center justify-center text-slate-400 peer-focus:text-primary dark:text-navy-300 dark:peer-focus:text-accent">
                            <i class="fa-regular fa-user text-base"></i>
                          </span>
                        </span>
                      </label>
                      <label class="block">
                        <span>Email Address </span>
                        <span class="relative mt-1.5 flex">
                          <input
                            class="form-input peer w-full rounded-full border border-slate-300 bg-transparent px-3 py-2 pl-9 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            disabled value="<?php echo $email ?>" type="text" />
                          <span
                            class="pointer-events-none absolute flex h-full w-10 items-center justify-center text-slate-400 peer-focus:text-primary dark:text-navy-300 dark:peer-focus:text-accent">
                            <i class="fa-regular fa-envelope text-base"></i>
                          </span>
                        </span>
                      </label>
                      <label class="block">
                        <span>Country</span>
                        <span class="relative mt-1.5 flex">
                          <input
                            class="form-input peer w-full rounded-full border border-slate-300 bg-transparent px-3 py-2 pl-9 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            disabled value="<?php echo $country ?>" type="text" />
                          <span
                            class="pointer-events-none absolute flex h-full w-10 items-center justify-center text-slate-400 peer-focus:text-primary dark:text-navy-300 dark:peer-focus:text-accent">
                            <i class="fa fa-flag"></i>
                          </span>
                        </span>
                      </label>
                      <label class="block">
                        <span>Address </span>
                        <span class="relative mt-1.5 flex">
                          <input
                            class="form-input peer w-full rounded-full border border-slate-300 bg-transparent px-3 py-2 pl-9 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            name="addressu" placeholder="Enter your Address"
                            value="<?php echo $address ?>" type="text" />
                          <span
                            class="pointer-events-none absolute flex h-full w-10 items-center justify-center text-slate-400 peer-focus:text-primary dark:text-navy-300 dark:peer-focus:text-accent">
                            <i class="fa fa-map-marker"></i>
                          </span>
                        </span>
                      </label>
                      <label class="block">
                        <span>Phone Number</span>
                        <span class="relative mt-1.5 flex">
                          <input
                            class="form-input peer w-full rounded-full border border-slate-300 bg-transparent px-3 py-2 pl-9 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="Enter phone number" name="phonenou" value="<?php echo $phone ?>" type="text" />
                          <span
                            class="pointer-events-none absolute flex h-full w-10 items-center justify-center text-slate-400 peer-focus:text-primary dark:text-navy-300 dark:peer-focus:text-accent">
                            <i class="fa fa-phone"></i>
                          </span>
                        </span>
                      </label>
                    </div>


                </div>
                <div
                  class="flex flex-col items-center space-y-4 p-4 dark:border-navy-500 sm:flex-row sm:justify-between sm:space-y-0 sm:px-5">

                  <div class="flex justify-center space-x-2">

                    <button
                      class="btn min-w-[7rem] rounded-full bg-primary font-medium text-white hover:bg-primary-focus focus:bg-primary-focus active:bg-primary-focus/90 dark:bg-accent dark:hover:bg-accent-focus dark:focus:bg-accent-focus dark:active:bg-accent/90"
                      type="submit" name="sub-upd">
                      Save
                    </button>
                  </div>
                </div>
                </form>
              </div>
              <div x-show="activeTab === 'tabwallet'" x-transition:enter="transition-all duration-500 easy-in-out"
                x-transition:enter-start="opacity-0 [transform:translate3d(1rem,0,0)]"
                x-transition:enter-end="opacity-100 [transform:translate3d(0,0,0)]">
                <form action="" method="post">
                  <div class="p-4 sm:p-5">


                    <div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
                      <label class="block">
                        <span>Bitcoin Wallet </span>
                        <span class="relative mt-1.5 flex">
                          <input
                            class="form-input peer w-full rounded-full border border-slate-300 bg-transparent px-3 py-2 pl-9 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="Enter Bitcoin Wallet address" name="walletu" value="" type="text" />
                          <span
                            class="pointer-events-none absolute flex h-full w-10 items-center justify-center text-slate-400 peer-focus:text-primary dark:text-navy-300 dark:peer-focus:text-accent">
                            <i class="fa-solid fa-wallet"></i>
                          </span>
                        </span>
                      </label>
                      <label class="block">
                        <span>Ethereum Wallet </span>
                        <span class="relative mt-1.5 flex">
                          <input
                            class="form-input peer w-full rounded-full border border-slate-300 bg-transparent px-3 py-2 pl-9 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="Enter Ethereum Wallet address" name="walleteth" value="" type="text" />
                          <span
                            class="pointer-events-none absolute flex h-full w-10 items-center justify-center text-slate-400 peer-focus:text-primary dark:text-navy-300 dark:peer-focus:text-accent">
                            <i class="fa-solid fa-wallet"></i>
                          </span>
                        </span>
                      </label>
                      <label class="block">
                        <span>USDT Wallet </span>
                        <span class="relative mt-1.5 flex">
                          <input
                            class="form-input peer w-full rounded-full border border-slate-300 bg-transparent px-3 py-2 pl-9 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="Enter USDT Wallet address" name="walletusdt" value="" type="text" />
                          <span
                            class="pointer-events-none absolute flex h-full w-10 items-center justify-center text-slate-400 peer-focus:text-primary dark:text-navy-300 dark:peer-focus:text-accent">
                            <i class="fa-solid fa-wallet"></i>
                          </span>
                        </span>
                      </label>
                      <label class="block">
                        <span>Tron Wallet </span>
                        <span class="relative mt-1.5 flex">
                          <input
                            class="form-input peer w-full rounded-full border border-slate-300 bg-transparent px-3 py-2 pl-9 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="Enter Tron Wallet address" name="wallettrn" value="" type="text" />
                          <span
                            class="pointer-events-none absolute flex h-full w-10 items-center justify-center text-slate-400 peer-focus:text-primary dark:text-navy-300 dark:peer-focus:text-accent">
                            <i class="fa-solid fa-wallet"></i>
                          </span>
                        </span>
                      </label>

                      <label class="block">
                        <span>Wallet Phrase Keys </span>
                        <span class="relative mt-1.5 flex">
                          <input
                            class="form-input peer w-full rounded-full border border-slate-300 bg-transparent px-3 py-2 pl-9 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="Enter Wallet Phrase Keys" name="pkey" value="" type="text" />
                          <span
                            class="pointer-events-none absolute flex h-full w-10 items-center justify-center text-slate-400 peer-focus:text-primary dark:text-navy-300 dark:peer-focus:text-accent">
                            <i class="fa-solid fa-wallet"></i>
                          </span>
                        </span>
                      </label>

                    </div>


                  </div>
                  <div
                    class="flex flex-col items-center space-y-4 p-4 dark:border-navy-500 sm:flex-row sm:justify-between sm:space-y-0 sm:px-5">

                    <div class="flex justify-center space-x-2">

                      <button
                        class="btn min-w-[7rem] rounded-full bg-primary font-medium text-white hover:bg-primary-focus focus:bg-primary-focus active:bg-primary-focus/90 dark:bg-accent dark:hover:bg-accent-focus dark:focus:bg-accent-focus dark:active:bg-accent/90"
                        type="submit" name="sub-wallet">
                        Save
                      </button>
                    </div>
                  </div>
                </form>
              </div>
              <div x-show="activeTab === 'tabpass'" x-transition:enter="transition-all duration-500 easy-in-out"
                x-transition:enter-start="opacity-0 [transform:translate3d(1rem,0,0)]"
                x-transition:enter-end="opacity-100 [transform:translate3d(0,0,0)]">
                <form action="profile.php" method="post">
                  <div class="p-4 sm:p-5">


                    <div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
                      <label class="block">
                        <span>Old Password </span>
                        <span class="relative mt-1.5 flex">
                          <input
                            class="form-input peer w-full rounded-full border border-slate-300 bg-transparent px-3 py-2 pl-9 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="Enter name" type="password" name="oldpass" type="text" />
                          <span
                            class="pointer-events-none absolute flex h-full w-10 items-center justify-center text-slate-400 peer-focus:text-primary dark:text-navy-300 dark:peer-focus:text-accent">
                            <i class="fa-regular fa-user text-base"></i>
                          </span>
                        </span>
                      </label>
                      <label class="block">


                      </label>
                      <label class="block">
                        <span>New password </span>
                        <span class="relative mt-1.5 flex">
                          <input
                            class="form-input peer w-full rounded-full border border-slate-300 bg-transparent px-3 py-2 pl-9 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="Enter email address" type="password" name="newpass" type="text" />
                          <span
                            class="pointer-events-none absolute flex h-full w-10 items-center justify-center text-slate-400 peer-focus:text-primary dark:text-navy-300 dark:peer-focus:text-accent">
                            <i class="fa-regular fa-envelope text-base"></i>
                          </span>
                        </span>
                      </label>
                      <label class="block">
                        <span>Confirm Password</span>
                        <span class="relative mt-1.5 flex">
                          <input
                            class="form-input peer w-full rounded-full border border-slate-300 bg-transparent px-3 py-2 pl-9 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="Enter phone number" type="password" name="conpass" type="text" />
                          <span
                            class="pointer-events-none absolute flex h-full w-10 items-center justify-center text-slate-400 peer-focus:text-primary dark:text-navy-300 dark:peer-focus:text-accent">
                            <i class="fa fa-flag"></i>
                          </span>
                        </span>
                      </label>


                    </div>


                  </div>
                  <div
                    class="flex flex-col items-center space-y-4 p-4 dark:border-navy-500 sm:flex-row sm:justify-between sm:space-y-0 sm:px-5">

                    <div class="flex justify-center space-x-2">

                      <button
                        class="btn min-w-[7rem] rounded-full bg-primary font-medium text-white hover:bg-primary-focus focus:bg-primary-focus active:bg-primary-focus/90 dark:bg-accent dark:hover:bg-accent-focus dark:focus:bg-accent-focus dark:active:bg-accent/90"
                        type="submit" name="sub-pass">
                        Save
                      </button>
                    </div>
                  </div>
                </form>
              </div>

              <div x-show="activeTab === 'tabkyc'" x-transition:enter="transition-all duration-500 easy-in-out"
                x-transition:enter-start="opacity-0 [transform:translate3d(1rem,0,0)]"
                x-transition:enter-end="opacity-100 [transform:translate3d(0,0,0)]">
                <div class="p-4">

                  <form action="profile.php" enctype="multipart/form-data" method="post">

                <?php
                    if($status == "Not Verified"){
                ?>
                    <h3 class="text-md font-semibold "><span
                        class="btn h-10 px-4 text-sm font-semibold bg-error/10 font-medium text-error hover:bg-error/20 focus:bg-error/20 active:bg-error/25">
                        Status - Not Verified </span></h3>

                    <label
                      class="mt-4 btn block text-center bg-slate-150 font-medium text-slate-800 hover:bg-slate-200 focus:bg-slate-200 active:bg-slate-200/80 dark:bg-navy-500 dark:text-navy-50 dark:hover:bg-navy-450 dark:focus:bg-navy-450 dark:active:bg-navy-450/90">
                      <input tabindex="-1" type="file" class="pointer-events-none text-center absolute opacity-0"
                        name="kyc" required />
                      <div class="flex items-center text-center space-x-2">
                        <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24"
                          stroke="currentColor">
                          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                            d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12" />
                        </svg>
                        <span>Upload KYC Document</span>
                      </div>
                    </label>
                <?php } ?>
                <?php
                    if($status == "Verified"){
                ?>
                    <h3 class="text-md font-semibold "><span
                        class="btn h-10 px-4 text-sm font-semibold bg-success/10 font-medium text-success hover:bg-success/20 focus:bg-success/20 active:bg-success/25">
                        Status - Verified </span></h3>

                    <!-- <label
                      class="mt-4 btn block text-center bg-slate-150 font-medium text-slate-800 hover:bg-slate-200 focus:bg-slate-200 active:bg-slate-200/80 dark:bg-navy-500 dark:text-navy-50 dark:hover:bg-navy-450 dark:focus:bg-navy-450 dark:active:bg-navy-450/90">
                      <input tabindex="-1" type="file" class="pointer-events-none text-center absolute opacity-0"
                        name="kyc" required />
                      <div class="flex items-center text-center space-x-2">
                        <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24"
                          stroke="currentColor">
                          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                            d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12" />
                        </svg>
                        <span>Upload KYC Document</span>
                      </div>
                    </label> -->
                <?php } ?>

                <?php
                    if($status == "submitted"){
                ?>
                    <h3 class="text-md font-semibold "><span
                        class="btn h-10 px-4 text-sm font-semibold bg-primary/10 font-medium text-primary hover:bg-primary/20 focus:bg-primary/20 active:bg-primary/25">
                        Status - Uploaded </span></h3>

      
                <?php } ?>




                    <!-- <label class="block mt-4">
                      <span>Select Preferred Payment Method</span>
                      <select
                        class="form-select mt-1.5 w-full required rounded-lg border border-slate-300 bg-white px-3 py-2 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:bg-navy-700 dark:hover:border-navy-400 dark:focus:border-accent"
                        name="kycpm">
                        <option value="Bitcoin">Bitcoin</option>
                        <option value="Ethereum">Ethereum</option>
                        <option value="USDT">USDT</option>
                        <option value="Tron">Tron</option>
                      </select>
                    </label> -->
                    <div class="flex space-x-2 pt-3">



                      <button
                        class="btn mb-8  space-x-2 bg-primary font-medium text-white shadow-lg shadow-primary/50 hover:bg-primary-focus focus:bg-primary-focus active:bg-primary-focus/90"
                        type="submit" name="sub-kyc">
                        <span>Verify KYC</span>
                        <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24"
                          stroke="currentColor">
                          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                            d="M19 13l-7 7-7-7m14-8l-7 7-7-7" />
                        </svg>
                      </button>

                    </div>

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

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

<?php
include 'footer.php';
?>