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