41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
PropertyView = {
|
|
template: "#PropertyView",
|
|
router_path: "/PropertyView",
|
|
delimiters: ["[[", "]]"],
|
|
props: [],
|
|
|
|
computed: {
|
|
...Vuex.mapState({
|
|
properties: state => state.properties.items,
|
|
properties_headers: state => state.properties.headers,
|
|
}),
|
|
|
|
properties_relations: function() {
|
|
return this.properties_headers.filter(e => e.choices != null)
|
|
},
|
|
},
|
|
|
|
methods: {
|
|
|
|
property_edition (method, item) {
|
|
return this.object_edit("items:property.edit", "items:property.create", "properties", method, item)
|
|
},
|
|
|
|
async createItem (item) {
|
|
const new_item = await this.property_edition("post", item)
|
|
this.$store.commit("properties/addItem", new_item)
|
|
},
|
|
|
|
async editItem (item) {
|
|
const new_item = await this.property_edition("post", item)
|
|
this.$store.commit("properties/editItem", new_item)
|
|
},
|
|
|
|
async deleteItem (item) {
|
|
await this.property_edition("delete", item)
|
|
this.$store.commit("properties/removeItem", item.id)
|
|
},
|
|
|
|
},
|
|
}
|