diff --git a/Web/templates/library_table.html b/Web/templates/library_table.html
index ed183db..7a45c31 100644
--- a/Web/templates/library_table.html
+++ b/Web/templates/library_table.html
@@ -1436,31 +1436,39 @@
// =========================================================================
// 4. UI INTERACTIONS & UTILITIES
// =========================================================================
- function borrowItem(itemId) {
+ async function borrowItem(itemId) {
const selectedItem = (libraryItems || []).find(item => item._id === itemId);
if (selectedItem && selectedItem.LibraryDisplayStatus === 'damaged') {
- alert('Dieses Medium ist als defekt/zerstört markiert und kann nicht ausgeliehen werden.');
+ await customAlert('Dieses Medium ist als defekt/zerstört markiert und kann nicht ausgeliehen werden.');
return;
}
const defaultCardId = activeStudentCardId || '';
- const cardId = (window.prompt('Bitte Bibliotheksausweis-ID eingeben:', defaultCardId) || '').trim().toUpperCase();
+ const promptCardResult = await customPrompt('Bitte Bibliotheksausweis-ID eingeben:', defaultCardId);
+ if (promptCardResult === null) return;
+
+ const cardId = promptCardResult.trim().toUpperCase();
if (!cardId) {
- alert('Ausleihe abgebrochen: Für Bibliotheksmedien ist eine gültige Bibliotheksausweis-ID erforderlich.');
+ await customAlert('Ausleihe abgebrochen: Für Bibliotheksmedien ist eine gültige Bibliotheksausweis-ID erforderlich.');
return;
}
setActiveStudentCard(cardId);
- const durationInput = (window.prompt('Ausleihdauer in Tagen (optional):') || '').trim();
+ const promptDurationResult = await customPrompt('Ausleihdauer in Tagen (optional):');
+ if (promptDurationResult === null) return;
+ const durationInput = promptDurationResult.trim();
+
const maxAvailable = Math.max(1, parseInt(selectedItem?.AvailableGroupedCount || selectedItem?.Quantity || 1, 10) || 1);
- const countPrompt = (window.prompt(`Anzahl ausleihen? (Standard: 1, verfügbar: ${maxAvailable})`, '1') || '').trim();
- let borrowCount = parseInt(countPrompt || '1', 10);
+ const countPromptResult = await customPrompt(`Anzahl ausleihen? (Standard: 1, verfügbar: ${maxAvailable})`, '1');
+ if (countPromptResult === null) return;
+
+ let borrowCount = parseInt(countPromptResult.trim() || '1', 10);
if (!Number.isFinite(borrowCount) || borrowCount < 1) {
borrowCount = 1;
}
if (borrowCount > maxAvailable) {
- alert(`Es sind nur ${maxAvailable} Exemplar(e) verfügbar.`);
+ await customAlert(`Es sind nur ${maxAvailable} Exemplar(e) verfügbar.`);
return;
}