commit 09/10/2025

User Management belum kelar
This commit is contained in:
2025-10-09 15:49:03 +07:00
parent 2ad26c3ef6
commit d549aee42c
29 changed files with 1535 additions and 662 deletions

View File

@@ -1,4 +1,14 @@
/**
* @typedef {Object} SoundChannel
* @property {number} index - The index of the sound channel.
* @property {string} channel - The name of the sound channel.
* @property {string} ip - The IP address associated with the sound channel.
*/
/**
* @type {SoundChannel[]}
*/
window.soundChannels = [];
// Currently selected sound channel row in the table
window.selectedSoundChannel = null;
@@ -41,7 +51,22 @@ function fill_soundchanneltablebody(vv) {
$tablesizeSoundChannel.text("Table Size: " + vv.length);
}
/**
* Reload sound channels from server
* @param {String} APIURL API URL endpoint (default "SoundChannel/")
*/
function reloadSoundChannel(APIURL = "SoundChannel/") {
window.soundChannels = [];
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
if (Array.isArray(okdata)) {
//console.log("reloadSoundChannel : ", okdata)
window.soundChannels.push(...okdata);
fill_soundchanneltablebody(window.soundChannels);
} else console.log("reloadSoundChannel: okdata is not array");
}, (errdata) => {
alert("Error loading sound channels : " + errdata.message);
});
}
$(document).ready(function () {
console.log("soundchannel.js loaded successfully");
@@ -83,15 +108,11 @@ $(document).ready(function () {
$soundchannelip.val('');
}
reloadSoundChannel(API_SoundChannel, () => {
fill_soundchanneltablebody(window.soundChannels);
});
reloadSoundChannel(API_SoundChannel);
$btnReinitializeSoundChannel.click(() => {
DoClear(API_SoundChannel, "SoundChannels", (okdata) => {
reloadSoundChannel(API_SoundChannel, () => {
fill_soundchanneltablebody(window.soundChannels);
alert("Success clear sound channels: " + okdata.message);
});
reloadSoundChannel(API_SoundChannel);
alert("Success clear sound channels: " + okdata.message);
}, (errdata) => {
alert("Error clear sound channels: " + errdata.message);
});
@@ -135,10 +156,8 @@ $(document).ready(function () {
fetchAPI(API_SoundChannel + "UpdateByIndex/" + newsc.index, "PATCH", {}, newsc, (okdata) => {
reloadSoundChannel(API_SoundChannel, () => {
fill_soundchanneltablebody(window.soundChannels);
alert("Success edit sound channel: " + okdata.message);
});
reloadSoundChannel(API_SoundChannel);
alert("Success edit sound channel: " + okdata.message);
}, (errdata) => {
alert("Error edit sound channel: " + errdata.message);
});
@@ -158,10 +177,8 @@ $(document).ready(function () {
$btnImportSoundChannel.click(() => {
DoImport(API_SoundChannel, (okdata) => {
reloadSoundChannel(API_SoundChannel, () => {
fill_soundchanneltablebody(window.soundChannels);
alert("Success import sound channels: " + okdata.message);
});
reloadSoundChannel(API_SoundChannel);
alert("Success import sound channels: " + okdata.message);
}, (errdata) => {
alert("Error importing sound channels from XLSX: " + errdata.message);
});