This commit is contained in:
j3d1 2026-08-21 19:56:55 +02:00
parent 395a9b156a
commit 7d9f67a77a

View file

@ -40,6 +40,9 @@
<a :href="`/inventory/${item.id}/delete`" @click.prevent="deleteInventoryItem(item)">
<b-icon-trash></b-icon-trash>
</a>
<router-link :to="shortIdLink(item)">
<b-icon-link></b-icon-link>
</router-link>
</td>
</tr>
</tbody>
@ -65,11 +68,14 @@
</div>
<div class="btn-group">
<button class="btn btn-danger btn-sm"
@click="deleteInventoryItem(item.id)">Delete
@click="deleteInventoryItem(item)">Delete
</button>
<router-link :to="`/inventory/${item.id}/edit`"
class="btn btn-primary btn-sm">Edit
</router-link>
<router-link :to="shortIdLink(item)" class="btn btn-secondary btn-sm">
<b-icon-link></b-icon-link>
</router-link>
</div>
</div>
</div>
@ -94,6 +100,7 @@ import {mapActions, mapGetters, mapMutations, mapState} from "vuex";
import * as BIcons from "bootstrap-icons-vue";
import BaseLayout from "@/components/BaseLayout.vue";
import AuthenticatedImage from "../components/AuthenticatedImage.vue";
import {encodeShortId, serializeShortId} from "@/short-id";
export default {
name: "Inventory",
@ -120,6 +127,13 @@ export default {
const loc = this.storage_locations.find(loc => loc.id === item.storage_location)
return loc ? loc.path : null
},
shortIdLink(item) {
// owner_identity_id is a placeholder until the backend exposes a KnownIdentity pk
// per item (see docs/handles-and-shortids.md) - it doesn't decode to a
// meaningful owner yet.
const ints = serializeShortId({kind: 'item', owner_identity_id: 0, item_local_id: item.id});
return '/' + encodeShortId(ints);
},
},
async mounted() {
await this.fetchInventoryItems()