Spaces:
Sleeping
Sleeping
Update templates/proposed-GUI.html
Browse files- templates/proposed-GUI.html +91 -25
templates/proposed-GUI.html
CHANGED
|
@@ -177,7 +177,7 @@
|
|
| 177 |
<select name="measureitem" class="measureitems" id="measureitemsid"> </select>
|
| 178 |
<br>
|
| 179 |
<div id="repeatforloop" class="repeatforloopclass00" name="repeatforloopname " >
|
| 180 |
-
<
|
| 181 |
<input type="text" id="text1" name="text2name" placeholder="A" class=a>
|
| 182 |
<input type="text" id="text2" name="text3name" placeholder="Depth" class=depth>
|
| 183 |
<script src="https://cdn.lordicon.com/bhenfmcm.js" ></script>
|
|
@@ -206,7 +206,7 @@
|
|
| 206 |
<div id="repeatforloophidden" class="repeatforloopclasshidden" name="repeatforloopnamehidden " > <!-- onchange="getmctName()" -->
|
| 207 |
|
| 208 |
|
| 209 |
-
<
|
| 210 |
<input type="text" id="text1" name="text2name" placeholder="A" class=a>
|
| 211 |
<input type="text" id="text2" name="text3name" placeholder="Depth" class=depth>
|
| 212 |
<script src="https://cdn.lordicon.com/bhenfmcm.js" ></script>
|
|
@@ -407,6 +407,7 @@ $(firstdropdown).select2({
|
|
| 407 |
width:'51ch'
|
| 408 |
|
| 409 |
});
|
|
|
|
| 410 |
$(seconddropdown).select2({
|
| 411 |
placeholder:'Project Parts',
|
| 412 |
closeOnSelect: true,
|
|
@@ -1436,6 +1437,7 @@ function ImgSide(imgdata, spreadsheetLink, pdfLink) {
|
|
| 1436 |
var imgbutton = document.createElement("button");
|
| 1437 |
imgbutton.className = 'measureADRbutton2';
|
| 1438 |
imgbutton.innerText = 'Click to view as PDF';
|
|
|
|
| 1439 |
imgbutton.style.backgroundColor = 'rgb(255,0,255)';
|
| 1440 |
|
| 1441 |
imgbutton.addEventListener('mouseover', function () {
|
|
@@ -1493,6 +1495,59 @@ function updatepreview(pdfname){
|
|
| 1493 |
})
|
| 1494 |
}
|
| 1495 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1496 |
function getData(form) {
|
| 1497 |
|
| 1498 |
document.getElementById("loading").hidden = false;
|
|
@@ -1606,6 +1661,8 @@ function getData(form) {
|
|
| 1606 |
// (new Audio(mp3_url)).play()
|
| 1607 |
// retrieveLinks()
|
| 1608 |
|
|
|
|
|
|
|
| 1609 |
|
| 1610 |
document.getElementById("loading").hidden = true;
|
| 1611 |
document.getElementById("rightside").hidden = false;
|
|
@@ -2177,6 +2234,7 @@ console.log(selections.value)
|
|
| 2177 |
//___________________________________________________________________________________________________________
|
| 2178 |
var repeatforloopI=0;
|
| 2179 |
function getmctName(){
|
|
|
|
| 2180 |
var listofnames=[];
|
| 2181 |
var flag=0;
|
| 2182 |
arrallvalues=[];
|
|
@@ -2199,21 +2257,6 @@ function getmctName(){
|
|
| 2199 |
var divValues=['text1'+div[0].value, div[1].value , div[2].value];
|
| 2200 |
mctname=[selections.value ,divValues , measitemVal ];
|
| 2201 |
|
| 2202 |
-
// if(div[0].value && div[1].value && div[2].value)
|
| 2203 |
-
// {
|
| 2204 |
-
// flag=1;
|
| 2205 |
-
// arrmctNames.push( mctname);
|
| 2206 |
-
// }
|
| 2207 |
-
// else if (div[0].value && !div[1].value && !div[2].value) {
|
| 2208 |
-
// mctname=[selections.value ,['text1'+div[0].value ], measitemVal ];
|
| 2209 |
-
// flag=1;
|
| 2210 |
-
// arrmctNames.push( mctname);
|
| 2211 |
-
// }
|
| 2212 |
-
// else if (div[0].value && div[1].value && !div[2].value) {
|
| 2213 |
-
// mctname=[selections.value ,['text1'+div[0].value, div[1].value ] , measitemVal ];
|
| 2214 |
-
// flag=1;
|
| 2215 |
-
// arrmctNames.push( mctname);
|
| 2216 |
-
// }
|
| 2217 |
//////////////////////////////////////////
|
| 2218 |
|
| 2219 |
|
|
@@ -2395,13 +2438,6 @@ function getmctName(){
|
|
| 2395 |
$.get( '/mctnametoGoogleSheet/'+ JSON.stringify(arrFinalMCNames))
|
| 2396 |
.success( function(data) {
|
| 2397 |
console.log('dataaaaa',data)
|
| 2398 |
-
// listofnames=data[1];
|
| 2399 |
-
|
| 2400 |
-
// var is_same = listofnames.length == arrallvalues.length && listofnames.every(function(element, index) {
|
| 2401 |
-
// if(arrallvalues.indexOf(element)>-1){
|
| 2402 |
-
// return element = arrallvalues[arrallvalues.indexOf(element)];
|
| 2403 |
-
// }
|
| 2404 |
-
// });
|
| 2405 |
|
| 2406 |
spreadsheetURL=spreadsheetURL+ '/edit#gid='+data[0].toString()
|
| 2407 |
console.log('spreadsheetURL',spreadsheetURL)
|
|
@@ -2418,7 +2454,7 @@ function getmctName(){
|
|
| 2418 |
//___________________________________________________________________________________________________________
|
| 2419 |
//___________________________________________________________________________________________________________
|
| 2420 |
function addmctnameicon(){
|
| 2421 |
-
|
| 2422 |
repeatforloopI+=1
|
| 2423 |
var dupDiv;
|
| 2424 |
if (clonedDivId==0){
|
|
@@ -2532,6 +2568,35 @@ myCanvas.addEventListener("click", e => {
|
|
| 2532 |
});
|
| 2533 |
//___________________________________________________________________________________________________________
|
| 2534 |
//___________________________________________________________________________________________________________
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2535 |
function drawChart() {
|
| 2536 |
ctx.lineWidth = 5;
|
| 2537 |
|
|
@@ -2668,6 +2733,7 @@ levelsin.addEventListener('click',function(){
|
|
| 2668 |
//___________________________________________________________________________________________________________
|
| 2669 |
function getSecondData(){
|
| 2670 |
document.getElementById('all').style.display='block';
|
|
|
|
| 2671 |
getmctName()
|
| 2672 |
}
|
| 2673 |
//___________________________________________________________________________________________________________
|
|
|
|
| 177 |
<select name="measureitem" class="measureitems" id="measureitemsid"> </select>
|
| 178 |
<br>
|
| 179 |
<div id="repeatforloop" class="repeatforloopclass00" name="repeatforloopname " >
|
| 180 |
+
<select type="text" id="text0" name="text1name" placeholder="GB-1" class=gb> </select>
|
| 181 |
<input type="text" id="text1" name="text2name" placeholder="A" class=a>
|
| 182 |
<input type="text" id="text2" name="text3name" placeholder="Depth" class=depth>
|
| 183 |
<script src="https://cdn.lordicon.com/bhenfmcm.js" ></script>
|
|
|
|
| 206 |
<div id="repeatforloophidden" class="repeatforloopclasshidden" name="repeatforloopnamehidden " > <!-- onchange="getmctName()" -->
|
| 207 |
|
| 208 |
|
| 209 |
+
<select type="text" id="text0" name="text1name" placeholder="GB-1" class=gb> </select>
|
| 210 |
<input type="text" id="text1" name="text2name" placeholder="A" class=a>
|
| 211 |
<input type="text" id="text2" name="text3name" placeholder="Depth" class=depth>
|
| 212 |
<script src="https://cdn.lordicon.com/bhenfmcm.js" ></script>
|
|
|
|
| 407 |
width:'51ch'
|
| 408 |
|
| 409 |
});
|
| 410 |
+
|
| 411 |
$(seconddropdown).select2({
|
| 412 |
placeholder:'Project Parts',
|
| 413 |
closeOnSelect: true,
|
|
|
|
| 1437 |
var imgbutton = document.createElement("button");
|
| 1438 |
imgbutton.className = 'measureADRbutton2';
|
| 1439 |
imgbutton.innerText = 'Click to view as PDF';
|
| 1440 |
+
imgbutton.id='clickpdfurldp'
|
| 1441 |
imgbutton.style.backgroundColor = 'rgb(255,0,255)';
|
| 1442 |
|
| 1443 |
imgbutton.addEventListener('mouseover', function () {
|
|
|
|
| 1495 |
})
|
| 1496 |
}
|
| 1497 |
|
| 1498 |
+
|
| 1499 |
+
|
| 1500 |
+
// Function to update dropdown options
|
| 1501 |
+
function updateDropdown(options) {
|
| 1502 |
+
const dropdowns = document.getElementsByName('text1name');
|
| 1503 |
+
|
| 1504 |
+
dropdowns.forEach((dropdown) => {
|
| 1505 |
+
// Save the currently selected value
|
| 1506 |
+
const selectedValue = dropdown.value;
|
| 1507 |
+
|
| 1508 |
+
// Clear the dropdown
|
| 1509 |
+
dropdown.innerHTML = '';
|
| 1510 |
+
|
| 1511 |
+
// Repopulate with new options
|
| 1512 |
+
options.forEach((value) => {
|
| 1513 |
+
const option = document.createElement('option');
|
| 1514 |
+
option.value = value;
|
| 1515 |
+
option.textContent = value;
|
| 1516 |
+
dropdown.appendChild(option);
|
| 1517 |
+
});
|
| 1518 |
+
|
| 1519 |
+
// Restore the previously selected value if it still exists
|
| 1520 |
+
if (options.includes(selectedValue)) {
|
| 1521 |
+
dropdown.value = selectedValue;
|
| 1522 |
+
}
|
| 1523 |
+
});
|
| 1524 |
+
}
|
| 1525 |
+
|
| 1526 |
+
// Function to start the worker and periodic updates
|
| 1527 |
+
function startDropdownUpdates() {
|
| 1528 |
+
const guessedNamesWorker = new Worker('../static/guessedNamesWorker.js');
|
| 1529 |
+
// Handle messages from the worker
|
| 1530 |
+
guessedNamesWorker.onmessage = function (event) {
|
| 1531 |
+
if (event.data.status === 'success') {
|
| 1532 |
+
console.log('Updating dropdown with new data:', event.data.data);
|
| 1533 |
+
updateDropdown(event.data.data); // Update the dropdown
|
| 1534 |
+
} else {
|
| 1535 |
+
console.error('Error from worker:', event.data.error);
|
| 1536 |
+
}
|
| 1537 |
+
};
|
| 1538 |
+
|
| 1539 |
+
// Send an initial fetch message to the worker
|
| 1540 |
+
guessedNamesWorker.postMessage('fetch');
|
| 1541 |
+
|
| 1542 |
+
// Periodically fetch data every 3 seconds
|
| 1543 |
+
setInterval(() => {
|
| 1544 |
+
guessedNamesWorker.postMessage('fetch');
|
| 1545 |
+
}, 3000);
|
| 1546 |
+
}
|
| 1547 |
+
|
| 1548 |
+
|
| 1549 |
+
|
| 1550 |
+
|
| 1551 |
function getData(form) {
|
| 1552 |
|
| 1553 |
document.getElementById("loading").hidden = false;
|
|
|
|
| 1661 |
// (new Audio(mp3_url)).play()
|
| 1662 |
// retrieveLinks()
|
| 1663 |
|
| 1664 |
+
startDropdownUpdates(); // Start the dropdown updates
|
| 1665 |
+
|
| 1666 |
|
| 1667 |
document.getElementById("loading").hidden = true;
|
| 1668 |
document.getElementById("rightside").hidden = false;
|
|
|
|
| 2234 |
//___________________________________________________________________________________________________________
|
| 2235 |
var repeatforloopI=0;
|
| 2236 |
function getmctName(){
|
| 2237 |
+
|
| 2238 |
var listofnames=[];
|
| 2239 |
var flag=0;
|
| 2240 |
arrallvalues=[];
|
|
|
|
| 2257 |
var divValues=['text1'+div[0].value, div[1].value , div[2].value];
|
| 2258 |
mctname=[selections.value ,divValues , measitemVal ];
|
| 2259 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2260 |
//////////////////////////////////////////
|
| 2261 |
|
| 2262 |
|
|
|
|
| 2438 |
$.get( '/mctnametoGoogleSheet/'+ JSON.stringify(arrFinalMCNames))
|
| 2439 |
.success( function(data) {
|
| 2440 |
console.log('dataaaaa',data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2441 |
|
| 2442 |
spreadsheetURL=spreadsheetURL+ '/edit#gid='+data[0].toString()
|
| 2443 |
console.log('spreadsheetURL',spreadsheetURL)
|
|
|
|
| 2454 |
//___________________________________________________________________________________________________________
|
| 2455 |
//___________________________________________________________________________________________________________
|
| 2456 |
function addmctnameicon(){
|
| 2457 |
+
// guessednamesDropdown()
|
| 2458 |
repeatforloopI+=1
|
| 2459 |
var dupDiv;
|
| 2460 |
if (clonedDivId==0){
|
|
|
|
| 2568 |
});
|
| 2569 |
//___________________________________________________________________________________________________________
|
| 2570 |
//___________________________________________________________________________________________________________
|
| 2571 |
+
// function guessednamesDropdown(){
|
| 2572 |
+
// //
|
| 2573 |
+
// $.get('/getguessednamepath/')
|
| 2574 |
+
|
| 2575 |
+
// .success(function(arrayofvalues) {
|
| 2576 |
+
// console.log('arrayofvalues',arrayofvalues)
|
| 2577 |
+
// var text1name= document.getElementsByName('text1name')
|
| 2578 |
+
// // Loop through each dropdown
|
| 2579 |
+
// text1name.forEach((dropdown, index) => {
|
| 2580 |
+
// // Clear existing options
|
| 2581 |
+
// dropdown.innerHTML = '';
|
| 2582 |
+
|
| 2583 |
+
// // Populate with arrayofvalues
|
| 2584 |
+
// arrayofvalues.forEach(value => {
|
| 2585 |
+
// let option = document.createElement('option');
|
| 2586 |
+
// option.value = value;
|
| 2587 |
+
// option.text = value;
|
| 2588 |
+
// dropdown.appendChild(option);
|
| 2589 |
+
// });
|
| 2590 |
+
// });
|
| 2591 |
+
|
| 2592 |
+
// })
|
| 2593 |
+
// .error(function(jqXHR, textStatus, errorThrown) {
|
| 2594 |
+
// PopupElement.textContent='Error occured while retrieving the Legend Guessed Names. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
|
| 2595 |
+
// ShowPopUp();
|
| 2596 |
+
// });
|
| 2597 |
+
// }
|
| 2598 |
+
|
| 2599 |
+
|
| 2600 |
function drawChart() {
|
| 2601 |
ctx.lineWidth = 5;
|
| 2602 |
|
|
|
|
| 2733 |
//___________________________________________________________________________________________________________
|
| 2734 |
function getSecondData(){
|
| 2735 |
document.getElementById('all').style.display='block';
|
| 2736 |
+
|
| 2737 |
getmctName()
|
| 2738 |
}
|
| 2739 |
//___________________________________________________________________________________________________________
|