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