stash
This commit is contained in:
parent
3cd9200d87
commit
e88dc898b3
18 changed files with 298 additions and 84 deletions
|
|
@ -55,10 +55,10 @@
|
|||
</td>
|
||||
<td class="d-none d-md-table-cell">{{ item.owned_quantity }}</td>
|
||||
<td class="table-action">
|
||||
<router-link v-if="canEdit" :to="`${itemRoute(item)}/edit`">
|
||||
<router-link v-if="canEdit" :to="itemEditRoute(item)">
|
||||
<b-icon-pencil-square></b-icon-pencil-square>
|
||||
</router-link>
|
||||
<a v-if="canEdit" :href="`${itemRoute(item)}/delete`" @click.prevent="tryDeleteItem(item)">
|
||||
<a v-if="canEdit" href="#" @click.prevent="tryDeleteItem(item)">
|
||||
<b-icon-trash></b-icon-trash>
|
||||
</a>
|
||||
<router-link v-if="shortIdLink(item)" :to="shortIdLink(item)">
|
||||
|
|
@ -95,7 +95,7 @@
|
|||
<button v-if="canEdit" class="btn btn-danger btn-sm"
|
||||
@click="tryDeleteItem(item)">Delete
|
||||
</button>
|
||||
<router-link v-if="canEdit" :to="`${itemRoute(item)}/edit`"
|
||||
<router-link v-if="canEdit" :to="itemEditRoute(item)"
|
||||
class="btn btn-primary btn-sm">Edit
|
||||
</router-link>
|
||||
<router-link v-if="shortIdLink(item)" :to="shortIdLink(item)"
|
||||
|
|
@ -166,8 +166,8 @@ export default {
|
|||
return this.owner ? decodeHandleFromUrl(this.owner) : this.user
|
||||
},
|
||||
set(value) {
|
||||
const path = value === this.user ? '/inventory' : `/inventory/${encodeHandleForUrl(value)}`
|
||||
this.$router.replace(path)
|
||||
const params = value === this.user ? {} : {owner: encodeHandleForUrl(value)}
|
||||
this.$router.replace({name: 'inventory', params})
|
||||
}
|
||||
},
|
||||
isGroupSelected() {
|
||||
|
|
@ -182,9 +182,8 @@ export default {
|
|||
return this.selectedOwner === this.user ? this.inventory_items : this.groupInventoryItems(this.selectedOwner)
|
||||
},
|
||||
addItemRoute() {
|
||||
return this.selectedOwner === this.user
|
||||
? '/inventory/new'
|
||||
: `/inventory/new/${encodeHandleForUrl(this.selectedOwner)}`
|
||||
const params = this.selectedOwner === this.user ? {} : {group: encodeHandleForUrl(this.selectedOwner)}
|
||||
return {name: 'inventory-new', params}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -203,7 +202,10 @@ export default {
|
|||
},
|
||||
// Derived from the item's own owner, not the current selection, so the link stays correct if the dropdown changes underneath it.
|
||||
itemRoute(item) {
|
||||
return `/inventory/${encodeHandleForUrl(item.owner_group || item.owner)}/${item.id}`
|
||||
return {name: 'inventory-detail', params: {handle: encodeHandleForUrl(item.owner_group || item.owner), id: item.id}}
|
||||
},
|
||||
itemEditRoute(item) {
|
||||
return {name: 'inventory-edit', params: {handle: encodeHandleForUrl(item.owner_group || item.owner), id: item.id}}
|
||||
},
|
||||
only_images(files) {
|
||||
return files.filter(file => file.mime_type.startsWith("image/"));
|
||||
|
|
@ -225,7 +227,7 @@ export default {
|
|||
printLinkFor(item) {
|
||||
const userHandle = item.owner || item.owner_group
|
||||
if (!userHandle) return null
|
||||
return {path: '/print', query: {kind: 'item', userHandle, id: item.id}}
|
||||
return {name: 'print', query: {kind: 'item', userHandle, id: item.id}}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue