|
|
|
@ -20,7 +20,14 @@ |
|
|
|
|
|
|
|
|
|
|
|
$effect(() => { |
|
|
|
$effect(() => { |
|
|
|
// This effect runs whenever `location` changes |
|
|
|
// This effect runs whenever `location` changes |
|
|
|
if (location !== null) item = null; |
|
|
|
if (location !== null) { |
|
|
|
|
|
|
|
item = null; |
|
|
|
|
|
|
|
setLocationUrl(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$effect(() => { |
|
|
|
|
|
|
|
if (item !== null) setItemUrl(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
let properties = $state(null); |
|
|
|
let properties = $state(null); |
|
|
|
let top_level = $state(null); |
|
|
|
let top_level = $state(null); |
|
|
|
@ -38,12 +45,6 @@ |
|
|
|
} else error(res); |
|
|
|
} else error(res); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function unlistLocation(loc){ |
|
|
|
|
|
|
|
for (var owner of top_level){ |
|
|
|
|
|
|
|
if (owner.locations && dropNestedLocation(owner.locations,loc)) break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function drag_item(item){ |
|
|
|
function drag_item(item){ |
|
|
|
draggedLocation = null; |
|
|
|
draggedLocation = null; |
|
|
|
draggedItem = item; |
|
|
|
draggedItem = item; |
|
|
|
@ -154,6 +155,26 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setItemUrl(){ |
|
|
|
|
|
|
|
var owner = `/${item.owner.type}/${item.owner.id}` |
|
|
|
|
|
|
|
var code = `/item/${item.owner_number}` |
|
|
|
|
|
|
|
let url = window.location.origin + '/stock' + owner + code; |
|
|
|
|
|
|
|
window.history.replaceState(window.history.state, '', url); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setLocationUrl(){ |
|
|
|
|
|
|
|
let url = window.location.origin + '/stock/location/' + location.id; |
|
|
|
|
|
|
|
window.history.replaceState(window.history.state, '', url); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function unlistLocation(loc){ |
|
|
|
|
|
|
|
for (var owner of top_level){ |
|
|
|
|
|
|
|
if (owner.locations && dropNestedLocation(owner.locations,loc)) break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMount(load); |
|
|
|
onMount(load); |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
|