work on document form

This commit is contained in:
2025-07-11 15:41:29 +02:00
parent 86801e10c2
commit 2a7e9df334
6 changed files with 90 additions and 43 deletions

View File

@@ -24,6 +24,16 @@
}
</script>
<style>
div{
min-width: 40px;
min-height: 20px;
}
div:hover{
border: 1px dotted;
}
</style>
{#if editable && editing}
<input bind:value={editValue} onkeyup={typed} autofocus />
{:else}

View File

@@ -45,6 +45,13 @@
width: 100%;
min-height: 100px;
}
div{
min-width: 40px;
min-height: 20px;
}
div:hover{
border: 1px dotted;
}
</style>
{#if editable && editing}

View File

@@ -2,6 +2,7 @@
import { onMount } from 'svelte';
import { t } from '../../translations.svelte.js';
import { useTinyRouter } from 'svelte-tiny-router';
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
import PositionList from './PositionList.svelte';
import StateSelector from './StateSelector.svelte';
import TemplateSelector from './TemplateSelector.svelte';
@@ -9,6 +10,9 @@
let error = null;
let doc = $state(null);
let editable = $derived(doc.state == 1);
async function loadDoc(){
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/document/${id}`;
const resp = await fetch(url,{credentials:'include'});
@@ -39,42 +43,59 @@
{#if doc}
<fieldset class="left">
<legend>{t('document.customer')}</legend>
<div>
{#each doc.customer.name.split("\n") as line}
{line}<br/>
{/each}
</div>
<div>
<span>{t('document.customer_number',doc.customer.id)}</span>
</div>
<div>
<span>{t('document.tax_id',doc.customer.tax_id)}</span>
</div>
<div>
<span>{t('document.email',doc.customer.email)}</span>
</div>
<table>
<tbody>
<tr>
<td colspan="2">
{#each doc.customer.name.split("\n") as line}
{line}<br/>
{/each}
</td>
</tr>
<tr>
<th>{t('document.customer_id')}:</th>
<td>{doc.customer.id}</td>
</tr>
<tr>
<th>{t('document.tax_id')}:</th>
<td>{doc.customer.tax_id}</td>
</tr>
<tr>
<th>{t('document.email')}:</th>
<td>{doc.customer.email}</td>
</tr>
</tbody>
</table>
</fieldset>
<fieldset class="left">
<legend>{t('document.sender')}</legend>
<div>
{#each doc.sender.name.split("\n") as line}
{line}<br/>
{/each}
</div>
<div>
<span>{t('document.court',doc.sender.court)}</span>
</div>
<div>
<span>{t('document.tax_id',doc.sender.tax_id)}</span>
</div>
<div>
<span>
{t('document.bank_account')}:
{#each doc.sender.bank_account.split("\n") as line}
{line}<br/>
{/each}
</span>
</div>
<table>
<tbody>
<tr>
<td colspan="2">
{#each doc.sender.name.split("\n") as line}
{line}<br/>
{/each}
</td>
</tr>
<tr>
<th>{t('document.court')}:</th>
<td>{doc.sender.court}</td>
</tr>
<tr>
<th>{t('document.tax_id')}:</th>
<td>{doc.sender.tax_id}</td>
</tr>
<tr>
<th>{t('document.bank_account')}:</th>
<td>
{#each doc.sender.bank_account.split("\n") as line}
{line}<br/>
{/each}
</td>
</tr>
</tbody>
</table>
</fieldset>
<fieldset class="left">
<legend>{t('document.type_'+doc.type)}</legend>
@@ -86,7 +107,7 @@
</fieldset>
<fieldset class="clear">
<legend>{t('document.head')}</legend>
{@html doc.head}
<MarkdownEditor bind:value={doc.head} editable={editable} />
</fieldset>
<fieldset>
<legend>{t('document.positions')}</legend>
@@ -94,7 +115,7 @@
</fieldset>
<fieldset>
<legend>{t('document.footer')}</legend>
{@html doc.footer}
<MarkdownEditor bind:value={doc.footer} editable={editable} />
</fieldset>
<fieldset>
<legend>{t('document.actions')}</legend>