Trefferzähler auf Gesamtzahl vereinfacht
This commit is contained in:
@@ -111,8 +111,7 @@
|
|||||||
}
|
}
|
||||||
.result-counts {
|
.result-counts {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
justify-content: center;
|
||||||
gap: 1rem;
|
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
background-color: #f8f9fa;
|
background-color: #f8f9fa;
|
||||||
@@ -172,10 +171,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="result-counts">
|
<div class="result-counts">
|
||||||
<span id="nameCount" class="result-count"></span>
|
|
||||||
<span id="ortCount" class="result-count"></span>
|
|
||||||
<span id="kundennummerCount" class="result-count"></span>
|
|
||||||
<span id="fachrichtungCount" class="result-count"></span>
|
|
||||||
<span id="generalCount" class="result-count"></span>
|
<span id="generalCount" class="result-count"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -257,40 +252,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateResultCounts() {
|
function updateResultCounts() {
|
||||||
const name = document.getElementById('nameInput').value;
|
// Nur Gesamtzahl anzeigen
|
||||||
const ort = document.getElementById('ortInput').value;
|
|
||||||
const kundennummer = document.getElementById('kundennummerInput').value;
|
|
||||||
const fachrichtung = document.getElementById('fachrichtungInput').value;
|
|
||||||
const query = document.getElementById('searchInput').value;
|
|
||||||
|
|
||||||
// Zähler für spezifische Felder
|
|
||||||
const nameCount = lastResults.filter(customer =>
|
|
||||||
(customer.Vorname + ' ' + customer.Nachname).toLowerCase().includes(name.toLowerCase())
|
|
||||||
).length;
|
|
||||||
document.getElementById('nameCount').textContent = nameCount;
|
|
||||||
document.getElementById('nameCount').classList.toggle('visible', nameCount > 0);
|
|
||||||
|
|
||||||
const ortCount = lastResults.filter(customer =>
|
|
||||||
customer.Ort?.toLowerCase().includes(ort.toLowerCase())
|
|
||||||
).length;
|
|
||||||
document.getElementById('ortCount').textContent = ortCount;
|
|
||||||
document.getElementById('ortCount').classList.toggle('visible', ortCount > 0);
|
|
||||||
|
|
||||||
const kundennummerCount = lastResults.filter(customer =>
|
|
||||||
customer.Nummer?.toString().includes(kundennummer)
|
|
||||||
).length;
|
|
||||||
document.getElementById('kundennummerCount').textContent = kundennummerCount;
|
|
||||||
document.getElementById('kundennummerCount').classList.toggle('visible', kundennummerCount > 0);
|
|
||||||
|
|
||||||
const fachrichtungCount = lastResults.filter(customer =>
|
|
||||||
customer.Fachrichtung?.toLowerCase().includes(fachrichtung.toLowerCase())
|
|
||||||
).length;
|
|
||||||
document.getElementById('fachrichtungCount').textContent = fachrichtungCount;
|
|
||||||
document.getElementById('fachrichtungCount').classList.toggle('visible', fachrichtungCount > 0);
|
|
||||||
|
|
||||||
// Zähler für allgemeine Suche
|
|
||||||
const generalCount = lastResults.length;
|
const generalCount = lastResults.length;
|
||||||
document.getElementById('generalCount').textContent = generalCount;
|
document.getElementById('generalCount').textContent =
|
||||||
|
generalCount > 0 ? `${generalCount} Treffer gefunden` : '';
|
||||||
document.getElementById('generalCount').classList.toggle('visible', generalCount > 0);
|
document.getElementById('generalCount').classList.toggle('visible', generalCount > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user