This commit is contained in:
j3d1 2024-06-08 20:30:56 +02:00
parent 33a7423fef
commit b08f9a7127

View file

@ -1,7 +1,7 @@
<template> <template>
<h3 class="text-center">Message Templates</h3> <h3 class="text-center">Message Templates</h3>
<ul> <ul>
<li v-for="template in messageTemplates" :key="template.id"> <li v-for="template in messageTemplatesIntermediate" :key="template.id">
<b>{{ template.name }}</b><br> <b>{{ template.name }}</b><br>
<FormatedText :value="template.message" :format="formatText" class="template-message" <FormatedText :value="template.message" :format="formatText" class="template-message"
@input="changeMessageTemplate(template.id, $event)"/> @input="changeMessageTemplate(template.id, $event)"/>
@ -20,6 +20,9 @@
{{ variable }} {{ variable }}
</span> </span>
</p> </p>
<hr>
{{ messageTemplates }}
<hr>
{{messageTemplatesIntermediate}} {{messageTemplatesIntermediate}}
</template> </template>
@ -46,7 +49,7 @@ export default {
}, },
changeMessageTemplate(id, message) { changeMessageTemplate(id, message) {
console.log(id, message); console.log(id, message);
this.messageTemplates.forEach(template => { this.messageTemplatesIntermediate.forEach(template => {
if (template.id === id) { if (template.id === id) {
template.message = message; template.message = message;
} }
@ -61,7 +64,7 @@ export default {
}, },
mounted() { mounted() {
this.fetchMessageTemplates().then(() => { this.fetchMessageTemplates().then(() => {
this.messageTemplatesIntermediate = this.messageTemplates; this.messageTemplatesIntermediate = [...this.messageTemplates];
}); });
this.fetchMessageTemplateVariables(); this.fetchMessageTemplateVariables();
}, },