Marthee commited on
Commit
e50e63d
·
verified ·
1 Parent(s): 59d50ac

Update templates/proposed-GUI.html

Browse files
Files changed (1) hide show
  1. templates/proposed-GUI.html +66 -28
templates/proposed-GUI.html CHANGED
@@ -125,7 +125,7 @@
125
  <div id ="tomeasurediv">
126
  <div>
127
  <label id="measureLabel">Document To Measure</label>
128
- <input type="search" onkeyup=filterFunction(this.id) id="tomeasureSearchInput">
129
  <!-- <button id="refreshDropboxButtonID"></button> -->
130
  <i hidden class="fa fa-dropbox fa-lg" id="refreshDropboxButtonID">
131
  <span class="dropboxtip">The console updates projects retrieved from Dropbox automatically at 9:00 am and 9:00 p.m. If you need to access any projects in between, just click on this button. Please note that it will refresh the files related to the project you chose only.</span> </i>
@@ -2259,14 +2259,14 @@ let selectedValues = []; // global
2259
  measSelect.appendChild(div);
2260
 
2261
  // Handle duplicates
2262
- if (nameSet.has(name)) {
2263
- label.style.color = "red";
2264
- document.getElementById("TopTextModal").textContent = 'Error: Duplicates Error';
2265
- PopupElement.textContent = 'Duplicate project names were detected while retrieving the project PDFs. Please visit Dropbox and rename the relevant files that you will be working on to ensure each project has a unique name. Once the renaming is complete, return to the console and click on the Dropbox icon to retrieve the updated project names.';
2266
- ShowPopUp();
2267
- } else {
2268
- nameSet.add(name);
2269
- }
2270
  }
2271
 
2272
 
@@ -2334,11 +2334,11 @@ let selectedValues = []; // global
2334
 
2335
  relvSelect.appendChild(divRelv);
2336
 
2337
- if (nameSetRelv.has(name)) {
2338
- label.style.color = "red";
2339
- } else {
2340
- nameSetRelv.add(name);
2341
- }
2342
  }
2343
 
2344
 
@@ -4173,30 +4173,68 @@ dialog_container.style.display = "block";
4173
  }
4174
  };
4175
 
 
 
 
 
 
 
 
 
 
 
 
4176
 
4177
  function filterFunction(id) {
4178
- var input, filter, ul, li, a, i;
4179
- input = document.getElementById(id);
4180
- filter = input.value.toUpperCase();
4181
- if (id.toString().startsWith('tomeasure'))
4182
- a = document.querySelectorAll("#measureContainer .measure-item");
4183
 
4184
- // a = document.getElementById("measureselectid").children;
 
 
4185
  else
4186
- // a = document.getElementById("relvselectid").children;
4187
- a = document.querySelectorAll("#relvselectid .relv-item");
4188
- // a = div.getElementsByTagName("option");
4189
- for (i = 0; i < a.length; i++) {
4190
- txtValue = a[i].textContent || a[i].innerText;
4191
- if (txtValue.toUpperCase().indexOf(filter) > -1) {
4192
- a[i].style.display = "";
 
 
 
4193
  } else {
4194
- a[i].style.display = "none";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4195
  }
 
 
 
 
 
 
4196
  }
4197
  }
4198
 
4199
 
 
4200
  // Call function when show dialog btn is clicked
4201
  var duplicaterExtra = document.getElementById("duplicaterExtra");
4202
  var overlaymeText = document.getElementById("modal-bodyTextp");
 
125
  <div id ="tomeasurediv">
126
  <div>
127
  <label id="measureLabel">Document To Measure</label>
128
+ <input type="search" oninput="handleKey(event, this.id)" id="tomeasureSearchInput">
129
  <!-- <button id="refreshDropboxButtonID"></button> -->
130
  <i hidden class="fa fa-dropbox fa-lg" id="refreshDropboxButtonID">
131
  <span class="dropboxtip">The console updates projects retrieved from Dropbox automatically at 9:00 am and 9:00 p.m. If you need to access any projects in between, just click on this button. Please note that it will refresh the files related to the project you chose only.</span> </i>
 
2259
  measSelect.appendChild(div);
2260
 
2261
  // Handle duplicates
2262
+ // if (nameSet.has(name)) {
2263
+ // label.style.color = "red";
2264
+ // document.getElementById("TopTextModal").textContent = 'Error: Duplicates Error';
2265
+ // PopupElement.textContent = 'Duplicate project names were detected while retrieving the project PDFs. Please visit Dropbox and rename the relevant files that you will be working on to ensure each project has a unique name. Once the renaming is complete, return to the console and click on the Dropbox icon to retrieve the updated project names.';
2266
+ // ShowPopUp();
2267
+ // } else {
2268
+ // nameSet.add(name);
2269
+ // }
2270
  }
2271
 
2272
 
 
2334
 
2335
  relvSelect.appendChild(divRelv);
2336
 
2337
+ // if (nameSetRelv.has(name)) {
2338
+ // label.style.color = "red";
2339
+ // } else {
2340
+ // nameSetRelv.add(name);
2341
+ // }
2342
  }
2343
 
2344
 
 
4173
  }
4174
  };
4175
 
4176
+
4177
+ function handleKey(event, id) {
4178
+ const ignoredKeys = [
4179
+ 'Backspace', 'Delete', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown',
4180
+ 'Shift', 'Control', 'Alt', 'Meta', 'Escape', 'Tab'
4181
+ ];
4182
+
4183
+ if (!ignoredKeys.includes(event.key)) {
4184
+ filterFunction(id);
4185
+ }
4186
+ }
4187
 
4188
  function filterFunction(id) {
4189
+ const nameCount = {}; // Track name frequency
4190
+ let flagnameset = false;
4191
+
4192
+ const input = document.getElementById(id);
4193
+ const filter = input.value.toUpperCase();
4194
 
4195
+ let items;
4196
+ if (id.toString().startsWith('tomeasure'))
4197
+ items = document.querySelectorAll("#measureContainer .measure-item");
4198
  else
4199
+ items = document.querySelectorAll("#relvselectid .relv-item");
4200
+
4201
+ // First pass: count names
4202
+ items.forEach(item => {
4203
+ const txtValue = item.textContent || item.innerText;
4204
+ const name = item.children[1].textContent;
4205
+
4206
+ if (txtValue.toUpperCase().includes(filter)) {
4207
+ nameCount[name] = (nameCount[name] || 0) + 1;
4208
+ item.style.display = "";
4209
  } else {
4210
+ item.style.display = "none";
4211
+ }
4212
+ });
4213
+
4214
+ // Second pass: apply coloring
4215
+ items.forEach(item => {
4216
+ const txtValue = item.textContent || item.innerText;
4217
+ const name = item.children[1].textContent;
4218
+
4219
+ if (txtValue.toUpperCase().includes(filter)) {
4220
+ if (nameCount[name] > 1) {
4221
+ item.style.color = "red";
4222
+ flagnameset = true;
4223
+ } else {
4224
+ item.style.color = ""; // Reset color for unique names
4225
+ }
4226
  }
4227
+ });
4228
+
4229
+ if (flagnameset) {
4230
+ document.getElementById("TopTextModal").textContent = 'Error: Duplicates Error';
4231
+ PopupElement.textContent = 'Duplicate project names were detected while retrieving the project PDFs. Please visit Dropbox and rename the relevant files that you will be working on to ensure each project has a unique name. Once the renaming is complete, return to the console and click on the Dropbox icon to retrieve the updated project names.';
4232
+ ShowPopUp();
4233
  }
4234
  }
4235
 
4236
 
4237
+
4238
  // Call function when show dialog btn is clicked
4239
  var duplicaterExtra = document.getElementById("duplicaterExtra");
4240
  var overlaymeText = document.getElementById("modal-bodyTextp");