Marthee commited on
Commit
c788628
·
verified ·
1 Parent(s): 6406b67

Update templates/proposed-GUI.html

Browse files
Files changed (1) hide show
  1. templates/proposed-GUI.html +420 -118
templates/proposed-GUI.html CHANGED
@@ -118,9 +118,9 @@
118
  <label id="measureLabel">Document To Measure</label>
119
  <input type="search" onkeyup=filterFunction(this.id) id="tomeasureSearchInput">
120
  <!-- <button id="refreshDropboxButtonID"></button> -->
121
- <i class="fa fa-dropbox fa-lg" id="refreshDropboxButtonID" >
122
- <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>
123
-
124
  </div>
125
  <div id="measureCheckbox">
126
  <select style="margin-left: -1%;" hidden name="measureselectname" id="measureselectid" multiple size="5"></select>
@@ -145,6 +145,7 @@
145
  <br>
146
  <div id ="relvdiv">
147
  <select style="margin-left: -1%;" hidden name="relvselectname" id="relvselectid" multiple size="5"> </select>
 
148
  </div>
149
  </div>
150
 
@@ -152,13 +153,27 @@
152
 
153
  <div id="radiosColors" hidden="until-found">
154
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  <input type="checkbox" id="levelcheckbox" >
156
  <label id=nLevels name="levelsnamelabel" >Leveled Plan </label>
157
- <i class="fa fa-info-circle" id="infotool" > <span class="tooltiptext">Choose whether this project contains levels or not. Leave the checkbox unchecked if you want to measure the entirety of the plan. <br> Please check the box on this line 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 apear that will allow you to draw on the PDF. Click the save button at the bottom of the page when you are done. </span> </i>
158
-
159
  </div>
160
- <br>
161
-
162
  <div id ="saveOPdiv">
163
  <button id="measureADRbutton">Measure using ADR</button>
164
  <script src="https://cdn.lordicon.com/bhenfmcm.js"></script>
@@ -363,14 +378,14 @@
363
  <p style="font-weight: bold;">Double Door:</p>
364
  <div style="margin-left: 20px;">
365
  <p>• Can correctly detect some double doors.</p>
366
- <p>• Identify the opening of the door properly and draw a line between the two end points.</p>
367
- <p>• Calculate the width of the opening</p>
368
  </div>
369
  </div>
370
 
371
  <p style="font-weight: bold;">What to Expect in the Next Version?</p>
372
  <div style="margin-left: 20px;">
373
- <p>• Detect more single and double doors. </p>
374
  <p>• Get the labels beside doors to generate their name.</p>
375
  <p>• Detect more symbols, e.g., "Leaf door".</p>
376
  </div>
@@ -486,16 +501,90 @@
486
  </div>
487
 
488
 
 
 
489
  <div id="dialog-container" class="overlay">
490
  <!-- Modal content -->
491
  <div class="modal-content">
492
  <div class="modal-header">
493
  <button type="button" class="closeModal" >&times;</button>
494
- <h2 id="TopTextModal">Warning!</h2>
495
  </div>
496
- <div class="modal-body">
497
- <p id="modal-bodyTextp">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.
498
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
499
  <br>
500
  <div class="text-right">
501
  <button class="dialog-btn btn-primary" id="confirm">Ok</button>
@@ -513,15 +602,23 @@
513
 
514
  ///////////////////////////////////////////////BEGIN JS CODE//////////////////////////////////////////////////
515
  // Function to send the Dropbox link and keyword to the server
 
 
 
 
 
 
 
 
 
516
  function processPdf() {
517
- const pdfLink = 'https://www.dropbox.com/scl/fi/fjykwhhn9gu9t3kqrflxd/LA002-NOR-ZZ-ZZ-T-A-2403_Architectural-Specification-F10-Brick-and-Block-Walling_A4-_C01.pdf?rlkey=ek9i66i79m0hwp8z5yjs6rp5p&e=1&st=mh7rurkc&dl=1'; // Dropbox link
518
- const keyword = 'Page 1 of 5' ; // Example keyword
519
-
520
  // Create a new FormData object to send the data as form data
521
  const formData = new FormData();
522
  formData.append('pdf_link', pdfLink);
523
- formData.append('keyword', keyword);
524
-
525
  // Send the data to the Flask server
526
  fetch('/api/process-data', {
527
  method: 'POST',
@@ -529,11 +626,9 @@ function processPdf() {
529
  })
530
  .then(response => response.json())
531
  .then(data => {
532
- // Handle the server's response
533
  if (data.download_link) {
534
- // Redirect the user to the page where the annotation is located
535
- // The download_link includes both the page number and the rect (coordinates)
536
- window.location.href = data.download_link; // This will use the rect info from Flask
537
  } else {
538
  alert('Error: ' + data.error);
539
  }
@@ -542,11 +637,8 @@ function processPdf() {
542
  console.error('Error:', error);
543
  });
544
  }
545
-
546
  // Call the function to process the PDF
547
- // processPdf();
548
-
549
-
550
  ////////////////////////////////////////////////////////////////////
551
 
552
  PopupElement=document.getElementById('modal-bodyText');
@@ -596,6 +688,8 @@ displayprjnames()
596
  function displayprjnames(){
597
  $.get('/getprojectnames/')
598
  .success(function(data) {
 
 
599
  document.getElementById("all").style.display = "none";
600
  prjids=data[1];
601
  var op0 = document.createElement("OPTION") ;
@@ -696,7 +790,7 @@ function displayprojsections(projectid,Partid){
696
  opt.text=data[i];
697
  thirddropdown.append(opt);
698
 
699
- if(!(data[i].startsWith('1.0') ) && !(data[i].startsWith('3.2')) && !(data[i].startsWith('2.8')) && !(data[i].startsWith('3.3')) && !(data[i].startsWith('2.1')) ) // ||data[i].startsWith('2.2')))
700
  {
701
  opt.style.color='#bdbcbc';
702
  opt.style.cursor='not-allowed';
@@ -822,7 +916,7 @@ worker.onmessage= function(event){
822
  opt=document.createElement("option");
823
  opt.textContent=data[2][d];
824
  opt.text=data[2][d];
825
- if(!(data[2][d].startsWith('1.0') ) && !(data[2][d].startsWith('3.2') ) && !(data[2][d].startsWith('2.8')) && !(data[2][d].startsWith('3.3')) && !(data[2][d].startsWith('2.1')) ) //||data[i].startsWith('2.2')))
826
  {
827
  opt.style.color='#bdbcbc';
828
  opt.style.cursor='not-allowed';
@@ -1012,11 +1106,18 @@ function downloadPdf(pdfname) {
1012
  //___________________________________________________________________________________________________________
1013
  //___________________________________________________________________________________________________________
1014
  /*Add icon to duplicate 'duplicater' div (big section that includes 3 dropdowns,3 textboxes, 2 buttons(add,delete)*/
 
 
 
 
 
 
1015
  var dupliatei = 0; // i
1016
  var clonedDivId=0;
1017
  var original = document.getElementById('duplicaterhidden');
1018
  var addciconval=0; //div duplicate
1019
  var jj=0;
 
1020
  const vals = [];
1021
  var canvasimg;
1022
  var ry = [[]];
@@ -1133,7 +1234,8 @@ console.log('ayhaga', clone.children[5])
1133
  optn2.value= "Internal Doors";
1134
  inputs1.add(optn2);
1135
  }
1136
- if (section.value.startsWith('3.3'))
 
1137
  {
1138
  var opt = document.createElement("OPTION");
1139
  opt.text= 'Select';
@@ -1142,8 +1244,8 @@ console.log('ayhaga', clone.children[5])
1142
  inputs1.add(opt);
1143
 
1144
  var optn = document.createElement("OPTION");
1145
- optn.text= 'Ceiling';
1146
- optn.value= "Ceiling";
1147
  inputs1.add(optn);
1148
 
1149
  }
@@ -1250,7 +1352,7 @@ function getSelectValues(select) {
1250
  //___________________________________________________________________________________________________________
1251
 
1252
  //Retrieves list of projects
1253
-
1254
  function getproj(){
1255
  getALLMCTNAMES();
1256
 
@@ -1265,17 +1367,16 @@ function getSelectValues(select) {
1265
 
1266
  $.get( '/getmethod/'+JSON.stringify(projectVal))
1267
  .success (function(data){
1268
-
1269
  document.getElementById("all").style.display = "none";
1270
- if (sections.value.startsWith('3.2') || sections.value.startsWith('3.3') ){
1271
  document.getElementById('dxfdiv').removeAttribute('hidden');
1272
  document.getElementById('pdftodxfFile').setAttribute('required',true)
1273
  }
1274
  else{
1275
  document.getElementById('dxfdiv').setAttribute('hidden',true)
1276
  }
1277
-
1278
- console.log(data[0],data[1])
1279
  var docsToMeasure=data[0]; //
1280
  var relvDocs=data[1]
1281
  var projname = document.getElementsByClassName("selectionsProj")[0];
@@ -1320,44 +1421,64 @@ function getSelectValues(select) {
1320
  optn1.setAttribute('disabled',true);
1321
  }
1322
  }
 
1323
 
1324
  for (i = 0; i < docsToMeasure.length; i++) {
1325
  //to measure documents
1326
  var optn2 = document.createElement("OPTION");
1327
-
1328
  optn2.text= docsToMeasure[i][0];
1329
  optn2.value= docsToMeasure[i][0] ;
1330
  optn2.id=docsToMeasure[i][1] ;
1331
  measSelect.add(optn2);
1332
  measoptns.push(optn2);
 
 
 
 
 
 
 
 
 
 
1333
  if (data=='No projects found'){
1334
  optn2.style.color='#bdbcbc';
1335
  optn2.style.cursor='not-allowed';
1336
  optn2.setAttribute('disabled',true);
1337
  }
1338
  }
1339
-
1340
  relvids.push(relvSelect) ;
1341
  measids.push(measSelect);
1342
  //to open pdf in a new tab (relevant documents)
1343
 
1344
 
1345
- relvids.forEach(function(elem){
1346
- elem.addEventListener("change", function() {
1347
- // console.log(elem.value)
1348
- document.getElementById("all").style.display = "block";
1349
- // var pdfpatharr=[]
1350
- // pdfpatharr.push(projname.value, projpart.value,projsec.value, elem.value)
1351
- $.get( '/getdropboxurl/'+JSON.stringify(elem.value))
1352
- .success (function(data){
1353
- document.getElementById("all").style.display = "none";
1354
- window.open( data)
1355
- })
1356
- .error(function(jqXHR, textStatus, errorThrown) {
1357
- PopupElement.textContent='Error occured while retrieving the dropbox URL. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
1358
- ShowPopUp();
1359
- });
1360
- });
 
 
 
 
 
 
 
 
 
1361
  });
1362
 
1363
  measids.forEach(function(elem) {
@@ -1366,7 +1487,7 @@ function getSelectValues(select) {
1366
  // if (!(projsec.value.startsWith('2.8')))
1367
  // {
1368
  // Show alert immediately to prompt the user
1369
- if (projsec.value.startsWith('3.2') || projsec.value.startsWith('3.3') ) {
1370
  downloadPdf(elem.value);
1371
  window.alert("Measure the purple shape drawn on the PDF using Foxit Reader, Bluebeam, or any other external tool, then enter its area and perimeter in your desired scale.");
1372
  }
@@ -1398,7 +1519,7 @@ function getSelectValues(select) {
1398
  document.getElementById('measureADRbutton').onclick= function()
1399
  {
1400
  if (!areaRatio.value){
1401
- if (!(projsec.value.startsWith('3.2')) & !(projsec.value.startsWith('2.8')) & !(projsec.value.startsWith('3.3')) )
1402
  areaRatio.style.boxShadow='0 0 8px 2px rgb(255, 0, 0)';
1403
  }
1404
  if (!prmRatio.value)
@@ -1425,7 +1546,7 @@ function getSelectValues(select) {
1425
  areaRatio.style.textAlign='right';
1426
  areaRatio.step=".0000001";
1427
 
1428
- if( projsec.value.startsWith('3.2') || projsec.value.startsWith('2.8') || projsec.value.startsWith('3.3') || projsec.value.startsWith('2.1') ){
1429
  areaRatio.setAttribute('disabled',true)
1430
  document.getElementById('selectunitA').setAttribute('disabled',true)
1431
  }
@@ -1510,7 +1631,13 @@ function getSelectValues(select) {
1510
 
1511
  });
1512
 
1513
-
 
 
 
 
 
 
1514
  document.getElementById('measureADRbutton').onclick= function()
1515
  {
1516
  if (!measSelect.value)
@@ -1523,7 +1650,7 @@ function getSelectValues(select) {
1523
  ShowPopUp();
1524
  });
1525
  if (document.getElementById('arealvlinput')){
1526
- if( projsec.value.startsWith('3.2') || projsec.value.startsWith('2.8') || projsec.value.startsWith('3.3') || projsec.value.startsWith('2.1') ){
1527
  document.getElementById('arealvlinput').setAttribute('disabled',true)
1528
  document.getElementById('selectunitA').setAttribute('disabled',true)
1529
  }
@@ -1759,7 +1886,7 @@ function getData(form) {
1759
  tomeasureproj=formvalues['measureselectname']; //proj name
1760
 
1761
 
1762
- if( formvalues['selectprojs'].startsWith('3.2') || formvalues['selectprojs'].startsWith('3.3') ){
1763
  ratio1=1
1764
  ratio2=prminpixels/(formvalues['prmRatio']/ratioPunit);
1765
  console.log(ratio2, prminpixels,formvalues['prmRatio'],ratioPunit)
@@ -1792,7 +1919,17 @@ function getData(form) {
1792
  answers.push(tomeasureproj, 0,[], ratio1, ratio2 ,pdfpath);
1793
  formData.append('file',dxffile)
1794
  formData.append('answers',JSON.stringify(answers))
 
 
 
 
 
 
 
 
 
1795
  }
 
1796
  else if (formvalues['selectprojs'].startsWith('1.0'))
1797
  {
1798
  console.log('whyyyy hereeee')
@@ -1808,7 +1945,7 @@ function getData(form) {
1808
 
1809
  }
1810
 
1811
- if (formvalues['selectprojs'].startsWith('1.0') || formvalues['selectprojs'].startsWith('3.2') || formvalues['selectprojs'].startsWith('2.8') || formvalues['selectprojs'].startsWith('3.3') ||formvalues['selectprojs'].startsWith('2.1') ) //
1812
  {
1813
  // console.log(formData)
1814
  $.ajax({
@@ -1879,7 +2016,7 @@ function getData(form) {
1879
  document.getElementById('measureADRbutton').style.boxShadow='none';
1880
  });
1881
 
1882
- if (formvalues['selectprojs'].startsWith('3.2') || formvalues['selectprojs'].startsWith('3.3') )
1883
  { //
1884
  // /* data[0]--> img , SimilarAreaDictionary.to_dict(), spreadsheet_url,spreadsheetId,[],list1.to_dict(),pdflink,hatched_areas,namepathArr]# , spreadsheetId, spreadsheet_url , list1.to_dict()]
1885
 
@@ -1921,10 +2058,11 @@ function getData(form) {
1921
  if (formvalues['selectprojs'].startsWith('2.1'))
1922
  {
1923
  //ignore data[0] --> img passed directly
1924
- dropboxLink=data[1];
1925
- spreadsheetURL=data[2];
1926
- list1= data[3] // list of pdf markups
1927
- SimilarAreaDictionary=data[4];
 
1928
 
1929
  }
1930
  if (formvalues['selectprojs'].startsWith('1.0'))
@@ -1964,7 +2102,7 @@ function getData(form) {
1964
  var flag=0;
1965
  pdfpath=[];
1966
  pdfpath.push(formvalues['selectproj'],formvalues['selectprojp'] ,formvalues['selectprojs'])
1967
- if (formvalues['selectprojs'].startsWith('1.0') || formvalues['selectprojs'].startsWith('3.2') || formvalues['selectprojs'].startsWith('2.8') || formvalues['selectprojs'].startsWith('3.3')) {
1968
  const interval = 6000; // Interval in milliseconds
1969
  let delrows1 = ''; // Initial data storage
1970
  let delrows2 = ''; // Updated data storage
@@ -2230,7 +2368,23 @@ function get3rddropdown(){
2230
  }
2231
  console.log(section.value.toString())
2232
 
2233
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2234
 
2235
  // if (inputs1.value.startsWith('Floor') & (selections1.value.startsWith('Wall') || !selections1.value )){
2236
  // selections1.innerHTML='';
@@ -2445,6 +2599,7 @@ console.log(selections.value)
2445
  //___________________________________________________________________________________________________________
2446
  //___________________________________________________________________________________________________________
2447
  var repeatforloopI=0;
 
2448
  function getmctName(){
2449
 
2450
  var listofnames=[];
@@ -2729,6 +2884,81 @@ function deletemctnameicon(){
2729
  }
2730
  }
2731
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2732
  //___________________________________________________________________________________________________________
2733
  //___________________________________________________________________________________________________________
2734
  function colors(){
@@ -3011,6 +3241,18 @@ function chooseFirstdrpdwn()
3011
  optn.value= "Ceiling";
3012
  inputs.add(optn);
3013
  }
 
 
 
 
 
 
 
 
 
 
 
 
3014
  if (section.value.startsWith('2.8'))
3015
  {
3016
  var opt = document.createElement("OPTION");
@@ -3149,6 +3391,8 @@ function filterFunction(id) {
3149
 
3150
 
3151
  // Call function when show dialog btn is clicked
 
 
3152
  var overlayme = document.getElementById("dialog-container");
3153
  document.getElementById("refreshDropboxButtonID").disabled=false;
3154
 
@@ -3157,41 +3401,108 @@ document.getElementById("refreshDropboxButtonID").disabled=false;
3157
 
3158
  document.getElementById("refreshDropboxButtonID").onclick = function()
3159
  {
 
3160
  if (document.getElementById("refreshDropboxButtonID").disabled==false)
3161
  overlayme.style.display = "block";
 
 
3162
  };
3163
- // }
3164
 
3165
 
3166
- // document.getElementById("confirm").onclick = function(){confirmDialog()};
3167
- // function confirmDialog() {
3168
- // /* code executed if confirm is clicked */
3169
- // console.log('bvhj')
3170
- // overlayme.style.display = "none";
3171
- // callrefreshDropbox();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3172
  // }
3173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3174
  // If cancel btn is clicked , the function cancel() is executed
3175
  document.getElementById("cancel").onclick = function(){cancelDialog()};
3176
  function cancelDialog() {
3177
  overlayme.style.display = "none";
3178
  }
3179
 
 
3180
  function callrefreshDropbox(){
3181
- console.log('ldropboxx')
3182
  document.getElementById("refreshDropboxButtonID").style.backgroundColor = "gray";
3183
  document.getElementById("refreshDropboxButtonID").style.cursor='not-allowed';
3184
  document.getElementById("refreshDropboxButtonID").disabled="disabled";
3185
 
3186
-
3187
- $.get('/postdropboxprojects')
3188
 
3189
  .success(function(stringReturned) {
 
 
3190
  console.log('DONEEEE')
3191
- TopTextModal=document.getElementById("TopTextModal");
3192
  TopTextModal.textContent= "Success!";
3193
  TopTextModal.style.color='green';
3194
  PopupElement.textContent=stringReturned;
 
 
 
 
3195
  ShowPopUp();
3196
  document.getElementById("refreshDropboxButtonID").style.cursor='pointer';
3197
  document.getElementById("refreshDropboxButtonID").style.backgroundColor = "#1680c7";
@@ -3205,40 +3516,6 @@ function callrefreshDropbox(){
3205
  }
3206
 
3207
 
3208
- // Call function when show dialog btn is clicked
3209
- var overlaymeText = document.getElementById("modal-bodyTextp");
3210
- document.getElementById("refreshAPIbutton").disabled=false;
3211
- document.getElementById("refreshAPIbutton").onclick = function()
3212
- {
3213
- if (document.getElementById("refreshAPIbutton").disabled==false)
3214
- {
3215
- console.log(overlaymeText.textContent)
3216
- overlaymeText.textContent='This is not a mandatory button. The system already runs at half-hour intervals to update the dropdowns and MC-Templates from the MC. Using this would manually refresh the data retrieved, disregarding the 30-minute interval.';
3217
- overlayme.style.display = "block";
3218
- }
3219
- };
3220
- // }
3221
-
3222
-
3223
- document.getElementById("confirm").onclick = function(){confirmDialogR()};
3224
- function confirmDialogR() {
3225
- /* code executed if confirm is clicked */
3226
- overlayme.style.display = "none";
3227
- console.log(document.getElementById("confirm").parentElement.parentElement.children[0].textContent)
3228
- if (document.getElementById("confirm").parentElement.parentElement.children[0].textContent.startsWith('Are'))
3229
- {
3230
- console.log('hereeeeeeeee')
3231
- callrefreshDropbox();
3232
- }
3233
- else
3234
- callrefreshAPI();
3235
- }
3236
-
3237
- // // If cancel btn is clicked , the function cancel() is executed
3238
- // document.getElementById("cancel").onclick = function(){cancelDialog()};
3239
- // function cancelDialog() {
3240
- // overlayme.style.display = "none";
3241
- // }
3242
  function refreshAPIbuutton(dataa){
3243
  $.get('/refreshAPIAppendNewTables')
3244
  .success(function(successData){
@@ -3284,7 +3561,7 @@ function refreshAPIbuutton(dataa){
3284
  opt=document.createElement("option");
3285
  opt.textContent=dataa[2][d];
3286
  opt.text=dataa[2][d];
3287
- if(!(dataa[2][d].startsWith('1.0') ) || (data[i].startsWith('3.2') ) || (data[i].startsWith('2.8')) || (data[i].startsWith('3.3')) || (data[i].startsWith('2.1')) )//||data[i].startsWith('2.2')))
3288
  {
3289
  opt.style.color='#bdbcbc';
3290
  opt.style.cursor='not-allowed';
@@ -3295,9 +3572,7 @@ function refreshAPIbuutton(dataa){
3295
  }
3296
  }
3297
  }
3298
-
3299
- console.log('DONEEEE')
3300
- TopTextModal=document.getElementById("TopTextModal");
3301
  TopTextModal.textContent= "Success!";
3302
  TopTextModal.style.color='green';
3303
  PopupElement.textContent='Console is up to date!';
@@ -3362,5 +3637,32 @@ function callrefreshAPI(){
3362
  }
3363
 
3364
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3365
  </script>
3366
 
 
118
  <label id="measureLabel">Document To Measure</label>
119
  <input type="search" onkeyup=filterFunction(this.id) id="tomeasureSearchInput">
120
  <!-- <button id="refreshDropboxButtonID"></button> -->
121
+ <i hidden class="fa fa-dropbox fa-lg" id="refreshDropboxButtonID">
122
+ <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>
123
+
124
  </div>
125
  <div id="measureCheckbox">
126
  <select style="margin-left: -1%;" hidden name="measureselectname" id="measureselectid" multiple size="5"></select>
 
145
  <br>
146
  <div id ="relvdiv">
147
  <select style="margin-left: -1%;" hidden name="relvselectname" id="relvselectid" multiple size="5"> </select>
148
+ <iframe id="pdfFrame" hidden></iframe>
149
  </div>
150
  </div>
151
 
 
153
 
154
  <div id="radiosColors" hidden="until-found">
155
 
156
+ <div id="checkboxLine">
157
+ <input type="checkbox" id="levelcheckbox">
158
+ <label id="nLevels" name="levelsnamelabel">Leveled Plan</label>
159
+ <i class="fa fa-info-circle" id="infotool">
160
+ <span class="tooltiptext">
161
+ Choose whether this project contains levels or not. Leave the checkbox unchecked if you want to measure the entirety of the plan.
162
+ <br> Please check the box on this line 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.
163
+ </span>
164
+ </i>
165
+ </div>
166
+
167
+ <div class="button-container">
168
+ <input type="button" id="popupforextratext" title="Add Key Information" value="Add Key Information">
169
+ </div>
170
+ <!-- <br>
171
  <input type="checkbox" id="levelcheckbox" >
172
  <label id=nLevels name="levelsnamelabel" >Leveled Plan </label>
173
+ <i class="fa fa-info-circle" id="infotool" > <span class="tooltiptext">Choose whether this project contains levels or not. Leave the checkbox unchecked if you want to measure the entirety of the plan. <br> Please check the box on this line 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 apear that will allow you to draw on the PDF. Click the save button at the bottom of the page when you are done. </span> </i> -->
174
+
175
  </div>
176
+
 
177
  <div id ="saveOPdiv">
178
  <button id="measureADRbutton">Measure using ADR</button>
179
  <script src="https://cdn.lordicon.com/bhenfmcm.js"></script>
 
378
  <p style="font-weight: bold;">Double Door:</p>
379
  <div style="margin-left: 20px;">
380
  <p>• Can correctly detect some double doors.</p>
381
+ <p>• Calculate the width of the opening.</p>
382
+ <p>• Draw a rectangle around the detected door.</p>
383
  </div>
384
  </div>
385
 
386
  <p style="font-weight: bold;">What to Expect in the Next Version?</p>
387
  <div style="margin-left: 20px;">
388
+ <p>• Identify the opening of the double door properly and draw a line between the two end points.</p>
389
  <p>• Get the labels beside doors to generate their name.</p>
390
  <p>• Detect more symbols, e.g., "Leaf door".</p>
391
  </div>
 
501
  </div>
502
 
503
 
504
+
505
+
506
  <div id="dialog-container" class="overlay">
507
  <!-- Modal content -->
508
  <div class="modal-content">
509
  <div class="modal-header">
510
  <button type="button" class="closeModal" >&times;</button>
511
+ <h2 id="TopTextModalWarning">Warning!</h2>
512
  </div>
513
+
514
+ <div class="modal-body">
515
+ <p id="modal-bodyTextp">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.
516
+ </p>
517
+ <div id="duplicaterExtra" hidden="until-found">
518
+ <div id="repeatforloopExtra" class="repeatforloopclassExtra0" name="repeatforloopExtraname " >
519
+ <label id="modalColIndex">Index</label>
520
+ <i class="fa fa-info-circle smallFaIcon" id="infotoolModal">
521
+ <span class="tooltiptext" id="modaltooltips">
522
+ Index of column. (Optional)
523
+ </span>
524
+ </i>
525
+ <label id="modalColumn">Type</label> <label id="modalGray">(from drawing)</label>
526
+ <i class="fa fa-info-circle smallFaIcon" id="infotoolModal">
527
+ <span class="tooltiptext" id="modaltooltips">
528
+ Enter the title for the column as it will be shown in Bluebeam columns. This helps organize and categorize extracted information.
529
+ </span>
530
+ </i>
531
+ <label id="modalKeyword">Specification</label> <label id="modalGray">(from drawing)</label>
532
+ <i class="fa fa-info-circle smallFaIcon" id="infotoolModal">
533
+ <span class="tooltiptext" id="modaltooltips">
534
+ Provide a word or phrase from the data you want to help detect relevant information in the drawing.
535
+ </span>
536
+ </i>
537
+ <label id="modalCharacter">Count</label>
538
+ <i class="fa fa-info-circle smallFaIcon" id="infotoolModal">
539
+ <span class="tooltiptext" id="modaltooltips">
540
+ Set the number of characters that is expected to be captured. This helps refine the extraction by limiting or expanding the detected text.
541
+ </span>
542
+ </i>
543
+ <br>
544
+ <input type="number" id="textextra" name="text0name" placeholder="Eg: 1" >
545
+ <input type="text" id="text0extra" name="text1name" placeholder="Eg: Wall Type" >
546
+ <input type="text" id="text1extra" name="text2name" placeholder="Eg:NBS K10/" >
547
+ <input type="number" id="text2extra" name="text3name" placeholder="Eg: 3" >
548
+
549
+ <script src="https://cdn.lordicon.com/bhenfmcm.js" ></script>
550
+ <lord-icon
551
+ onclick="addmctnameiconPopup()"
552
+ src="https://cdn.lordicon.com/mecwbjnp.json"
553
+ trigger="hover"
554
+ class="addmctnameclassExtra"
555
+ id="addmctnameidExtra"
556
+ colors="primary:black,secondary:black">
557
+ </lord-icon>
558
+ </div>
559
+ </div>
560
+ <div hidden="until-found" id="duplicaterExtraHidden" >
561
+ <div id="repeatforloopExtrahidden" class="repeatforloopclassExtrahidden" name="repeatforloopnameExtrahidden " > <!-- onchange="getmctName()" -->
562
+ <input type="number" id="textextra" name="text0name" placeholder="Eg: 1" >
563
+ <input type="text" id="text0extra" name="text1name" placeholder="Eg:Specification" >
564
+ <input type="text" id="text1extra" name="text2name" placeholder="Eg:NBS K10/" >
565
+ <input type="number" id="text2extra" name="text3name" placeholder="Eg: 3" >
566
+ <script src="https://cdn.lordicon.com/bhenfmcm.js" ></script>
567
+ <lord-icon
568
+ onclick="addmctnameiconPopup()"
569
+ src="https://cdn.lordicon.com/mecwbjnp.json"
570
+ trigger="hover"
571
+ class="addmctnameclassExtra"
572
+ id="addmctnameidExtra"
573
+ colors="primary:black,secondary:black">
574
+ </lord-icon>
575
+ <script src="https://cdn.lordicon.com/bhenfmcm.js"></script>
576
+ <lord-icon
577
+ onclick="deletemctnameiconPopup()"
578
+ src="https://cdn.lordicon.com/rivoakkk.json"
579
+ trigger="hover"
580
+ class="deletemctnameclassExtra"
581
+ id="deletemctnameidExtra"
582
+ colors="primary:black,secondary:black">
583
+ </lord-icon>
584
+ </div>
585
+
586
+ </div>
587
+
588
  <br>
589
  <div class="text-right">
590
  <button class="dialog-btn btn-primary" id="confirm">Ok</button>
 
602
 
603
  ///////////////////////////////////////////////BEGIN JS CODE//////////////////////////////////////////////////
604
  // Function to send the Dropbox link and keyword to the server
605
+ function getURLParams() {
606
+ const urlParams = new URLSearchParams(window.location.search);
607
+ return {
608
+ pdfLink: urlParams.get('pdfLink'),
609
+ keyword: JSON.parse(decodeURIComponent(urlParams.get('keyword') || "[]")), // Decode and parse
610
+ pageNumber: parseInt(urlParams.get('page')) || 1,
611
+ zoomRect: urlParams.get('zoom') // Expecting format: "x,y,width,height"
612
+ };
613
+ }
614
  function processPdf() {
615
+ // const pdfLink = 'https://www.dropbox.com/scl/fi/hnp4mqigb51a5kp89kgfa/00801-ARC-20-ZZ-S-A-0002.pdf?rlkey=45abeoebzqw4qwnslnei6dkd6&st=m4yrcjm2&dl=1'; // Dropbox link
616
+ // const keyword = ['115 INTEGRATED MRI ROOM LININGS','710 TRANSPORTATION'] ; // Example keyword
617
+ const { pdfLink, keyword, pageNumber, zoomRect } = getURLParams();
618
  // Create a new FormData object to send the data as form data
619
  const formData = new FormData();
620
  formData.append('pdf_link', pdfLink);
621
+ formData.append('keyword', JSON.stringify(keyword));
 
622
  // Send the data to the Flask server
623
  fetch('/api/process-data', {
624
  method: 'POST',
 
626
  })
627
  .then(response => response.json())
628
  .then(data => {
 
629
  if (data.download_link) {
630
+ //window.location.href = data.download_link; // This will use the rect info from Flask
631
+ console.log('Done!')
 
632
  } else {
633
  alert('Error: ' + data.error);
634
  }
 
637
  console.error('Error:', error);
638
  });
639
  }
 
640
  // Call the function to process the PDF
641
+ // processPdf();
 
 
642
  ////////////////////////////////////////////////////////////////////
643
 
644
  PopupElement=document.getElementById('modal-bodyText');
 
688
  function displayprjnames(){
689
  $.get('/getprojectnames/')
690
  .success(function(data) {
691
+
692
+
693
  document.getElementById("all").style.display = "none";
694
  prjids=data[1];
695
  var op0 = document.createElement("OPTION") ;
 
790
  opt.text=data[i];
791
  thirddropdown.append(opt);
792
 
793
+ if(!(data[i].startsWith('1.0') ) && !(data[i].startsWith('3.2')) && !(data[i].startsWith('2.8')) && !(data[i].startsWith('3.3')) && !(data[i].startsWith('2.1')) && !(data[i].startsWith('2.7')) ) // ||data[i].startsWith('2.2')))
794
  {
795
  opt.style.color='#bdbcbc';
796
  opt.style.cursor='not-allowed';
 
916
  opt=document.createElement("option");
917
  opt.textContent=data[2][d];
918
  opt.text=data[2][d];
919
+ if(!(data[2][d].startsWith('1.0') ) && !(data[2][d].startsWith('3.2') ) && !(data[2][d].startsWith('2.8')) && !(data[2][d].startsWith('3.3')) && !(data[2][d].startsWith('2.1')) && !(data[i].startsWith('2.7'))) //||data[i].startsWith('2.2')))
920
  {
921
  opt.style.color='#bdbcbc';
922
  opt.style.cursor='not-allowed';
 
1106
  //___________________________________________________________________________________________________________
1107
  //___________________________________________________________________________________________________________
1108
  /*Add icon to duplicate 'duplicater' div (big section that includes 3 dropdowns,3 textboxes, 2 buttons(add,delete)*/
1109
+ var dupliateiExtra = 0; // i
1110
+ var clonedDivIdExtra=0;
1111
+ var originalExtra = document.getElementById('duplicaterhidden');
1112
+ var addciconvalExtra=0; //div duplicate
1113
+ var jjExtra=0;
1114
+
1115
  var dupliatei = 0; // i
1116
  var clonedDivId=0;
1117
  var original = document.getElementById('duplicaterhidden');
1118
  var addciconval=0; //div duplicate
1119
  var jj=0;
1120
+
1121
  const vals = [];
1122
  var canvasimg;
1123
  var ry = [[]];
 
1234
  optn2.value= "Internal Doors";
1235
  inputs1.add(optn2);
1236
  }
1237
+
1238
+ if (section.value.startsWith('2.7'))
1239
  {
1240
  var opt = document.createElement("OPTION");
1241
  opt.text= 'Select';
 
1244
  inputs1.add(opt);
1245
 
1246
  var optn = document.createElement("OPTION");
1247
+ optn.text= 'Internal Walls';
1248
+ optn.value= "Internal Walls";
1249
  inputs1.add(optn);
1250
 
1251
  }
 
1352
  //___________________________________________________________________________________________________________
1353
 
1354
  //Retrieves list of projects
1355
+
1356
  function getproj(){
1357
  getALLMCTNAMES();
1358
 
 
1367
 
1368
  $.get( '/getmethod/'+JSON.stringify(projectVal))
1369
  .success (function(data){
1370
+ document.getElementById('refreshDropboxButtonID').style.display = "block";
1371
  document.getElementById("all").style.display = "none";
1372
+ if (sections.value.startsWith('3.2') || sections.value.startsWith('3.3') || sections.value.startsWith('2.7') ){
1373
  document.getElementById('dxfdiv').removeAttribute('hidden');
1374
  document.getElementById('pdftodxfFile').setAttribute('required',true)
1375
  }
1376
  else{
1377
  document.getElementById('dxfdiv').setAttribute('hidden',true)
1378
  }
1379
+ extracted_path=data[2]
 
1380
  var docsToMeasure=data[0]; //
1381
  var relvDocs=data[1]
1382
  var projname = document.getElementsByClassName("selectionsProj")[0];
 
1421
  optn1.setAttribute('disabled',true);
1422
  }
1423
  }
1424
+ const nameSet = new Set(); // To track unique names
1425
 
1426
  for (i = 0; i < docsToMeasure.length; i++) {
1427
  //to measure documents
1428
  var optn2 = document.createElement("OPTION");
1429
+ let name = docsToMeasure[i][0]; // Extract name
1430
  optn2.text= docsToMeasure[i][0];
1431
  optn2.value= docsToMeasure[i][0] ;
1432
  optn2.id=docsToMeasure[i][1] ;
1433
  measSelect.add(optn2);
1434
  measoptns.push(optn2);
1435
+
1436
+ // Check for duplicates
1437
+ if (nameSet.has(name)) {
1438
+ optn2.style.color = "red"; // Highlight duplicate (optional)
1439
+ PopupElement.textContent = 'Duplicate project names were detected while retrieving the project PDFs. Please visit Dropbox and rename the files to ensure each project has a unique name. Once the renaming is complete, return to the console and click on the Dropbox icon to retrieve the updated project names.';
1440
+ ShowPopUp();
1441
+ } else {
1442
+ nameSet.add(name); // Add unique name to the set
1443
+ }
1444
+
1445
  if (data=='No projects found'){
1446
  optn2.style.color='#bdbcbc';
1447
  optn2.style.cursor='not-allowed';
1448
  optn2.setAttribute('disabled',true);
1449
  }
1450
  }
1451
+ console.log(nameSet)
1452
  relvids.push(relvSelect) ;
1453
  measids.push(measSelect);
1454
  //to open pdf in a new tab (relevant documents)
1455
 
1456
 
1457
+ relvids.forEach(function(elem) {
1458
+ elem.addEventListener("change", function() {
1459
+ // Show loading indicator
1460
+ document.getElementById("all").style.display = "block";
1461
+ fetch('/getdropboxurl/'+ JSON.stringify(elem.value), {
1462
+
1463
+ method: 'POST',
1464
+ headers: { 'Content-Type': 'application/json' },
1465
+ body: JSON.stringify({ filename: "your_pdf_filename_here.pdf" })
1466
+ })
1467
+ .then(response => response.blob())
1468
+ .then(blob => {
1469
+ document.getElementById("all").style.display = "none";
1470
+ const url = URL.createObjectURL(blob);
1471
+ // Set the URL to the iframe's src to load the content inside the page
1472
+ const iframe = document.getElementById("pdfFrame");
1473
+ iframe.src = url;
1474
+ iframe.style.display = "block"; // Show the iframe
1475
+ })
1476
+ .catch(function(jqXHR, textStatus, errorThrown) {
1477
+ // Handle error
1478
+ PopupElement.textContent = 'Error occurred while retrieving the dropbox URL. Refresh and try again. If the error continues, please contact the ADR team to fix it.';
1479
+ ShowPopUp();
1480
+ });
1481
+ });
1482
  });
1483
 
1484
  measids.forEach(function(elem) {
 
1487
  // if (!(projsec.value.startsWith('2.8')))
1488
  // {
1489
  // Show alert immediately to prompt the user
1490
+ if (projsec.value.startsWith('3.2') || projsec.value.startsWith('3.3') || projsec.value.startsWith('2.7')) {
1491
  downloadPdf(elem.value);
1492
  window.alert("Measure the purple shape drawn on the PDF using Foxit Reader, Bluebeam, or any other external tool, then enter its area and perimeter in your desired scale.");
1493
  }
 
1519
  document.getElementById('measureADRbutton').onclick= function()
1520
  {
1521
  if (!areaRatio.value){
1522
+ if (!(projsec.value.startsWith('3.2')) & !(projsec.value.startsWith('2.8')) & !(projsec.value.startsWith('3.3')) & !(projsec.value.startsWith('2.7')) )
1523
  areaRatio.style.boxShadow='0 0 8px 2px rgb(255, 0, 0)';
1524
  }
1525
  if (!prmRatio.value)
 
1546
  areaRatio.style.textAlign='right';
1547
  areaRatio.step=".0000001";
1548
 
1549
+ if( projsec.value.startsWith('3.2') || projsec.value.startsWith('2.8') || projsec.value.startsWith('3.3') || projsec.value.startsWith('2.1') || projsec.value.startsWith('2.7')){
1550
  areaRatio.setAttribute('disabled',true)
1551
  document.getElementById('selectunitA').setAttribute('disabled',true)
1552
  }
 
1631
 
1632
  });
1633
 
1634
+ document.addEventListener("click", function(event) {
1635
+ const iframe = document.getElementById("pdfFrame");
1636
+ if (!iframe.contains(event.target)) {
1637
+ const iframe = document.getElementById("pdfFrame");
1638
+ iframe.style.display = "none";
1639
+ }
1640
+ });
1641
  document.getElementById('measureADRbutton').onclick= function()
1642
  {
1643
  if (!measSelect.value)
 
1650
  ShowPopUp();
1651
  });
1652
  if (document.getElementById('arealvlinput')){
1653
+ if( projsec.value.startsWith('3.2') || projsec.value.startsWith('2.8') || projsec.value.startsWith('3.3') || projsec.value.startsWith('2.1') || projsec.value.startsWith('2.7')){
1654
  document.getElementById('arealvlinput').setAttribute('disabled',true)
1655
  document.getElementById('selectunitA').setAttribute('disabled',true)
1656
  }
 
1886
  tomeasureproj=formvalues['measureselectname']; //proj name
1887
 
1888
 
1889
+ if( formvalues['selectprojs'].startsWith('3.2') || formvalues['selectprojs'].startsWith('3.3') || formvalues['selectprojs'].startsWith('2.7') ){
1890
  ratio1=1
1891
  ratio2=prminpixels/(formvalues['prmRatio']/ratioPunit);
1892
  console.log(ratio2, prminpixels,formvalues['prmRatio'],ratioPunit)
 
1919
  answers.push(tomeasureproj, 0,[], ratio1, ratio2 ,pdfpath);
1920
  formData.append('file',dxffile)
1921
  formData.append('answers',JSON.stringify(answers))
1922
+ }
1923
+
1924
+ else if ( formvalues['selectprojs'].startsWith('2.7'))
1925
+ {
1926
+ console.log('elseif')
1927
+ console.log(groupedValues)
1928
+ answers.push(tomeasureproj, 0,[], ratio1, ratio2 ,pdfpath,groupedValues);
1929
+ formData.append('file',dxffile)
1930
+ formData.append('answers',JSON.stringify(answers))
1931
  }
1932
+
1933
  else if (formvalues['selectprojs'].startsWith('1.0'))
1934
  {
1935
  console.log('whyyyy hereeee')
 
1945
 
1946
  }
1947
 
1948
+ if (formvalues['selectprojs'].startsWith('1.0') || formvalues['selectprojs'].startsWith('3.2') || formvalues['selectprojs'].startsWith('2.8') || formvalues['selectprojs'].startsWith('3.3') || formvalues['selectprojs'].startsWith('2.7') ) //formvalues['selectprojs'].startsWith('2.1')
1949
  {
1950
  // console.log(formData)
1951
  $.ajax({
 
2016
  document.getElementById('measureADRbutton').style.boxShadow='none';
2017
  });
2018
 
2019
+ if (formvalues['selectprojs'].startsWith('3.2') || formvalues['selectprojs'].startsWith('3.3') || formvalues['selectprojs'].startsWith('2.7') )
2020
  { //
2021
  // /* data[0]--> img , SimilarAreaDictionary.to_dict(), spreadsheet_url,spreadsheetId,[],list1.to_dict(),pdflink,hatched_areas,namepathArr]# , spreadsheetId, spreadsheet_url , list1.to_dict()]
2022
 
 
2058
  if (formvalues['selectprojs'].startsWith('2.1'))
2059
  {
2060
  //ignore data[0] --> img passed directly
2061
+ //dropboxLink=data[1]
2062
+
2063
+ //spreadsheetId=data[2]
2064
+ //spreadsheetURL=data[3]
2065
+ spreadsheetURL=data[0]
2066
 
2067
  }
2068
  if (formvalues['selectprojs'].startsWith('1.0'))
 
2102
  var flag=0;
2103
  pdfpath=[];
2104
  pdfpath.push(formvalues['selectproj'],formvalues['selectprojp'] ,formvalues['selectprojs'])
2105
+ if (formvalues['selectprojs'].startsWith('1.0') || formvalues['selectprojs'].startsWith('3.2') || formvalues['selectprojs'].startsWith('2.8') || formvalues['selectprojs'].startsWith('3.3')|| formvalues['selectprojs'].startsWith('2.7')) {
2106
  const interval = 6000; // Interval in milliseconds
2107
  let delrows1 = ''; // Initial data storage
2108
  let delrows2 = ''; // Updated data storage
 
2368
  }
2369
  console.log(section.value.toString())
2370
 
2371
+ }
2372
+ else if(( (inputs1.value=='Internal Walls' ) ) & (!selections1.value))//& (selections.value.startsWith('Pile') || !selections.value )) || (inputs.children[0].value=='pile caps' & (selections.value.startsWith('Ground') || !selections.value )))
2373
+ { //3.3
2374
+ selections1.innerHTML='';
2375
+
2376
+
2377
+ for (let m=0;m<MCTNames.length;m++)
2378
+ {
2379
+ var opt0 = document.createElement("OPTION") ;
2380
+ opt0.text= MCTNames[m][0];
2381
+ opt0.textContent= MCTNames[m][0];
2382
+ opt0.value= MCTNames[m][0];
2383
+ selections1.add(opt0);
2384
+ }
2385
+ console.log(section.value.toString())
2386
+
2387
+ }
2388
 
2389
  // if (inputs1.value.startsWith('Floor') & (selections1.value.startsWith('Wall') || !selections1.value )){
2390
  // selections1.innerHTML='';
 
2599
  //___________________________________________________________________________________________________________
2600
  //___________________________________________________________________________________________________________
2601
  var repeatforloopI=0;
2602
+ var repeatforloopIextra=0;
2603
  function getmctName(){
2604
 
2605
  var listofnames=[];
 
2884
  }
2885
  }
2886
  }
2887
+
2888
+ function addmctnameiconPopup(){
2889
+ // guessednamesDropdown()
2890
+ repeatforloopIextra+=1
2891
+ var dupDivExtra;
2892
+ if (clonedDivIdExtra==0){
2893
+ var dupDivExtra=document.getElementById('duplicaterExtra'); //pass kol div hna
2894
+ }
2895
+ else{
2896
+ var dupDivExtra=document.getElementById(clonedDivIdExtra); //pass kol div hna //akher div et3mlt
2897
+ }
2898
+
2899
+ var divExtra=document.getElementById('repeatforloopExtrahidden')
2900
+ var cloneExtra = divExtra.cloneNode(true); // "deep" clone
2901
+ jjExtra++;
2902
+
2903
+ // if (clonedDivIdExtra==0)
2904
+ // clone.style.marginLeft='5px';
2905
+ // else
2906
+ // clone.style.marginLeft='5px';
2907
+
2908
+ window.onclick = elem => {
2909
+ if (elem.target.tagName.startsWith('LORD-ICON') && elem.target.id.startsWith('addmctnameidExtra')){
2910
+ // console.log('repeatforloopExtraaa', elem.target.parentElement.parentElement.childNodes[1].value )
2911
+ cloneExtra.id = 'repeatforloopExtra'+ jjExtra;
2912
+ cloneExtra.setAttribute('class','repeatforloopclassExtra'+jjExtra);
2913
+ cloneExtra.setAttribute('name','repeatforloopnameExtra'+jjExtra);
2914
+ cloneExtra.childNodes[11].id='addmctnameidExtra'+jjExtra;
2915
+ cloneExtra.childNodes[15].id='deletemctnameidExtra'+jjExtra;
2916
+
2917
+ if (elem.target.parentElement.nextElementSibling)
2918
+ {
2919
+ $("#"+elem.target.parentElement.parentElement.id).append(cloneExtra);
2920
+ }
2921
+ else
2922
+ {
2923
+ $("#"+elem.target.parentElement.parentElement.id).append(cloneExtra);
2924
+ $("#"+elem.target.parentElement.id).insertBefore(cloneExtra,document.getElementById('doneebackground'));
2925
+ }
2926
+
2927
+ }
2928
+ }
2929
+ console.log()
2930
+ if (sectionNumber.startsWith('2.7'))
2931
+ {
2932
+ textextra= cloneExtra.children[0]
2933
+ textextra.style.backgroundColor = "#7c7c7c;";
2934
+ textextra.style.cursor='not-allowed';
2935
+ textextra.disabled="disabled";
2936
+
2937
+ }
2938
+ if (sectionNumber.startsWith('2.8'))
2939
+ {
2940
+ text2extra= cloneExtra.children[3]
2941
+ text2extra.style.backgroundColor = "#7c7c7c;";
2942
+ text2extra.style.cursor='not-allowed';
2943
+ text2extra.disabled="disabled";
2944
+ }
2945
+ }
2946
+
2947
+ function deletemctnameiconPopup(){
2948
+ window.onclick = elem => {
2949
+
2950
+ if (elem.target.tagName.startsWith('LORD-ICON') && elem.target.id.startsWith('deletemctnameidExtra'))
2951
+ {
2952
+ var numb = elem.target.parentElement.id.match(/\d/g);
2953
+ if (numb==null)
2954
+ numb='';
2955
+ else
2956
+ numb = numb.join("");
2957
+ var deletethisdivExtra= document.getElementById('repeatforloopExtra'+ numb);
2958
+ deletethisdivExtra.parentNode.removeChild(deletethisdivExtra);
2959
+ }
2960
+ }
2961
+ }
2962
  //___________________________________________________________________________________________________________
2963
  //___________________________________________________________________________________________________________
2964
  function colors(){
 
3241
  optn.value= "Ceiling";
3242
  inputs.add(optn);
3243
  }
3244
+ if (section.value.startsWith('2.7'))
3245
+ {
3246
+ var opt = document.createElement("OPTION");
3247
+ opt.text= 'Select';
3248
+ opt.value= "";
3249
+ opt.hidden=true;
3250
+ inputs.add(opt);
3251
+ var optn = document.createElement("OPTION");
3252
+ optn.text= 'Internal Walls';
3253
+ optn.value= "Internal Walls";
3254
+ inputs.add(optn);
3255
+ }
3256
  if (section.value.startsWith('2.8'))
3257
  {
3258
  var opt = document.createElement("OPTION");
 
3391
 
3392
 
3393
  // Call function when show dialog btn is clicked
3394
+ var duplicaterExtra = document.getElementById("duplicaterExtra");
3395
+ var overlaymeText = document.getElementById("modal-bodyTextp");
3396
  var overlayme = document.getElementById("dialog-container");
3397
  document.getElementById("refreshDropboxButtonID").disabled=false;
3398
 
 
3401
 
3402
  document.getElementById("refreshDropboxButtonID").onclick = function()
3403
  {
3404
+ TopTextModal.textContent='Warning!';
3405
  if (document.getElementById("refreshDropboxButtonID").disabled==false)
3406
  overlayme.style.display = "block";
3407
+ overlaymeText.textContent='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.';
3408
+ duplicaterExtra.setAttribute('hidden',true)
3409
  };
 
3410
 
3411
 
3412
+ // Call function when show dialog btn is clicked
3413
+ var TopTextModal = document.getElementById("TopTextModalWarning");
3414
+
3415
+ document.getElementById("refreshAPIbutton").disabled=false;
3416
+ document.getElementById("refreshAPIbutton").onclick = function()
3417
+ {
3418
+ TopTextModal.textContent='Warning!';
3419
+ if (document.getElementById("refreshAPIbutton").disabled==false)
3420
+ {
3421
+ console.log(overlaymeText.textContent)
3422
+ overlaymeText.textContent='This is not a mandatory button. The system already runs at half-hour intervals to update the dropdowns and MC-Templates from the MC. Using this would manually refresh the data retrieved, disregarding the 30-minute interval.';
3423
+ overlayme.style.display = "block";
3424
+ duplicaterExtra.setAttribute('hidden',true)
3425
+ }
3426
+ };
3427
+
3428
+
3429
+
3430
+ document.getElementById("popupforextratext").disabled=false;
3431
+ document.getElementById("popupforextratext").onclick = function(){
3432
+ if (sectionNumber.startsWith('2.7'))
3433
+ {
3434
+ textextra= document.getElementById("textextra")
3435
+ textextra.style.backgroundColor = "#7c7c7c;";
3436
+ textextra.style.cursor='not-allowed';
3437
+ textextra.disabled="disabled";
3438
+
3439
+ }
3440
+ if (sectionNumber.startsWith('2.8'))
3441
+ {
3442
+ text2extra= document.getElementById("text2extra")
3443
+ text2extra.style.backgroundColor = "#7c7c7c;";
3444
+ text2extra.style.cursor='not-allowed';
3445
+ text2extra.disabled="disabled";
3446
+ }
3447
+ duplicaterExtra.removeAttribute('hidden');
3448
+ TopTextModal.textContent='Define Information to Extract from Drawing'
3449
+ if (document.getElementById("popupforextratext").disabled==false)
3450
+ {
3451
+ overlaymeText.textContent='';
3452
+ overlayme.style.display = "block";
3453
+ }
3454
+ };
3455
  // }
3456
 
3457
+
3458
+ document.getElementById("confirm").onclick = function(){confirmDialogR()};
3459
+ function confirmDialogR() {
3460
+ /* code executed if confirm is clicked */
3461
+ overlayme.style.display = "none";
3462
+ console.log(document.getElementById("confirm").parentElement.parentElement.children[0].textContent)
3463
+ if (document.getElementById("confirm").parentElement.parentElement.children[0].textContent.startsWith('Are'))
3464
+ {
3465
+ console.log('hereeeeeeeee')
3466
+ callrefreshDropbox();
3467
+ }
3468
+ else if(document.getElementById("confirm").parentElement.parentElement.children[0].textContent.startsWith('This')){
3469
+
3470
+ callrefreshAPI();
3471
+ }
3472
+ else{
3473
+ getpopuptext();
3474
+ }
3475
+
3476
+ }
3477
+
3478
  // If cancel btn is clicked , the function cancel() is executed
3479
  document.getElementById("cancel").onclick = function(){cancelDialog()};
3480
  function cancelDialog() {
3481
  overlayme.style.display = "none";
3482
  }
3483
 
3484
+ var extracted_path;
3485
  function callrefreshDropbox(){
3486
+ console.log('ldropboxx' , extracted_path)
3487
  document.getElementById("refreshDropboxButtonID").style.backgroundColor = "gray";
3488
  document.getElementById("refreshDropboxButtonID").style.cursor='not-allowed';
3489
  document.getElementById("refreshDropboxButtonID").disabled="disabled";
3490
 
3491
+ TopTextModal=document.getElementById("TopTextModal");
3492
+ $.get('/postdropboxprojects/' + encodeURIComponent(JSON.stringify(extracted_path)))
3493
 
3494
  .success(function(stringReturned) {
3495
+ if (stringReturned.startsWith('Updated'))
3496
+ {
3497
  console.log('DONEEEE')
3498
+
3499
  TopTextModal.textContent= "Success!";
3500
  TopTextModal.style.color='green';
3501
  PopupElement.textContent=stringReturned;
3502
+ }
3503
+ else{
3504
+ PopupElement.textContent=stringReturned;
3505
+ }
3506
  ShowPopUp();
3507
  document.getElementById("refreshDropboxButtonID").style.cursor='pointer';
3508
  document.getElementById("refreshDropboxButtonID").style.backgroundColor = "#1680c7";
 
3516
  }
3517
 
3518
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3519
  function refreshAPIbuutton(dataa){
3520
  $.get('/refreshAPIAppendNewTables')
3521
  .success(function(successData){
 
3561
  opt=document.createElement("option");
3562
  opt.textContent=dataa[2][d];
3563
  opt.text=dataa[2][d];
3564
+ if(!(dataa[2][d].startsWith('1.0') ) || (data[i].startsWith('3.2') ) || (data[i].startsWith('2.8')) || (data[i].startsWith('3.3')) || (data[i].startsWith('2.1')) || (data[i].startsWith('2.7')) )//||data[i].startsWith('2.2')))
3565
  {
3566
  opt.style.color='#bdbcbc';
3567
  opt.style.cursor='not-allowed';
 
3572
  }
3573
  }
3574
  }
3575
+ TopTextModal=document.getElementById("TopTextModalWarning");
 
 
3576
  TopTextModal.textContent= "Success!";
3577
  TopTextModal.style.color='green';
3578
  PopupElement.textContent='Console is up to date!';
 
3637
  }
3638
 
3639
  }
3640
+
3641
+ var groupedValues = [];
3642
+
3643
+ function getpopuptext(){
3644
+ // Select all text input fields inside the modal
3645
+ const inputs = document.querySelectorAll('.modal-body input[type="text"], .modal-body input[type="number"]');
3646
+ const values = [];
3647
+
3648
+ // Loop through the inputs and add their values to the array
3649
+ inputs.forEach(input => {
3650
+ values.push(input.value);
3651
+ });
3652
+
3653
+ console.log("Collected input values:", values);
3654
+
3655
+ // Group the values into subarrays of 4
3656
+ // const groupedValues = [];
3657
+ for (let i = 0; i < values.length; i += 4) {
3658
+ groupedValues.push(values.slice(i, i + 4));
3659
+ }
3660
+
3661
+ console.log("Grouped input values:", groupedValues);
3662
+
3663
+ return groupedValues;
3664
+
3665
+ }
3666
+
3667
  </script>
3668