implemented creating new stock items

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-10-25 18:31:46 +02:00
parent 4b4a575356
commit 3caf51f52d
6 changed files with 51 additions and 7 deletions

View File

@@ -8,11 +8,13 @@
async function saveNewItem(){
newItem.location = location;
console.log(JSON.parse(JSON.stringify(newItem)));
const url = api('stock/item');
const res = post(url,newItem);
const res = await post(url,newItem);
if (res.ok) {
yikes();
const it = await res.json();
console.log(it);
items = [...items, it];
} else error(res);
}
</script>
@@ -27,7 +29,7 @@
<tbody>
{#each items as item}
<tr onclick={ev => selected = item} ondragstart={e => drag_start(item)} draggable="true">
<td>{item.id}</td>
<td title={`db id: ${item.id}`}>{item.owner_number}</td>
<td>{item.code}</td>
<td>{item.name}</td>
</tr>