implemented deletion of item properties

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-10-15 21:13:08 +02:00
parent a001074783
commit 21c5a72349
4 changed files with 15 additions and 7 deletions

View File

@@ -19,7 +19,9 @@
return a.name.localeCompare(b.name);
}
async function onclick(){
async function onsubmit(ev){
ev.preventDefault();
ev.stopPropagation();
const url = api('stock/property');
const data = {
item : {
@@ -40,6 +42,7 @@
item.properties.push(prop);
yikes();
} else error(res);
return false;
}
async function patch(key,newVal){
@@ -95,13 +98,15 @@ Code: <LineEditor type="span" editable={true} value={item.code} onSet={v => patc
{/if}
</td>
<td>
<form {onsubmit}>
<input type="text" placeholder="value" bind:value={add_prop.value} />
{#if !add_prop.existing_prop_id}
<input type="text" placeholder="unit" bind:value={add_prop.new_prop.unit} />
{:else}
{properties.filter(p => p.id == add_prop.existing_prop_id)[0].unit}
{/if}
<button {onclick}>{t('save')}</button>
<button>{t('save')}</button>
</form>
</td>
</tr>
</tbody>