This commit is contained in:
2022-03-08 01:03:06 +00:00
parent 34707ddcb6
commit 32dd15f70a

View File

@@ -252,15 +252,16 @@
></gz-tag-picker>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-col cols="12">
<v-text-field
ref="subject"
v-model="obj.subject"
:readonly="formState.readOnly"
:label="$ay.t('Subject')"
:label="$ay.t('EmailSubject')"
:rules="[form().required(this, 'subject')]"
:error-messages="form().serverErrors(this, 'subject')"
@input="fieldValueChanged('subject')"
@focus="currentTemplateField = 'subject'"
></v-text-field>
</v-col>
@@ -275,6 +276,7 @@
data-cy="template"
auto-grow
@input="fieldValueChanged('template')"
@focus="currentTemplateField = 'template'"
></v-textarea>
</v-col>
<v-col
@@ -535,7 +537,8 @@ export default {
whoList: [],
woToken: null,
quoteToken: null,
csrToken: null
csrToken: null,
currentTemplateField: null
};
},
computed: {
@@ -769,14 +772,34 @@ export default {
},
methods: {
insertToken(t) {
const bodyTextArea = this.$refs.template.$el.querySelector("textarea");
const start = bodyTextArea.selectionStart;
this.obj.template = window.$gz.util.stringSplice(
this.obj.template,
start,
0,
t
);
switch (this.currentTemplateField) {
case "template":
{
const bodyTextArea = this.$refs.template.$el.querySelector(
"textarea"
);
const start = bodyTextArea.selectionStart;
this.obj.template = window.$gz.util.stringSplice(
this.obj.template,
start,
0,
t
);
}
break;
case "subject":
{
const inputText = this.$refs.subject.$el.querySelector("input");
const start = inputText.selectionStart;
this.obj.subject = window.$gz.util.stringSplice(
this.obj.subject,
start,
0,
t
);
}
break;
}
},
objectTagsTitle() {
let objectName = null;
@@ -1143,7 +1166,8 @@ async function fetchTranslatedText() {
"QuoteSerialNumber",
"QuoteIntroduction",
"QuoteQuoteRequestDate",
"QuoteValidUntilDate"
"QuoteValidUntilDate",
"EmailSubject"
]);
}