Fix: Login-Funktionalität wiederhergestellt und Passwort aktualisiert
This commit is contained in:
16
app.py
16
app.py
@@ -148,6 +148,19 @@ def search_customers(search_params):
|
||||
# Allgemeine Suche über alle Felder
|
||||
if search_params.get('q'):
|
||||
search_term = f"%{search_params['q']}%"
|
||||
operator = search_params.get('operator', 'or').upper()
|
||||
|
||||
if operator == 'AND':
|
||||
# Bei UND-Verknüpfung müssen alle Begriffe in mindestens einem Feld vorkommen
|
||||
terms = search_params['q'].split()
|
||||
conditions = []
|
||||
for term in terms:
|
||||
term = f"%{term}%"
|
||||
conditions.append("(name LIKE ? OR ort LIKE ? OR nummer LIKE ? OR telefon LIKE ? OR mobil LIKE ? OR email LIKE ? OR bemerkung LIKE ? OR fachrichtung LIKE ?)")
|
||||
params.extend([term] * 8)
|
||||
query += " AND " + " AND ".join(conditions)
|
||||
else:
|
||||
# Bei ODER-Verknüpfung (Standard) muss mindestens ein Begriff in einem Feld vorkommen
|
||||
query += " AND (name LIKE ? OR ort LIKE ? OR nummer LIKE ? OR telefon LIKE ? OR mobil LIKE ? OR email LIKE ? OR bemerkung LIKE ? OR fachrichtung LIKE ?)"
|
||||
params.extend([search_term] * 8)
|
||||
|
||||
@@ -292,7 +305,8 @@ def search():
|
||||
'telefon': request.args.get('telefon', ''),
|
||||
'email': request.args.get('email', ''),
|
||||
'q': request.args.get('q', ''),
|
||||
'fachrichtung': request.args.get('fachrichtung', '')
|
||||
'fachrichtung': request.args.get('fachrichtung', ''),
|
||||
'operator': request.args.get('operator', 'or')
|
||||
}
|
||||
|
||||
# Führe die Suche in der Datenbank durch
|
||||
|
@@ -236,3 +236,21 @@ body {
|
||||
font-size: 1.2rem;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
.search-options {
|
||||
font-size: 0.9em;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.search-options .form-check {
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
.search-options .form-check-input {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.search-options .form-check-label {
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
@@ -24,6 +24,16 @@
|
||||
<i class="fas fa-times reset-icon" onclick="clearInput('q')"></i>
|
||||
<i class="fas fa-search search-icon"></i>
|
||||
</div>
|
||||
<div class="search-options mt-2">
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="searchOperator" id="searchOr" value="or" checked>
|
||||
<label class="form-check-label" for="searchOr">ODER</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="searchOperator" id="searchAnd" value="and">
|
||||
<label class="form-check-label" for="searchAnd">UND</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-fields">
|
||||
@@ -278,6 +288,7 @@
|
||||
const nummer = document.getElementById('nummerInput').value;
|
||||
const plz = document.getElementById('plzInput').value;
|
||||
const fachrichtung = document.getElementById('fachrichtungInput').value;
|
||||
const searchOperator = document.querySelector('input[name="searchOperator"]:checked').value;
|
||||
|
||||
// Zeige das Lade-Icon
|
||||
document.getElementById('loading').style.display = 'block';
|
||||
@@ -290,6 +301,7 @@
|
||||
if (nummer) params.append('nummer', nummer);
|
||||
if (plz) params.append('plz', plz);
|
||||
if (fachrichtung) params.append('fachrichtung', fachrichtung);
|
||||
if (searchOperator) params.append('operator', searchOperator);
|
||||
|
||||
// Führe die Suche durch
|
||||
fetch('/search?' + params.toString())
|
||||
|
Reference in New Issue
Block a user