Marthee commited on
Commit
fd1d10d
·
1 Parent(s): 770754a

Update templates/proposed-GUI.html

Browse files
Files changed (1) hide show
  1. templates/proposed-GUI.html +173 -50
templates/proposed-GUI.html CHANGED
@@ -138,7 +138,7 @@
138
  <option value="11aaa"> 11</option> -->
139
  </select>
140
  <br>
141
- <div id="repeatforloop" class="repeatforloopclass" name="repeatforloopname " onchange="getmctName()">
142
 
143
 
144
  <input type="text" id="text0" name="text1name" placeholder="GB-1" class=gb>
@@ -171,6 +171,45 @@
171
 
172
  </form>
173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
 
175
 
176
  </body>
@@ -182,19 +221,21 @@
182
  /* link to dropbox to view pdfs */
183
 
184
  ////////////////////////////////////////////////////////////////////////////////
185
- var dupliatei = 0;
186
  var clonedDivId=0;
187
- var original = document.getElementById('duplicater');
188
- var addciconval=0;
189
  var jj=0;
190
  const vals = [];
191
  function duplicate(mylist) {
192
  addciconval+=1;
 
193
  var clone = original.cloneNode(true); // "deep" clone
194
 
195
  // or clone.id = ""; if the divs don't need an ID
196
  clone.id = 'duplicater' + ++dupliatei;
197
  clonedDivId=clone.id;
 
198
  clone.setAttribute('class','duplicaterclass'+dupliatei);
199
 
200
  clone.getElementsByClassName('measurementselections')[0].setAttribute('name', 'measurementscripts'+dupliatei);
@@ -216,8 +257,9 @@
216
  clone.getElementsByClassName('selections')[0].setAttribute('name', 'select'+dupliatei);
217
  clone.getElementsByClassName('selections')[0].setAttribute('class', 'selections'+dupliatei);
218
 
219
- clone.getElementsByClassName('repeatforloopclass')[0].setAttribute('name', 'repeatforloopname'+dupliatei);
220
- clone.getElementsByClassName('repeatforloopclass')[0].setAttribute('class', 'repeatforloopclass'+dupliatei);
 
221
 
222
  original.parentNode.appendChild(clone).insertBefore(document.getElementById('doneebackground'),null);
223
  console.log( original.parentNode)
@@ -591,34 +633,66 @@ function get3rddropdown(){
591
  var repeatforloopI=0;
592
 
593
  function getmctName(){
 
594
  flag=0;
595
  arrall=[];
596
- for (ii=0 ; ii<=addciconval; ii++){
597
  arrmctNames=[];
598
  arrFinalMCNames=[];
 
599
 
600
- if (ii==0)
 
 
601
  var divduplicater= document.getElementsByClassName('duplicaterclass')[0].children;
602
- else
 
 
 
 
 
 
 
 
 
 
 
603
  var divduplicater= document.getElementsByClassName('duplicaterclass'+ii)[0].children;
604
-
605
- console.log('divv ',divduplicater);
606
- var selections = divduplicater[3][0];//document.getElementsByClassName("selections")[0];
607
- var div=divduplicater[5].children;//document.getElementById('repeatforloop').children;
608
- var divValues=[div[0].value, div[1].value , div[2].value];
609
-
610
- mctname=[selections.value ,divValues , measitemVal ];
611
- if(div[0].value && div[1].value && div[2].value)
612
- { flag=1;
613
- // console.log(mctname);
614
- arrmctNames.push( mctname);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
615
  }
 
 
 
616
 
617
- if (repeatforloopI>0){
618
- for (let i =1 ; i <=repeatforloopI ; i++){
619
- var replicatedDivChildren=document.getElementById('repeatforloop'+i).children;
620
  var divValues2=[replicatedDivChildren[0].value, replicatedDivChildren[1].value , replicatedDivChildren[2].value];
621
- mctname1=[selections.value ,divValues2 , measitemVal];
622
  if(replicatedDivChildren[0].value && replicatedDivChildren[1].value && replicatedDivChildren[2].value)
623
  {
624
  // console.log(mctname1);
@@ -627,29 +701,67 @@ function getmctName(){
627
  }
628
  // console.log(arrmctNames[0][1]);
629
  }
630
- else
631
- {
632
- //first entry only
633
-
634
- arrFinalMCNames= arrmctNames.slice();
635
- console.log(arrFinalMCNames);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
636
 
637
- }
638
- console.log(arrmctNames.length)
639
  if(arrmctNames.length >1){
640
  var name=[];
641
  allnames=[];
642
  arrFinalMCNames = arrmctNames.slice();
 
643
  var newarr=[];
644
  for (let i=0;i<arrmctNames.length; i++)
645
  { str='';
646
  newarr=[];
 
647
  for (let j=i+1; j<arrmctNames.length; j++)
648
  {
649
-
650
  // console.log('NAME = ' +name);
651
  if (arrmctNames[i][1][1] == arrmctNames[j][1][1] && arrmctNames[i][1][2] == arrmctNames[j][1][2])
652
- {
 
653
 
654
  if (allnames.includes(arrmctNames[i][1][0]) )
655
  {
@@ -687,41 +799,52 @@ if(arrmctNames.length >1){
687
  console.log(measitemVal)
688
  // allnames.push(newarr );
689
  if (newarr.length >0){
690
- arrFinalMCNames.push([selections.value , newarr ,measitemVal]);
691
-
 
692
  }
693
  }
694
 
695
- console.log(arrFinalMCNames);
696
  arrall.push(arrFinalMCNames);
697
- console.log(arrall);
698
  }
699
  arrFinalMCNames.push([spreadsheetId]);
700
  }
701
- if (flag==1){
702
 
703
- $.get( '/mctnametoGoogleSheet/'+JSON.stringify(arrFinalMCNames));
704
- }
705
 
706
  }
707
 
708
 
709
-
710
  function addmctnameicon(){
 
711
  repeatforloopI+=1
712
- if (clonedDivId==0)
 
 
713
  var dupDiv=document.getElementById('duplicater'); //pass kol div hna
714
- else
715
- var dupDiv=document.getElementById(clonedDivId); //pass kol div hna
716
 
717
- var div=document.getElementById('repeatforloop');
 
 
 
718
 
 
 
 
719
  var clone = div.cloneNode(true); // "deep" clone
720
- clone.id = 'repeatforloop'+ ++jj;
721
- clone.setAttribute('class','repeatforloopclass'+jj);
722
- clone.setAttribute('name','repeatforloopname'+jj);
 
 
 
723
  dupDiv.appendChild(clone);//.insertBefore(document.getElementById('doneebackground'),null);
724
- console.log(dupDiv);
 
725
 
726
  }
727
 
 
138
  <option value="11aaa"> 11</option> -->
139
  </select>
140
  <br>
141
+ <div id="repeatforloop" class="repeatforloopclass00" name="repeatforloopname " onchange="getmctName()">
142
 
143
 
144
  <input type="text" id="text0" name="text1name" placeholder="GB-1" class=gb>
 
171
 
172
  </form>
173
 
174
+ <div hidden id ="duplicaterhidden" class="duplicaterclasshidden">
175
+ <select name="measurementscripts" class="measurementselections" id="measurementselectionsid" >
176
+ <!-- <option value="" disabled selected hidden>Ground Beams</option> -->
177
+ <option value="ground beams" >Ground Beams </option>
178
+ <option value="pile caps"> Pile Caps</option>
179
+ </select>
180
+
181
+ <select name="measureitem" class="measureitems" oninput="get3rddropdown()" id="measureitemsid">
182
+ <!-- <option value="" disabled selected hidden>Area</option> -->
183
+ <option value="area" >Area </option>
184
+ <option value="perimeter"> Perimeter</option>
185
+ <option value="length" disabled> Length</option>
186
+ <option value="count" disabled> Count</option>
187
+ </select>
188
+
189
+ <select name="select" class="selections" id="selectionsid">
190
+
191
+ </select>
192
+ <br>
193
+ <div id="repeatforloophidden" class="repeatforloopclasshidden" name="repeatforloopnamehidden " onchange="getmctName()">
194
+
195
+
196
+ <input type="text" id="text0" name="text1name" placeholder="GB-1" class=gb>
197
+ <input type="text" id="text1" name="text2name" placeholder="A" class=a>
198
+ <input type="text" id="text2" name="text3name" placeholder="Depth" class=depth>
199
+ <script src="https://cdn.lordicon.com/bhenfmcm.js" ></script>
200
+ <lord-icon
201
+ onclick="addmctnameicon()"
202
+ src="https://cdn.lordicon.com/mecwbjnp.json"
203
+ trigger="hover"
204
+ id="addmctnameid"
205
+ colors="primary:black,secondary:black">
206
+ </lord-icon>
207
+
208
+ </div>
209
+
210
+
211
+ </div>
212
+
213
 
214
 
215
  </body>
 
221
  /* link to dropbox to view pdfs */
222
 
223
  ////////////////////////////////////////////////////////////////////////////////
224
+ var dupliatei = 0; // i
225
  var clonedDivId=0;
226
+ var original = document.getElementById('duplicaterhidden');
227
+ var addciconval=0; //div duplicate
228
  var jj=0;
229
  const vals = [];
230
  function duplicate(mylist) {
231
  addciconval+=1;
232
+ jj=0;
233
  var clone = original.cloneNode(true); // "deep" clone
234
 
235
  // or clone.id = ""; if the divs don't need an ID
236
  clone.id = 'duplicater' + ++dupliatei;
237
  clonedDivId=clone.id;
238
+ clone.removeAttribute("hidden");
239
  clone.setAttribute('class','duplicaterclass'+dupliatei);
240
 
241
  clone.getElementsByClassName('measurementselections')[0].setAttribute('name', 'measurementscripts'+dupliatei);
 
257
  clone.getElementsByClassName('selections')[0].setAttribute('name', 'select'+dupliatei);
258
  clone.getElementsByClassName('selections')[0].setAttribute('class', 'selections'+dupliatei);
259
 
260
+ clone.getElementsByClassName('repeatforloopclasshidden')[0].setAttribute('id', 'repeatforloop'+addciconval+'0');
261
+ clone.getElementsByClassName('repeatforloopclasshidden')[0].setAttribute('name', 'repeatforloopname'+addciconval+'0');
262
+ clone.getElementsByClassName('repeatforloopclasshidden')[0].setAttribute('class', 'repeatforloopclass'+addciconval+'0');
263
 
264
  original.parentNode.appendChild(clone).insertBefore(document.getElementById('doneebackground'),null);
265
  console.log( original.parentNode)
 
633
  var repeatforloopI=0;
634
 
635
  function getmctName(){
636
+
637
  flag=0;
638
  arrall=[];
 
639
  arrmctNames=[];
640
  arrFinalMCNames=[];
641
+ for (ii=0 ; ii<=addciconval; ii++){
642
 
643
+
644
+ // arrFinalMCNames=[];
645
+ if (ii==0){
646
  var divduplicater= document.getElementsByClassName('duplicaterclass')[0].children;
647
+ console.log('divv ',divduplicater); //addicon .children[4]
648
+ var selections = divduplicater[3][0];//document.getElementsByClassName("selections")[0];
649
+ var div=divduplicater[5].children;//document.getElementById('repeatforloop').children
650
+ var divValues=[div[0].value, div[1].value , div[2].value];
651
+ mctname=[selections.value ,divValues , measitemVal ];
652
+ console.log(mctname)
653
+ if(div[0].value && div[1].value && div[2].value)
654
+ { flag=1;
655
+ arrmctNames.push( mctname);
656
+ }
657
+ }
658
+ else if (ii>0){
659
  var divduplicater= document.getElementsByClassName('duplicaterclass'+ii)[0].children;
660
+ console.log('dddd',divduplicater);
661
+ selections = divduplicater[2][0];//document.getElementsByClassName("selections")[0];
662
+ console.log(selections)
663
+ div=divduplicater[4].children;
664
+ var divValues=[div[0].value, div[1].value , div[2].value];
665
+ mctname=[selections.value ,divValues , measitemVal ];
666
+ console.log(mctname)
667
+ if(div[0].value && div[1].value && div[2].value)
668
+ { flag=1;
669
+ arrmctNames.push( mctname);
670
+ }
671
+
672
+ }
673
+ // console.log('divv ',divduplicater[5+repeatforloopI].children[4]); //addicon .children[4]
674
+
675
+
676
+ console.log(arrmctNames)
677
+ // if (repeatforloopI>0){
678
+ if (ii==0 ){
679
+ count=0;
680
+ var ii0selections='';
681
+ var cc= (document.getElementsByClassName('repeatforloopclass'+ii.toString()+'0')[0]).parentNode.children;
682
+ for (let o =0;o <=cc.length;o++)
683
+ {
684
+ if( cc[o] instanceof(HTMLDivElement) )
685
+ count++;
686
+ ii0selections=cc[3].value;
687
  }
688
+ console.log(count);
689
+ for (let i =1 ; i <count ; i++){
690
+ console.log('inloop',ii.toString()+i.toString())
691
 
692
+ var replicatedDivChildren=document.getElementsByClassName('repeatforloopclass'+ii.toString()+i.toString())[0].children;
693
+
 
694
  var divValues2=[replicatedDivChildren[0].value, replicatedDivChildren[1].value , replicatedDivChildren[2].value];
695
+ mctname1=[ii0selections ,divValues2 , measitemVal];
696
  if(replicatedDivChildren[0].value && replicatedDivChildren[1].value && replicatedDivChildren[2].value)
697
  {
698
  // console.log(mctname1);
 
701
  }
702
  // console.log(arrmctNames[0][1]);
703
  }
704
+ else if (ii>0 && addciconval >0 && jj>0)
705
+ {
706
+ count=0;
707
+ var ii0selections='';
708
+ var cc= (document.getElementsByClassName('repeatforloopclass'+ii.toString()+'0')[0]).parentNode.children;
709
+ for (let o =0;o <=cc.length;o++)
710
+ {
711
+ if( cc[o] instanceof(HTMLDivElement) )
712
+ { count++;
713
+ console.log('divvvv',cc[o])}
714
+
715
+ // count++;
716
+ // ii0selections=cc[3].value;
717
+ }
718
+ console.log(count);
719
+
720
+ for (let i =1 ; i < count ; i++){
721
+ console.log('aaaanloop',addciconval.toString()+i.toString())
722
+
723
+ var replicatedDivChildren=document.getElementsByClassName('repeatforloopclass'+ii.toString()+i.toString())[0].children;
724
+ // console.log(document.getElementsByClassName('repeatforloopclass'+ii.toString()+i.toString())[0].parentElement)
725
+
726
+ var divValues2=[replicatedDivChildren[0].value, replicatedDivChildren[1].value , replicatedDivChildren[2].value];
727
+ mctname1=[selections.value ,divValues2 , measitemVal];
728
+ if(replicatedDivChildren[0].value && replicatedDivChildren[1].value && replicatedDivChildren[2].value)
729
+ {
730
+ // if (!(arrmctNames.includes(mctname1))){
731
+ arrmctNames.push(mctname1);
732
+ // console.log(arrmctNames)
733
+ // }
734
+ }
735
+ }
736
+
737
+ }
738
+
739
+ // }
740
+
741
+ // else
742
+ // {
743
+ // //first entry only
744
+ // arrFinalMCNames= arrmctNames.slice();
745
+ // }
746
+ console.log(arrmctNames)
747
 
 
 
748
  if(arrmctNames.length >1){
749
  var name=[];
750
  allnames=[];
751
  arrFinalMCNames = arrmctNames.slice();
752
+ console.log('finalnameflawel',arrFinalMCNames)
753
  var newarr=[];
754
  for (let i=0;i<arrmctNames.length; i++)
755
  { str='';
756
  newarr=[];
757
+
758
  for (let j=i+1; j<arrmctNames.length; j++)
759
  {
760
+
761
  // console.log('NAME = ' +name);
762
  if (arrmctNames[i][1][1] == arrmctNames[j][1][1] && arrmctNames[i][1][2] == arrmctNames[j][1][2])
763
+ { var selectionsname=arrmctNames[i][0] ;
764
+ console.log('foorrr',arrmctNames[i][1][1])
765
 
766
  if (allnames.includes(arrmctNames[i][1][0]) )
767
  {
 
799
  console.log(measitemVal)
800
  // allnames.push(newarr );
801
  if (newarr.length >0){
802
+ arrFinalMCNames.push([selectionsname , newarr, measitemVal ]);
803
+
804
+
805
  }
806
  }
807
 
808
+ console.log('finals',arrFinalMCNames);
809
  arrall.push(arrFinalMCNames);
810
+
811
  }
812
  arrFinalMCNames.push([spreadsheetId]);
813
  }
814
+ // if (flag==1){
815
 
816
+ // $.get( '/mctnametoGoogleSheet/'+JSON.stringify(arrFinalMCNames));
817
+ // }
818
 
819
  }
820
 
821
 
 
822
  function addmctnameicon(){
823
+
824
  repeatforloopI+=1
825
+
826
+ if (clonedDivId==0){
827
+
828
  var dupDiv=document.getElementById('duplicater'); //pass kol div hna
 
 
829
 
830
+ }
831
+ else{
832
+
833
+ var dupDiv=document.getElementById(clonedDivId); //pass kol div hna //akher div et3mlt
834
 
835
+ }
836
+ var div=document.getElementById('repeatforloophidden');
837
+ // console.log('vcc, ' ,dupDiv.children[5]);
838
  var clone = div.cloneNode(true); // "deep" clone
839
+
840
+ clone.id = 'repeatforloop'+ addciconval + ++jj;
841
+ clone.setAttribute('class','repeatforloopclass'+addciconval+jj);
842
+ clone.setAttribute('name','repeatforloopname'+addciconval+jj);
843
+
844
+
845
  dupDiv.appendChild(clone);//.insertBefore(document.getElementById('doneebackground'),null);
846
+
847
+ console.log(dupDiv.children);
848
 
849
  }
850