Compare commits

...

5 Commits

Author SHA1 Message Date
Aiirondev_dev c90cef6dcf Addition of ort preloading for the edeting modal
Release Inventarsystem / release-docker (push) Successful in 2m14s
2026-08-11 15:30:26 +02:00
Aiirondev_dev b5451a4ef0 Addition of ort preloading for the edeting modal
Release Inventarsystem / release-docker (push) Successful in 2m18s
2026-08-11 15:12:17 +02:00
Aiirondev_dev a4afef8283 Fix of a stray redirect error
Release Inventarsystem / release-docker (push) Successful in 2m17s
2026-08-11 15:00:20 +02:00
Aiirondev_dev b2951eed6c Fix of broken authentication metode
Release Inventarsystem / release-docker (push) Has been cancelled
2026-08-11 10:46:38 +02:00
Aiirondev_dev 9a37c047c1 Fix of an missing parethasys
Release Inventarsystem / release-docker (push) Successful in 2m14s
2026-08-11 02:01:27 +02:00
4 changed files with 163 additions and 7 deletions
+2 -2
View File
@@ -5780,7 +5780,7 @@ def upload_item():
app.logger.warning('Audit write failed for library_item_created')
flash(success_msg, 'success')
return redirect(url_for(success_redirect_endpoint, highlight_item=str(item_id)))
return redirect(url_for(success_redirect_endpoint))
else:
error_msg = 'Fehler beim Hinzufügen des Elements'
if is_mobile:
@@ -7697,7 +7697,7 @@ def user_del():
last_name = ""
fullname = None
users_list.append({
'username': username,
'username': decrypt_text(username),
'admin': user.get('Admin', False),
'fullname': fullname,
'name': name,
+1 -1
View File
@@ -650,7 +650,7 @@ def add_user(
safe_last_name = last_name.strip() if last_name else ''
user_doc = {
'Username': dp.encrypt_text(username),
'Username': username,
'Password': hashing(password),
'Admin': (permission_preset == "full_access"),
'active_ausleihung': None,
+104 -4
View File
@@ -524,7 +524,7 @@
<option value="card_only">Nur Ausweis erfassen</option>
<option value="quick_toggle">Schnellmodus: Ausweis + Mediencode</option>
</select>
<input type="text" id="activeStudentCard" placeholder="Aktiver Ausweis (gescannt)" readonly>
<input type="text" id="activeStudentCard" placeholder="Aktiver Ausweis (gescannt)" >
<input type="text" id="manualItemCode" placeholder="Manueller Mediencode (optional)" style="min-width:180px;">
<button id="resetCardBtn" class="button" type="button">Ausweis löschen</button>
<button id="toggleScannerBtn" class="button" type="button">Scanner starten</button>
@@ -1578,9 +1578,11 @@
document.getElementById('editLibraryName').value = item.Name;
document.getElementById('editLibraryType').value = item.ItemType;
document.getElementById('editLibraryIsbn').value = item.ISBN || '';
document.getElementById('editLibraryLocation').value = item.Ort;
document.getElementById('editLibraryDescription').value = item.Beschreibung;
// Orte laden und bestehenden Ort setzen
await loadEditLocationOptions(item.Ort);
const codesContainer = document.getElementById('editLibraryCodesContainer');
if (codesContainer) {
codesContainer.innerHTML = '<div style="padding:10px 0; color:#6b7280;">Lade Codes...</div>';
@@ -1594,6 +1596,87 @@
function closeEditLibraryModal() {
document.getElementById('editLibraryModal').style.display = 'none';
// Setzt das Feld für neuen Ort sicherheitshalber zurück, wenn geschlossen wird
cancelEditAddLocation();
}
// Lädt die Optionen in das Dropdown und wählt den aktuellen Ort des Mediums aus
async function loadEditLocationOptions(currentLocation) {
try {
const response = await fetch('/get_predefined_locations');
const data = await response.json();
const ortSelect = document.getElementById('editLibraryLocation');
if (ortSelect) {
// Bestehende Optionen löschen (außer die erste Platzhalter-Option)
while (ortSelect.children.length > 1) {
ortSelect.removeChild(ortSelect.lastChild);
}
let locationFound = false;
// Neue Optionen aus der Datenbank hinzufügen
data.locations.forEach(location => {
const option = document.createElement('option');
option.value = location;
option.textContent = location;
ortSelect.appendChild(option);
if (location === currentLocation) {
locationFound = true;
}
});
// WICHTIG: Falls der aktuell hinterlegte Ort nicht in der Datenbank-Liste ist,
// fügen wir ihn als temporäre Option hinzu, damit er nicht beim Speichern überschrieben wird.
if (currentLocation && !locationFound) {
const option = document.createElement('option');
option.value = currentLocation;
option.textContent = currentLocation;
ortSelect.appendChild(option);
}
// Zuletzt den aktuellen Ort anwählen
if (currentLocation) {
ortSelect.value = currentLocation;
}
}
} catch (error) {
console.error('Error loading location options:', error);
}
}
// Funktion um einen neuen Ort ins Bearbeiten-Dropdown aufzunehmen
function addEditNewLocation() {
const newLocationInput = document.getElementById('edit-new-location-input');
const newLocation = newLocationInput.value.trim();
if (!newLocation) {
alert('Bitte geben Sie einen Ort ein.');
return;
}
// Füge Option dem Dropdown hinzu
const ortSelect = document.getElementById('editLibraryLocation');
const option = document.createElement('option');
option.value = newLocation;
option.textContent = newLocation;
ortSelect.appendChild(option);
// Wähle die neue Option direkt aus
ortSelect.value = newLocation;
// Verstecke die Eingabemaske wieder
cancelEditAddLocation();
}
// Funktion zum Abbrechen der Orteingabe
function cancelEditAddLocation() {
const container = document.getElementById('edit-new-location-container');
if(container) container.style.display = 'none';
const input = document.getElementById('edit-new-location-input');
if(input) input.value = '';
}
</script>
@@ -1642,10 +1725,27 @@
<label>Mediencodes</label>
<div id="editLibraryCodesContainer"></div>
</div>
<div class="full">
<!-- NEUER BEREICH FÜR DIE ORTS-AUSWAHL -->
<div class="full form-group">
<label for="editLibraryLocation">Ort</label>
<input id="editLibraryLocation" required style="width: 100%;">
<div style="display: flex; gap: 10px; margin-bottom: 5px;">
<select id="editLibraryLocation" required style="flex-grow: 1; padding: 8px;">
<option value="">-- Bitte Ort auswählen --</option>
<!-- Options will be loaded by JavaScript -->
</select>
<button type="button" class="button" id="edit-add-new-location-btn" onclick="document.getElementById('edit-new-location-container').style.display = 'flex';" style="white-space: nowrap;">
Neuen Ort hinzufügen
</button>
</div>
<div id="edit-new-location-container" class="edit-new-location-container" style="display: none; gap: 10px; margin-top: 5px;">
<input type="text" id="edit-new-location-input" placeholder="Neuen Ort eingeben" style="flex-grow: 1; padding: 8px;">
<button type="button" class="button" onclick="addEditNewLocation()" style="background:#10b981; color:#fff;">Hinzufügen</button>
<button type="button" class="button" onclick="cancelEditAddLocation()" style="background:#ef4444; color:#fff;">Abbrechen</button>
</div>
</div>
<!-- ENDE ORTS-AUSWAHL -->
<div class="full">
<label for="editLibraryDescription">Beschreibung</label>
<textarea id="editLibraryDescription" rows="4" required style="width: 100%;"></textarea>
+56
View File
@@ -4315,6 +4315,7 @@ document.addEventListener('DOMContentLoaded', ()=>{
hiddenInput.value = image;
editForm.appendChild(hiddenInput);
}
});
}
@@ -5632,6 +5633,61 @@ document.addEventListener('DOMContentLoaded', ()=>{
futureAppointments.sort((a, b) => new Date(a.date) - new Date(b.date));
return futureAppointments[0];
}
// Load location options
function loadLocationOptions() {
fetch('/get_predefined_locations')
.then(response => response.json())
.then(data => {
const ortSelect = document.getElementById('ort');
if (ortSelect) {
// Clear existing options except the first one
while (ortSelect.children.length > 1) {
ortSelect.removeChild(ortSelect.lastChild);
}
// Add new options - data.locations contains the array
data.locations.forEach(location => {
const option = document.createElement('option');
option.value = location;
option.textContent = location;
ortSelect.appendChild(option);
});
}
})
.catch(error => {
console.error('Error loading location options:', error);
});
}
// Function to add new location
function addNewLocation() {
const newLocationInput = document.getElementById('new-location-input');
const newLocation = newLocationInput.value.trim();
if (!newLocation) {
alert('Bitte geben Sie einen Ort ein.');
return;
}
// Add to dropdown
const ortSelect = document.getElementById('ort');
const option = document.createElement('option');
option.value = newLocation;
option.textContent = newLocation;
option.selected = true;
ortSelect.appendChild(option);
// Hide the input container
document.getElementById('new-location-container').style.display = 'none';
newLocationInput.value = '';
}
// Function to cancel adding new location
function cancelAddLocation() {
document.getElementById('new-location-container').style.display = 'none';
document.getElementById('new-location-input').value = '';
}
</script>
<!-- Include edit item functions -->