feat: admin Verktyg (live fordon + sanktioner lookup) + service-type pricing in configurator

/admin/verktyg uses live /api/vehicles (RDW) + /api/screen (OpenSanctions); added to admin nav. Configurator now has a Tjänst selector that applies each service's price multiplier (lib/services) to the live estimate + summary; service_type carried into the order so orders-store prices by service. tsc 0, build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-25 02:17:18 +02:00
co-authored by Claude Opus 4.8
parent 56e117a6d6
commit 76b20e341d
5 changed files with 117 additions and 4 deletions
+3 -1
View File
@@ -99,6 +99,7 @@ export interface EstimateInput {
volume: number;
frequency: Frequency;
confidence: number; // target 80–99
serviceMult?: number; // service-type price multiplier (see lib/services)
}
export interface Estimate {
@@ -118,7 +119,8 @@ export function computeEstimate(input: EstimateInput): Estimate {
const confidenceMult = 1 + Math.max(0, input.confidence - 90) * 0.03;
const enrichWeight = ENRICHMENTS.filter((e) => input.enrichmentIds.includes(e.id)).reduce((s, e) => s + e.weight, 0);
const base = fieldWeight * markets * FIELD_RATE * (input.volume / 1000) * entityMult * confidenceMult;
const serviceMult = input.serviceMult ?? 1;
const base = fieldWeight * markets * FIELD_RATE * (input.volume / 1000) * entityMult * confidenceMult * serviceMult;
const price = Math.round((base * (1 + enrichWeight)) / 5) * 5; // round to 5 kr
const deposit = Math.round(price / 2);