4 changed files with 49 additions and 4 deletions
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
<script> |
||||
import { onMount } from 'svelte'; |
||||
|
||||
import { api } from '../../urls.svelte.js'; |
||||
import { t } from '../../translations.svelte.js'; |
||||
|
||||
let { module, id } = $props(); |
||||
|
||||
let task = $state(null); |
||||
let caption = $state(`${t(module)} ${id}`); |
||||
|
||||
async function loadDefault(){ |
||||
const url = api(`${module}/${id}`); |
||||
const resp = await fetch(url,{credentials:'include'}); |
||||
if (resp.ok){ |
||||
var json = await resp.json(); |
||||
if (json.name) caption = json.name; |
||||
if (json.type && json.number) caption = `${t(json.type)} ${json.number} (${json.customer.name.split('\n')[0]})` |
||||
} |
||||
} |
||||
|
||||
async function load(){ |
||||
loadDefault(); |
||||
} |
||||
|
||||
onMount(load); |
||||
</script> |
||||
|
||||
{caption} |
||||
Loading…
Reference in new issue