Update Tabellen und Suchalgo

This commit is contained in:
2026-02-17 17:29:40 +01:00
parent ce89fccdb5
commit 441ba313aa
12 changed files with 131 additions and 70 deletions

View File

@@ -3,6 +3,8 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="/images/icons/favicon.png">
<link rel="apple-touch-icon" href="/images/icons/icon-180x180.png">
<title>Infraviewer - Volltextsuche</title>
<style>
* {
@@ -385,19 +387,31 @@
resultsDiv.innerHTML = html;
}
// Feste Spaltenreihenfolge und Anzeige-Labels (siehe Spalten.txt)
const DISPLAY_COLUMNS = [
{ key: 'Teil', label: 'Teilenummer' },
{ key: 'Bez', label: 'Bezeichnung' },
{ key: 'Bez2', label: 'Bezeichnung 2' },
{ key: 'Ben7', label: 'Englischer Text' },
{ key: 'Ben8', label: 'Deutscher Text' },
{ key: 'Hersteller', label: 'Hersteller' },
{ key: 'Text', label: 'Zusatztext' },
{ key: 'PrsVK', label: 'Verkaufspreis in €' }
];
function renderRecord(record) {
let html = '<div class="record">';
for (const [key, value] of Object.entries(record)) {
const displayValue = value === null ? '<em>NULL</em>' : highlightSearchTerm(String(value));
for (const { key, label } of DISPLAY_COLUMNS) {
if (!(key in record)) continue;
const value = record[key];
const displayValue = value === null || value === undefined ? '' : highlightSearchTerm(String(value));
html += `
<div class="record-field">
<span class="field-name">${escapeHtml(key)}:</span>
<span class="field-name">${escapeHtml(label)}:</span>
<span class="field-value">${displayValue}</span>
</div>
`;
}
html += '</div>';
return html;
}
@@ -405,8 +419,12 @@
function highlightSearchTerm(text) {
if (!currentSearchTerm) return escapeHtml(text);
const words = currentSearchTerm.trim().split(/\s+/).filter(Boolean);
if (words.length === 0) return escapeHtml(text);
const escapedText = escapeHtml(text);
const searchRegex = new RegExp(`(${escapeRegex(currentSearchTerm)})`, 'gi');
const pattern = words.map(w => escapeRegex(w)).join('|');
const searchRegex = new RegExp(`(${pattern})`, 'gi');
return escapedText.replace(searchRegex, '<span class="highlight">$1</span>');
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@@ -4,6 +4,8 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Infraviewer - Wartung</title>
<link rel="icon" type="image/png" href="/images/icons/favicon.png">
<link rel="apple-touch-icon" href="/images/icons/icon-180x180.png">
<style>
* {
margin: 0;