<?php session_start(); include"../connect/db.php" ?>    
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Admin| Users</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- Font Awesome -->
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <!-- DataTables -->
  <link rel="stylesheet" href="../plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
  <link rel="stylesheet" href="../plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="../dist/css/adminlte.min.css">
  <!-- Google Font: Source Sans Pro -->
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
  <!-- Navbar -->
  <nav class="main-header navbar navbar-expand navbar-white navbar-light">
    <!-- Left navbar links -->
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
      </li>
      <li class="nav-item d-none d-sm-inline-block">
       
      </li>
      <li class="nav-item d-none d-sm-inline-block">
   
      </li>
    </ul>

    <!-- SEARCH FORM -->
    
    <!-- Right navbar links -->
    <ul class="navbar-nav ml-auto">
      <!-- Messages Dropdown Menu -->
      
      <!-- Notifications Dropdown Menu -->
      
      <li class="nav-item">
        <a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#" role="button">
          <i class="fas fa-th-large"></i>
        </a>
      </li>
    </ul>
  </nav>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->


  <?php           


?> 
  <aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <a href="../index3.html" class="brand-link">
      <img src="../dist/img/AdminLTELogo.png"
           alt="AdminLTE Logo"
           class="brand-image img-circle elevation-3"
           style="opacity: .8">
      <span class="brand-text font-weight-light">Admin</span>
    </a>

    <!-- Sidebar -->

    <?php include"includes/sidebar.php" ?>        
 
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1> Edit User</h1>
            
          <div class="col-sm-6">
        
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>

    <!-- Main content -->
    <section class="content">
   
      <div class="container-fluid">
        
      <div class="page-wrapper">

   

<?php           
 include"../connect/db.php";
    $maga = mysqli_real_escape_string($con, $_GET['user'] ?? '');
    $vanila = mysqli_query($con,"SELECT * FROM users WHERE email = '$maga' ");
    $crow = mysqli_fetch_assoc($vanila);

    if( $crow['gender'] == "Male" ){
        $gender = 
        '
            <select name="gender" id="gender" required>
                 <option selected value="Male">Male</option>
                 <option value="Female">Female</option>
            </select>

        ';
    }
    else{
        $gender =
        '
            <select name="gender" id="gender" required>
                 <option value="Male">Male</option>
                 <option selected value="Female">Female</option>
            </select>

        ';
    }

?>             

<!-- PAGE CONTAINER-->
<div class="page-container"> 
<!-- Switch Button -->






























    <!-- MAIN CONTENT-->
    <div class="main-content">
        
        <div class="section__content section__content--p30">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-1"></div>
                    <div class="col-lg-10"><br><br>
                        <div class="card">
                            
                            <div class="card-body" style="border-radius: 5px;box-shadow: 0 0 10px 5px #cecece;">
                                <!-- Switch Button -->

<?php


$result = mysqli_query($con, "SELECT crypto_status FROM users WHERE email = '$maga'");
$row = mysqli_fetch_assoc($result);
$crypto_status = $row['crypto_status'];
?>








<style>
 /* Switch Container */
.switch-container {
    display: inline-block;
}

/* The switch itself (hidden checkbox) */
.switch input {
    display: none;
}

/* The slider (moving part of the switch) */
.slider {
    position: relative;
    display: inline-block;
    width: 80px;
    height: 35px;
    background-color: #ff4d4d; /* Default Red for Off */
    border-radius: 35px;
    transition: background-color 0.4s ease;
}

/* The moving part of the slider */
.slider:before {
    position: absolute;
    content: "";
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: transform 0.4s ease;
}

/* When the switch is checked (On) */
input:checked + .slider {
    background-color: #4caf50; /* Green for On */
}

input:checked + .slider:before {
    transform: translateX(45px); /* Move the slider ball to the right */
}

/* Text displaying On or Off */
.switch-text {
    position: absolute;
    width: 100%;
    text-align: center;
    line-height: 35px;
    color: white;
    font-weight: bold;
    pointer-events: none; /* Prevent text from interfering with clicks */
    transition: opacity 0.4s ease;
}

/* Text color for On */
input:checked + .slider + .switch-text {
    opacity: 0;
}

/* Text color for Off */
input:not(:checked) + .slider + .switch-text {
    opacity: 1;
}

</style>



<script>
document.getElementById('toggleSwitch').addEventListener('change', function() {
    let switchText = document.getElementById('switchText');
    let cryptostats = this.checked ? "on" : "off"; // Set value based on switch state
    switchText.textContent = cryptostats; // Update text content

    // You may need to properly escape or encode this PHP variable if it's a string
    let email = '<?=$maga?>';

    $.ajax({
        url: '../apps/man/cryptotoggle.php',
        type: 'POST',
        data: { 
            cryptostats: cryptostats, // Send the cryptostats value in the request
            email: email  // Send the email value if needed
        },
        success: function(data) {
            let info = data.trim();
            if (info === "on") {
                toastAlert(true, "top-end", false, 3000, "success", "You have successfully activated the crypto dashboard");
                setTimeout(function() { location.reload(); }, 3200);
            } else {
                toastAlert(true, "top-end", false, 3000, "success", "You have successfully deactivated the crypto dashboard");
            }
        },
        error: function(jqXHR, textStatus, errorThrown) {
            console.error("AJAX request failed:", textStatus, errorThrown);
            toastAlert(true, "top-end", false, 3000, "error", "An error occurred while processing your request");
        }
    });
});
</script>


                                <ul class="nav nav-tabs nav-tabs-warning top-icon nav-justified">
                                    <li class="nav-item">
                                        <a href="javascript:void();" data-target="#profile" data-toggle="pill" class="nav-link active"><i class="icon-user"></i> <span class="hidden-xs"><?php echo $crow['email'] ?>  Profile</span></a>
                                    </li>        
                                </ul>
                                <br>
                               <div class="action-buttons">
  <a href="transaction.php?user=<?= $crow['account_num'] ?>" class="btn-action info">
    <i class="fa fa-exchange"></i> Manage Transactions
  </a>

  <a href="tickets.php?user=<?= $crow['email'] ?>" class="btn-action success">
    <i class="fa fa-ticket"></i> Manage Support Tickets
  </a>

  <a href="requests.php?user=<?= $crow['email'] ?>" class="btn-action primary">
    <i class="fa fa-credit-card"></i> Card Requests / Assign Card
  </a>

  <button onclick="loadUpdateData(<?= $crow['account_num'] ?>)" class="btn-action warning">
    <i class="fa fa-barcode"></i> Generate / View Billing Code
  </button>

  <a href="loan.php?user=<?= $crow['email'] ?>" class="btn-action danger">
    <i class="fa fa-bank"></i> Manage Loan Requests
  </a>
</div>

<style>
/* Container */
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 20px;
}

/* Base Button Style */
.btn-action {
  flex: 1 1 250px; /* responsive: min 250px width */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease-in-out;

  color: #fff;
  box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}

/* Hover + Active Effects */
.btn-action:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.2);
}
.btn-action:active {
  transform: scale(0.97);
}

/* Colors */
.btn-action.info { background: #17a2b8; }
.btn-action.success { background: #28a745; }
.btn-action.primary { background: #007bff; }
.btn-action.warning { background: #ffc107; color: #000; }
.btn-action.danger { background: #dc3545; }

/* Mobile Friendly */
@media(max-width: 600px) {
  .btn-action {
    flex: 1 1 100%;
    font-size: 14px;
    padding: 10px 15px;
  }
}
</style>

<br>

                                <div class="tab-content p-3">
                                    <div class="tab-pane active" id="profile"> 
                                        <div class="row">
                                            <div class="col-lg-1"></div>
                                            <div class="col-lg-10">











<style>
  .nav-tabs .nav-link {
    color: #007bff;
    transition: color 0.3s, background-color 0.3s;
}

.nav-tabs .nav-link.active {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.tab-content {
    padding: 10px;
    border: 1px solid #dee2e6;
    border-top: none;
}

.form-group.row {
    margin-bottom: 15px;
}

</style>
<form>










                                            <div class="tab-container">
    <ul class="nav nav-tabs">
        <li class="nav-item">
            <a class="nav-link active" href="#personal-info" data-toggle="tab">Personal Information</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" href="#account-stats" data-toggle="tab">Account Statistics</a>
        </li>
     
        <li class="nav-item">
            <a class="nav-link" href="#code-stats" data-toggle="tab">Modify Billing Code Names</a>
        </li>
    </ul>

    <div class="tab-content mt-3">
        <!-- Personal Information Tab -->
        <div class="tab-pane fade show active" id="personal-info">
           
        <div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">First Name</label>
    <div class="col-lg-9">
        <input class="form-control" name="firstname" type="text" value="<?php echo $crow['firstname'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Last Name</label>
    <div class="col-lg-9">
        <input class="form-control" name="lastname" type="text" value="<?php echo $crow['lastname'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Middle Name</label>
    <div class="col-lg-9">
        <input class="form-control" name="middlename" type="text" value="<?php echo $crow['middlename'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Nickname</label>
    <div class="col-lg-9">
        <input class="form-control" name="nickname" type="text" value="<?php echo $crow['nickname'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Email</label>
    <div class="col-lg-9">
        <input class="form-control" name="email" type="email" value="<?php echo $crow['email'] ?>" readonly>
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Phone</label>
    <div class="col-lg-9">
        <input class="form-control" name="phone" type="text" value="<?php echo $crow['phone'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Zip Code</label>
    <div class="col-lg-9">
        <input class="form-control" name="zipcode" type="text" value="<?php echo $crow['zipcode'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Title</label>
    <div class="col-lg-9">
        <input class="form-control" name="title" type="text" value="<?php echo $crow['title'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Gender</label>
    <div class="col-lg-9">
        <select class="form-control" name="gender">
            <option value="male" <?php echo ($crow['gender'] == 'male') ? 'selected' : ''; ?>>Male</option>
            <option value="female" <?php echo ($crow['gender'] == 'female') ? 'selected' : ''; ?>>Female</option>
            <option value="other" <?php echo ($crow['gender'] == 'other') ? 'selected' : ''; ?>>Other</option>
        </select>
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Address</label>
    <div class="col-lg-9">
        <textarea class="form-control" name="address"><?php echo $crow['address'] ?></textarea>
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Country</label>
    <div class="col-lg-9">
        <input class="form-control" name="country" type="text" value="<?php echo $crow['country'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">State</label>
    <div class="col-lg-9">
        <input class="form-control" name="state" type="text" value="<?php echo $crow['state'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">SSN</label>
    <div class="col-lg-9">
        <input class="form-control" name="ssn" type="text" value="<?php echo $crow['ssn'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">City</label>
    <div class="col-lg-9">
        <input class="form-control" name="city" type="text" value="<?php echo $crow['city'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Occupation</label>
    <div class="col-lg-9">
        <input class="form-control" name="occupation" type="text" value="<?php echo $crow['occupation'] ?>">
    </div>
</div>


<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Income</label>
    <div class="col-lg-9">
        <input class="form-control" name="income" type="text" value="<?php echo $crow['income'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Next of Kin</label>
    <div class="col-lg-9">
        <input class="form-control" name="next_kin" type="text" value="<?php echo $crow['next_kin'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Next of Kin Address</label>
    <div class="col-lg-9">
        <input class="form-control" name="next_address" type="text" value="<?php echo $crow['next_address'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Relationship with Next of Kin</label>
    <div class="col-lg-9">
        <input class="form-control" name="next_relationship" type="text" value="<?php echo $crow['next_relationship'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">KYC status</label>
    <div class="col-lg-9">
        <select class="form-control" name="kyc_status">
            <option value="pending" <?php echo ($crow['kyc_status'] == 'pending') ? 'selected' : ''; ?>>Pending</option>
            <option value="review" <?php echo ($crow['kyc_status'] == 'review') ? 'selected' : ''; ?>>Review</option>
            <option value="approved" <?php echo ($crow['kyc_status'] == 'approved') ? 'selected' : ''; ?>>Approved</option>
            <option value="rejected" <?php echo ($crow['kyc_status'] == 'rejected') ? 'selected' : ''; ?>>Rejected</option>
        </select>
    </div>
</div>

<!-- Admin OTP toggle -->
<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Admin OTP Verification</label>
    <div class="col-lg-9">
        <select class="form-control" name="admin_otp">
            <option value="0" <?= ($crow['admin_otp'] ?? 0) == 0 ? 'selected' : '' ?>>Off</option>
            <option value="1" <?= ($crow['admin_otp'] ?? 0) == 1 ? 'selected' : '' ?>>On</option>
        </select>
        <small class="text-muted">When on, user must enter an OTP sent to admin email after PIN verification.</small>
    </div>
</div>

<!-- Transfer limit toggle -->
<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Transfer Limit</label>
    <div class="col-lg-9">
        <select class="form-control" name="transfer_limit" id="transferLimit">
            <option value="0" <?= ($crow['transfer_limit'] ?? 0) == 0 ? 'selected' : '' ?>>No Limit</option>
            <option value="1" <?= ($crow['transfer_limit'] ?? 0) == 1 ? 'selected' : '' ?>>Limited</option>
        </select>
    </div>
</div>

<!-- Limit message -->
<div class="form-group row" id="limitMsgRow" style="<?= ($crow['transfer_limit'] ?? 0) == 1 ? '' : 'display:none;' ?>">
    <label class="col-lg-3 col-form-label form-control-label">Limit Message</label>
    <div class="col-lg-9">
        <textarea class="form-control" name="limit_message" rows="3"><?= htmlspecialchars($crow['limit_message'] ?? 'Your account has a transfer restriction. Please contact customer care for assistance.') ?></textarea>
    </div>
</div>

<script>document.getElementById('transferLimit').addEventListener('change',function(){document.getElementById('limitMsgRow').style.display=this.value=='1'?'':'none';});</script>

        <div class="form-group row">
            <div clas="col-12">
                <span onclick="updateProfile()" class="btn btn-warning pull-right">Submit Update</span>
            </div>
        </div>






            <!-- Add more personal information fields as needed -->
        </div>

































































































































































        <div class="tab-pane fade" id="code-stats">
    
       






















































  <form id="form3">
  <div class="form-group row">
    <input class="form-control" name="email223" type="hidden" value="<?php echo $maga ?>">
  </div>

  <div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Billing Code Count</label>
    <div class="col-lg-9">
        <select class="form-control" name="code_count" id="code_count" onchange="toggleCodeFields()">
            <?php
                $savedCount = isset($crow['code_count']) ? (int)$crow['code_count'] : 6;
                for ($i = 1; $i <= 6; $i++) {
                    $selected = ($i === $savedCount) ? 'selected' : '';
                    echo "<option value=\"$i\" $selected>$i</option>";
                }
            ?>
        </select>
    </div>
  </div>

<div class="code-field-row code-field-1">
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Code Name 1 in Full</label>
<div class="col-lg-9">
    <input class="form-control" name="code_name1" type="text" value="<?php echo $crow['code_name1'] ?>">
</div>
</div>
</div>

<div class="code-field-row code-field-2">
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Code Name 2 in Full</label>
<div class="col-lg-9">
    <input class="form-control" name="code_name2" type="text" value="<?php echo $crow['code_name2'] ?>">
</div>
</div>
</div>

<div class="code-field-row code-field-3">
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Code Name 3 in Full</label>
<div class="col-lg-9">
    <input class="form-control" name="code_name3" type="text" value="<?php echo $crow['code_name3'] ?>">
</div>
</div>
</div>

<div class="code-field-row code-field-4">
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Code Name 4 in Full</label>
<div class="col-lg-9">
    <input class="form-control" name="code_name4" type="text" value="<?php echo $crow['code_name4'] ?>">
</div>
</div>
</div>

<div class="code-field-row code-field-5">
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Code Name 5 in Full</label>
<div class="col-lg-9">
    <input class="form-control" name="code_name5" type="text" value="<?php echo $crow['code_name5'] ?>">
</div>
</div>
</div>

<div class="code-field-row code-field-6">
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Code Name 6 in Full</label>
<div class="col-lg-9">
    <input class="form-control" name="code_name6" type="text" value="<?php echo $crow['code_name6'] ?>">
</div>
</div>
</div>


<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Stay Locked On Code</label>
    <div class="col-lg-9">
        <div class="form-check">
            <input class="form-check-input" type="radio" name="lock_status" value="active" id="lockActive" <?php echo isset($crow['lock_status']) && $crow['lock_status'] === 'active' ? 'checked' : ''; ?>>
            <label class="form-check-label" for="lockActive">
                Active
            </label>
        </div>
        <div class="form-check">
            <input class="form-check-input" type="radio" name="lock_status" value="inactive" id="lockInactive" <?php echo isset($crow['lock_status']) && $crow['lock_status'] === 'inactive' ? 'checked' : ''; ?>>
            <label class="form-check-label" for="lockInactive">
                Inactive
            </label>
        </div>
    </div>
</div>

<script>
function toggleCodeFields() {
    var count = parseInt(document.getElementById('code_count').value);
    for (var i = 1; i <= 6; i++) {
        var row = document.querySelector('.code-field-' + i);
        if (row) {
            row.style.display = (i <= count) ? '' : 'none';
        }
    }
}
// Initialize on page load
document.addEventListener('DOMContentLoaded', function() {
    toggleCodeFields();
});
</script>

  </form>






<div class="form-group row">
                      <div clas="col-12">
                                                        
                      <span onclick="updatecode()" class="btn btn-success pull-right" >Submit Update</span>                                                        
                                                        </div>
                                                    </div>













































































                                                    















  </div>
































        <div class="tab-pane fade" id="crypto-stats">
    
       






















































        <?php           
 include"../connect/db.php";
    $maga = mysqli_real_escape_string($con, $_GET['user'] ?? '');
    $vanila3 = mysqli_query($con,"SELECT * FROM usercrypto WHERE user = '$maga' ");
    $crow3 = mysqli_fetch_assoc($vanila3);



?>        















      <form id="form2">
      <div class="form-group row">
      <input class="form-control" name="email22" type="hidden" value="<?php echo $maga ?>">

    <label class="col-lg-3 col-form-label form-control-label">Stellar</label>
    <div class="col-lg-9">
        <input class="form-control" name="stellar" type="text" value="<?php echo $crow3['stellar'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Tether</label>
    <div class="col-lg-9">
        <input class="form-control" name="tether" type="text" value="<?php echo $crow3['tether'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Bitcoin</label>
    <div class="col-lg-9">
        <input class="form-control" name="bitcoin" type="text" value="<?php echo $crow3['bitcoin'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Bitcoin Cash</label>
    <div class="col-lg-9">
        <input class="form-control" name="bitcoincash" type="text" value="<?php echo $crow3['bitcoincash'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Litecoin</label>
    <div class="col-lg-9">
        <input class="form-control" name="litecoin" type="text" value="<?php echo $crow3['litecoin'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Ripple</label>
    <div class="col-lg-9">
        <input class="form-control" name="ripple" type="text" value="<?php echo $crow3['ripple'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Tron</label>
    <div class="col-lg-9">
        <input class="form-control" name="tron" type="text" value="<?php echo $crow3['tron'] ?>">
    </div>
</div>
      </form>






<div class="form-group row">
                          <div clas="col-12">
                                                            
                          <span onclick="updatecrypto()" class="btn btn-primary pull-right" >Submit Update</span>                                                        
                                                            </div>
                                                        </div>





























































































      </div>

        <!-- Account Statistics Tab -->
        <div class="tab-pane fade" id="account-stats">
            
           







        <div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Password</label>
    <div class="col-lg-9">
        <input class="form-control" name="password" type="text" value="<?php echo $crow['password'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Secret Code</label>
    <div class="col-lg-9">
        <input class="form-control" name="secretCode" type="text" value="<?php echo $crow['secretCode'] ?>">
    </div>
</div>
<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Date Of Birth</label>
    <div class="col-lg-9">
        <input class="form-control" name="dob" type="text" value="<?php echo $crow['dob'] ?>">
    </div>
</div>
<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Account Number</label>
    <div class="col-lg-9">
        <input class="form-control" name="account_num" type="text" value="<?php echo $crow['account_num'] ?>" readonly>
    </div>
</div>
<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Currency</label>
    <div class="col-lg-9">
        <input class="form-control" name="usercurrency" type="text" value="<?php echo $crow['usercurrency'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Security Question 1</label>
    <div class="col-lg-9">
        <input class="form-control" name="securityquestion" type="text" value="<?php echo $crow['securityquestion'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Answer 1</label>
    <div class="col-lg-9">
        <input class="form-control" name="answer" type="text" value="<?php echo $crow['answer'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Security Question 2</label>
    <div class="col-lg-9">
        <input class="form-control" name="securityquestion2" type="text" value="<?php echo $crow['securityquestion2'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Answer 2</label>
    <div class="col-lg-9">
        <input class="form-control" name="answer2" type="text" value="<?php echo $crow['answer2'] ?>">
    </div>
</div>
<?php
$sql2 = "SELECT * FROM email_confirmation WHERE email = ?";
$stmt = $mysqli->prepare($sql2);
$stmt->bind_param('s', $maga);
$stmt->execute();
$result = $stmt->get_result();

if ($result->num_rows > 0) {
    $row3 = $result->fetch_assoc();
    
    // Check if the email is confirmed
    if ($row3['confirmed'] == 1) {
        // Email is confirmed, display the confirmation message with the timestamp
        $created_at = $row3['confirmed_at'];
        echo "<p>Email is confirmed successfully at $created_at.</p>";
    } else {
        // Email is not confirmed yet
        echo "<p>Email is not confirmed yet.</p>";
    }
} else {
    // No record found for the provided email
    echo "<p>No confirmation record found for this email.</p>";
}
?>





















<div class="form-group row">
                                                            <label class="col-lg-3 col-form-label form-control-label">Status</label>
                                                            <div class="col-lg-9">
                                                            <select name="status" id="status" class="form-control" required>
                                                                <?php 
                                                                   if ( $crow['status'] == "Active" ){
                                                                    $status = 
                                                                    '
                                                                        <option selected="selcted" value="Active">Active</option>
                                                                        <option value="suspended">Suspended</option>
                                                                         <option  value="inactive">Inactive</option>
                                                                                                                                             <option  value="terminated">Terminate</option>

                                                                    ';				
                                                                }
                                                                else if( $crow['status'] == "suspended" ){
                                                                    $status = 
                                                                    '
                                                                        <option value="Active">Active</option>
                                                                        <option  value="review">Review</option>
                                                                        <option selected="selcted" value="suspended">Suspended</option>
                                                                        <option  value="inactive">Inactive</option>
                                                                        <option  value="terminated">Terminate</option>
                                                                        
                                                                    ';				
                                                                }
                                                                 else if( $crow['status'] == "review" ){
                                                                    $status = 
                                                                    '
                                                                        <option value="Active">Active</option>
                                                                        <option  value="review" selected>Review</option>
                                                                        <option selected="selcted" value="suspended">Suspended</option>
                                                                        <option  value="inactive">Inactive</option>
                                                                        <option  value="terminated">Terminate</option>
                                                                        
                                                                    ';				
                                                                }
                                                                 else if( $crow['status'] == "inactive" ){
                                                                    $status = 
                                                                    '
                                                                        <option value="Active">Active</option>
                                                                        <option  value="suspended">Suspended</option>
                                                                        <option selected="selcted" value="inactive">Inactive</option>
                                                                        <option  value="review">Review</option>
                                                                        <option  value="terminated">Terminate</option>
                                                     ';				
                                                                }
                                                                 else if( $crow['status'] == "terminated" ){
                                                                    $status = 
                                                                    '
                                                                        <option value="Active">Active</option>
                                                                        <option  value="review">Review</option>
                                                                        <option  value="suspended">Suspended</option>
                                                                        <option selected="selcted" value="inactive">Inactive</option>
                                                                        <option  value="terminated" selected>Terminate</option>
                                                     ';				
                                                                }
                                                                
                                                                
                                                                 else{
                                                                    $status = 
                                                                    '
                                                                        <option selected="selcted" value="Active">Active</option>
                                        <option  value="review">Review</option>
                                        
                                                                        <option value="suspended">Suspended</option>
                                                                         <option  value="inactive">Inactive</option>
                                                                          <option  value="terminated">Terminate</option>
                                                                      
                                                                    ';				
                                                                }
                                                                
                                                                ?>
                                                                 <?=$status?>
                                                            </select>
                                                            </div>
                                                        </div>     


<!-- Existing fields you provided -->
<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">FICO Score</label>
    <div class="col-lg-9">
        <input class="form-control" name="fico_score" type="text" value="<?php echo $crow['fico_score'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Linked Card</label>
    <div class="col-lg-9">
        <input class="form-control" name="linked_card" type="text" value="<?php echo $crow['linked_card'] ?>">
    </div>
</div>


<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Code Level</label>
    <div class="col-lg-9">
        <input class="form-control" name="code_level" type="text" value="<?php echo $crow['code_level'] ?>" readonly>
    </div>
</div>


<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">LOGIN PIN CODE</label>
    <div class="col-lg-9">
        <input class="form-control" name="pincode" type="text" value="<?php echo $crow['pincode'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label"> Login PIN Status</label>
    <div class="col-lg-9">
        <div class="form-check">
            <input class="form-check-input" type="radio" name="pin_stat" value="active" id="pinStatActive" <?php echo (isset($crow['pin_stat']) ? $crow['pin_stat'] : 'active') === 'active' ? 'checked' : ''; ?>>
            <label class="form-check-label" for="pinStatActive">
                Active
            </label>
        </div>
        <div class="form-check">
            <input class="form-check-input" type="radio" name="pin_stat" value="inactive" id="pinStatInactive" <?php echo (isset($crow['pin_stat']) ? $crow['pin_stat'] : 'active') === 'inactive' ? 'checked' : ''; ?>>
            <label class="form-check-label" for="pinStatInactive">
                Inactive
            </label>
        </div>
    </div>
</div>

<br>
<br>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Transfer Settings</label>
    <div class="col-lg-9">
        <select name="code_status" id="code_status" class="form-control">
            <option value="">-- Select Status --</option>
            <option value="active" <?= ($crow['code_status'] === 'active') ? 'selected' : '' ?>>Billing Code</option>
            <option value="inactive" <?= ($crow['code_status'] === 'inactive') ? 'selected' : '' ?>>Transfer Disabled</option>
            <option value="debit_success" <?= ($crow['code_status'] === 'debit_success') ? 'selected' : '' ?>>Debit Success</option>
        </select>
    </div>
</div>



<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
document.getElementById("code_status").addEventListener("change", function() {
    let selected = this.value;

    if (selected === "active") {
        Swal.fire({
            icon: "success",
            title: "You have selected progress code biling",
            text: "Once the user tries to transfer to a account not inside the bank it will require a billing code to complete,please proceed to submit button below to complete",
                  showConfirmButton: false,
            timer:10000

        });
    } 
    else if (selected === "inactive") {
        Swal.fire({
            icon: "warning",
            title: "You have selected transfer disabled",
            text: "Once the user tries to transfer to a account not inside the bank it will show Transfer Disabled,please proceed to submit button below to complete",
            showConfirmButton: false,
            timer: 10000

        });
    } 
    else if (selected === "debit_success") {
        Swal.fire({
            icon: "info",
            title: "You have selected Debit Success",
            text: "All transfers will go through regardless if the account is in the bank or not, it will always go through,please proceed to submit button below to complete",
                   showConfirmButton: false,
            timer: 10000

        });
    }
});
</script>



<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">Checking Balance</label>
    <div class="col-lg-9">
        <input class="form-control" name="checking_balance" type="number" value="<?php echo $crow['checking_balance'] ?>">
    </div>
</div>

<div class="form-group row">
    <label class="col-lg-3 col-form-label form-control-label">BSL Balance</label>
    <div class="col-lg-9">
        <input class="form-control" name="bsl_balance" type="number" value="<?php echo $crow['bsl_balance'] ?>">
    </div>
</div>




<div class="form-group row">
                                                            <div clas="col-12">
                                                                <span onclick="updateProfile()" class="btn btn-warning pull-right" >Submit Update</span>                                                        
                                                            </div>
                                                        </div>







            <!-- Add more account statistics fields as needed -->
        </div>
    </div>
</div>











<script>
  $(document).ready(function () {
    $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
        var target = $(e.target).attr("href");
        $('.tab-pane').hide(); // Hide all tab panes
        $(target).fadeIn('slow'); // Fade in the target pane
    });

    // Initialize visible tab on page load
    var initialTab = $('.nav-link.active').attr('href');
    $(initialTab).fadeIn('slow');
  });
</script>
















                                                  <br>
                                                    
                                                   





                                                      
                                                     
                                                        
                                                    </form>
                                            </div>
                                            <div class="col-lg-1"></div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>                                               
                    </div>
                    <div class="col-lg-1"></div>
                </div>
    
            </div>
        </div>
    </div>
    <!-- END MAIN CONTENT-->
    <!-- END PAGE CONTAINER-->
</div>

</div>
        <div class="row">
        
       
          
          <div class="col-12">
        
        
            <!-- /.card -->

    
              
              <!-- /.card-body -->
              
            </div>
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div>
      <!-- /.container-fluid -->
    </section>
      <!-- MODAL CREATE TRANSACTION -->
   <!-- MODAL CREATE TRANSACTION -->
      <span id="scamBtn" style="display: none" class="btn btn-primary" data-toggle="modal" data-target="#updateModal">
    </span>

    <span id="scamBtn2" style="display: none" class="btn btn-primary" data-toggle="modal" data-target="#viewModal">
    </span>    

    <!-- Modal -->
    <div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
          <div class="modal-body">
            <div class="card">
                <div class="card-body card-profile">
                                                
                </div>
            </div>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
          </div>
        </div>
      </div>
    </div>

    <!-- Modal -->
    <div class="modal fade" id="viewModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
          <div class="modal-body">
            <div class="card">
                <div class="card-body card-profile-view">
                                                
                </div>
            </div>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
          </div>
        </div>
      </div>
    </div>        

    </div>   
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  <footer class="main-footer">
    <div class="float-right d-none d-sm-block">
      <b>Version</b> 1.0.0
    </div>
    <strong>Copyright &copy; 2021 <a href="#">Swagalomo's Admin</a>.</strong> All rights
    reserved.
  </footer>

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Control sidebar content goes here -->
  </aside>
  <!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->

<!-- jQuery -->
<script src="../plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- DataTables -->
<script src="../plugins/datatables/jquery.dataTables.min.js"></script>
<script src="../plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="../plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="../plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<!-- page script -->
<script>
  $(function () {
    $("#example1").DataTable({
      "responsive": true,
      "autoWidth": false,
    });
    $('#example2').DataTable({
      "paging": true,
      "lengthChange": false,
      "searching": false,
      "ordering": true,
      "info": true,
      "autoWidth": false,
      "responsive": true,
    });
  });
</script>

<script src="js/sweetalert2.all.min.js"></script>
    <!-- Main JS-->
    <script src="js/main.js"></script>
    <script src="js/custom.js?v=7.3"></script>
</body>
</html>