obananapay_admin/users/edit-kyc.php

166 lines
7.4 KiB
PHP
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<?php include '../header.php'; ?>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2024-03-07 14:23:47 +08:00
<link rel="stylesheet" href="edit-kyc.css">
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand">Verify KYCs</a>
</div>
</div>
</nav>
<div class="mainContainer">
<div class="section form-container">
<?php
2024-03-07 14:23:47 +08:00
$IDkyc = isset($_GET['kycID']) ? $_GET['kycID'] : '';
include '../functions-test.php';
2024-03-07 14:23:47 +08:00
$response = get_kyc_info($IDkyc);
$array = json_decode($response, true);
// Check if the decoding was successful
if ($array !== null) {
?>
<h2>Selfie</h2>
<div class="image-container">
<?php
// Display selfie image
if (!empty($array['selfie'])) {
echo '<img src="' . $array['selfie'] . '" alt="Selfie Image">';
} else {
echo '<p>No selfie available.</p>';
}
?>
</div>
<h3>User Information</h3>
<div class="form-container">
<fieldset disabled>
<form>
2024-03-07 14:23:47 +08:00
<label for="email">USER ID:</label>
<input class="form-control" type="text" id="email" name="kycID" value="<?php echo $array['userRef']['_id']; ?>" readonly>
<label for="fullName">Full Name:</label>
<input class="form-control" type="text" id="fullName" name="fullName" value="<?php echo $array['userRef']['fName'] . ' ' . $array['userRef']['lName']; ?>" readonly>
<label for="email">Email:</label>
<input class="form-control" type="text" id="email" name="email" value="<?php echo $array['userRef']['email']; ?>" readonly>
<label for="additionalStatus">Status:</label>
<input class="form-control" type="text" id="additionalStatus" name="additionalStatus" value="<?php echo $array['status']; ?>" readonly>
</fieldset>
</form>
</div>
<?php
} else {
echo 'Failed to decode JSON response.';
}
?>
</div>
<div class="section form-container">
<h2>Images</h2>
<div class="image-container">
<?php
if (!empty($array['images'])) {
foreach ($array['images'] as $image) {
echo '<img src="' . $image['link'] . '" alt="KYC Image">';
}
} else {
echo '<p>No images available.</p>';
}
?>
</div>
<h3>KYC Information</h3>
<div class="form-container">
<form>
<fieldset disabled>
2024-03-07 14:23:47 +08:00
<label for="email">KYC ID</label>
<input class="form-control" type="text" id="email" name="kycID" value="<?php echo $array['_id']; ?>" readonly>
<label for="additionalFullName">Full Name:</label>
<input class="form-control" type="text" id="additionalFullName" name="additionalFullName" value="<?php echo $array['full_name']; ?>" readonly>
<label for="idNum">ID Number:</label>
<input class="form-control" type="text" id="idNum" name="idNum" value="<?php echo $array['id_num']; ?>" readonly>
<label for="dob">Date of Birth:</label>
<input class="form-control" type="text" id="dob" name="dob" value="<?php echo $array['date_of_birth']; ?>" readonly>
<label for="address">Address:</label>
<input class="form-control" type="text" id="address" name="address" value="<?php echo $array['address']; ?>" readonly>
</fieldset>
</form>
</div>
</div>
<div class="section form-container">
<h2>Confirm KYC Details</h2>
<div class="checkboxFormContainer">
<form id="checkboxForm">
<div class="checkbox-container">
<label for="checkbox1" class="checkbox-label">Full Name
<input type="checkbox" id="checkbox1" name="checkbox1">
</label>
</div>
<div class="checkbox-container">
<label for="checkbox2" class="checkbox-label">ID Number
<input type="checkbox" id="checkbox2" name="checkbox2">
</label>
</div>
<div class="checkbox-container">
<label for="checkbox3" class="checkbox-label">Date of Birth
<input type="checkbox" id="checkbox3" name="checkbox3">
</label>
</div>
<div class="checkbox-container">
<label for="checkbox4" class="checkbox-label">Address
<input type="checkbox" id="checkbox4" name="checkbox4">
</label>
</div>
</div>
<div class="form-container">
<h3>Change the status?</h3>
2024-03-07 14:23:47 +08:00
<button type="button" class="btn btn-danger" id="rejectButton" onclick="window.location.href='update-kyc.php?kycID=<?php echo $IDkyc; ?>&userID=<?php echo $array['userRef']['_id']; ?>&isAccepted=false';">Reject</button>
<button type="button" class="btn btn-success" id="acceptButton" onclick="handleKycAction('<?php echo $IDkyc; ?>', '<?php echo $array['userRef']['_id']; ?>', true);" disabled>Accept</button>
</div>
</form>
</div>
</div>
<script>
function handleCheckboxChange() {
// Check the status of checkboxes and enable/disable the "Accept" button
var areAllChecked = document.querySelectorAll('#checkboxForm input[type="checkbox"]:checked').length === 4;
document.getElementById('acceptButton').disabled = !areAllChecked;
}
// Attach the handleCheckboxChange function to each checkbox's onchange event
var checkboxes = document.querySelectorAll('#checkboxForm input[type="checkbox"]');
checkboxes.forEach(function(checkbox) {
checkbox.addEventListener('change', handleCheckboxChange);
});
2024-03-07 14:23:47 +08:00
function handleKycAction(kycID, userID, isAccepted) {
if (isAccepted) {
// Handle the logic for accept
// You may call acceptFunction or perform other actions
2024-03-07 14:23:47 +08:00
window.location.href = 'update-kyc.php?kycID=' + kycID + '&userID=' + userID + '&isAccepted=true';
} else {
// Handle the logic for reject
// Redirect to update-kyc.php with the additional parameter
2024-03-07 14:23:47 +08:00
window.location.href = 'update-kyc.php?kycID=' + kycID + '&userID=' + userID + '&isAccepted=false';
}
}
</script>
</body>
</html>