feat: agregar manejo de porcentaje de impuesto por defecto al duplicar y agregar elementos en el controlador de proformas
This commit is contained in:
parent
394d3465e3
commit
275fc0aca8
@ -131,7 +131,9 @@ export const useUpdateProformaItemsController = ({
|
|||||||
|
|
||||||
const duplicatedItem: ProformaItemUpdateForm = {
|
const duplicatedItem: ProformaItemUpdateForm = {
|
||||||
...item,
|
...item,
|
||||||
id: buildProformaItemUpdateDefault(index + 1).id,
|
id: buildProformaItemUpdateDefault(index + 1, {
|
||||||
|
defaultTaxPercentage: getValues("taxPercentage") ?? undefined,
|
||||||
|
}).id,
|
||||||
position: index + 1,
|
position: index + 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -177,7 +179,14 @@ export const useUpdateProformaItemsController = ({
|
|||||||
const safeIndex = Math.max(0, Math.min(index, currentItems.length));
|
const safeIndex = Math.max(0, Math.min(index, currentItems.length));
|
||||||
|
|
||||||
const nextItems = [...currentItems];
|
const nextItems = [...currentItems];
|
||||||
nextItems.splice(safeIndex, 0, buildProformaItemUpdateDefault(safeIndex));
|
|
||||||
|
nextItems.splice(
|
||||||
|
safeIndex,
|
||||||
|
0,
|
||||||
|
buildProformaItemUpdateDefault(safeIndex, {
|
||||||
|
defaultTaxPercentage: getValues("taxPercentage") ?? undefined,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
replaceItems(nextItems);
|
replaceItems(nextItems);
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user