Browse Source

preparing to make items/locations referencable

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
module/stock
Stephan Richter 2 days ago
parent
commit
9a377a8871
  1. 13
      frontend/src/routes/stock/Index.svelte

13
frontend/src/routes/stock/Index.svelte

@ -17,6 +17,7 @@
let location = $state(null); let location = $state(null);
let draggedItem = $state(null) let draggedItem = $state(null)
let draggedLocation = $state(null) let draggedLocation = $state(null)
let { location_id } = $props();
$effect(() => { $effect(() => {
// This effect runs whenever `location` changes // This effect runs whenever `location` changes
@ -122,6 +123,7 @@
function load(){ function load(){
loadUserLocations(); loadUserLocations();
unfoldPath();
loadProperties(); loadProperties();
} }
@ -167,18 +169,25 @@
window.history.replaceState(window.history.state, '', url); window.history.replaceState(window.history.state, '', url);
} }
// tries to unfold the path to a certain location, if a locationId is supplied via URL
function unfoldPath(){
if (!locationId) return;
// TODO
}
function unlistLocation(loc){ function unlistLocation(loc){
for (var owner of top_level){ for (var owner of top_level){
if (owner.locations && dropNestedLocation(owner.locations,loc)) break; if (owner.locations && dropNestedLocation(owner.locations,loc)) break;
} }
} }
onMount(load); onMount(load);
</script> </script>
<h2>{t('Stock')}</h2> <h2>{t('Stock')}</h2>
{#if location_id}
{location_id}
{/if}
<div class="grid3"> <div class="grid3">
<div class="locations"> <div class="locations">
{#if top_level} {#if top_level}

Loading…
Cancel
Save