Added DatumPreise und Zeichnungsnummer

This commit is contained in:
2026-03-12 16:50:07 +01:00
parent dcfadb51d3
commit 1bdb327592
2 changed files with 42 additions and 6 deletions

View File

@@ -234,6 +234,18 @@
color: #333;
word-break: break-word;
white-space: pre-line;
margin-left: 16px;
}
.price-age {
margin-left: 6px;
font-size: 0.9em;
color: #555;
}
.price-age--old {
color: #c62828;
font-weight: 600;
}
.field-value .part-link {
@@ -474,10 +486,11 @@
{ key: 'Bez', label: 'Bezeichnung' },
{ key: 'Bez2', label: 'Bezeichnung 2' },
{ key: 'Ben8', label: 'Bezeichnung 3' },
{ key: 'Ben7', label: 'Eng 3' },
{ key: 'Ben7', label: 'Englischer Text' },
{ key: 'Hersteller', label: 'Hersteller' },
{ key: 'Text', label: 'Zusatztext' },
{ key: 'PrsVK', label: 'Verkaufspreis in €' },
{ key: 'Ben43', label: 'Zeichnungsnummer' },
{ key: 'Ersatz', label: 'Ersetzt durch' }
];
@@ -527,9 +540,26 @@
displayValue = `<a href="#" class="part-link" data-part="${safePartAttr}">${safePart}</a>`;
} else if (key === 'PrsVK') {
const isVkTeil = record.VkTeil != null && Number(record.VkTeil) !== 0;
displayValue = isVkTeil && value != null && String(value).trim() !== ''
? highlightSearchTerm(String(value))
: escapeHtml('kein Verkaufsteil');
if (isVkTeil && value != null && String(value).trim() !== '') {
const priceText = highlightSearchTerm(String(value));
const priceTermStr = record.PrsVkTerm || record.PrsVKTerm;
let ageHtml = '';
if (priceTermStr) {
const priceDate = new Date(priceTermStr);
if (!isNaN(priceDate)) {
const now = new Date();
const diffMs = now.getTime() - priceDate.getTime();
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
const ageText = `${diffDays} Tage alt`;
const isOld = diffDays > 182; // > ca. 6 Monate
const ageClass = isOld ? 'price-age price-age--old' : 'price-age';
ageHtml = ` <span class="${ageClass}">(${escapeHtml(ageText)})</span>`;
}
}
displayValue = `${priceText}${ageHtml}`;
} else {
displayValue = escapeHtml('kein Verkaufsteil');
}
} else {
displayValue = value === null || value === undefined ? '' : highlightSearchTerm(String(value));
}