import { useState } from "react";
import { Card, CardContent } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
/**
* Estimator – bygget for å fungere prinsipielt lik kuttno.no sin estimator:
* - Stegvis valg
* - Reell utregning (areal * korrekt m²-pris + minimum)
* - Skille mellom produksjon / bearbeiding
* - Prisindikasjon (ikke tilbud)
*/
export default function Estimator() {
const [product, setProduct] = useState("print");
const [finish, setFinish] = useState("standard");
const [area, setArea] = useState(1);
/**
* Interne m²-priser (inkl. normal margin)
* Disse samsvarer med prislistene dere har definert tidligere
*/
const priceTable = {
skjarefolie: {
standard: 1390,
},
frost: {
ren: 1350,
dekor: 1490,
},
print: {
standard: 1690,
cut: 1890,
},
};
/**
* Minimumsregler – identisk prinsipp som kuttno:
* - Minimum 1 m²
* - Minimumspris pr. jobb
*/
const minArea = 1;
const minJobPrice = 1490;
const billableArea = Math.max(area, minArea);
const m2Price = priceTable[product][finish];
const calculatedPrice = billableArea * m2Price;
const finalPrice = Math.max(calculatedPrice, minJobPrice);
return (
{/* Steg 2: Bearbeiding / variant */}
{/* Steg 3: Areal */}
);
}
Prisindikator
Veiledende pris beregnet automatisk basert på valg og areal
{/* Steg 1: Produkt */}
setArea(Number(e.target.value))}
className="w-full border rounded-lg p-2"
/>
{/* Resultat */}
Minimum {minArea} m² og minimumspris gjelder
Estimert pris
kr {finalPrice.toLocaleString()},-
Eks. mva. · Veiledende prisindikasjon