commit 10/09/2025
This commit is contained in:
@@ -212,7 +212,7 @@ function fill_messagebanktablebody(vv) {
|
||||
});
|
||||
});
|
||||
|
||||
console.log("loaded " + vv.length + " messagebank items");
|
||||
$('#tablesize').text("Table Size: " + vv.length);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -246,7 +246,7 @@ function fill_languagebanktablebody(vv) {
|
||||
$('#btnEdit').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
console.log("loaded " + vv.length + " languagebank items");
|
||||
$('#tablesize').text("Table Size: " + vv.length);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -286,7 +286,7 @@ function fill_schedulebanktablebody(vv) {
|
||||
$('#btnEdit').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
console.log("loaded " + vv.length + " schedulebank items");
|
||||
$('#tablesize').text("Table Size: " + vv.length);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -306,7 +306,7 @@ function fill_logtablebody(vv) {
|
||||
</tr>`;
|
||||
$('#logtablebody').append(row);
|
||||
});
|
||||
console.log("loaded " + vv.length + " log items");
|
||||
$('#tablesize').text("Table Size: " + vv.length);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -349,21 +349,21 @@ function fetchAPI(endpoint, method, headers = {}, body = null, cbOK, cbError) {
|
||||
options.headers['Content-Type'] = 'application/json';
|
||||
}
|
||||
}
|
||||
console.log("About to fetch from " + url + " with options", options);
|
||||
//console.log("About to fetch from " + url + " with options", options);
|
||||
fetch(url, options)
|
||||
.then(response => {
|
||||
console.log("fetchAPI: received response", response);
|
||||
//console.log("fetchAPI: received response", response);
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok ' + response.statusText);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
console.log("fetchAPI: received data", data);
|
||||
.then(data => {
|
||||
//console.log("fetchAPI: received data", data);
|
||||
cbOK(data);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('There was a problem with the fetch operation:', error);
|
||||
// console.error('There was a problem with the fetch operation:', error);
|
||||
cbError(error);
|
||||
});
|
||||
}
|
||||
@@ -374,9 +374,7 @@ function fetchAPI(endpoint, method, headers = {}, body = null, cbOK, cbError) {
|
||||
*/
|
||||
function reloadSoundBank(APIURL) {
|
||||
soundbankdata = [];
|
||||
console.log("reloadSoundBank: fetching from " + APIURL + "List");
|
||||
fetchAPI(APIURL + "List", "GET", {}, null, (okdata) => {
|
||||
console.log("reloadSoundBank: received data", okdata);
|
||||
if (Array.isArray(okdata)) {
|
||||
soundbankdata = okdata;
|
||||
selectedsoundrow = null;
|
||||
@@ -441,12 +439,17 @@ function reloadTimerBank(APIURL) {
|
||||
/**
|
||||
* Reload logs from server with date and filter
|
||||
* @param {String} APIURL API URL endpoint
|
||||
* @param {String} date date in format dd/MM/yyyy
|
||||
* @param {String} date date in format dd-mm-yyyy
|
||||
* @param {String} filter log filter text
|
||||
*/
|
||||
function reloadLogs(APIURL, date, filter) {
|
||||
fetchAPI(APIURL + "List/" + date + "/" + filter, "GET", {}, null, (okdata) => {
|
||||
$('#logcontent').val(okdata.data);
|
||||
const params = new URLSearchParams({
|
||||
date: date,
|
||||
filter: filter
|
||||
})
|
||||
fetchAPI(APIURL + "List?" + params.toString(), "GET", {}, null, (okdata) => {
|
||||
//console.log("Logs data received", okdata);
|
||||
fill_logtablebody(okdata);
|
||||
}, (errdata) => {
|
||||
alert("Error loading logs: " + errdata.message);
|
||||
});
|
||||
@@ -536,6 +539,24 @@ function getScheduledDays() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear database mechanism
|
||||
* @param {String} APIURL API URL endpoint
|
||||
* @param {String} whattoclear what to clear
|
||||
* @param {Function} cbOK callback function on success
|
||||
* @param {Function} cbError callback function on error
|
||||
*/
|
||||
function DoClear(APIURL, whattoclear, cbOK, cbError) {
|
||||
if (confirm(`Are you sure want to clear ${whattoclear} ? This procedure is not reversible`)) {
|
||||
fetchAPI(APIURL + "List", "DELETE", {}, null, (okdata) => {
|
||||
cbOK(okdata);
|
||||
}, (errdata) => {
|
||||
cbError(errdata);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Export mechanism to XLSX file
|
||||
* @param {String} APIURL API URL endpoint
|
||||
@@ -550,27 +571,25 @@ function DoExport(APIURL, filename) {
|
||||
method: "GET",
|
||||
headers: {}
|
||||
})
|
||||
.then(response => {
|
||||
if (!response.ok) throw new Error('Network response was not ok ' + response.statusText);
|
||||
return response.blob();
|
||||
})
|
||||
.then(blob => {
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
window.URL.revokeObjectURL(url);
|
||||
})
|
||||
.catch(error => {
|
||||
alert("Error export to " + filename + ": " + error.message);
|
||||
});
|
||||
.then(response => {
|
||||
if (!response.ok) throw new Error('Network response was not ok ' + response.statusText);
|
||||
return response.blob();
|
||||
})
|
||||
.then(blob => {
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
window.URL.revokeObjectURL(url);
|
||||
})
|
||||
.catch(error => {
|
||||
alert("Error export to " + filename + ": " + error.message);
|
||||
});
|
||||
return; // prevent the rest of the function from running
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -704,17 +723,26 @@ $(document).ready(function () {
|
||||
|
||||
|
||||
reloadSoundBank(APIURL);
|
||||
$('#findsoundbank').on('input', function () {
|
||||
let searchTerm = $(this).val().trim().toLowerCase();
|
||||
if (searchTerm.length>0){
|
||||
let filtered = soundbankdata.filter(item => item.description.toLowerCase().includes(searchTerm) || item.tag.toLowerCase().includes(searchTerm) || item.path.toLowerCase().includes(searchTerm));
|
||||
fill_soundbanktablebody(filtered);
|
||||
} else {
|
||||
selectedsoundrow = null;
|
||||
fill_soundbanktablebody(soundbankdata);
|
||||
}
|
||||
});
|
||||
$btnClear.click(() => {
|
||||
if (confirm(`Are you sure want to clear Soundbank ? This procedure is not reversible`)) {
|
||||
fetchAPI(APIURL + "List", "DELETE", {}, null, (okdata) => {
|
||||
alert("Success clear soundbank" + okdata.message);
|
||||
DoClear(APIURL, "Soundbank", (okdata) => {
|
||||
alert("Success clear soundbank" + okdata.message);
|
||||
soundbankdata = []
|
||||
selectedsoundrow = null;
|
||||
fill_soundbanktablebody(soundbankdata);
|
||||
}, (errdata) => {
|
||||
alert("Error clear soundbank: " + errdata.message);
|
||||
});
|
||||
}
|
||||
}, (errdata) => {
|
||||
alert("Error clear soundbank: " + errdata.message);
|
||||
});
|
||||
|
||||
});
|
||||
$btnAdd.click(() => {
|
||||
$('.js-example-basic-single').select2({
|
||||
@@ -817,16 +845,15 @@ $(document).ready(function () {
|
||||
|
||||
reloadMessageBank(APIURL);
|
||||
$btnClear.click(() => {
|
||||
if (confirm(`Are you sure want to clear Messagebank ? This procedure is not reversible`)) {
|
||||
fetchAPI(APIURL + "List", "DELETE", {}, null, (okdata) => {
|
||||
alert("Success clear messagebank" + okdata.message);
|
||||
messagebankdata = []
|
||||
selectedmessagerow = null;
|
||||
fill_messagebanktablebody(messagebankdata);
|
||||
}, (errdata) => {
|
||||
alert("Error clear messagebank: " + errdata.message);
|
||||
});
|
||||
}
|
||||
DoClear(APIURL, "Messagebank", (okdata) => {
|
||||
alert("Success clear messagebank" + okdata.message);
|
||||
messagebankdata = []
|
||||
selectedmessagerow = null;
|
||||
fill_messagebanktablebody(messagebankdata);
|
||||
}, (errdata) => {
|
||||
alert("Error clear messagebank: " + errdata.message);
|
||||
});
|
||||
|
||||
});
|
||||
$btnAdd.click(() => {
|
||||
let $modal = $('#messagebankmodal');
|
||||
@@ -921,22 +948,21 @@ $(document).ready(function () {
|
||||
let $btnImport = $('#btnImport');
|
||||
$btnRemove.prop('disabled', true);
|
||||
$btnEdit.prop('disabled', true);
|
||||
let APIURL = "LanguageBank/";
|
||||
let APIURL = "LanguageLink/";
|
||||
|
||||
|
||||
|
||||
reloadLanguageBank(APIURL);
|
||||
$btnClear.click(() => {
|
||||
if (confirm(`Are you sure want to clear Languagebank ? This procedure is not reversible`)) {
|
||||
fetchAPI(APIURL + "List", "DELETE", {}, null, (okdata) => {
|
||||
alert("Success clear languagebank" + okdata.message);
|
||||
languagebankdata = []
|
||||
selectedlanguagerow = null;
|
||||
fill_languagebanktablebody(languagebankdata);
|
||||
}, (errdata) => {
|
||||
alert("Error clear languagebank: " + errdata.message);
|
||||
});
|
||||
}
|
||||
DoClear(APIURL, "LanguageLink", (okdata) => {
|
||||
alert("Success clear languageLink" + okdata.message);
|
||||
languagebankdata = []
|
||||
selectedlanguagerow = null;
|
||||
fill_languagebanktablebody(languagebankdata);
|
||||
}, (errdata) => {
|
||||
alert("Error clear languagebank: " + errdata.message);
|
||||
});
|
||||
|
||||
});
|
||||
$btnAdd.click(() => {
|
||||
// show modal with id 'languagemodal'
|
||||
@@ -1107,16 +1133,15 @@ $(document).ready(function () {
|
||||
|
||||
reloadTimerBank(APIURL);
|
||||
$btnClear.click(() => {
|
||||
if (confirm(`Are you sure want to clear Timerbank ? This procedure is not reversible`)) {
|
||||
fetchAPI(APIURL + "List", "DELETE", {}, null, (okdata) => {
|
||||
alert("Success clear schedulebank" + okdata.message);
|
||||
schedulebankdata = []
|
||||
selectedschedulerow = null;
|
||||
fill_schedulebanktablebody(schedulebankdata);
|
||||
}, (errdata) => {
|
||||
alert("Error clear schedulebank: " + errdata.message);
|
||||
});
|
||||
}
|
||||
DoClear(APIURL, "Timerbank", (okdata) => {
|
||||
alert("Success clear schedulebank" + okdata.message);
|
||||
schedulebankdata = []
|
||||
selectedschedulerow = null;
|
||||
fill_schedulebanktablebody(schedulebankdata);
|
||||
}, (errdata) => {
|
||||
alert("Error clear schedulebank: " + errdata.message);
|
||||
});
|
||||
|
||||
});
|
||||
$btnAdd.click(() => {
|
||||
//TODO form add timer
|
||||
@@ -1190,9 +1215,11 @@ $(document).ready(function () {
|
||||
console.log("Log content loaded successfully");
|
||||
const $logdate = $('#logdate');
|
||||
const $searchfilter = $('#searchfilter');
|
||||
const $logtable = $('#logtablebody')
|
||||
let selectedlogdate = "";
|
||||
let logfilter = "";
|
||||
let APIURL = "/api/Logs/";
|
||||
let APIURL = "Log/";
|
||||
$logtable.empty();
|
||||
|
||||
|
||||
if (!$logdate.val()) {
|
||||
@@ -1201,13 +1228,14 @@ $(document).ready(function () {
|
||||
const mm = String(today.getMonth() + 1).padStart(2, '0');
|
||||
const yyyy = today.getFullYear();
|
||||
$logdate.val(`${yyyy}-${mm}-${dd}`);
|
||||
selectedlogdate = `${dd}/${mm}/${yyyy}`;
|
||||
selectedlogdate = `${dd}-${mm}-${yyyy}`;
|
||||
reloadLogs(APIURL, selectedlogdate, logfilter);
|
||||
}
|
||||
$logdate.off('change').on('change', function () {
|
||||
const selected = $(this).val();
|
||||
if (selected) {
|
||||
const [year, month, day] = selected.split('-');
|
||||
selectedlogdate = `${day}/${month}/${year}`;
|
||||
selectedlogdate = `${day}-${month}-${year}`;
|
||||
reloadLogs(APIURL, selectedlogdate, logfilter);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -24,40 +24,22 @@
|
||||
<div class="col-6 col-sm-6 col-md-6 col-lg-2 col-xl-2"><button class="btn w-100 pad-button btn-round-basic color-import" id="btnExport" type="button">Export</button></div>
|
||||
<div class="col-6 col-sm-6 col-md-6 col-lg-2 col-xl-2"><button class="btn w-100 pad-button btn-round-basic color-import" id="btnImport" type="button">Import</button></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p id="tablesize" class="text-add" style="text-align: center;">Table Length : N/A</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-sm-1">No</th>
|
||||
<th>Description</th>
|
||||
<th class="col-sm-1">TAG</th>
|
||||
<th class="col-sm-1">Category</th>
|
||||
<th class="col-sm-1">Language</th>
|
||||
<th class="col-sm-1">Type</th>
|
||||
<th class="col-sm-3">Filename</th>
|
||||
<th class="col-sm-2">TAG</th>
|
||||
<th class="col">Languages</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="languagebanktablebody">
|
||||
<tr>
|
||||
<td>Cell 1</td>
|
||||
<td>Cell 2</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 5</td>
|
||||
<td>Cell 6</td>
|
||||
<td>Cell 7</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 4</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 5</td>
|
||||
<td>Cell 6</td>
|
||||
<td>Cell 7</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody id="languagebanktablebody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
</div>
|
||||
<div class="col-6 col-sm col-md-2 col-lg-2 col-xl-2"><input type="text" id="searchfilter" class="form-control" placeholder="Search Filter"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p id="tablesize" class="text-add" style="text-align: center;">Table Length : N/A</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
@@ -35,23 +40,11 @@
|
||||
<th class="col-1 col-md-1">No</th>
|
||||
<th class="col-2 col-md-2 col-lg-2">Date</th>
|
||||
<th class="col-2 col-md-2 col-lg-2">Time</th>
|
||||
<th class="col-2 col-md-2 col-lg-2">Machine</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="logtablebody">
|
||||
<tr>
|
||||
<td>Cell 1</td>
|
||||
<td>Cell 2</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 4</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 4</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 4</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody id="logtablebody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
<div class="col-6 col-sm-6 col-md-6 col-lg-2 col-xl-2"><button class="btn w-100 pad-button btn-round-basic color-import" id="btnExport" type="button">Export</button></div>
|
||||
<div class="col-6 col-sm-6 col-md-6 col-lg-2 col-xl-2"><button class="btn w-100 pad-button btn-round-basic color-import" id="btnImport" type="button">Import</button></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p id="tablesize" class="text-add" style="text-align: center;">Table Length : N/A</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
@@ -38,26 +43,7 @@
|
||||
<th class="col-sm-3">Message Tags</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="messagebanktablebody">
|
||||
<tr>
|
||||
<td>Cell 1</td>
|
||||
<td>Cell 2</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 5</td>
|
||||
<td>Cell 6</td>
|
||||
<td>Cell 7</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 4</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 5</td>
|
||||
<td>Cell 6</td>
|
||||
<td>Cell 7</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody id="messagebanktablebody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -50,26 +50,7 @@
|
||||
<th class="col-sm-3">Filename</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="soundbanktablebody">
|
||||
<tr>
|
||||
<td>Cell 1</td>
|
||||
<td>Cell 2</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 5</td>
|
||||
<td>Cell 6</td>
|
||||
<td>Cell 7</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 4</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 5</td>
|
||||
<td>Cell 6</td>
|
||||
<td>Cell 7</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody id="soundbanktablebody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<body>
|
||||
<div class="row">
|
||||
<div class="col w-100 h-100 pad-header">
|
||||
<h2 style="text-align: center;">Timer</h2>
|
||||
<h2 style="text-align: center;">Schedule Bank</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -24,40 +24,27 @@
|
||||
<div class="col-6 col-sm-6 col-md-6 col-lg-2 col-xl-2"><button class="btn w-100 pad-button btn-round-basic color-import" id="btnExport" type="button">Export</button></div>
|
||||
<div class="col-6 col-sm-6 col-md-6 col-lg-2 col-xl-2"><button class="btn w-100 pad-button btn-round-basic color-import" id="btnImport" type="button">Import</button></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p id="tablesize" class="text-add" style="text-align: center;">Table Length : N/A</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-sm-1">No</th>
|
||||
<th>Description</th>
|
||||
<th class="col-sm-1">TAG</th>
|
||||
<th class="col-sm-1">Category</th>
|
||||
<th class="col-sm-1">Language</th>
|
||||
<th class="col-sm-1">Type</th>
|
||||
<th class="col-sm-3">Filename</th>
|
||||
<th class="col-sm-2">Description</th>
|
||||
<th class="col-sm-1">Day</th>
|
||||
<th class="col-sm-1">Time</th>
|
||||
<th class="col-sm-2">Sound Path</th>
|
||||
<th class="col-sm-1">Repeat</th>
|
||||
<th class="col-sm-1">Enable</th>
|
||||
<th>Broadcast Zones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="schedulebanktablebody">
|
||||
<tr>
|
||||
<td>Cell 1</td>
|
||||
<td>Cell 2</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 5</td>
|
||||
<td>Cell 6</td>
|
||||
<td>Cell 7</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 4</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 3</td>
|
||||
<td>Cell 5</td>
|
||||
<td>Cell 6</td>
|
||||
<td>Cell 7</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody id="schedulebanktablebody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user