fix(detail-panel): show Flexoptix price in competitor comparison + fix 800.00G->800G

This commit is contained in:
Rene Fichtmueller 2026-06-05 22:55:15 +00:00
parent 0d3edd6ea9
commit 261135c544

View File

@ -4622,12 +4622,15 @@ async function openTxDetail(id) {
h += '<div style="font-size:0.72rem;color:#888;margin-bottom:0.5rem">Gleiche Spezifikationsklasse — andere Part Number</div>'; h += '<div style="font-size:0.72rem;color:#888;margin-bottom:0.5rem">Gleiche Spezifikationsklasse — andere Part Number</div>';
comparPrices.forEach(function(p) { comparPrices.forEach(function(p) {
// Calculate price delta (EUR-normalized) // Calculate price delta (EUR-normalized)
var myEur = null; // Use Flexoptix own verified EUR price as reference for comparison
var myEur = t.price_verified_eur ? parseFloat(t.price_verified_eur) : null;
if (!myEur) {
var refPrice = directPrices.length > 0 ? directPrices[0] : null; var refPrice = directPrices.length > 0 ? directPrices[0] : null;
if (refPrice) { if (refPrice) {
var ra = parseFloat(refPrice.price), rc = (refPrice.currency||'USD').toUpperCase(); var ra = parseFloat(refPrice.price), rc = (refPrice.currency||'USD').toUpperCase();
myEur = rc === 'EUR' ? ra : rc === 'USD' ? ra * 0.92 : ra; myEur = rc === 'EUR' ? ra : rc === 'USD' ? ra * 0.92 : ra;
} }
}
var compEur = null; var compEur = null;
var ca = parseFloat(p.price), cc = (p.currency||'USD').toUpperCase(); var ca = parseFloat(p.price), cc = (p.currency||'USD').toUpperCase();
compEur = cc === 'EUR' ? ca : cc === 'USD' ? ca * 0.92 : ca; compEur = cc === 'EUR' ? ca : cc === 'USD' ? ca * 0.92 : ca;
@ -4654,8 +4657,8 @@ async function openTxDetail(id) {
+ '<td style="color:' + compColor + ';font-size:0.7rem;padding:2px 0">' + esc(compVal || '—') + '</td></tr>'; + '<td style="color:' + compColor + ';font-size:0.7rem;padding:2px 0">' + esc(compVal || '—') + '</td></tr>';
} }
var mySpeed = t.speed_gbps >= 1000 ? (t.speed_gbps / 1000).toFixed(1).replace('.0','') + 'T' : t.speed_gbps + 'G'; var mySpeed = fmtSpd(t.speed_gbps);
var compSpeed = p.comp_speed_gbps ? (p.comp_speed_gbps >= 1000 ? (p.comp_speed_gbps/1000).toFixed(1).replace('.0','')+'T' : p.comp_speed_gbps+'G') : null; var compSpeed = p.comp_speed_gbps ? fmtSpd(p.comp_speed_gbps) : null;
h += '<div style="border:1px solid var(--border);border-radius:8px;margin-bottom:0.6rem;overflow:hidden">'; h += '<div style="border:1px solid var(--border);border-radius:8px;margin-bottom:0.6rem;overflow:hidden">';
@ -4676,7 +4679,8 @@ async function openTxDetail(id) {
if (savBadge) { if (savBadge) {
h += '<div style="padding:0.3rem 0.75rem;background:rgba(255,255,255,0.02);border-bottom:1px solid var(--border);display:flex;align-items:center;gap:0.5rem">'; h += '<div style="padding:0.3rem 0.75rem;background:rgba(255,255,255,0.02);border-bottom:1px solid var(--border);display:flex;align-items:center;gap:0.5rem">';
h += savBadge; h += savBadge;
h += '<span style="font-size:0.68rem;color:#666">vs. Flexoptix Listenpreis</span>'; var fxPriceLabel = myEur ? 'EUR ' + myEur.toLocaleString('de-DE',{minimumFractionDigits:2,maximumFractionDigits:2}) : null;
h += '<span style="font-size:0.68rem;color:#666">vs. Flexoptix Listenpreis' + (fxPriceLabel ? ' (' + fxPriceLabel + ')' : '') + '</span>';
h += '</div>'; h += '</div>';
} }