import { FormPercentageField } from "@/components"; import { useLocalization } from "@/lib/hooks"; import { Card, CardContent, CardDescription, CardTitle, Separator } from "@/ui"; import { CurrencyData } from "@shared/contexts"; import { t } from "i18next"; import { useMemo } from "react"; import { useFormContext } from "react-hook-form"; export const QuotePricesResume = () => { const { watch, register, formState } = useFormContext(); const { formatNumber } = useLocalization(); const currency_code = watch("currency_code"); const subtotal_price = formatNumber(watch("subtotal_price")); const discount_price = formatNumber(watch("discount_price")); const tax_price = formatNumber(watch("tax_price")); const total_price = formatNumber(watch("total_price")); const currency_symbol = useMemo(() => { const currencyOrError = CurrencyData.createFromCode(currency_code); return currencyOrError.isSuccess ? currencyOrError.object.symbol : ""; }, [currency_code]); return (
{t("quotes.form_fields.subtotal_price.label")} {subtotal_price} {currency_symbol}
{t("quotes.form_fields.discount.label")}
{t("quotes.form_fields.discount_price.label")} {discount_price} {currency_symbol}
{t("quotes.form_fields.tax.label")}
{t("quotes.form_fields.tax_price.label")} {tax_price} {currency_symbol}
{" "}
{t("quotes.form_fields.total_price.label")} {total_price} {currency_symbol}
); };