implemented display of document positions

This commit is contained in:
2025-07-10 22:47:09 +02:00
parent 48dfabaaf3
commit 5f3d112cdb
14 changed files with 264 additions and 128 deletions

View File

@@ -0,0 +1,35 @@
<script>
import {onMount} from 'svelte';
import {t} from '../../translations.svelte.js';
let { caption, company, value = $bindable(0), onchange = () => console.log('changed')} = $props();
let message = t('document.loading');
let templates = $state(null);
async function loadTemplates(){
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/document/templates`;
var resp = await fetch(url,{
credentials: 'include',
method: 'POST',
body: JSON.stringify({company:company})
});
if (resp.ok){
templates = await resp.json();
} else {
message = await resp.text();
}
}
onMount(loadTemplates)
</script>
{#if templates}
<select bind:value onchange={onchange}>
<option value={0}>{caption}</option>
{#each Object.entries(templates) as [id,template]}
<option value={template.id}>{template.name}</option>
{/each}
</select>
{:else}
<span>{message}</span>
{/if}