Marthee commited on
Commit
da450ce
·
verified ·
1 Parent(s): 14432d5

Update templates/proposed-GUI.html

Browse files
Files changed (1) hide show
  1. templates/proposed-GUI.html +104 -79
templates/proposed-GUI.html CHANGED
@@ -842,7 +842,6 @@
842
  <div id="repeatforloopExtra" class="repeatforloopclassExtra0" name="repeatforloopExtraname " >
843
  <label id="modalColumn">Enter column names as shown in the schedule</label>
844
  <button type="button" id="popupbuttonsDeleteTable" class="delete-table-btn" style="margin-bottom: 8px;">Delete Table</button>
845
-
846
 
847
 
848
 
@@ -1370,7 +1369,6 @@ $.get( '/RetrieveMCTNames/')
1370
  //___________________________________________________________________________________________________________
1371
  //___________________________________________________________________________________________________________
1372
 
1373
- /****Values of MCTname rows at the end of the conssole( grouping shapes) --> legend summary ****/
1374
  document.getElementById('duplicater').childNodes[1].value=[0,0]
1375
  //___________________________________________________________________________________________________________
1376
  //___________________________________________________________________________________________________________
@@ -2469,54 +2467,54 @@ var doorSchedulePDF;
2469
  label.textContent = name;
2470
 
2471
  // Shared click handler
2472
- function checkboxRelvClick(event) {
2473
- event.stopPropagation();
2474
- const container = event.currentTarget;
2475
- const checkbox = container.querySelector('input[type="checkbox"]');
2476
-
2477
- const isMultiSection = projsec.value.startsWith('2.6') || projsec.value.startsWith('2.8');
2478
-
2479
- if (isMultiSection) {
2480
- // --- MULTI (2.6 / 2.8): do NOT flip manually; read browser state ---
2481
- container.style.backgroundColor = checkbox.checked ? '#d3f8d3' : '';
2482
-
2483
- // 1) Gather selected values
2484
- const selectedCheckboxes = Array.from(
2485
- document.querySelectorAll('input[name="measureCheckboxRelv"]:checked')
2486
- );
2487
- window.doorSchedulePDFs = selectedCheckboxes.map(cb => cb.value);
2488
- console.log('Selected (multi):', window.doorSchedulePDFs);
2489
-
2490
- // 2) Reorder: selected to the top, keep relative order
2491
- const relvContainer = relvSelect; // #relvselectid
2492
- const items = Array.from(relvContainer.querySelectorAll('.relv-item'));
2493
- const selectedItems = items.filter(it => it.querySelector('input[name="measureCheckboxRelv"]').checked);
2494
- const unselectedItems = items.filter(it => !it.querySelector('input[name="measureCheckboxRelv"]').checked);
2495
- [...selectedItems, ...unselectedItems].forEach(it => relvContainer.appendChild(it));
2496
- } else {
2497
- // --- SINGLE (other sections): keep previous behavior ---
2498
- document.querySelectorAll('input[name="measureCheckboxRelv"]').forEach(cb => {
2499
- cb.checked = false;
2500
- cb.closest('.relv-item').style.backgroundColor = '';
2501
- });
2502
- checkbox.checked = true;
2503
- container.style.backgroundColor = '#d3f8d3';
2504
-
2505
- doorSchedulePDF = checkbox.value;
2506
- relvSelect.value = doorSchedulePDF;
2507
-
2508
- // Reorder single: the one checked goes first
2509
- const relvContainer = relvSelect;
2510
- const items = Array.from(relvContainer.querySelectorAll('.relv-item'));
2511
- const selectedItems = items.filter(it => it.querySelector('input[type="checkbox"]').checked);
2512
- const unselectedItems = items.filter(it => !it.querySelector('input[type="checkbox"]').checked);
2513
- [...selectedItems, ...unselectedItems].forEach(it => relvContainer.appendChild(it));
2514
- }
2515
-
2516
- // Clear any warning style
2517
- const panel = document.getElementById('relvselectid');
2518
- if (panel) panel.style.boxShadow = '';
2519
- }
2520
 
2521
  // Assign the click event to the container div
2522
  divRelv.onclick = checkboxRelvClick;
@@ -2670,7 +2668,7 @@ function ImgSide(imgdata, spreadsheetLink, pdfLink, pdfname, baxlink, xmllink) {
2670
  imgcanvas.height = 600;
2671
  imgcanvas.id = 'imgcanvas_' + index;
2672
  imgcanvas.alt = "Larry " + index;
2673
- imgcanvas.style.zIndex = 999;
2674
 
2675
  imgcanvas.addEventListener('click', function () {
2676
  ImgLarger(imgcanvas.id, imgcanvas.src);
@@ -2684,7 +2682,7 @@ function ImgSide(imgdata, spreadsheetLink, pdfLink, pdfname, baxlink, xmllink) {
2684
  imgcanvas.height = 600;
2685
  imgcanvas.id = 'imgcanvas';
2686
  imgcanvas.alt = "Larry";
2687
- imgcanvas.style.zIndex = 999;
2688
 
2689
  imgcanvas.addEventListener('click', function () {
2690
  ImgLarger(imgcanvas.id, imgcanvas.src);
@@ -2976,8 +2974,11 @@ function getData(form) {
2976
  ratio2=(formvalues['prmRatio']/ratioPunit)/prminpixels;
2977
  console.log('ratioss',ratio1,ratio2)
2978
  }
 
 
 
2979
  pdfpath.push(formvalues['selectproj'],formvalues['selectprojp'] ,formvalues['selectprojs']) //project name - part - section
2980
-
2981
  if (canvasimg){
2982
  console.log('canvasimg')
2983
  buf=canvasimg.split("data:image/png;base64,")
@@ -3022,7 +3023,7 @@ function getData(form) {
3022
  console.log('formvalues:', formvalues)
3023
  console.log('tomeasureproj:', tomeasureproj)
3024
  // send allTablesData instead of groupedValues
3025
- answers.push(tomeasureproj, 0,[] , 0,0,pdfpath , doorSchedulePDFs, allTablesData);
3026
  console.log('answers:', answers)
3027
  formData.append('answers',JSON.stringify(answers))
3028
  console.log('formData:', formData)
@@ -4637,7 +4638,8 @@ document.getElementById("refreshAPIbutton").onclick = function()
4637
 
4638
 
4639
 
4640
- document.getElementById("popupforextratext").disabled=false;
 
4641
  document.getElementById("popupforextratext").onclick = function () {
4642
  if (sectionNumber.startsWith('2.7')) {
4643
  document.getElementById("Thickness2.7").removeAttribute("hidden");
@@ -4911,6 +4913,7 @@ document.addEventListener('click', function (e) {
4911
  };
4912
 
4913
 
 
4914
  document.getElementById("confirm").onclick = function(){confirmDialogR()};
4915
  function confirmDialogR() {
4916
  /* code executed if confirm is clicked */
@@ -5209,9 +5212,6 @@ function getAddedTablesDataSimple_modified() {
5209
  return result;
5210
  }
5211
 
5212
-
5213
-
5214
-
5215
  // Attach listener to all current and future delete buttons
5216
  document.addEventListener('click', function(event) {
5217
  if(event.target.classList.contains('delete-table-btn')) {
@@ -5226,27 +5226,51 @@ document.addEventListener('click', function(event) {
5226
  });
5227
  // After adding tables, run this code:
5228
  function updateDeleteButtonStates() {
5229
- const allDeleteBtns = document.querySelectorAll('.delete-table-btn');
5230
-
5231
- // Reset all buttons to enabled state first
5232
- allDeleteBtns.forEach(btn => {
5233
- btn.disabled = false;
5234
- btn.style.opacity = '1';
5235
- btn.style.background = '';
5236
- btn.style.color = '';
5237
- btn.style.cursor = 'pointer';
5238
- });
5239
-
5240
- // Disable and shade the first button only
5241
- if (allDeleteBtns.length > 0) {
5242
- const firstBtn = allDeleteBtns[0];
5243
- firstBtn.disabled = true;
5244
- // Apply shaded styling
5245
- firstBtn.style.opacity = '0.5';
5246
- firstBtn.style.background = '#ddd';
5247
- firstBtn.style.color = '#888';
5248
- firstBtn.style.cursor = 'not-allowed';
5249
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5250
  }
5251
 
5252
  // 5. Also call it when the page loads (if needed)
@@ -5273,6 +5297,7 @@ function get_combined_tables(main_table, other_tables){
5273
  console.log("Final output that will be passed to flask:", mergedArray);
5274
  return mergedArray;
5275
  }
 
5276
  (() => {
5277
  const BTN_ID = 'addAnotherTableBtn';
5278
  const WATCH_ROOT = document.body;
 
842
  <div id="repeatforloopExtra" class="repeatforloopclassExtra0" name="repeatforloopExtraname " >
843
  <label id="modalColumn">Enter column names as shown in the schedule</label>
844
  <button type="button" id="popupbuttonsDeleteTable" class="delete-table-btn" style="margin-bottom: 8px;">Delete Table</button>
 
845
 
846
 
847
 
 
1369
  //___________________________________________________________________________________________________________
1370
  //___________________________________________________________________________________________________________
1371
 
 
1372
  document.getElementById('duplicater').childNodes[1].value=[0,0]
1373
  //___________________________________________________________________________________________________________
1374
  //___________________________________________________________________________________________________________
 
2467
  label.textContent = name;
2468
 
2469
  // Shared click handler
2470
+ function checkboxRelvClick(event) {
2471
+ event.stopPropagation();
2472
+ const container = event.currentTarget;
2473
+ const checkbox = container.querySelector('input[type="checkbox"]');
2474
+
2475
+ const isMultiSection = projsec.value.startsWith('2.6') || projsec.value.startsWith('2.8');
2476
+
2477
+ if (isMultiSection) {
2478
+ // --- MULTI (2.6 / 2.8): do NOT flip manually; read browser state ---
2479
+ container.style.backgroundColor = checkbox.checked ? '#d3f8d3' : '';
2480
+
2481
+ // 1) Gather selected values
2482
+ const selectedCheckboxes = Array.from(
2483
+ document.querySelectorAll('input[name="measureCheckboxRelv"]:checked')
2484
+ );
2485
+ window.doorSchedulePDFs = selectedCheckboxes.map(cb => cb.value);
2486
+ console.log('Selected (multi):', window.doorSchedulePDFs);
2487
+
2488
+ // 2) Reorder: selected to the top, keep relative order
2489
+ const relvContainer = relvSelect; // #relvselectid
2490
+ const items = Array.from(relvContainer.querySelectorAll('.relv-item'));
2491
+ const selectedItems = items.filter(it => it.querySelector('input[name="measureCheckboxRelv"]').checked);
2492
+ const unselectedItems = items.filter(it => !it.querySelector('input[name="measureCheckboxRelv"]').checked);
2493
+ [...selectedItems, ...unselectedItems].forEach(it => relvContainer.appendChild(it));
2494
+ } else {
2495
+ // --- SINGLE (other sections): keep previous behavior ---
2496
+ document.querySelectorAll('input[name="measureCheckboxRelv"]').forEach(cb => {
2497
+ cb.checked = false;
2498
+ cb.closest('.relv-item').style.backgroundColor = '';
2499
+ });
2500
+ checkbox.checked = true;
2501
+ container.style.backgroundColor = '#d3f8d3';
2502
+
2503
+ doorSchedulePDF = checkbox.value;
2504
+ relvSelect.value = doorSchedulePDF;
2505
+
2506
+ // Reorder single: the one checked goes first
2507
+ const relvContainer = relvSelect;
2508
+ const items = Array.from(relvContainer.querySelectorAll('.relv-item'));
2509
+ const selectedItems = items.filter(it => it.querySelector('input[type="checkbox"]').checked);
2510
+ const unselectedItems = items.filter(it => !it.querySelector('input[type="checkbox"]').checked);
2511
+ [...selectedItems, ...unselectedItems].forEach(it => relvContainer.appendChild(it));
2512
+ }
2513
+
2514
+ // Clear any warning style
2515
+ const panel = document.getElementById('relvselectid');
2516
+ if (panel) panel.style.boxShadow = '';
2517
+ }
2518
 
2519
  // Assign the click event to the container div
2520
  divRelv.onclick = checkboxRelvClick;
 
2668
  imgcanvas.height = 600;
2669
  imgcanvas.id = 'imgcanvas_' + index;
2670
  imgcanvas.alt = "Larry " + index;
2671
+ imgcanvas.style.zIndex = 1;
2672
 
2673
  imgcanvas.addEventListener('click', function () {
2674
  ImgLarger(imgcanvas.id, imgcanvas.src);
 
2682
  imgcanvas.height = 600;
2683
  imgcanvas.id = 'imgcanvas';
2684
  imgcanvas.alt = "Larry";
2685
+ imgcanvas.style.zIndex = 1;
2686
 
2687
  imgcanvas.addEventListener('click', function () {
2688
  ImgLarger(imgcanvas.id, imgcanvas.src);
 
2974
  ratio2=(formvalues['prmRatio']/ratioPunit)/prminpixels;
2975
  console.log('ratioss',ratio1,ratio2)
2976
  }
2977
+ console.log('selectproj', formvalues['selectproj'])
2978
+ console.log('selectprojp', formvalues['selectprojp'])
2979
+ console.log('selectprojs', formvalues['selectprojs'])
2980
  pdfpath.push(formvalues['selectproj'],formvalues['selectprojp'] ,formvalues['selectprojs']) //project name - part - section
2981
+ console.log('pdfpath: ', pdfpath)
2982
  if (canvasimg){
2983
  console.log('canvasimg')
2984
  buf=canvasimg.split("data:image/png;base64,")
 
3023
  console.log('formvalues:', formvalues)
3024
  console.log('tomeasureproj:', tomeasureproj)
3025
  // send allTablesData instead of groupedValues
3026
+ answers.push(tomeasureproj, 0,[] , 0,0,pdfpath , doorSchedulePDFs ,allTablesData);
3027
  console.log('answers:', answers)
3028
  formData.append('answers',JSON.stringify(answers))
3029
  console.log('formData:', formData)
 
4638
 
4639
 
4640
 
4641
+ // ===== Tabs-based popup using a SEPARATE template =====
4642
+ document.getElementById("popupforextratext").disabled = false;
4643
  document.getElementById("popupforextratext").onclick = function () {
4644
  if (sectionNumber.startsWith('2.7')) {
4645
  document.getElementById("Thickness2.7").removeAttribute("hidden");
 
4913
  };
4914
 
4915
 
4916
+
4917
  document.getElementById("confirm").onclick = function(){confirmDialogR()};
4918
  function confirmDialogR() {
4919
  /* code executed if confirm is clicked */
 
5212
  return result;
5213
  }
5214
 
 
 
 
5215
  // Attach listener to all current and future delete buttons
5216
  document.addEventListener('click', function(event) {
5217
  if(event.target.classList.contains('delete-table-btn')) {
 
5226
  });
5227
  // After adding tables, run this code:
5228
  function updateDeleteButtonStates() {
5229
+ const rows = Array.from(document.querySelectorAll('.extraDoorRow'));
5230
+
5231
+ // Enable all delete buttons first
5232
+ rows.forEach(row => {
5233
+ const btn = row.querySelector('.delete-table-btn');
5234
+ if (!btn) return;
5235
+ btn.disabled = false;
5236
+ btn.style.opacity = '1';
5237
+ btn.style.background = '';
5238
+ btn.style.color = '';
5239
+ btn.style.cursor = 'pointer';
5240
+ });
5241
+
5242
+ rows.forEach(row => {
5243
+ const btn = row.querySelector('.addRowForPdfBtn');
5244
+ if (!btn) return;
5245
+ btn.disabled = false;
5246
+ btn.style.opacity = '1';
5247
+ btn.style.background = '';
5248
+ btn.style.color = '';
5249
+ btn.style.cursor = 'pointer';
5250
+ });
5251
+
5252
+ // Group rows by PDF name and disable the first delete button in each group
5253
+ const groups = new Map();
5254
+ rows.forEach(row => {
5255
+ const key = row.dataset.pdfName || '__global__';
5256
+ if (!groups.has(key)) groups.set(key, []);
5257
+ groups.get(key).push(row);
5258
+ });
5259
+
5260
+ groups.forEach(groupRows => {
5261
+ const firstBtn = groupRows[0].querySelector('.delete-table-btn');
5262
+ if (!firstBtn) return;
5263
+ firstBtn.disabled = true;
5264
+ firstBtn.style.opacity = '0.5';
5265
+ firstBtn.style.background = '#ddd';
5266
+ firstBtn.style.color = '#888';
5267
+ firstBtn.style.cursor = 'not-allowed';
5268
+ });
5269
+
5270
+ groups.forEach(groupRowsA => {
5271
+ const firstBtnAdd = groupRowsA[0].querySelector('.addRowForPdfBtn');
5272
+ if (!firstBtnAdd) return;
5273
+ });
5274
  }
5275
 
5276
  // 5. Also call it when the page loads (if needed)
 
5297
  console.log("Final output that will be passed to flask:", mergedArray);
5298
  return mergedArray;
5299
  }
5300
+
5301
  (() => {
5302
  const BTN_ID = 'addAnotherTableBtn';
5303
  const WATCH_ROOT = document.body;