Marthee commited on
Commit
692fd16
·
verified ·
1 Parent(s): c7da3b4

Update templates/proposed-GUI.html

Browse files
Files changed (1) hide show
  1. templates/proposed-GUI.html +155 -70
templates/proposed-GUI.html CHANGED
@@ -125,11 +125,8 @@
125
  <div id ="tomeasurediv">
126
  <div>
127
  <label id="measureLabel">Document To Measure</label>
128
- <div class="input-containerSearchPaste">
129
  <input type="search" oninput="handleKey(event, this.id)" id="tomeasureSearchInput">
130
- <i class="fa fa-clipboard clipboard-icon" aria-hidden="true"></i>
131
- <i class="fa fa-times searchfocusx" aria-hidden="true"></i>
132
- </div>
133
  <i hidden class="fa fa-dropbox fa-lg" id="refreshDropboxButtonID">
134
  <span class="dropboxtip">The console updates projects retrieved from Dropbox automatically at 9:00 am and 9:00 p.m. If you need to access any projects in between, just click on this button. Please note that it will refresh the files related to the project you chose only.</span> </i>
135
 
@@ -749,10 +746,88 @@
749
  colors="primary:black,secondary:black">
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>
@@ -789,33 +864,6 @@
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" >
795
- <input type="text" id="text1extra" name="text2name" placeholder="Eg:NBS K10/" >
796
- <input type="number" id="text2extra" name="text3name" placeholder="Eg: 3" >
797
- <script src="https://cdn.lordicon.com/bhenfmcm.js" ></script>
798
- <lord-icon
799
- onclick="addmctnameiconPopup()"
800
- src="https://cdn.lordicon.com/mecwbjnp.json"
801
- trigger="hover"
802
- class="addmctnameclassExtra"
803
- id="addmctnameidExtra"
804
- colors="primary:black,secondary:black">
805
- </lord-icon>
806
- <script src="https://cdn.lordicon.com/bhenfmcm.js"></script>
807
- <lord-icon
808
- onclick="deletemctnameiconPopup()"
809
- src="https://cdn.lordicon.com/rivoakkk.json"
810
- trigger="hover"
811
- class="deletemctnameclassExtra"
812
- id="deletemctnameidExtra"
813
- colors="primary:black,secondary:black">
814
- </lord-icon>
815
- </div>
816
-
817
- </div>
818
-
819
  <br>
820
  <div class="text-right">
821
  <button class="dialog-btn btn-primary" id="confirm">Ok</button>
@@ -2407,6 +2455,8 @@ var doorSchedulePDF;
2407
  }
2408
 
2409
 
 
 
2410
  relvids.push(relvSelect);
2411
  measids.push(measSelect);
2412
 
@@ -3822,6 +3872,60 @@ function deletemctnameiconPopup(){
3822
  }
3823
  }
3824
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3825
  //___________________________________________________________________________________________________________
3826
  //___________________________________________________________________________________________________________
3827
  function colors(){
@@ -4375,7 +4479,6 @@ if (sectionNumber.startsWith('2.8') || sectionNumber.startsWith('2.6'))
4375
  };
4376
  // }
4377
 
4378
-
4379
  document.getElementById('addAnotherTableBtn').onclick = function() {
4380
  console.log("add another table clicked")
4381
  // Clone the template row
@@ -4405,7 +4508,7 @@ document.getElementById('addAnotherTableBtn').onclick = function() {
4405
  updateDeleteButtonStates();
4406
  };
4407
 
4408
-
4409
  document.getElementById("confirm").onclick = function(){confirmDialogR()};
4410
  function confirmDialogR() {
4411
  /* code executed if confirm is clicked */
@@ -4437,6 +4540,20 @@ document.getElementById("cancel").onclick = function(){cancelDialog()};
4437
  function cancelDialog() {
4438
  overlayme.style.display = "none";
4439
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4440
 
4441
  var extracted_path;
4442
  function callrefreshDropbox(){
@@ -4595,18 +4712,16 @@ function callrefreshAPI(){
4595
 
4596
  }
4597
 
4598
- var groupedValues = [];
4599
- function getpopuptext() {
4600
  groupedValues = [];
4601
  // Select all text/number input fields inside the modal
4602
  const inputs = document.querySelectorAll('#duplicaterExtra input[type="text"], #duplicaterExtra input[type="number"]');
4603
  const values = [];
4604
-
4605
  // Collect all input values
4606
  inputs.forEach(input => {
4607
  values.push(input.value.trim());
4608
  });
4609
-
4610
  console.log("Collected input values:", values);
4611
  if (projsec.value.startsWith('2.7') || projsec.value.startsWith('3.2') || projsec.value.startsWith('3.3'))
4612
  lengthofitems=3
@@ -4617,39 +4732,10 @@ function getpopuptext() {
4617
  const group = values.slice(i, i + lengthofitems);
4618
  groupedValues.push(group)
4619
  }
4620
-
4621
  console.log("Grouped input values:", groupedValues);
4622
  return groupedValues;
4623
  }
4624
- // Clipboard paste with focus preservation
4625
- document.querySelector('.clipboard-icon').addEventListener('mousedown', (e) => {
4626
- e.preventDefault(); // Prevent input blur
4627
- });
4628
 
4629
- document.querySelector('.clipboard-icon').addEventListener('click', async () => {
4630
- try {
4631
- const text = await navigator.clipboard.readText();
4632
- const input = document.getElementById('tomeasureSearchInput');
4633
- input.value = text;
4634
- input.focus(); // Re-focus after clipboard read
4635
- handleKey({ target: input }, 'tomeasureSearchInput');
4636
- } catch (err) {
4637
- console.error('Clipboard access error:', err);
4638
- alert('Clipboard access is blocked. Try using Ctrl+V.');
4639
- }
4640
- });
4641
-
4642
- // Clear input on 'x' click, with focus preserved
4643
- document.querySelector('.searchfocusx').addEventListener('mousedown', (e) => {
4644
- e.preventDefault(); // Prevent input blur
4645
- });
4646
-
4647
- document.querySelector('.searchfocusx').addEventListener('click', () => {
4648
- const input = document.getElementById('tomeasureSearchInput');
4649
- input.value = '';
4650
- input.focus(); // Keep input focused
4651
- handleKey({ target: input }, 'tomeasureSearchInput');
4652
- });
4653
  function getAddedTablesDataSimple_modified() {
4654
  const allTablesData = [];
4655
  // 1. Get the first main table container
@@ -4744,4 +4830,3 @@ function get_combined_tables(main_table, other_tables){
4744
  return mergedArray;
4745
  }
4746
  </script>
4747
-
 
125
  <div id ="tomeasurediv">
126
  <div>
127
  <label id="measureLabel">Document To Measure</label>
 
128
  <input type="search" oninput="handleKey(event, this.id)" id="tomeasureSearchInput">
129
+ <!-- <button id="refreshDropboxButtonID"></button> -->
 
 
130
  <i hidden class="fa fa-dropbox fa-lg" id="refreshDropboxButtonID">
131
  <span class="dropboxtip">The console updates projects retrieved from Dropbox automatically at 9:00 am and 9:00 p.m. If you need to access any projects in between, just click on this button. Please note that it will refresh the files related to the project you chose only.</span> </i>
132
 
 
746
  colors="primary:black,secondary:black">
747
  </lord-icon>
748
  </div>
749
+ </div>
750
+ <div hidden="until-found" id="duplicaterExtraHidden" >
751
+ <div id="repeatforloopExtrahidden" class="repeatforloopclassExtrahidden" name="repeatforloopnameExtrahidden " > <!-- onchange="getmctName()" -->
752
+ <input type="text" id="text0extra" name="text1name" placeholder="Eg: Column Name" >
753
+ <input type="text" id="text1extra" name="text2name" placeholder="Eg:NBS K10/" >
754
+ <input type="number" id="text2extra" name="text3name" placeholder="Eg: 3" >
755
+ <script src="https://cdn.lordicon.com/bhenfmcm.js" ></script>
756
+ <lord-icon
757
+ onclick="addmctnameiconPopup()"
758
+ src="https://cdn.lordicon.com/mecwbjnp.json"
759
+ trigger="hover"
760
+ class="addmctnameclassExtra"
761
+ id="addmctnameidExtra"
762
+ colors="primary:black,secondary:black">
763
+ </lord-icon>
764
+ <script src="https://cdn.lordicon.com/bhenfmcm.js"></script>
765
+ <lord-icon
766
+ onclick="deletemctnameiconPopup()"
767
+ src="https://cdn.lordicon.com/rivoakkk.json"
768
+ trigger="hover"
769
+ class="deletemctnameclassExtra"
770
+ id="deletemctnameidExtra"
771
+ colors="primary:black,secondary:black">
772
+ </lord-icon>
773
+ </div>
774
+
775
+ </div>
776
 
777
+ <!-- Place at the bottom of your modal-body (or outside the modal if you want) -->
778
+ <div id="addAnotherTable" hidden="until-found">
779
+ <div id="repeatforloopExtratable" class="repeatforloopclassExtra0table" name="repeatforloopExtranametable " >
780
+ <label id="clm">New Table</label> <br>
781
+ <input type="text" id="text0extra" name="text1name" placeholder="Eg: Column Name" >
782
+ <input type="text" id="text1extra" name="text2name" placeholder="Eg:NBS K10/" >
783
+ <input type="number" id="text2extra" name="text3name" placeholder="Eg: 3" >
784
+ <script src="https://cdn.lordicon.com/bhenfmcm.js" ></script>
785
+ <lord-icon
786
+ onclick="addmctnameiconPopupTable(event)"
787
+ src="https://cdn.lordicon.com/mecwbjnp.json"
788
+ trigger="hover"
789
+ class="addmctnameclassExtra"
790
+ id="addmctnameidExtra"
791
+ colors="primary:black,secondary:black">
792
+ </lord-icon>
793
+
794
+ <lord-icon
795
+ onclick="deletemctnameiconPopupTable(event)"
796
+ src="https://cdn.lordicon.com/rivoakkk.json"
797
+ trigger="hover"
798
+ class="deletemctnameclassExtra"
799
+ id="deletemctnameidExtra"
800
+ colors="primary:black,secondary:black">
801
+ </lord-icon>
802
+ </div>
803
+ </div>
804
+ <div hidden="until-found" id="duplicaterExtraHiddentable" >
805
+ <div id="addAnotherTableHidden" class="repeatforloopclassExtrahiddentable" name="repeatforloopnameExtrahiddentable " > <!-- onchange="getmctName()" -->
806
+ <input type="text" id="text0extra" name="text1name" placeholder="Eg: Column Name" >
807
+ <input type="text" id="text1extra" name="text2name" placeholder="Eg:NBS K10/" >
808
+ <input type="number" id="text2extra" name="text3name" placeholder="Eg: 3" >
809
+ <script src="https://cdn.lordicon.com/bhenfmcm.js" ></script>
810
+ <lord-icon
811
+ onclick="addmctnameiconPopupTable(event)"
812
+ src="https://cdn.lordicon.com/mecwbjnp.json"
813
+ trigger="hover"
814
+ class="addmctnameclassExtra"
815
+ id="addmctnameidExtra"
816
+ colors="primary:black,secondary:black">
817
+ </lord-icon>
818
+
819
+ <lord-icon
820
+ onclick="deletemctnameiconPopupTable(event)"
821
+ src="https://cdn.lordicon.com/rivoakkk.json"
822
+ trigger="hover"
823
+ class="deletemctnameclassExtra"
824
+ id="deletemctnameidExtra"
825
+ colors="primary:black,secondary:black">
826
+ </lord-icon>
827
+ </div>
828
+ </div>
829
+
830
+ <div id="duplicaterExtradoor" hidden="until-found">
831
  <div id="repeatforloopExtra" class="repeatforloopclassExtra0" name="repeatforloopExtraname " >
832
  <label id="modalColumn">Enter column names as shown in the schedule</label>
833
  <button type="button" class="delete-table-btn" style="float:right; margin-bottom: 8px;">Delete Table</button>
 
864
  </div>
865
  </div>
866
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
867
  <br>
868
  <div class="text-right">
869
  <button class="dialog-btn btn-primary" id="confirm">Ok</button>
 
2455
  }
2456
 
2457
 
2458
+
2459
+
2460
  relvids.push(relvSelect);
2461
  measids.push(measSelect);
2462
 
 
3872
  }
3873
  }
3874
  }
3875
+
3876
+ //Functions for the new added tables
3877
+ // + button in dynamic table rows
3878
+ function addmctnameiconPopupTable(event) {
3879
+ // Find current row in the table (supports both classes)
3880
+ let currentTableDiv = event.target.closest('.repeatforloopclassExtra0table, .repeatforloopclassExtrahiddentable');
3881
+ if (!currentTableDiv) {
3882
+ alert("Could not find the row to insert after! Check the class names.");
3883
+ return;
3884
+ }
3885
+
3886
+ // Clone the hidden row template for table-rows
3887
+ let template = document.getElementById('addAnotherTableHidden');
3888
+ let newRow = template.cloneNode(true);
3889
+ newRow.id = ""; // Remove ID to avoid duplicates
3890
+
3891
+ // Hook up + and - for this new row
3892
+ let plus = newRow.querySelector('lord-icon[onclick^="addmctnameiconPopupTable"]');
3893
+ if (plus) plus.onclick = addmctnameiconPopupTable;
3894
+
3895
+ let minus = newRow.querySelector('lord-icon[onclick^="deletemctnameiconPopupTable"]');
3896
+ if (minus) minus.onclick = deletemctnameiconPopupTable;
3897
+
3898
+ // Optionally clear all input values
3899
+ newRow.querySelectorAll('input').forEach(inp => inp.value = '');
3900
+
3901
+ // Section logic: disable fields in 2.6/2.8
3902
+ if (typeof sectionNumber !== "undefined" && (sectionNumber.startsWith('2.6') || sectionNumber.startsWith('2.8'))) {
3903
+ let spec = newRow.querySelector('input[name="text2name"]');
3904
+ let count = newRow.querySelector('input[name="text3name"]');
3905
+ if (spec) {
3906
+ spec.disabled = true;
3907
+ spec.style.backgroundColor = "rgba(101, 101, 101, 0.27)";
3908
+ spec.style.cursor = "not-allowed";
3909
+ }
3910
+ if (count) {
3911
+ count.disabled = true;
3912
+ count.style.backgroundColor = "rgba(101, 101, 101, 0.27)";
3913
+ count.style.cursor = "not-allowed";
3914
+ }
3915
+ }
3916
+
3917
+ // Insert after the current row
3918
+ currentTableDiv.parentNode.insertBefore(newRow, currentTableDiv.nextSibling);
3919
+ }
3920
+
3921
+ // - button in dynamic table rows
3922
+ function deletemctnameiconPopupTable(event) {
3923
+ // Remove the parent of the clicked minus button (support both classes)
3924
+ let row = event.target.closest('.repeatforloopclassExtra0table, .repeatforloopclassExtrahiddentable');
3925
+ if (row) row.remove();
3926
+ }
3927
+
3928
+
3929
  //___________________________________________________________________________________________________________
3930
  //___________________________________________________________________________________________________________
3931
  function colors(){
 
4479
  };
4480
  // }
4481
 
 
4482
  document.getElementById('addAnotherTableBtn').onclick = function() {
4483
  console.log("add another table clicked")
4484
  // Clone the template row
 
4508
  updateDeleteButtonStates();
4509
  };
4510
 
4511
+
4512
  document.getElementById("confirm").onclick = function(){confirmDialogR()};
4513
  function confirmDialogR() {
4514
  /* code executed if confirm is clicked */
 
4540
  function cancelDialog() {
4541
  overlayme.style.display = "none";
4542
  }
4543
+ // This targets all plus/minus clicks anywhere inside the modal body
4544
+ document.querySelector('.modal-body').addEventListener('click', function(e) {
4545
+ // Handle PLUS (+)
4546
+ if (e.target.classList.contains('plusBtnClass')) {
4547
+ // call your existing add-row logic
4548
+ // e.target is the + that was clicked
4549
+ addmctnameiconPopup(e.target); // or whatever your logic is
4550
+ }
4551
+ // Handle MINUS (–)
4552
+ if (e.target.classList.contains('minusBtnClass')) {
4553
+ // call your existing remove-row logic
4554
+ deletemctnameiconPopup(e.target);
4555
+ }
4556
+ });
4557
 
4558
  var extracted_path;
4559
  function callrefreshDropbox(){
 
4712
 
4713
  }
4714
 
4715
+ var groupedValues = [];
4716
+ function getpopuptext() {
4717
  groupedValues = [];
4718
  // Select all text/number input fields inside the modal
4719
  const inputs = document.querySelectorAll('#duplicaterExtra input[type="text"], #duplicaterExtra input[type="number"]');
4720
  const values = [];
 
4721
  // Collect all input values
4722
  inputs.forEach(input => {
4723
  values.push(input.value.trim());
4724
  });
 
4725
  console.log("Collected input values:", values);
4726
  if (projsec.value.startsWith('2.7') || projsec.value.startsWith('3.2') || projsec.value.startsWith('3.3'))
4727
  lengthofitems=3
 
4732
  const group = values.slice(i, i + lengthofitems);
4733
  groupedValues.push(group)
4734
  }
 
4735
  console.log("Grouped input values:", groupedValues);
4736
  return groupedValues;
4737
  }
 
 
 
 
4738
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4739
  function getAddedTablesDataSimple_modified() {
4740
  const allTablesData = [];
4741
  // 1. Get the first main table container
 
4830
  return mergedArray;
4831
  }
4832
  </script>