Merge branch 'TagItemDisplay' into dev
All checks were successful
Build Docker Image / Docker-Build (push) Successful in 2m22s
Build Docker Image / Clean-Registry (push) Successful in -7s

This commit is contained in:
2026-03-16 09:12:21 +01:00
3 changed files with 49 additions and 2 deletions

View File

@@ -0,0 +1,37 @@
<script>
import { onMount } from 'svelte';
import { useTinyRouter } from 'svelte-tiny-router';
import { api, get } from '../../urls.svelte';
import { error, yikes } from '../../warn.svelte';
import { t } from '../../translations.svelte';
let {module, id} = $props();
let item = $state(null);
let router = useTinyRouter();
function onclick(e){
e.preventDefault();
var target = e.target;
while (target && !target.href) target=target.parentNode;
let href = target.getAttribute('href');
if (href) router.navigate(href);
return false;
}
async function loadItem(){
let url = api(`stock/item/${id}`);
let res = await get(url);
if (res.ok) {
yikes();
item = await res.json();
} else error();
}
onMount(loadItem);
</script>
{#if item}
<a href="/stock/{id}/view" {onclick} >({item.code}) {item.name}</a>
{/if}