This commit is contained in:
@@ -1068,7 +1068,6 @@
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
setScanStatus('Verarbeite Mediencode...', 'warn');
|
||||
const response = await fetch('/api/library_scan_action', {
|
||||
@@ -1220,12 +1219,7 @@
|
||||
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) {
|
||||
@@ -1341,7 +1335,7 @@
|
||||
}
|
||||
|
||||
// Run when DOM structure is entirely ready
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
wireScannerUi(); // Setup scanner control buttons
|
||||
loadLibraryItems(); // Fetch your database items right away!
|
||||
|
||||
@@ -1405,31 +1399,9 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Edit Modal Form processing
|
||||
const editForm = document.getElementById('editLibraryForm');
|
||||
if (editForm) {
|
||||
editForm.addEventListener('submit', async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const itemId = document.getElementById('editLibraryItemId').value;
|
||||
const currentItem = libraryItems.find(i => i._id === itemId);
|
||||
if (!currentItem) return;
|
||||
|
||||
const sharedPayload = {
|
||||
name: document.getElementById('editLibraryName').value,
|
||||
item_type: document.getElementById('editLibraryType').value,
|
||||
isbn: document.getElementById('editLibraryIsbn').value,
|
||||
ort: document.getElementById('editLibraryLocation').value,
|
||||
beschreibung: document.getElementById('editLibraryDescription').value,
|
||||
ansch_jahr: currentItem.Anschaffungsjahr || '',
|
||||
ansch_kost: currentItem.Anschaffungskosten || '',
|
||||
reservierbar: currentItem.Reservierbar !== false,
|
||||
};
|
||||
|
||||
const codeInputs = Array.from(document.querySelectorAll('#editLibraryCodesContainer input[data-item-id]'));
|
||||
const codeByItemId = new Map(codeInputs.map(input => [input.dataset.itemId, (input.value || '').trim()]));
|
||||
const groupMembers = editLibraryState.groupMembers.length > 0 ? editLibraryState.groupMembers : [currentItem];
|
||||
const isGroupedEdit = Boolean(currentItem.SeriesGroupId) && groupMembers.length > 1;
|
||||
|
||||
try {
|
||||
if (isGroupedEdit) {
|
||||
const payload = {
|
||||
@@ -1495,6 +1467,29 @@
|
||||
console.error('Update failed:', error);
|
||||
alert('Netzwerkfehler beim Aktualisieren des Mediums.');
|
||||
}
|
||||
editForm.addEventListener('submit', async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const itemId = document.getElementById('editLibraryItemId').value;
|
||||
const currentItem = libraryItems.find(i => i._id === itemId);
|
||||
if (!currentItem) return;
|
||||
|
||||
const codeInputs = Array.from(document.querySelectorAll('#editLibraryCodesContainer input[data-item-id]'));
|
||||
|
||||
const sharedPayload = {
|
||||
name: document.getElementById('editLibraryName').value,
|
||||
item_type: document.getElementById('editLibraryType').value,
|
||||
isbn: document.getElementById('editLibraryIsbn').value,
|
||||
ort: document.getElementById('editLibraryLocation').value,
|
||||
beschreibung: document.getElementById('editLibraryDescription').value,
|
||||
ansch_jahr: currentItem.Anschaffungsjahr || '',
|
||||
ansch_kost: currentItem.Anschaffungskosten || '',
|
||||
reservierbar: currentItem.Reservierbar !== false,
|
||||
};
|
||||
const codeByItemId = new Map(codeInputs.map(input => [input.dataset.itemId, (input.value || '').trim()]));
|
||||
const groupMembers = editLibraryState.groupMembers.length > 0 ? editLibraryState.groupMembers : [currentItem];
|
||||
const isGroupedEdit = Boolean(currentItem.SeriesGroupId) && groupMembers.length > 1;
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user