+
+
+ |
0
+ },
times() {
return Array.from(
{
@@ -1076,6 +1234,12 @@ export default {
if (this.editedItem.active) this.changeState(this.editedItem)
else this.active_dialog = true
},
+ deactivateBulk() {
+ this.deactivateBulkDialog = true
+ },
+ activateBulk() {
+ this.changeBulkState({active:true})
+ },
editItem(item) {
this.editedId = item.id
this.editedItem = Object.assign({}, item)
@@ -1108,6 +1272,12 @@ export default {
this.editedId = null
}, 300)
},
+ closeBulkActive() {
+ this.deactivateBulkDialog = false
+ setTimeout(() => {
+ this.bulkDeactivateItem = Object.assign({}, this.bulkDeactivateDefaultItem)
+ }, 300)
+ },
validate() {
if (this.$refs.form.validate()) {
this.$refs.form.resetValidation()
@@ -1127,6 +1297,26 @@ export default {
])
this.close_active()
},
+ changeBulkState(item) {
+ this.selected.map(a => {
+ this.$store
+ .dispatch('notificationRules/updateNotificationRule', [
+ a.id,
+ {
+ active: item.active,
+ reactivate: this.bulkDeactivateItem.reactivateDate ? this.toISODate(
+ this.bulkDeactivateItem.reactivateDate,
+ this.bulkDeactivateItem.reactivateTime
+ ) : null
+ }
+ ])
+ })
+ this.clearSelected()
+ this.closeBulkActive()
+ },
+ clearSelected() {
+ this.$store.dispatch('notificationRules/updateSelected', [])
+ },
refresh_all() {
this.$store.dispatch('set', ['refresh', true])
setTimeout(() => {
@@ -1209,4 +1399,8 @@ export default {
}
-
+
diff --git a/src/store/modules/notificationRule.store.ts b/src/store/modules/notificationRule.store.ts
index 9de5e1cb..0a16b968 100644
--- a/src/store/modules/notificationRule.store.ts
+++ b/src/store/modules/notificationRule.store.ts
@@ -6,6 +6,7 @@ const state = {
isLoading: false,
notification_rules: [],
+ selected: [],
query: {},
@@ -31,6 +32,9 @@ const mutations = {
state.pagination.totalItems = total
state.pagination.rowsPerPage = pageSize
},
+ SET_SELECTED(state, selected) {
+ state.selected = selected
+ },
RESET_LOADING(state) {
state.isLoading = false
},
@@ -62,6 +66,9 @@ const actions = {
dispatch('getNotificationRules')
})
},
+ updateSelected({commit}, selected) {
+ commit('SET_SELECTED', selected)
+ },
updateNotificationRule({dispatch, commit}, [notificationRuleId, update]) {
return NotificationRuleApi.updateNotificationRule(notificationRuleId, update).then(response => {
dispatch('getNotificationRules')
|