Compare commits
19
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3e79a65c1 | ||
|
|
b33b4eadc6 | ||
|
|
07a1cdb063 | ||
|
|
2942bcc380 | ||
|
|
349337e75f | ||
|
|
9bdd8261fe | ||
|
|
04c8505531 | ||
|
|
c9edf4a4c8 | ||
|
|
0e0a99569e | ||
|
|
6e94ca20c4 | ||
|
|
72fdfb0898 | ||
|
|
9de09a2f41 | ||
|
|
3d5a81824f | ||
|
|
b0344627a7 | ||
|
|
8d07577220 | ||
|
|
f3c7b6cd55 | ||
|
|
c2bfed710d | ||
|
|
5d90eab154 | ||
|
|
1eadfff9e1 |
No files matched your search
+109
-163
@@ -468,6 +468,10 @@ def _enforce_active_session_user():
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
username = session.get('username')
|
username = session.get('username')
|
||||||
|
current_user_id = session.get('user_id')
|
||||||
|
if not current_user_id:
|
||||||
|
current_user = us.get_user(username)
|
||||||
|
current_user_id = str(current_user['_id']) if current_user and current_user.get('_id') else None
|
||||||
if not username:
|
if not username:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -1560,7 +1564,7 @@ def update_appointment_statuses():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
# STUFE 2: >= 2 * student_ausleih_dauer Tage überfällig -> Ausweis sperren, Stufe 2 setzen & Admins benachrichtigen
|
# STUFE 2: >= 2 * student_ausleih_dauer Tage überfällig -> Ausweis sperren, Stufe 2 setzen & Admins benachrichtigen
|
||||||
if days_overdue >= (int(student_ausleih_dauer) * 2) and mahnstufe < 2:
|
if days_overdue >= (int(student_ausleih_dauer) * 2) and mahnstufe == 1 and card.get('is_blocked') is not True:
|
||||||
ausleihungen.update_one(
|
ausleihungen.update_one(
|
||||||
{'_id': appt['_id']},
|
{'_id': appt['_id']},
|
||||||
{'$set': {'Mahnstufe': 2, 'LastUpdated': current_time}}
|
{'$set': {'Mahnstufe': 2, 'LastUpdated': current_time}}
|
||||||
@@ -3506,144 +3510,6 @@ def library_loans_admin():
|
|||||||
if client:
|
if client:
|
||||||
client.close()
|
client.close()
|
||||||
|
|
||||||
|
|
||||||
def generate_test_ausleihen():
|
|
||||||
"""
|
|
||||||
Generiert Testdaten für die Überprüfung der Mahnungs- und Sperrlogik.
|
|
||||||
Erstellt Dummy-Schülerausweise, Bibliotheks-Items und Ausleihungen mit manipulierten Daten (DueDate).
|
|
||||||
"""
|
|
||||||
current_time = datetime.datetime.now(ZoneInfo("Europe/Berlin"))
|
|
||||||
|
|
||||||
try:
|
|
||||||
client = MongoClient(MONGODB_HOST, MONGODB_PORT)
|
|
||||||
db = client[MONGODB_DB]
|
|
||||||
ausleihungen = db['ausleihungen']
|
|
||||||
student_cards_col = db['student_cards']
|
|
||||||
items_col = db['items']
|
|
||||||
|
|
||||||
print("Generiere Testdaten für das Mahnungssystem...")
|
|
||||||
|
|
||||||
# 1. Test-Schülerausweise erstellen oder aktualisieren (upsert)
|
|
||||||
# Wir nutzen AusweisIds, die im System als Identifikation dienen
|
|
||||||
test_students = [
|
|
||||||
{
|
|
||||||
"AusweisId": "TEST-AUSWEIS-01",
|
|
||||||
"SchülerName": encrypt_text("Max Mustermann (Stufe 1 Test)"),
|
|
||||||
"Klasse": "9a",
|
|
||||||
"is_blocked": False
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AusweisId": "TEST-AUSWEIS-02",
|
|
||||||
"SchülerName": encrypt_text("Erika Musterfrau (Stufe 2 Test)"),
|
|
||||||
"Klasse": "10b",
|
|
||||||
"is_blocked": False
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AusweisId": "TEST-AUSWEIS-03",
|
|
||||||
"SchülerName": encrypt_text("Tom Frisch (Keine Mahnung Test)"),
|
|
||||||
"Klasse": "8c",
|
|
||||||
"is_blocked": False
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
for s in test_students:
|
|
||||||
student_cards_col.update_one(
|
|
||||||
{'AusweisId': s['AusweisId']},
|
|
||||||
{'$set': s},
|
|
||||||
upsert=True
|
|
||||||
)
|
|
||||||
|
|
||||||
# 2. Test-Items als Bibliotheksartikel erstellen (ItemType wird gesetzt, damit it.is_library_itemgreift)
|
|
||||||
# Passe LIBRARY_ITEM_TYPES an deine verwendeten Typen an (hier beispielhaft 'Buch' / 'Medien')
|
|
||||||
item_type = LIBRARY_ITEM_TYPES[0] if 'LIBRARY_ITEM_TYPES' in globals() and LIBRARY_ITEM_TYPES else 'Buch'
|
|
||||||
|
|
||||||
item1_res = items_col.insert_one({
|
|
||||||
"Name": "Biologie Buch (Test Stufe 1)",
|
|
||||||
"ItemType": item_type,
|
|
||||||
"Verfuegbar": False,
|
|
||||||
"Exemplare": 1,
|
|
||||||
"Code_4": "TR-9988"
|
|
||||||
})
|
|
||||||
item2_res = items_col.insert_one({
|
|
||||||
"Name": "iPad Pro (Test Stufe 2)",
|
|
||||||
"ItemType": item_type,
|
|
||||||
"Verfuegbar": False,
|
|
||||||
"Exemplare": 1,
|
|
||||||
"Code_4": "TR-9988"
|
|
||||||
})
|
|
||||||
item3_res = items_col.insert_one({
|
|
||||||
"Name": "Taschenrechner (Test Frisch)",
|
|
||||||
"ItemType": item_type,
|
|
||||||
"Verfuegbar": False,
|
|
||||||
"Exemplare": 1,
|
|
||||||
"Code_4": "TR-9988"
|
|
||||||
})
|
|
||||||
|
|
||||||
# 3. Test-Ausleihungen generieren
|
|
||||||
# Fall 1: 15 Tage drüber, Mahnstufe 0 -> Sollte Stufe 1 triggern (>= 14 Tage)
|
|
||||||
due_date_stufe1 = current_time - datetime.timedelta(days=15)
|
|
||||||
|
|
||||||
# Fall 2: 29 Tage drüber, Mahnstufe 1 -> Sollte Stufe 2 triggern & Ausweis sperren (>= 28 Tage)
|
|
||||||
due_date_stufe2 = current_time - datetime.timedelta(days=29)
|
|
||||||
|
|
||||||
# Fall 3: 5 Tage drüber, Mahnstufe 0 -> Sollte NICHTS tun (da < 14 Tage)
|
|
||||||
due_date_frisch = current_time - datetime.timedelta(days=5)
|
|
||||||
|
|
||||||
# Je nachdem, ob dein System die User-Felder in Ausleihungen verschlüsselt speichert:
|
|
||||||
# Hier wird encrypt_text verwendet, falls die Funktion im Scope liegt.
|
|
||||||
user_val_1 = encrypt_text("TEST-AUSWEIS-01")
|
|
||||||
user_val_2 = encrypt_text("TEST-AUSWEIS-02")
|
|
||||||
user_val_3 = encrypt_text("TEST-AUSWEIS-03")
|
|
||||||
|
|
||||||
test_ausleihungen = [
|
|
||||||
{
|
|
||||||
"User": user_val_1,
|
|
||||||
"Item": str(item1_res.inserted_id),
|
|
||||||
"Status": "active",
|
|
||||||
"DueDate": due_date_stufe1,
|
|
||||||
"Mahnstufe": 0,
|
|
||||||
"LastUpdated": current_time
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"User": user_val_2,
|
|
||||||
"Item": str(item2_res.inserted_id),
|
|
||||||
"Status": "active",
|
|
||||||
"DueDate": due_date_stufe2,
|
|
||||||
"Mahnstufe": 1, # Hat bereits Stufe 1, wartet auf Eskalation zu Stufe 2
|
|
||||||
"LastUpdated": due_date_stufe2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"User": user_val_3,
|
|
||||||
"Item": str(item3_res.inserted_id),
|
|
||||||
"Status": "active",
|
|
||||||
"DueDate": due_date_frisch,
|
|
||||||
"Mahnstufe": 2,
|
|
||||||
"LastUpdated": current_time
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
# In die Datenbank einfügen
|
|
||||||
ausleihungen.insert_many(test_ausleihungen)
|
|
||||||
|
|
||||||
print("Erfolgreich! Folgende Testdaten wurden für das Mahnungssystem in die DB geschrieben:")
|
|
||||||
print(f"- Fall 1 (Mahnstufe 1 Trigger): Ausweis 'TEST-AUSWEIS-01', fällig war am {due_date_stufe1.strftime('%Y-%m-%d')} (15 Tage überfällig)")
|
|
||||||
print(f"- Fall 2 (Mahnstufe 2 & Sperre): Ausweis 'TEST-AUSWEIS-02', fällig war am {due_date_stufe2.strftime('%Y-%m-%d')} (29 Tage überfällig)")
|
|
||||||
print(f"- Fall 3 (Zu früh / Ignorieren): Ausweis 'TEST-AUSWEIS-03', fällig war am {due_date_frisch.strftime('%Y-%m-%d')} (5 Tage überfällig)")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Fehler beim Erstellen der Testdaten: {e}")
|
|
||||||
finally:
|
|
||||||
if client:
|
|
||||||
client.close()
|
|
||||||
|
|
||||||
@app.route('/test_mahnungen')
|
|
||||||
def test_mahnungen():
|
|
||||||
# Testdaten (Mock-Daten), um alle if/else Bedingungen im HTML zu testen
|
|
||||||
generate_test_ausleihen()
|
|
||||||
create_return_reminders()
|
|
||||||
return redirect(url_for('mahnungen_admin'))
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/mahnungen_admin')
|
@app.route('/mahnungen_admin')
|
||||||
def mahnungen_admin():
|
def mahnungen_admin():
|
||||||
"""Admin-Übersicht für überfällige Bibliotheks-Ausleihen."""
|
"""Admin-Übersicht für überfällige Bibliotheks-Ausleihen."""
|
||||||
@@ -3763,8 +3629,8 @@ def mahnungen_admin():
|
|||||||
email_service_enabled=cfg.EMAIL_ENABLED
|
email_service_enabled=cfg.EMAIL_ENABLED
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.route('/mahnungen_reset', methods=['POST'])
|
@app.route('/mahnungen_reset/<int:days>', methods=['POST'])
|
||||||
def mahnungen_reset():
|
def mahnungen_reset(days):
|
||||||
"""Setzt die Mahnstufe einer Ausleihe zurück, verlängert die Frist und entsperrt den Schülerausweis."""
|
"""Setzt die Mahnstufe einer Ausleihe zurück, verlängert die Frist und entsperrt den Schülerausweis."""
|
||||||
if 'username' not in session:
|
if 'username' not in session:
|
||||||
return jsonify({'success': False, 'message': 'Nicht angemeldet.'}), 401
|
return jsonify({'success': False, 'message': 'Nicht angemeldet.'}), 401
|
||||||
@@ -3792,7 +3658,7 @@ def mahnungen_reset():
|
|||||||
return jsonify({'success': False, 'message': 'Ausleihe nicht gefunden.'}), 404
|
return jsonify({'success': False, 'message': 'Ausleihe nicht gefunden.'}), 404
|
||||||
|
|
||||||
current_time = datetime.datetime.now(ZoneInfo("Europe/Berlin"))
|
current_time = datetime.datetime.now(ZoneInfo("Europe/Berlin"))
|
||||||
new_due_date = current_time + datetime.timedelta(days=14) # Frist um 14 Tage verlängern
|
new_due_date = current_time + datetime.timedelta(days=days) # Frist um die angegebene Anzahl an Tagen verlängern
|
||||||
|
|
||||||
# 2. Mahnstufe zurücksetzen und Frist verlängern
|
# 2. Mahnstufe zurücksetzen und Frist verlängern
|
||||||
ausleihungen_col.update_one(
|
ausleihungen_col.update_one(
|
||||||
@@ -3826,7 +3692,7 @@ def mahnungen_reset():
|
|||||||
|
|
||||||
return jsonify({
|
return jsonify({
|
||||||
'success': True,
|
'success': True,
|
||||||
'message': 'Mahnstufe zurückgesetzt, Frist um 14 Tage verlängert und Ausweis entsperrt.'
|
'message': f'Mahnstufe zurückgesetzt, Frist um {days} Tage verlängert und Ausweis entsperrt.'
|
||||||
})
|
})
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -4366,9 +4232,12 @@ def api_library_scan_action():
|
|||||||
due_date = now + datetime.timedelta(days=borrow_duration_days)
|
due_date = now + datetime.timedelta(days=borrow_duration_days)
|
||||||
|
|
||||||
it.update_item_status(item_id, False, borrower_name)
|
it.update_item_status(item_id, False, borrower_name)
|
||||||
|
borrower_user = us.get_user_by_student_card(student_card_id)
|
||||||
|
if not borrower_user or not borrower_user.get('_id'):
|
||||||
|
return jsonify({'ok': False, 'message': 'Kein Benutzer für diesen Schülerausweis gefunden.'}), 404
|
||||||
au.add_ausleihung(
|
au.add_ausleihung(
|
||||||
item_id,
|
item_id,
|
||||||
borrower_name,
|
str(borrower_user['_id']),
|
||||||
now,
|
now,
|
||||||
end_date=due_date,
|
end_date=due_date,
|
||||||
due_date=due_date,
|
due_date=due_date,
|
||||||
@@ -5605,6 +5474,7 @@ def login():
|
|||||||
if user:
|
if user:
|
||||||
app.logger.info(f"Login success: username={encrypt_text(username)!r} tenant={current_tenant_id or 'default'} db={current_tenant_db} host={request.host} ip={encrypt_text(request.remote_addr)}")
|
app.logger.info(f"Login success: username={encrypt_text(username)!r} tenant={current_tenant_id or 'default'} db={current_tenant_db} host={request.host} ip={encrypt_text(request.remote_addr)}")
|
||||||
session['username'] = username
|
session['username'] = username
|
||||||
|
session['user_id'] = str(user.get('_id'))
|
||||||
is_admin_user = bool(user.get('Admin', False))
|
is_admin_user = bool(user.get('Admin', False))
|
||||||
session['admin'] = is_admin_user
|
session['admin'] = is_admin_user
|
||||||
session['is_admin'] = is_admin_user
|
session['is_admin'] = is_admin_user
|
||||||
@@ -5735,6 +5605,8 @@ def get_items():
|
|||||||
favorites = set(session.get('favorites', []))
|
favorites = set(session.get('favorites', []))
|
||||||
|
|
||||||
available_only = str(request.args.get('available_only', '')).strip().lower() in ('1', 'true', 'yes', 'on')
|
available_only = str(request.args.get('available_only', '')).strip().lower() in ('1', 'true', 'yes', 'on')
|
||||||
|
search_term = str(request.args.get('search', '')).strip()
|
||||||
|
search_scope = str(request.args.get('search_scope', 'all')).strip().lower()
|
||||||
offset_raw = request.args.get('offset')
|
offset_raw = request.args.get('offset')
|
||||||
limit_raw = request.args.get('limit')
|
limit_raw = request.args.get('limit')
|
||||||
light_mode_param = str(request.args.get('light_mode', '')).strip().lower()
|
light_mode_param = str(request.args.get('light_mode', '')).strip().lower()
|
||||||
@@ -5770,6 +5642,42 @@ def get_items():
|
|||||||
'Deleted': {'$ne': True},
|
'Deleted': {'$ne': True},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if search_term:
|
||||||
|
search_pattern = re.escape(search_term[:200])
|
||||||
|
if search_scope in ('description', 'title_description'):
|
||||||
|
search_fields = ['Name', 'Beschreibung']
|
||||||
|
else:
|
||||||
|
search_fields = [
|
||||||
|
'Name', 'Beschreibung', 'Code_4', 'ISBN',
|
||||||
|
'Author', 'Autor',
|
||||||
|
]
|
||||||
|
|
||||||
|
direct_matches = [{field: {'$regex': search_pattern, '$options': 'i'}}
|
||||||
|
for field in search_fields]
|
||||||
|
if search_scope not in ('description', 'title_description') and search_term.isdigit():
|
||||||
|
direct_matches.append({'Code_4': int(search_term)})
|
||||||
|
grouped_parent_ids = [
|
||||||
|
child.get('ParentItemId')
|
||||||
|
for child in items_col.find(
|
||||||
|
{
|
||||||
|
'IsGroupedSubItem': True,
|
||||||
|
'Deleted': {'$ne': True},
|
||||||
|
'$or': direct_matches,
|
||||||
|
},
|
||||||
|
{'ParentItemId': 1},
|
||||||
|
)
|
||||||
|
if child.get('ParentItemId')
|
||||||
|
]
|
||||||
|
if grouped_parent_ids:
|
||||||
|
direct_matches.append({'_id': {'$in': grouped_parent_ids}})
|
||||||
|
|
||||||
|
base_query = {
|
||||||
|
'$and': [
|
||||||
|
base_query,
|
||||||
|
{'$or': direct_matches},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
total_count = items_col.count_documents(base_query)
|
total_count = items_col.count_documents(base_query)
|
||||||
|
|
||||||
light_projection = {
|
light_projection = {
|
||||||
@@ -5836,6 +5744,7 @@ def get_items():
|
|||||||
'ParentItemId': 1,
|
'ParentItemId': 1,
|
||||||
'Code_4': 1,
|
'Code_4': 1,
|
||||||
'Verfuegbar': 1,
|
'Verfuegbar': 1,
|
||||||
|
'User': 1,
|
||||||
'Name': 1,
|
'Name': 1,
|
||||||
}
|
}
|
||||||
# Full mode: complete child data with all details
|
# Full mode: complete child data with all details
|
||||||
@@ -5844,6 +5753,7 @@ def get_items():
|
|||||||
'ParentItemId': 1,
|
'ParentItemId': 1,
|
||||||
'Code_4': 1,
|
'Code_4': 1,
|
||||||
'Verfuegbar': 1,
|
'Verfuegbar': 1,
|
||||||
|
'User': 1,
|
||||||
'Name': 1,
|
'Name': 1,
|
||||||
'Images': 1,
|
'Images': 1,
|
||||||
'ThumbnailInfo': 1,
|
'ThumbnailInfo': 1,
|
||||||
@@ -5871,13 +5781,26 @@ def get_items():
|
|||||||
grouped_units = [itm] + grouped_children
|
grouped_units = [itm] + grouped_children
|
||||||
available_units = []
|
available_units = []
|
||||||
grouped_all_codes = []
|
grouped_all_codes = []
|
||||||
|
grouped_unit_states = []
|
||||||
for unit in grouped_units:
|
for unit in grouped_units:
|
||||||
|
unit_id = str(unit['_id']) if not isinstance(unit['_id'], str) else unit['_id']
|
||||||
unit_code = unit.get('Code_4')
|
unit_code = unit.get('Code_4')
|
||||||
if unit_code is not None and str(unit_code).strip() != '':
|
if unit_code is not None and str(unit_code).strip() != '':
|
||||||
grouped_all_codes.append(str(unit_code).strip())
|
normalized_code = str(unit_code).strip()
|
||||||
|
grouped_all_codes.append(normalized_code)
|
||||||
|
else:
|
||||||
|
normalized_code = ''
|
||||||
|
|
||||||
|
grouped_unit_states.append({
|
||||||
|
'id': unit_id,
|
||||||
|
'code': normalized_code,
|
||||||
|
'available': bool(unit.get('Verfuegbar', True)),
|
||||||
|
'borrowed_by_current_user': bool(
|
||||||
|
username and str(unit.get('User') or '') == str(username)
|
||||||
|
),
|
||||||
|
})
|
||||||
|
|
||||||
if unit.get('Verfuegbar', True):
|
if unit.get('Verfuegbar', True):
|
||||||
unit_id = str(unit['_id']) if not isinstance(unit['_id'], str) else unit['_id']
|
|
||||||
code = unit.get('Code_4') or '-'
|
code = unit.get('Code_4') or '-'
|
||||||
available_units.append({
|
available_units.append({
|
||||||
'id': unit_id,
|
'id': unit_id,
|
||||||
@@ -5890,6 +5813,7 @@ def get_items():
|
|||||||
itm['AvailableGroupedCount'] = len(available_units)
|
itm['AvailableGroupedCount'] = len(available_units)
|
||||||
itm['GroupedAvailableUnits'] = available_units
|
itm['GroupedAvailableUnits'] = available_units
|
||||||
itm['GroupedAllCodes'] = grouped_all_codes
|
itm['GroupedAllCodes'] = grouped_all_codes
|
||||||
|
itm['GroupedUnitStates'] = grouped_unit_states
|
||||||
if grouped_count > 1:
|
if grouped_count > 1:
|
||||||
itm['Verfuegbar'] = len(available_units) > 0
|
itm['Verfuegbar'] = len(available_units) > 0
|
||||||
if available_only and not itm.get('Verfuegbar', False):
|
if available_only and not itm.get('Verfuegbar', False):
|
||||||
@@ -5951,10 +5875,7 @@ def get_bookings():
|
|||||||
result = []
|
result = []
|
||||||
for booking in bookings:
|
for booking in bookings:
|
||||||
raw_booking_user = booking.get('User') or ''
|
raw_booking_user = booking.get('User') or ''
|
||||||
try:
|
booking_user = str(raw_booking_user)
|
||||||
booking_user = decrypt_text(raw_booking_user) if raw_booking_user else ''
|
|
||||||
except Exception:
|
|
||||||
booking_user = str(raw_booking_user)
|
|
||||||
start_dt = booking.get('Start')
|
start_dt = booking.get('Start')
|
||||||
if not start_dt:
|
if not start_dt:
|
||||||
continue
|
continue
|
||||||
@@ -6000,7 +5921,7 @@ def get_bookings():
|
|||||||
'userName': str(booking_user),
|
'userName': str(booking_user),
|
||||||
'notes': str(booking.get('Notes') or ''),
|
'notes': str(booking.get('Notes') or ''),
|
||||||
'period': period,
|
'period': period,
|
||||||
'isCurrentUser': str(booking_user) == username,
|
'isCurrentUser': str(booking_user) == str(current_user_id),
|
||||||
'itemBorrower': item_borrower,
|
'itemBorrower': item_borrower,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -6120,7 +6041,10 @@ def api_booking_conflicts():
|
|||||||
current_permissions = us.get_effective_permissions(session['username'])
|
current_permissions = us.get_effective_permissions(session['username'])
|
||||||
|
|
||||||
if not current_permissions['actions'].get('can_view_logs', False):
|
if not current_permissions['actions'].get('can_view_logs', False):
|
||||||
query['User'] = session['username']
|
current_user = us.get_user(session['username'])
|
||||||
|
if not current_user or not current_user.get('_id'):
|
||||||
|
return jsonify({'error': 'User account could not be resolved'}), 401
|
||||||
|
query['User'] = str(current_user['_id'])
|
||||||
|
|
||||||
conflicts = list(ausleihungen.find(query))
|
conflicts = list(ausleihungen.find(query))
|
||||||
result = []
|
result = []
|
||||||
@@ -7461,6 +7385,11 @@ def ausleihen(id):
|
|||||||
return redirect(url_for('login'))
|
return redirect(url_for('login'))
|
||||||
|
|
||||||
username = session['username']
|
username = session['username']
|
||||||
|
current_user = us.get_user(username)
|
||||||
|
if not current_user or not current_user.get('_id'):
|
||||||
|
flash('Benutzerkonto konnte nicht eindeutig ermittelt werden.', 'error')
|
||||||
|
return redirect(url_for('login'))
|
||||||
|
effective_borrower_id = str(current_user['_id'])
|
||||||
requested_return_to = (request.form.get('return_to') or '').strip().lower()
|
requested_return_to = (request.form.get('return_to') or '').strip().lower()
|
||||||
if requested_return_to == 'library' and cfg.MODULES.is_enabled('library'):
|
if requested_return_to == 'library' and cfg.MODULES.is_enabled('library'):
|
||||||
redirect_target = 'library_view'
|
redirect_target = 'library_view'
|
||||||
@@ -7534,6 +7463,7 @@ def ausleihen(id):
|
|||||||
flash('Keine Schülerin/kein Schüler mit dieser Ausweis-ID gefunden.', 'error')
|
flash('Keine Schülerin/kein Schüler mit dieser Ausweis-ID gefunden.', 'error')
|
||||||
return redirect(url_for('library_view'))
|
return redirect(url_for('library_view'))
|
||||||
effective_borrower = student_user.get('Username') or student_user.get('username') or username
|
effective_borrower = student_user.get('Username') or student_user.get('username') or username
|
||||||
|
effective_borrower_id = str(student_user['_id'])
|
||||||
if borrow_duration_days is None:
|
if borrow_duration_days is None:
|
||||||
try:
|
try:
|
||||||
card_default = int(student_user.get('MaxBorrowDays', cfg.STUDENT_DEFAULT_BORROW_DAYS))
|
card_default = int(student_user.get('MaxBorrowDays', cfg.STUDENT_DEFAULT_BORROW_DAYS))
|
||||||
@@ -7608,7 +7538,7 @@ def ausleihen(id):
|
|||||||
it.update_item_status(unit_id, False, effective_borrower)
|
it.update_item_status(unit_id, False, effective_borrower)
|
||||||
au.add_ausleihung(
|
au.add_ausleihung(
|
||||||
unit_id,
|
unit_id,
|
||||||
effective_borrower,
|
effective_borrower_id,
|
||||||
start_date,
|
start_date,
|
||||||
end_date=end_date,
|
end_date=end_date,
|
||||||
due_date=end_date if is_library_item else None,
|
due_date=end_date if is_library_item else None,
|
||||||
@@ -7705,7 +7635,7 @@ def ausleihen(id):
|
|||||||
start_date = datetime.datetime.now(ZoneInfo("Europe/Berlin"))
|
start_date = datetime.datetime.now(ZoneInfo("Europe/Berlin"))
|
||||||
au.add_ausleihung(
|
au.add_ausleihung(
|
||||||
id,
|
id,
|
||||||
effective_borrower,
|
effective_borrower_id,
|
||||||
start_date,
|
start_date,
|
||||||
end_date=end_date,
|
end_date=end_date,
|
||||||
due_date=end_date if is_library_item else None,
|
due_date=end_date if is_library_item else None,
|
||||||
@@ -7756,7 +7686,7 @@ def ausleihen(id):
|
|||||||
exemplar_id = f"{id}_{exemplar['number']}"
|
exemplar_id = f"{id}_{exemplar['number']}"
|
||||||
au.add_ausleihung(
|
au.add_ausleihung(
|
||||||
exemplar_id,
|
exemplar_id,
|
||||||
effective_borrower,
|
effective_borrower_id,
|
||||||
start_date,
|
start_date,
|
||||||
end_date=end_date,
|
end_date=end_date,
|
||||||
due_date=end_date if is_library_item else None,
|
due_date=end_date if is_library_item else None,
|
||||||
@@ -7917,7 +7847,12 @@ def get_ausleihung_by_item_route(id):
|
|||||||
|
|
||||||
current_permissions = us.get_effective_permissions(session['username'])
|
current_permissions = us.get_effective_permissions(session['username'])
|
||||||
|
|
||||||
if ausleihung and (current_permissions['actions'].get('can_manage_users')) or ausleihung.get('User') == session['username']:
|
current_user = us.get_user(session['username'])
|
||||||
|
current_user_id = str(current_user['_id']) if current_user and current_user.get('_id') else ''
|
||||||
|
if ausleihung and (
|
||||||
|
current_permissions['actions'].get('can_manage_users')
|
||||||
|
or ausleihung.get('User') == current_user_id
|
||||||
|
):
|
||||||
return {'ausleihung': ausleihung, 'status': 'success'}
|
return {'ausleihung': ausleihung, 'status': 'success'}
|
||||||
|
|
||||||
item = it.get_item(id)
|
item = it.get_item(id)
|
||||||
@@ -8199,7 +8134,7 @@ def plan_booking():
|
|||||||
try:
|
try:
|
||||||
for _, period, period_times in requested_slots:
|
for _, period, period_times in requested_slots:
|
||||||
booking_id = au.add_planned_booking(
|
booking_id = au.add_planned_booking(
|
||||||
item_id, session['username'], period_times['start'],
|
item_id, session.get('user_id') or str(us.get_user(session['username'])['_id']), period_times['start'],
|
||||||
period_times['end'], notes, period=period
|
period_times['end'], notes, period=period
|
||||||
)
|
)
|
||||||
if not booking_id:
|
if not booking_id:
|
||||||
@@ -8252,7 +8187,7 @@ def process_day_bookings(item_id, booking_date, periods, notes):
|
|||||||
# Create the booking
|
# Create the booking
|
||||||
booking_id = au.add_planned_booking(
|
booking_id = au.add_planned_booking(
|
||||||
item_id,
|
item_id,
|
||||||
session['username'],
|
session.get('user_id') or str(us.get_user(session['username'])['_id']),
|
||||||
start_time,
|
start_time,
|
||||||
end_time,
|
end_time,
|
||||||
notes,
|
notes,
|
||||||
@@ -8319,7 +8254,7 @@ def add_booking():
|
|||||||
# Continue with adding the booking
|
# Continue with adding the booking
|
||||||
booking_id = au.add_planned_booking(
|
booking_id = au.add_planned_booking(
|
||||||
item_id=item_id,
|
item_id=item_id,
|
||||||
user=session['username'],
|
user_id=session.get('user_id') or str(us.get_user(session['username'])['_id']),
|
||||||
start_date=start_date,
|
start_date=start_date,
|
||||||
end_date=end_date,
|
end_date=end_date,
|
||||||
notes=notes,
|
notes=notes,
|
||||||
@@ -8350,8 +8285,10 @@ def cancel_booking(id):
|
|||||||
current_permissions = us.get_effective_permissions(session['username'])
|
current_permissions = us.get_effective_permissions(session['username'])
|
||||||
|
|
||||||
# Check if user owns this booking
|
# Check if user owns this booking
|
||||||
booking_user = au.dp.decrypt_text(booking.get('User')) if booking.get('User') else ''
|
current_user = us.get_user(session['username'])
|
||||||
if booking_user != session['username'] and not current_permissions['actions'].get('can_manage_users', False):
|
current_user_id = str(current_user['_id']) if current_user and current_user.get('_id') else ''
|
||||||
|
booking_user_id = str(booking.get('User') or '')
|
||||||
|
if booking_user_id != current_user_id and not current_permissions['actions'].get('can_manage_users', False):
|
||||||
return {"success": False, "error": "Not authorized to cancel this booking"}, 403
|
return {"success": False, "error": "Not authorized to cancel this booking"}, 403
|
||||||
|
|
||||||
# Cancel the booking
|
# Cancel the booking
|
||||||
@@ -10913,7 +10850,9 @@ def search_word(word):
|
|||||||
if (term_lower in text.lower()) or (term_lower in title_text.lower()):
|
if (term_lower in text.lower()) or (term_lower in title_text.lower()):
|
||||||
_id = i.get("_id")
|
_id = i.get("_id")
|
||||||
if _id is not None:
|
if _id is not None:
|
||||||
id_set.add(str(_id))
|
item_id = str(_id)
|
||||||
|
parent_id = i.get('ParentItemId')
|
||||||
|
id_set.add(str(parent_id or item_id))
|
||||||
|
|
||||||
return jsonify({"success": True, "response": list(id_set)})
|
return jsonify({"success": True, "response": list(id_set)})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -12281,7 +12220,7 @@ def schedule_appointment():
|
|||||||
# Use add_ausleihung directly to set the correct initial status
|
# Use add_ausleihung directly to set the correct initial status
|
||||||
appointment_id = au.add_ausleihung(
|
appointment_id = au.add_ausleihung(
|
||||||
item_id=item_id,
|
item_id=item_id,
|
||||||
user=session['username'],
|
user_id=session.get('user_id') or str(us.get_user(session['username'])['_id']),
|
||||||
start_date=start_datetime,
|
start_date=start_datetime,
|
||||||
end_date=end_datetime,
|
end_date=end_datetime,
|
||||||
notes=notes,
|
notes=notes,
|
||||||
@@ -13775,6 +13714,13 @@ def upload_csv_batch():
|
|||||||
"images_failed": error_count
|
"images_failed": error_count
|
||||||
}), 200
|
}), 200
|
||||||
|
|
||||||
|
@app.route('/get/asv_export', methods=['GET'])
|
||||||
|
def get_asv_export():
|
||||||
|
if 'username' not in session:
|
||||||
|
flash('Bitte melden Sie sich an.', 'error')
|
||||||
|
return redirect(url_for('login'))
|
||||||
|
return send_from_directory(app.static_folder, 'img/asv_export_invario_2026.exfj')
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@app.route('/test_email')
|
@app.route('/test_email')
|
||||||
def test_email():
|
def test_email():
|
||||||
|
|||||||
@@ -185,13 +185,13 @@ def create_backup_database():
|
|||||||
|
|
||||||
# === AUSLEIHUNG MANAGEMENT ===
|
# === AUSLEIHUNG MANAGEMENT ===
|
||||||
|
|
||||||
def add_ausleihung(item_id, user, start_date, end_date=None, notes="", status="active", period=None, exemplar_data=None, due_date=None):
|
def add_ausleihung(item_id, user_id, start_date, end_date=None, notes="", status="active", period=None, exemplar_data=None, due_date=None):
|
||||||
"""
|
"""
|
||||||
Add a new borrowing record for an item.
|
Add a new borrowing record for an item.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
item_id (str): ID of the item borrowed
|
item_id (str): ID of the item borrowed
|
||||||
user (str): Username of the borrower
|
user_id (str): ID of the borrower
|
||||||
start_date (datetime): Start date and time of the borrowing
|
start_date (datetime): Start date and time of the borrowing
|
||||||
end_date (datetime, optional): End date and time if already returned
|
end_date (datetime, optional): End date and time if already returned
|
||||||
notes (str, optional): Additional notes about the borrowing
|
notes (str, optional): Additional notes about the borrowing
|
||||||
@@ -209,7 +209,7 @@ def add_ausleihung(item_id, user, start_date, end_date=None, notes="", status="a
|
|||||||
|
|
||||||
ausleihung = {
|
ausleihung = {
|
||||||
'Item': item_id,
|
'Item': item_id,
|
||||||
'User': dp.encrypt_text(user),
|
'User': str(user_id),
|
||||||
'Start': start_date,
|
'Start': start_date,
|
||||||
'Status': status
|
'Status': status
|
||||||
}
|
}
|
||||||
@@ -256,8 +256,7 @@ def update_ausleihung(id, item_id=None, user_id=None, start=None, end=None, note
|
|||||||
if item_id is not None:
|
if item_id is not None:
|
||||||
update_data['Item'] = item_id
|
update_data['Item'] = item_id
|
||||||
if user_id is not None:
|
if user_id is not None:
|
||||||
# WICHTIG: Gleiche Verschlüsselung wie in add_ausleihung nutzen!
|
update_data['User'] = str(user_id)
|
||||||
update_data['User'] = dp.encrypt_text(user_id) if hasattr(dp, 'encrypt_text') else user_id
|
|
||||||
if start is not None:
|
if start is not None:
|
||||||
update_data['Start'] = ensure_timezone_aware(start)
|
update_data['Start'] = ensure_timezone_aware(start)
|
||||||
if end is not None:
|
if end is not None:
|
||||||
@@ -556,9 +555,7 @@ def get_ausleihung_by_user(user_id, status=None, use_client_side_verification=Tr
|
|||||||
db = client[cfg.MONGODB_DB]
|
db = client[cfg.MONGODB_DB]
|
||||||
ausleihungen = db['ausleihungen']
|
ausleihungen = db['ausleihungen']
|
||||||
|
|
||||||
# Ensure proper encrypted query string if user IDs are encrypted in DB
|
query = {'User': str(user_id), 'Status': {'$ne': 'deleted'}}
|
||||||
search_user = dp.encrypt_text(user_id) if hasattr(dp, 'encrypt_text') else user_id
|
|
||||||
query = {'User': search_user, 'Status': {'$ne': 'deleted'}}
|
|
||||||
|
|
||||||
if not use_client_side_verification:
|
if not use_client_side_verification:
|
||||||
if status is not None:
|
if status is not None:
|
||||||
@@ -864,8 +861,8 @@ def reset_item_completely(item_id):
|
|||||||
|
|
||||||
# === KOMPATIBILITÄTSFUNKTIONEN ===
|
# === KOMPATIBILITÄTSFUNKTIONEN ===
|
||||||
|
|
||||||
def add_planned_booking(item_id, user, start_date, end_date, notes="", period=None):
|
def add_planned_booking(item_id, user_id, start_date, end_date, notes="", period=None):
|
||||||
return add_ausleihung(item_id, user, start_date, end_date, notes, status='planned', period=period)
|
return add_ausleihung(item_id, user_id, start_date, end_date, notes, status='planned', period=period)
|
||||||
|
|
||||||
|
|
||||||
def check_booking_conflict(item_id, start_date, end_date, period=None):
|
def check_booking_conflict(item_id, start_date, end_date, period=None):
|
||||||
|
|||||||
@@ -921,6 +921,42 @@ html, body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* iPad layout: keep content airy while using the available tablet width. */
|
||||||
|
@media screen and (min-width: 768px) and (max-width: 1180px) {
|
||||||
|
.container {
|
||||||
|
width: min(100% - 32px, 1120px);
|
||||||
|
margin: 16px auto;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control,
|
||||||
|
.form-select,
|
||||||
|
textarea,
|
||||||
|
input,
|
||||||
|
select {
|
||||||
|
min-height: 44px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn,
|
||||||
|
button,
|
||||||
|
input[type="submit"],
|
||||||
|
input[type="button"] {
|
||||||
|
min-height: 44px;
|
||||||
|
touch-action: manipulation;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-responsive {
|
||||||
|
border: 1px solid var(--ui-border);
|
||||||
|
border-radius: var(--ui-radius);
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-responsive > .table {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ========================================================= */
|
/* ========================================================= */
|
||||||
/* UNIVERSAL DARK MODE OVERRIDES FOR HARDCODED HTML STYLES */
|
/* UNIVERSAL DARK MODE OVERRIDES FOR HARDCODED HTML STYLES */
|
||||||
/* ========================================================= */
|
/* ========================================================= */
|
||||||
|
|||||||
Binary file not shown.
@@ -78,11 +78,11 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="filter_name_1">Name Filter 1</label>
|
<label for="filter_name_1">Name Filter 1</label>
|
||||||
<input type="text" id="filter_name_1" name="filter_name_1" value="{{ filter_names.get('1', 'Klassenstufe') }}" placeholder="z. B. Klassenstufe">
|
<input type="text" id="filter_name_1" name="filter_name_1" value="{{ filter_names.get('1', 'Fachgebiet') }}" placeholder="z. B. Fachgebiet">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="filter_name_2">Name Filter 2</label>
|
<label for="filter_name_2">Name Filter 2</label>
|
||||||
<input type="text" id="filter_name_2" name="filter_name_2" value="{{ filter_names.get('2', 'Fach') }}" placeholder="z. B. Fach">
|
<input type="text" id="filter_name_2" name="filter_name_2" value="{{ filter_names.get('2', 'Klassenstufe') }}" placeholder="z. B. Klassenstufe">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="filter_name_3">Name Filter 3</label>
|
<label for="filter_name_3">Name Filter 3</label>
|
||||||
|
|||||||
@@ -1301,8 +1301,6 @@
|
|||||||
<button class="function-search-btn" type="submit">Los</button>
|
<button class="function-search-btn" type="submit">Los</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% if current_tenant_db %}
|
|
||||||
<span class="navbar-text tenant-badge" title="Aktive Tenant-Datenbank">{{ current_tenant_db }}</span>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span class="navbar-text text-light me-3">{{ session['username'] }}</span>
|
<span class="navbar-text text-light me-3">{{ session['username'] }}</span>
|
||||||
<div class="dropdown me-2 user-menu-wrap">
|
<div class="dropdown me-2 user-menu-wrap">
|
||||||
@@ -1332,7 +1330,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if library_module_enabled and CURRENT_MODULE == 'library' %}
|
{% if library_module_enabled and CURRENT_MODULE == 'library' %}
|
||||||
<nav class="navbar navbar-expand-lg navbar-dark" id="libraryNavbar">
|
<nav class="navbar navbar-expand-lg navbar-dark" id="libraryNavbar">
|
||||||
|
|||||||
@@ -26,18 +26,27 @@
|
|||||||
<form method="POST" action="{{ url_for('change_password') }}">
|
<form method="POST" action="{{ url_for('change_password') }}">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="current_password">Aktuelles Passwort:</label>
|
<label for="current_password">Aktuelles Passwort:</label>
|
||||||
<input type="password" id="current_password" name="current_password" required>
|
<div class="input-group">
|
||||||
|
<input type="password" class="form-control" id="current_password" name="current_password" required>
|
||||||
|
<button class="btn btn-outline-secondary" type="button" onclick="togglePasswordVisibility('current_password', this)">Anzeigen</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="new_password">Neues Passwort:</label>
|
<label for="new_password">Neues Passwort:</label>
|
||||||
<input type="password" id="new_password" name="new_password" required>
|
<div class="input-group">
|
||||||
|
<input type="password" class="form-control" id="new_password" name="new_password" required>
|
||||||
|
<button class="btn btn-outline-secondary" type="button" onclick="togglePasswordVisibility('new_password', this)">Anzeigen</button>
|
||||||
|
</div>
|
||||||
<small class="form-text text-muted">Das Passwort sollte mindestens 6 Zeichen lang sein.</small>
|
<small class="form-text text-muted">Das Passwort sollte mindestens 6 Zeichen lang sein.</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="confirm_password">Neues Passwort bestätigen:</label>
|
<label for="confirm_password">Neues Passwort bestätigen:</label>
|
||||||
<input type="password" id="confirm_password" name="confirm_password" required>
|
<div class="input-group">
|
||||||
|
<input type="password" class="form-control" id="confirm_password" name="confirm_password" required>
|
||||||
|
<button class="btn btn-outline-secondary" type="button" onclick="togglePasswordVisibility('confirm_password', this)">Anzeigen</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
@@ -48,6 +57,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function togglePasswordVisibility(fieldId, button) {
|
||||||
|
var passwordInput = document.getElementById(fieldId);
|
||||||
|
|
||||||
|
if (passwordInput.type === 'password') {
|
||||||
|
passwordInput.type = 'text';
|
||||||
|
button.textContent = 'Verbergen';
|
||||||
|
} else {
|
||||||
|
passwordInput.type = 'password';
|
||||||
|
button.textContent = 'Anzeigen';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.password-change-form {
|
.password-change-form {
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
@@ -74,7 +97,7 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="password"] {
|
.form-control {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border: 1px solid #ced4da;
|
border: 1px solid #ced4da;
|
||||||
@@ -122,6 +145,16 @@
|
|||||||
.btn-secondary:hover {
|
.btn-secondary:hover {
|
||||||
background-color: #5a6268;
|
background-color: #5a6268;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-outline-secondary {
|
||||||
|
border: 1px solid #ced4da;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
color: #495057;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-outline-secondary:hover {
|
||||||
|
background-color: #e2e6ea;
|
||||||
|
}
|
||||||
|
|
||||||
.alert {
|
.alert {
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
@@ -141,4 +174,4 @@
|
|||||||
border: 1px solid #c3e6cb;
|
border: 1px solid #c3e6cb;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -278,8 +278,8 @@
|
|||||||
<div class="multi-filter">
|
<div class="multi-filter">
|
||||||
{% for idx in range(4) %}
|
{% for idx in range(4) %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="filter1-{{ idx + 1 }}">Wert {{ idx + 1 }}:</label>
|
<label for="filter2-{{ idx + 1 }}">Wert {{ idx + 1 }}:</label>
|
||||||
<select id="filter1-{{ idx + 1 }}" name="filter" class="filter-dropdown-select" data-selected="{{ item.Filter[idx] if item.Filter and item.Filter|length > idx else '' }}">
|
<select id="filter2-{{ idx + 1 }}" name="filter" class="filter-dropdown-select" data-selected="{{ item.Filter[idx] if item.Filter and item.Filter|length > idx else '' }}">
|
||||||
<option value="">-- Optional --</option>
|
<option value="">-- Optional --</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@@ -290,8 +290,8 @@
|
|||||||
<div class="multi-filter">
|
<div class="multi-filter">
|
||||||
{% for idx in range(4) %}
|
{% for idx in range(4) %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="filter2-{{ idx + 1 }}">Wert {{ idx + 1 }}:</label>
|
<label for="filter1-{{ idx + 1 }}">Wert {{ idx + 1 }}:</label>
|
||||||
<select id="filter2-{{ idx + 1 }}" name="filter2" class="filter-dropdown-select" data-selected="{{ item.Filter2[idx] if item.Filter2 and item.Filter2|length > idx else '' }}">
|
<select id="filter1-{{ idx + 1 }}" name="filter2" class="filter-dropdown-select" data-selected="{{ item.Filter2[idx] if item.Filter2 and item.Filter2|length > idx else '' }}">
|
||||||
<option value="">-- Optional --</option>
|
<option value="">-- Optional --</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1419,6 +1419,7 @@
|
|||||||
keyboardScannerEnabled = false;
|
keyboardScannerEnabled = false;
|
||||||
keyboardScanBuffer = '';
|
keyboardScanBuffer = '';
|
||||||
keyboardLastKeyAt = 0;
|
keyboardLastKeyAt = 0;
|
||||||
|
setActiveStudentCard('');
|
||||||
document.removeEventListener('keydown', keyboardScanKeydownHandler);
|
document.removeEventListener('keydown', keyboardScanKeydownHandler);
|
||||||
const modal = document.getElementById('physicalScannerModal');
|
const modal = document.getElementById('physicalScannerModal');
|
||||||
if (modal) modal.style.display = 'none';
|
if (modal) modal.style.display = 'none';
|
||||||
|
|||||||
@@ -187,7 +187,11 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<button type="button" class="btn btn-sm btn-outline-warning text-dark"
|
<button type="button" class="btn btn-sm btn-outline-warning text-dark"
|
||||||
onclick="resetMahnung('{{ item.id }}', '{{ item.schueler_name }}')">
|
onclick="resetMahnung('{{ item.id }}', '{{ item.schueler_name }}')">
|
||||||
<i class="bi bi-arrow-counterclockwise"></i> Zurücksetzen
|
<i class="bi bi-arrow-counterclockwise"></i> Zurücksetzen (14 Tage)
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-sm btn-outline-warning text-dark"
|
||||||
|
onclick="resetMahnungCustom('{{ item.id }}', '{{ item.schueler_name }}')">
|
||||||
|
<i class="bi bi-arrow-counterclockwise"></i> Zurücksetzen mit eigener Frist
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -210,7 +214,7 @@
|
|||||||
|
|
||||||
<!-- E-Mail Modal -->
|
<!-- E-Mail Modal -->
|
||||||
<div class="modal fade" id="emailModal" tabindex="-1" aria-labelledby="emailModalLabel" aria-hidden="true">
|
<div class="modal fade" id="emailModal" tabindex="-1" aria-labelledby="emailModalLabel" aria-hidden="true">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title" id="emailModalLabel">Mahnungs-E-Mail senden</h5>
|
<h5 class="modal-title" id="emailModalLabel">Mahnungs-E-Mail senden</h5>
|
||||||
@@ -228,7 +232,7 @@
|
|||||||
<input type="email" class="form-control" id="modalEmail" placeholder="E-Mail-Adresse eingeben...">
|
<input type="email" class="form-control" id="modalEmail" placeholder="E-Mail-Adresse eingeben...">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="modalMessage" class="form-label">Nachricht</label>
|
<label for="modalMessage" class="form-label">Nachrichten-Text</label>
|
||||||
<textarea class="form-control" id="modalMessage" rows="4" placeholder="Optionaler Text..."></textarea>
|
<textarea class="form-control" id="modalMessage" rows="4" placeholder="Optionaler Text..."></textarea>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -241,6 +245,31 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Custom Reset Days Modal -->
|
||||||
|
<div class="modal fade" id="customResetModal" tabindex="-1" aria-labelledby="customResetModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="customResetModalLabel">Mahnung zurücksetzen</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Schließen"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="hidden" id="resetModalLoanId">
|
||||||
|
<p>Möchten Sie die Mahnung für <strong id="resetModalStudentName"></strong> wirklich zurücksetzen?</p>
|
||||||
|
<p class="text-muted small">Dadurch wird die Mahnstufe auf 0 gesetzt und der Schülerausweis entsperrt.</p>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="resetModalDays" class="form-label">Frist verlängern um (Tage):</label>
|
||||||
|
<input type="number" class="form-control" id="resetModalDays" value="14" min="1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Abbrechen</button>
|
||||||
|
<button type="button" class="btn btn-warning" onclick="submitCustomReset()">Mahnung zurücksetzen</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function openEmailModal(loanId, studentName, studentEmail) {
|
function openEmailModal(loanId, studentName, studentEmail) {
|
||||||
document.getElementById('modalLoanId').value = loanId;
|
document.getElementById('modalLoanId').value = loanId;
|
||||||
@@ -292,7 +321,7 @@ function resetMahnung(loanId, studentName) {
|
|||||||
|
|
||||||
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.content || '';
|
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.content || '';
|
||||||
|
|
||||||
fetch('/mahnungen_reset', {
|
fetch('/mahnungen_reset/14', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json', 'X-CSRFToken': csrfToken },
|
headers: { 'Content-Type': 'application/json', 'X-CSRFToken': csrfToken },
|
||||||
body: JSON.stringify({ loan_id: loanId })
|
body: JSON.stringify({ loan_id: loanId })
|
||||||
@@ -301,7 +330,46 @@ function resetMahnung(loanId, studentName) {
|
|||||||
.then(data => {
|
.then(data => {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
alert(data.message);
|
alert(data.message);
|
||||||
location.reload(); // Seite neu laden, um die aktualisierte Ansicht zu sehen
|
location.reload();
|
||||||
|
} else {
|
||||||
|
alert('Fehler: ' + data.message);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
alert('Fehler beim Senden der Anfrage.');
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetMahnungCustom(loanId, studentName) {
|
||||||
|
document.getElementById('resetModalLoanId').value = loanId;
|
||||||
|
document.getElementById('resetModalStudentName').textContent = studentName;
|
||||||
|
document.getElementById('resetModalDays').value = 14;
|
||||||
|
|
||||||
|
var customModal = new bootstrap.Modal(document.getElementById('customResetModal'));
|
||||||
|
customModal.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitCustomReset() {
|
||||||
|
const loanId = document.getElementById('resetModalLoanId').value;
|
||||||
|
const daysToExtend = parseInt(document.getElementById('resetModalDays').value, 10);
|
||||||
|
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.content || '';
|
||||||
|
|
||||||
|
if (isNaN(daysToExtend) || daysToExtend < 1) {
|
||||||
|
alert('Bitte geben Sie eine gültige Anzahl an Tagen ein.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch(`/mahnungen_reset/${daysToExtend}`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json', 'X-CSRFToken': csrfToken },
|
||||||
|
body: JSON.stringify({ loan_id: loanId })
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.success) {
|
||||||
|
alert(data.message);
|
||||||
|
location.reload();
|
||||||
} else {
|
} else {
|
||||||
alert('Fehler: ' + data.message);
|
alert('Fehler: ' + data.message);
|
||||||
}
|
}
|
||||||
|
|||||||
+186
-19
@@ -1971,6 +1971,122 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* iPad: use the wider canvas for cards, filters, forms, and image previews. */
|
||||||
|
@media screen and (min-width: 768px) and (max-width: 1180px) {
|
||||||
|
.admin-content-container {
|
||||||
|
width: min(100%, 1120px) !important;
|
||||||
|
max-width: 1120px !important;
|
||||||
|
margin: 0 auto !important;
|
||||||
|
padding: 20px 24px 28px !important;
|
||||||
|
box-sizing: border-box !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-container {
|
||||||
|
display: grid !important;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
|
||||||
|
align-items: start;
|
||||||
|
gap: 14px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-group {
|
||||||
|
min-width: 0 !important;
|
||||||
|
width: auto !important;
|
||||||
|
padding: 14px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-group.search-field {
|
||||||
|
grid-column: span 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-container {
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-container input,
|
||||||
|
.form-group input,
|
||||||
|
.form-group select,
|
||||||
|
.form-group textarea {
|
||||||
|
min-height: 44px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.items-container {
|
||||||
|
display: grid !important;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
|
||||||
|
gap: 18px !important;
|
||||||
|
padding: 14px 0 24px !important;
|
||||||
|
overflow: visible !important;
|
||||||
|
scroll-snap-type: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-card {
|
||||||
|
width: auto !important;
|
||||||
|
max-width: none !important;
|
||||||
|
min-width: 0 !important;
|
||||||
|
padding: 16px !important;
|
||||||
|
scroll-snap-align: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-card .image-container {
|
||||||
|
width: 100% !important;
|
||||||
|
max-width: none !important;
|
||||||
|
height: auto !important;
|
||||||
|
aspect-ratio: 4 / 3;
|
||||||
|
margin: 10px 0 14px !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
border: 1px solid var(--ui-border);
|
||||||
|
border-radius: 12px !important;
|
||||||
|
background: var(--ui-surface-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-card .image-container .item-image,
|
||||||
|
.item-card .image-container .video-container {
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-card .image-container .item-image {
|
||||||
|
object-fit: contain !important;
|
||||||
|
object-position: center;
|
||||||
|
background: var(--ui-surface-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-card .image-container .item-image[data-index="0"] {
|
||||||
|
display: block !important;
|
||||||
|
position: relative !important;
|
||||||
|
opacity: 1 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-card .image-container .item-image:not([data-index="0"]) {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-card .image-container .video-container {
|
||||||
|
position: relative;
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-actions {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-actions > * {
|
||||||
|
min-height: 44px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#item-modal .modal-content {
|
||||||
|
width: min(92vw, 880px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<style>
|
<style>
|
||||||
.bookmark-btn { position:absolute; top:8px; right:8px; width:46px; height:46px; background:rgba(255,255,255,.92); border:2px solid #ffc107; border-radius:50%; font-size:1.65rem; line-height:1; display:flex; align-items:center; justify-content:center; cursor:pointer; color:#ffc107; box-shadow:0 2px 6px rgba(0,0,0,.18); transition:background .2s, transform .15s, color .2s; z-index:6; pointer-events:auto; }
|
.bookmark-btn { position:absolute; top:8px; right:8px; width:46px; height:46px; background:rgba(255,255,255,.92); border:2px solid #ffc107; border-radius:50%; font-size:1.65rem; line-height:1; display:flex; align-items:center; justify-content:center; cursor:pointer; color:#ffc107; box-shadow:0 2px 6px rgba(0,0,0,.18); transition:background .2s, transform .15s, color .2s; z-index:6; pointer-events:auto; }
|
||||||
@@ -3206,9 +3322,12 @@ document.addEventListener('DOMContentLoaded', ()=>{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadItems(offset = 0, append = false) {
|
function loadItems(offset = 0, append = false, searchTerm = '', searchScope = 'all') {
|
||||||
// Keep list payload lightweight; full details are fetched on-demand in openItemQuick.
|
// Keep list payload lightweight; full details are fetched on-demand in openItemQuick.
|
||||||
return fetch(`{{ url_for('get_items') }}?offset=${offset}&limit=${MAIN_ADMIN_ITEMS_PAGE_SIZE}&light_mode=true`)
|
const searchParams = searchTerm
|
||||||
|
? `&search=${encodeURIComponent(searchTerm)}&search_scope=${encodeURIComponent(searchScope)}`
|
||||||
|
: '';
|
||||||
|
return fetch(`{{ url_for('get_items') }}?offset=${offset}&limit=${MAIN_ADMIN_ITEMS_PAGE_SIZE}&light_mode=true${searchParams}`)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const itemsContainer = document.querySelector('#items-container');
|
const itemsContainer = document.querySelector('#items-container');
|
||||||
@@ -3241,7 +3360,7 @@ document.addEventListener('DOMContentLoaded', ()=>{
|
|||||||
}
|
}
|
||||||
pageItems.sort((a, b) => {
|
pageItems.sort((a, b) => {
|
||||||
const nameA = a.Name ? a.Name.toLowerCase() : '';
|
const nameA = a.Name ? a.Name.toLowerCase() : '';
|
||||||
const nameB = a.Name ? a.Name.toLowerCase() : '';
|
const nameB = b.Name ? b.Name.toLowerCase() : '';
|
||||||
return nameA.localeCompare(nameB);
|
return nameA.localeCompare(nameB);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -3285,6 +3404,7 @@ document.addEventListener('DOMContentLoaded', ()=>{
|
|||||||
card.dataset.code = (item.Code_4 !== undefined && item.Code_4 !== null) ?
|
card.dataset.code = (item.Code_4 !== undefined && item.Code_4 !== null) ?
|
||||||
String(item.Code_4).trim() : '';
|
String(item.Code_4).trim() : '';
|
||||||
card.dataset.groupCodes = JSON.stringify(Array.isArray(item.GroupedAllCodes) ? item.GroupedAllCodes : []);
|
card.dataset.groupCodes = JSON.stringify(Array.isArray(item.GroupedAllCodes) ? item.GroupedAllCodes : []);
|
||||||
|
card.dataset.groupedUnits = JSON.stringify(Array.isArray(item.GroupedUnitStates) ? item.GroupedUnitStates : []);
|
||||||
|
|
||||||
// Add filter values to their respective sets
|
// Add filter values to their respective sets
|
||||||
filter1Array.forEach(value => {
|
filter1Array.forEach(value => {
|
||||||
@@ -3415,7 +3535,7 @@ document.addEventListener('DOMContentLoaded', ()=>{
|
|||||||
</div>
|
</div>
|
||||||
{% if current_permissions.actions.get('can_borrow', False) %}
|
{% if current_permissions.actions.get('can_borrow', False) %}
|
||||||
${isAvailableForBorrow && !item.BlockedNow ?
|
${isAvailableForBorrow && !item.BlockedNow ?
|
||||||
`<form method="POST" action="{{ url_for('ausleihen', id='') }}${item._id}">
|
`<form method="POST" action="{{ url_for('ausleihen', id='') }}${item._id}" data-grouped-borrow-form>
|
||||||
${isGroupedItem ? `
|
${isGroupedItem ? `
|
||||||
<div class="grouped-borrow-controls" style="display:flex; gap:8px; flex-wrap:wrap; margin-bottom:8px; align-items:center;">
|
<div class="grouped-borrow-controls" style="display:flex; gap:8px; flex-wrap:wrap; margin-bottom:8px; align-items:center;">
|
||||||
<label style="font-size:0.85rem; margin:0;">Anzahl:</label>
|
<label style="font-size:0.85rem; margin:0;">Anzahl:</label>
|
||||||
@@ -3445,6 +3565,7 @@ document.addEventListener('DOMContentLoaded', ()=>{
|
|||||||
:
|
:
|
||||||
`<button class="ausleihen disabled-button" disabled>${item.BlockedNow ? 'Reserviert' : 'Ausgeliehen'}</button>`
|
`<button class="ausleihen disabled-button" disabled>${item.BlockedNow ? 'Reserviert' : 'Ausgeliehen'}</button>`
|
||||||
}
|
}
|
||||||
|
${isGroupedItem ? '<div class="grouped-searched-action" data-grouped-searched-action style="display:none;"></div>' : ''}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if current_permissions.actions.get('can_delete', False) %}
|
{% if current_permissions.actions.get('can_delete', False) %}
|
||||||
<form method="POST" action="{{ url_for('delete_item', id='') }}${item._id}" style="display:inline;" onsubmit="return confirm('Sind Sie sicher, dass Sie dieses Objekt löschen möchten?')">
|
<form method="POST" action="{{ url_for('delete_item', id='') }}${item._id}" style="display:inline;" onsubmit="return confirm('Sind Sie sicher, dass Sie dieses Objekt löschen möchten?')">
|
||||||
@@ -3679,13 +3800,66 @@ document.addEventListener('DOMContentLoaded', ()=>{
|
|||||||
card.classList.remove('highlight-item', 'code-match', 'exact-code-match');
|
card.classList.remove('highlight-item', 'code-match', 'exact-code-match');
|
||||||
});
|
});
|
||||||
|
|
||||||
applyFilters(true);
|
if (codeSearchTerm) {
|
||||||
|
loadItems(0, false, codeSearchTerm, 'all');
|
||||||
|
} else {
|
||||||
|
loadItems();
|
||||||
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
searchInput.classList.remove('searching');
|
searchInput.classList.remove('searching');
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function syncSearchedGroupedAction(card, searchTerm, exactCodeMatch) {
|
||||||
|
const searchedAction = card.querySelector('[data-grouped-searched-action]');
|
||||||
|
if (!searchedAction) return;
|
||||||
|
|
||||||
|
const borrowForm = card.querySelector('[data-grouped-borrow-form]');
|
||||||
|
searchedAction.style.display = 'none';
|
||||||
|
searchedAction.innerHTML = '';
|
||||||
|
|
||||||
|
if (!exactCodeMatch || !searchTerm) {
|
||||||
|
if (borrowForm) borrowForm.style.display = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let groupedUnits = [];
|
||||||
|
try {
|
||||||
|
groupedUnits = JSON.parse(card.dataset.groupedUnits || '[]');
|
||||||
|
} catch {
|
||||||
|
groupedUnits = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const matchedUnit = groupedUnits.find(unit =>
|
||||||
|
String(unit.code || '').trim().toLowerCase() === searchTerm
|
||||||
|
);
|
||||||
|
if (!matchedUnit) return;
|
||||||
|
|
||||||
|
if (matchedUnit.available) {
|
||||||
|
if (borrowForm) borrowForm.style.display = '';
|
||||||
|
const specificSelect = borrowForm?.querySelector('[name="specific_item_id"]');
|
||||||
|
if (specificSelect) {
|
||||||
|
specificSelect.value = matchedUnit.id;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (borrowForm) borrowForm.style.display = 'none';
|
||||||
|
searchedAction.style.display = 'block';
|
||||||
|
if (matchedUnit.borrowed_by_current_user) {
|
||||||
|
searchedAction.innerHTML = `
|
||||||
|
<form method="POST" action="/zurueckgeben/${encodeURIComponent(matchedUnit.id)}">
|
||||||
|
<button class="ausleihen" type="submit">Zurückgeben (${escapeHtml(matchedUnit.code || 'Code')})</button>
|
||||||
|
</form>`;
|
||||||
|
} else {
|
||||||
|
searchedAction.innerHTML = `
|
||||||
|
<button class="ausleihen disabled-button" type="button" disabled>
|
||||||
|
${escapeHtml(matchedUnit.code || 'Code')} ausgeliehen
|
||||||
|
</button>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function applyFilters(isDirectSearch = false) {
|
function applyFilters(isDirectSearch = false) {
|
||||||
const itemsContainer = document.querySelector('#items-container');
|
const itemsContainer = document.querySelector('#items-container');
|
||||||
const items = itemsContainer.querySelectorAll('.item-card');
|
const items = itemsContainer.querySelectorAll('.item-card');
|
||||||
@@ -3732,6 +3906,7 @@ document.addEventListener('DOMContentLoaded', ()=>{
|
|||||||
if (passesAllFilters && matchesCodeSearch && matchesDesc && (!favoritesOnly || isFavoriteCard)) {
|
if (passesAllFilters && matchesCodeSearch && matchesDesc && (!favoritesOnly || isFavoriteCard)) {
|
||||||
item.style.display = 'block';
|
item.style.display = 'block';
|
||||||
visibleCount++;
|
visibleCount++;
|
||||||
|
syncSearchedGroupedAction(item, searchTerm, exactCodeMatch);
|
||||||
|
|
||||||
if (exactCodeMatch) {
|
if (exactCodeMatch) {
|
||||||
item.classList.add('highlight-item', 'exact-code-match');
|
item.classList.add('highlight-item', 'exact-code-match');
|
||||||
@@ -3756,6 +3931,7 @@ document.addEventListener('DOMContentLoaded', ()=>{
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
item.style.display = 'none';
|
item.style.display = 'none';
|
||||||
|
syncSearchedGroupedAction(item, '', false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -3830,7 +4006,7 @@ document.addEventListener('DOMContentLoaded', ()=>{
|
|||||||
card.classList.remove('highlight-item', 'code-match', 'exact-code-match');
|
card.classList.remove('highlight-item', 'code-match', 'exact-code-match');
|
||||||
});
|
});
|
||||||
|
|
||||||
applyFilters();
|
loadItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Description search using backend substring match
|
// Description search using backend substring match
|
||||||
@@ -3839,21 +4015,12 @@ document.addEventListener('DOMContentLoaded', ()=>{
|
|||||||
const term = (input?.value || '').trim();
|
const term = (input?.value || '').trim();
|
||||||
if (!term){
|
if (!term){
|
||||||
descSearchIds = null;
|
descSearchIds = null;
|
||||||
applyFilters(true);
|
loadItems(0, false, codeSearchTerm, 'all');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
input?.classList.add('searching');
|
input?.classList.add('searching');
|
||||||
fetch(`/search_word/${encodeURIComponent(term)}`)
|
descSearchIds = null;
|
||||||
.then(r=>r.json())
|
loadItems(0, false, term, 'title_description')
|
||||||
.then(data=>{
|
|
||||||
if (data && data.success && Array.isArray(data.response)){
|
|
||||||
descSearchIds = new Set(data.response.map(String));
|
|
||||||
} else {
|
|
||||||
descSearchIds = new Set();
|
|
||||||
}
|
|
||||||
applyFilters(true);
|
|
||||||
})
|
|
||||||
.catch(()=>{ descSearchIds = new Set(); applyFilters(true); })
|
|
||||||
.finally(()=>{ setTimeout(()=> input?.classList.remove('searching'), 300); });
|
.finally(()=>{ setTimeout(()=> input?.classList.remove('searching'), 300); });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3861,7 +4028,7 @@ document.addEventListener('DOMContentLoaded', ()=>{
|
|||||||
const input = document.getElementById('desc-search');
|
const input = document.getElementById('desc-search');
|
||||||
if (input) input.value = '';
|
if (input) input.value = '';
|
||||||
descSearchIds = null;
|
descSearchIds = null;
|
||||||
applyFilters();
|
loadItems(0, false, codeSearchTerm, 'all');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open item modal with fresh details from backend.
|
// Open item modal with fresh details from backend.
|
||||||
|
|||||||
@@ -21,9 +21,8 @@
|
|||||||
<div class="card shadow-sm border-0 h-100 rounded-3">
|
<div class="card shadow-sm border-0 h-100 rounded-3">
|
||||||
<div class="card-header bg-white border-bottom py-3 d-flex justify-content-between align-items-center">
|
<div class="card-header bg-white border-bottom py-3 d-flex justify-content-between align-items-center">
|
||||||
<h2 class="card-title h5 mb-0 fw-semibold text-primary">
|
<h2 class="card-title h5 mb-0 fw-semibold text-primary">
|
||||||
<i class="bi bi-funnel me-2"></i>{{ filter_names.get('1', 'Jahrgangsstufe') }}
|
<i class="bi bi-funnel me-2"></i>{{ filter_names.get('2', 'Jahrgangsstufe') }}
|
||||||
</h2>
|
</h2>
|
||||||
<span class="badge bg-primary-subtle text-primary rounded-pill">Filter 1</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body p-4">
|
<div class="card-body p-4">
|
||||||
<form method="POST" action="{{ url_for('add_filter_value', filter_num=1) }}" class="mb-4">
|
<form method="POST" action="{{ url_for('add_filter_value', filter_num=1) }}" class="mb-4">
|
||||||
@@ -87,9 +86,8 @@
|
|||||||
<div class="card shadow-sm border-0 h-100 rounded-3">
|
<div class="card shadow-sm border-0 h-100 rounded-3">
|
||||||
<div class="card-header bg-white border-bottom py-3 d-flex justify-content-between align-items-center">
|
<div class="card-header bg-white border-bottom py-3 d-flex justify-content-between align-items-center">
|
||||||
<h2 class="card-title h5 mb-0 fw-semibold text-primary">
|
<h2 class="card-title h5 mb-0 fw-semibold text-primary">
|
||||||
<i class="bi bi-funnel me-2"></i>{{ filter_names.get('2', 'Fachgebiet') }}
|
<i class="bi bi-funnel me-2"></i>{{ filter_names.get('1', 'Fachgebiet') }}
|
||||||
</h2>
|
</h2>
|
||||||
<span class="badge bg-primary-subtle text-primary rounded-pill">Filter 2</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body p-4">
|
<div class="card-body p-4">
|
||||||
<form method="POST" action="{{ url_for('add_filter_value', filter_num=2) }}" class="mb-4">
|
<form method="POST" action="{{ url_for('add_filter_value', filter_num=2) }}" class="mb-4">
|
||||||
|
|||||||
@@ -514,6 +514,7 @@
|
|||||||
<p style="margin:0 0 12px 0; color:#555; font-size:13px; line-height:1.4;">
|
<p style="margin:0 0 12px 0; color:#555; font-size:13px; line-height:1.4;">
|
||||||
Laden Sie eine <strong>.xlsx</strong>- oder <strong>.csv</strong>-Datei hoch (z. B. aus <strong>ASV</strong>). Erkannt werden Rufame, Nachname, Klasse*, Ausweis-ID*, lokales Differenzierungsmerkmal*, Notizen* & Ausleihdauer*.
|
Laden Sie eine <strong>.xlsx</strong>- oder <strong>.csv</strong>-Datei hoch (z. B. aus <strong>ASV</strong>). Erkannt werden Rufame, Nachname, Klasse*, Ausweis-ID*, lokales Differenzierungsmerkmal*, Notizen* & Ausleihdauer*.
|
||||||
Hinweis: Die Daten werden Validiert und müssen dann noch einmal aus sicherheits gründen hochgeladen werden!
|
Hinweis: Die Daten werden Validiert und müssen dann noch einmal aus sicherheits gründen hochgeladen werden!
|
||||||
|
Im folgenden ist eine export vorlage für ihre ASV-Software hinterlegt: <a href="{{ url_for('get_asv_export') }}" target="_blank" style="color:#007bff; text-decoration:underline;">ASV Export Vorlage</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -865,38 +865,6 @@
|
|||||||
<!-- Normal Item Mode: Standard Filters -->
|
<!-- Normal Item Mode: Standard Filters -->
|
||||||
<div class="filter-inputs">
|
<div class="filter-inputs">
|
||||||
<h3>{{ filter_names.get('1', 'Jahrgangsstufe') }}</h3>
|
<h3>{{ filter_names.get('1', 'Jahrgangsstufe') }}</h3>
|
||||||
<div class="multi-filter">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="filter1-1">Wert 1:</label>
|
|
||||||
<select id="filter1-1" name="filter" class="filter-dropdown-select" required>
|
|
||||||
<option value="">-- Bitte auswählen --</option>
|
|
||||||
<!-- Options will be loaded by JavaScript -->
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="filter1-2">Wert 2:</label>
|
|
||||||
<select id="filter1-2" name="filter" class="filter-dropdown-select">
|
|
||||||
<option value="">-- Optional --</option>
|
|
||||||
<!-- Options will be loaded by JavaScript -->
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="filter1-3">Wert 3:</label>
|
|
||||||
<select id="filter1-3" name="filter" class="filter-dropdown-select">
|
|
||||||
<option value="">-- Optional --</option>
|
|
||||||
<!-- Options will be loaded by JavaScript -->
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="filter1-4">Wert 4:</label>
|
|
||||||
<select id="filter1-4" name="filter" class="filter-dropdown-select">
|
|
||||||
<option value="">-- Optional --</option>
|
|
||||||
<!-- Options will be loaded by JavaScript -->
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h3>{{ filter_names.get('2', 'Fachgebiet') }}</h3>
|
|
||||||
<div class="multi-filter">
|
<div class="multi-filter">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="filter2-1">Wert 1:</label>
|
<label for="filter2-1">Wert 1:</label>
|
||||||
@@ -928,6 +896,38 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3>{{ filter_names.get('2', 'Fachgebiet') }}</h3>
|
||||||
|
<div class="multi-filter">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="filter1-1">Wert 1:</label>
|
||||||
|
<select id="filter1-1" name="filter" class="filter-dropdown-select" required>
|
||||||
|
<option value="">-- Bitte auswählen --</option>
|
||||||
|
<!-- Options will be loaded by JavaScript -->
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="filter1-2">Wert 2:</label>
|
||||||
|
<select id="filter1-2" name="filter" class="filter-dropdown-select">
|
||||||
|
<option value="">-- Optional --</option>
|
||||||
|
<!-- Options will be loaded by JavaScript -->
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="filter1-3">Wert 3:</label>
|
||||||
|
<select id="filter1-3" name="filter" class="filter-dropdown-select">
|
||||||
|
<option value="">-- Optional --</option>
|
||||||
|
<!-- Options will be loaded by JavaScript -->
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="filter1-4">Wert 4:</label>
|
||||||
|
<select id="filter1-4" name="filter" class="filter-dropdown-select">
|
||||||
|
<option value="">-- Optional --</option>
|
||||||
|
<!-- Options will be loaded by JavaScript -->
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3>{{ filter_names.get('3', 'Schlagwort') }}</h3>
|
<h3>{{ filter_names.get('3', 'Schlagwort') }}</h3>
|
||||||
<div class="multi-filter">
|
<div class="multi-filter">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
Reference in new issue
Block a user