Se cambio en el modulo de editar producto el tipo de input a number
This commit is contained in:
@@ -21,9 +21,9 @@ import { useForm } from 'react-hook-form';
|
||||
import { useUpdateProduct } from "@/feactures/inventory/hooks/use-mutation";
|
||||
import { updateInventory, EditInventory, InventoryTable } from '@/feactures/inventory/schemas/inventory'; // Renombrado EditInventory para claridad
|
||||
import { Textarea } from '@repo/shadcn/components/ui/textarea';
|
||||
import {STATUS} from '@/constants/status'
|
||||
import { STATUS } from '@/constants/status'
|
||||
import { useState, useEffect } from 'react';
|
||||
import {sizeFormate} from "@/feactures/inventory/utils/sizeFormate"
|
||||
import { sizeFormate } from "@/feactures/inventory/utils/sizeFormate"
|
||||
// import { z } from 'zod'; // Asegúrate de importar Zod
|
||||
|
||||
// --- MODIFICACIÓN CLAVE ---
|
||||
@@ -154,7 +154,7 @@ export function UpdateForm({
|
||||
<FormItem >
|
||||
<FormLabel>Precio</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
<Input type="number" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -182,7 +182,7 @@ export function UpdateForm({
|
||||
<FormItem className='col-span-2'>
|
||||
<FormLabel>Descripción</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea {...field} className="resize-none"/>
|
||||
<Textarea {...field} className="resize-none" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -196,7 +196,7 @@ export function UpdateForm({
|
||||
<FormItem>
|
||||
<FormLabel>Cantidad/Stock</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} type="number" onChange={(e) => field.onChange(Number(e.target.value))}/>
|
||||
<Input {...field} type="number" onChange={(e) => field.onChange(Number(e.target.value))} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -248,8 +248,8 @@ export function UpdateForm({
|
||||
const newPreviewUrls: string[] = [];
|
||||
|
||||
files.forEach(element => {
|
||||
size += element.size;
|
||||
newPreviewUrls.push(URL.createObjectURL(element));
|
||||
size += element.size;
|
||||
newPreviewUrls.push(URL.createObjectURL(element));
|
||||
});
|
||||
|
||||
const tamañoFormateado = sizeFormate(size);
|
||||
@@ -257,18 +257,18 @@ export function UpdateForm({
|
||||
setPreviewUrls(newPreviewUrls);
|
||||
onChange(e.target.files);
|
||||
} else {
|
||||
setPreviewUrls([]);
|
||||
setPreviewUrls([]);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
{previewUrls.length > 0 && (
|
||||
<div className="mt-2 flex flex-wrap gap-2">
|
||||
{previewUrls.map((url, index) => (
|
||||
<img key={index} src={url} alt={`Preview ${index}`} className="w-24 h-24 object-cover rounded-md" />
|
||||
))}
|
||||
</div>
|
||||
<div className="mt-2 flex flex-wrap gap-2">
|
||||
{previewUrls.map((url, index) => (
|
||||
<img key={index} src={url} alt={`Preview ${index}`} className="w-24 h-24 object-cover rounded-md" />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</FormItem>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user