feat: update mq field handling in AnnuncioEditForm for improved data parsing
This commit is contained in:
parent
8ac1c1da3d
commit
c459da5d23
1 changed files with 4 additions and 1 deletions
|
|
@ -161,6 +161,7 @@ export const AnnuncioEditForm = ({ data }: { data: AnnunciWithMedia }) => {
|
||||||
|
|
||||||
const defaultValues: FormValues = {
|
const defaultValues: FormValues = {
|
||||||
...data,
|
...data,
|
||||||
|
mq: Number(data.mq) || null,
|
||||||
email: data.email || undefined,
|
email: data.email || undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1261,6 +1262,8 @@ export const AnnuncioEditForm = ({ data }: { data: AnnunciWithMedia }) => {
|
||||||
name="mq"
|
name="mq"
|
||||||
render={({ field }) => {
|
render={({ field }) => {
|
||||||
const { value, onChange, ...rest } = field;
|
const { value, onChange, ...rest } = field;
|
||||||
|
const mqValue =
|
||||||
|
typeof value === "string" ? parseFloat(value) : value;
|
||||||
return (
|
return (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<div className="flex flex-wrap items-center gap-x-2">
|
<div className="flex flex-wrap items-center gap-x-2">
|
||||||
|
|
@ -1273,7 +1276,7 @@ export const AnnuncioEditForm = ({ data }: { data: AnnunciWithMedia }) => {
|
||||||
decimalScale={2}
|
decimalScale={2}
|
||||||
{...rest}
|
{...rest}
|
||||||
decimalSeparator=","
|
decimalSeparator=","
|
||||||
defaultValue={value || undefined}
|
defaultValue={mqValue || undefined}
|
||||||
fixedDecimalScale
|
fixedDecimalScale
|
||||||
id="mq"
|
id="mq"
|
||||||
min={0}
|
min={0}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue