Spaces:
Sleeping
Sleeping
Update templates/proposed-GUI.html
Browse files- templates/proposed-GUI.html +34 -30
templates/proposed-GUI.html
CHANGED
|
@@ -1936,37 +1936,41 @@ var doorSchedulePDF;
|
|
| 1936 |
}
|
| 1937 |
// Action for when the label is clicked (no checkbox change)
|
| 1938 |
function handleLabelClick(event) {
|
| 1939 |
-
|
| 1940 |
-
|
| 1941 |
-
|
| 1942 |
-
|
| 1943 |
-
|
| 1944 |
-
|
| 1945 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1946 |
|
| 1947 |
-
// event.target.closest(".measure-item").style.backgroundColor = '#919592'; // Highlight the selected item
|
| 1948 |
-
// Show loading indicator
|
| 1949 |
-
document.getElementById("all").style.display = "block";
|
| 1950 |
-
fetch('/getdropboxurl/'+ JSON.stringify(selectedLabel), {
|
| 1951 |
-
|
| 1952 |
-
method: 'POST',
|
| 1953 |
-
headers: { 'Content-Type': 'application/json' },
|
| 1954 |
-
body: JSON.stringify({ filename: "your_pdf_filename_here.pdf" })
|
| 1955 |
-
})
|
| 1956 |
-
.then(response => response.blob())
|
| 1957 |
-
.then(blob => {
|
| 1958 |
-
document.getElementById("all").style.display = "none";
|
| 1959 |
-
const url = URL.createObjectURL(blob);
|
| 1960 |
-
// Set the URL to the iframe's src to load the content inside the page
|
| 1961 |
-
addIframeTab(selectedLabel,url);
|
| 1962 |
-
// addIframeTab("Google", "https://www.google.com");
|
| 1963 |
-
})
|
| 1964 |
-
.catch(function(jqXHR, textStatus, errorThrown) {
|
| 1965 |
-
// Handle error
|
| 1966 |
-
PopupElement.textContent = 'Error occurred while retrieving the dropbox URL. Refresh and try again. If the error continues, please contact the ADR team to fix it.';
|
| 1967 |
-
ShowPopUp();
|
| 1968 |
-
});
|
| 1969 |
-
}
|
| 1970 |
|
| 1971 |
for (let i = 0; i < docsToMeasure.length; i++) {
|
| 1972 |
let name = docsToMeasure[i][0];
|
|
|
|
| 1936 |
}
|
| 1937 |
// Action for when the label is clicked (no checkbox change)
|
| 1938 |
function handleLabelClick(event) {
|
| 1939 |
+
let selectedLabel = event.target.textContent;
|
| 1940 |
+
console.log("Label clicked: ", selectedLabel);
|
| 1941 |
+
|
| 1942 |
+
// Reset background only for items whose checkbox is **not** checked
|
| 1943 |
+
document.querySelectorAll(".measure-item").forEach(item => {
|
| 1944 |
+
const checkbox = item.querySelector('input[type="checkbox"]');
|
| 1945 |
+
if (!checkbox.checked) {
|
| 1946 |
+
item.style.backgroundColor = '';
|
| 1947 |
+
}
|
| 1948 |
+
});
|
| 1949 |
+
|
| 1950 |
+
// Optionally highlight the clicked div (even though its checkbox isn’t selected)
|
| 1951 |
+
const clickedDiv = event.target.closest(".measure-item");
|
| 1952 |
+
clickedDiv.style.backgroundColor = '#919592';
|
| 1953 |
+
|
| 1954 |
+
// Show loading spinner
|
| 1955 |
+
document.getElementById("all").style.display = "block";
|
| 1956 |
+
|
| 1957 |
+
fetch('/getdropboxurl/' + JSON.stringify(selectedLabel), {
|
| 1958 |
+
method: 'POST',
|
| 1959 |
+
headers: { 'Content-Type': 'application/json' },
|
| 1960 |
+
body: JSON.stringify({ filename: "your_pdf_filename_here.pdf" }) // ← Replace with real value if dynamic
|
| 1961 |
+
})
|
| 1962 |
+
.then(response => response.blob())
|
| 1963 |
+
.then(blob => {
|
| 1964 |
+
document.getElementById("all").style.display = "none";
|
| 1965 |
+
const url = URL.createObjectURL(blob);
|
| 1966 |
+
addIframeTab(selectedLabel, url);
|
| 1967 |
+
})
|
| 1968 |
+
.catch(function (jqXHR, textStatus, errorThrown) {
|
| 1969 |
+
PopupElement.textContent = 'Error occurred while retrieving the Dropbox URL. Refresh and try again. If the error continues, please contact the ADR team to fix it.';
|
| 1970 |
+
ShowPopUp();
|
| 1971 |
+
});
|
| 1972 |
+
}
|
| 1973 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1974 |
|
| 1975 |
for (let i = 0; i < docsToMeasure.length; i++) {
|
| 1976 |
let name = docsToMeasure[i][0];
|