Fix database model associations and update API route

This commit is contained in:
newtbot
2024-01-27 20:15:29 +08:00
parent 6190cb63cd
commit d491750916
14 changed files with 61 additions and 164 deletions

View File

@ -5,8 +5,6 @@ document.addEventListener("DOMContentLoaded", function () {
const aqi = "15";
const temperature = "25°C";
const humidity = "60%";
const pm25 = "10";
const pm10 = "20";
const so2 = "5";
const o3 = "35";
const co = "0.5";
@ -15,7 +13,6 @@ document.addEventListener("DOMContentLoaded", function () {
infoContainer.innerHTML = `
<div class="additional-info-box">
<h3>Additional Information - ${region}</h3>
<button id="viewData">View Data</button>
<div class="info-item">
<span class="info-label">Air Quality Index:</span>
<span class="info-value">${aqi}</span>
@ -28,14 +25,6 @@ document.addEventListener("DOMContentLoaded", function () {
<span class="info-label">Humidity:</span>
<span class="info-value">${humidity}</span>
</div>
<div class="info-item">
<span class="info-label">PM2.5:</span>
<span class="info-value">${pm25}</span>
</div>
<div class="info-item">
<span class="info-label">PM10:</span>
<span class="info-value">${pm10}</span>
</div>
<div class="info-item">
<span class="info-label">SO2:</span>
<span class="info-value">${so2}</span>
@ -54,21 +43,6 @@ document.addEventListener("DOMContentLoaded", function () {
</div>
</div>
`;
var viewDataButton = document.getElementById("viewData");
// Add a click event listener to the button
viewDataButton.addEventListener("click", function () {
// Redirect to the "viewdata.ejs" page
window.location.href = "/viewdata";
});
// Remove the 'active' class from all info-box elements
const infoBoxes = document.querySelectorAll('.info-box');
infoBoxes.forEach(box => box.classList.remove('active'));
// Add the 'active' class to the clicked info-box
const clickedBox = document.getElementById(region.toLowerCase());
clickedBox.classList.add('active');
}