|
|
@ -68,11 +68,11 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
<script lang="ts">
|
|
|
|
import { Modal } from "bootstrap"
|
|
|
|
import { Modal } from "bootstrap";
|
|
|
|
import { ucfirst } from "../util.ts"
|
|
|
|
import { ucfirst } from "../util.ts";
|
|
|
|
|
|
|
|
|
|
|
|
import Confirm from "./Confirm.vue";
|
|
|
|
import Confirm from "./Confirm.vue";
|
|
|
|
import NotificationFormList from "./notifications"
|
|
|
|
import NotificationFormList from "./notifications";
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
components: {
|
|
|
@ -93,15 +93,15 @@ export default {
|
|
|
|
isDefault: false,
|
|
|
|
isDefault: false,
|
|
|
|
// Do not set default value here, please scroll to show()
|
|
|
|
// Do not set default value here, please scroll to show()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
computed: {
|
|
|
|
currentForm() {
|
|
|
|
currentForm() {
|
|
|
|
if (!this.notification.type) {
|
|
|
|
if (!this.notification.type) {
|
|
|
|
return null
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NotificationFormList[this.notification.type]
|
|
|
|
return NotificationFormList[this.notification.type];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
@ -120,13 +120,13 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
mounted() {
|
|
|
|
this.modal = new Modal(this.$refs.modal)
|
|
|
|
this.modal = new Modal(this.$refs.modal);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
|
|
|
|
deleteConfirm() {
|
|
|
|
deleteConfirm() {
|
|
|
|
this.modal.hide();
|
|
|
|
this.modal.hide();
|
|
|
|
this.$refs.confirmDelete.show()
|
|
|
|
this.$refs.confirmDelete.show();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
show(notificationID) {
|
|
|
|
show(notificationID) {
|
|
|
@ -145,19 +145,19 @@ export default {
|
|
|
|
name: "",
|
|
|
|
name: "",
|
|
|
|
type: null,
|
|
|
|
type: null,
|
|
|
|
isDefault: false,
|
|
|
|
isDefault: false,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Set Default value here
|
|
|
|
// Set Default value here
|
|
|
|
this.notification.type = this.notificationTypes[0];
|
|
|
|
this.notification.type = this.notificationTypes[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.modal.show()
|
|
|
|
this.modal.show();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
submit() {
|
|
|
|
submit() {
|
|
|
|
this.processing = true;
|
|
|
|
this.processing = true;
|
|
|
|
this.$root.getSocket().emit("addNotification", this.notification, this.id, (res) => {
|
|
|
|
this.$root.getSocket().emit("addNotification", this.notification, this.id, (res) => {
|
|
|
|
this.$root.toastRes(res)
|
|
|
|
this.$root.toastRes(res);
|
|
|
|
this.processing = false;
|
|
|
|
this.processing = false;
|
|
|
|
|
|
|
|
|
|
|
|
if (res.ok) {
|
|
|
|
if (res.ok) {
|
|
|
@ -169,45 +169,45 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
test() {
|
|
|
|
test() {
|
|
|
|
this.processing = true;
|
|
|
|
this.processing = true;
|
|
|
|
this.$root.getSocket().emit("testNotification", this.notification, (res) => {
|
|
|
|
this.$root.getSocket().emit("testNotification", this.notification, (res) => {
|
|
|
|
this.$root.toastRes(res)
|
|
|
|
this.$root.toastRes(res);
|
|
|
|
this.processing = false;
|
|
|
|
this.processing = false;
|
|
|
|
})
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
deleteNotification() {
|
|
|
|
deleteNotification() {
|
|
|
|
this.processing = true;
|
|
|
|
this.processing = true;
|
|
|
|
this.$root.getSocket().emit("deleteNotification", this.id, (res) => {
|
|
|
|
this.$root.getSocket().emit("deleteNotification", this.id, (res) => {
|
|
|
|
this.$root.toastRes(res)
|
|
|
|
this.$root.toastRes(res);
|
|
|
|
this.processing = false;
|
|
|
|
this.processing = false;
|
|
|
|
|
|
|
|
|
|
|
|
if (res.ok) {
|
|
|
|
if (res.ok) {
|
|
|
|
this.modal.hide()
|
|
|
|
this.modal.hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @param {keyof NotificationFormList} notificationKey
|
|
|
|
* @param {keyof NotificationFormList} notificationKey
|
|
|
|
* @return {string}
|
|
|
|
* @return {string}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
getUniqueDefaultName(notificationKey) {
|
|
|
|
getUniqueDefaultName(notificationKey) {
|
|
|
|
let index = 1
|
|
|
|
let index = 1;
|
|
|
|
let name = ""
|
|
|
|
let name = "";
|
|
|
|
do {
|
|
|
|
do {
|
|
|
|
name = this.$t("defaultNotificationName", [
|
|
|
|
name = this.$t("defaultNotificationName", {
|
|
|
|
this.$t(notificationKey).replace(/\(.+\)/, "").trim(),
|
|
|
|
notification: this.$t(notificationKey).replace(/\(.+\)/, "").trim(),
|
|
|
|
index++
|
|
|
|
number: index++
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
} while (this.$root.notificationList.find(it => it.name === name))
|
|
|
|
} while (this.$root.notificationList.find(it => it.name === name));
|
|
|
|
return name
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|