58 lines
1.8 KiB
JavaScript
58 lines
1.8 KiB
JavaScript
ItemRelationDetail = {
|
|
template: "#ItemRelationDetail",
|
|
router_path: "/ItemRelationDetail/:id",
|
|
delimiters: ["[[", "]]"],
|
|
|
|
computed: {
|
|
object: function() {
|
|
return this.$store.state.relations.items.find(i => i.id == this.$route.params.id)
|
|
},
|
|
|
|
headers: function() {
|
|
return this.$store.state.relations.headers
|
|
},
|
|
|
|
relation_properties: function() {
|
|
return this.$store.state.relationProperties.items.filter(i => i.relation == this.$route.params.id)
|
|
},
|
|
|
|
relation_properties_headers: function() {
|
|
return this.$store.state.relationProperties.headers
|
|
},
|
|
|
|
all_properties: function() {
|
|
return this.$store.state.properties.items
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
|
|
showItem (id) {
|
|
this.$router.push({ name: 'ItemDetail', params: { id: id }})
|
|
},
|
|
|
|
relationPropertyEdition (method, item) {
|
|
return this.object_edit("items:relation.property.edit", "items:relation.property.create", 'relationProperties', method, item)
|
|
},
|
|
|
|
async deleteRelationProperty (item) {
|
|
await this.relationPropertyEdition("delete", item)
|
|
this.$store.commit("relationProperties/removeItem", item.id)
|
|
},
|
|
|
|
async createRelationProperty (item) {
|
|
item.relation = this.$route.params.id
|
|
const new_item = await this.relationPropertyEdition("post", item)
|
|
this.$store.commit("relationProperties/addItem", new_item)
|
|
},
|
|
|
|
async editRelationProperty (item) {
|
|
item.relation = this.$route.params.id
|
|
const new_item = await this.relationPropertyEdition("post", item)
|
|
this.$store.commit("relationProperties/editItem", new_item)
|
|
},
|
|
|
|
}
|
|
|
|
}
|