80 lines
2.8 KiB
JavaScript
80 lines
2.8 KiB
JavaScript
PropertyDetail = {
|
|
template: "#PropertyDetail",
|
|
router_path: "/PropertyDetail/:id",
|
|
delimiters: ["[[", "]]"],
|
|
|
|
computed: {
|
|
object: function() {
|
|
return this.$store.state.properties.items.find(i => i.id == this.$route.params.id)
|
|
},
|
|
|
|
headers: function() {
|
|
return this.$store.state.properties.headers
|
|
},
|
|
|
|
linked_properties: function() {
|
|
return this.$store.state.linkedProperties.items.filter(i => i.property == this.$route.params.id)
|
|
},
|
|
|
|
linked_properties_headers: function() {
|
|
return this.$store.state.linkedProperties.headers
|
|
},
|
|
|
|
relation_properties: function() {
|
|
return this.$store.state.relationProperties.items.filter(i => i.property == this.$route.params.id)
|
|
},
|
|
|
|
relation_properties_headers: function() {
|
|
return this.$store.state.relationProperties.headers
|
|
},
|
|
|
|
all_items: function() {
|
|
return this.$store.state.items.items
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
linkedPropertyEdition (method, item) {
|
|
return this.object_edit("items:linked.property.edit", "items:linked.property.create", 'linkedProperties', method, item)
|
|
},
|
|
|
|
relationPropertyEdition (method, item) {
|
|
return this.object_edit("items:relation.property.edit", "items:relation.property.create", 'relationProperties', method, item)
|
|
},
|
|
|
|
async deleteLinkedProperty (item) {
|
|
await this.linkedPropertyEdition("delete", item)
|
|
this.$store.commit("linkedProperties/removeItem", item.id)
|
|
},
|
|
|
|
async createLinkedProperty (item) {
|
|
item.property = this.$route.params.id
|
|
const new_item = await this.linkedPropertyEdition("post", item)
|
|
this.$store.commit("linkedProperties/addItem", new_item)
|
|
},
|
|
|
|
async editLinkedProperty (item) {
|
|
item.property = this.$route.params.id
|
|
const new_item = await this.linkedPropertyEdition("post", item)
|
|
this.$store.commit("linkedProperties/editItem", new_item)
|
|
},
|
|
|
|
async deleteRelationProperty (item) {
|
|
await this.relationPropertyEdition("delete", item)
|
|
this.$store.commit("relationProperties/removeItem", item.id)
|
|
},
|
|
|
|
async createRelationProperty (item) {
|
|
item.property = this.$route.params.id
|
|
const new_item = await this.relationPropertyEdition("post", item)
|
|
this.$store.commit("relationProperties/addItem", new_item)
|
|
},
|
|
|
|
async editRelationProperty (item) {
|
|
item.property = this.$route.params.id
|
|
const new_item = await this.relationPropertyEdition("post", item)
|
|
this.$store.commit("relationProperties/editItem", new_item)
|
|
},
|
|
}
|
|
},
|