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