This commit is contained in:
@@ -1049,7 +1049,7 @@
|
||||
const resp = await fetch('/api/library_return_by_code', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({ item_code: code })
|
||||
body: JSON.stringify({item_code: code})
|
||||
});
|
||||
const result = await resp.json();
|
||||
if (!resp.ok || !result.ok) {
|
||||
@@ -1068,6 +1068,7 @@
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
setScanStatus('Verarbeite Mediencode...', 'warn');
|
||||
const response = await fetch('/api/library_scan_action', {
|
||||
@@ -1119,9 +1120,9 @@
|
||||
|
||||
scanEditBtn.textContent = 'Scanner schließen';
|
||||
|
||||
startScanner(function(decodedText) {
|
||||
startScanner(function (decodedText) {
|
||||
editCodeInput.value = decodedText;
|
||||
if(typeof validateCodeField === "function") {
|
||||
if (typeof validateCodeField === "function") {
|
||||
validateCodeField(editCodeInput, document.getElementById('edit-item-id')?.value || null);
|
||||
}
|
||||
scanEditBtn.textContent = 'Barcode scannen';
|
||||
@@ -1207,7 +1208,7 @@
|
||||
if (kind) el.classList.add(kind);
|
||||
}
|
||||
|
||||
function showSmallConfirm(message, kind='ok') {
|
||||
function showSmallConfirm(message, kind = 'ok') {
|
||||
// Append the small helper text in German
|
||||
const helper = 'Sie können fortfahren. Dies ist nur eine kleine Benachrichtigung.';
|
||||
const el = document.createElement('div');
|
||||
@@ -1219,7 +1220,12 @@
|
||||
if (el && el.parentNode) el.parentNode.removeChild(el);
|
||||
});
|
||||
// auto remove after 3 seconds
|
||||
setTimeout(() => { try { if (el && el.parentNode) el.parentNode.removeChild(el); } catch(e){} }, 3000);
|
||||
setTimeout(() => {
|
||||
try {
|
||||
if (el && el.parentNode) el.parentNode.removeChild(el);
|
||||
} catch (e) {
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
function setActiveStudentCard(cardId) {
|
||||
@@ -1233,7 +1239,7 @@
|
||||
}
|
||||
|
||||
function getItemTypeLabel(type) {
|
||||
const labels = { 'book': 'Buch', 'cd': 'CD', 'dvd': 'DVD', 'other': 'Sonstige', 'schoolbook': 'Schulbuch' };
|
||||
const labels = {'book': 'Buch', 'cd': 'CD', 'dvd': 'DVD', 'other': 'Sonstige', 'schoolbook': 'Schulbuch'};
|
||||
return labels[type] || type;
|
||||
}
|
||||
|
||||
@@ -1276,7 +1282,7 @@
|
||||
}
|
||||
|
||||
// Closes the modal if the user clicks the dark background overlay
|
||||
window.onclick = function(event) {
|
||||
window.onclick = function (event) {
|
||||
const modal = document.getElementById('detailModal');
|
||||
// If the click happened directly on the dark overlay (not the white box)
|
||||
if (event.target === modal) {
|
||||
@@ -1365,7 +1371,7 @@
|
||||
document.getElementById('filterISBN').value = '';
|
||||
document.getElementById('filterType').value = '';
|
||||
document.getElementById('filterStatus').value = '';
|
||||
activeFilters = { isbn: '', type: '', status: '' };
|
||||
activeFilters = {isbn: '', type: '', status: ''};
|
||||
applyFiltersAndSearch(true);
|
||||
});
|
||||
}
|
||||
@@ -1401,7 +1407,7 @@
|
||||
|
||||
const editForm = document.getElementById('editLibraryForm');
|
||||
if (editForm) {
|
||||
editForm.addEventListener('submit', async function(e) {
|
||||
editForm.addEventListener('submit', async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const itemId = document.getElementById('editLibraryItemId').value;
|
||||
@@ -1562,7 +1568,7 @@
|
||||
}).join('');
|
||||
}
|
||||
|
||||
window.openEditLibraryItem = async function(itemId) {
|
||||
window.openEditLibraryItem = async function (itemId) {
|
||||
const item = libraryItems.find(i => i._id === itemId);
|
||||
if (!item) return;
|
||||
|
||||
@@ -1592,6 +1598,7 @@
|
||||
function closeEditLibraryModal() {
|
||||
document.getElementById('editLibraryModal').style.display = 'none';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div id="editLibraryModal" class="modal" style="display:none;">
|
||||
|
||||
Reference in New Issue
Block a user