Spaces:
Running
Running
Delete index.html
Browse files- index.html +0 -196
index.html
DELETED
|
@@ -1,196 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="en">
|
| 3 |
-
<head>
|
| 4 |
-
<meta charset="UTF-8">
|
| 5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>Data Collection App</title>
|
| 7 |
-
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
-
</head>
|
| 9 |
-
<body class="bg-gradient-to-br from-blue-50 to-indigo-100 min-h-screen flex items-center justify-center p-4">
|
| 10 |
-
<div class="bg-white rounded-lg shadow-2xl p-8 w-full max-w-md">
|
| 11 |
-
<h1 class="text-3xl font-bold text-gray-800 mb-8 text-center">Data Collection</h1>
|
| 12 |
-
|
| 13 |
-
<!-- Input Form -->
|
| 14 |
-
<div id="formContainer" class="space-y-5 mb-8">
|
| 15 |
-
<div>
|
| 16 |
-
<label class="block text-sm font-semibold text-gray-700 mb-2">Human</label>
|
| 17 |
-
<input
|
| 18 |
-
type="text"
|
| 19 |
-
id="person1"
|
| 20 |
-
placeholder="Enter human name"
|
| 21 |
-
class="w-full px-4 py-2 border-2 border-gray-300 rounded-lg focus:outline-none focus:border-indigo-500 transition"
|
| 22 |
-
>
|
| 23 |
-
</div>
|
| 24 |
-
|
| 25 |
-
<div>
|
| 26 |
-
<label class="block text-sm font-semibold text-gray-700 mb-2">AI</label>
|
| 27 |
-
<input
|
| 28 |
-
type="text"
|
| 29 |
-
id="person2"
|
| 30 |
-
placeholder="Enter AI name"
|
| 31 |
-
class="w-full px-4 py-2 border-2 border-gray-300 rounded-lg focus:outline-none focus:border-indigo-500 transition"
|
| 32 |
-
>
|
| 33 |
-
</div>
|
| 34 |
-
|
| 35 |
-
<button
|
| 36 |
-
onclick="addData()"
|
| 37 |
-
class="w-full bg-indigo-600 hover:bg-indigo-700 text-white font-bold py-2 px-4 rounded-lg transition duration-200 ease-in-out transform hover:scale-105"
|
| 38 |
-
>
|
| 39 |
-
ADD
|
| 40 |
-
</button>
|
| 41 |
-
</div>
|
| 42 |
-
|
| 43 |
-
<!-- Status Message -->
|
| 44 |
-
<div id="statusMessage" class="mb-6 text-center"></div>
|
| 45 |
-
|
| 46 |
-
<!-- Download Button -->
|
| 47 |
-
<button
|
| 48 |
-
onclick="openPasswordModal()"
|
| 49 |
-
class="w-full bg-green-600 hover:bg-green-700 text-white font-bold py-2 px-4 rounded-lg transition duration-200 ease-in-out transform hover:scale-105"
|
| 50 |
-
>
|
| 51 |
-
Download Data
|
| 52 |
-
</button>
|
| 53 |
-
</div>
|
| 54 |
-
|
| 55 |
-
<!-- Password Modal -->
|
| 56 |
-
<div id="passwordModal" class="hidden fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
|
| 57 |
-
<div class="bg-white rounded-lg p-8 max-w-sm w-full mx-4 shadow-2xl">
|
| 58 |
-
<h2 class="text-2xl font-bold text-gray-800 mb-6">Enter Password</h2>
|
| 59 |
-
|
| 60 |
-
<input
|
| 61 |
-
type="password"
|
| 62 |
-
id="passwordInput"
|
| 63 |
-
placeholder="Enter password"
|
| 64 |
-
class="w-full px-4 py-2 border-2 border-gray-300 rounded-lg focus:outline-none focus:border-indigo-500 transition mb-6"
|
| 65 |
-
>
|
| 66 |
-
|
| 67 |
-
<div id="passwordError" class="text-red-600 text-sm mb-4 text-center hidden"></div>
|
| 68 |
-
|
| 69 |
-
<div class="flex gap-3">
|
| 70 |
-
<button
|
| 71 |
-
onclick="closePasswordModal()"
|
| 72 |
-
class="flex-1 bg-gray-400 hover:bg-gray-500 text-white font-bold py-2 px-4 rounded-lg transition"
|
| 73 |
-
>
|
| 74 |
-
Cancel
|
| 75 |
-
</button>
|
| 76 |
-
<button
|
| 77 |
-
onclick="verifyPassword()"
|
| 78 |
-
class="flex-1 bg-indigo-600 hover:bg-indigo-700 text-white font-bold py-2 px-4 rounded-lg transition"
|
| 79 |
-
>
|
| 80 |
-
Submit
|
| 81 |
-
</button>
|
| 82 |
-
</div>
|
| 83 |
-
</div>
|
| 84 |
-
</div>
|
| 85 |
-
|
| 86 |
-
<script>
|
| 87 |
-
function addData() {
|
| 88 |
-
const person1 = document.getElementById('person1').value;
|
| 89 |
-
const person2 = document.getElementById('person2').value;
|
| 90 |
-
const statusMsg = document.getElementById('statusMessage');
|
| 91 |
-
|
| 92 |
-
if (!person1 || !person2) {
|
| 93 |
-
showStatus('Please fill in both fields', 'error');
|
| 94 |
-
return;
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
fetch('/add_data', {
|
| 98 |
-
method: 'POST',
|
| 99 |
-
headers: {
|
| 100 |
-
'Content-Type': 'application/json'
|
| 101 |
-
},
|
| 102 |
-
body: JSON.stringify({
|
| 103 |
-
person1: person1,
|
| 104 |
-
person2: person2
|
| 105 |
-
})
|
| 106 |
-
})
|
| 107 |
-
.then(response => response.json())
|
| 108 |
-
.then(data => {
|
| 109 |
-
if (data.success) {
|
| 110 |
-
showStatus('✓ Data added successfully', 'success');
|
| 111 |
-
document.getElementById('person1').value = '';
|
| 112 |
-
document.getElementById('person2').value = '';
|
| 113 |
-
document.getElementById('person1').focus();
|
| 114 |
-
} else {
|
| 115 |
-
showStatus('✗ ' + data.message, 'error');
|
| 116 |
-
}
|
| 117 |
-
})
|
| 118 |
-
.catch(error => {
|
| 119 |
-
showStatus('✗ Error: ' + error, 'error');
|
| 120 |
-
});
|
| 121 |
-
}
|
| 122 |
-
|
| 123 |
-
function openPasswordModal() {
|
| 124 |
-
document.getElementById('passwordModal').classList.remove('hidden');
|
| 125 |
-
document.getElementById('passwordInput').value = '';
|
| 126 |
-
document.getElementById('passwordError').classList.add('hidden');
|
| 127 |
-
document.getElementById('passwordInput').focus();
|
| 128 |
-
}
|
| 129 |
-
|
| 130 |
-
function closePasswordModal() {
|
| 131 |
-
document.getElementById('passwordModal').classList.add('hidden');
|
| 132 |
-
}
|
| 133 |
-
|
| 134 |
-
function verifyPassword() {
|
| 135 |
-
const password = document.getElementById('passwordInput').value;
|
| 136 |
-
const errorMsg = document.getElementById('passwordError');
|
| 137 |
-
|
| 138 |
-
if (!password) {
|
| 139 |
-
errorMsg.textContent = 'Please enter a password';
|
| 140 |
-
errorMsg.classList.remove('hidden');
|
| 141 |
-
return;
|
| 142 |
-
}
|
| 143 |
-
|
| 144 |
-
fetch('/verify_password', {
|
| 145 |
-
method: 'POST',
|
| 146 |
-
headers: {
|
| 147 |
-
'Content-Type': 'application/json'
|
| 148 |
-
},
|
| 149 |
-
body: JSON.stringify({
|
| 150 |
-
password: password
|
| 151 |
-
})
|
| 152 |
-
})
|
| 153 |
-
.then(response => response.json())
|
| 154 |
-
.then(data => {
|
| 155 |
-
if (data.success) {
|
| 156 |
-
closePasswordModal();
|
| 157 |
-
window.location.href = '/download_csv';
|
| 158 |
-
} else {
|
| 159 |
-
errorMsg.textContent = 'Incorrect password';
|
| 160 |
-
errorMsg.classList.remove('hidden');
|
| 161 |
-
}
|
| 162 |
-
})
|
| 163 |
-
.catch(error => {
|
| 164 |
-
errorMsg.textContent = 'Error: ' + error;
|
| 165 |
-
errorMsg.classList.remove('hidden');
|
| 166 |
-
});
|
| 167 |
-
}
|
| 168 |
-
|
| 169 |
-
function showStatus(message, type) {
|
| 170 |
-
const statusMsg = document.getElementById('statusMessage');
|
| 171 |
-
statusMsg.textContent = message;
|
| 172 |
-
statusMsg.className = 'text-center font-semibold text-sm p-3 rounded-lg';
|
| 173 |
-
|
| 174 |
-
if (type === 'success') {
|
| 175 |
-
statusMsg.classList.add('bg-green-100', 'text-green-700');
|
| 176 |
-
} else {
|
| 177 |
-
statusMsg.classList.add('bg-red-100', 'text-red-700');
|
| 178 |
-
}
|
| 179 |
-
|
| 180 |
-
setTimeout(() => {
|
| 181 |
-
statusMsg.textContent = '';
|
| 182 |
-
statusMsg.className = 'text-center';
|
| 183 |
-
}, 3000);
|
| 184 |
-
}
|
| 185 |
-
|
| 186 |
-
// Allow Enter key to submit
|
| 187 |
-
document.getElementById('person2').addEventListener('keypress', function(e) {
|
| 188 |
-
if (e.key === 'Enter') addData();
|
| 189 |
-
});
|
| 190 |
-
|
| 191 |
-
document.getElementById('passwordInput').addEventListener('keypress', function(e) {
|
| 192 |
-
if (e.key === 'Enter') verifyPassword();
|
| 193 |
-
});
|
| 194 |
-
</script>
|
| 195 |
-
</body>
|
| 196 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|