diff --git a/_includes/header.html b/_includes/header.html
index fe76347..d10b834 100644
--- a/_includes/header.html
+++ b/_includes/header.html
@@ -33,4 +33,3 @@
-
diff --git a/_layouts/wizard.html b/_layouts/wizard.html
index 6a26af4..c7e6d7f 100644
--- a/_layouts/wizard.html
+++ b/_layouts/wizard.html
@@ -148,6 +148,7 @@
+
Please select KYC data for individuals who can
@@ -166,9 +167,11 @@
id_images = ["
+
diff --git a/assets/js/main.js b/assets/js/main.js
index 1500365..768e73a 100644
--- a/assets/js/main.js
+++ b/assets/js/main.js
@@ -23,19 +23,18 @@ function applyTheme() {
}
}
-toggleButton.addEventListener('click', () => {
- if (htmlElement.classList.contains('dark-theme')) {
- htmlElement.classList.remove('dark-theme');
- localStorage.setItem('theme', 'light');
- } else {
- htmlElement.classList.add('dark-theme');
- localStorage.setItem('theme', 'dark');
- }
-});
+// toggleButton.addEventListener('click', () => {
+// if (htmlElement.classList.contains('dark-theme')) {
+// htmlElement.classList.remove('dark-theme');
+// localStorage.setItem('theme', 'light');
+// } else {
+// htmlElement.classList.add('dark-theme');
+// localStorage.setItem('theme', 'dark');
+// }
+// });
// Load the saved theme on page load
window.onload = () => {
- console.log('ih')
// applyTheme();
resetFormFields()
};
@@ -105,7 +104,6 @@ async function extractValues() {
const pubKeysEl = document.getElementById('pub_keys');
const pubKeys = pubKeysEl.files;
-
let pubKeyData = [];
for (let i = 0; i < pubKeys.length; i++) {
const pubKeyFile = pubKeys[i];
@@ -132,8 +130,14 @@ async function extractValues() {
}
const kycDataEl = document.getElementById('kyc_data');
- const kycData = kycDataEl.files;
- if (kycData) {
+ const kycDataFiles = kycDataEl.files;
+ let kycData = [];
+ for (let i = 0; i < kycDataFiles.length; i++) {
+ const kycDataFile = kycDataFiles[i];
+ const fileText = await readFileAsText(kycDataFile);
+ kycData.push(fileText);
+ }
+ if (kycData.length) {
policy.kyc_data = kycData;
console.log(kycData);
}
@@ -173,10 +177,8 @@ function validateThreshold(threshold) {
threshold,
};
- console.log('threshold', threshold)
if (valid) {
const numbers = threshold.split('/');
- console.log('numbers', numbers)
if (Number(numbers[0]) > Number(numbers[1])) {
res.error = "Error: first number has to be lesser than second.";
} else {
@@ -318,19 +320,39 @@ remoteThresholdEl.addEventListener('input', function () {
}
});
+const kycThresholdEl = document.getElementById('kyc_threshold');
+kycThresholdEl.addEventListener('input', function () {
+ const kycThresholdErrorEl = document.getElementById('kyc_threshold_error');
+ kycThresholdErrorEl.innerText = "";
+ const currentValue = kycThresholdEl.value;
+ const thresholdRes = validateThreshold(currentValue)
+ if (thresholdRes.error) {
+ kycThresholdErrorEl.innerText = thresholdRes.error;
+ }
+});
+
const pubKeysErrorEl = document.getElementById('pub_keys_error');
const pubKeys = document.getElementById('pub_keys')
pubKeys.addEventListener('change', function () {
pubKeysErrorEl.innerText = "";
const res = validateThreshold(remoteThresholdEl.value);
- console.log(res, remoteThresholdEl)
if (pubKeys.files.length < res.threshold.split('/')[1] || !res || !res.threshold) {
- console.log('uhoh')
- pubKeysErrorEl.innerText = "Please select a valid threshold";
+ pubKeysErrorEl.innerText = "Please select a valid threshold or upload the correct number of public key files.";
pubKeys.value = "";
}
});
+const kycDataErrorEl = document.getElementById('kyc_data_error');
+const kycData = document.getElementById('kyc_data')
+kycData.addEventListener('change', function () {
+ kycDataErrorEl.innerText = "";
+ const res = validateThreshold(kycThresholdEl.value);
+ if (kycData.files.length < res.threshold.split('/')[1] || !res || !res.threshold) {
+ kycDataErrorEl.innerText = "Please select a valid threshold or upload the correct number of public key files.";
+ kycData.value = "";
+ }
+});
+
let kycAvailableEl = document.getElementById('kyc_available');
kycAvailableEl.addEventListener('input', function () {
let currentValue = kycAvailableEl.value;