commit 23/09/2025
This commit is contained in:
@@ -123,7 +123,17 @@ $(document).ready(function () {
|
||||
function clearBroadcastZoneModal() {
|
||||
$broadcastzoneindex.prop('disabled', true).val('');
|
||||
$broadcastzonedescription.val('');
|
||||
$broadcastzonesoundchannel.val('');
|
||||
// fill broadcastzonesoundchannel from SoundChannelList
|
||||
$broadcastzonesoundchannel.empty();
|
||||
if (Array.isArray(SoundChannelList) && SoundChannelList.length > 0) {
|
||||
// SoundChannelList ada isinya
|
||||
SoundChannelList.forEach(ch => {
|
||||
if (ch.channel && ch.channel.length > 0){
|
||||
// hanya yang punya channel saja
|
||||
$broadcastzonesoundchannel.append($('<option>').val(ch.channel).text(ch.channel));
|
||||
}
|
||||
});
|
||||
}
|
||||
$broadcastzonebox.val('');
|
||||
for (let i = 1; i <= 32; i++) {
|
||||
cbRelay(i).prop('checked', false);
|
||||
@@ -179,7 +189,7 @@ $(document).ready(function () {
|
||||
Box: box,
|
||||
Relay: relay
|
||||
};
|
||||
fetchAPI(APIURL_BroadcastZone + "Add", "POST", bz, null, (okdata) => {
|
||||
fetchAPI(APIURL_BroadcastZone + "Add", "POST", {}, bz, (okdata) => {
|
||||
reloadBroadcastZones(APIURL_BroadcastZone);
|
||||
alert("Success add new broadcast zone: " + okdata.message);
|
||||
}, (errdata) => {
|
||||
@@ -272,7 +282,7 @@ $(document).ready(function () {
|
||||
Box: box,
|
||||
Relay: relay
|
||||
};
|
||||
fetchAPI(APIURL_BroadcastZone + "UpdateByIndex/" + bz.index, "PATCH", bzUpdate, null, (okdata) => {
|
||||
fetchAPI(APIURL_BroadcastZone + "UpdateByIndex/" + bz.index, "PATCH", {}, bzUpdate, (okdata) => {
|
||||
reloadBroadcastZones(APIURL_BroadcastZone);
|
||||
alert("Success edit broadcast zone: " + okdata.message);
|
||||
}, (errdata) => {
|
||||
|
||||
@@ -69,9 +69,16 @@ function fetchAPI(endpoint, method, headers = {}, body = null, cbOK, cbError) {
|
||||
}
|
||||
}
|
||||
fetch(url, options)
|
||||
.then(response => {
|
||||
.then(async(response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok ' + response.statusText);
|
||||
let msg ;
|
||||
try{
|
||||
let _xxx = await response.json();
|
||||
msg = _xxx.message || response.statusText;
|
||||
} catch {
|
||||
msg = await response.statusText;
|
||||
}
|
||||
throw new Error(msg);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
|
||||
@@ -150,7 +150,9 @@ $(document).ready(function () {
|
||||
return;
|
||||
}
|
||||
|
||||
fetchAPI(API_SoundChannel + "UpdateByIndex/" + newsc.index, "PATCH", newsc, null, (okdata) => {
|
||||
|
||||
|
||||
fetchAPI(API_SoundChannel + "UpdateByIndex/" + newsc.index, "PATCH", {}, newsc, (okdata) => {
|
||||
reloadSoundChannel(API_SoundChannel);
|
||||
alert("Success edit sound channel: " + okdata.message);
|
||||
}, (errdata) => {
|
||||
|
||||
Reference in New Issue
Block a user