Marthee commited on
Commit
2fa7407
·
verified ·
1 Parent(s): 053f1ba

Update templates/proposed-GUI.html

Browse files
Files changed (1) hide show
  1. templates/proposed-GUI.html +229 -75
templates/proposed-GUI.html CHANGED
@@ -76,7 +76,7 @@
76
  <div id="caption"></div>
77
  </div>
78
 
79
-
80
  <form method="post" id="myForm" >
81
 
82
  <!-- <div class="projnamedp">
@@ -99,20 +99,25 @@
99
 
100
 
101
  <div id ="tomeasurediv">
102
- <label id="measureLabel">Document To Measure</label>
103
- <input type="search" onkeyup=filterFunction(this.id) id="tomeasureSearchInput">
104
- <br>
105
- <div id="measureCheckbox">
106
- <select style="margin-left: -1%;" hidden name="measureselectname" id="measureselectid" multiple size="5" required> </select>
107
- <select id='selectunitA' hidden>
108
- <option id="m2" value="m2" >m&#xb2; </option>
109
- <option id="mm2" value="mm2" >mm&#xb2; </option>
110
- </select>
111
- <select id='selectunitP' hidden>
112
- <option id="m" value="m" >m </option>
113
- <option id="mm"value="mm" >mm </option>
114
- </select>
115
- </div>
 
 
 
 
 
116
  </div>
117
 
118
  <div id ="relvDocdiv">
@@ -240,25 +245,26 @@
240
  <br><br>
241
  <li id="userguideheadings"> First Part </li>
242
  <label id="underlinedLables"> - Inputs: </label>
243
- <br>There are three dropdowns available that will allow you to select the name of the project you wish to measure, along with the project part, and the project section.
244
 
245
  <br > <br>
246
- <label style="font-style: italic;"> Please make sure the Project Section you select is correct because it will affect the code that will be applied to the plan. </label>
247
  <br>
248
  <br>
249
- Mark the project from the "To measure" section that you want to measure. Additionally, you have the ability to view any relevant documents you might need in Dropbox.(optional).
250
-
 
251
  <br> <label style="font-style: italic;"> * Pixel to Metric conversion important notes:</label>
252
- <br>Once you have selected a specific plan to measure, you will be provided with a pdf with a colored rectangle drawn in it. Please open this PDF in Foxit Reader, Adobe, or any software that will allow you to measure shapes on a plan, and measure the given shape’s area and perimeter in the desired metric unit, then input those values in the textboxes that will be shown below the relevant documents.
253
  For the ease of conversion of metric units, you will find a dropdown with ‘m’ or ‘mm’ next to each textbox.
254
- This will allow the code to understand the ratio between the pixels to the metric unit you chose.
255
 
256
  <br>
257
  You may think of this rectangle's measurement as a scale check for Bluebeam.
258
  <br> <br>
259
  <label style="font-style: italic;"> * Notes for section 1.0 measurement:</label> <!-- (Section 3.2 does not yet support this feature): -->
260
- <br><label id=info >You can measure several levels independently using checkbox labeled 'Leveled plan' under Scale document heading. </label>
261
- Leave the checkbox unchecked if you want to measure the entirety of the plan. <br>Please tick the box if you want to measure certain areas of the plan or have the plan divided into levels. Once the checkbox is ticked, a window will appear that will allow you to draw on the PDF. Click the save button at the bottom of the page when you are done.
262
  <br>
263
 
264
  <i id="secondpage" class="fa fa-arrow-right" aria-hidden="true"></i>
@@ -320,17 +326,39 @@
320
  <!-- Modal content -->
321
  <div class="modal-content">
322
  <div class="modal-header">
323
- <span class="close">×</span>
324
- <h2>Error</h2>
325
  </div>
326
  <div class="modal-body">
327
  <p id="modal-bodyText">
328
  </p>
 
329
  </div>
330
 
331
  </div>
332
  </div>
333
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  </body>
335
  </html>
336
 
@@ -339,6 +367,7 @@
339
  ///////////////////////////////////////////////BEGIN JS CODE//////////////////////////////////////////////////
340
  PopupElement=document.getElementById('modal-bodyText');
341
 
 
342
  // add project names to first dropdown from google sheet
343
  firstdropdown=document.getElementsByClassName('selectionsProj')[0];
344
  seconddropdown=document.getElementsByClassName('selectionsProjp')[0];
@@ -375,6 +404,7 @@ function displayprjnames(){
375
  $.get('/getprojectnames/')
376
  .success(function(data) {
377
  document.getElementById("all").style.display = "none";
 
378
  for (let i=0;i<data.length;i++)
379
  {
380
  var op0 = document.createElement("OPTION") ;
@@ -496,12 +526,48 @@ $toggle.addEventListener('click', function() {
496
  }
497
 
498
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
499
 
500
  var worker = new Worker('../static/API_Refresh_workerJS.js');
 
501
  worker.onmessage= function(event){
502
- var data=JSON.parse(event.data);
 
 
 
 
 
 
 
 
 
 
503
  if (data)
504
  {
 
 
 
 
 
 
 
 
 
505
  if (confirm(data[0]+"\n")){
506
  document.getElementById('all').style.display='block';
507
 
@@ -560,53 +626,63 @@ worker.onmessage= function(event){
560
  }
561
  }
562
 
563
- // var workerDropbox = new Worker('../static/DropboxWorker.js');
564
- // workerDropbox.onmessage= function(event){
565
- // var dataDropbox=JSON.parse(event.data);
566
- // console.log(dataDropbox)
567
- // if (dataDropbox)
568
- // { console.log('dataDropbox')
569
- // console.log(dataDropbox)
570
- // console.log(dataDropbox[1])
571
-
572
- // if (confirm(dataDropbox[0]+"\n")){
573
- // document.getElementById('all').style.display='block';
574
-
575
- // $.getJSON('/postdropboxprojects', {
576
- // dict: JSON.stringify(dataDropbox[1]),
577
-
578
- // }, function(data2){
579
- // console.log(data2)
580
- // if (data2.startsWith('post'))
581
- // {
582
- // getproj();
583
- // }
584
-
585
- // })
586
- // }
587
- // else{
588
- // workerDropbox.terminate()
589
- // }
590
 
591
- // }
592
- // }
 
 
593
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
594
  //___________________________________________________________________________________________________________
595
  //___________________________________________________________________________________________________________
596
- /*Retrieve MCTNAMES Dictionary from API - Flask*/
597
- MCTNames={}
598
- function getALLMCTNAMES(){
599
-
600
- $.get( '/RetrieveMCTNames/'+thirddropdown.value)
601
- .success (function(data){
602
- MCTNames=data;
603
- console.log(MCTNames)
604
- })
605
- .error(function(jqXHR, textStatus, errorThrown) {
606
- PopupElement.textContent='Error occured while retrieving the MC-T Names. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
607
- ShowPopUp();
608
- });
609
- }
610
  //___________________________________________________________________________________________________________
611
  //___________________________________________________________________________________________________________
612
 
@@ -855,7 +931,7 @@ var ratioPunit=1;
855
  //___________________________________________________________________________________________________________
856
  //Retrieves list of projects
857
  function getproj(){
858
- getALLMCTNAMES();
859
  document.getElementById("all").style.display = "block";
860
  var proj = document.getElementsByClassName("selectionsProj")[0];
861
  var projectVal=proj.value.toString() //selected project
@@ -886,10 +962,11 @@ var ratioPunit=1;
886
  var relvSelect = document.getElementById("relvselectid");
887
  var levelcheckbox= document.getElementById("levelcheckbox");
888
 
889
-
890
  measSelect.removeAttribute("hidden");
891
  relvSelect.removeAttribute("hidden");
892
  measSelect.innerHTML='';
 
893
  var optn2 = document.createElement("OPTION");
894
  optn2.text= 'Select project to measure';
895
  optn2.value=''
@@ -898,8 +975,9 @@ var ratioPunit=1;
898
 
899
  measSelect.add(optn2);
900
  document.getElementById("hidden").required = true;
 
901
  // console.log(measSelect)
902
-
903
  relvSelect.innerHTML='';
904
  for (i = 0; i < relvDocs.length; i++) {
905
  //relevant documents
@@ -914,6 +992,7 @@ var ratioPunit=1;
914
  optn1.setAttribute('disabled',true);
915
  }
916
  }
 
917
  for (i = 0; i < docsToMeasure.length; i++) {
918
  //to measure documents
919
  var optn2 = document.createElement("OPTION");
@@ -2517,11 +2596,10 @@ function sortlegends(clicked_id){
2517
  //___________________________________________________________________________________________________________
2518
  /* POP-UP code JS*/
2519
  // Select modal
 
2520
  var mpopup = document.getElementById('mpopupBox');
2521
- // Select trigger link
2522
- var mpLink = document.getElementById("mpopupLink");
2523
  // Select close action element
2524
- var close = document.getElementsByClassName("close")[0];
2525
  function ShowPopUp(){
2526
  // Open modal
2527
  mpopup.style.display = "block";
@@ -2538,6 +2616,25 @@ function ShowPopUp(){
2538
  };
2539
 
2540
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2541
  function filterFunction(id) {
2542
  var input, filter, ul, li, a, i;
2543
  input = document.getElementById(id);
@@ -2556,5 +2653,62 @@ function filterFunction(id) {
2556
  }
2557
  }
2558
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2559
  </script>
2560
 
 
76
  <div id="caption"></div>
77
  </div>
78
 
79
+
80
  <form method="post" id="myForm" >
81
 
82
  <!-- <div class="projnamedp">
 
99
 
100
 
101
  <div id ="tomeasurediv">
102
+ <div>
103
+ <label id="measureLabel">Document To Measure</label>
104
+ <input type="search" onkeyup=filterFunction(this.id) id="tomeasureSearchInput">
105
+ <!-- <button id="refreshDropboxButtonID"></button> -->
106
+ <i class="fa fa-dropbox fa-lg" id="refreshDropboxButtonID" >
107
+ <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.</span> </i>
108
+
109
+ </div>
110
+ <div id="measureCheckbox">
111
+ <select style="margin-left: -1%;" hidden name="measureselectname" id="measureselectid" multiple size="5"></select>
112
+ <select id='selectunitA' hidden>
113
+ <option id="m2" value="m2" >m&#xb2; </option>
114
+ <option id="mm2" value="mm2" >mm&#xb2; </option>
115
+ </select>
116
+ <select id='selectunitP' hidden>
117
+ <option id="m" value="m" >m </option>
118
+ <option id="mm"value="mm" >mm </option>
119
+ </select>
120
+ </div>
121
  </div>
122
 
123
  <div id ="relvDocdiv">
 
245
  <br><br>
246
  <li id="userguideheadings"> First Part </li>
247
  <label id="underlinedLables"> - Inputs: </label>
248
+ <br>There are three dropdowns available that will allow you to select the name of the project you wish to measure, the project part, and the project section.
249
 
250
  <br > <br>
251
+ <label style="font-style: italic;"> Please ensure that the 'Project Section' you select is correct, as it will affect the code applied to the plan. </label>
252
  <br>
253
  <br>
254
+ Select the project you want to measure from the 'To measure' section. Additionally, you have the option to view any relevant documents you might need in Dropbox. (optional).
255
+ <br> Important Note: 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, click on the dropbox icon located next to the 'Document to measure' section.
256
+ <br>
257
  <br> <label style="font-style: italic;"> * Pixel to Metric conversion important notes:</label>
258
+ <br>Once you have selected a specific plan to measure, you will be provided with a PDF containing a colored rectangle. Please open this PDF in Foxit Reader, Adobe, or any software that will allow you to measure shapes on a plan, and measure the given shape’s area and perimeter in the desired metric unit, then input those values in the textboxes that will be shown below the relevant documents.
259
  For the ease of conversion of metric units, you will find a dropdown with ‘m’ or ‘mm’ next to each textbox.
260
+ This will enable the code to understand the ratio between pixels and the metric unit you chose.
261
 
262
  <br>
263
  You may think of this rectangle's measurement as a scale check for Bluebeam.
264
  <br> <br>
265
  <label style="font-style: italic;"> * Notes for section 1.0 measurement:</label> <!-- (Section 3.2 does not yet support this feature): -->
266
+ <br><label id=info >You can measure multiple levels independently using checkbox labeled 'Leveled plan' under Scale document heading. </label>
267
+ Leave the checkbox unchecked if you want to measure the entire plan. <br>Please check the box if you want to measure specific areas of the plan or if the plan is divided into levels. Click the save button at the bottom of the page when you have finished.
268
  <br>
269
 
270
  <i id="secondpage" class="fa fa-arrow-right" aria-hidden="true"></i>
 
326
  <!-- Modal content -->
327
  <div class="modal-content">
328
  <div class="modal-header">
329
+ <button type="button" class="closeModal" data-dismiss="modal">&times;</button>
330
+ <h2 id="TopTextModal">Error</h2>
331
  </div>
332
  <div class="modal-body">
333
  <p id="modal-bodyText">
334
  </p>
335
+ <br>
336
  </div>
337
 
338
  </div>
339
  </div>
340
 
341
+
342
+ <div id="dialog-container" class="overlay">
343
+ <!-- Modal content -->
344
+ <div class="modal-content">
345
+ <div class="modal-header">
346
+ <button type="button" class="closeModal" >&times;</button>
347
+ <h2 id="TopTextModal">Warning!</h2>
348
+ </div>
349
+ <div class="modal-body">
350
+ <p id="modal-bodyText">Are you sure you want to retrieve information from dropbox. Please note that this process may exceed 30 minutes, depending on the amount of data found in the dropbox and the internet connection.
351
+ </p>
352
+ <br>
353
+ <div class="text-right">
354
+ <button class="dialog-btn btn-primary" id="confirm">Ok</button>
355
+ <button class="dialog-btn btn-cancel" id="cancel">Cancel</button>
356
+ </div>
357
+ <br>
358
+ </div>
359
+ </div>
360
+ </div>
361
+
362
  </body>
363
  </html>
364
 
 
367
  ///////////////////////////////////////////////BEGIN JS CODE//////////////////////////////////////////////////
368
  PopupElement=document.getElementById('modal-bodyText');
369
 
370
+
371
  // add project names to first dropdown from google sheet
372
  firstdropdown=document.getElementsByClassName('selectionsProj')[0];
373
  seconddropdown=document.getElementsByClassName('selectionsProjp')[0];
 
404
  $.get('/getprojectnames/')
405
  .success(function(data) {
406
  document.getElementById("all").style.display = "none";
407
+
408
  for (let i=0;i<data.length;i++)
409
  {
410
  var op0 = document.createElement("OPTION") ;
 
526
  }
527
 
528
  });
529
+ // if (thirddropdown.value){
530
+ MCTNames={}
531
+ var workerMCT = new Worker('../static/MC_T_API_Worker.js');
532
+ // workerMCT.postMessage(thirddropdown.value)
533
+ workerMCT.onmessage= function(event){
534
+ console.log('refreshed')
535
+ if (thirddropdown.value){
536
+ sectionNumber=thirddropdown.value;
537
+
538
+ MCTNames=event.data;
539
+ MCTNames=MCTNames[sectionNumber.toString().toLowerCase()]
540
+ }
541
+ console.log(MCTNames)
542
+ }
543
+ // }
544
+
545
 
546
  var worker = new Worker('../static/API_Refresh_workerJS.js');
547
+
548
  worker.onmessage= function(event){
549
+
550
+ // if (event.data=='sectionData')
551
+ // {
552
+ // if (thirddropdown.value){
553
+ // worker.postMessage(thirddropdown.value);
554
+ // }
555
+ // else{
556
+ // worker.postMessage('noSectionYet');
557
+ // }
558
+ var data=JSON.parse(event.data);
559
+ // }
560
  if (data)
561
  {
562
+ // console.log(event.data)
563
+ // // if (event.data!='noSectionYet'){
564
+ // // returnString=event.data[0]
565
+ // // MCTNames=event.data[1]
566
+ // }
567
+ // else{
568
+ // returnString=event.data
569
+ // console.log(returnString)
570
+ // }
571
  if (confirm(data[0]+"\n")){
572
  document.getElementById('all').style.display='block';
573
 
 
626
  }
627
  }
628
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
629
 
630
+ /*worker.onmessage= function(event){
631
+ }
632
+ */
633
+
634
 
635
+
636
+ var workerDropbox = new Worker('../static/DropboxWorker.js');
637
+ workerDropbox.onmessage= function(event)
638
+ {
639
+ var dataDropbox=JSON.parse(event.data);
640
+ console.log(dataDropbox)
641
+ // if (dataDropbox)
642
+ // {
643
+ // $.ajax({
644
+ // type: "POST",
645
+ // url: "/postdropboxprojects",
646
+
647
+ // // set content type header to use Flask response.get_json()
648
+ // contentType: "application/json",
649
+
650
+ // // convert data/object to JSON to send
651
+ // data: JSON.stringify({dict:dataDropbox[1]}),
652
+
653
+ // // expect JSON data in return (e.g. Flask jsonify)
654
+ // dataType: "json",
655
+
656
+ // // handle response
657
+ // success: function(response) {
658
+ // console.log(response);
659
+ // document.getElementById('all').style.display='none';
660
+ // console.log('posted successfully',data)
661
+ // getproj();
662
+ // },
663
+ // error: function(err) {
664
+ // PopupElement.textContent='Error occured. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
665
+ // ShowPopUp();
666
+ // }
667
+ // })
668
+ // }
669
+ }
670
  //___________________________________________________________________________________________________________
671
  //___________________________________________________________________________________________________________
672
+ // /*Retrieve MCTNAMES Dictionary from API - Flask*/
673
+
674
+ // function getALLMCTNAMES(){
675
+
676
+ // $.get( '/RetrieveMCTNames/'+thirddropdown.value)
677
+ // .success (function(data){
678
+ // MCTNames=data;
679
+ // console.log(MCTNames)
680
+ // })
681
+ // .error(function(jqXHR, textStatus, errorThrown) {
682
+ // PopupElement.textContent='Error occured while retrieving the MC-T Names. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
683
+ // ShowPopUp();
684
+ // });
685
+ // }
686
  //___________________________________________________________________________________________________________
687
  //___________________________________________________________________________________________________________
688
 
 
931
  //___________________________________________________________________________________________________________
932
  //Retrieves list of projects
933
  function getproj(){
934
+
935
  document.getElementById("all").style.display = "block";
936
  var proj = document.getElementsByClassName("selectionsProj")[0];
937
  var projectVal=proj.value.toString() //selected project
 
962
  var relvSelect = document.getElementById("relvselectid");
963
  var levelcheckbox= document.getElementById("levelcheckbox");
964
 
965
+
966
  measSelect.removeAttribute("hidden");
967
  relvSelect.removeAttribute("hidden");
968
  measSelect.innerHTML='';
969
+
970
  var optn2 = document.createElement("OPTION");
971
  optn2.text= 'Select project to measure';
972
  optn2.value=''
 
975
 
976
  measSelect.add(optn2);
977
  document.getElementById("hidden").required = true;
978
+ // measSelect.required=true;
979
  // console.log(measSelect)
980
+
981
  relvSelect.innerHTML='';
982
  for (i = 0; i < relvDocs.length; i++) {
983
  //relevant documents
 
992
  optn1.setAttribute('disabled',true);
993
  }
994
  }
995
+
996
  for (i = 0; i < docsToMeasure.length; i++) {
997
  //to measure documents
998
  var optn2 = document.createElement("OPTION");
 
2596
  //___________________________________________________________________________________________________________
2597
  /* POP-UP code JS*/
2598
  // Select modal
2599
+
2600
  var mpopup = document.getElementById('mpopupBox');
 
 
2601
  // Select close action element
2602
+ var close = document.getElementsByClassName("closeModal")[0];
2603
  function ShowPopUp(){
2604
  // Open modal
2605
  mpopup.style.display = "block";
 
2616
  };
2617
 
2618
 
2619
+ var dialog_container = document.getElementById('dialog-container');
2620
+ // Select close action element
2621
+ var closeDialog = document.getElementsByClassName("closeModal")[1];
2622
+ function ShowPopUpWarning(){
2623
+ // Open modal
2624
+ dialog_container.style.display = "block";
2625
+ }
2626
+ // Close modal once close element is clicked
2627
+ closeDialog.onclick = function() {
2628
+ dialog_container.style.display = "none";
2629
+ };
2630
+ // Close modal when user clicks outside of the modal box
2631
+ window.onclick = function(event) {
2632
+ if (event.target == dialog_container) {
2633
+ dialog_container.style.display = "none";
2634
+ }
2635
+ };
2636
+
2637
+
2638
  function filterFunction(id) {
2639
  var input, filter, ul, li, a, i;
2640
  input = document.getElementById(id);
 
2653
  }
2654
  }
2655
  }
2656
+
2657
+
2658
+ // Call function when show dialog btn is clicked
2659
+ var overlayme = document.getElementById("dialog-container");
2660
+ document.getElementById("refreshDropboxButtonID").disabled=false;
2661
+
2662
+ // if (document.getElementById("refreshDropboxButtonID").disabled==false){
2663
+
2664
+
2665
+ document.getElementById("refreshDropboxButtonID").onclick = function()
2666
+ {
2667
+ if (document.getElementById("refreshDropboxButtonID").disabled==false)
2668
+ overlayme.style.display = "block";
2669
+ };
2670
+ // }
2671
+
2672
+
2673
+ document.getElementById("confirm").onclick = function(){confirmDialog()};
2674
+ function confirmDialog() {
2675
+ /* code executed if confirm is clicked */
2676
+ overlayme.style.display = "none";
2677
+ callrefreshDropbox();
2678
+ }
2679
+
2680
+ // If cancel btn is clicked , the function cancel() is executed
2681
+ document.getElementById("cancel").onclick = function(){cancelDialog()};
2682
+ function cancelDialog() {
2683
+ /* code executed if cancel is clicked */
2684
+ overlayme.style.display = "none";
2685
+ }
2686
+
2687
+ function callrefreshDropbox(){
2688
+ console.log('l')
2689
+ document.getElementById("refreshDropboxButtonID").style.backgroundColor = "gray";
2690
+ document.getElementById("refreshDropboxButtonID").style.cursor='not-allowed';
2691
+ document.getElementById("refreshDropboxButtonID").disabled="disabled";
2692
+
2693
+
2694
+ $.get('/postdropboxprojects')
2695
+
2696
+ .success(function(stringReturned) {
2697
+ console.log('DONEEEE')
2698
+ TopTextModal=document.getElementById("TopTextModal");
2699
+ TopTextModal.textContent= "Success!";
2700
+ TopTextModal.style.color='green';
2701
+ PopupElement.textContent=stringReturned;
2702
+ ShowPopUp();
2703
+ document.getElementById("refreshDropboxButtonID").style.cursor='pointer';
2704
+ document.getElementById("refreshDropboxButtonID").style.backgroundColor = "#1680c7";
2705
+ document.getElementById("refreshDropboxButtonID").disabled = false;
2706
+ })
2707
+ .error(function(jqXHR, textStatus, errorThrown) {
2708
+ PopupElement.textContent='Error occured while retrieving projects from the dropbox. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
2709
+ ShowPopUp();
2710
+ });
2711
+
2712
+ }
2713
  </script>
2714