Marthee commited on
Commit
f479e8f
·
verified ·
1 Parent(s): 184c035

Update templates/proposed-GUI.html

Browse files
Files changed (1) hide show
  1. templates/proposed-GUI.html +28 -7
templates/proposed-GUI.html CHANGED
@@ -891,8 +891,9 @@ $toggle.addEventListener('click', function() {
891
 
892
  MCTNames=event.data;
893
  MCTNames=MCTNames[sectionNumber.toString().toLowerCase()]
 
894
  }
895
- console.log(MCTNames)
896
  }
897
  // }
898
  var val=''
@@ -1022,7 +1023,7 @@ worker.onmessage= function(event){
1022
  //___________________________________________________________________________________________________________
1023
  //___________________________________________________________________________________________________________
1024
  // /*Retrieve MCTNAMES Dictionary from API - Flask*/
1025
-
1026
  function getALLMCTNAMES(){
1027
  MCTNames={}
1028
  document.getElementById("all").style.display = "block";
@@ -1031,9 +1032,29 @@ $.get( '/RetrieveMCTNames/')
1031
  // document.getElementById("all").style.display = "none";
1032
  console.log(data)
1033
  MCTNames=data;
1034
- sectionNumber=thirddropdown.value
1035
- MCTNames=MCTNames[sectionNumber.toString().toLowerCase()]
1036
- console.log(MCTNames)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1037
  })
1038
  .error(function(jqXHR, textStatus, errorThrown) {
1039
  PopupElement.textContent='Error occured while retrieving the MC-T Names. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
@@ -2033,7 +2054,7 @@ function ImgSide(imgdata, spreadsheetLink, pdfLink) {
2033
 
2034
 
2035
 
2036
- if (sectionNumber.startsWith('2.8')){
2037
  legendbutton.setAttribute('disabled',true);
2038
  legendbutton.style.cursor='not-allowed';
2039
  legendbutton.style.boxShadow = 'none';
@@ -2303,7 +2324,7 @@ function getData(form) {
2303
  document.getElementById('addicon').style.display='inline-block';
2304
  document.getElementById('doneebackground').removeAttribute('hidden');
2305
  document.getElementById('summarytoXML').removeAttribute('hidden');
2306
- if (formvalues['selectprojs'].startsWith('2.8') ){
2307
  document.getElementById('doneebackground').setAttribute('disabled','True')
2308
  document.getElementById('doneebackground').style.cursor='not-allowed';
2309
  document.getElementById('doneebackground').style.boxShadow = 'none';
 
891
 
892
  MCTNames=event.data;
893
  MCTNames=MCTNames[sectionNumber.toString().toLowerCase()]
894
+
895
  }
896
+ console.log('MCtname::',MCTNames)
897
  }
898
  // }
899
  var val=''
 
1023
  //___________________________________________________________________________________________________________
1024
  //___________________________________________________________________________________________________________
1025
  // /*Retrieve MCTNAMES Dictionary from API - Flask*/
1026
+ var mctnameEmpty=false;
1027
  function getALLMCTNAMES(){
1028
  MCTNames={}
1029
  document.getElementById("all").style.display = "block";
 
1032
  // document.getElementById("all").style.display = "none";
1033
  console.log(data)
1034
  MCTNames=data;
1035
+ let sectionNumber = projsec.value.split(" ")[0]; // Get first item after splitting by space
1036
+ console.log(sectionNumber);
1037
+
1038
+ // Find the first key in MCTNames that starts with sectionNumber
1039
+ let matchedKey = Object.keys(MCTNames).find(key => key.toLowerCase().startsWith(sectionNumber.toLowerCase()));
1040
+
1041
+ if (matchedKey) {
1042
+ console.log(matchedKey); // Found matching key
1043
+ let matchedValue = MCTNames[matchedKey]; // Store matched value without overwriting MCTNames
1044
+
1045
+ console.log('MCTname::', matchedValue);
1046
+
1047
+ if (matchedValue && matchedValue.length ==0) { // Ensure matchedValue exists and has length
1048
+ mctnameEmpty = true;
1049
+ } else {
1050
+ mctnameEmpty = false;
1051
+ }
1052
+ } else {
1053
+ console.log("No matching key found in MCTNames");
1054
+ mctnameEmpty = false; // Handle case where no key is found
1055
+ }
1056
+
1057
+
1058
  })
1059
  .error(function(jqXHR, textStatus, errorThrown) {
1060
  PopupElement.textContent='Error occured while retrieving the MC-T Names. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
 
2054
 
2055
 
2056
 
2057
+ if ( projsec.value.startsWith('2.8')){
2058
  legendbutton.setAttribute('disabled',true);
2059
  legendbutton.style.cursor='not-allowed';
2060
  legendbutton.style.boxShadow = 'none';
 
2324
  document.getElementById('addicon').style.display='inline-block';
2325
  document.getElementById('doneebackground').removeAttribute('hidden');
2326
  document.getElementById('summarytoXML').removeAttribute('hidden');
2327
+ if (mctnameEmpty){
2328
  document.getElementById('doneebackground').setAttribute('disabled','True')
2329
  document.getElementById('doneebackground').style.cursor='not-allowed';
2330
  document.getElementById('doneebackground').style.boxShadow = 'none';