Marthee commited on
Commit
ba7f2df
·
verified ·
1 Parent(s): 4db8f84

Update templates/proposed-GUI.html

Browse files
Files changed (1) hide show
  1. templates/proposed-GUI.html +68 -29
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>
@@ -1961,7 +1961,7 @@ var doorSchedulePDF;
1961
  relvSelect.removeChild(relvSelect.firstChild);
1962
  }
1963
  }
1964
- const nameSet = new Set(); // To track unique names
1965
  const nameSetRelv = new Set(); // To track unique names
1966
 
1967
  // Action foconst nameSet = new Set(); // To track unique names
@@ -2255,14 +2255,14 @@ var doorSchedulePDF;
2255
  measSelect.appendChild(div);
2256
 
2257
  // Handle duplicates
2258
- if (nameSet.has(name)) {
2259
- label.style.color = "red";
2260
- document.getElementById("TopTextModal").textContent = 'Error: Duplicates Error';
2261
- 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.';
2262
- ShowPopUp();
2263
- } else {
2264
- nameSet.add(name);
2265
- }
2266
  }
2267
 
2268
 
@@ -2330,11 +2330,11 @@ var doorSchedulePDF;
2330
 
2331
  relvSelect.appendChild(divRelv);
2332
 
2333
- if (nameSetRelv.has(name)) {
2334
- label.style.color = "red";
2335
- } else {
2336
- nameSetRelv.add(name);
2337
- }
2338
  }
2339
 
2340
 
@@ -4163,29 +4163,68 @@ dialog_container.style.display = "block";
4163
  };
4164
 
4165
 
 
 
 
 
 
 
 
 
 
 
 
4166
  function filterFunction(id) {
4167
- var input, filter, ul, li, a, i;
4168
- input = document.getElementById(id);
4169
- filter = input.value.toUpperCase();
4170
- if (id.toString().startsWith('tomeasure'))
4171
- a = document.querySelectorAll("#measureContainer .measure-item");
4172
 
4173
- // a = document.getElementById("measureselectid").children;
 
 
4174
  else
4175
- // a = document.getElementById("relvselectid").children;
4176
- a = document.querySelectorAll("#relvselectid .relv-item");
4177
- // a = div.getElementsByTagName("option");
4178
- for (i = 0; i < a.length; i++) {
4179
- txtValue = a[i].textContent || a[i].innerText;
4180
- if (txtValue.toUpperCase().indexOf(filter) > -1) {
4181
- a[i].style.display = "";
 
 
 
4182
  } else {
4183
- a[i].style.display = "none";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4184
  }
 
 
 
 
 
 
4185
  }
4186
  }
4187
 
4188
 
 
 
4189
  // Call function when show dialog btn is clicked
4190
  var duplicaterExtra = document.getElementById("duplicaterExtra");
4191
  var overlaymeText = document.getElementById("modal-bodyTextp");
 
125
  <div id ="tomeasurediv">
126
  <div>
127
  <label id="measureLabel">Document To Measure</label>
128
+ <input type="search" onkeydown="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>
 
1961
  relvSelect.removeChild(relvSelect.firstChild);
1962
  }
1963
  }
1964
+ // const nameSet = new Set(); // To track unique names
1965
  const nameSetRelv = new Set(); // To track unique names
1966
 
1967
  // Action foconst nameSet = new Set(); // To track unique names
 
2255
  measSelect.appendChild(div);
2256
 
2257
  // Handle duplicates
2258
+ // if (nameSet.has(name)) {
2259
+ // label.style.color = "red";
2260
+ // document.getElementById("TopTextModal").textContent = 'Error: Duplicates Error';
2261
+ // 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.';
2262
+ // ShowPopUp();
2263
+ // } else {
2264
+ // nameSet.add(name);
2265
+ // }
2266
  }
2267
 
2268
 
 
2330
 
2331
  relvSelect.appendChild(divRelv);
2332
 
2333
+ // if (nameSetRelv.has(name)) {
2334
+ // label.style.color = "red";
2335
+ // } else {
2336
+ // nameSetRelv.add(name);
2337
+ // }
2338
  }
2339
 
2340
 
 
4163
  };
4164
 
4165
 
4166
+ function handleKey(event, id) {
4167
+ const ignoredKeys = [
4168
+ 'Backspace', 'Delete', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown',
4169
+ 'Shift', 'Control', 'Alt', 'Meta', 'Escape', 'Tab'
4170
+ ];
4171
+
4172
+ if (!ignoredKeys.includes(event.key)) {
4173
+ filterFunction(id);
4174
+ }
4175
+ }
4176
+
4177
  function filterFunction(id) {
4178
+ const nameCount = {}; // Track name frequency
4179
+ let flagnameset = false;
4180
+
4181
+ const input = document.getElementById(id);
4182
+ const filter = input.value.toUpperCase();
4183
 
4184
+ let items;
4185
+ if (id.toString().startsWith('tomeasure'))
4186
+ items = document.querySelectorAll("#measureContainer .measure-item");
4187
  else
4188
+ items = document.querySelectorAll("#relvselectid .relv-item");
4189
+
4190
+ // First pass: count names
4191
+ items.forEach(item => {
4192
+ const txtValue = item.textContent || item.innerText;
4193
+ const name = item.children[1].textContent;
4194
+
4195
+ if (txtValue.toUpperCase().includes(filter)) {
4196
+ nameCount[name] = (nameCount[name] || 0) + 1;
4197
+ item.style.display = "";
4198
  } else {
4199
+ item.style.display = "none";
4200
+ }
4201
+ });
4202
+
4203
+ // Second pass: apply coloring
4204
+ items.forEach(item => {
4205
+ const txtValue = item.textContent || item.innerText;
4206
+ const name = item.children[1].textContent;
4207
+
4208
+ if (txtValue.toUpperCase().includes(filter)) {
4209
+ if (nameCount[name] > 1) {
4210
+ item.style.color = "red";
4211
+ flagnameset = true;
4212
+ } else {
4213
+ item.style.color = ""; // Reset color for unique names
4214
+ }
4215
  }
4216
+ });
4217
+
4218
+ if (flagnameset) {
4219
+ document.getElementById("TopTextModal").textContent = 'Error: Duplicates Error';
4220
+ 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.';
4221
+ ShowPopUp();
4222
  }
4223
  }
4224
 
4225
 
4226
+
4227
+
4228
  // Call function when show dialog btn is clicked
4229
  var duplicaterExtra = document.getElementById("duplicaterExtra");
4230
  var overlaymeText = document.getElementById("modal-bodyTextp");