import { notFound } from "next/navigation" import Image from "next/image" import Link from "next/link" import { getQuoteBySlug } from "@/lib/db" import { calculatePrice, formatEstimate } from "@/lib/calculations" import { getDistance } from "@/lib/distance" import { CalculationDetailsView } from "@/components/calculator/calculation-details" import { ArrowLeft, CheckCircle2, Calendar } from "lucide-react" import { FLOORING_TYPES } from "@/lib/constants" interface PageProps { params: Promise<{ slug: string }> } export default async function TilbudPage({ params }: PageProps) { const { slug } = await params const quote = getQuoteBySlug(slug) if (!quote) { notFound() } // Recalculate the price based on stored inputs const distance = getDistance(quote.postalCode) const calculation = calculatePrice({ area: quote.area, height: quote.height, postalCode: quote.postalCode, distance, includeInsulation: true, includeFloorHeating: quote.includeFloorHeating, includeCompound: true, flooringType: quote.flooringType as keyof typeof FLOORING_TYPES, }) const createdDate = new Date(quote.createdAt).toLocaleDateString("da-DK", { day: "numeric", month: "long", year: "numeric", }) return (
{/* Header */}
Foam King
Tilbud #{quote.id}
Tilbage til forsiden {/* Quote Header */}

Prisoverslag

Oprettet {createdDate}

{/* Customer Info */}

Kundeoplysninger

Navn:
{quote.customerName}
Adresse:
{quote.postalCode} {quote.address ? `, ${quote.address}` : ""}
{quote.remarks && (
Bemærkninger:

{quote.remarks}

)}
{/* Price Box */}

{formatEstimate(calculation.totalInclVat)}

inkl. moms

{/* Project Details */}

Projektdetaljer

Areal:
{quote.area} m²
Gulvhøjde:
{quote.height} cm
Placering:
{quote.postalCode} {quote.address ? `, ${quote.address}` : ""}
Gulvbelægning:
{FLOORING_TYPES[quote.flooringType as keyof typeof FLOORING_TYPES]?.name || quote.flooringType}

Inkluderet i prisen

  • Isolering ({calculation.insulationThickness} cm)
  • {quote.includeFloorHeating && (
  • Gulvvarme syntetisk net + Ø16 PEX (excl. tilslutning)
  • )}
  • Flydespartel (støbning)
  • Transport

*Prisen er vejledende og kan variere med ±10.000 kr afhængigt af konkrete forhold

{/* Detailed Calculation */}

Detaljeret prisberegning

{/* Footer */}
) }