Spaces:
Running
Running
Upload 3 files
Browse files- app.js +18 -0
- index.html +3 -0
- styles.css +32 -0
app.js
CHANGED
|
@@ -13,6 +13,7 @@ const elements = {
|
|
| 13 |
totalAreaRai: document.getElementById("totalAreaRai"),
|
| 14 |
itemCount: document.getElementById("itemCount"),
|
| 15 |
loadingOverlay: document.getElementById("loadingOverlay"),
|
|
|
|
| 16 |
};
|
| 17 |
|
| 18 |
declareLoadingRow("Loading data...");
|
|
@@ -171,6 +172,23 @@ function attachEventListeners() {
|
|
| 171 |
state.adm3 = elements.adm3.value;
|
| 172 |
updateDashboard({ fitBounds: true });
|
| 173 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
}
|
| 175 |
|
| 176 |
function initializeSelects() {
|
|
|
|
| 13 |
totalAreaRai: document.getElementById("totalAreaRai"),
|
| 14 |
itemCount: document.getElementById("itemCount"),
|
| 15 |
loadingOverlay: document.getElementById("loadingOverlay"),
|
| 16 |
+
clearButton: document.getElementById("clearFilters"),
|
| 17 |
};
|
| 18 |
|
| 19 |
declareLoadingRow("Loading data...");
|
|
|
|
| 172 |
state.adm3 = elements.adm3.value;
|
| 173 |
updateDashboard({ fitBounds: true });
|
| 174 |
});
|
| 175 |
+
|
| 176 |
+
if (elements.clearButton) {
|
| 177 |
+
elements.clearButton.addEventListener("click", () => {
|
| 178 |
+
state.adm1 = "";
|
| 179 |
+
state.adm2 = "";
|
| 180 |
+
state.adm3 = "";
|
| 181 |
+
|
| 182 |
+
elements.adm1.value = "";
|
| 183 |
+
elements.adm2.value = "";
|
| 184 |
+
elements.adm3.value = "";
|
| 185 |
+
|
| 186 |
+
elements.adm2.disabled = elements.adm2.options.length <= 1;
|
| 187 |
+
elements.adm3.disabled = elements.adm3.options.length <= 1;
|
| 188 |
+
|
| 189 |
+
updateDashboard({ fitBounds: true });
|
| 190 |
+
});
|
| 191 |
+
}
|
| 192 |
}
|
| 193 |
|
| 194 |
function initializeSelects() {
|
index.html
CHANGED
|
@@ -43,6 +43,9 @@
|
|
| 43 |
<option value="">ทั้งหมด</option>
|
| 44 |
</select>
|
| 45 |
</label>
|
|
|
|
|
|
|
|
|
|
| 46 |
</div>
|
| 47 |
<div class="summary">
|
| 48 |
<div class="card">
|
|
|
|
| 43 |
<option value="">ทั้งหมด</option>
|
| 44 |
</select>
|
| 45 |
</label>
|
| 46 |
+
<button id="clearFilters" type="button" class="clear-btn">
|
| 47 |
+
รีเซ็ตตัวกรอง
|
| 48 |
+
</button>
|
| 49 |
</div>
|
| 50 |
<div class="summary">
|
| 51 |
<div class="card">
|
styles.css
CHANGED
|
@@ -121,6 +121,33 @@ main.dashboard {
|
|
| 121 |
min-width: 140px;
|
| 122 |
}
|
| 123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
.filters select {
|
| 125 |
padding: 0.5rem 0.75rem;
|
| 126 |
border: 1px solid var(--border);
|
|
@@ -283,6 +310,7 @@ main.dashboard {
|
|
| 283 |
.summary {
|
| 284 |
flex: 1 1 auto;
|
| 285 |
width: 100%;
|
|
|
|
| 286 |
}
|
| 287 |
}
|
| 288 |
|
|
@@ -305,6 +333,10 @@ main.dashboard {
|
|
| 305 |
width: 100%;
|
| 306 |
}
|
| 307 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 308 |
.card {
|
| 309 |
width: 100%;
|
| 310 |
}
|
|
|
|
| 121 |
min-width: 140px;
|
| 122 |
}
|
| 123 |
|
| 124 |
+
.filters .clear-btn {
|
| 125 |
+
align-self: stretch;
|
| 126 |
+
margin-top: auto;
|
| 127 |
+
padding: 0.6rem 1rem;
|
| 128 |
+
border: 1px solid #4aa564;
|
| 129 |
+
border-radius: 8px;
|
| 130 |
+
background: #ddf7e4;
|
| 131 |
+
color: #000000;
|
| 132 |
+
font-family: "Kanit", "Segoe UI", sans-serif;
|
| 133 |
+
font-size: 0.9rem;
|
| 134 |
+
font-weight: 400;
|
| 135 |
+
cursor: pointer;
|
| 136 |
+
transition: background 0.2s ease, transform 0.15s ease, color 0.2s ease;
|
| 137 |
+
min-width: 140px;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
.filters .clear-btn:hover {
|
| 141 |
+
background: #a9e9c0;
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
.filters .clear-btn:disabled {
|
| 145 |
+
background: #e0e7e2;
|
| 146 |
+
border-color: #d2d8d3;
|
| 147 |
+
color: #7a867c;
|
| 148 |
+
cursor: not-allowed;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
.filters select {
|
| 152 |
padding: 0.5rem 0.75rem;
|
| 153 |
border: 1px solid var(--border);
|
|
|
|
| 310 |
.summary {
|
| 311 |
flex: 1 1 auto;
|
| 312 |
width: 100%;
|
| 313 |
+
gap: 0.75rem;
|
| 314 |
}
|
| 315 |
}
|
| 316 |
|
|
|
|
| 333 |
width: 100%;
|
| 334 |
}
|
| 335 |
|
| 336 |
+
.filters .clear-btn {
|
| 337 |
+
width: 100%;
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
.card {
|
| 341 |
width: 100%;
|
| 342 |
}
|