Add 2 files
Browse files- README.md +7 -5
- index.html +404 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: communication-preference
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: pink
|
| 5 |
+
colorTo: pink
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,404 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Communication Preference Management</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
.fade-in {
|
| 11 |
+
animation: fadeIn 0.3s ease-in-out;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
@keyframes fadeIn {
|
| 15 |
+
from { opacity: 0; }
|
| 16 |
+
to { opacity: 1; }
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
.slide-up {
|
| 20 |
+
animation: slideUp 0.3s ease-out;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
@keyframes slideUp {
|
| 24 |
+
from { transform: translateY(20px); opacity: 0; }
|
| 25 |
+
to { transform: translateY(0); opacity: 1; }
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
.file-input-wrapper {
|
| 29 |
+
position: relative;
|
| 30 |
+
overflow: hidden;
|
| 31 |
+
display: inline-block;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
.file-input-wrapper input[type=file] {
|
| 35 |
+
position: absolute;
|
| 36 |
+
left: 0;
|
| 37 |
+
top: 0;
|
| 38 |
+
opacity: 0;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
.tab-content {
|
| 42 |
+
display: none;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.tab-content.active {
|
| 46 |
+
display: block;
|
| 47 |
+
animation: fadeIn 0.3s ease-in-out;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
.tag {
|
| 51 |
+
display: inline-flex;
|
| 52 |
+
align-items: center;
|
| 53 |
+
background-color: #e2e8f0;
|
| 54 |
+
border-radius: 9999px;
|
| 55 |
+
padding: 0.25rem 0.75rem;
|
| 56 |
+
margin-right: 0.5rem;
|
| 57 |
+
margin-bottom: 0.5rem;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
.tag-remove {
|
| 61 |
+
margin-left: 0.5rem;
|
| 62 |
+
cursor: pointer;
|
| 63 |
+
color: #64748b;
|
| 64 |
+
}
|
| 65 |
+
</style>
|
| 66 |
+
</head>
|
| 67 |
+
<body class="bg-gray-100">
|
| 68 |
+
<div class="container mx-auto p-4">
|
| 69 |
+
<button id="openModalBtn" class="bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg transition duration-200">
|
| 70 |
+
<i class="fas fa-plus mr-2"></i> Add Communication Preference
|
| 71 |
+
</button>
|
| 72 |
+
</div>
|
| 73 |
+
|
| 74 |
+
<!-- Modal -->
|
| 75 |
+
<div id="preferenceModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 hidden">
|
| 76 |
+
<div class="bg-white rounded-xl shadow-2xl w-full max-w-3xl max-h-[90vh] overflow-y-auto slide-up">
|
| 77 |
+
<!-- Modal Header -->
|
| 78 |
+
<div class="border-b border-gray-200 p-6 sticky top-0 bg-white z-10">
|
| 79 |
+
<div class="flex justify-between items-center">
|
| 80 |
+
<h3 class="text-2xl font-semibold text-gray-800">Manage Communication Preference</h3>
|
| 81 |
+
<button id="closeModalBtn" class="text-gray-500 hover:text-gray-700">
|
| 82 |
+
<i class="fas fa-times text-xl"></i>
|
| 83 |
+
</button>
|
| 84 |
+
</div>
|
| 85 |
+
</div>
|
| 86 |
+
|
| 87 |
+
<!-- Modal Body -->
|
| 88 |
+
<div class="p-6 space-y-6">
|
| 89 |
+
<!-- Basic Information Section -->
|
| 90 |
+
<div>
|
| 91 |
+
<h4 class="text-lg font-medium text-gray-800 mb-4">Basic Information</h4>
|
| 92 |
+
<div class="space-y-4">
|
| 93 |
+
<div>
|
| 94 |
+
<label for="preferenceName" class="block text-sm font-medium text-gray-700 mb-1">Preference Name *</label>
|
| 95 |
+
<input type="text" id="preferenceName" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 96 |
+
</div>
|
| 97 |
+
|
| 98 |
+
<div>
|
| 99 |
+
<label for="description" class="block text-sm font-medium text-gray-700 mb-1">Description</label>
|
| 100 |
+
<textarea id="description" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea>
|
| 101 |
+
</div>
|
| 102 |
+
|
| 103 |
+
<div>
|
| 104 |
+
<label for="tooltip" class="block text-sm font-medium text-gray-700 mb-1">Tooltip Text</label>
|
| 105 |
+
<input type="text" id="tooltip" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 106 |
+
<p class="text-xs text-gray-500 mt-1">This will appear when users hover over the preference name</p>
|
| 107 |
+
</div>
|
| 108 |
+
|
| 109 |
+
<div class="flex items-center">
|
| 110 |
+
<input type="checkbox" id="isMandatory" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
|
| 111 |
+
<label for="isMandatory" class="ml-2 block text-sm text-gray-700">This preference is mandatory</label>
|
| 112 |
+
</div>
|
| 113 |
+
</div>
|
| 114 |
+
</div>
|
| 115 |
+
|
| 116 |
+
<!-- User Assignment Section -->
|
| 117 |
+
<div>
|
| 118 |
+
<h4 class="text-lg font-medium text-gray-800 mb-4">User Assignment</h4>
|
| 119 |
+
|
| 120 |
+
<div class="space-y-4">
|
| 121 |
+
<div class="space-y-2">
|
| 122 |
+
<div class="flex items-center space-x-4">
|
| 123 |
+
<div class="flex items-center">
|
| 124 |
+
<input type="radio" id="assignAll" name="assignmentType" value="all" checked class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300">
|
| 125 |
+
<label for="assignAll" class="ml-2 block text-sm text-gray-700">Assign to all users</label>
|
| 126 |
+
</div>
|
| 127 |
+
|
| 128 |
+
<div class="flex items-center">
|
| 129 |
+
<input type="radio" id="assignNone" name="assignmentType" value="none" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300">
|
| 130 |
+
<label for="assignNone" class="ml-2 block text-sm text-gray-700">Assign to no users</label>
|
| 131 |
+
</div>
|
| 132 |
+
|
| 133 |
+
<div class="flex items-center">
|
| 134 |
+
<input type="radio" id="assignSome" name="assignmentType" value="some" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300">
|
| 135 |
+
<label for="assignSome" class="ml-2 block text-sm text-gray-700">Assign to specific users</label>
|
| 136 |
+
</div>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
|
| 140 |
+
<!-- Conditional Content for Specific Assignment -->
|
| 141 |
+
<div id="specificAssignmentContent" class="hidden bg-gray-50 p-4 rounded-lg">
|
| 142 |
+
<div class="mb-4">
|
| 143 |
+
<h5 class="text-sm font-medium text-gray-700 mb-2">Select assignment method:</h5>
|
| 144 |
+
<div class="flex space-x-4">
|
| 145 |
+
<button type="button" data-tab="regionCountry" class="assignment-tab-btn px-3 py-1 bg-blue-100 text-blue-700 rounded-md text-sm font-medium">Region & Country</button>
|
| 146 |
+
<button type="button" data-tab="userTags" class="assignment-tab-btn px-3 py-1 bg-gray-200 text-gray-700 rounded-md text-sm font-medium">User Tags</button>
|
| 147 |
+
<button type="button" data-tab="contactRoles" class="assignment-tab-btn px-3 py-1 bg-gray-200 text-gray-700 rounded-md text-sm font-medium">Key Contact Roles</button>
|
| 148 |
+
<button type="button" data-tab="importUsers" class="assignment-tab-btn px-3 py-1 bg-gray-200 text-gray-700 rounded-md text-sm font-medium">Import Users</button>
|
| 149 |
+
</div>
|
| 150 |
+
</div>
|
| 151 |
+
|
| 152 |
+
<!-- Tab Contents -->
|
| 153 |
+
<div class="space-y-4">
|
| 154 |
+
<!-- Region & Country Tab -->
|
| 155 |
+
<div id="regionCountry" class="tab-content active">
|
| 156 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 157 |
+
<div>
|
| 158 |
+
<label for="region" class="block text-sm font-medium text-gray-700 mb-1">Region</label>
|
| 159 |
+
<select id="region" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 160 |
+
<option value="">Select a region</option>
|
| 161 |
+
<option value="europe">Europe</option>
|
| 162 |
+
<option value="asia">Asia</option>
|
| 163 |
+
<option value="americas">Americas</option>
|
| 164 |
+
<option value="africa">Africa</option>
|
| 165 |
+
</select>
|
| 166 |
+
</div>
|
| 167 |
+
|
| 168 |
+
<div>
|
| 169 |
+
<label for="country" class="block text-sm font-medium text-gray-700 mb-1">Country</label>
|
| 170 |
+
<select id="country" disabled class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 bg-gray-100">
|
| 171 |
+
<option value="">Select a region first</option>
|
| 172 |
+
</select>
|
| 173 |
+
</div>
|
| 174 |
+
</div>
|
| 175 |
+
</div>
|
| 176 |
+
|
| 177 |
+
<!-- User Tags Tab -->
|
| 178 |
+
<div id="userTags" class="tab-content">
|
| 179 |
+
<div>
|
| 180 |
+
<label for="tagInput" class="block text-sm font-medium text-gray-700 mb-1">Add User Tags</label>
|
| 181 |
+
<div class="flex">
|
| 182 |
+
<input type="text" id="tagInput" class="flex-1 px-3 py-2 border border-gray-300 rounded-l-md focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Enter tags separated by commas">
|
| 183 |
+
<button type="button" id="addTagsBtn" class="px-4 py-2 bg-blue-600 text-white rounded-r-md hover:bg-blue-700">Add</button>
|
| 184 |
+
</div>
|
| 185 |
+
<div id="tagsContainer" class="mt-2 flex flex-wrap"></div>
|
| 186 |
+
</div>
|
| 187 |
+
</div>
|
| 188 |
+
|
| 189 |
+
<!-- Key Contact Roles Tab -->
|
| 190 |
+
<div id="contactRoles" class="tab-content">
|
| 191 |
+
<div>
|
| 192 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Select Key Contact Roles</label>
|
| 193 |
+
<div class="space-y-2">
|
| 194 |
+
<div class="flex items-center">
|
| 195 |
+
<input type="checkbox" id="roleAdmin" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
|
| 196 |
+
<label for="roleAdmin" class="ml-2 block text-sm text-gray-700">Administrator</label>
|
| 197 |
+
</div>
|
| 198 |
+
<div class="flex items-center">
|
| 199 |
+
<input type="checkbox" id="roleManager" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
|
| 200 |
+
<label for="roleManager" class="ml-2 block text-sm text-gray-700">Manager</label>
|
| 201 |
+
</div>
|
| 202 |
+
<div class="flex items-center">
|
| 203 |
+
<input type="checkbox" id="roleSupervisor" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
|
| 204 |
+
<label for="roleSupervisor" class="ml-2 block text-sm text-gray-700">Supervisor</label>
|
| 205 |
+
</div>
|
| 206 |
+
<div class="flex items-center">
|
| 207 |
+
<input type="checkbox" id="roleCoordinator" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
|
| 208 |
+
<label for="roleCoordinator" class="ml-2 block text-sm text-gray-700">Coordinator</label>
|
| 209 |
+
</div>
|
| 210 |
+
</div>
|
| 211 |
+
</div>
|
| 212 |
+
</div>
|
| 213 |
+
|
| 214 |
+
<!-- Import Users Tab -->
|
| 215 |
+
<div id="importUsers" class="tab-content">
|
| 216 |
+
<div>
|
| 217 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Import Users from File</label>
|
| 218 |
+
<div class="file-input-wrapper">
|
| 219 |
+
<button type="button" class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700">
|
| 220 |
+
<i class="fas fa-upload mr-2"></i> Choose Excel/CSV File
|
| 221 |
+
</button>
|
| 222 |
+
<input type="file" id="userImportFile" accept=".xlsx,.xls,.csv" class="hidden">
|
| 223 |
+
</div>
|
| 224 |
+
<p class="text-xs text-gray-500 mt-2">Supported formats: .xlsx, .xls, .csv</p>
|
| 225 |
+
<div id="fileInfo" class="mt-2 text-sm text-gray-600 hidden">
|
| 226 |
+
<i class="fas fa-check-circle text-green-500 mr-1"></i>
|
| 227 |
+
<span id="fileName"></span> selected
|
| 228 |
+
</div>
|
| 229 |
+
</div>
|
| 230 |
+
</div>
|
| 231 |
+
</div>
|
| 232 |
+
</div>
|
| 233 |
+
</div>
|
| 234 |
+
</div>
|
| 235 |
+
</div>
|
| 236 |
+
|
| 237 |
+
<!-- Modal Footer -->
|
| 238 |
+
<div class="border-t border-gray-200 p-6 sticky bottom-0 bg-white">
|
| 239 |
+
<div class="flex justify-end space-x-3">
|
| 240 |
+
<button type="button" id="cancelBtn" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50">Cancel</button>
|
| 241 |
+
<button type="button" id="saveBtn" class="px-4 py-2 bg-blue-600 text-white rounded-md text-sm font-medium hover:bg-blue-700">Save Preference</button>
|
| 242 |
+
</div>
|
| 243 |
+
</div>
|
| 244 |
+
</div>
|
| 245 |
+
</div>
|
| 246 |
+
|
| 247 |
+
<script>
|
| 248 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 249 |
+
// Modal toggle
|
| 250 |
+
const modal = document.getElementById('preferenceModal');
|
| 251 |
+
const openModalBtn = document.getElementById('openModalBtn');
|
| 252 |
+
const closeModalBtn = document.getElementById('closeModalBtn');
|
| 253 |
+
const cancelBtn = document.getElementById('cancelBtn');
|
| 254 |
+
|
| 255 |
+
openModalBtn.addEventListener('click', () => {
|
| 256 |
+
modal.classList.remove('hidden');
|
| 257 |
+
});
|
| 258 |
+
|
| 259 |
+
[closeModalBtn, cancelBtn].forEach(btn => {
|
| 260 |
+
btn.addEventListener('click', () => {
|
| 261 |
+
modal.classList.add('hidden');
|
| 262 |
+
});
|
| 263 |
+
});
|
| 264 |
+
|
| 265 |
+
// Assignment type toggle
|
| 266 |
+
const assignmentRadios = document.querySelectorAll('input[name="assignmentType"]');
|
| 267 |
+
const specificAssignmentContent = document.getElementById('specificAssignmentContent');
|
| 268 |
+
|
| 269 |
+
assignmentRadios.forEach(radio => {
|
| 270 |
+
radio.addEventListener('change', function() {
|
| 271 |
+
if (this.value === 'some') {
|
| 272 |
+
specificAssignmentContent.classList.remove('hidden');
|
| 273 |
+
} else {
|
| 274 |
+
specificAssignmentContent.classList.add('hidden');
|
| 275 |
+
}
|
| 276 |
+
});
|
| 277 |
+
});
|
| 278 |
+
|
| 279 |
+
// Tab switching
|
| 280 |
+
const tabButtons = document.querySelectorAll('.assignment-tab-btn');
|
| 281 |
+
|
| 282 |
+
tabButtons.forEach(button => {
|
| 283 |
+
button.addEventListener('click', function() {
|
| 284 |
+
// Update active tab button
|
| 285 |
+
tabButtons.forEach(btn => {
|
| 286 |
+
btn.classList.remove('bg-blue-100', 'text-blue-700');
|
| 287 |
+
btn.classList.add('bg-gray-200', 'text-gray-700');
|
| 288 |
+
});
|
| 289 |
+
this.classList.remove('bg-gray-200', 'text-gray-700');
|
| 290 |
+
this.classList.add('bg-blue-100', 'text-blue-700');
|
| 291 |
+
|
| 292 |
+
// Show corresponding tab content
|
| 293 |
+
const tabId = this.getAttribute('data-tab');
|
| 294 |
+
document.querySelectorAll('.tab-content').forEach(content => {
|
| 295 |
+
content.classList.remove('active');
|
| 296 |
+
});
|
| 297 |
+
document.getElementById(tabId).classList.add('active');
|
| 298 |
+
});
|
| 299 |
+
});
|
| 300 |
+
|
| 301 |
+
// Region-country dependency
|
| 302 |
+
const regionSelect = document.getElementById('region');
|
| 303 |
+
const countrySelect = document.getElementById('country');
|
| 304 |
+
|
| 305 |
+
const countryOptions = {
|
| 306 |
+
europe: ['United Kingdom', 'Germany', 'France', 'Spain', 'Italy'],
|
| 307 |
+
asia: ['China', 'Japan', 'India', 'South Korea', 'Singapore'],
|
| 308 |
+
americas: ['United States', 'Canada', 'Brazil', 'Mexico', 'Argentina'],
|
| 309 |
+
africa: ['South Africa', 'Egypt', 'Nigeria', 'Kenya', 'Morocco']
|
| 310 |
+
};
|
| 311 |
+
|
| 312 |
+
regionSelect.addEventListener('change', function() {
|
| 313 |
+
if (this.value) {
|
| 314 |
+
countrySelect.disabled = false;
|
| 315 |
+
countrySelect.innerHTML = '<option value="">Select a country</option>';
|
| 316 |
+
countrySelect.classList.remove('bg-gray-100');
|
| 317 |
+
|
| 318 |
+
countryOptions[this.value].forEach(country => {
|
| 319 |
+
const option = document.createElement('option');
|
| 320 |
+
option.value = country.toLowerCase().replace(' ', '-');
|
| 321 |
+
option.textContent = country;
|
| 322 |
+
countrySelect.appendChild(option);
|
| 323 |
+
});
|
| 324 |
+
} else {
|
| 325 |
+
countrySelect.disabled = true;
|
| 326 |
+
countrySelect.innerHTML = '<option value="">Select a region first</option>';
|
| 327 |
+
countrySelect.classList.add('bg-gray-100');
|
| 328 |
+
}
|
| 329 |
+
});
|
| 330 |
+
|
| 331 |
+
// Tag management
|
| 332 |
+
const tagInput = document.getElementById('tagInput');
|
| 333 |
+
const addTagsBtn = document.getElementById('addTagsBtn');
|
| 334 |
+
const tagsContainer = document.getElementById('tagsContainer');
|
| 335 |
+
|
| 336 |
+
addTagsBtn.addEventListener('click', function() {
|
| 337 |
+
const tagsText = tagInput.value.trim();
|
| 338 |
+
if (tagsText) {
|
| 339 |
+
const tags = tagsText.split(',').map(tag => tag.trim()).filter(tag => tag);
|
| 340 |
+
|
| 341 |
+
tags.forEach(tag => {
|
| 342 |
+
const tagElement = document.createElement('div');
|
| 343 |
+
tagElement.className = 'tag';
|
| 344 |
+
tagElement.innerHTML = `
|
| 345 |
+
${tag}
|
| 346 |
+
<span class="tag-remove" onclick="this.parentElement.remove()">
|
| 347 |
+
<i class="fas fa-times"></i>
|
| 348 |
+
</span>
|
| 349 |
+
`;
|
| 350 |
+
tagsContainer.appendChild(tagElement);
|
| 351 |
+
});
|
| 352 |
+
|
| 353 |
+
tagInput.value = '';
|
| 354 |
+
}
|
| 355 |
+
});
|
| 356 |
+
|
| 357 |
+
// File upload display
|
| 358 |
+
const fileInput = document.getElementById('userImportFile');
|
| 359 |
+
const fileInfo = document.getElementById('fileInfo');
|
| 360 |
+
const fileName = document.getElementById('fileName');
|
| 361 |
+
|
| 362 |
+
fileInput.addEventListener('change', function() {
|
| 363 |
+
if (this.files.length > 0) {
|
| 364 |
+
fileName.textContent = this.files[0].name;
|
| 365 |
+
fileInfo.classList.remove('hidden');
|
| 366 |
+
} else {
|
| 367 |
+
fileInfo.classList.add('hidden');
|
| 368 |
+
}
|
| 369 |
+
});
|
| 370 |
+
|
| 371 |
+
// Save button
|
| 372 |
+
const saveBtn = document.getElementById('saveBtn');
|
| 373 |
+
|
| 374 |
+
saveBtn.addEventListener('click', function() {
|
| 375 |
+
// Validate form
|
| 376 |
+
const preferenceName = document.getElementById('preferenceName').value.trim();
|
| 377 |
+
if (!preferenceName) {
|
| 378 |
+
alert('Please enter a preference name');
|
| 379 |
+
return;
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
// Gather form data (in a real app, you would send this to a server)
|
| 383 |
+
const formData = {
|
| 384 |
+
name: preferenceName,
|
| 385 |
+
description: document.getElementById('description').value.trim(),
|
| 386 |
+
tooltip: document.getElementById('tooltip').value.trim(),
|
| 387 |
+
isMandatory: document.getElementById('isMandatory').checked,
|
| 388 |
+
assignmentType: document.querySelector('input[name="assignmentType"]:checked').value,
|
| 389 |
+
// Add other fields as needed
|
| 390 |
+
};
|
| 391 |
+
|
| 392 |
+
console.log('Form data:', formData);
|
| 393 |
+
alert('Preference saved successfully!');
|
| 394 |
+
modal.classList.add('hidden');
|
| 395 |
+
|
| 396 |
+
// Reset form (in a real app, you might want to keep some values)
|
| 397 |
+
document.querySelector('form').reset();
|
| 398 |
+
tagsContainer.innerHTML = '';
|
| 399 |
+
fileInfo.classList.add('hidden');
|
| 400 |
+
});
|
| 401 |
+
});
|
| 402 |
+
</script>
|
| 403 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=EmilyMooreGlobal/communication-preference" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 404 |
+
</html>
|