obananapay_admin/users/edit-kyc.php

240 lines
8.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">
<style>
body {
justify-content: space-between;
margin: 0;
}
h1 {
margin: 0;
}
.mainContainer {
display: flex;
justify-content: center;
padding-left: 10rem;
padding-right: 10rem;
}
.section {
width: 45%;
padding: 20px;
box-sizing: border-box;
}
.section h2 {
margin-bottom: 10px;
}
.form-container {
margin-bottom: 20px;
padding-top: 0px;
}
form {
width: 100%;
}
label {
display: block;
margin-bottom: 5px;
}
input {
width: 100%;
padding: 8px;
box-sizing: border-box;
margin-bottom: 10px;
}
.image-container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
img {
width: 48%;
height: auto;
max-height: 200px;
object-fit: cover;
margin-bottom: 10px;
}
.checkboxFormContainer {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.checkbox-container {
margin-bottom: 10px;
/* Adjust the margin as needed */
}
.checkbox-label {
display: block;
}
</style>
</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
$IDuser = isset($_GET['userID']) ? $_GET['userID'] : '';
include '../functions-test.php';
$response = get_kyc_info($IDuser);
$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>
<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>
<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>
<button type="button" class="btn btn-danger" id="rejectButton" onclick="window.location.href='update-kyc.php?userID=<?php echo $IDuser; ?>&isAccepted=false';">Reject</button>
<button type="button" class="btn btn-success" id="acceptButton" onclick="handleKycAction('<?php echo $IDuser; ?>', 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);
});
function handleKycAction(userID, isAccepted) {
if (isAccepted) {
// Handle the logic for accept
// You may call acceptFunction or perform other actions
window.location.href = 'update-kyc.php?userID=' + userID + '&isAccepted=true';
} else {
// Handle the logic for reject
// Redirect to update-kyc.php with the additional parameter
window.location.href = 'update-kyc.php?userID=' + userID + '&isAccepted=false';
}
}
</script>
</body>
</html>