Spaces:
Sleeping
Sleeping
Update templates/proposed-GUI.html
Browse files- templates/proposed-GUI.html +180 -28
templates/proposed-GUI.html
CHANGED
|
@@ -77,7 +77,7 @@
|
|
| 77 |
</div>
|
| 78 |
|
| 79 |
|
| 80 |
-
<form method="post" id="myForm" >
|
| 81 |
|
| 82 |
<!-- <div class="projnamedp">
|
| 83 |
<input type="text" placeholder="Project" name="selectproj" class="selectionsProj" id="selectionsProjid" oninput="filterFunction(this,event)" >
|
|
@@ -104,11 +104,15 @@
|
|
| 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² </option>
|
| 114 |
<option id="mm2" value="mm2" >mm² </option>
|
|
@@ -498,7 +502,7 @@ function displayprojsections(projectid,Partid){
|
|
| 498 |
opt.text=data[i];
|
| 499 |
thirddropdown.append(opt);
|
| 500 |
|
| 501 |
-
if(!(data[i].startsWith('1.0') )
|
| 502 |
{
|
| 503 |
opt.style.color='#bdbcbc';
|
| 504 |
opt.style.cursor='not-allowed';
|
|
@@ -622,7 +626,7 @@ worker.onmessage= function(event){
|
|
| 622 |
opt=document.createElement("option");
|
| 623 |
opt.textContent=data[2][d];
|
| 624 |
opt.text=data[2][d];
|
| 625 |
-
if(!(data[2][d].startsWith('1.0') )
|
| 626 |
{
|
| 627 |
opt.style.color='#bdbcbc';
|
| 628 |
opt.style.cursor='not-allowed';
|
|
@@ -701,7 +705,7 @@ document.getElementById('duplicater').childNodes[1].value=[0,0]
|
|
| 701 |
//___________________________________________________________________________________________________________
|
| 702 |
/*Tab View of User Guide*/
|
| 703 |
document.getElementById('secondpage').addEventListener('click',function(){
|
| 704 |
-
document.getElementById('textsecondpage').removeAttribute('hidden');
|
| 705 |
document.getElementById('textfirstpage').setAttribute('hidden',true)
|
| 706 |
|
| 707 |
});
|
|
@@ -791,6 +795,40 @@ function openTab(evt, tabname) {
|
|
| 791 |
// Start with the first page (Home)
|
| 792 |
document.getElementById("pagetitle").click();
|
| 793 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 794 |
//___________________________________________________________________________________________________________
|
| 795 |
//___________________________________________________________________________________________________________
|
| 796 |
/*Add icon to duplicate 'duplicater' div (big section that includes 3 dropdowns,3 textboxes, 2 buttons(add,delete)*/
|
|
@@ -885,14 +923,21 @@ document.getElementById("pagetitle").click();
|
|
| 885 |
opt.value= "";
|
| 886 |
opt.hidden=true;
|
| 887 |
inputs1.add(opt);
|
|
|
|
| 888 |
var optn = document.createElement("OPTION");
|
| 889 |
optn.text= 'Floor';
|
| 890 |
optn.value= "Floor";
|
| 891 |
inputs1.add(optn);
|
|
|
|
| 892 |
var optn1 = document.createElement("OPTION");
|
| 893 |
optn1.text= 'Wall';
|
| 894 |
optn1.value= "Wall";
|
| 895 |
inputs1.add(optn1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 896 |
}
|
| 897 |
}
|
| 898 |
|
|
@@ -955,6 +1000,13 @@ var ratioPunit=1;
|
|
| 955 |
.success (function(data){
|
| 956 |
|
| 957 |
document.getElementById("all").style.display = "none";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 958 |
|
| 959 |
console.log(data[0],data[1])
|
| 960 |
var docsToMeasure=data[0]; //
|
|
@@ -986,8 +1038,6 @@ var ratioPunit=1;
|
|
| 986 |
|
| 987 |
measSelect.add(optn2);
|
| 988 |
document.getElementById("hidden").required = true;
|
| 989 |
-
// measSelect.required=true;
|
| 990 |
-
// console.log(measSelect)
|
| 991 |
|
| 992 |
relvSelect.innerHTML='';
|
| 993 |
for (i = 0; i < relvDocs.length; i++) {
|
|
@@ -1052,21 +1102,28 @@ var ratioPunit=1;
|
|
| 1052 |
pdfname=elem.value;
|
| 1053 |
measSelect.style.boxShadow='none';
|
| 1054 |
|
|
|
|
| 1055 |
document.getElementById("all").style.display = "block";
|
|
|
|
| 1056 |
pixelArr=[projname.value, projpart.value,projsec.value, pdfname]
|
|
|
|
|
|
|
|
|
|
| 1057 |
$.get( '/pixelimg/'+JSON.stringify(pixelArr))
|
| 1058 |
.success( function(data) {
|
| 1059 |
-
|
| 1060 |
document.getElementById("all").style.display = "none";
|
| 1061 |
-
if(window.confirm("Measure the purple shape drawn on the pdf using Foxit Reader or any other external tool, then enter its area and perimeter in your desired scale. \n")){
|
| 1062 |
window.open(data[2]);
|
| 1063 |
}
|
| 1064 |
document.getElementById("all").style.display = "none";
|
| 1065 |
|
| 1066 |
document.getElementById('measureADRbutton').onclick= function()
|
| 1067 |
{
|
| 1068 |
-
if (!areaRatio.value)
|
| 1069 |
-
|
|
|
|
|
|
|
| 1070 |
if (!prmRatio.value)
|
| 1071 |
prmRatio.style.boxShadow='0 0 8px 2px rgb(255, 0, 0)';
|
| 1072 |
|
|
@@ -1084,11 +1141,21 @@ var ratioPunit=1;
|
|
| 1084 |
|
| 1085 |
var areaRatio= document.createElement("input");
|
| 1086 |
areaRatio.type='number';
|
| 1087 |
-
areaRatio.id='
|
|
|
|
| 1088 |
areaRatio.name='areaRatio';
|
| 1089 |
areaRatio.style.marginLeft='78px';
|
| 1090 |
areaRatio.style.textAlign='right';
|
| 1091 |
areaRatio.step=".0000001";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1092 |
areaRatio.addEventListener('change',function(){
|
| 1093 |
areaRatio.value=(Number(areaRatio.value)).toFixed(7)
|
| 1094 |
areaRatio.style.boxShadow='none';
|
|
@@ -1108,7 +1175,8 @@ var ratioPunit=1;
|
|
| 1108 |
|
| 1109 |
var prmRatio= document.createElement("input");
|
| 1110 |
prmRatio.type='number';
|
| 1111 |
-
prmRatio.id='
|
|
|
|
| 1112 |
prmRatio.name='prmRatio';
|
| 1113 |
prmRatio.style.textAlign='right';
|
| 1114 |
// prmRatio.onchange=setNumberDecimal();
|
|
@@ -1167,7 +1235,17 @@ var ratioPunit=1;
|
|
| 1167 |
PopupElement.textContent='Error occured while retrieving the Project Names. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
|
| 1168 |
ShowPopUp();
|
| 1169 |
});
|
| 1170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1171 |
//___________________________________________________________________________________________________________
|
| 1172 |
//___________________________________________________________________________________________________________
|
| 1173 |
|
|
@@ -1207,9 +1285,15 @@ var allcolors=['#2FFFFF'];
|
|
| 1207 |
// Main Function - form submit
|
| 1208 |
//___________________________________________________________________________________________________________
|
| 1209 |
//___________________________________________________________________________________________________________
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1210 |
function getData(form) {
|
| 1211 |
-
|
| 1212 |
-
|
| 1213 |
document.getElementById("loading").hidden = false;
|
| 1214 |
|
| 1215 |
document.getElementById('measureADRbutton').setAttribute('disabled',true);
|
|
@@ -1221,6 +1305,7 @@ function getData(form) {
|
|
| 1221 |
var underimg=document.getElementById('underimgbuttons');
|
| 1222 |
var rightside=document.getElementById('rightside');
|
| 1223 |
var formData = new FormData(form);
|
|
|
|
| 1224 |
clearInterval(interval)
|
| 1225 |
val=0;
|
| 1226 |
answers=[];
|
|
@@ -1230,37 +1315,66 @@ function getData(form) {
|
|
| 1230 |
pdfpath=[];
|
| 1231 |
formvalues=Object.fromEntries(formData);
|
| 1232 |
|
| 1233 |
-
|
| 1234 |
// iterate through entries...
|
| 1235 |
|
| 1236 |
tomeasureproj=formvalues['measureselectname']; //proj name
|
| 1237 |
-
ratio1=(formvalues['areaRatio']/ratioAunit)/areainpixels;
|
| 1238 |
-
ratio2=(formvalues['prmRatio']/ratioPunit)/prminpixels;
|
| 1239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1240 |
pdfpath.push(formvalues['selectproj'],formvalues['selectprojp'] ,formvalues['selectprojs']) //project name - part - section
|
| 1241 |
|
| 1242 |
if (canvasimg){
|
| 1243 |
buf=canvasimg.split("data:image/png;base64,")
|
| 1244 |
answers.push(tomeasureproj, 220,allcolors , ratio1, ratio2 ,pdfpath,buf[1]);
|
| 1245 |
}
|
|
|
|
| 1246 |
else{
|
| 1247 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1248 |
}
|
| 1249 |
|
| 1250 |
-
if (
|
| 1251 |
{
|
|
|
|
| 1252 |
$.ajax({
|
| 1253 |
type: "POST",
|
|
|
|
| 1254 |
url: "/savebase64Img/",
|
| 1255 |
|
| 1256 |
// set content type header to use Flask response.get_json()
|
| 1257 |
contentType: "application/json",
|
| 1258 |
|
| 1259 |
// convert data/object to JSON to send
|
| 1260 |
-
data:
|
|
|
|
|
|
|
|
|
|
| 1261 |
|
| 1262 |
// expect JSON data in return (e.g. Flask jsonify)
|
| 1263 |
-
dataType: "json",
|
| 1264 |
|
| 1265 |
// handle response
|
| 1266 |
success: function(response) {
|
|
@@ -1303,7 +1417,7 @@ function getData(form) {
|
|
| 1303 |
});
|
| 1304 |
|
| 1305 |
if (formvalues['selectprojs'].startsWith('3.2'))
|
| 1306 |
-
{
|
| 1307 |
// /* data[0]--> img , data[1]-->dataframe (goes to legend lsa ) , data [2] -->pdf dropbox shareable link ,data[3]-> spreadsheetId, data[4],spreadsheeturl */
|
| 1308 |
SimilarAreaDictionary=data[1];
|
| 1309 |
dropboxLink=data[2];
|
|
@@ -1408,7 +1522,7 @@ function getData(form) {
|
|
| 1408 |
pdfpath.push(formvalues['selectproj'],formvalues['selectprojp'] ,formvalues['selectprojs'])
|
| 1409 |
var rightsideids=[];
|
| 1410 |
|
| 1411 |
-
if (formvalues['selectprojs'].startsWith('1.0') )
|
| 1412 |
|
| 1413 |
interval= setInterval( function() {
|
| 1414 |
|
|
@@ -1608,6 +1722,22 @@ function get3rddropdown(){
|
|
| 1608 |
selections1.innerHTML='';
|
| 1609 |
|
| 1610 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1611 |
for (let m=0;m<MCTNames.length;m++)
|
| 1612 |
{
|
| 1613 |
var opt0 = document.createElement("OPTION") ;
|
|
@@ -1717,6 +1847,20 @@ function get3rddropdown(){
|
|
| 1717 |
}
|
| 1718 |
|
| 1719 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1720 |
|
| 1721 |
// if (inputs.value=='Floor' & (selections.value.startsWith('Wall') || !selections.value )){
|
| 1722 |
// selections.innerHTML='';
|
|
@@ -2186,6 +2330,8 @@ NewShapeButtonId=document.getElementById('NewShapeButtonId');
|
|
| 2186 |
var savecanvas=document.getElementById('savecanvas');
|
| 2187 |
|
| 2188 |
levelsin.addEventListener('click',function(){
|
|
|
|
|
|
|
| 2189 |
document.getElementById("all").style.display = "block";
|
| 2190 |
if( document.getElementById('levelcheckbox').checked)
|
| 2191 |
{
|
|
@@ -2262,6 +2408,12 @@ levelsin.addEventListener('click',function(){
|
|
| 2262 |
canvasimg=image.src;
|
| 2263 |
})
|
| 2264 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2265 |
})
|
| 2266 |
//___________________________________________________________________________________________________________
|
| 2267 |
function getSecondData(){
|
|
@@ -2499,7 +2651,7 @@ function getlegendstoDirectory(){
|
|
| 2499 |
newlabelsec.textContent=prjSectionsforLgnd[cc];
|
| 2500 |
newlabelsec.id='prjsec';
|
| 2501 |
newlabelsec.className='prjsecclass';
|
| 2502 |
-
if (!(newlabelsec.textContent.toString().startsWith('1.0') )
|
| 2503 |
{
|
| 2504 |
newlabelsec.style.color='lightgray';
|
| 2505 |
i.style.color='lightgray'
|
|
@@ -2853,7 +3005,7 @@ function refreshAPIbuutton(dataa){
|
|
| 2853 |
opt=document.createElement("option");
|
| 2854 |
opt.textContent=dataa[2][d];
|
| 2855 |
opt.text=dataa[2][d];
|
| 2856 |
-
if(!(dataa[2][d].startsWith('1.0') )
|
| 2857 |
{
|
| 2858 |
opt.style.color='#bdbcbc';
|
| 2859 |
opt.style.cursor='not-allowed';
|
|
|
|
| 77 |
</div>
|
| 78 |
|
| 79 |
|
| 80 |
+
<form method="post" id="myForm" enctype="multipart/form-data">
|
| 81 |
|
| 82 |
<!-- <div class="projnamedp">
|
| 83 |
<input type="text" placeholder="Project" name="selectproj" class="selectionsProj" id="selectionsProjid" oninput="filterFunction(this,event)" >
|
|
|
|
| 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 |
+
<div id="dxfdiv" hidden="until-found">
|
| 113 |
+
<input type="button" id="pdftodxfFileButton" onclick="document.getElementById('pdftodxfFile').click();" value="Choose DXF File" >
|
| 114 |
+
<input type="file" id="pdftodxfFile" name="pdftodxfFilename" >
|
| 115 |
+
</div>
|
| 116 |
<select id='selectunitA' hidden>
|
| 117 |
<option id="m2" value="m2" >m² </option>
|
| 118 |
<option id="mm2" value="mm2" >mm² </option>
|
|
|
|
| 502 |
opt.text=data[i];
|
| 503 |
thirddropdown.append(opt);
|
| 504 |
|
| 505 |
+
if(!(data[i].startsWith('1.0') ) && !(data[i].startsWith('3.2'))) // ||data[i].startsWith('2.2')))
|
| 506 |
{
|
| 507 |
opt.style.color='#bdbcbc';
|
| 508 |
opt.style.cursor='not-allowed';
|
|
|
|
| 626 |
opt=document.createElement("option");
|
| 627 |
opt.textContent=data[2][d];
|
| 628 |
opt.text=data[2][d];
|
| 629 |
+
if(!(data[2][d].startsWith('1.0') ) && !(data[2][d].startsWith('3.2') )) //||data[i].startsWith('2.2')))
|
| 630 |
{
|
| 631 |
opt.style.color='#bdbcbc';
|
| 632 |
opt.style.cursor='not-allowed';
|
|
|
|
| 705 |
//___________________________________________________________________________________________________________
|
| 706 |
/*Tab View of User Guide*/
|
| 707 |
document.getElementById('secondpage').addEventListener('click',function(){
|
| 708 |
+
document.getElementById('textsecondpage').removeAttribute('hidden');
|
| 709 |
document.getElementById('textfirstpage').setAttribute('hidden',true)
|
| 710 |
|
| 711 |
});
|
|
|
|
| 795 |
// Start with the first page (Home)
|
| 796 |
document.getElementById("pagetitle").click();
|
| 797 |
|
| 798 |
+
|
| 799 |
+
/// download file (made for 3.2 only)
|
| 800 |
+
// function downloadpdf(filename, pdfdata) {
|
| 801 |
+
// console.log('hereeee')
|
| 802 |
+
// var element = document.createElement('a');
|
| 803 |
+
// element.setAttribute('href', 'data:application/pdf;base64,[base64_encoded_pdf_data],' + encodeURIComponent(pdfdata));
|
| 804 |
+
// element.setAttribute('download', filename);
|
| 805 |
+
|
| 806 |
+
// element.style.display = 'none';
|
| 807 |
+
// document.body.appendChild(element);
|
| 808 |
+
|
| 809 |
+
// element.click();
|
| 810 |
+
|
| 811 |
+
// document.body.removeChild(element);
|
| 812 |
+
// }
|
| 813 |
+
|
| 814 |
+
function downloadPdf(pdfname) {
|
| 815 |
+
fetch('/get-pdf/'+pdfname)
|
| 816 |
+
.then(response => response.blob())
|
| 817 |
+
.then(blob => {
|
| 818 |
+
const url = URL.createObjectURL(blob);
|
| 819 |
+
const a = document.createElement('a');
|
| 820 |
+
a.href = url;
|
| 821 |
+
a.download = 'downloaded_file.pdf'; // Default filename
|
| 822 |
+
document.body.appendChild(a);
|
| 823 |
+
a.click();
|
| 824 |
+
a.remove();
|
| 825 |
+
|
| 826 |
+
console.log('adddxffilehere')
|
| 827 |
+
})
|
| 828 |
+
.catch(error => console.error('Error fetching PDF:', error));
|
| 829 |
+
}
|
| 830 |
+
|
| 831 |
+
|
| 832 |
//___________________________________________________________________________________________________________
|
| 833 |
//___________________________________________________________________________________________________________
|
| 834 |
/*Add icon to duplicate 'duplicater' div (big section that includes 3 dropdowns,3 textboxes, 2 buttons(add,delete)*/
|
|
|
|
| 923 |
opt.value= "";
|
| 924 |
opt.hidden=true;
|
| 925 |
inputs1.add(opt);
|
| 926 |
+
|
| 927 |
var optn = document.createElement("OPTION");
|
| 928 |
optn.text= 'Floor';
|
| 929 |
optn.value= "Floor";
|
| 930 |
inputs1.add(optn);
|
| 931 |
+
|
| 932 |
var optn1 = document.createElement("OPTION");
|
| 933 |
optn1.text= 'Wall';
|
| 934 |
optn1.value= "Wall";
|
| 935 |
inputs1.add(optn1);
|
| 936 |
+
|
| 937 |
+
var optn2 = document.createElement("OPTION");
|
| 938 |
+
optn2.text= 'Internal Doors';
|
| 939 |
+
optn2.value= "Internal Doors";
|
| 940 |
+
inputs1.add(optn2);
|
| 941 |
}
|
| 942 |
}
|
| 943 |
|
|
|
|
| 1000 |
.success (function(data){
|
| 1001 |
|
| 1002 |
document.getElementById("all").style.display = "none";
|
| 1003 |
+
if (sections.value.startsWith(3.2)){
|
| 1004 |
+
document.getElementById('dxfdiv').removeAttribute('hidden');
|
| 1005 |
+
document.getElementById('pdftodxfFile').setAttribute('required',true)
|
| 1006 |
+
}
|
| 1007 |
+
else{
|
| 1008 |
+
document.getElementById('dxfdiv').setAttribute('hidden',true)
|
| 1009 |
+
}
|
| 1010 |
|
| 1011 |
console.log(data[0],data[1])
|
| 1012 |
var docsToMeasure=data[0]; //
|
|
|
|
| 1038 |
|
| 1039 |
measSelect.add(optn2);
|
| 1040 |
document.getElementById("hidden").required = true;
|
|
|
|
|
|
|
| 1041 |
|
| 1042 |
relvSelect.innerHTML='';
|
| 1043 |
for (i = 0; i < relvDocs.length; i++) {
|
|
|
|
| 1102 |
pdfname=elem.value;
|
| 1103 |
measSelect.style.boxShadow='none';
|
| 1104 |
|
| 1105 |
+
|
| 1106 |
document.getElementById("all").style.display = "block";
|
| 1107 |
+
|
| 1108 |
pixelArr=[projname.value, projpart.value,projsec.value, pdfname]
|
| 1109 |
+
if (projsec.value.startsWith('3.2'))
|
| 1110 |
+
downloadPdf(pdfname)
|
| 1111 |
+
|
| 1112 |
$.get( '/pixelimg/'+JSON.stringify(pixelArr))
|
| 1113 |
.success( function(data) {
|
| 1114 |
+
// downloadpdf(pdfname, data1)
|
| 1115 |
document.getElementById("all").style.display = "none";
|
| 1116 |
+
if(window.confirm("Measure the purple shape drawn on the pdf using Foxit Reader, Blueabeam, or any other external tool, then enter its area and perimeter in your desired scale. \n")){
|
| 1117 |
window.open(data[2]);
|
| 1118 |
}
|
| 1119 |
document.getElementById("all").style.display = "none";
|
| 1120 |
|
| 1121 |
document.getElementById('measureADRbutton').onclick= function()
|
| 1122 |
{
|
| 1123 |
+
if (!areaRatio.value){
|
| 1124 |
+
if (!(projsec.value.startsWith('3.2')))
|
| 1125 |
+
areaRatio.style.boxShadow='0 0 8px 2px rgb(255, 0, 0)';
|
| 1126 |
+
}
|
| 1127 |
if (!prmRatio.value)
|
| 1128 |
prmRatio.style.boxShadow='0 0 8px 2px rgb(255, 0, 0)';
|
| 1129 |
|
|
|
|
| 1141 |
|
| 1142 |
var areaRatio= document.createElement("input");
|
| 1143 |
areaRatio.type='number';
|
| 1144 |
+
areaRatio.id='arealvlinput';
|
| 1145 |
+
areaRatio.className='lvlinput';
|
| 1146 |
areaRatio.name='areaRatio';
|
| 1147 |
areaRatio.style.marginLeft='78px';
|
| 1148 |
areaRatio.style.textAlign='right';
|
| 1149 |
areaRatio.step=".0000001";
|
| 1150 |
+
|
| 1151 |
+
if( projsec.value.startsWith('3.2')){
|
| 1152 |
+
areaRatio.setAttribute('disabled',true)
|
| 1153 |
+
document.getElementById('selectunitA').setAttribute('disabled',true)
|
| 1154 |
+
}
|
| 1155 |
+
else{
|
| 1156 |
+
areaRatio.removeAttribute('disabled')
|
| 1157 |
+
document.getElementById('selectunitA').removeAttribute('disabled')
|
| 1158 |
+
}
|
| 1159 |
areaRatio.addEventListener('change',function(){
|
| 1160 |
areaRatio.value=(Number(areaRatio.value)).toFixed(7)
|
| 1161 |
areaRatio.style.boxShadow='none';
|
|
|
|
| 1175 |
|
| 1176 |
var prmRatio= document.createElement("input");
|
| 1177 |
prmRatio.type='number';
|
| 1178 |
+
prmRatio.id='perimlvlinput';
|
| 1179 |
+
prmRatio.className='lvlinput';
|
| 1180 |
prmRatio.name='prmRatio';
|
| 1181 |
prmRatio.style.textAlign='right';
|
| 1182 |
// prmRatio.onchange=setNumberDecimal();
|
|
|
|
| 1235 |
PopupElement.textContent='Error occured while retrieving the Project Names. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
|
| 1236 |
ShowPopUp();
|
| 1237 |
});
|
| 1238 |
+
if (document.getElementById('arealvlinput')){
|
| 1239 |
+
if(projsec.value.startsWith('3.2')){
|
| 1240 |
+
document.getElementById('arealvlinput').setAttribute('disabled',true)
|
| 1241 |
+
document.getElementById('selectunitA').setAttribute('disabled',true)
|
| 1242 |
+
}
|
| 1243 |
+
else{
|
| 1244 |
+
document.getElementById('arealvlinput').removeAttribute('disabled')
|
| 1245 |
+
document.getElementById('selectunitA').removeAttribute('disabled')
|
| 1246 |
+
}
|
| 1247 |
+
}
|
| 1248 |
+
}
|
| 1249 |
//___________________________________________________________________________________________________________
|
| 1250 |
//___________________________________________________________________________________________________________
|
| 1251 |
|
|
|
|
| 1285 |
// Main Function - form submit
|
| 1286 |
//___________________________________________________________________________________________________________
|
| 1287 |
//___________________________________________________________________________________________________________
|
| 1288 |
+
document.getElementById('pdftodxfFile').addEventListener('input',function(){
|
| 1289 |
+
console.log('hghjk')
|
| 1290 |
+
const files = document.getElementById("pdftodxfFile");
|
| 1291 |
+
dxffile=files.files[0];
|
| 1292 |
+
console.log(dxffile)
|
| 1293 |
+
});
|
| 1294 |
+
|
| 1295 |
function getData(form) {
|
| 1296 |
+
|
|
|
|
| 1297 |
document.getElementById("loading").hidden = false;
|
| 1298 |
|
| 1299 |
document.getElementById('measureADRbutton').setAttribute('disabled',true);
|
|
|
|
| 1305 |
var underimg=document.getElementById('underimgbuttons');
|
| 1306 |
var rightside=document.getElementById('rightside');
|
| 1307 |
var formData = new FormData(form);
|
| 1308 |
+
|
| 1309 |
clearInterval(interval)
|
| 1310 |
val=0;
|
| 1311 |
answers=[];
|
|
|
|
| 1315 |
pdfpath=[];
|
| 1316 |
formvalues=Object.fromEntries(formData);
|
| 1317 |
|
| 1318 |
+
console.log(formData,formvalues)
|
| 1319 |
// iterate through entries...
|
| 1320 |
|
| 1321 |
tomeasureproj=formvalues['measureselectname']; //proj name
|
|
|
|
|
|
|
| 1322 |
|
| 1323 |
+
|
| 1324 |
+
if( formvalues['selectprojs'].startsWith('3.2')){
|
| 1325 |
+
ratio1=1
|
| 1326 |
+
ratio2=prminpixels/(formvalues['prmRatio']/ratioPunit);
|
| 1327 |
+
console.log(ratio2, prminpixels,formvalues['prmRatio'],ratioPunit)
|
| 1328 |
+
}
|
| 1329 |
+
else{
|
| 1330 |
+
ratio1=(formvalues['areaRatio']/ratioAunit)/areainpixels;
|
| 1331 |
+
ratio2=(formvalues['prmRatio']/ratioPunit)/prminpixels;
|
| 1332 |
+
}
|
| 1333 |
pdfpath.push(formvalues['selectproj'],formvalues['selectprojp'] ,formvalues['selectprojs']) //project name - part - section
|
| 1334 |
|
| 1335 |
if (canvasimg){
|
| 1336 |
buf=canvasimg.split("data:image/png;base64,")
|
| 1337 |
answers.push(tomeasureproj, 220,allcolors , ratio1, ratio2 ,pdfpath,buf[1]);
|
| 1338 |
}
|
| 1339 |
+
|
| 1340 |
else{
|
| 1341 |
+
console.log('else')
|
| 1342 |
+
|
| 1343 |
+
if (formvalues['selectprojs'].startsWith('3.2'))
|
| 1344 |
+
{
|
| 1345 |
+
console.log('elseif')
|
| 1346 |
+
answers.push(tomeasureproj, 0,[], ratio1, ratio2 ,pdfpath);
|
| 1347 |
+
formData.append('file',dxffile)
|
| 1348 |
+
formData.append('answers',JSON.stringify(answers))
|
| 1349 |
+
}
|
| 1350 |
+
else
|
| 1351 |
+
{
|
| 1352 |
+
console.log('why heree')
|
| 1353 |
+
file=''
|
| 1354 |
+
answers.push(tomeasureproj, 0,[] , ratio1, ratio2 ,pdfpath);
|
| 1355 |
+
formData.append('answers',JSON.stringify(answers))
|
| 1356 |
+
}
|
| 1357 |
}
|
| 1358 |
|
| 1359 |
+
if (formvalues['selectprojs'].startsWith('1.0')||formvalues['selectprojs'].startsWith('3.2'))
|
| 1360 |
{
|
| 1361 |
+
// console.log(formData)
|
| 1362 |
$.ajax({
|
| 1363 |
type: "POST",
|
| 1364 |
+
|
| 1365 |
url: "/savebase64Img/",
|
| 1366 |
|
| 1367 |
// set content type header to use Flask response.get_json()
|
| 1368 |
contentType: "application/json",
|
| 1369 |
|
| 1370 |
// convert data/object to JSON to send
|
| 1371 |
+
data: formData,
|
| 1372 |
+
processData: false, // Prevent jQuery from automatically processing the data
|
| 1373 |
+
contentType: false,
|
| 1374 |
+
// files:formvalues['pdftodxfFilename'],
|
| 1375 |
|
| 1376 |
// expect JSON data in return (e.g. Flask jsonify)
|
| 1377 |
+
// dataType: "json",
|
| 1378 |
|
| 1379 |
// handle response
|
| 1380 |
success: function(response) {
|
|
|
|
| 1417 |
});
|
| 1418 |
|
| 1419 |
if (formvalues['selectprojs'].startsWith('3.2'))
|
| 1420 |
+
{ //
|
| 1421 |
// /* data[0]--> img , data[1]-->dataframe (goes to legend lsa ) , data [2] -->pdf dropbox shareable link ,data[3]-> spreadsheetId, data[4],spreadsheeturl */
|
| 1422 |
SimilarAreaDictionary=data[1];
|
| 1423 |
dropboxLink=data[2];
|
|
|
|
| 1522 |
pdfpath.push(formvalues['selectproj'],formvalues['selectprojp'] ,formvalues['selectprojs'])
|
| 1523 |
var rightsideids=[];
|
| 1524 |
|
| 1525 |
+
if (formvalues['selectprojs'].startsWith('1.0') )// || formvalues['selectprojs'].startsWith('3.2') )
|
| 1526 |
|
| 1527 |
interval= setInterval( function() {
|
| 1528 |
|
|
|
|
| 1722 |
selections1.innerHTML='';
|
| 1723 |
|
| 1724 |
|
| 1725 |
+
for (let m=0;m<MCTNames.length;m++)
|
| 1726 |
+
{
|
| 1727 |
+
var opt0 = document.createElement("OPTION") ;
|
| 1728 |
+
opt0.text= MCTNames[m][0];
|
| 1729 |
+
opt0.textContent= MCTNames[m][0];
|
| 1730 |
+
opt0.value= MCTNames[m][0];
|
| 1731 |
+
selections1.add(opt0);
|
| 1732 |
+
}
|
| 1733 |
+
console.log(section.value.toString())
|
| 1734 |
+
|
| 1735 |
+
}
|
| 1736 |
+
else if(( (inputs1.value=='Floor' ) || (inputs1.value=='Wall' ) ) & (!selections1.value))//& (selections.value.startsWith('Pile') || !selections.value )) || (inputs.children[0].value=='pile caps' & (selections.value.startsWith('Ground') || !selections.value )))
|
| 1737 |
+
{
|
| 1738 |
+
selections1.innerHTML='';
|
| 1739 |
+
|
| 1740 |
+
|
| 1741 |
for (let m=0;m<MCTNames.length;m++)
|
| 1742 |
{
|
| 1743 |
var opt0 = document.createElement("OPTION") ;
|
|
|
|
| 1847 |
}
|
| 1848 |
|
| 1849 |
}
|
| 1850 |
+
else if(( (inputs.value=='Floor' ) || (inputs.value=='Wall' ) ) & (!selections.value))//& (selections.value.startsWith('Pile') || !selections.value )) || (inputs.children[0].value=='pile caps' & (selections.value.startsWith('Ground') || !selections.value )))
|
| 1851 |
+
{
|
| 1852 |
+
selections.innerHTML='';
|
| 1853 |
+
|
| 1854 |
+
for (let m=0;m<MCTNames.length;m++)
|
| 1855 |
+
{
|
| 1856 |
+
var opt0 = document.createElement("OPTION") ;
|
| 1857 |
+
opt0.text= MCTNames[m][0];
|
| 1858 |
+
opt0.textContent= MCTNames[m][0];
|
| 1859 |
+
opt0.value= MCTNames[m][0];
|
| 1860 |
+
selections.add(opt0);
|
| 1861 |
+
}
|
| 1862 |
+
|
| 1863 |
+
}
|
| 1864 |
|
| 1865 |
// if (inputs.value=='Floor' & (selections.value.startsWith('Wall') || !selections.value )){
|
| 1866 |
// selections.innerHTML='';
|
|
|
|
| 2330 |
var savecanvas=document.getElementById('savecanvas');
|
| 2331 |
|
| 2332 |
levelsin.addEventListener('click',function(){
|
| 2333 |
+
if (projsec.value.startsWith('1.0'))
|
| 2334 |
+
{
|
| 2335 |
document.getElementById("all").style.display = "block";
|
| 2336 |
if( document.getElementById('levelcheckbox').checked)
|
| 2337 |
{
|
|
|
|
| 2408 |
canvasimg=image.src;
|
| 2409 |
})
|
| 2410 |
}
|
| 2411 |
+
}
|
| 2412 |
+
else{
|
| 2413 |
+
PopupElement.textContent='Levels are not supported in this Section. ';
|
| 2414 |
+
ShowPopUp();
|
| 2415 |
+
document.getElementById('levelcheckbox').checked=false;
|
| 2416 |
+
}
|
| 2417 |
})
|
| 2418 |
//___________________________________________________________________________________________________________
|
| 2419 |
function getSecondData(){
|
|
|
|
| 2651 |
newlabelsec.textContent=prjSectionsforLgnd[cc];
|
| 2652 |
newlabelsec.id='prjsec';
|
| 2653 |
newlabelsec.className='prjsecclass';
|
| 2654 |
+
if (!(newlabelsec.textContent.toString().startsWith('1.0') ) && !(newlabelsec.textContent.toString().startsWith('3.2') ) )//|| newlabelsec.textContent.startsWith('2.2') || newlabelsec.textContent.startsWith('2.1')))
|
| 2655 |
{
|
| 2656 |
newlabelsec.style.color='lightgray';
|
| 2657 |
i.style.color='lightgray'
|
|
|
|
| 3005 |
opt=document.createElement("option");
|
| 3006 |
opt.textContent=dataa[2][d];
|
| 3007 |
opt.text=dataa[2][d];
|
| 3008 |
+
if(!(dataa[2][d].startsWith('1.0') ) &&(data[i].startsWith('3.2') ))//||data[i].startsWith('2.2')))
|
| 3009 |
{
|
| 3010 |
opt.style.color='#bdbcbc';
|
| 3011 |
opt.style.cursor='not-allowed';
|