Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f00e7d8f74 | |||
| 7af729ac88 | |||
| 847349b419 | |||
| 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)'}
|
||||
|
||||
@@ -266,6 +266,11 @@
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.code-search-label {
|
||||
color: #b93845;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.search-button {
|
||||
padding: 8px 12px;
|
||||
background-color: #007bff;
|
||||
@@ -284,10 +289,10 @@
|
||||
}
|
||||
|
||||
#code-search.searching {
|
||||
background-color: #fff3cd;
|
||||
background-color: #fff5f5;
|
||||
transition: background-color 0.3s;
|
||||
border: 2px solid #ffc107;
|
||||
box-shadow: 0 0 8px rgba(255, 193, 7, 0.5);
|
||||
border: 2px solid #d65a62;
|
||||
box-shadow: 0 0 8px rgba(190, 55, 66, 0.28);
|
||||
}
|
||||
|
||||
/* QR Scanner styles */
|
||||
@@ -562,26 +567,55 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.navigation-buttons {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
.items-navigation {
|
||||
display: grid;
|
||||
grid-template-columns: 42px minmax(0, 1fr) 42px;
|
||||
align-items: center;
|
||||
column-gap: 16px;
|
||||
width: calc(100% + 116px);
|
||||
margin-left: -58px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.navigation-buttons .prev-button,
|
||||
.navigation-buttons .next-button {
|
||||
background-color: #007bff;
|
||||
color: #fff;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
.navigation-button-slot {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.navigation-buttons .prev-button:hover,
|
||||
.navigation-buttons .next-button:hover {
|
||||
background-color: #0056b3;
|
||||
.navigation-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
padding: 0;
|
||||
background: var(--ui-surface-soft);
|
||||
color: var(--ui-title);
|
||||
border: 1px solid var(--ui-border);
|
||||
box-shadow: var(--ui-shadow-sm);
|
||||
cursor: pointer;
|
||||
border-radius: 10px;
|
||||
font-size: 1.15rem;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.navigation-button:hover {
|
||||
background: var(--ui-surface);
|
||||
border-color: var(--module-accent-color);
|
||||
box-shadow: var(--ui-shadow-md);
|
||||
transform: translateY(-2px) scale(1.04);
|
||||
}
|
||||
|
||||
.navigation-button:active {
|
||||
transform: translateY(0) scale(0.96);
|
||||
}
|
||||
|
||||
.navigation-button:focus-visible {
|
||||
outline: 3px solid rgba(37, 99, 235, 0.35);
|
||||
outline-offset: 3px;
|
||||
}
|
||||
|
||||
/* Modal styles */
|
||||
@@ -744,15 +778,15 @@
|
||||
}
|
||||
|
||||
.code-match {
|
||||
border: 2px solid #17a2b8 !important;
|
||||
box-shadow: 0 0 15px rgba(23, 162, 184, 0.5) !important;
|
||||
border: 2px solid #d65a62 !important;
|
||||
box-shadow: 0 0 15px rgba(190, 55, 66, 0.28) !important;
|
||||
position: relative;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.exact-code-match {
|
||||
border: 3px solid #28a745 !important;
|
||||
box-shadow: 0 0 20px rgba(40, 167, 69, 0.7) !important;
|
||||
border: 3px solid #b93845 !important;
|
||||
box-shadow: 0 0 20px rgba(185, 56, 69, 0.42) !important;
|
||||
position: relative;
|
||||
z-index: 11;
|
||||
}
|
||||
@@ -1633,7 +1667,13 @@
|
||||
}
|
||||
|
||||
/* Navigation buttons mobile */
|
||||
.navigation-buttons {
|
||||
.items-navigation {
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
|
||||
.navigation-button-slot {
|
||||
display: none !important; /* Hide horizontal navigation on mobile */
|
||||
}
|
||||
|
||||
@@ -1946,7 +1986,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;
|
||||
@@ -2501,7 +2541,7 @@ document.addEventListener('DOMContentLoaded', ()=>{
|
||||
|
||||
<div class="filter-group search-field">
|
||||
<div class="filter-header">
|
||||
<label for="code-search">Code suchen:</label>
|
||||
<label class="code-search-label" for="code-search">Code suchen:</label>
|
||||
<button type="button" class="clear-filter" onclick="clearCodeSearch()">Clear</button>
|
||||
</div>
|
||||
<div class="search-container">
|
||||
@@ -2543,12 +2583,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