[dyad] Fixed issue with adding new items to purchase orders - wrote 1 file(s)
This commit is contained in:
parent
0dc7ffb925
commit
c11b83f44e
1 changed files with 3 additions and 3 deletions
|
|
@ -126,14 +126,14 @@ export function PurchaseOrderForm({ setOpen, refreshData }: PurchaseOrderFormPro
|
|||
|
||||
// Function to add a new item row
|
||||
const addItem = () => {
|
||||
form.control.register("items", { shouldUnregister: true }) // Ensure registration
|
||||
form.setValue("items", [...form.getValues("items"), {
|
||||
const currentItems = form.getValues("items");
|
||||
form.setValue("items", [...currentItems, {
|
||||
stockItemId: "",
|
||||
itemName: "",
|
||||
quantity: 1,
|
||||
sku: "",
|
||||
costPrice: 0,
|
||||
}])
|
||||
}]);
|
||||
}
|
||||
|
||||
// Function to remove an item row
|
||||
|
|
|
|||
Loading…
Reference in a new issue