commit 02/10/2025
This commit is contained in:
@@ -1,17 +1,4 @@
|
|||||||
/**
|
|
||||||
* @typedef {Object} BroadcastZone
|
|
||||||
* @property {number} index
|
|
||||||
* @property {string} description
|
|
||||||
* @property {String} SoundChannel
|
|
||||||
* @property {String} Box
|
|
||||||
* @property {String} Relay
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* List of broadcast zones available
|
|
||||||
* @type {BroadcastZone[]}
|
|
||||||
*/
|
|
||||||
window.BroadcastZoneList ??= [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Currently selected broadcast zone row in the table
|
* Currently selected broadcast zone row in the table
|
||||||
@@ -55,22 +42,7 @@ function fill_broadcastzonetablebody(vv) {
|
|||||||
$('#tablesize').text("Table Size: " + vv.length);
|
$('#tablesize').text("Table Size: " + vv.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reload broadcast zones from server
|
|
||||||
* @param {String} APIURL API URL endpoint (default "BroadcastZones/")
|
|
||||||
*/
|
|
||||||
function reloadBroadcastZones(APIURL = "BroadcastZones/") {
|
|
||||||
window.BroadcastZoneList = [];
|
|
||||||
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
|
||||||
if (Array.isArray(okdata)) {
|
|
||||||
//console.log("reloadBroadcastZones : ", okdata)
|
|
||||||
window.BroadcastZoneList.push(...okdata);
|
|
||||||
fill_broadcastzonetablebody(window.BroadcastZoneList);
|
|
||||||
} else console.log("reloadBroadcastZones: okdata is not array");
|
|
||||||
}, (errdata) => {
|
|
||||||
alert("Error loading broadcast zones : " + errdata.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
console.log("broadcastzones.js loaded successfully");
|
console.log("broadcastzones.js loaded successfully");
|
||||||
@@ -140,11 +112,14 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadBroadcastZones(APIURL_BroadcastZone);
|
reloadBroadcastZones(APIURL_BroadcastZone, () => {
|
||||||
|
fill_broadcastzonetablebody(window.BroadcastZoneList);
|
||||||
|
});
|
||||||
|
|
||||||
$btnClear.click(() => {
|
$btnClear.click(() => {
|
||||||
DoClear(APIURL_BroadcastZone, "BroadcastZones", (okdata) => {
|
DoClear(APIURL_BroadcastZone, "BroadcastZones", (okdata) => {
|
||||||
reloadBroadcastZones(APIURL_BroadcastZone);
|
reloadBroadcastZones(APIURL_BroadcastZone);
|
||||||
|
fill_broadcastzonetablebody(window.BroadcastZoneList);
|
||||||
alert("Success clear broadcast zones: " + okdata.message);
|
alert("Success clear broadcast zones: " + okdata.message);
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error clear broadcast zones: " + errdata.message);
|
alert("Error clear broadcast zones: " + errdata.message);
|
||||||
@@ -190,8 +165,10 @@ $(document).ready(function () {
|
|||||||
Relay: relay
|
Relay: relay
|
||||||
};
|
};
|
||||||
fetchAPI(APIURL_BroadcastZone + "Add", "POST", {}, bz, (okdata) => {
|
fetchAPI(APIURL_BroadcastZone + "Add", "POST", {}, bz, (okdata) => {
|
||||||
reloadBroadcastZones(APIURL_BroadcastZone);
|
reloadBroadcastZones(APIURL_BroadcastZone, () => {
|
||||||
|
fill_broadcastzonetablebody(window.BroadcastZoneList);
|
||||||
alert("Success add new broadcast zone: " + okdata.message);
|
alert("Success add new broadcast zone: " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error add new broadcast zone: " + errdata.message);
|
alert("Error add new broadcast zone: " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -216,8 +193,10 @@ $(document).ready(function () {
|
|||||||
};
|
};
|
||||||
if (confirm(`Are you sure to delete broadcast zone [${bz.index}] Description=${bz.description}?`)) {
|
if (confirm(`Are you sure to delete broadcast zone [${bz.index}] Description=${bz.description}?`)) {
|
||||||
fetchAPI(APIURL_BroadcastZone + "DeleteByIndex/" + bz.index, "DELETE", {}, null, (okdata) => {
|
fetchAPI(APIURL_BroadcastZone + "DeleteByIndex/" + bz.index, "DELETE", {}, null, (okdata) => {
|
||||||
reloadBroadcastZones(APIURL_BroadcastZone);
|
reloadBroadcastZones(APIURL_BroadcastZone, () => {
|
||||||
|
fill_broadcastzonetablebody(window.BroadcastZoneList);
|
||||||
alert("Success delete broadcast zone: " + okdata.message);
|
alert("Success delete broadcast zone: " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error delete broadcast zone: " + errdata.message);
|
alert("Error delete broadcast zone: " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -283,8 +262,10 @@ $(document).ready(function () {
|
|||||||
Relay: relay
|
Relay: relay
|
||||||
};
|
};
|
||||||
fetchAPI(APIURL_BroadcastZone + "UpdateByIndex/" + bz.index, "PATCH", {}, bzUpdate, (okdata) => {
|
fetchAPI(APIURL_BroadcastZone + "UpdateByIndex/" + bz.index, "PATCH", {}, bzUpdate, (okdata) => {
|
||||||
reloadBroadcastZones(APIURL_BroadcastZone);
|
reloadBroadcastZones(APIURL_BroadcastZone, () => {
|
||||||
|
fill_broadcastzonetablebody(window.BroadcastZoneList);
|
||||||
alert("Success edit broadcast zone: " + okdata.message);
|
alert("Success edit broadcast zone: " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error edit broadcast zone: " + errdata.message);
|
alert("Error edit broadcast zone: " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -303,8 +284,10 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
$btnImport.click(() => {
|
$btnImport.click(() => {
|
||||||
DoImport(APIURL_BroadcastZone, (okdata) => {
|
DoImport(APIURL_BroadcastZone, (okdata) => {
|
||||||
reloadBroadcastZones(APIURL_BroadcastZone);
|
reloadBroadcastZones(APIURL_BroadcastZone, () => {
|
||||||
|
fill_broadcastzonetablebody(window.BroadcastZoneList);
|
||||||
alert("Success import broadcast zones: " + okdata.message);
|
alert("Success import broadcast zones: " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error importing broadcast zones from XLSX: " + errdata.message);
|
alert("Error importing broadcast zones from XLSX: " + errdata.message);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,15 +1,4 @@
|
|||||||
/**
|
|
||||||
* @typedef {Object} LanguageBank
|
|
||||||
* @property {number} index
|
|
||||||
* @property {string} tag
|
|
||||||
* @property {string} language
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** List of Languagebank data loaded from server
|
|
||||||
* @type {LanguageBank[]}
|
|
||||||
*/
|
|
||||||
window.languagebankdata = [];
|
|
||||||
/**
|
/**
|
||||||
* Currently selected languagebank row in the table
|
* Currently selected languagebank row in the table
|
||||||
* @type {JQuery<HTMLElement>|null}
|
* @type {JQuery<HTMLElement>|null}
|
||||||
@@ -50,22 +39,7 @@ function fill_languagebanktablebody(vv) {
|
|||||||
$('#tablesize').text("Table Size: " + vv.length);
|
$('#tablesize').text("Table Size: " + vv.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reload language bank from server
|
|
||||||
* @param {string} APIURL API URL endpoint, default "LanguageLink/"
|
|
||||||
*/
|
|
||||||
function reloadLanguageBank(APIURL = "LanguageLink/") {
|
|
||||||
window.languagebankdata = [];
|
|
||||||
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
|
||||||
if (Array.isArray(okdata)) {
|
|
||||||
window.languagebankdata.push(...okdata);
|
|
||||||
window.selectedlanguagerow = null;
|
|
||||||
fill_languagebanktablebody(window.languagebankdata);
|
|
||||||
}
|
|
||||||
}, (errdata) => {
|
|
||||||
alert("Error loading languagebank : " + errdata.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
console.log('languagebank.js loaded');
|
console.log('languagebank.js loaded');
|
||||||
@@ -115,11 +89,15 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
reloadLanguageBank(APIURL);
|
reloadLanguageBank(APIURL, () => {
|
||||||
|
fill_languagebanktablebody(window.languagebankdata);
|
||||||
|
});
|
||||||
$btnClear.click(() => {
|
$btnClear.click(() => {
|
||||||
DoClear(APIURL, "LanguageLink", (okdata) => {
|
DoClear(APIURL, "LanguageLink", (okdata) => {
|
||||||
reloadLanguageBank(APIURL);
|
reloadLanguageBank(APIURL, () => {
|
||||||
|
fill_languagebanktablebody(window.languagebankdata);
|
||||||
alert("Success clear languageLink : " + okdata.message);
|
alert("Success clear languageLink : " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error clear languageLink : " + errdata.message);
|
alert("Error clear languageLink : " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -156,8 +134,10 @@ $(document).ready(function () {
|
|||||||
language: langString
|
language: langString
|
||||||
}
|
}
|
||||||
fetchAPI(APIURL + "Add", "POST", {}, ll, (okdata) => {
|
fetchAPI(APIURL + "Add", "POST", {}, ll, (okdata) => {
|
||||||
|
reloadLanguageBank(APIURL, () => {
|
||||||
|
fill_languagebanktablebody(window.languagebankdata);
|
||||||
alert("Success add language : " + okdata.message);
|
alert("Success add language : " + okdata.message);
|
||||||
reloadLanguageBank(APIURL);
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error add language : " + errdata.message);
|
alert("Error add language : " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -181,8 +161,10 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
if (confirm(`Are you sure to delete language [${ll.index}] Tag=${ll.tag} Language=${ll.language}?`)) {
|
if (confirm(`Are you sure to delete language [${ll.index}] Tag=${ll.tag} Language=${ll.language}?`)) {
|
||||||
fetchAPI(APIURL + "DeleteByIndex/" + ll.index, "DELETE", {}, null, (okdata) => {
|
fetchAPI(APIURL + "DeleteByIndex/" + ll.index, "DELETE", {}, null, (okdata) => {
|
||||||
reloadLanguageBank(APIURL);
|
reloadLanguageBank(APIURL, () => {
|
||||||
|
fill_languagebanktablebody(window.languagebankdata);
|
||||||
alert("Success delete language : " + okdata.message);
|
alert("Success delete language : " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error delete language : " + errdata.message);
|
alert("Error delete language : " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -239,8 +221,10 @@ $(document).ready(function () {
|
|||||||
ll.tag = tag;
|
ll.tag = tag;
|
||||||
ll.language = langString;
|
ll.language = langString;
|
||||||
fetchAPI(APIURL + "UpdateByIndex/" + ll.index, "PATCH", {}, ll, (okdata) => {
|
fetchAPI(APIURL + "UpdateByIndex/" + ll.index, "PATCH", {}, ll, (okdata) => {
|
||||||
reloadLanguageBank(APIURL);
|
reloadLanguageBank(APIURL, () => {
|
||||||
|
fill_languagebanktablebody(window.languagebankdata);
|
||||||
alert("Success edit language : " + okdata.message);
|
alert("Success edit language : " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error edit language : " + errdata.message);
|
alert("Error edit language : " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -262,8 +246,10 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
$btnImport.click(() => {
|
$btnImport.click(() => {
|
||||||
DoImport(APIURL, (okdata) => {
|
DoImport(APIURL, (okdata) => {
|
||||||
reloadLanguageBank(APIURL);
|
reloadLanguageBank(APIURL, () => {
|
||||||
|
fill_languagebanktablebody(window.languagebankdata);
|
||||||
alert("Success import languagebank : " + okdata.message);
|
alert("Success import languagebank : " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error importing languagebank from XLSX : " + errdata.message);
|
alert("Error importing languagebank from XLSX : " + errdata.message);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,19 +1,4 @@
|
|||||||
/**
|
|
||||||
* @typedef {Object} MessageBank
|
|
||||||
* @property {number} index
|
|
||||||
* @property {string} description
|
|
||||||
* @property {string} language
|
|
||||||
* @property {number} aNN_ID
|
|
||||||
* @property {string} voice_Type
|
|
||||||
* @property {string} message_Detail
|
|
||||||
* @property {string} message_TAGS
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* List of Messagebank data loaded from server
|
|
||||||
* @type {MessageBank[]}
|
|
||||||
*/
|
|
||||||
window.messagebankdata ??= [];
|
|
||||||
/**
|
/**
|
||||||
* Currently selected messagebank row in the table
|
* Currently selected messagebank row in the table
|
||||||
* @type {JQuery<HTMLElement>|null}
|
* @type {JQuery<HTMLElement>|null}
|
||||||
@@ -59,22 +44,7 @@ function fill_messagebanktablebody(vv) {
|
|||||||
$('#tablesize').text("Table Size: " + vv.length);
|
$('#tablesize').text("Table Size: " + vv.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reload message bank from server
|
|
||||||
* @param {string} APIURL API URL endpoint, default "MessageBank/"
|
|
||||||
*/
|
|
||||||
function reloadMessageBank(APIURL = "MessageBank/") {
|
|
||||||
window.messagebankdata ??= [];
|
|
||||||
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
|
||||||
if (Array.isArray(okdata)) {
|
|
||||||
window.messagebankdata.push(...okdata);
|
|
||||||
window.selectedmessagerow = null;
|
|
||||||
fill_messagebanktablebody(window.messagebankdata);
|
|
||||||
}
|
|
||||||
}, (errdata) => {
|
|
||||||
alert("Error loading messagebank : " + errdata.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
console.log("messagebank.js loaded");
|
console.log("messagebank.js loaded");
|
||||||
@@ -208,11 +178,15 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
reloadMessageBank(APIURL);
|
reloadMessageBank(APIURL, () => {
|
||||||
|
fill_messagebanktablebody(window.messagebankdata);
|
||||||
|
});
|
||||||
$btnClear.click(() => {
|
$btnClear.click(() => {
|
||||||
DoClear(APIURL, "Messagebank", (okdata) => {
|
DoClear(APIURL, "Messagebank", (okdata) => {
|
||||||
reloadMessageBank(APIURL);
|
reloadMessageBank(APIURL, () => {
|
||||||
|
fill_messagebanktablebody(window.messagebankdata);
|
||||||
alert("Success clear messagebank : " + okdata.message);
|
alert("Success clear messagebank : " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error clear messagebank : " + errdata.message);
|
alert("Error clear messagebank : " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -287,8 +261,10 @@ $(document).ready(function () {
|
|||||||
};
|
};
|
||||||
// send to server using fetchAPI
|
// send to server using fetchAPI
|
||||||
fetchAPI(APIURL + "Add", "POST", mb, null, (okdata) => {
|
fetchAPI(APIURL + "Add", "POST", mb, null, (okdata) => {
|
||||||
reloadMessageBank(APIURL);
|
reloadMessageBank(APIURL, () => {
|
||||||
|
fill_messagebanktablebody(window.messagebankdata);
|
||||||
alert("Success add new messagebank : " + okdata.message);
|
alert("Success add new messagebank : " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error add new messagebank : " + errdata.message);
|
alert("Error add new messagebank : " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -316,8 +292,10 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
if (confirm(`Are you sure to delete messagebank [${mb.index}] Description=${mb.description}? ANN_ID=${mb.aNN_ID} Language=${mb.language} Voice_Type=${mb.voice_Type} `)) {
|
if (confirm(`Are you sure to delete messagebank [${mb.index}] Description=${mb.description}? ANN_ID=${mb.aNN_ID} Language=${mb.language} Voice_Type=${mb.voice_Type} `)) {
|
||||||
fetchAPI(APIURL + "DeleteByIndex/" + mb.index, "DELETE", {}, null, (okdata) => {
|
fetchAPI(APIURL + "DeleteByIndex/" + mb.index, "DELETE", {}, null, (okdata) => {
|
||||||
reloadMessageBank(APIURL);
|
reloadMessageBank(APIURL, () => {
|
||||||
|
fill_messagebanktablebody(window.messagebankdata);
|
||||||
alert("Success delete messagebank : " + okdata.message);
|
alert("Success delete messagebank : " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error delete messagebank : " + errdata.message);
|
alert("Error delete messagebank : " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -423,8 +401,10 @@ $(document).ready(function () {
|
|||||||
Message_TAGS: messagetags
|
Message_TAGS: messagetags
|
||||||
};
|
};
|
||||||
fetchAPI(APIURL + "UpdateByIndex/" + mb.index, "PATCH", mbUpdate, null, (okdata) => {
|
fetchAPI(APIURL + "UpdateByIndex/" + mb.index, "PATCH", mbUpdate, null, (okdata) => {
|
||||||
reloadMessageBank(APIURL);
|
reloadMessageBank(APIURL, () => {
|
||||||
|
fill_messagebanktablebody(window.messagebankdata);
|
||||||
alert("Success edit messagebank : " + okdata.message);
|
alert("Success edit messagebank : " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error edit messagebank : " + errdata.message);
|
alert("Error edit messagebank : " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -443,8 +423,11 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
$btnImport.click(() => {
|
$btnImport.click(() => {
|
||||||
DoImport(APIURL, (okdata) => {
|
DoImport(APIURL, (okdata) => {
|
||||||
reloadMessageBank(APIURL);
|
reloadMessageBank(APIURL, () => {
|
||||||
|
fill_messagebanktablebody(window.messagebankdata);
|
||||||
alert("Success import messagebank : " + okdata.message);
|
alert("Success import messagebank : " + okdata.message);
|
||||||
|
});
|
||||||
|
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error importing messagebank from XLSX : " + errdata.message);
|
alert("Error importing messagebank from XLSX : " + errdata.message);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,20 +1,4 @@
|
|||||||
/**
|
|
||||||
* @typedef {Object} ScheduleBank
|
|
||||||
* @property {number} index
|
|
||||||
* @property {string} description
|
|
||||||
* @property {string} day
|
|
||||||
* @property {string} time
|
|
||||||
* @property {string} soundpath
|
|
||||||
* @property {number} repeat
|
|
||||||
* @property {boolean} enable
|
|
||||||
* @property {string} broadcastZones
|
|
||||||
* @property {string} language
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** List of Schedulebank data loaded from server
|
|
||||||
* @type {ScheduleBank[]}
|
|
||||||
*/
|
|
||||||
window.schedulebankdata = [];
|
|
||||||
/**
|
/**
|
||||||
* Currently selected schedulebank row in the table
|
* Currently selected schedulebank row in the table
|
||||||
* @type {JQuery<HTMLElement>|null}
|
* @type {JQuery<HTMLElement>|null}
|
||||||
@@ -61,22 +45,7 @@ function fill_schedulebanktablebody(vv) {
|
|||||||
$('#tablesize').text("Table Size: " + vv.length);
|
$('#tablesize').text("Table Size: " + vv.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reload timer bank from server
|
|
||||||
* @param {string} APIURL API URL endpoint, default "ScheduleBank/"
|
|
||||||
*/
|
|
||||||
function reloadTimerBank(APIURL = "ScheduleBank/") {
|
|
||||||
window.schedulebankdata = [];
|
|
||||||
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
|
||||||
if (Array.isArray(okdata)) {
|
|
||||||
window.schedulebankdata.push(...okdata);
|
|
||||||
selectedschedulerow = null;
|
|
||||||
fill_schedulebanktablebody(window.schedulebankdata);
|
|
||||||
}
|
|
||||||
}, (errdata) => {
|
|
||||||
alert("Error loading schedulebank : " + errdata.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
console.log("schedulebank.js loaded successfully");
|
console.log("schedulebank.js loaded successfully");
|
||||||
@@ -101,7 +70,7 @@ $(document).ready(function () {
|
|||||||
let $schedulehour = $schedulemodal.find('#schedulehour');
|
let $schedulehour = $schedulemodal.find('#schedulehour');
|
||||||
// number input 0-59
|
// number input 0-59
|
||||||
let $scheduleminute = $schedulemodal.find('#scheduleminute');
|
let $scheduleminute = $schedulemodal.find('#scheduleminute');
|
||||||
// text input
|
// select for messagebank
|
||||||
let $schedulesoundpath = $schedulemodal.find('#schedulesoundpath');
|
let $schedulesoundpath = $schedulemodal.find('#schedulesoundpath');
|
||||||
// number input 0-5
|
// number input 0-5
|
||||||
let $schedulerepeat = $schedulemodal.find('#schedulerepeat');
|
let $schedulerepeat = $schedulemodal.find('#schedulerepeat');
|
||||||
@@ -137,8 +106,17 @@ $(document).ready(function () {
|
|||||||
$scheduledescription.val('');
|
$scheduledescription.val('');
|
||||||
$schedulehour.val('0');
|
$schedulehour.val('0');
|
||||||
$scheduleminute.val('0');
|
$scheduleminute.val('0');
|
||||||
$schedulesoundpath.val('');
|
|
||||||
$schedulerepeat.val('0');
|
$schedulesoundpath.empty();
|
||||||
|
if (Array.isArray(window.messagebankdata) && window.messagebankdata.length > 0) {
|
||||||
|
window.messagebankdata.forEach(item => {
|
||||||
|
let str = item.description+" ["+item.aNN_ID+"]";
|
||||||
|
let option = `<option value="${str}">${str}</option>`;
|
||||||
|
if ($schedulesoundpath.find(`option[value="${str}"]`).length === 0) $schedulesoundpath.append(option); // check if $schedulesoundpath already has this option
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
$schedulerepeat.val('1');
|
||||||
$scheduleenable.prop('checked', true);
|
$scheduleenable.prop('checked', true);
|
||||||
$scheduleeveryday.prop('checked', false);
|
$scheduleeveryday.prop('checked', false);
|
||||||
$schedulesunday.prop('checked', false);
|
$schedulesunday.prop('checked', false);
|
||||||
@@ -171,11 +149,15 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
reloadTimerBank(APIURL);
|
reloadTimerBank(APIURL, () => {
|
||||||
|
fill_schedulebanktablebody(window.schedulebankdata);
|
||||||
|
});
|
||||||
$btnClear.click(() => {
|
$btnClear.click(() => {
|
||||||
DoClear(APIURL, "Timerbank", (okdata) => {
|
DoClear(APIURL, "Timerbank", (okdata) => {
|
||||||
reloadTimerBank(APIURL);
|
reloadTimerBank(APIURL,() => {
|
||||||
|
fill_schedulebanktablebody(window.schedulebankdata);
|
||||||
alert("Success clear schedulebank : " + okdata.message);
|
alert("Success clear schedulebank : " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error clear schedulebank : " + errdata.message);
|
alert("Error clear schedulebank : " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -236,8 +218,10 @@ $(document).ready(function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fetchAPI(APIURL + "Add", "POST", {}, scheduleObj, (okdata) => {
|
fetchAPI(APIURL + "Add", "POST", {}, scheduleObj, (okdata) => {
|
||||||
|
reloadTimerBank(APIURL, () => {
|
||||||
|
fill_schedulebanktablebody(window.schedulebankdata);
|
||||||
alert("Success add schedule: " + okdata.message);
|
alert("Success add schedule: " + okdata.message);
|
||||||
reloadTimerBank(APIURL);
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error add schedule: " + errdata.message);
|
alert("Error add schedule: " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -262,8 +246,10 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
if (confirm(`Are you sure to delete schedule [${sr.index}] Description=${sr.description}?`)) {
|
if (confirm(`Are you sure to delete schedule [${sr.index}] Description=${sr.description}?`)) {
|
||||||
fetchAPI(APIURL + "DeleteByIndex/" + sr.index, "DELETE", {}, null, (okdata) => {
|
fetchAPI(APIURL + "DeleteByIndex/" + sr.index, "DELETE", {}, null, (okdata) => {
|
||||||
reloadTimerBank(APIURL);
|
reloadTimerBank(APIURL, () => {
|
||||||
|
fill_schedulebanktablebody(window.schedulebankdata);
|
||||||
alert("Success delete schedule : " + okdata.message);
|
alert("Success delete schedule : " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error delete schedule : " + errdata.message);
|
alert("Error delete schedule : " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -380,8 +366,10 @@ $(document).ready(function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fetchAPI(APIURL + "UpdateByIndex/" + sr.index, "PATCH", {}, scheduleObj, (okdata) => {
|
fetchAPI(APIURL + "UpdateByIndex/" + sr.index, "PATCH", {}, scheduleObj, (okdata) => {
|
||||||
|
reloadTimerBank(APIURL, () => {
|
||||||
|
fill_schedulebanktablebody(window.schedulebankdata);
|
||||||
alert("Success edit schedule: " + okdata.message);
|
alert("Success edit schedule: " + okdata.message);
|
||||||
reloadTimerBank(APIURL);
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error edit schedule: " + errdata.message);
|
alert("Error edit schedule: " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -396,8 +384,10 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
$btnImport.click(() => {
|
$btnImport.click(() => {
|
||||||
DoImport(APIURL, (okdata) => {
|
DoImport(APIURL, (okdata) => {
|
||||||
reloadTimerBank(APIURL);
|
reloadTimerBank(APIURL, () => {
|
||||||
|
fill_schedulebanktablebody(window.schedulebankdata);
|
||||||
alert("Success import schedulebank from XLSX : " + okdata.message);
|
alert("Success import schedulebank from XLSX : " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error importing schedulebank from XLSX : " + errdata.message);
|
alert("Error importing schedulebank from XLSX : " + errdata.message);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -20,6 +20,263 @@ window.languages = [];
|
|||||||
*/
|
*/
|
||||||
window.scheduledays = []
|
window.scheduledays = []
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} MessageBank
|
||||||
|
* @property {number} index
|
||||||
|
* @property {string} description
|
||||||
|
* @property {string} language
|
||||||
|
* @property {number} aNN_ID
|
||||||
|
* @property {string} voice_Type
|
||||||
|
* @property {string} message_Detail
|
||||||
|
* @property {string} message_TAGS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of Messagebank data loaded from server
|
||||||
|
* taruh di sini karena dipakai di banyak tempat
|
||||||
|
* @type {MessageBank[]}
|
||||||
|
*/
|
||||||
|
window.messagebankdata ??= [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload message bank from server
|
||||||
|
* @param {string} APIURL API URL endpoint, default "MessageBank/"
|
||||||
|
* @param {Function|null} callback Optional callback function to execute after loading
|
||||||
|
*/
|
||||||
|
function reloadMessageBank(APIURL = "MessageBank/", callback=null) {
|
||||||
|
window.messagebankdata ??= [];
|
||||||
|
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
||||||
|
if (Array.isArray(okdata)) {
|
||||||
|
window.messagebankdata.push(...okdata);
|
||||||
|
console.log("Loaded " + window.messagebankdata.length + " message bank items");
|
||||||
|
window.selectedmessagerow = null;
|
||||||
|
if (callback && typeof callback === 'function') callback();
|
||||||
|
}
|
||||||
|
}, (errdata) => {
|
||||||
|
alert("Error loading messagebank : " + errdata.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ScheduleBank
|
||||||
|
* @property {number} index
|
||||||
|
* @property {string} description
|
||||||
|
* @property {string} day
|
||||||
|
* @property {string} time
|
||||||
|
* @property {string} soundpath
|
||||||
|
* @property {number} repeat
|
||||||
|
* @property {boolean} enable
|
||||||
|
* @property {string} broadcastZones
|
||||||
|
* @property {string} language
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** List of Schedulebank data loaded from server
|
||||||
|
* @type {ScheduleBank[]}
|
||||||
|
*/
|
||||||
|
window.schedulebankdata = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload timer bank from server
|
||||||
|
* taruh di sini karena dipakai di banyak tempat
|
||||||
|
* @param {string} APIURL API URL endpoint, default "ScheduleBank/"
|
||||||
|
* @param {Function|null} callback Optional callback function to execute after loading
|
||||||
|
*/
|
||||||
|
function reloadTimerBank(APIURL = "ScheduleBank/", callback=null) {
|
||||||
|
window.schedulebankdata = [];
|
||||||
|
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
||||||
|
if (Array.isArray(okdata)) {
|
||||||
|
window.schedulebankdata.push(...okdata);
|
||||||
|
selectedschedulerow = null;
|
||||||
|
console.log("Loaded " + window.schedulebankdata.length + " schedule bank items");
|
||||||
|
if (callback && typeof callback === 'function') callback();
|
||||||
|
}
|
||||||
|
}, (errdata) => {
|
||||||
|
alert("Error loading schedulebank : " + errdata.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} BroadcastZone
|
||||||
|
* @property {number} index
|
||||||
|
* @property {string} description
|
||||||
|
* @property {String} SoundChannel
|
||||||
|
* @property {String} Box
|
||||||
|
* @property {String} Relay
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of broadcast zones available
|
||||||
|
* @type {BroadcastZone[]}
|
||||||
|
*/
|
||||||
|
window.BroadcastZoneList ??= [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload broadcast zones from server
|
||||||
|
* taruh di sini karena dipakai di banyak tempat
|
||||||
|
* @param {String} APIURL API URL endpoint (default "BroadcastZones/")
|
||||||
|
* @param {Function|null} callback Optional callback function to execute after loading
|
||||||
|
*/
|
||||||
|
function reloadBroadcastZones(APIURL = "BroadcastZones/", callback=null) {
|
||||||
|
window.BroadcastZoneList = [];
|
||||||
|
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
||||||
|
if (Array.isArray(okdata)) {
|
||||||
|
//console.log("reloadBroadcastZones : ", okdata)
|
||||||
|
window.BroadcastZoneList.push(...okdata);
|
||||||
|
console.log("Loaded " + window.BroadcastZoneList.length + " broadcast zone items");
|
||||||
|
window.selectedbroadcastzonerow = null;
|
||||||
|
if (callback && typeof callback === 'function') callback();
|
||||||
|
} else console.log("reloadBroadcastZones: okdata is not array");
|
||||||
|
}, (errdata) => {
|
||||||
|
alert("Error loading broadcast zones : " + errdata.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} SoundBank
|
||||||
|
* @property {number} index
|
||||||
|
* @property {string} description
|
||||||
|
* @property {string} tag
|
||||||
|
* @property {string} category
|
||||||
|
* @property {string} language
|
||||||
|
* @property {string} voiceType
|
||||||
|
* @property {string} path
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} Select2item
|
||||||
|
* @property {number} id
|
||||||
|
* @property {string} text
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of Soundbank data loaded from server
|
||||||
|
* taruh di sini karena dipakai di banyak tempat
|
||||||
|
* @type {SoundBank[]}
|
||||||
|
*/
|
||||||
|
window.soundbankdata = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of sound files in the soundbank directory, that ends with .wav or .mp3
|
||||||
|
* taruh di sini karena dipakai di banyak tempat
|
||||||
|
* @type {string[]}
|
||||||
|
*/
|
||||||
|
window.soundbankfiles = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select2 data source
|
||||||
|
* See https://select2.org/data-sources/formats
|
||||||
|
* @type {Select2item[]}
|
||||||
|
*/
|
||||||
|
window.select2data = [];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload sound bank from server
|
||||||
|
* @param {String} APIURL API URL endpoint, default "SoundBank/"
|
||||||
|
* @param {Function|null} callback Optional callback function to execute after loading
|
||||||
|
*/
|
||||||
|
function reloadSoundBank(APIURL = "SoundBank/", callback=null) {
|
||||||
|
window.soundbankdata = [];
|
||||||
|
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
||||||
|
|
||||||
|
if (Array.isArray(okdata)) {
|
||||||
|
window.soundbankdata.push(...okdata);
|
||||||
|
window.selectedsoundrow = null;
|
||||||
|
console.log("Loaded " + window.soundbankdata.length + " sound bank items");
|
||||||
|
if (callback && typeof callback === 'function') callback();
|
||||||
|
}
|
||||||
|
}, (errdata) => {
|
||||||
|
alert("Error loading soundbank : " + errdata.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload soundbank files from server
|
||||||
|
* @param {String} APIURL API URL endpoint (default "SoundBank/")
|
||||||
|
* @param {Function|null} callback Optional callback function to execute after loading
|
||||||
|
*/
|
||||||
|
function reloadSoundbankFiles(APIURL = "SoundBank/",callback=null) {
|
||||||
|
window.soundbankfiles = [];
|
||||||
|
fetchAPI(APIURL + "ListFiles", "GET", {}, null, (okdata) => {
|
||||||
|
// okdata is a string contains elements separated by semicolon ;
|
||||||
|
if (Array.isArray(okdata)) {
|
||||||
|
window.soundbankfiles = okdata.filter(item => item.trim().length > 0);
|
||||||
|
// refill select2data
|
||||||
|
window.select2data = window.soundbankfiles.map((item, index) => ({ id: index + 1, text: item }));
|
||||||
|
console.log("Loaded " + window.soundbankfiles.length + " sound bank files");
|
||||||
|
if (callback && typeof callback === 'function') callback();
|
||||||
|
} else console.log("reloadSoundbankFiles: okdata is not array");
|
||||||
|
}, (errdata) => {
|
||||||
|
alert("Error loading soundbank files : " + errdata.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload sound channels from server
|
||||||
|
* @param {String} APIURL API URL endpoint (default "SoundChannel/")
|
||||||
|
* @param {Function|null} callback Optional callback function to execute after loading
|
||||||
|
*/
|
||||||
|
function reloadSoundChannel(APIURL = "SoundChannel/", callback=null) {
|
||||||
|
window.soundChannels = [];
|
||||||
|
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
||||||
|
if (Array.isArray(okdata)) {
|
||||||
|
//console.log("reloadSoundChannel : ", okdata)
|
||||||
|
window.soundChannels.push(...okdata);
|
||||||
|
window.selectedsoundchannelrow = null;
|
||||||
|
console.log("Loaded " + window.soundChannels.length + " sound channel items");
|
||||||
|
if (callback && typeof callback === 'function') callback();
|
||||||
|
} else console.log("reloadSoundChannel: okdata is not array");
|
||||||
|
}, (errdata) => {
|
||||||
|
alert("Error loading sound channels : " + errdata.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} LanguageBank
|
||||||
|
* @property {number} index
|
||||||
|
* @property {string} tag
|
||||||
|
* @property {string} language
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** List of Languagebank data loaded from server
|
||||||
|
* @type {LanguageBank[]}
|
||||||
|
*/
|
||||||
|
window.languagebankdata = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload language bank from server
|
||||||
|
* @param {string} APIURL API URL endpoint, default "LanguageLink/"
|
||||||
|
* @param {Function|null} callback Optional callback function to execute after loading
|
||||||
|
*/
|
||||||
|
function reloadLanguageBank(APIURL = "LanguageLink/", callback=null) {
|
||||||
|
window.languagebankdata = [];
|
||||||
|
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
||||||
|
if (Array.isArray(okdata)) {
|
||||||
|
window.languagebankdata.push(...okdata);
|
||||||
|
window.selectedlanguagerow = null;
|
||||||
|
console.log("Loaded " + window.languagebankdata.length + " language bank items");
|
||||||
|
if (callback && typeof callback === 'function') callback();
|
||||||
|
}
|
||||||
|
}, (errdata) => {
|
||||||
|
alert("Error loading languagebank : " + errdata.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a list item element
|
* Create a list item element
|
||||||
* @param {String} text Text Content for the list item
|
* @param {String} text Text Content for the list item
|
||||||
@@ -311,7 +568,13 @@ $(document).ready(function () {
|
|||||||
getCategories();
|
getCategories();
|
||||||
getLanguages();
|
getLanguages();
|
||||||
getScheduledDays();
|
getScheduledDays();
|
||||||
|
reloadMessageBank();
|
||||||
|
reloadTimerBank();
|
||||||
|
reloadBroadcastZones();
|
||||||
|
reloadSoundBank();
|
||||||
|
reloadSoundbankFiles();
|
||||||
|
reloadSoundChannel();
|
||||||
|
reloadLanguageBank();
|
||||||
|
|
||||||
// Initialize WebSocket connection
|
// Initialize WebSocket connection
|
||||||
window.ws = new WebSocket(wsURL);
|
window.ws = new WebSocket(wsURL);
|
||||||
|
|||||||
@@ -1,61 +1,11 @@
|
|||||||
/**
|
|
||||||
* @typedef {Object} SoundBank
|
|
||||||
* @property {number} index
|
|
||||||
* @property {string} description
|
|
||||||
* @property {string} tag
|
|
||||||
* @property {string} category
|
|
||||||
* @property {string} language
|
|
||||||
* @property {string} voiceType
|
|
||||||
* @property {string} path
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} Select2item
|
|
||||||
* @property {number} id
|
|
||||||
* @property {string} text
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* List of Soundbank data loaded from server
|
|
||||||
* @type {SoundBank[]}
|
|
||||||
*/
|
|
||||||
window.soundbankdata = [];
|
|
||||||
/**
|
/**
|
||||||
* Currently selected soundbank row in the table
|
* Currently selected soundbank row in the table
|
||||||
* @type {JQuery<HTMLElement>|null}
|
* @type {JQuery<HTMLElement>|null}
|
||||||
*/
|
*/
|
||||||
window.selectedsoundrow = null;
|
window.selectedsoundrow = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* List of sound files in the soundbank directory, that ends with .wav or .mp3
|
|
||||||
* @type {string[]}
|
|
||||||
*/
|
|
||||||
window.soundbankfiles = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Select2 data source
|
|
||||||
* See https://select2.org/data-sources/formats
|
|
||||||
* @type {Select2item[]}
|
|
||||||
*/
|
|
||||||
window.select2data = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reload sound bank from server
|
|
||||||
* @param {String} APIURL API URL endpoint, default "SoundBank/"
|
|
||||||
*/
|
|
||||||
function reloadSoundBank(APIURL = "SoundBank/") {
|
|
||||||
window.soundbankdata = [];
|
|
||||||
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
|
||||||
|
|
||||||
if (Array.isArray(okdata)) {
|
|
||||||
window.soundbankdata.push(...okdata);
|
|
||||||
window.selectedsoundrow = null;
|
|
||||||
fill_soundbanktablebody(window.soundbankdata);
|
|
||||||
}
|
|
||||||
}, (errdata) => {
|
|
||||||
alert("Error loading soundbank : " + errdata.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill soundbank table body with values
|
* Fill soundbank table body with values
|
||||||
@@ -63,6 +13,7 @@ function reloadSoundBank(APIURL = "SoundBank/") {
|
|||||||
*/
|
*/
|
||||||
function fill_soundbanktablebody(vv) {
|
function fill_soundbanktablebody(vv) {
|
||||||
$('#soundbanktablebody').empty();
|
$('#soundbanktablebody').empty();
|
||||||
|
console.log("Filling soundbank table with " + vv.length + " items");
|
||||||
if (!Array.isArray(vv) || vv.length === 0) return;
|
if (!Array.isArray(vv) || vv.length === 0) return;
|
||||||
vv.forEach(item => {
|
vv.forEach(item => {
|
||||||
const row = `<tr>
|
const row = `<tr>
|
||||||
@@ -98,23 +49,7 @@ function fill_soundbanktablebody(vv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reload soundbank files from server
|
|
||||||
* @param {String} APIURL API URL endpoint (default "SoundBank/")
|
|
||||||
*/
|
|
||||||
function reloadSoundbankFiles(APIURL = "SoundBank/") {
|
|
||||||
window.soundbankfiles = [];
|
|
||||||
fetchAPI(APIURL + "ListFiles", "GET", {}, null, (okdata) => {
|
|
||||||
// okdata is a string contains elements separated by semicolon ;
|
|
||||||
if (Array.isArray(okdata)) {
|
|
||||||
window.soundbankfiles = okdata.filter(item => item.trim().length > 0);
|
|
||||||
// refill select2data
|
|
||||||
window.select2data = window.soundbankfiles.map((item, index) => ({ id: index + 1, text: item }));
|
|
||||||
} else console.log("reloadSoundbankFiles: okdata is not array");
|
|
||||||
}, (errdata) => {
|
|
||||||
alert("Error loading soundbank files : " + errdata.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
console.log("soundbank.js loaded successfully");
|
console.log("soundbank.js loaded successfully");
|
||||||
@@ -172,7 +107,10 @@ $(document).ready(function () {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadSoundBank(APIURL);
|
reloadSoundBank(APIURL, () => {
|
||||||
|
fill_soundbanktablebody(window.soundbankdata);
|
||||||
|
});
|
||||||
|
|
||||||
$('#findsoundbank').on('input', function () {
|
$('#findsoundbank').on('input', function () {
|
||||||
let searchTerm = $(this).val().trim().toLowerCase();
|
let searchTerm = $(this).val().trim().toLowerCase();
|
||||||
if (searchTerm.length > 0) {
|
if (searchTerm.length > 0) {
|
||||||
@@ -186,8 +124,10 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
$btnClear.click(() => {
|
$btnClear.click(() => {
|
||||||
DoClear(APIURL, "Soundbank", (okdata) => {
|
DoClear(APIURL, "Soundbank", (okdata) => {
|
||||||
reloadSoundBank(APIURL);
|
reloadSoundBank(APIURL, () => {
|
||||||
|
fill_soundbanktablebody(window.soundbankdata);
|
||||||
alert("Success clear soundbank : " + okdata.message);
|
alert("Success clear soundbank : " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error clear soundbank : " + errdata.message);
|
alert("Error clear soundbank : " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -222,8 +162,10 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
if (confirm(`Are you sure to delete soundbank [${sb.index}] Description=${sb.description} Tag=${sb.tag}?`)) {
|
if (confirm(`Are you sure to delete soundbank [${sb.index}] Description=${sb.description} Tag=${sb.tag}?`)) {
|
||||||
fetchAPI(APIURL + "DeleteByIndex/" + sb.index, "DELETE", {}, null, (okdata) => {
|
fetchAPI(APIURL + "DeleteByIndex/" + sb.index, "DELETE", {}, null, (okdata) => {
|
||||||
reloadSoundBank(APIURL);
|
reloadSoundBank(APIURL, () => {
|
||||||
|
fill_soundbanktablebody(window.soundbankdata);
|
||||||
alert("Success delete soundbank : " + okdata.message);
|
alert("Success delete soundbank : " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error delete soundbank : " + errdata.message);
|
alert("Error delete soundbank : " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -265,8 +207,10 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
$btnImport.click(() => {
|
$btnImport.click(() => {
|
||||||
DoImport(APIURL, (okdata) => {
|
DoImport(APIURL, (okdata) => {
|
||||||
reloadSoundBank(APIURL);
|
reloadSoundBank(APIURL, () => {
|
||||||
|
fill_soundbanktablebody(window.soundbankdata);
|
||||||
alert("Success import soundbank : " + okdata.message);
|
alert("Success import soundbank : " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error importing soundbank from XLSX : " + errdata.message);
|
alert("Error importing soundbank from XLSX : " + errdata.message);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,14 +1,4 @@
|
|||||||
/**
|
|
||||||
* @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
|
// Currently selected sound channel row in the table
|
||||||
window.selectedSoundChannel = null;
|
window.selectedSoundChannel = null;
|
||||||
@@ -51,22 +41,7 @@ function fill_soundchanneltablebody(vv) {
|
|||||||
$tablesizeSoundChannel.text("Table Size: " + vv.length);
|
$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 () {
|
$(document).ready(function () {
|
||||||
console.log("soundchannel.js loaded successfully");
|
console.log("soundchannel.js loaded successfully");
|
||||||
@@ -108,11 +83,15 @@ $(document).ready(function () {
|
|||||||
$soundchannelip.val('');
|
$soundchannelip.val('');
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadSoundChannel(API_SoundChannel);
|
reloadSoundChannel(API_SoundChannel, () => {
|
||||||
|
fill_soundchanneltablebody(window.soundChannels);
|
||||||
|
});
|
||||||
$btnReinitializeSoundChannel.click(() => {
|
$btnReinitializeSoundChannel.click(() => {
|
||||||
DoClear(API_SoundChannel, "SoundChannels", (okdata) => {
|
DoClear(API_SoundChannel, "SoundChannels", (okdata) => {
|
||||||
reloadSoundChannel(API_SoundChannel);
|
reloadSoundChannel(API_SoundChannel, () => {
|
||||||
|
fill_soundchanneltablebody(window.soundChannels);
|
||||||
alert("Success clear sound channels: " + okdata.message);
|
alert("Success clear sound channels: " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error clear sound channels: " + errdata.message);
|
alert("Error clear sound channels: " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -156,8 +135,10 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
|
|
||||||
fetchAPI(API_SoundChannel + "UpdateByIndex/" + newsc.index, "PATCH", {}, newsc, (okdata) => {
|
fetchAPI(API_SoundChannel + "UpdateByIndex/" + newsc.index, "PATCH", {}, newsc, (okdata) => {
|
||||||
reloadSoundChannel(API_SoundChannel);
|
reloadSoundChannel(API_SoundChannel, () => {
|
||||||
|
fill_soundchanneltablebody(window.soundChannels);
|
||||||
alert("Success edit sound channel: " + okdata.message);
|
alert("Success edit sound channel: " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error edit sound channel: " + errdata.message);
|
alert("Error edit sound channel: " + errdata.message);
|
||||||
});
|
});
|
||||||
@@ -177,8 +158,10 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
$btnImportSoundChannel.click(() => {
|
$btnImportSoundChannel.click(() => {
|
||||||
DoImport(API_SoundChannel, (okdata) => {
|
DoImport(API_SoundChannel, (okdata) => {
|
||||||
reloadSoundChannel(API_SoundChannel);
|
reloadSoundChannel(API_SoundChannel, () => {
|
||||||
|
fill_soundchanneltablebody(window.soundChannels);
|
||||||
alert("Success import sound channels: " + okdata.message);
|
alert("Success import sound channels: " + okdata.message);
|
||||||
|
});
|
||||||
}, (errdata) => {
|
}, (errdata) => {
|
||||||
alert("Error importing sound channels from XLSX: " + errdata.message);
|
alert("Error importing sound channels from XLSX: " + errdata.message);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -148,7 +148,7 @@
|
|||||||
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4">
|
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4">
|
||||||
<p class="text-add">Sound Path</p>
|
<p class="text-add">Sound Path</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-8 col-sm-8 col-md-8 col-lg-8 col-xl-8"><input type="text" id="schedulesoundpath" class="input-add form-control"></div>
|
<div class="col-8 col-sm-8 col-md-8 col-lg-8 col-xl-8"><select id="schedulesoundpath" class="input-add form-control"></select></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4">
|
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4">
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import java.net.InetSocketAddress
|
|||||||
import java.util.function.BiConsumer
|
import java.util.function.BiConsumer
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
|
|
||||||
|
@Deprecated("Sepertinya gak jadi pake")
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
/**
|
/**
|
||||||
* UDPReceiverToFile is a class that listens for UDP packets on a specified address and port
|
* UDPReceiverToFile is a class that listens for UDP packets on a specified address and port
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import kotlinx.coroutines.CoroutineScope
|
|||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
@Deprecated("Sepertinya gak jadi pake ini")
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
class UDPSenderFromFile(val fileName: String, val bytesPerPackage: Int=1024, targetIP: Array<String>, targetPort: Int ) {
|
class UDPSenderFromFile(val fileName: String, val bytesPerPackage: Int=1024, targetIP: Array<String>, targetPort: Int ) {
|
||||||
val bass: Bass = Bass.Instance
|
val bass: Bass = Bass.Instance
|
||||||
|
|||||||
@@ -651,6 +651,9 @@ class WebApp(val listenPort: Int, val userlist: List<Pair<String, String>>) {
|
|||||||
it.status(500).result(objectmapper.writeValueAsString(resultMessage("Failed to truncate schedulebank table")))
|
it.status(500).result(objectmapper.writeValueAsString(resultMessage("Failed to truncate schedulebank table")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
post("Add"){
|
||||||
|
// TODO add new schedule
|
||||||
|
}
|
||||||
delete("DeleteByIndex/{index}") {
|
delete("DeleteByIndex/{index}") {
|
||||||
// delete by index
|
// delete by index
|
||||||
val index = it.pathParam("index").toUIntOrNull()
|
val index = it.pathParam("index").toUIntOrNull()
|
||||||
|
|||||||
Reference in New Issue
Block a user