Created At: 2026-06-14T13:52:23Z
Completed At: 2026-06-14T13:52:23Z
File Path: `file:///c:/Users/HP/Downloads/climate-system/climate-system/index.php`
Total Lines: 4581
Total Bytes: 193572
Showing lines 4070 to 4150
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.
4070:         csvData: csvData
4071:       };
4072: 
4073:       try {
4074:         const res = await fetch('?action=save_future', {
4075:           method: 'POST',
4076:           headers: {
4077:             'Content-Type': 'application/json'
4078:           },
4079:           body: JSON.stringify(data)
4080:         });
4081:         const result = await res.json();
4082: 
4083:         if (result.success) {
4084:           alert('Data parameter grafik proyeksi berhasil disimpan ke database SQLite!');
4085:           // Clear CSV input and indicators
4086:           const csvFileEl = document.getElementById('futureSetCsvFile');
4087:           if (csvFileEl) csvFileEl.value = '';
4088:           const csvDataEl = document.getElementById('futureSetCsvData');
4089:           if (csvDataEl) csvDataEl.value = '';
4090:           const csvIndicatorEl = document.getElementById('csvStatusIndicator');
4091:           if (csvIndicatorEl) csvIndicatorEl.innerText = '';
4092: 
4093:           await loadFilters();
4094:         } else {
4095:           alert('Gagal menyimpan: ' + (result.error || result.message));
4096:         }
4097:       } catch (err) {
4098:         console.error(err);
4099:         alert('Gagal mengirim data penyimpanan ke server.');
4100:       }
4101:     }
4102: 
4103:     // Tambah Lokasi Master
4104:     async function addMasterLocation() {
4105:       const nameInput = document.getElementById('masterLocationName');
4106:       const name = nameInput.value.trim();
4107:       if (!name) {
4108:         alert('Nama lokasi tidak boleh kosong!');
4109:         return;
4110:       }
4111: 
4112:       try {
4113:         const res = await fetch('?action=add_location', {
4114:           method: 'POST',
4115:           headers: {
4116:             'Content-Type': 'application/json'
4117:           },
4118:           body: JSON.stringify({ name })
4119:         });
4120:         const result = await res.json();
4121:         if (result.success) {
4122:           alert('Lokasi master baru berhasil ditambahkan!');
4123:           nameInput.value = '';
4124:           await loadFilters();
4125:         } else {
4126:           alert('Gagal menambah lokasi: ' + (result.error || result.message));
4127:         }
4128:       } catch (err) {
4129:         console.error(err);
4130:         alert('Gagal mengirim permintaan tambah lokasi.');
4131:       }
4132:     }
4133: 
4134:     // Tambah Variabel Master
4135:     async function addMasterVariable() {
4136:       const nameInput = document.getElementById('masterVariableName');
4137:       const name = nameInput.value.trim();
4138:       if (!name) {
4139:         alert('Nama variabel tidak boleh kosong!');
4140:         return;
4141:       }
4142: 
4143:       try {
4144:         const res = await fetch('?action=add_variable', {
4145:           method: 'POST',
4146:           headers: {
4147:             'Content-Type': 'application/json'
4148:           },
4149:           body: JSON.stringify({ name })
4150:         });
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.
