fix(helpdesk): show risk score as points/budget per dimension in dialog
Each dimension shows 'points / max' (e.g. '18 / 35') making the score composition immediately understandable. Total row sums to the final 'score / 100'. Replaces abstract percentage column. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -125,32 +125,32 @@ if (container) {
|
|||||||
dialogTitle.textContent = (customer.customer_name || customer.customer_no) + ' — ' + customer.risk_score + '/100';
|
dialogTitle.textContent = (customer.customer_name || customer.customer_no) + ' — ' + customer.risk_score + '/100';
|
||||||
dialogBody.replaceChildren();
|
dialogBody.replaceChildren();
|
||||||
|
|
||||||
// All 5 dimensions as table with raw value, score, weight
|
// Dimensions as points breakdown: "18 / 35"
|
||||||
const dims = customer.dimensions || [];
|
const dims = customer.dimensions || [];
|
||||||
const dimTable = h('table', 'helpdesk-risk-detail-tickets');
|
const dimTable = h('table', 'helpdesk-risk-detail-tickets');
|
||||||
const dimHead = h('thead');
|
const dimHead = h('thead');
|
||||||
const dimHeadRow = h('tr');
|
const dimHeadRow = h('tr');
|
||||||
dimHeadRow.appendChild(h('th', '', d('labelScore', 'Dimension')));
|
dimHeadRow.appendChild(h('th', '', 'Dimension'));
|
||||||
dimHeadRow.appendChild(h('th', '', d('labelScore', 'Score')));
|
dimHeadRow.appendChild(h('th', '', d('labelScore', 'Score')));
|
||||||
dimHeadRow.appendChild(h('th', '', '%'));
|
|
||||||
dimHead.appendChild(dimHeadRow);
|
dimHead.appendChild(dimHeadRow);
|
||||||
dimTable.appendChild(dimHead);
|
dimTable.appendChild(dimHead);
|
||||||
const dimBody = h('tbody');
|
const dimBody = h('tbody');
|
||||||
for (const dim of dims) {
|
for (const dim of dims) {
|
||||||
const tr = h('tr');
|
const tr = h('tr');
|
||||||
tr.appendChild(h('td', '', dimLabel(dim.id)));
|
tr.appendChild(h('td', '', dimLabel(dim.id)));
|
||||||
tr.appendChild(h('td', '', dim.dimension_score !== null ? String(dim.dimension_score) : '—'));
|
const points = Math.round(dim.weighted_points || 0);
|
||||||
tr.appendChild(h('td', '', dim.weighted_points > 0 ? dim.weighted_points.toFixed(1) : '—'));
|
tr.appendChild(h('td', '', points + ' / ' + dim.weight));
|
||||||
dimBody.appendChild(tr);
|
dimBody.appendChild(tr);
|
||||||
}
|
}
|
||||||
// Total row
|
|
||||||
const totalTr = h('tr');
|
const totalTr = h('tr');
|
||||||
totalTr.appendChild(h('td', '', 'Total'));
|
const totalLabel = h('td', '');
|
||||||
const totalTd = h('td', '');
|
totalLabel.style.fontWeight = '700';
|
||||||
totalTd.style.fontWeight = '700';
|
totalLabel.textContent = 'Total';
|
||||||
totalTd.textContent = String(customer.risk_score);
|
totalTr.appendChild(totalLabel);
|
||||||
totalTr.appendChild(totalTd);
|
const totalVal = h('td', '');
|
||||||
totalTr.appendChild(h('td', '', ''));
|
totalVal.style.fontWeight = '700';
|
||||||
|
totalVal.textContent = customer.risk_score + ' / 100';
|
||||||
|
totalTr.appendChild(totalVal);
|
||||||
dimBody.appendChild(totalTr);
|
dimBody.appendChild(totalTr);
|
||||||
dimTable.appendChild(dimBody);
|
dimTable.appendChild(dimBody);
|
||||||
dialogBody.appendChild(dimTable);
|
dialogBody.appendChild(dimTable);
|
||||||
|
|||||||
Reference in New Issue
Block a user