Created At: 2026-06-14T16:18:05Z
Completed At: 2026-06-14T16:18:05Z
File Path: `file:///c:/Users/HP/Downloads/climate-system/climate-system/index.php`
Total Lines: 3882
Total Bytes: 163903
Showing lines 2280 to 2320
The following code has been modified to include a line number before every line, in the format: <line_number>: <original_line>. Please note that any changes targeting the original code should remove the line number, colon, and leading space.
2280:     // ============ DINAMIS: DROPDOWN & API DB ===============
2281:     // ======================================================
2282: 
2283:     async function loadFilters() {
2284:       try {
2285:         const res = await fetch('?action=get_filters');
2286:         const data = await res.json();
2287:         if (data.success) {
2288:           populateDropdown('historicalLocation', data.locations);
2289:           populateDropdown('futureLocation', data.locations);
2290:           populateDropdown('historicalSetLocation', data.locations);
2291:           populateDropdown('futureSetLocation', data.locations);
2292: 
2293:           populateDropdown('historicalVariable', data.variables);
2294:           populateDropdown('futureVariable', data.variables);
2295: 
2296:           populateDropdown('futurePeriod', data.periods);
2297:         }
2298:       } catch (err) {
2299:         console.error('Gagal memuat daftar filter:', err);
2300:       }
2301:     }
2302: 
2303:     function populateDropdown(id, items) {
2304:       const select = document.getElementById(id);
2305:       if (!select) return;
2306:       
2307:       // Ambil nilai terpilih sebelumnya jika ada
2308:       const prevVal = select.value;
2309:       
2310:       // Kosongkan dan isi kembali
2311:       select.replaceChildren();
2312:       items.forEach(item => {
2313:         const opt = document.createElement('option');
2314:         opt.value = item;
2315:         opt.textContent = item;
2316:         select.appendChild(opt);
2317:       });
2318:       
2319:       if (prevVal && items.includes(prevVal)) {
2320:         select.value = prevVal;
The above content does NOT show the entire file contents. If you need to view any lines of the file which were not shown to complete your task, call this tool again to view those lines.
