Spaces:
Sleeping
Sleeping
Update templates/proposed-GUI.html
Browse files- templates/proposed-GUI.html +184 -89
templates/proposed-GUI.html
CHANGED
|
@@ -1533,104 +1533,199 @@ function getData(form) {
|
|
| 1533 |
pdfpath.push(formvalues['selectproj'],formvalues['selectprojp'] ,formvalues['selectprojs'])
|
| 1534 |
var rightsideids=[];
|
| 1535 |
|
| 1536 |
-
if (formvalues['selectprojs'].startsWith('1.0') )// || formvalues['selectprojs'].startsWith('3.2') )
|
|
|
|
|
|
|
|
|
|
| 1537 |
|
| 1538 |
-
|
| 1539 |
-
|
| 1540 |
-
const delay = ms => new Promise(res => setTimeout(res, ms));
|
| 1541 |
-
delay(3000)
|
| 1542 |
|
| 1543 |
-
|
| 1544 |
-
|
| 1545 |
-
|
| 1546 |
-
|
| 1547 |
-
|
| 1548 |
-
|
| 1549 |
-
|
| 1550 |
-
|
| 1551 |
-
|
| 1552 |
-
|
| 1553 |
-
|
| 1554 |
-
|
| 1555 |
-
|
| 1556 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1557 |
|
| 1558 |
-
|
| 1559 |
-
|
| 1560 |
-
|
| 1561 |
-
|
| 1562 |
-
|
| 1563 |
-
|
| 1564 |
-
|
| 1565 |
-
|
| 1566 |
-
|
| 1567 |
-
|
| 1568 |
-
|
| 1569 |
-
|
| 1570 |
-
|
| 1571 |
-
|
| 1572 |
-
|
| 1573 |
-
|
| 1574 |
-
|
| 1575 |
-
|
| 1576 |
-
|
| 1577 |
-
|
| 1578 |
-
|
| 1579 |
-
|
| 1580 |
-
|
| 1581 |
-
|
| 1582 |
-
|
| 1583 |
-
|
| 1584 |
-
|
| 1585 |
-
|
| 1586 |
-
|
| 1587 |
-
|
| 1588 |
-
|
| 1589 |
-
success: function(response) {
|
| 1590 |
-
console.log(data2)
|
| 1591 |
-
},
|
| 1592 |
-
error: function(err) {
|
| 1593 |
-
PopupElement.textContent='Error occured. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
|
| 1594 |
-
ShowPopUp();
|
| 1595 |
-
}
|
| 1596 |
-
})
|
| 1597 |
-
|
| 1598 |
}
|
| 1599 |
-
}
|
| 1600 |
-
}
|
| 1601 |
},
|
| 1602 |
-
|
| 1603 |
-
|
| 1604 |
-
|
|
|
|
|
|
|
| 1605 |
}
|
| 1606 |
-
|
| 1607 |
-
|
| 1608 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1609 |
|
|
|
|
|
|
|
| 1610 |
|
| 1611 |
-
|
| 1612 |
-
type: "POST",
|
| 1613 |
-
url: "/_submission",
|
| 1614 |
-
// set content type header to use Flask response.get_json()
|
| 1615 |
-
contentType: "application/json",
|
| 1616 |
-
// convert data/object to JSON to send
|
| 1617 |
-
data: JSON.stringify({dict1: JSON.stringify(list1),
|
| 1618 |
-
spreadsheetId:spreadsheetId,
|
| 1619 |
-
pdfpathpath:JSON.stringify(pdfpath),
|
| 1620 |
-
path:Object.fromEntries(formData)['measureselectname']}),
|
| 1621 |
-
// expect JSON data in return (e.g. Flask jsonify)
|
| 1622 |
-
dataType: "json",
|
| 1623 |
-
// handle response
|
| 1624 |
-
success: function(data11) {
|
| 1625 |
-
delrows2=data11[0];
|
| 1626 |
-
},
|
| 1627 |
-
error: function(err) {
|
| 1628 |
-
PopupElement.textContent='Error occured. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
|
| 1629 |
-
ShowPopUp();
|
| 1630 |
-
}
|
| 1631 |
-
})
|
| 1632 |
|
| 1633 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1634 |
|
| 1635 |
|
| 1636 |
|
|
|
|
| 1533 |
pdfpath.push(formvalues['selectproj'],formvalues['selectprojp'] ,formvalues['selectprojs'])
|
| 1534 |
var rightsideids=[];
|
| 1535 |
|
| 1536 |
+
if (formvalues['selectprojs'].startsWith('1.0') )// || formvalues['selectprojs'].startsWith('3.2') )
|
| 1537 |
+
{
|
| 1538 |
+
// Set the interval in milliseconds
|
| 1539 |
+
const interval = 10000;
|
| 1540 |
|
| 1541 |
+
// Function to handle the delay
|
| 1542 |
+
const delay = ms => new Promise(res => setTimeout(res, ms));
|
|
|
|
|
|
|
| 1543 |
|
| 1544 |
+
// Function to perform AJAX requests and compare data
|
| 1545 |
+
function fetchAndCompareData() {
|
| 1546 |
+
// First AJAX request
|
| 1547 |
+
$.ajax({
|
| 1548 |
+
type: "POST",
|
| 1549 |
+
url: "/_submission",
|
| 1550 |
+
contentType: "application/json",
|
| 1551 |
+
data: JSON.stringify({
|
| 1552 |
+
dict1: JSON.stringify(list1),
|
| 1553 |
+
spreadsheetId: spreadsheetId,
|
| 1554 |
+
pdfpathpath: JSON.stringify(pdfpath),
|
| 1555 |
+
path: Object.fromEntries(formData)['measureselectname']
|
| 1556 |
+
}),
|
| 1557 |
+
dataType: "json",
|
| 1558 |
+
success: function(data1) {
|
| 1559 |
+
// if (data1.length > 0) {
|
| 1560 |
+
const delrows1 = data1[0];
|
| 1561 |
+
if(data1.length >0)
|
| 1562 |
+
{
|
| 1563 |
+
// Wait for the delay
|
| 1564 |
+
delay(10000);
|
| 1565 |
+
|
| 1566 |
+
// Second AJAX request
|
| 1567 |
+
$.ajax({
|
| 1568 |
+
type: "POST",
|
| 1569 |
+
url: "/_submission",
|
| 1570 |
+
contentType: "application/json",
|
| 1571 |
+
data: JSON.stringify({
|
| 1572 |
+
dict1: JSON.stringify(list1),
|
| 1573 |
+
spreadsheetId: spreadsheetId,
|
| 1574 |
+
pdfpathpath: JSON.stringify(pdfpath),
|
| 1575 |
+
path: Object.fromEntries(formData)['measureselectname']
|
| 1576 |
+
}),
|
| 1577 |
+
dataType: "json",
|
| 1578 |
+
success: function(data11) {
|
| 1579 |
|
| 1580 |
+
const delrows2 = data11[0];
|
| 1581 |
+
console.log('rowssssss',delrows1,delrows2)
|
| 1582 |
+
if (JSON.stringify(delrows1) === JSON.stringify(delrows2)) {
|
| 1583 |
+
console.log('same');
|
| 1584 |
+
} else {
|
| 1585 |
+
console.log('differences found', delrows1);
|
| 1586 |
+
if (confirm("Changes have been made in the markups. Would you like to save and view them in the legend?")) {
|
| 1587 |
+
$.ajax({
|
| 1588 |
+
type: "POST",
|
| 1589 |
+
url: "/deletemarkupsroute",
|
| 1590 |
+
contentType: "application/json",
|
| 1591 |
+
data: JSON.stringify({
|
| 1592 |
+
dict: JSON.stringify(SimilarAreaDictionary),
|
| 1593 |
+
deletedrows: delrows1,
|
| 1594 |
+
path: Object.fromEntries(formData)['measureselectname'],
|
| 1595 |
+
spreadsheetId: spreadsheetId,
|
| 1596 |
+
areaPermArr: JSON.stringify(data[7]),
|
| 1597 |
+
section: Object.fromEntries(formData)['selectprojs'],
|
| 1598 |
+
pdfpathpath: JSON.stringify(pdfpath)
|
| 1599 |
+
}),
|
| 1600 |
+
dataType: "json",
|
| 1601 |
+
success: function(response) {
|
| 1602 |
+
console.log('Markups updated');
|
| 1603 |
+
delay(5000)
|
| 1604 |
+
},
|
| 1605 |
+
error: function(err) {
|
| 1606 |
+
PopupElement.textContent = 'Error occurred. Refresh and try again. If the error continues, please contact the ADR team to fix it.';
|
| 1607 |
+
ShowPopUp();
|
| 1608 |
+
}
|
| 1609 |
+
});
|
| 1610 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1611 |
}
|
|
|
|
|
|
|
| 1612 |
},
|
| 1613 |
+
error: function(err) {
|
| 1614 |
+
PopupElement.textContent = 'Error occurred. Refresh and try again. If the error continues, please contact the ADR team to fix it.';
|
| 1615 |
+
ShowPopUp();
|
| 1616 |
+
}
|
| 1617 |
+
});
|
| 1618 |
}
|
| 1619 |
+
},
|
| 1620 |
+
error: function(err) {
|
| 1621 |
+
PopupElement.textContent = 'Error occurred. Refresh and try again. If the error continues, please contact the ADR team to fix it.';
|
| 1622 |
+
ShowPopUp();
|
| 1623 |
+
}
|
| 1624 |
+
});
|
| 1625 |
+
}
|
| 1626 |
|
| 1627 |
+
// Set the interval to call the function
|
| 1628 |
+
setInterval(fetchAndCompareData, interval);
|
| 1629 |
|
| 1630 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1631 |
|
| 1632 |
+
// interval= setInterval( function() {
|
| 1633 |
+
|
| 1634 |
+
// const delay = ms => new Promise(res => setTimeout(res, ms));
|
| 1635 |
+
// delay(3000)
|
| 1636 |
+
|
| 1637 |
+
// $.ajax({
|
| 1638 |
+
// type: "POST",
|
| 1639 |
+
// url: "/_submission",
|
| 1640 |
+
// // set content type header to use Flask response.get_json()
|
| 1641 |
+
// contentType: "application/json",
|
| 1642 |
+
// // convert data/object to JSON to send
|
| 1643 |
+
// data: JSON.stringify({dict1: JSON.stringify(list1),
|
| 1644 |
+
// spreadsheetId:spreadsheetId,
|
| 1645 |
+
// pdfpathpath:JSON.stringify(pdfpath),
|
| 1646 |
+
// path:Object.fromEntries(formData)['measureselectname']}),
|
| 1647 |
+
// // expect JSON data in return (e.g. Flask jsonify)
|
| 1648 |
+
// dataType: "json",
|
| 1649 |
+
// // handle response
|
| 1650 |
+
// success: function(data1){
|
| 1651 |
+
|
| 1652 |
+
// if(data1.length >0){
|
| 1653 |
+
// delrows1=data1[0];
|
| 1654 |
+
// // console.log(data1, delrows1,delrows2)
|
| 1655 |
+
// // console.log(typeof delrows1)
|
| 1656 |
+
// // console.log(typeof delrows2)
|
| 1657 |
+
// if (JSON.stringify(delrows1)=== JSON.stringify(delrows2))
|
| 1658 |
+
// {
|
| 1659 |
+
// console.log('same')
|
| 1660 |
+
// }
|
| 1661 |
+
// else{
|
| 1662 |
+
// // if (data1[0]==1){
|
| 1663 |
+
// // return data1[0];
|
| 1664 |
+
// flag=1
|
| 1665 |
+
// console.log('jjjj')
|
| 1666 |
+
// if (confirm("Changes have been made in the markups. Would you like to save and view them in the legend?")) {
|
| 1667 |
+
// console.log('kkkkk')
|
| 1668 |
+
// $.ajax({
|
| 1669 |
+
// type: "POST",
|
| 1670 |
+
// url: "/deletemarkupsroute",
|
| 1671 |
+
// // set content type header to use Flask response.get_json()
|
| 1672 |
+
// contentType: "application/json",
|
| 1673 |
+
// // convert data/object to JSON to send
|
| 1674 |
+
// data: JSON.stringify({ dict: JSON.stringify(SimilarAreaDictionary),
|
| 1675 |
+
// deletedrows: JSON.stringify(delrows1),
|
| 1676 |
+
// path:Object.fromEntries(formData)['measureselectname'],
|
| 1677 |
+
// spreadsheetId:spreadsheetId,
|
| 1678 |
+
// areaPermArr: JSON.stringify(data[7]),
|
| 1679 |
+
// section: Object.fromEntries(formData)['selectprojs'],
|
| 1680 |
+
// pdfpathpath:JSON.stringify(pdfpath),}),
|
| 1681 |
+
// // expect JSON data in return (e.g. Flask jsonify)
|
| 1682 |
+
// dataType: "json",
|
| 1683 |
+
// // handle response
|
| 1684 |
+
// success: function(response) {
|
| 1685 |
+
// console.log(data2)
|
| 1686 |
+
// },
|
| 1687 |
+
// error: function(err) {
|
| 1688 |
+
// PopupElement.textContent='Error occured. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
|
| 1689 |
+
// ShowPopUp();
|
| 1690 |
+
// }
|
| 1691 |
+
// })
|
| 1692 |
+
|
| 1693 |
+
// }
|
| 1694 |
+
// }
|
| 1695 |
+
// }
|
| 1696 |
+
// },
|
| 1697 |
+
// error: function(err) {
|
| 1698 |
+
// PopupElement.textContent='Error occured. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
|
| 1699 |
+
// ShowPopUp();
|
| 1700 |
+
// }
|
| 1701 |
+
// })
|
| 1702 |
+
|
| 1703 |
+
// delay(4000);
|
| 1704 |
+
|
| 1705 |
+
|
| 1706 |
+
// $.ajax({
|
| 1707 |
+
// type: "POST",
|
| 1708 |
+
// url: "/_submission",
|
| 1709 |
+
// // set content type header to use Flask response.get_json()
|
| 1710 |
+
// contentType: "application/json",
|
| 1711 |
+
// // convert data/object to JSON to send
|
| 1712 |
+
// data: JSON.stringify({dict1: JSON.stringify(list1),
|
| 1713 |
+
// spreadsheetId:spreadsheetId,
|
| 1714 |
+
// pdfpathpath:JSON.stringify(pdfpath),
|
| 1715 |
+
// path:Object.fromEntries(formData)['measureselectname']}),
|
| 1716 |
+
// // expect JSON data in return (e.g. Flask jsonify)
|
| 1717 |
+
// dataType: "json",
|
| 1718 |
+
// // handle response
|
| 1719 |
+
// success: function(data11) {
|
| 1720 |
+
// delrows2=data11[0];
|
| 1721 |
+
// },
|
| 1722 |
+
// error: function(err) {
|
| 1723 |
+
// PopupElement.textContent='Error occured. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
|
| 1724 |
+
// ShowPopUp();
|
| 1725 |
+
// }
|
| 1726 |
+
// })
|
| 1727 |
+
|
| 1728 |
+
// },7000)
|
| 1729 |
|
| 1730 |
|
| 1731 |
|