diff --git a/users/edit-kyc.php b/users/edit-kyc.php index 889bf60..920bcea 100644 --- a/users/edit-kyc.php +++ b/users/edit-kyc.php @@ -129,7 +129,7 @@

Change the status?

- +
@@ -149,7 +149,11 @@ checkbox.addEventListener('change', handleCheckboxChange); }); - function handleKycAction(kycID, userID, isAccepted) { + function openRejectDialog() { + $('#rejectModal').modal('show'); + } + + function handleKycAction(kycID, userID, isAccepted, reason) { if (isAccepted) { // Handle the logic for accept // You may call acceptFunction or perform other actions @@ -157,10 +161,44 @@ } else { // Handle the logic for reject // Redirect to update-kyc.php with the additional parameter - window.location.href = 'update-kyc.php?kycID=' + kycID + '&userID=' + userID + '&isAccepted=false'; + window.location.href = 'update-kyc.php?kycID=' + kycID + '&userID=' + userID + '&isAccepted=false&reason=' + encodeURIComponent(reason); + } + } + + function handleRejectWithReason() { + var reason = document.getElementById('rejectReason').value; + if (reason.trim() !== "") { + // User entered a non-empty reason + var kycID = ''; + var userID = ''; + handleKycAction(kycID, userID, false, reason); + $('#rejectModal').modal('hide'); + } else { + // User entered an empty reason + alert("Please provide a valid reason for rejection."); } } + \ No newline at end of file diff --git a/users/update-kyc.php b/users/update-kyc.php index df2c4ea..6f0f90f 100644 --- a/users/update-kyc.php +++ b/users/update-kyc.php @@ -9,9 +9,12 @@ if (isset($_GET['kycID'], $_GET['userID'], $_GET['isAccepted'])) { $kycID = $_GET['kycID']; $userID = $_GET['userID']; $isAccepted = ($_GET['isAccepted'] === 'true'); + $reason = $_GET['reason']; + + // Now you can use the $reason variable as needed in your code + + // echo "KYC ID: $kycID, User ID: $userID, Is Accepted: $isAccepted, Reason: $reason"; - echo "KYC ID: $kycID, User ID: $userID, Is Accepted: $isAccepted"; - //Call the appropriate function based on isAccepted value if ($isAccepted) { // If isAccepted is true, call accept_kyc function if (accept_kyc($kycID, $userID)) {