diff --git a/client/src/app/quotes/components/QuotePricesResume.tsx b/client/src/app/quotes/components/QuotePricesResume.tsx
index 659d0a8..ca5b891 100644
--- a/client/src/app/quotes/components/QuotePricesResume.tsx
+++ b/client/src/app/quotes/components/QuotePricesResume.tsx
@@ -66,7 +66,7 @@ const calculateQuoteTotals = (prices: any) => {
};
export const QuotePricesResume = ({ currency }: { currency: CurrencyData }) => {
- const { register, formState, control } = useFormContext();
+ const { formState, control } = useFormContext();
const { formatNumber } = useLocalization();
const pricesWatch = useWatch({ control, name: ["subtotal_price", "discount", "tax"] });
@@ -105,9 +105,7 @@ export const QuotePricesResume = ({ currency }: { currency: CurrencyData }) => {
scale={2}
disabled={formState.disabled}
placeholder={t("quotes.form_fields.discount.placeholder")}
- {...register("discount", {
- required: false,
- })}
+ name='discount'
onChange={(value) => {
console.log("discount", value);
}}
@@ -134,9 +132,7 @@ export const QuotePricesResume = ({ currency }: { currency: CurrencyData }) => {
scale={2}
disabled={formState.disabled}
placeholder={t("quotes.form_fields.tax.placeholder")}
- {...register("tax", {
- required: false,
- })}
+ name='tax'
/>
diff --git a/client/src/app/quotes/components/editors/QuoteDetailsCardEditor.tsx b/client/src/app/quotes/components/editors/QuoteDetailsCardEditor.tsx
index 457ca7a..9d763d4 100644
--- a/client/src/app/quotes/components/editors/QuoteDetailsCardEditor.tsx
+++ b/client/src/app/quotes/components/editors/QuoteDetailsCardEditor.tsx
@@ -31,7 +31,7 @@ export const QuoteDetailsCardEditor = ({
defaultValues: Readonly<{ [x: string]: any }> | undefined;
}) => {
const { toast } = useToast();
- const { control, register } = useFormContext();
+ const { control } = useFormContext();
const [pickerMode] = useState<"dialog" | "panel">("dialog");
@@ -65,7 +65,7 @@ export const QuoteDetailsCardEditor = ({
);
},
@@ -80,7 +80,7 @@ export const QuoteDetailsCardEditor = ({
);
},
@@ -98,7 +98,7 @@ export const QuoteDetailsCardEditor = ({
);
},
@@ -117,7 +117,7 @@ export const QuoteDetailsCardEditor = ({
language={language}
scale={2}
className='text-right'
- {...register(`items.${index}.unit_price`)}
+ name={`items.${index}.unit_price`}
/>
);
},
@@ -138,7 +138,7 @@ export const QuoteDetailsCardEditor = ({
scale={2}
readOnly
className='text-right'
- {...register(`items.${index}.subtotal_price`)}
+ name={`items.${index}.subtotal_price`}
/>
);
},
@@ -155,7 +155,7 @@ export const QuoteDetailsCardEditor = ({
);
},
@@ -176,7 +176,7 @@ export const QuoteDetailsCardEditor = ({
scale={2}
readOnly
className='font-semibold text-right'
- {...register(`items.${index}.total_price`)}
+ name={`items.${index}.total_price`}
/>
);
},
diff --git a/client/src/app/quotes/components/editors/QuoteGeneralCardEditor.tsx b/client/src/app/quotes/components/editors/QuoteGeneralCardEditor.tsx
index 27634b3..7cd864d 100644
--- a/client/src/app/quotes/components/editors/QuoteGeneralCardEditor.tsx
+++ b/client/src/app/quotes/components/editors/QuoteGeneralCardEditor.tsx
@@ -4,7 +4,7 @@ import { t } from "i18next";
import { useFormContext } from "react-hook-form";
export const QuoteGeneralCardEditor = () => {
- const { register, formState } = useFormContext();
+ const { formState } = useFormContext();
return (
@@ -21,7 +21,7 @@ export const QuoteGeneralCardEditor = () => {
description={t("quotes.form_fields.customer_reference.desc")}
disabled={formState.disabled}
placeholder={t("quotes.form_fields.customer_reference.placeholder")}
- {...register("customer_reference")}
+ name='customer_reference'
/>
{
description={t("quotes.form_fields.date.desc")}
disabled={formState.disabled}
placeholder={t("quotes.form_fields.date.placeholder")}
- {...register("date", {
- required: true,
- })}
+ name='date'
/>
{
description={t("quotes.form_fields.payment_method.desc")}
disabled={formState.disabled}
placeholder={t("quotes.form_fields.payment_method.placeholder")}
- {...register("payment_method", {
- required: false,
- })}
+ name='payment_method'
/>
@@ -62,9 +56,7 @@ export const QuoteGeneralCardEditor = () => {
description={t("quotes.form_fields.customer_information.desc")}
disabled={formState.disabled}
placeholder={t("quotes.form_fields.customer_information.placeholder")}
- {...register("customer_information", {
- required: true,
- })}
+ name='customer_information'
errors={formState.errors}
/>
@@ -74,9 +66,7 @@ export const QuoteGeneralCardEditor = () => {
description={t("quotes.form_fields.notes.desc")}
disabled={formState.disabled}
placeholder={t("quotes.form_fields.notes.placeholder")}
- {...register("notes", {
- required: false,
- })}
+ name='notes'
/>
@@ -105,9 +95,7 @@ export const QuoteGeneralCardEditor = () => {
description={t("quotes.form_fields.lang_code.desc")}
//disabled={formState.disabled}
placeholder={t("quotes.form_fields.lang_code.placeholder")}
- {...register("lang_code", {
- required: true,
- })}
+ name='lang_code'
/>
{
description={t("quotes.form_fields.currency_code.desc")}
//disabled={formState.disabled}
placeholder={t("quotes.form_fields.currency_code.placeholder")}
- {...register("currency_code", {
- required: true,
- })}
+ name='currency_code'
/>
diff --git a/client/src/components/Forms/FormCurrencyField.tsx b/client/src/components/Forms/FormCurrencyField.tsx
index 06531f0..f3f4d4e 100644
--- a/client/src/components/Forms/FormCurrencyField.tsx
+++ b/client/src/components/Forms/FormCurrencyField.tsx
@@ -43,8 +43,7 @@ export type FormCurrencyFieldProps<
scale: number;
};
-export const FormCurrencyField = React.forwardRef