diff --git a/resources/js/components/Category/Editable.vue b/resources/js/components/Category/Editable.vue index 7de8d4e..49b251c 100644 --- a/resources/js/components/Category/Editable.vue +++ b/resources/js/components/Category/Editable.vue @@ -25,6 +25,9 @@ v-show="!originalId && isDirty()" > + @@ -121,6 +124,12 @@ export default { (cat) => parseInt(cat.value) === this.originalId, ).text; }, + emitDeleteCategory() { + if (!confirm('Are you sure you want to delete this category?')) { + return; + } + this.$emit('delete-category', this.categoryId, this.categoryIndex); + }, isDirty() { if (!this.selectedId) { return !!this.categoryId; diff --git a/resources/js/components/Concept/Default.vue b/resources/js/components/Concept/Default.vue index 4a39c66..dcdf588 100644 --- a/resources/js/components/Concept/Default.vue +++ b/resources/js/components/Concept/Default.vue @@ -129,6 +129,7 @@ :is-primary="0 === index" :selected-categories="selectedCategories" @save-category="saveCategory" + @delete-category="deleteCategory" @change="flagDirty" >

diff --git a/resources/js/components/Concept/mixins/Category.js b/resources/js/components/Concept/mixins/Category.js index 9bf181f..822a598 100644 --- a/resources/js/components/Concept/mixins/Category.js +++ b/resources/js/components/Concept/mixins/Category.js @@ -61,6 +61,11 @@ export default { this.cleanDirty({ id: categoryId }); + this.updateCategories().then(); + }, + deleteCategory(categoryId, index) { + this.cats.splice(index, 1); + this.updateCategories().then(); }, },