Marthee commited on
Commit
9c70185
·
verified ·
1 Parent(s): c1d20df

Update templates/proposed-GUI.html

Browse files
Files changed (1) hide show
  1. templates/proposed-GUI.html +22 -13
templates/proposed-GUI.html CHANGED
@@ -506,7 +506,11 @@ $(seconddropdown).on("change", function (e) {
506
  thirddropdown.add(op0);
507
  displayprojsections(prjids[(firstdropdown.selectedIndex)-1],partsArrIDsonly[(seconddropdown.selectedIndex)-1]);
508
  })
509
-
 
 
 
 
510
  function displayprojsections(projectid,Partid){
511
  console.log(seconddropdown.selectedIndex)
512
  document.getElementById("all").style.display = "block";
@@ -517,19 +521,24 @@ function displayprojsections(projectid,Partid){
517
  document.getElementById("all").style.display = "none";
518
  for (let i=0;i<data.length;i++)
519
  {
520
- opt=document.createElement("option");
521
- opt.value=data[i];
522
- opt.text=data[i];
523
- thirddropdown.append(opt);
 
 
 
524
 
525
- if(!(data[i].startsWith('1.0') ) && !(data[i].startsWith('3.2')) && !(data[i].startsWith('2.8')) && !(data[i].startsWith('3.3')) ) // ||data[i].startsWith('2.2')))
526
- {
527
- opt.style.color='#bdbcbc';
528
- opt.style.cursor='not-allowed';
529
- opt.setAttribute('disabled',true)
530
- }
531
- PrjSectionsArray.push(data[i]);
532
- }
 
 
533
  })
534
  .error(function(jqXHR, textStatus, errorThrown) {
535
  PopupElement.textContent='Error occured while retrieving the Project Sections. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
 
506
  thirddropdown.add(op0);
507
  displayprojsections(prjids[(firstdropdown.selectedIndex)-1],partsArrIDsonly[(seconddropdown.selectedIndex)-1]);
508
  })
509
+ function isValueNotInDropdown(dropdown, value) {
510
+ // const dropdown = document.getElementById(dropdownId);
511
+ const values = Array.from(dropdown.options).map(option => option.value);
512
+ return !values.includes(value); // Check if the value is not in dropdown values
513
+ }
514
  function displayprojsections(projectid,Partid){
515
  console.log(seconddropdown.selectedIndex)
516
  document.getElementById("all").style.display = "block";
 
521
  document.getElementById("all").style.display = "none";
522
  for (let i=0;i<data.length;i++)
523
  {
524
+ valueDoesNotExist=isValueNotInDropdown(thirddropdown, data[i])
525
+ if (valueDoesNotExist)
526
+ {
527
+ opt=document.createElement("option");
528
+ opt.value=data[i];
529
+ opt.text=data[i];
530
+ thirddropdown.append(opt);
531
 
532
+ if(!(data[i].startsWith('1.0') ) && !(data[i].startsWith('3.2')) && !(data[i].startsWith('2.8')) && !(data[i].startsWith('3.3')) ) // ||data[i].startsWith('2.2')))
533
+ {
534
+ opt.style.color='#bdbcbc';
535
+ opt.style.cursor='not-allowed';
536
+ opt.setAttribute('disabled',true)
537
+ }
538
+ PrjSectionsArray.push(data[i]);
539
+
540
+ }
541
+ }
542
  })
543
  .error(function(jqXHR, textStatus, errorThrown) {
544
  PopupElement.textContent='Error occured while retrieving the Project Sections. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';