Compare commits

..

2 Commits

Author SHA1 Message Date
8572cad8e5 KeinPlan 2026-03-12 16:50:11 +01:00
1bdb327592 Added DatumPreise und Zeichnungsnummer 2026-03-12 16:50:07 +01:00
2 changed files with 43 additions and 7 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: 'PrsVK', label: 'VK 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));
}

View File

@@ -17,6 +17,7 @@ const TEILE_SEARCH_COLUMNS = [
'Bez2',
'Ben7',
'Ben8',
'Ben43',
'Hersteller'
];
@@ -117,12 +118,14 @@ const fullTextSearch = async (searchTerm, statusFilter) => {
t.Bez2,
t.Ben7,
t.Ben8,
t.Ben43,
t.Hersteller,
t.Stat,
t.VkTeil,
txt.Text AS [Text],
ts.PrsVk AS PrsVK,
ts.Ersatz AS Ersatz
ts.Ersatz AS Ersatz,
ts.PrsVkTerm
FROM [${tableConfig.tableName}] t WITH (NOLOCK)
OUTER APPLY (
SELECT TOP 1 MemoID
@@ -137,7 +140,10 @@ const fullTextSearch = async (searchTerm, statusFilter) => {
WHERE tx.TextId = ek.MemoID
) txt
OUTER APPLY (
SELECT TOP 1 PrsVk, Ersatz
SELECT TOP 1
PrsVk,
Ersatz,
PrsVkTerm
FROM TSSAEF WITH (NOLOCK)
WHERE Teil = t.Teil
ORDER BY ISN