Spaces:
Paused
Paused
Update templates/proposed-GUI.html
Browse files- templates/proposed-GUI.html +183 -10
templates/proposed-GUI.html
CHANGED
|
@@ -750,6 +750,45 @@
|
|
| 750 |
</lord-icon>
|
| 751 |
</div>
|
| 752 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 753 |
<div hidden="until-found" id="duplicaterExtraHidden" >
|
| 754 |
<div id="repeatforloopExtrahidden" class="repeatforloopclassExtrahidden" name="repeatforloopnameExtrahidden " > <!-- onchange="getmctName()" -->
|
| 755 |
<input type="text" id="text0extra" name="text1name" placeholder="Eg: Column Name" >
|
|
@@ -781,6 +820,8 @@
|
|
| 781 |
<div class="text-right">
|
| 782 |
<button class="dialog-btn btn-primary" id="confirm">Ok</button>
|
| 783 |
<button class="dialog-btn btn-cancel" id="cancel">Cancel</button>
|
|
|
|
|
|
|
| 784 |
</div>
|
| 785 |
<br>
|
| 786 |
</div>
|
|
@@ -4309,27 +4350,61 @@ if(sectionNumber.startsWith('2.7') ){
|
|
| 4309 |
|
| 4310 |
if (sectionNumber.startsWith('2.8') || sectionNumber.startsWith('2.6'))
|
| 4311 |
{
|
| 4312 |
-
|
| 4313 |
-
|
| 4314 |
-
|
| 4315 |
-
text1extra.
|
| 4316 |
-
|
| 4317 |
-
|
| 4318 |
-
|
| 4319 |
-
|
| 4320 |
-
text2extra.
|
|
|
|
|
|
|
|
|
|
| 4321 |
}
|
| 4322 |
-
|
| 4323 |
TopTextModal.textContent='Define Information to Extract from Drawing'
|
| 4324 |
if (document.getElementById("popupforextratext").disabled==false)
|
| 4325 |
{
|
| 4326 |
overlaymeText.textContent='';
|
| 4327 |
overlayme.style.display = "block";
|
|
|
|
| 4328 |
}
|
| 4329 |
};
|
| 4330 |
// }
|
| 4331 |
|
| 4332 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4333 |
document.getElementById("confirm").onclick = function(){confirmDialogR()};
|
| 4334 |
function confirmDialogR() {
|
| 4335 |
/* code executed if confirm is clicked */
|
|
@@ -4346,6 +4421,12 @@ function confirmDialogR() {
|
|
| 4346 |
}
|
| 4347 |
else{
|
| 4348 |
getpopuptext();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4349 |
}
|
| 4350 |
|
| 4351 |
}
|
|
@@ -4568,6 +4649,98 @@ document.querySelector('.searchfocusx').addEventListener('click', () => {
|
|
| 4568 |
input.focus(); // Keep input focused
|
| 4569 |
handleKey({ target: input }, 'tomeasureSearchInput');
|
| 4570 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4571 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4572 |
</script>
|
| 4573 |
|
|
|
|
| 750 |
</lord-icon>
|
| 751 |
</div>
|
| 752 |
</div>
|
| 753 |
+
|
| 754 |
+
|
| 755 |
+
<div id="duplicaterExtradoor" hidden="until-found">
|
| 756 |
+
<div id="repeatforloopExtra" class="repeatforloopclassExtra0" name="repeatforloopExtraname " >
|
| 757 |
+
<label id="modalColumn">Enter column names as shown in the schedule</label>
|
| 758 |
+
<button type="button" class="delete-table-btn" style="float:right; margin-bottom: 8px;">Delete Table</button>
|
| 759 |
+
|
| 760 |
+
|
| 761 |
+
|
| 762 |
+
|
| 763 |
+
<i class="fa fa-info-circle smallFaIcon" id="infotoolModal">
|
| 764 |
+
<span class="tooltiptext" id="modaltooltips">
|
| 765 |
+
<p>
|
| 766 |
+
<b>SCROLL DOWN TO READ ALL INFORMATION.</b><br>
|
| 767 |
+
1) You can skip any column name, but <b>at least one of “Door id”</b> or <b>“Door type”</b> must be included.<br>
|
| 768 |
+
2) Column names must <b>exactly match</b> how they appear in the schedule. For best results, <b>copy the name directly from the schedule and paste it here</b>. <br>
|
| 769 |
+
3) If there is <b>"Structural Opening" </b>there are two scenarios:<br>
|
| 770 |
+
3.a) <b>Single Column:</b> If both width and height appear in one cell, enter the value into the <b>“Width”</b> field and leave the <b>“Height field empty”</b>.<br>
|
| 771 |
+
3.b) <b>Separate Columns:</b> If width and height appear in <b>two separate columns,</b> enter them into the respective <b>“Width”</b> and <b>“Height”</b> fields. In this case, you can <b>ignore “Structural Opening”</b>.<br>
|
| 772 |
+
4) <b>“Fire Rating”</b> and <b>“Acoustic Rating”</b> are optional fields.<br>
|
| 773 |
+
If only one of them is available, make sure to maintain the <b>same order of fields</b>.
|
| 774 |
+
</p>
|
| 775 |
+
</span>
|
| 776 |
+
</i>
|
| 777 |
+
|
| 778 |
+
<br>
|
| 779 |
+
|
| 780 |
+
<input type="text" id="textidextra" name="textidname" placeholder="Door Id" > <br>
|
| 781 |
+
<input type="text" id="textypeextra" name="texttypename" placeholder="Door Type" > <br>
|
| 782 |
+
<input type="text" id="textstopextra" name="textstopname" placeholder="Width or Structural Opening" > <br>
|
| 783 |
+
<input type="text" id="textheightextra" name="textheightname" placeholder="Height" > <br>
|
| 784 |
+
<input type="text" id="textfireextra" name="textfirename" placeholder="Fire rating" > <br>
|
| 785 |
+
<input type="text" id="textacousticextra" name="textacousticname" placeholder="Acoustic Rating" >
|
| 786 |
+
|
| 787 |
+
<script src="https://cdn.lordicon.com/bhenfmcm.js" ></script>
|
| 788 |
+
|
| 789 |
+
</div>
|
| 790 |
+
</div>
|
| 791 |
+
|
| 792 |
<div hidden="until-found" id="duplicaterExtraHidden" >
|
| 793 |
<div id="repeatforloopExtrahidden" class="repeatforloopclassExtrahidden" name="repeatforloopnameExtrahidden " > <!-- onchange="getmctName()" -->
|
| 794 |
<input type="text" id="text0extra" name="text1name" placeholder="Eg: Column Name" >
|
|
|
|
| 820 |
<div class="text-right">
|
| 821 |
<button class="dialog-btn btn-primary" id="confirm">Ok</button>
|
| 822 |
<button class="dialog-btn btn-cancel" id="cancel">Cancel</button>
|
| 823 |
+
<button type="button" id="addAnotherTableBtn" style="display:none; margin:10px 0 15px 0;">Add Another Table</button>
|
| 824 |
+
|
| 825 |
</div>
|
| 826 |
<br>
|
| 827 |
</div>
|
|
|
|
| 4350 |
|
| 4351 |
if (sectionNumber.startsWith('2.8') || sectionNumber.startsWith('2.6'))
|
| 4352 |
{
|
| 4353 |
+
document.getElementById('addAnotherTableBtn').style.display = 'block';
|
| 4354 |
+
document.getElementById('addAnotherTableBtn').disabled = false;
|
| 4355 |
+
|
| 4356 |
+
//text1extra= document.getElementById("text1extra")
|
| 4357 |
+
//text1extra.style.backgroundColor = "rgba(101, 101, 101, 0.27)";
|
| 4358 |
+
//text1extra.style.cursor='not-allowed';
|
| 4359 |
+
//text1extra.disabled="disabled";
|
| 4360 |
+
|
| 4361 |
+
//text2extra= document.getElementById("text2extra")
|
| 4362 |
+
//text2extra.style.backgroundColor = "rgba(101, 101, 101, 0.27)";
|
| 4363 |
+
//text2extra.style.cursor='not-allowed';
|
| 4364 |
+
//text2extra.disabled="disabled";
|
| 4365 |
}
|
| 4366 |
+
duplicaterExtradoor.removeAttribute('hidden');
|
| 4367 |
TopTextModal.textContent='Define Information to Extract from Drawing'
|
| 4368 |
if (document.getElementById("popupforextratext").disabled==false)
|
| 4369 |
{
|
| 4370 |
overlaymeText.textContent='';
|
| 4371 |
overlayme.style.display = "block";
|
| 4372 |
+
updateDeleteButtonStates();
|
| 4373 |
}
|
| 4374 |
};
|
| 4375 |
// }
|
| 4376 |
|
| 4377 |
|
| 4378 |
+
document.getElementById('addAnotherTableBtn').onclick = function() {
|
| 4379 |
+
console.log("add another table clicked")
|
| 4380 |
+
// Clone the template row
|
| 4381 |
+
let newRow = document.getElementById('duplicaterExtradoor').firstElementChild.cloneNode(true);
|
| 4382 |
+
// Clear values
|
| 4383 |
+
newRow.querySelectorAll('input').forEach(inp => inp.value = '');
|
| 4384 |
+
|
| 4385 |
+
// --- Section logic: Disable Spec/Count for 2.6/2.8 ---
|
| 4386 |
+
// if (sectionNumber === '2.6' || sectionNumber === '2.8') {
|
| 4387 |
+
// let spec = newRow.querySelector('input[name="text2name"]');
|
| 4388 |
+
// let count = newRow.querySelector('input[name="text3name"]');
|
| 4389 |
+
//if(spec){
|
| 4390 |
+
//spec.disabled = true;
|
| 4391 |
+
//spec.style.backgroundColor = "rgba(101,101,101,0.27)";
|
| 4392 |
+
//spec.style.cursor = "not-allowed";
|
| 4393 |
+
//}
|
| 4394 |
+
//if(count){
|
| 4395 |
+
//count.disabled = true;
|
| 4396 |
+
//count.style.backgroundColor = "rgba(101,101,101,0.27)";
|
| 4397 |
+
//count.style.cursor = "not-allowed";
|
| 4398 |
+
//}
|
| 4399 |
+
//}
|
| 4400 |
+
|
| 4401 |
+
// Insert before the Ok/Cancel buttons (find the .text-right div)
|
| 4402 |
+
let btns = document.querySelector('.modal-body .text-right');
|
| 4403 |
+
btns.parentNode.insertBefore(newRow, btns);
|
| 4404 |
+
updateDeleteButtonStates();
|
| 4405 |
+
};
|
| 4406 |
+
|
| 4407 |
+
|
| 4408 |
document.getElementById("confirm").onclick = function(){confirmDialogR()};
|
| 4409 |
function confirmDialogR() {
|
| 4410 |
/* code executed if confirm is clicked */
|
|
|
|
| 4421 |
}
|
| 4422 |
else{
|
| 4423 |
getpopuptext();
|
| 4424 |
+
//get_from_dataSimple_modified();
|
| 4425 |
+
getAddedTablesDataSimple_modified();
|
| 4426 |
+
//tab1 = getpopuptext();
|
| 4427 |
+
//tab2 = get_from_dataSimple_modified();
|
| 4428 |
+
//get_combined_tables(getpopuptext(), get_from_dataSimple_modified());
|
| 4429 |
+
updateDeleteButtonStates();
|
| 4430 |
}
|
| 4431 |
|
| 4432 |
}
|
|
|
|
| 4649 |
input.focus(); // Keep input focused
|
| 4650 |
handleKey({ target: input }, 'tomeasureSearchInput');
|
| 4651 |
});
|
| 4652 |
+
function getAddedTablesDataSimple_modified() {
|
| 4653 |
+
const allTablesData = [];
|
| 4654 |
+
// 1. Get the first main table container
|
| 4655 |
+
const firstTableDiv = document.querySelector('#duplicaterExtradoor > .repeatforloopclassExtra0');
|
| 4656 |
+
// 2. Get all other tables (added dynamically) - assume they have same 6 inputs & a label
|
| 4657 |
+
const otherTables = Array.from(document.querySelectorAll('.repeatforloopclassExtra0'))
|
| 4658 |
+
.concat(Array.from(document.querySelectorAll('#duplicaterExtradoor ~ .repeatforloopclassExtra0')));
|
| 4659 |
+
|
| 4660 |
+
// Merge first and others (remove duplicates)
|
| 4661 |
+
const uniqueTables = [firstTableDiv].concat(
|
| 4662 |
+
Array.from(document.querySelectorAll('.repeatforloopclassExtra0')).filter(div => div !== firstTableDiv)
|
| 4663 |
+
);
|
| 4664 |
+
|
| 4665 |
+
uniqueTables.forEach(container => {
|
| 4666 |
+
if (!container) return;
|
| 4667 |
+
const inputs = container.querySelectorAll('input[name="textidname"], input[name="texttypename"], input[name="textstopname"], input[name="textheightname"], input[name="textfirename"], input[name="textacousticname"]');
|
| 4668 |
+
if (inputs.length === 6) {
|
| 4669 |
+
const rowValues = [
|
| 4670 |
+
inputs[0].value.trim(),
|
| 4671 |
+
inputs[1].value.trim(),
|
| 4672 |
+
inputs[2].value.trim(),
|
| 4673 |
+
inputs[3].value.trim(),
|
| 4674 |
+
inputs[4].value.trim(),
|
| 4675 |
+
inputs[5].value.trim()
|
| 4676 |
+
];
|
| 4677 |
+
allTablesData.push(rowValues);
|
| 4678 |
+
}
|
| 4679 |
+
});
|
| 4680 |
+
|
| 4681 |
+
console.log("All table data:", allTablesData);
|
| 4682 |
+
return allTablesData;
|
| 4683 |
+
}
|
| 4684 |
+
// Attach listener to all current and future delete buttons
|
| 4685 |
+
document.addEventListener('click', function(event) {
|
| 4686 |
+
if(event.target.classList.contains('delete-table-btn')) {
|
| 4687 |
+
// Find all delete buttons
|
| 4688 |
+
const allBtns = Array.from(document.querySelectorAll('.delete-table-btn'));
|
| 4689 |
+
// Only allow delete if it's NOT the first button
|
| 4690 |
+
if (event.target !== allBtns[0]) {
|
| 4691 |
+
const tableGroup = event.target.closest('.repeatforloopclassExtra0');
|
| 4692 |
+
if(tableGroup) tableGroup.remove();
|
| 4693 |
+
}
|
| 4694 |
+
}
|
| 4695 |
+
});
|
| 4696 |
+
// After adding tables, run this code:
|
| 4697 |
+
function updateDeleteButtonStates() {
|
| 4698 |
+
const allDeleteBtns = document.querySelectorAll('.delete-table-btn');
|
| 4699 |
+
|
| 4700 |
+
// Reset all buttons to enabled state first
|
| 4701 |
+
allDeleteBtns.forEach(btn => {
|
| 4702 |
+
btn.disabled = false;
|
| 4703 |
+
btn.style.opacity = '1';
|
| 4704 |
+
btn.style.background = '';
|
| 4705 |
+
btn.style.color = '';
|
| 4706 |
+
btn.style.cursor = 'pointer';
|
| 4707 |
+
});
|
| 4708 |
+
|
| 4709 |
+
// Disable and shade the first button only
|
| 4710 |
+
if (allDeleteBtns.length > 0) {
|
| 4711 |
+
const firstBtn = allDeleteBtns[0];
|
| 4712 |
+
firstBtn.disabled = true;
|
| 4713 |
+
// Apply shaded styling
|
| 4714 |
+
firstBtn.style.opacity = '0.5';
|
| 4715 |
+
firstBtn.style.background = '#ddd';
|
| 4716 |
+
firstBtn.style.color = '#888';
|
| 4717 |
+
firstBtn.style.cursor = 'not-allowed';
|
| 4718 |
+
}
|
| 4719 |
+
}
|
| 4720 |
+
|
| 4721 |
+
// 5. Also call it when the page loads (if needed)
|
| 4722 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 4723 |
+
updateDeleteButtonStates();
|
| 4724 |
+
});
|
| 4725 |
+
// Call this whenever you add or remove a table!
|
| 4726 |
+
|
| 4727 |
|
| 4728 |
+
|
| 4729 |
+
function get_from_dataSimple_modified(){
|
| 4730 |
+
const data_from_table_simple = getAddedTablesDataSimple_modified();
|
| 4731 |
+
const tables = [];
|
| 4732 |
+
for (let i = 1; i < data_from_table_simple.length; i++) {
|
| 4733 |
+
tables.push(data_from_table_simple[i])
|
| 4734 |
+
}
|
| 4735 |
+
console.log("Filtered Added Tables:", tables);
|
| 4736 |
+
return tables;
|
| 4737 |
+
|
| 4738 |
+
}
|
| 4739 |
+
|
| 4740 |
+
function get_combined_tables(main_table, other_tables){
|
| 4741 |
+
const mergedArray = main_table.concat(other_tables);
|
| 4742 |
+
console.log("Final output that will be passed to flask:", mergedArray);
|
| 4743 |
+
return mergedArray;
|
| 4744 |
+
}
|
| 4745 |
</script>
|
| 4746 |
|