"use client"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Check, X } from "lucide-react"; import { useState } from "react"; interface PriceOverrideInputProps { value: string; onChange: (value: string) => void; calculatedTotal?: number; } export function PriceOverrideInput({ value, onChange, calculatedTotal }: PriceOverrideInputProps) { const [isTouched, setIsTouched] = useState(false); const numValue = parseFloat(value) || 0; const matches = calculatedTotal !== undefined && Math.abs(numValue - calculatedTotal) < 0.01; return (
Prezzo calcolato: €{calculatedTotal.toLocaleString("it-IT", { minimumFractionDigits: 2, maximumFractionDigits: 2, })}
)} {isTouched && value && !matches && (Attenzione: il valore inserito non corrisponde al totale calcolato (server verificherà )
)}