Marthee commited on
Commit
e726cea
·
verified ·
1 Parent(s): c006073

Update templates/proposed-GUI.html

Browse files
Files changed (1) hide show
  1. templates/proposed-GUI.html +113 -71
templates/proposed-GUI.html CHANGED
@@ -1969,85 +1969,127 @@ var doorSchedulePDF;
1969
  }
1970
 
1971
  for (let i = 0; i < docsToMeasure.length; i++) {
1972
- let name = docsToMeasure[i][0];
1973
-
1974
- // Create div for the measure item
1975
- let div = document.createElement("div");
1976
- div.className = "measure-item";
1977
-
1978
- // Create the checkbox
1979
- let checkbox = document.createElement("input");
1980
- checkbox.type = "checkbox";
1981
- checkbox.name = "measureCheckbox";
1982
- checkbox.value = name;
1983
- checkbox.onclick = handleCheckboxChange; // Handle checkbox click
1984
-
1985
- // Create the label
1986
- let label = document.createElement("label");
1987
- label.textContent = name;
1988
- label.onclick = handleLabelClick; // Handle label click
1989
-
1990
- // Append checkbox and label to the div
1991
- div.appendChild(checkbox);
1992
- div.appendChild(label);
1993
-
1994
- // Append the item to the select container
1995
- measSelect.appendChild(div);
1996
- // Check for duplicates
1997
- if (nameSet.has(name)) {
1998
- label.style.color = "red"; // Highlight duplicate (optional)
1999
-
2000
- document.getElementById("TopTextModal").textContent='Error: Duplicates Error'
2001
- PopupElement.textContent = 'Duplicate project names were detected while retrieving the project PDFs. Please visit Dropbox and rename the relevant files that you will be working on to ensure each project has a unique name. Once the renaming is complete, return to the console and click on the Dropbox icon to retrieve the updated project names.';
2002
- ShowPopUp();
2003
- } else {
2004
- nameSet.add(name); // Add unique name to the set
2005
- }
2006
- }
2007
-
 
 
 
 
 
 
 
 
 
 
 
 
2008
 
2009
 
2010
  for (let i = 0; i < relvDocs.length; i++) {
2011
- let name = relvDocs[i][0];
2012
-
2013
- // Create div for the measure item
2014
- let div = document.createElement("div");
2015
- div.className = "relv-item"; //relvselectid .relv-item
2016
- // Create the label
2017
- let label = document.createElement("label");
2018
- label.textContent = name;
2019
- label.onclick= function(event)
2020
- {
2021
- // Action when label is clicked (e.g., log the selected project via the label)
2022
- let relevantDocumentName = event.target.textContent;
2023
- console.log("Label clicked: ", relevantDocumentName);
2024
- if (projsec.value.startsWith('2.8') ||projsec.value.startsWith('2.6')){
2025
- doorSchedulePDF=relevantDocumentName
2026
- console.log(doorSchedulePDF)
2027
- }
2028
- // Optional: Highlight the selected item
2029
- document.querySelectorAll(".relv-item").forEach(item => {
2030
- item.style.backgroundColor = ''; // Reset background color for all items
2031
 
2032
- });
2033
- event.target.closest(".relv-item").style.backgroundColor ='#d3f8d3'; // Highlight the selected item
2034
- document.getElementById('relvselectid').style.boxShadow='';
2035
- relvSelect.value=relevantDocumentName;
2036
 
2037
- };
 
 
 
 
2038
 
 
 
 
2039
 
2040
- div.appendChild(label);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2041
 
2042
- // Append the item to the select container
2043
- relvSelect.appendChild(div);
2044
- // Handle duplicate names
2045
- if (nameSetRelv.has(name)) {
2046
- label.style.color = "red"; // Highlight duplicate (optional)
2047
- } else {
2048
- nameSetRelv.add(name);
2049
- }
2050
- }
2051
 
2052
  relvids.push(relvSelect);
2053
  measids.push(measSelect);
 
1969
  }
1970
 
1971
  for (let i = 0; i < docsToMeasure.length; i++) {
1972
+ let name = docsToMeasure[i][0];
1973
+
1974
+ // Create div for the measure item
1975
+ let div = document.createElement("div");
1976
+ div.className = "measure-item";
1977
+
1978
+ // Create the checkbox
1979
+ let checkbox = document.createElement("input");
1980
+ checkbox.type = "checkbox";
1981
+ checkbox.name = "measureCheckbox";
1982
+ checkbox.value = name;
1983
+
1984
+ // Only clicking checkbox checks it and triggers handler
1985
+ checkbox.onclick = function (e) {
1986
+ e.stopPropagation(); // prevent bubbling to div
1987
+ handleCheckboxChange(e);
1988
+ };
1989
+
1990
+ // Create the label
1991
+ let label = document.createElement("label");
1992
+ label.textContent = name;
1993
+
1994
+ // Label click does not check the checkbox
1995
+ label.onclick = function (e) {
1996
+ e.stopPropagation(); // just to be safe
1997
+ handleLabelClick(e, name);
1998
+ };
1999
+
2000
+ // Div click also doesn't check the checkbox
2001
+ div.onclick = function (e) {
2002
+ handleLabelClick(e, name);
2003
+ };
2004
+
2005
+ // Assemble
2006
+ div.appendChild(checkbox);
2007
+ div.appendChild(label);
2008
+ measSelect.appendChild(div);
2009
+
2010
+ // Handle duplicates
2011
+ if (nameSet.has(name)) {
2012
+ label.style.color = "red";
2013
+ document.getElementById("TopTextModal").textContent = 'Error: Duplicates Error';
2014
+ PopupElement.textContent = 'Duplicate project names were detected while retrieving the project PDFs. Please visit Dropbox and rename the relevant files that you will be working on to ensure each project has a unique name. Once the renaming is complete, return to the console and click on the Dropbox icon to retrieve the updated project names.';
2015
+ ShowPopUp();
2016
+ } else {
2017
+ nameSet.add(name);
2018
+ }
2019
+ }
2020
 
2021
 
2022
  for (let i = 0; i < relvDocs.length; i++) {
2023
+ let name = relvDocs[i][0];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2024
 
2025
+ // Create div for the measure item
2026
+ let divRelv = document.createElement("div");
2027
+ divRelv.className = "relv-item";
 
2028
 
2029
+ // Create the checkbox
2030
+ let checkboxRelv = document.createElement("input");
2031
+ checkboxRelv.type = "checkbox";
2032
+ checkboxRelv.name = "measureCheckboxRelv";
2033
+ checkboxRelv.value = name;
2034
 
2035
+ // Create the label
2036
+ let label = document.createElement("label");
2037
+ label.textContent = name;
2038
 
2039
+ // Shared click handler
2040
+ function checkboxRelvClick(event) {
2041
+ event.stopPropagation(); // Prevent event bubbling issues
2042
+
2043
+ // Get the parent div from the event target
2044
+ const container = event.currentTarget;
2045
+
2046
+ // Get the checkbox inside this container
2047
+ const checkbox = container.querySelector('input[type="checkbox"]');
2048
+
2049
+ // Uncheck all checkboxes
2050
+ document.querySelectorAll('input[name="measureCheckboxRelv"]').forEach(cb => cb.checked = false);
2051
+
2052
+ // Check the clicked one
2053
+ checkbox.checked = true;
2054
+
2055
+ const relevantDocumentName = checkbox.value;
2056
+ console.log("Item clicked: ", relevantDocumentName);
2057
+
2058
+ if (projsec.value.startsWith('2.8') || projsec.value.startsWith('2.6')) {
2059
+ doorSchedulePDF = relevantDocumentName;
2060
+ console.log(doorSchedulePDF);
2061
+ }
2062
+
2063
+ // Highlight selection
2064
+ document.querySelectorAll(".relv-item").forEach(item => {
2065
+ item.style.backgroundColor = '';
2066
+ });
2067
+ container.style.backgroundColor = '#d3f8d3';
2068
+ document.getElementById('relvselectid').style.boxShadow = '';
2069
+ relvSelect.value = relevantDocumentName;
2070
+ }
2071
+
2072
+ // Assign the click event to the container div
2073
+ divRelv.onclick = checkboxRelvClick;
2074
+
2075
+ // Also attach to checkbox specifically to prevent bubbling issue
2076
+ checkboxRelv.onclick = (e) => {
2077
+ e.stopPropagation();
2078
+ divRelv.click(); // Trigger div's click logic
2079
+ };
2080
+
2081
+ divRelv.appendChild(checkboxRelv);
2082
+ divRelv.appendChild(label);
2083
+
2084
+ relvSelect.appendChild(divRelv);
2085
+
2086
+ if (nameSetRelv.has(name)) {
2087
+ label.style.color = "red";
2088
+ } else {
2089
+ nameSetRelv.add(name);
2090
+ }
2091
+ }
2092
 
 
 
 
 
 
 
 
 
 
2093
 
2094
  relvids.push(relvSelect);
2095
  measids.push(measSelect);