Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 91a80c6330 | |||
| 530d71ac8f | |||
| 64991326e7 |
+25
-20
@@ -11510,6 +11510,13 @@ def my_borrowed_items():
|
||||
return redirect(url_for('login', next=request.path))
|
||||
|
||||
username = session['username']
|
||||
current_user = us.get_user(username) or {}
|
||||
user_ids = {
|
||||
username,
|
||||
str(current_user.get('_id')) if current_user.get('_id') else '',
|
||||
str(session.get('user_id') or ''),
|
||||
}
|
||||
user_ids.discard('')
|
||||
|
||||
client = MongoClient(MONGODB_HOST, MONGODB_PORT)
|
||||
db = client[MONGODB_DB]
|
||||
@@ -11526,31 +11533,27 @@ def my_borrowed_items():
|
||||
|
||||
for appointment in all_ausleihungen:
|
||||
raw_user = appointment.get('User', '')
|
||||
user_values = {str(raw_user).strip()} if raw_user else set()
|
||||
try:
|
||||
decrypted_user = decrypt_text(raw_user) if raw_user else ''
|
||||
except Exception as e:
|
||||
app.logger.error(f"Entschlüsselungsfehler: {e}")
|
||||
decrypted_user = ''
|
||||
if raw_user:
|
||||
user_values.add(str(decrypt_text(raw_user)).strip())
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if decrypted_user != username:
|
||||
if not user_values.intersection(user_ids):
|
||||
continue
|
||||
|
||||
item_id = appointment.get('Item')
|
||||
if not item_id:
|
||||
continue
|
||||
|
||||
try:
|
||||
if isinstance(item_id, str):
|
||||
query_id = ObjectId(item_id)
|
||||
else:
|
||||
query_id = item_id
|
||||
|
||||
item_obj = items_collection.find_one({
|
||||
'_id': query_id,
|
||||
'Deleted': {'$ne': True}
|
||||
})
|
||||
except Exception:
|
||||
item_obj = None
|
||||
item_queries = [{'_id': item_id}]
|
||||
if isinstance(item_id, str) and ObjectId.is_valid(item_id):
|
||||
item_queries.insert(0, {'_id': ObjectId(item_id)})
|
||||
item_obj = items_collection.find_one({
|
||||
'$or': item_queries,
|
||||
'Deleted': {'$ne': True}
|
||||
})
|
||||
|
||||
if item_obj:
|
||||
item_obj['_id'] = str(item_obj['_id'])
|
||||
@@ -11587,12 +11590,14 @@ def my_borrowed_items():
|
||||
|
||||
for item in all_borrowed_items:
|
||||
raw_item_user = item.get('User', '')
|
||||
item_user_values = {str(raw_item_user).strip()} if raw_item_user else set()
|
||||
try:
|
||||
dec_item_user = decrypt_text(raw_item_user) if raw_item_user else ''
|
||||
if raw_item_user:
|
||||
item_user_values.add(str(decrypt_text(raw_item_user)).strip())
|
||||
except Exception:
|
||||
dec_item_user = ''
|
||||
pass
|
||||
|
||||
if dec_item_user == username and str(item['_id']) not in processed_item_ids:
|
||||
if item_user_values.intersection(user_ids) and str(item['_id']) not in processed_item_ids:
|
||||
item['_id'] = str(item['_id'])
|
||||
item['ActiveAppointment'] = True
|
||||
item['AppointmentData'] = {'status': 'active (no document)'}
|
||||
|
||||
@@ -562,25 +562,30 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.navigation-buttons {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
.items-navigation {
|
||||
display: grid;
|
||||
grid-template-columns: 44px minmax(0, 1fr) 44px;
|
||||
align-items: center;
|
||||
column-gap: 18px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.navigation-buttons .prev-button,
|
||||
.navigation-buttons .next-button {
|
||||
.navigation-button-slot {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.navigation-button {
|
||||
background-color: #007bff;
|
||||
color: #fff;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.navigation-buttons .prev-button:hover,
|
||||
.navigation-buttons .next-button:hover {
|
||||
.navigation-button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
@@ -1633,7 +1638,11 @@
|
||||
}
|
||||
|
||||
/* Navigation buttons mobile */
|
||||
.navigation-buttons {
|
||||
.items-navigation {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.navigation-button-slot {
|
||||
display: none !important; /* Hide horizontal navigation on mobile */
|
||||
}
|
||||
|
||||
@@ -1946,7 +1955,7 @@
|
||||
/* Standardized button styles across the application */
|
||||
.search-button, .scan-button, .filter-toggle, .clear-filter,
|
||||
.add-new-btn, .popup-close-button, .prev-image-button, .next-image-button,
|
||||
.navigation-buttons .prev-button, .navigation-buttons .next-button {
|
||||
.navigation-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -2543,12 +2552,16 @@ document.addEventListener('DOMContentLoaded', ()=>{
|
||||
<span>Anzahl</span>
|
||||
</div>
|
||||
|
||||
<div id="items-container" class="items-container">
|
||||
<!-- Items will be dynamically loaded here -->
|
||||
</div>
|
||||
<div class="navigation-buttons">
|
||||
<button class="prev-button" onclick="scrollPrev()">❮</button>
|
||||
<button class="next-button" onclick="scrollNext()">❯</button>
|
||||
<div class="items-navigation">
|
||||
<div class="navigation-button-slot">
|
||||
<button class="navigation-button prev-button" type="button" onclick="scrollPrev()" aria-label="Vorherige Elemente">❮</button>
|
||||
</div>
|
||||
<div id="items-container" class="items-container">
|
||||
<!-- Items will be dynamically loaded here -->
|
||||
</div>
|
||||
<div class="navigation-button-slot">
|
||||
<button class="navigation-button next-button" type="button" onclick="scrollNext()" aria-label="Nächste Elemente">❯</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="item-modal" class="item-modal">
|
||||
|
||||
Reference in New Issue
Block a user