Spaces:
Paused
Paused
Update templates/proposed-GUI.html
Browse files- templates/proposed-GUI.html +62 -29
templates/proposed-GUI.html
CHANGED
|
@@ -1958,28 +1958,50 @@ var doorSchedulePDF;
|
|
| 1958 |
|
| 1959 |
// Action for when the checkbox is clicked
|
| 1960 |
function handleCheckboxChange(event) {
|
| 1961 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1962 |
|
| 1963 |
-
document.querySelectorAll('input[name="measureCheckbox"]').forEach(checkbox => {
|
| 1964 |
-
checkbox.checked = false;
|
| 1965 |
-
});
|
| 1966 |
-
|
| 1967 |
-
// Check the current checkbox
|
| 1968 |
-
event.target.checked = true;
|
| 1969 |
-
|
| 1970 |
-
// Action when checkbox is clicked (e.g., log the selected project)
|
| 1971 |
-
let selectedValue = event.target.value;
|
| 1972 |
-
measSelect.value=selectedValue;
|
| 1973 |
-
console.log("Selected project:", selectedValue);
|
| 1974 |
-
|
| 1975 |
-
// Highlight the selected item
|
| 1976 |
-
document.querySelectorAll(".measure-item").forEach(item => {
|
| 1977 |
-
item.style.backgroundColor = ''; // Reset background color for all items
|
| 1978 |
-
});
|
| 1979 |
-
event.target.closest(".measure-item").style.backgroundColor = '#d3f8d3'; // Highlight the selected item
|
| 1980 |
-
|
| 1981 |
-
|
| 1982 |
-
|
| 1983 |
// Show alert immediately to prompt the user
|
| 1984 |
if (projsec.value.startsWith('3.2') || projsec.value.startsWith('3.3') || projsec.value.startsWith('2.7')) {
|
| 1985 |
// downloadPdf(selectedValue);
|
|
@@ -1992,8 +2014,9 @@ var doorSchedulePDF;
|
|
| 1992 |
canvasimg='';
|
| 1993 |
ry=[[]];
|
| 1994 |
levelcheckbox.checked=false;
|
| 1995 |
-
pdfname=selectedValue;
|
| 1996 |
measSelect.style.boxShadow='none';
|
|
|
|
| 1997 |
|
| 1998 |
console.log(projsec.value)
|
| 1999 |
if (!(projsec.value.startsWith('2.6') || projsec.value.startsWith('2.8'))) {
|
|
@@ -2654,10 +2677,18 @@ function getData(form) {
|
|
| 2654 |
formvalues=Object.fromEntries(formData);
|
| 2655 |
|
| 2656 |
console.log(formData,formvalues)
|
| 2657 |
-
// iterate through entries...
|
| 2658 |
-
tomeasureproj=formvalues['measureCheckbox']; //proj name
|
| 2659 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2660 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2661 |
if( formvalues['selectprojs'].startsWith('3.2') || formvalues['selectprojs'].startsWith('3.3') || formvalues['selectprojs'].startsWith('2.7') ){
|
| 2662 |
ratio1=1
|
| 2663 |
ratio2=prminpixels/(formvalues['prmRatio']/ratioPunit);
|
|
@@ -2715,9 +2746,13 @@ function getData(form) {
|
|
| 2715 |
formData.append('answers',JSON.stringify(answers))
|
| 2716 |
}
|
| 2717 |
else if (formvalues['selectprojs'].startsWith('2.8') || formvalues['selectprojs'].startsWith('2.6') )
|
| 2718 |
-
{
|
|
|
|
|
|
|
| 2719 |
answers.push(tomeasureproj, 0,[] , 0,0,pdfpath , doorSchedulePDF,groupedValues);
|
|
|
|
| 2720 |
formData.append('answers',JSON.stringify(answers))
|
|
|
|
| 2721 |
}
|
| 2722 |
}
|
| 2723 |
|
|
@@ -4482,11 +4517,9 @@ function getpopuptext() {
|
|
| 4482 |
else if (projsec.value.startsWith('2.8') || projsec.value.startsWith('2.6'))
|
| 4483 |
lengthofitems=1
|
| 4484 |
// Group the values into subarrays of 4, only if any field has value
|
| 4485 |
-
for (let i = 0; i < values.length; i +=
|
| 4486 |
const group = values.slice(i, i + lengthofitems);
|
| 4487 |
-
|
| 4488 |
-
groupedValues.push(group);
|
| 4489 |
-
}
|
| 4490 |
}
|
| 4491 |
|
| 4492 |
console.log("Grouped input values:", groupedValues);
|
|
|
|
| 1958 |
|
| 1959 |
// Action for when the checkbox is clicked
|
| 1960 |
function handleCheckboxChange(event) {
|
| 1961 |
+
const sectionValue = projsec.value;
|
| 1962 |
+
const isMultiSection = sectionValue.startsWith('2.6') || sectionValue.startsWith('2.8');
|
| 1963 |
+
const checkboxes = document.querySelectorAll('input[name="measureCheckbox"]');
|
| 1964 |
+
const items = document.querySelectorAll('.measure-item');
|
| 1965 |
+
|
| 1966 |
+
if (isMultiSection) {
|
| 1967 |
+
// --- MULTI-SELECTION LOGIC FOR 2.6/2.8 ---
|
| 1968 |
+
|
| 1969 |
+
// 1. Gather checked checkboxes and their values
|
| 1970 |
+
const selectedCheckboxes = Array.from(checkboxes).filter(cb => cb.checked);
|
| 1971 |
+
let selectedValue = selectedCheckboxes.map(cb => cb.value);
|
| 1972 |
+
|
| 1973 |
+
// 2. Set field value and pdfname
|
| 1974 |
+
measSelect.value = selectedValue.join(', ');
|
| 1975 |
+
pdfname = selectedValue.join(', ');
|
| 1976 |
+
console.log("selected value:",selectedValue)
|
| 1977 |
+
console.log("pdfname:",pdfname)
|
| 1978 |
+
// 3. Highlight checked items in green, others reset
|
| 1979 |
+
items.forEach(item => {
|
| 1980 |
+
const checkbox = item.querySelector('input[name="measureCheckbox"]');
|
| 1981 |
+
item.style.backgroundColor = checkbox.checked ? '#d3f8d3' : '';
|
| 1982 |
+
});
|
| 1983 |
+
|
| 1984 |
+
// 4. Reorder: selected .measure-item to the top (checked order), unselected below
|
| 1985 |
+
const container = items[0]?.parentNode;
|
| 1986 |
+
const selectedItems = selectedCheckboxes.map(cb => cb.closest('.measure-item'));
|
| 1987 |
+
const unselectedItems = Array.from(items).filter(item => !item.querySelector('input[name="measureCheckbox"]').checked);
|
| 1988 |
+
[...selectedItems, ...unselectedItems].forEach(item => container.appendChild(item));
|
| 1989 |
+
|
| 1990 |
+
} else {
|
| 1991 |
+
// --- SINGLE SELECTION LOGIC (UNCHANGED) ---
|
| 1992 |
+
checkboxes.forEach(checkbox => { checkbox.checked = false; });
|
| 1993 |
+
event.target.checked = true;
|
| 1994 |
+
|
| 1995 |
+
// Set value and pdfname for single selection
|
| 1996 |
+
let selectedValue = event.target.value;
|
| 1997 |
+
measSelect.value = selectedValue;
|
| 1998 |
+
pdfname = selectedValue;
|
| 1999 |
+
|
| 2000 |
+
// Highlight only the selected item in green, others reset
|
| 2001 |
+
items.forEach(item => { item.style.backgroundColor = ''; });
|
| 2002 |
+
event.target.closest(".measure-item").style.backgroundColor = '#d3f8d3';
|
| 2003 |
+
}
|
| 2004 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2005 |
// Show alert immediately to prompt the user
|
| 2006 |
if (projsec.value.startsWith('3.2') || projsec.value.startsWith('3.3') || projsec.value.startsWith('2.7')) {
|
| 2007 |
// downloadPdf(selectedValue);
|
|
|
|
| 2014 |
canvasimg='';
|
| 2015 |
ry=[[]];
|
| 2016 |
levelcheckbox.checked=false;
|
| 2017 |
+
//pdfname=selectedValue;
|
| 2018 |
measSelect.style.boxShadow='none';
|
| 2019 |
+
|
| 2020 |
|
| 2021 |
console.log(projsec.value)
|
| 2022 |
if (!(projsec.value.startsWith('2.6') || projsec.value.startsWith('2.8'))) {
|
|
|
|
| 2677 |
formvalues=Object.fromEntries(formData);
|
| 2678 |
|
| 2679 |
console.log(formData,formvalues)
|
|
|
|
|
|
|
| 2680 |
|
| 2681 |
+
// to tomeasureproj is an array of plans in 2.6 and 2.8
|
| 2682 |
+
if (formvalues['selectprojs'].startsWith('2.8') || formvalues['selectprojs'].startsWith('2.6') ){
|
| 2683 |
+
tomeasureproj = formData.getAll('measureCheckbox');
|
| 2684 |
+
}
|
| 2685 |
|
| 2686 |
+
else{
|
| 2687 |
+
tomeasureproj=formvalues['measureCheckbox']; //proj name
|
| 2688 |
+
|
| 2689 |
+
}
|
| 2690 |
+
|
| 2691 |
+
// iterate through entries...
|
| 2692 |
if( formvalues['selectprojs'].startsWith('3.2') || formvalues['selectprojs'].startsWith('3.3') || formvalues['selectprojs'].startsWith('2.7') ){
|
| 2693 |
ratio1=1
|
| 2694 |
ratio2=prminpixels/(formvalues['prmRatio']/ratioPunit);
|
|
|
|
| 2746 |
formData.append('answers',JSON.stringify(answers))
|
| 2747 |
}
|
| 2748 |
else if (formvalues['selectprojs'].startsWith('2.8') || formvalues['selectprojs'].startsWith('2.6') )
|
| 2749 |
+
{
|
| 2750 |
+
console.log('formvalues:', formvalues)
|
| 2751 |
+
console.log('tomeasureproj:', tomeasureproj)
|
| 2752 |
answers.push(tomeasureproj, 0,[] , 0,0,pdfpath , doorSchedulePDF,groupedValues);
|
| 2753 |
+
console.log('answers:', answers)
|
| 2754 |
formData.append('answers',JSON.stringify(answers))
|
| 2755 |
+
console.log('formData:', formData)
|
| 2756 |
}
|
| 2757 |
}
|
| 2758 |
|
|
|
|
| 4517 |
else if (projsec.value.startsWith('2.8') || projsec.value.startsWith('2.6'))
|
| 4518 |
lengthofitems=1
|
| 4519 |
// Group the values into subarrays of 4, only if any field has value
|
| 4520 |
+
for (let i = 0; i < values.length; i += 3) {
|
| 4521 |
const group = values.slice(i, i + lengthofitems);
|
| 4522 |
+
groupedValues.push(group)
|
|
|
|
|
|
|
| 4523 |
}
|
| 4524 |
|
| 4525 |
console.log("Grouped input values:", groupedValues);
|