implemented editing of document in GUI + respective handlers in backend

This commit is contained in:
2025-07-12 23:34:05 +02:00
parent 2cc4d43e7c
commit 26fa72ef84
12 changed files with 190 additions and 81 deletions

View File

@@ -5,33 +5,38 @@
import LineEditor from '../../Components/LineEditor.svelte';
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
import PriceEditor from '../../Components/PriceEditor.svelte';
var { currency, editable, pos = $bindable(null) } = $props();
console.log(pos);
var { currency, editable, pos = $bindable(null), submit = (key,newVal) => {} } = $props();
let prefix = `pos.${pos.number}`
</script>
{#if pos}
<tr>
<td>{pos.number}</td>
<td>
<LineEditor bind:value={pos.item} editable={editable} />
<td class="item">
<LineEditor bind:value={pos.item} editable={editable} onSet={(val) => submit(`${prefix}.item`,val)} />
</td>
<td class="title">
<LineEditor bind:value={pos.title} editable={editable} />
<LineEditor bind:value={pos.title} editable={editable} onSet={(val) => submit(`${prefix}.title`,val)} />
</td>
<td>
<LineEditor bind:value={pos.amount} editable={editable} />
<td class="amount">
<LineEditor bind:value={pos.amount} editable={editable} onSet={(val) => submit(`${prefix}.amount`,val)} />
</td>
<td>
<LineEditor bind:value={pos.unit} editable={editable} />
<td class="unit">
<LineEditor bind:value={pos.unit} editable={editable} onSet={(val) => submit(`${prefix}.unit`,val)} />
</td>
<td class="price">
<PriceEditor bind:value={pos.unit_price} editable={editable} currency={currency} onSet={(val) => submit(`${prefix}.unit_price`,val)} /></td>
<td class="price">
{Number(pos.amount * pos.unit_price/100).toFixed(2)}&nbsp;{currency}
</td>
<td class="tax">
{pos.tax}&nbsp;%
</td>
<td>
<PriceEditor bind:value={pos.unit_price} editable={editable} currency={currency} /></td>
<td>{Number(pos.amount * pos.unit_price/100).toFixed(2)}&nbsp;{currency}</td>
<td>{pos.tax}&nbsp;%</td>
</tr>
<tr>
<td class="error"><br/></td>
<td colspan="6"><MarkdownEditor bind:value={pos.description} editable={editable} /></td>
<td class="move"><br/></td>
<td colspan="6" class="description">
<MarkdownEditor bind:value={pos.description} editable={editable} onSet={(val) => submit(`${prefix}.description`,val)} />
</td>
<td></td>
</tr>
{/if}