vue-intergrall-plugins 1.1.90 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +220 -220
- package/dist/dist/vue-intergrall-plugins.css +1 -1
- package/dist/vue-intergrall-plugins.esm.js +193 -78
- package/dist/vue-intergrall-plugins.min.js +7 -7
- package/dist/vue-intergrall-plugins.ssr.js +245 -136
- package/package.json +61 -61
- package/src/lib-components/Buttons/IconButton.vue +27 -27
- package/src/lib-components/Buttons/SimpleButton.vue +140 -140
- package/src/lib-components/Cards/Card.vue +490 -490
- package/src/lib-components/Cards/CardCheck.vue +35 -35
- package/src/lib-components/Cards/CardFile.vue +163 -163
- package/src/lib-components/Chat/BtnDownloadAllFiles.vue +36 -36
- package/src/lib-components/Chat/BtnEmojis.vue +118 -118
- package/src/lib-components/Chat/BtnExpand.vue +17 -17
- package/src/lib-components/Chat/BtnFiles.vue +486 -486
- package/src/lib-components/Chat/BtnMic.vue +60 -60
- package/src/lib-components/Chat/BtnScreenShare.vue +31 -31
- package/src/lib-components/Chat/BtnStandardMessages.vue +17 -17
- package/src/lib-components/Chat/ExpandTextarea.vue +427 -427
- package/src/lib-components/Chat/MultipleFilePreview.vue +291 -291
- package/src/lib-components/Chat/Picker.vue +525 -525
- package/src/lib-components/Chat/RemainingCharacters.vue +28 -28
- package/src/lib-components/Chat/SingleFilePreview.vue +94 -94
- package/src/lib-components/Chat/SkeletonPicker.vue +110 -110
- package/src/lib-components/Chat/StandardMessages.vue +252 -252
- package/src/lib-components/Chat/TextFooter.vue +1007 -1007
- package/src/lib-components/Email/EmailExpanded.vue +270 -270
- package/src/lib-components/Email/EmailFile.vue +192 -192
- package/src/lib-components/Email/EmailFrom.vue +66 -66
- package/src/lib-components/Email/EmailItem.vue +867 -850
- package/src/lib-components/Email/EmailTo.vue +64 -64
- package/src/lib-components/Loader/Loader.vue +78 -78
- package/src/lib-components/Messages/AnexoMensagem.vue +534 -497
- package/src/lib-components/Messages/CardAttachment.vue +61 -61
- package/src/lib-components/Messages/CardMessages.vue +687 -687
- package/src/lib-components/Messages/InteratividadeBotoes.vue +197 -197
- package/src/lib-components/Messages/InteratividadeContato.vue +32 -32
- package/src/lib-components/Messages/InteratividadeContatoItem.vue +235 -235
- package/src/lib-components/Messages/InteratividadeFormulario.vue +334 -334
- package/src/lib-components/Messages/InteratividadePopup.vue +95 -95
- package/src/lib-components/Messages/LinkPreview.vue +176 -176
- package/src/lib-components/Scroll/ScrollContent.vue +166 -166
- package/src/lib-components/Templates/TemplateGenerator.vue +640 -640
- package/src/lib-components/Templates/TemplateMessage.vue +83 -83
- package/src/lib-components/Templates/TemplateSingle.vue +478 -478
|
@@ -1,252 +1,252 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="text-footer-hsm-container" v-if="hasStandardMessages">
|
|
3
|
-
<div class="transition-selects">
|
|
4
|
-
<transition name="fade" mode="out-in">
|
|
5
|
-
<div v-if="formatted_messages_2.length && key_1">
|
|
6
|
-
<v-select :style="`background-color: ${backgroundColor}`" appendToBody
|
|
7
|
-
:calculatePosition="calculateSelectPosition" class="text-footer-v-select" :options="formatted_messages_2"
|
|
8
|
-
label="value" v-model="key_2" :reduce="formatted_messages_2 => formatted_messages_2.cod"
|
|
9
|
-
@input="inputSelectKey2">
|
|
10
|
-
<div slot="no-options"> {{ dictionary.msg_sem_resultados }} </div>
|
|
11
|
-
</v-select>
|
|
12
|
-
</div>
|
|
13
|
-
<div class="loader-select" v-else-if="key_1 && loadingReq">
|
|
14
|
-
<VueLoader />
|
|
15
|
-
</div>
|
|
16
|
-
</transition>
|
|
17
|
-
<transition name="fade" mode="out-in">
|
|
18
|
-
<div class="text-footer-select-03"
|
|
19
|
-
v-if="formatted_messages_3.length && key_2 && formatted_messages_2.length && key_1">
|
|
20
|
-
<v-select :style="`background-color: ${backgroundColor}`" appendToBody
|
|
21
|
-
:calculatePosition="calculateSelectPosition" class="text-footer-v-select" :options="formatted_messages_3"
|
|
22
|
-
:reduce="formatted_messages_3 => formatted_messages_3.cod" label="value" :clearable="false"
|
|
23
|
-
@input="openMsg()" v-model="key_3">
|
|
24
|
-
<div slot="no-options"> {{ dictionary.msg_sem_resultados }} </div>
|
|
25
|
-
</v-select>
|
|
26
|
-
</div>
|
|
27
|
-
<div class="loader-select" v-else-if="key_2 && loadingReq">
|
|
28
|
-
<VueLoader />
|
|
29
|
-
</div>
|
|
30
|
-
</transition>
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
</template>
|
|
34
|
-
|
|
35
|
-
<style>
|
|
36
|
-
.transition-selects {
|
|
37
|
-
min-height: 80px;
|
|
38
|
-
display: flex;
|
|
39
|
-
flex-direction: column;
|
|
40
|
-
width: 100%;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.loader-select {
|
|
44
|
-
position: relative;
|
|
45
|
-
min-height: 35px;
|
|
46
|
-
background: #FFF;
|
|
47
|
-
width: 100%;
|
|
48
|
-
border: 1px solid #ccc;
|
|
49
|
-
border-radius: 5px;
|
|
50
|
-
z-index: 1;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.loading-message {
|
|
54
|
-
background-color: #555 !important;
|
|
55
|
-
}
|
|
56
|
-
</style>
|
|
57
|
-
|
|
58
|
-
<script>
|
|
59
|
-
|
|
60
|
-
import { createPopper } from "@popperjs/core"
|
|
61
|
-
import { standardMessages } from "../../services/standardMessages"
|
|
62
|
-
|
|
63
|
-
export default {
|
|
64
|
-
mixins: [standardMessages],
|
|
65
|
-
props: {
|
|
66
|
-
hasStandardMessages: {
|
|
67
|
-
type: Boolean,
|
|
68
|
-
default: false
|
|
69
|
-
},
|
|
70
|
-
dictionary: {
|
|
71
|
-
type: Object,
|
|
72
|
-
default: {},
|
|
73
|
-
required: false
|
|
74
|
-
},
|
|
75
|
-
backgroundColor: {
|
|
76
|
-
type: String,
|
|
77
|
-
default: '#fff',
|
|
78
|
-
required: false
|
|
79
|
-
},
|
|
80
|
-
token_cliente: {
|
|
81
|
-
type: String,
|
|
82
|
-
default: '',
|
|
83
|
-
required: false
|
|
84
|
-
},
|
|
85
|
-
message: {
|
|
86
|
-
type: String,
|
|
87
|
-
default: '',
|
|
88
|
-
required: false
|
|
89
|
-
},
|
|
90
|
-
messageType: {
|
|
91
|
-
type: [Number, String],
|
|
92
|
-
default: 1,
|
|
93
|
-
required: false
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
data() {
|
|
97
|
-
return {
|
|
98
|
-
placement: "top",
|
|
99
|
-
formatted_messages_1: [{ cod: "T", value: "Todos" }],
|
|
100
|
-
key_1: "T",
|
|
101
|
-
formatted_messages_2: [],
|
|
102
|
-
key_2: "",
|
|
103
|
-
formatted_messages_3: [],
|
|
104
|
-
key_3: "",
|
|
105
|
-
loadingReq: true
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
mounted() {
|
|
109
|
-
this.receiveValueFormattedMessage(this.key_1, 2)
|
|
110
|
-
},
|
|
111
|
-
methods: {
|
|
112
|
-
calculateSelectPosition(dropdownList, component, sizes) {
|
|
113
|
-
dropdownList.style.width = sizes.width
|
|
114
|
-
const popper = createPopper(component.$refs.toggle, dropdownList, {
|
|
115
|
-
placement: this.placement
|
|
116
|
-
})
|
|
117
|
-
return () => popper.destroy()
|
|
118
|
-
},
|
|
119
|
-
inputSelectKey1() {
|
|
120
|
-
if (!this.key_1) {
|
|
121
|
-
if (this.formatted_messages_2.length) this.formatted_messages_2 = []
|
|
122
|
-
if (this.key_2) this.key_2 = ""
|
|
123
|
-
return
|
|
124
|
-
}
|
|
125
|
-
this.receiveValueFormattedMessage(this.key_1, 2)
|
|
126
|
-
},
|
|
127
|
-
inputSelectKey2() {
|
|
128
|
-
if (!this.key_2) {
|
|
129
|
-
if (this.formatted_messages_3.length) this.formatted_messages_3 = []
|
|
130
|
-
if (this.key_3) this.key_3 = ""
|
|
131
|
-
return
|
|
132
|
-
}
|
|
133
|
-
if (this.formatted_messages_3.length) this.formatted_messages_3 = []
|
|
134
|
-
if (this.key_3) this.key_3 = ""
|
|
135
|
-
this.receiveValueFormattedMessage(`T/${this.key_2}`, 3)
|
|
136
|
-
},
|
|
137
|
-
receiveValueFormattedMessage(cod, selectionIndex) {
|
|
138
|
-
try {
|
|
139
|
-
if (!this.token_cliente) throw new Error("Informe token_cliente como chave na propriedade formattedMessageSettings que ocorre na chamada componente TextFooter ")
|
|
140
|
-
this.loadingReq = true
|
|
141
|
-
this.getStandardMessages(cod, this.token_cliente).then((data) => {
|
|
142
|
-
this.loadingReq = false
|
|
143
|
-
if (data) {
|
|
144
|
-
if (data.msg_ret) {
|
|
145
|
-
if (data.error) throw new Error(data.msg_ret)
|
|
146
|
-
if (selectionIndex == 2) {
|
|
147
|
-
this.$toasted.global.defaultInfo({ msg: data.msg_ret })
|
|
148
|
-
this.$emit("close-blocker-standard-message")
|
|
149
|
-
return this.closeStandardMessages()
|
|
150
|
-
}
|
|
151
|
-
return this.$toasted.global.defaultInfo({ msg: data.msg_ret })
|
|
152
|
-
}
|
|
153
|
-
return this.showFormattedMessage(data, selectionIndex)
|
|
154
|
-
}
|
|
155
|
-
this.$toasted.global.defaultError({ msg: data && data.msg_ret ? data.msg_ret : 'Problema com as mensagens formatadas. Contate o suporte.' })
|
|
156
|
-
this.$emit("error-standard-message")
|
|
157
|
-
this.closeStandardMessages()
|
|
158
|
-
this.loadingReq = false
|
|
159
|
-
}).catch(e => {
|
|
160
|
-
this.loadingReq = false
|
|
161
|
-
this.$toasted.global.defaultError({ msg: e && e.message ? e.message : e })
|
|
162
|
-
this.closeStandardMessages()
|
|
163
|
-
this.$emit("error-standard-message")
|
|
164
|
-
console.error("Error in getStandardMessages: ", e)
|
|
165
|
-
})
|
|
166
|
-
} catch (e) {
|
|
167
|
-
this.loadingReq = false
|
|
168
|
-
console.error("Error in receiveValueFormattedMessage: ", e)
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
showFormattedMessage(messageData, selectionIndex) {
|
|
172
|
-
try {
|
|
173
|
-
let success = false
|
|
174
|
-
if (Array.isArray(messageData)) success = true
|
|
175
|
-
if (!success && selectionIndex != 4) this.$toasted.global.defaultInfo({ msg: messageData ? messageData.msg : "Nao foi possível obter mensagens" })
|
|
176
|
-
|
|
177
|
-
switch (selectionIndex) {
|
|
178
|
-
case 2:
|
|
179
|
-
if (!success) {
|
|
180
|
-
this.formatted_messages_2.push(messageData)
|
|
181
|
-
this.key_2 = this.formatted_messages_2[0]
|
|
182
|
-
} else {
|
|
183
|
-
this.formatted_messages_2 = messageData
|
|
184
|
-
if (this.formatted_messages_2.length == 1) {
|
|
185
|
-
if (this.formatted_messages_2[0].cod) {
|
|
186
|
-
this.key_2 = this.formatted_messages_2[0].cod
|
|
187
|
-
this.receiveValueFormattedMessage(`T/${this.key_2}`, 3)
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
break
|
|
192
|
-
case 3:
|
|
193
|
-
if (!success) {
|
|
194
|
-
this.formatted_messages_3.push(messageData)
|
|
195
|
-
this.$toasted.global.defaultInfo({ msg: this.dictionary.msg_erro_sem_msg_formatada })
|
|
196
|
-
this.$emit("close-blocker-standard-message")
|
|
197
|
-
} else {
|
|
198
|
-
if (messageData.length) {
|
|
199
|
-
this.formatted_messages_3 = messageData
|
|
200
|
-
if (this.formatted_messages_3.length == 1 && this.formatted_messages_3[0].cod) {
|
|
201
|
-
this.key_3 = this.formatted_messages_3[0].cod
|
|
202
|
-
this.openMsg()
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
break
|
|
207
|
-
case 4:
|
|
208
|
-
const finalMessage = `${this.message}${this.message && !this.message.endsWith(" ") ? ` ${messageData}` : messageData}`
|
|
209
|
-
this.$emit("add-standard-message", finalMessage)
|
|
210
|
-
this.$parent.focusTextarea()
|
|
211
|
-
// return this.closeStandardMessages()
|
|
212
|
-
break
|
|
213
|
-
default:
|
|
214
|
-
console.error("Error in showFormattedMessage: selectionIndex not found")
|
|
215
|
-
break
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
} catch (e) {
|
|
219
|
-
console.error("Error in showFormattedMessage: ", e)
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
closeStandardMessages() {
|
|
223
|
-
this.$emit("close-standard-messages")
|
|
224
|
-
},
|
|
225
|
-
openMsg() {
|
|
226
|
-
try {
|
|
227
|
-
this.messageType == 1 ? this.insertFormattedMessage(this.key_3) : this.openFormattedMsgType2(this.key_3)
|
|
228
|
-
} catch (e) {
|
|
229
|
-
console.error("Error in openMsg: ", e)
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
openFormattedMsgType2(key) {
|
|
233
|
-
try {
|
|
234
|
-
if (!key || !this.key_2) return
|
|
235
|
-
this.$emit("open-blocker-standard-message")
|
|
236
|
-
key = key.cod
|
|
237
|
-
this.$emit("set-standard-infos", { category: this.key_2, subject: key })
|
|
238
|
-
} catch (e) {
|
|
239
|
-
console.error("Error in openFormattedMsgType2: ", e)
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
insertFormattedMessage() {
|
|
243
|
-
try {
|
|
244
|
-
if (!this.key_3) return this.$toasted.global.defaultError({ msg: 'Selecione uma mensagem' })
|
|
245
|
-
this.receiveValueFormattedMessage(`T/${this.key_2}/${this.key_3}`, 4)
|
|
246
|
-
} catch (e) {
|
|
247
|
-
console.error("Erro ao inserir mensagem formatada: ", e)
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="text-footer-hsm-container" v-if="hasStandardMessages">
|
|
3
|
+
<div class="transition-selects">
|
|
4
|
+
<transition name="fade" mode="out-in">
|
|
5
|
+
<div v-if="formatted_messages_2.length && key_1">
|
|
6
|
+
<v-select :style="`background-color: ${backgroundColor}`" appendToBody
|
|
7
|
+
:calculatePosition="calculateSelectPosition" class="text-footer-v-select" :options="formatted_messages_2"
|
|
8
|
+
label="value" v-model="key_2" :reduce="formatted_messages_2 => formatted_messages_2.cod"
|
|
9
|
+
@input="inputSelectKey2">
|
|
10
|
+
<div slot="no-options"> {{ dictionary.msg_sem_resultados }} </div>
|
|
11
|
+
</v-select>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="loader-select" v-else-if="key_1 && loadingReq">
|
|
14
|
+
<VueLoader />
|
|
15
|
+
</div>
|
|
16
|
+
</transition>
|
|
17
|
+
<transition name="fade" mode="out-in">
|
|
18
|
+
<div class="text-footer-select-03"
|
|
19
|
+
v-if="formatted_messages_3.length && key_2 && formatted_messages_2.length && key_1">
|
|
20
|
+
<v-select :style="`background-color: ${backgroundColor}`" appendToBody
|
|
21
|
+
:calculatePosition="calculateSelectPosition" class="text-footer-v-select" :options="formatted_messages_3"
|
|
22
|
+
:reduce="formatted_messages_3 => formatted_messages_3.cod" label="value" :clearable="false"
|
|
23
|
+
@input="openMsg()" v-model="key_3">
|
|
24
|
+
<div slot="no-options"> {{ dictionary.msg_sem_resultados }} </div>
|
|
25
|
+
</v-select>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="loader-select" v-else-if="key_2 && loadingReq">
|
|
28
|
+
<VueLoader />
|
|
29
|
+
</div>
|
|
30
|
+
</transition>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
.transition-selects {
|
|
37
|
+
min-height: 80px;
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
width: 100%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.loader-select {
|
|
44
|
+
position: relative;
|
|
45
|
+
min-height: 35px;
|
|
46
|
+
background: #FFF;
|
|
47
|
+
width: 100%;
|
|
48
|
+
border: 1px solid #ccc;
|
|
49
|
+
border-radius: 5px;
|
|
50
|
+
z-index: 1;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.loading-message {
|
|
54
|
+
background-color: #555 !important;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
57
|
+
|
|
58
|
+
<script>
|
|
59
|
+
|
|
60
|
+
import { createPopper } from "@popperjs/core"
|
|
61
|
+
import { standardMessages } from "../../services/standardMessages"
|
|
62
|
+
|
|
63
|
+
export default {
|
|
64
|
+
mixins: [standardMessages],
|
|
65
|
+
props: {
|
|
66
|
+
hasStandardMessages: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: false
|
|
69
|
+
},
|
|
70
|
+
dictionary: {
|
|
71
|
+
type: Object,
|
|
72
|
+
default: {},
|
|
73
|
+
required: false
|
|
74
|
+
},
|
|
75
|
+
backgroundColor: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: '#fff',
|
|
78
|
+
required: false
|
|
79
|
+
},
|
|
80
|
+
token_cliente: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: '',
|
|
83
|
+
required: false
|
|
84
|
+
},
|
|
85
|
+
message: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: '',
|
|
88
|
+
required: false
|
|
89
|
+
},
|
|
90
|
+
messageType: {
|
|
91
|
+
type: [Number, String],
|
|
92
|
+
default: 1,
|
|
93
|
+
required: false
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
data() {
|
|
97
|
+
return {
|
|
98
|
+
placement: "top",
|
|
99
|
+
formatted_messages_1: [{ cod: "T", value: "Todos" }],
|
|
100
|
+
key_1: "T",
|
|
101
|
+
formatted_messages_2: [],
|
|
102
|
+
key_2: "",
|
|
103
|
+
formatted_messages_3: [],
|
|
104
|
+
key_3: "",
|
|
105
|
+
loadingReq: true
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
mounted() {
|
|
109
|
+
this.receiveValueFormattedMessage(this.key_1, 2)
|
|
110
|
+
},
|
|
111
|
+
methods: {
|
|
112
|
+
calculateSelectPosition(dropdownList, component, sizes) {
|
|
113
|
+
dropdownList.style.width = sizes.width
|
|
114
|
+
const popper = createPopper(component.$refs.toggle, dropdownList, {
|
|
115
|
+
placement: this.placement
|
|
116
|
+
})
|
|
117
|
+
return () => popper.destroy()
|
|
118
|
+
},
|
|
119
|
+
inputSelectKey1() {
|
|
120
|
+
if (!this.key_1) {
|
|
121
|
+
if (this.formatted_messages_2.length) this.formatted_messages_2 = []
|
|
122
|
+
if (this.key_2) this.key_2 = ""
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
this.receiveValueFormattedMessage(this.key_1, 2)
|
|
126
|
+
},
|
|
127
|
+
inputSelectKey2() {
|
|
128
|
+
if (!this.key_2) {
|
|
129
|
+
if (this.formatted_messages_3.length) this.formatted_messages_3 = []
|
|
130
|
+
if (this.key_3) this.key_3 = ""
|
|
131
|
+
return
|
|
132
|
+
}
|
|
133
|
+
if (this.formatted_messages_3.length) this.formatted_messages_3 = []
|
|
134
|
+
if (this.key_3) this.key_3 = ""
|
|
135
|
+
this.receiveValueFormattedMessage(`T/${this.key_2}`, 3)
|
|
136
|
+
},
|
|
137
|
+
receiveValueFormattedMessage(cod, selectionIndex) {
|
|
138
|
+
try {
|
|
139
|
+
if (!this.token_cliente) throw new Error("Informe token_cliente como chave na propriedade formattedMessageSettings que ocorre na chamada componente TextFooter ")
|
|
140
|
+
this.loadingReq = true
|
|
141
|
+
this.getStandardMessages(cod, this.token_cliente).then((data) => {
|
|
142
|
+
this.loadingReq = false
|
|
143
|
+
if (data) {
|
|
144
|
+
if (data.msg_ret) {
|
|
145
|
+
if (data.error) throw new Error(data.msg_ret)
|
|
146
|
+
if (selectionIndex == 2) {
|
|
147
|
+
this.$toasted.global.defaultInfo({ msg: data.msg_ret })
|
|
148
|
+
this.$emit("close-blocker-standard-message")
|
|
149
|
+
return this.closeStandardMessages()
|
|
150
|
+
}
|
|
151
|
+
return this.$toasted.global.defaultInfo({ msg: data.msg_ret })
|
|
152
|
+
}
|
|
153
|
+
return this.showFormattedMessage(data, selectionIndex)
|
|
154
|
+
}
|
|
155
|
+
this.$toasted.global.defaultError({ msg: data && data.msg_ret ? data.msg_ret : 'Problema com as mensagens formatadas. Contate o suporte.' })
|
|
156
|
+
this.$emit("error-standard-message")
|
|
157
|
+
this.closeStandardMessages()
|
|
158
|
+
this.loadingReq = false
|
|
159
|
+
}).catch(e => {
|
|
160
|
+
this.loadingReq = false
|
|
161
|
+
this.$toasted.global.defaultError({ msg: e && e.message ? e.message : e })
|
|
162
|
+
this.closeStandardMessages()
|
|
163
|
+
this.$emit("error-standard-message")
|
|
164
|
+
console.error("Error in getStandardMessages: ", e)
|
|
165
|
+
})
|
|
166
|
+
} catch (e) {
|
|
167
|
+
this.loadingReq = false
|
|
168
|
+
console.error("Error in receiveValueFormattedMessage: ", e)
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
showFormattedMessage(messageData, selectionIndex) {
|
|
172
|
+
try {
|
|
173
|
+
let success = false
|
|
174
|
+
if (Array.isArray(messageData)) success = true
|
|
175
|
+
if (!success && selectionIndex != 4) this.$toasted.global.defaultInfo({ msg: messageData ? messageData.msg : "Nao foi possível obter mensagens" })
|
|
176
|
+
|
|
177
|
+
switch (selectionIndex) {
|
|
178
|
+
case 2:
|
|
179
|
+
if (!success) {
|
|
180
|
+
this.formatted_messages_2.push(messageData)
|
|
181
|
+
this.key_2 = this.formatted_messages_2[0]
|
|
182
|
+
} else {
|
|
183
|
+
this.formatted_messages_2 = messageData
|
|
184
|
+
if (this.formatted_messages_2.length == 1) {
|
|
185
|
+
if (this.formatted_messages_2[0].cod) {
|
|
186
|
+
this.key_2 = this.formatted_messages_2[0].cod
|
|
187
|
+
this.receiveValueFormattedMessage(`T/${this.key_2}`, 3)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
break
|
|
192
|
+
case 3:
|
|
193
|
+
if (!success) {
|
|
194
|
+
this.formatted_messages_3.push(messageData)
|
|
195
|
+
this.$toasted.global.defaultInfo({ msg: this.dictionary.msg_erro_sem_msg_formatada })
|
|
196
|
+
this.$emit("close-blocker-standard-message")
|
|
197
|
+
} else {
|
|
198
|
+
if (messageData.length) {
|
|
199
|
+
this.formatted_messages_3 = messageData
|
|
200
|
+
if (this.formatted_messages_3.length == 1 && this.formatted_messages_3[0].cod) {
|
|
201
|
+
this.key_3 = this.formatted_messages_3[0].cod
|
|
202
|
+
this.openMsg()
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
break
|
|
207
|
+
case 4:
|
|
208
|
+
const finalMessage = `${this.message}${this.message && !this.message.endsWith(" ") ? ` ${messageData}` : messageData}`
|
|
209
|
+
this.$emit("add-standard-message", finalMessage)
|
|
210
|
+
this.$parent.focusTextarea()
|
|
211
|
+
// return this.closeStandardMessages()
|
|
212
|
+
break
|
|
213
|
+
default:
|
|
214
|
+
console.error("Error in showFormattedMessage: selectionIndex not found")
|
|
215
|
+
break
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
} catch (e) {
|
|
219
|
+
console.error("Error in showFormattedMessage: ", e)
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
closeStandardMessages() {
|
|
223
|
+
this.$emit("close-standard-messages")
|
|
224
|
+
},
|
|
225
|
+
openMsg() {
|
|
226
|
+
try {
|
|
227
|
+
this.messageType == 1 ? this.insertFormattedMessage(this.key_3) : this.openFormattedMsgType2(this.key_3)
|
|
228
|
+
} catch (e) {
|
|
229
|
+
console.error("Error in openMsg: ", e)
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
openFormattedMsgType2(key) {
|
|
233
|
+
try {
|
|
234
|
+
if (!key || !this.key_2) return
|
|
235
|
+
this.$emit("open-blocker-standard-message")
|
|
236
|
+
key = key.cod
|
|
237
|
+
this.$emit("set-standard-infos", { category: this.key_2, subject: key })
|
|
238
|
+
} catch (e) {
|
|
239
|
+
console.error("Error in openFormattedMsgType2: ", e)
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
insertFormattedMessage() {
|
|
243
|
+
try {
|
|
244
|
+
if (!this.key_3) return this.$toasted.global.defaultError({ msg: 'Selecione uma mensagem' })
|
|
245
|
+
this.receiveValueFormattedMessage(`T/${this.key_2}/${this.key_3}`, 4)
|
|
246
|
+
} catch (e) {
|
|
247
|
+
console.error("Erro ao inserir mensagem formatada: ", e)
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
</script>
|