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 = {
|
||||
...data,
|
||||
mq: Number(data.mq) || null,
|
||||
email: data.email || undefined,
|
||||
};
|
||||
|
||||
|
|
@ -1261,6 +1262,8 @@ export const AnnuncioEditForm = ({ data }: { data: AnnunciWithMedia }) => {
|
|||
name="mq"
|
||||
render={({ field }) => {
|
||||
const { value, onChange, ...rest } = field;
|
||||
const mqValue =
|
||||
typeof value === "string" ? parseFloat(value) : value;
|
||||
return (
|
||||
<FormItem>
|
||||
<div className="flex flex-wrap items-center gap-x-2">
|
||||
|
|
@ -1273,7 +1276,7 @@ export const AnnuncioEditForm = ({ data }: { data: AnnunciWithMedia }) => {
|
|||
decimalScale={2}
|
||||
{...rest}
|
||||
decimalSeparator=","
|
||||
defaultValue={value || undefined}
|
||||
defaultValue={mqValue || undefined}
|
||||
fixedDecimalScale
|
||||
id="mq"
|
||||
min={0}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue