Marthee commited on
Commit
b66f47c
·
verified ·
1 Parent(s): 48e48f8

Update templates/proposed-GUI.html

Browse files
Files changed (1) hide show
  1. templates/proposed-GUI.html +18 -16
templates/proposed-GUI.html CHANGED
@@ -399,24 +399,26 @@ PrjPartsArray=[];
399
  PrjSectionsArray=[];
400
  var partsArrwithID=[];
401
  var firstDpwnValue;
 
 
402
  displayprjnames()
403
  function displayprjnames(){
404
  $.get('/getprojectnames/')
405
  .success(function(data) {
406
  document.getElementById("all").style.display = "none";
407
-
408
- for (let i=0;i<data.length;i++)
409
- {
410
- var op0 = document.createElement("OPTION") ;
411
  op0.text= 'Projects'
412
  op0.value= "";
413
  op0.hidden=true;
414
  firstdropdown.add(op0);
 
 
415
  opt=document.createElement("option");
416
- opt.textContent=data[i];
417
- opt.text=data[i];
418
  firstdropdown.append(opt);
419
- PrjNamesArray.push(data[i]);
420
  }
421
 
422
  })
@@ -427,8 +429,7 @@ $.get('/getprojectnames/')
427
  });
428
  }
429
  /*Get chosen value and send to flask to get project parts*/
430
- // firstdropdownInput=document.getElementById('selectionsProjid');
431
- // console.log('kk',firstdropdownInput)
432
  $(firstdropdown).on("change", function (e) {
433
  console.log('clickeds')
434
  firstDpwnValue=firstdropdown.value;
@@ -443,13 +444,14 @@ $(firstdropdown).on("change", function (e) {
443
  if (seconddropdown.options[ii].value)
444
  seconddropdown.remove(ii);
445
  }
446
- console.log(firstDpwnValue)
447
- displayprojparts(firstDpwnValue);
448
  })
449
  var partsArrIDsonly=[]
450
- function displayprojparts(name){
451
  document.getElementById("all").style.display = "block";
452
- $.get('/getprojectparts/'+JSON.stringify(name))
 
453
  .success(function(data){
454
  document.getElementById("all").style.display = "none";
455
  partsArrwithID= data[0];
@@ -478,15 +480,15 @@ $(seconddropdown).on("change", function (e) {
478
  op0.value= "";
479
  op0.hidden=true;
480
  thirddropdown.add(op0);
481
- displayprojsections(firstdropdown.value,seconddropdown.value);
482
  })
483
 
484
- function displayprojsections(projectName,PartName){
485
  console.log(seconddropdown.selectedIndex)
486
  document.getElementById("all").style.display = "block";
487
  measSelect.innerHTML='';
488
  relvSelect.innerHTML='';
489
- $.get('/getprojectsections/'+JSON.stringify([projectName,PartName]))
490
  .success(function(data){
491
  document.getElementById("all").style.display = "none";
492
  for (let i=0;i<data.length;i++)
 
399
  PrjSectionsArray=[];
400
  var partsArrwithID=[];
401
  var firstDpwnValue;
402
+ var prjids=[]
403
+
404
  displayprjnames()
405
  function displayprjnames(){
406
  $.get('/getprojectnames/')
407
  .success(function(data) {
408
  document.getElementById("all").style.display = "none";
409
+ prjids=data[1];
410
+ var op0 = document.createElement("OPTION") ;
 
 
411
  op0.text= 'Projects'
412
  op0.value= "";
413
  op0.hidden=true;
414
  firstdropdown.add(op0);
415
+ for (let i=0;i<data[0].length;i++)
416
+ {
417
  opt=document.createElement("option");
418
+ opt.textContent=data[0][i];
419
+ opt.text=data[0][i];
420
  firstdropdown.append(opt);
421
+ PrjNamesArray.push(data[0][i]);
422
  }
423
 
424
  })
 
429
  });
430
  }
431
  /*Get chosen value and send to flask to get project parts*/
432
+
 
433
  $(firstdropdown).on("change", function (e) {
434
  console.log('clickeds')
435
  firstDpwnValue=firstdropdown.value;
 
444
  if (seconddropdown.options[ii].value)
445
  seconddropdown.remove(ii);
446
  }
447
+
448
+ displayprojparts(prjids[(firstdropdown.selectedIndex)-1]);
449
  })
450
  var partsArrIDsonly=[]
451
+ function displayprojparts(val){
452
  document.getElementById("all").style.display = "block";
453
+ console.log(val)
454
+ $.get('/getprojectparts/'+JSON.stringify(val))
455
  .success(function(data){
456
  document.getElementById("all").style.display = "none";
457
  partsArrwithID= data[0];
 
480
  op0.value= "";
481
  op0.hidden=true;
482
  thirddropdown.add(op0);
483
+ displayprojsections(prjids[(firstdropdown.selectedIndex)-1],partsArrIDsonly[(seconddropdown.selectedIndex)-1]);
484
  })
485
 
486
+ function displayprojsections(projectid,Partid){
487
  console.log(seconddropdown.selectedIndex)
488
  document.getElementById("all").style.display = "block";
489
  measSelect.innerHTML='';
490
  relvSelect.innerHTML='';
491
+ $.get('/getprojectsections/'+JSON.stringify([projectid,Partid]))
492
  .success(function(data){
493
  document.getElementById("all").style.display = "none";
494
  for (let i=0;i<data.length;i++)