Created At: 2026-06-14T15:58:06Z
Completed At: 2026-06-14T15:58:06Z
File Path: `file:///c:/Users/HP/Downloads/climate-system/climate-system/index.php`
Total Lines: 3856
Total Bytes: 159351
Showing lines 2340 to 2400
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.
2340:           document.getElementById('historicalImageMonthlyGraph').src = PLACEHOLDER_IMG;
2341:           alert('Belum ada data climate tersimpan untuk filter ini!');
2342:         }
2343:       } catch (err) {
2344:         console.error(err);
2345:         alert('Gagal memuat data dari database server.');
2346:       }
2347:     }
2348: 
2349:     // Mengirim data baru Historical Climate ke backend (settings)
2350:     async function saveHistoricalData() {
2351:       const lokasi = document.getElementById('historicalSetLocation').value.trim();
2352:       const variable = document.getElementById('historicalSetVariable').value.trim();
2353:       const description = document.getElementById('historicalSetDescription').value.trim();
2354:       const imageAnnual = normalizeImageUrl(document.getElementById('historicalSetImage').value.trim());
2355:       const imageTrend = normalizeImageUrl(document.getElementById('historicalSetImageTrend').value.trim());
2356:       const imageTimeSeries = normalizeImageUrl(document.getElementById('historicalSetImageTimeSeries').value.trim());
2357:       const imageMonthlyMap = normalizeImageUrl(document.getElementById('historicalSetImageMonthlyMap').value.trim());
2358:       const imageMonthlyGraph = normalizeImageUrl(document.getElementById('historicalSetImageMonthlyGraph').value.trim());
2359: 
2360:       if (!lokasi || !variable) {
2361:         alert('Nama lokasi dan nama variable wajib diisi!');
2362:         return;
2363:       }
2364: 
2365:       const data = {
2366:         location: lokasi,
2367:         variable: variable,
2368:         description: description,
2369:         imageAnnual: imageAnnual,
2370:         imageTrend: imageTrend,
2371:         imageTimeSeries: imageTimeSeries,
2372:         imageMonthlyMap: imageMonthlyMap,
2373:         imageMonthlyGraph: imageMonthlyGraph
2374:       };
2375: 
2376:       try {
2377:         const res = await fetch('?action=save_historical', {
2378:           method: 'POST',
2379:           headers: {
2380:             'Content-Type': 'application/json'
2381:           },
2382:           body: JSON.stringify(data)
2383:         });
2384:         const result = await res.json();
2385:         
2386:         if (result.success) {
2387:           alert('Data historical berhasil disimpan ke database SQLite!');
2388:           // Segera perbarui dropdown list filter
2389:           await loadFilters();
2390:         } else {
2391:           alert('Gagal menyimpan: ' + (result.error || result.message));
2392:         }
2393:       } catch (err) {
2394:         console.error(err);
2395:         alert('Gagal mengirim data penyimpanan ke server.');
2396:       }
2397:     }
2398: 
2399:     // Global chart instance to avoid "Canvas is already in use" error in Chart.js
2400:     let futureClimateChart = null;
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.
