vue-intergrall-plugins 1.1.89 → 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.
Files changed (45) hide show
  1. package/README.md +220 -220
  2. package/dist/dist/vue-intergrall-plugins.css +1 -1
  3. package/dist/vue-intergrall-plugins.esm.js +193 -78
  4. package/dist/vue-intergrall-plugins.min.js +7 -7
  5. package/dist/vue-intergrall-plugins.ssr.js +245 -136
  6. package/package.json +61 -61
  7. package/src/lib-components/Buttons/IconButton.vue +27 -27
  8. package/src/lib-components/Buttons/SimpleButton.vue +140 -140
  9. package/src/lib-components/Cards/Card.vue +490 -490
  10. package/src/lib-components/Cards/CardCheck.vue +35 -35
  11. package/src/lib-components/Cards/CardFile.vue +163 -163
  12. package/src/lib-components/Chat/BtnDownloadAllFiles.vue +36 -36
  13. package/src/lib-components/Chat/BtnEmojis.vue +118 -118
  14. package/src/lib-components/Chat/BtnExpand.vue +17 -17
  15. package/src/lib-components/Chat/BtnFiles.vue +486 -486
  16. package/src/lib-components/Chat/BtnMic.vue +60 -60
  17. package/src/lib-components/Chat/BtnScreenShare.vue +31 -31
  18. package/src/lib-components/Chat/BtnStandardMessages.vue +17 -17
  19. package/src/lib-components/Chat/ExpandTextarea.vue +427 -427
  20. package/src/lib-components/Chat/MultipleFilePreview.vue +291 -291
  21. package/src/lib-components/Chat/Picker.vue +525 -525
  22. package/src/lib-components/Chat/RemainingCharacters.vue +28 -28
  23. package/src/lib-components/Chat/SingleFilePreview.vue +94 -94
  24. package/src/lib-components/Chat/SkeletonPicker.vue +110 -110
  25. package/src/lib-components/Chat/StandardMessages.vue +252 -252
  26. package/src/lib-components/Chat/TextFooter.vue +1007 -1007
  27. package/src/lib-components/Email/EmailExpanded.vue +270 -270
  28. package/src/lib-components/Email/EmailFile.vue +192 -192
  29. package/src/lib-components/Email/EmailFrom.vue +66 -66
  30. package/src/lib-components/Email/EmailItem.vue +867 -850
  31. package/src/lib-components/Email/EmailTo.vue +64 -64
  32. package/src/lib-components/Loader/Loader.vue +78 -78
  33. package/src/lib-components/Messages/AnexoMensagem.vue +534 -497
  34. package/src/lib-components/Messages/CardAttachment.vue +61 -61
  35. package/src/lib-components/Messages/CardMessages.vue +687 -687
  36. package/src/lib-components/Messages/InteratividadeBotoes.vue +197 -197
  37. package/src/lib-components/Messages/InteratividadeContato.vue +32 -32
  38. package/src/lib-components/Messages/InteratividadeContatoItem.vue +235 -235
  39. package/src/lib-components/Messages/InteratividadeFormulario.vue +334 -334
  40. package/src/lib-components/Messages/InteratividadePopup.vue +95 -95
  41. package/src/lib-components/Messages/LinkPreview.vue +176 -176
  42. package/src/lib-components/Scroll/ScrollContent.vue +166 -166
  43. package/src/lib-components/Templates/TemplateGenerator.vue +640 -640
  44. package/src/lib-components/Templates/TemplateMessage.vue +83 -83
  45. package/src/lib-components/Templates/TemplateSingle.vue +478 -478
@@ -1,687 +1,687 @@
1
- <template>
2
- <div v-if="origem"
3
- :class="`${msgNova ? 'msgNova' : `${origem === 'outros' ? 'card-cli' : 'card-ope'} ${customClass || ''}`}`"
4
- :id="`a${messageIndex ? messageIndex : randomizeValue}`">
5
- <transition name="fade">
6
- <span v-if="msgNova" class="novas-mensagens"> Nova mensagem </span>
7
- </transition>
8
- <div class="card box-shadow">
9
- <div class="card-header">
10
- <div class="card-autor">
11
- <fa-icon :icon="iconAutor" />
12
- <p class="text-bold" v-if="autor" v-text="`${tratarTextoLongo(autor)}`" :title="autor"></p>
13
- <p v-if="origem === 'principal' && autor && login" v-text="returnLoginText" :title="returnLoginText"></p>
14
- </div>
15
- <div class="card-right">
16
- <div class="card-datas">
17
- <div v-if="data_cri" class="card-data" :title="data_cri === data_mod ? `${dictionary.data_criacao} e ${dictionary.data_mod}: ${origem === 'outros'
18
- ? formataTimezoneData(data_cri)
19
- : returnFormataDataHora(data_cri)
20
- }` : `${dictionary.data_criacao}: ${origem === 'outros'
21
- ? formataTimezoneData(data_cri)
22
- : returnFormataDataHora(data_cri)
23
- }`">
24
- <span v-text="origem === 'outros'
25
- ? formataTimezoneData(data_cri)
26
- : returnFormataDataHora(data_cri)
27
- "></span>
28
- </div>
29
- <div v-if="data_mod && data_mod !== data_cri" class="card-data" :title="`${dictionary.data_mod}: ${origem === 'outros'
30
- ? formataTimezoneData(data_mod)
31
- : returnFormataDataHora(data_mod)
32
- }`">
33
- <span v-text="origem === 'outros'
34
- ? formataTimezoneData(data_mod)
35
- : returnFormataDataHora(data_mod)
36
- "></span>
37
- </div>
38
- </div>
39
- <div class="card-expand" @click="expandirCard()" v-if="hasExpand" v-tippy :content="'Expandir mensagem'">
40
- <fa-icon :icon="['fas', 'expand-alt']" />
41
- </div>
42
- <div class="card-actions" v-if="customButtons && customButtons.length">
43
- <span v-for="(button, index) in customButtons" :key="button.id || index" v-show="button.use"
44
- @click="button.callback(returnParams(button.params))" :class="`${button.customClass || 'menu-mensagem'}`"
45
- v-tippy :content="button.tippyContent">
46
- <fa-icon :icon="['fas', button.icon || 'question-circle']" v-if="!button.svgIcon" />
47
- <span v-else v-html="button.svgIcon" :class="button.svgClass ? button.svgClass : ''"></span>
48
- </span>
49
- </div>
50
- </div>
51
- </div>
52
- <div class="card-chip-container">
53
- <p class="card-chip" :class="[ticketClassCod]" v-if="ticket_id.cod && ticket_id.desc"
54
- v-text="`${ticket_id.desc} (${ticket_id.cod})`" :title="`${ticket_id.desc} (${ticket_id.cod})`"></p>
55
- <p v-if="ticket_id.hasOwnProperty('back_doing_business')"
56
- :class="`${ticket_id.back_doing_business ? 'green' : 'red'} card-chip`" :title="`${dictionary.title_voltaria_fazer_negocio} ${ticket_id.back_doing_business
57
- ? `${dictionary.title_sim}`
58
- : `${dictionary.title_nao}`
59
- }`" v-text="`${dictionary.title_voltaria_fazer_negocio} ${ticket_id.back_doing_business
60
- ? `${dictionary.title_sim}`
61
- : `${dictionary.title_nao}`
62
- }`
63
- "></p>
64
- <p v-if="ticket_id.hasOwnProperty('rating')" :class="`${isNumberBiggerThanSix ? 'green' : 'red'} card-chip`"
65
- :title="`${dictionary.title_avaliacao} ${ticket_id.rating}`"
66
- v-text="`${dictionary.title_avaliacao} ${ticket_id.rating}`"></p>
67
- <p v-if="ticket_id.hasOwnProperty('resolved_issue')"
68
- :class="`${ticket_id.resolved_issue ? 'green' : 'red'} card-chip`" :title="`${dictionary.title_problema_resolvido} ${ticket_id.resolved_issue
69
- ? `${dictionary.title_sim}`
70
- : `${dictionary.title_nao}`
71
- }`" v-text="`${dictionary.title_problema_resolvido} ${ticket_id.resolved_issue
72
- ? `${dictionary.title_sim}`
73
- : `${dictionary.title_nao}`
74
- }`
75
- "></p>
76
- </div>
77
- <p class="card-message" v-html="mensagemFormatada"></p>
78
- <div class="card-interatividade" v-if="filteredInteratividadeData && filteredInteratividadeData.length">
79
- <p class="card-interatividade-title">{{ dictionary.ra_infos_interatividade }}:</p>
80
- <ul class="card-interatividade-list">
81
- <li v-for="(values, index) in filteredInteratividadeData" :key="index">
82
- <p v-for="(value, key) in values" :key="key">
83
- <span v-if="key.indexOf(dictionary.ra_ask_avaliation_title) <= -1"
84
- v-html="formatInteratividadeValue(key, value)"></span>
85
- <span v-else>
86
- <strong v-text="`${key}:`"></strong>
87
- <button @click="sendLink(filteredInteratividadeData[index])" class="box-shadow" v-text="value"></button>
88
- </span>
89
- </p>
90
- <hr />
91
- </li>
92
- </ul>
93
- </div>
94
- <div class="card-footer" v-if="anexos && anexos.length">
95
- <div class="card-anexo" v-for="(anexo, index) in anexos" :key="`${index}`">
96
- <CardAttachment :anexo="anexo" :dictionary="dictionary" :dominio="dominio" />
97
- </div>
98
- </div>
99
- </div>
100
- </div>
101
- </template>
102
-
103
- <script>
104
- import { textoLongo } from "@/mixins/formatarTexto";
105
- import { formataTimezoneData, formataDataHora } from "../../services/textFormatting";
106
- import CardAttachment from "./CardAttachment";
107
-
108
- export default {
109
- components: { CardAttachment },
110
- props: {
111
- dictionary: {
112
- type: Object,
113
- required: true,
114
- },
115
- messageIndex: {
116
- type: [Number, String],
117
- required: true,
118
- },
119
- dominio: {
120
- type: String,
121
- required: true,
122
- },
123
- hasExpand: {
124
- type: Boolean,
125
- required: false,
126
- default: true,
127
- },
128
- origem: {
129
- type: String,
130
- required: true,
131
- },
132
- autor: {
133
- type: String,
134
- },
135
- login: {
136
- type: String,
137
- },
138
- mensagem: {
139
- type: String,
140
- },
141
- anexos: {
142
- type: Array,
143
- },
144
- data_cri: {
145
- type: String,
146
- },
147
- data_mod: {
148
- type: String,
149
- },
150
- ticket_id: {
151
- type: Object,
152
- },
153
- ticket_name: {
154
- type: String,
155
- },
156
- msgNova: {
157
- type: Boolean,
158
- },
159
- customClass: {
160
- type: String
161
- },
162
- customButtons: {
163
- type: Array
164
- },
165
- origemExterna: {
166
- type: String,
167
- },
168
- interatividade: {
169
- type: Array,
170
- required: false,
171
- default: () => [],
172
- },
173
- },
174
- mixins: [textoLongo],
175
- computed: {
176
- randomizeValue() {
177
- return `${Math.floor(Math.random() * 7770)}${Date.now()}`;
178
- },
179
- mensagemFormatada() {
180
- if (this.mensagem) {
181
- const regex = /(\n|&nbsp;)/g;
182
- if (regex.test(this.mensagem)) return this.mensagem.replace(regex, "<br>");
183
- }
184
- return this.mensagem;
185
- },
186
- iconAutor() {
187
- return this.origem === "outros" ? ["fas", "user"] : ["fas", "headset"];
188
- },
189
- returnLoginText() {
190
- if (!this.login) return "";
191
- if (this.autor) return ` (${this.login})`;
192
- return `${this.login}`;
193
- },
194
- ticketClassCod() {
195
- if (!this.ticket_id || !this.ticket_id.cod) return "";
196
- const { cod } = this.ticket_id;
197
- switch (cod) {
198
- case 17:
199
- case "17":
200
- case 9:
201
- case "9":
202
- case 8:
203
- case "8":
204
- case "CANCELADA":
205
- return "red";
206
- case 3:
207
- case "3":
208
- case 6:
209
- case "6":
210
- case "AGENDADA":
211
- return "yellow";
212
- default:
213
- return "";
214
- }
215
- },
216
- isNumberBiggerThanSix() {
217
- if (!this.ticket_id || !this.ticket_id.rating) return false;
218
- try {
219
- return parseInt(this.ticket_id.rating) > 6;
220
- } catch (err) {
221
- return false;
222
- }
223
- },
224
- filteredInteratividadeData() {
225
- if (!this.interatividade || !this.interatividade.length) return [];
226
- const finalData = [];
227
- const validKeys = [
228
- "name",
229
- "value",
230
- // "ticket_detail_id",
231
- // "ticket_detail_type_id",
232
- // "creation_date",
233
- // "modification_date",
234
- ];
235
- const validIds = [7];
236
- this.interatividade.forEach((values) => {
237
- if (validIds.includes(values.ticket_detail_type_id)) {
238
- const currentKeys = Object.keys(values);
239
- const formattedValues = {};
240
- if (values.name && values.value) {
241
- formattedValues[values.name] = values.value;
242
- }
243
- currentKeys.forEach((key) => {
244
- if (validKeys.includes(key)) {
245
- let formattedKey = "";
246
- // if (key === "ticket_detail_id") {
247
- // formattedKey = this.dictionary.ra_ticket_detail_id_title;
248
- // } else if (key === "ticket_detail_type_id") {
249
- // formattedKey = this.dictionary.ra_ticket_detail_type_id_title;
250
- // } else if (key === "creation_date") {
251
- // formattedKey = this.dictionary.ra_creation_date_title;
252
- // } else if (key === "modification_date") {
253
- // formattedKey = this.dictionary.ra_creation_modification_title;
254
- // }
255
- if (formattedKey) {
256
- formattedValues[formattedKey] = values[key];
257
- }
258
- }
259
- });
260
- if (values.ticket_detail_type_id === 25) {
261
- formattedValues[
262
- this.dictionary.ra_ask_avaliation_title
263
- ] = this.dictionary.ra_ask_avaliation_text;
264
- }
265
- finalData.push(formattedValues);
266
- }
267
- });
268
-
269
- return finalData;
270
- },
271
- },
272
- methods: {
273
- formataTimezoneData(timezoneData) {
274
- return formataTimezoneData(timezoneData);
275
- },
276
- returnFormataDataHora(dataHora) {
277
- return formataDataHora(dataHora, false, false, this.dictionary);
278
- },
279
- expandirCard() {
280
- this.$emit("expand-card", this.$props);
281
- // this.$store.dispatch("informacoesCardExpandido", this.$props)
282
- // this.$store.dispatch("toggleBlocker", { state: true, origin: "expandir-card-reclamacao"})
283
- },
284
- formatInteratividadeValue(key, value) {
285
- const regexISO8601 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/;
286
- if (regexISO8601.test(value)) {
287
- const data = new Date(value);
288
- const dia = String(data.getDate()).padStart(2, "0");
289
- const mes = String(data.getMonth() + 1).padStart(2, "0");
290
- const ano = data.getFullYear();
291
- const horas = String(data.getHours()).padStart(2, "0");
292
- const minutos = String(data.getMinutes()).padStart(2, "0");
293
-
294
- value = `${dia}/${mes}/${ano} ${horas}:${minutos}`;
295
- }
296
- return `<strong>${key}:</strong> ${value || "---"}`;
297
- },
298
- sendLink(obj) {
299
- this.$emit("send-avaliation-link", obj);
300
- },
301
- returnParams(params) {
302
- const defaultParams = {
303
- message: this.mensagem,
304
- };
305
-
306
- if (!params) return defaultParams;
307
-
308
- const keys = params.instanceKeys.split("|");
309
- if (!keys || !keys.length)
310
- return {
311
- defaultParams,
312
- ...params.values,
313
- };
314
-
315
- const customParams = { ...params.values };
316
- keys.forEach((key) => {
317
- if (this[key]) customParams[key] = this[key];
318
- else console.warn(`Cant find ${key} on 'this' instance`);
319
- });
320
-
321
- return Object.keys(customParams).length ? customParams : defaultParams;
322
- }
323
- },
324
- };
325
- </script>
326
-
327
- <style>
328
- .fade-enter-active,
329
- .fade-leave-active {
330
- transition: opacity 200ms;
331
- }
332
-
333
- .fade-enter,
334
- .fade-leave-to {
335
- opacity: 0;
336
- }
337
-
338
- .card-cli,
339
- .card-ope {
340
- display: flex;
341
- width: 95%;
342
- margin: 5px 0;
343
- position: relative;
344
- }
345
-
346
- .card-cli.msgNova,
347
- .card-ope.msgNova {
348
- margin-top: 30px;
349
- }
350
-
351
- .novas-mensagens {
352
- position: absolute;
353
- top: -30px;
354
- width: 100%;
355
- display: flex;
356
- justify-content: center;
357
- align-items: center;
358
- margin: 2.5px 0;
359
- background-color: lighten(#fff249, 15);
360
- }
361
-
362
- .card-cli .card {
363
- border-left: 3px solid #90b823;
364
- }
365
-
366
- .card-ope {
367
- align-self: flex-end;
368
- background-color: lighten(#007535, 72);
369
- }
370
-
371
- .card-ope .card {
372
- border-right: 3px solid #007535;
373
- }
374
-
375
- .card {
376
- background-color: rgba(255, 255, 255, 0.9);
377
- overflow: hidden;
378
- width: 100%;
379
- padding: 2.5px 5px;
380
- border-radius: 7px;
381
- box-shadow: rgba(0, 0, 0, 0.15) 1px 2px 3px 0px;
382
- }
383
-
384
- .card p {
385
- word-break: break-all;
386
- }
387
-
388
- .card-header {
389
- width: 100%;
390
- border-bottom: 1px solid #ddd;
391
- margin-bottom: 5px;
392
- display: flex;
393
- justify-content: space-between;
394
- padding: 10px 5px;
395
- }
396
-
397
- .card-header svg {
398
- font-size: 16px;
399
- }
400
-
401
- .card-canal {
402
- flex: 1;
403
- margin-right: 10px;
404
- }
405
-
406
- .card-datas {
407
- display: flex;
408
- flex-direction: column;
409
- margin-right: 10px;
410
- background: rgb(0, 136, 69);
411
- padding: 5px 10px;
412
- border-top-left-radius: 15px;
413
- border-bottom-left-radius: 15px;
414
- color: #fff;
415
- }
416
-
417
- .card-right {
418
- margin-right: -20px;
419
- display: flex;
420
- flex-direction: row-reverse;
421
- align-items: center;
422
- }
423
-
424
- .card-data {
425
- overflow: hidden;
426
- display: flex;
427
- align-content: center;
428
- }
429
-
430
- .card-data span {
431
- white-space: nowrap;
432
- text-overflow: ellipsis;
433
- overflow: hidden;
434
- }
435
-
436
- .card-data svg {
437
- margin-right: 5px;
438
- color: #232323;
439
- }
440
-
441
- .card-actions {
442
- display: flex;
443
- gap: 7px;
444
- }
445
-
446
- .menu-mensagem {
447
- cursor: pointer;
448
- padding: 1px;
449
- }
450
-
451
- .card-expand {
452
- display: flex;
453
- justify-content: center;
454
- align-items: center;
455
- margin: 0 10px;
456
- cursor: pointer;
457
- opacity: 0.8;
458
- transition: opacity 150ms;
459
- }
460
-
461
- .card-expand:hover {
462
- opacity: 1;
463
- }
464
-
465
- .card-footer {
466
- margin-top: 5px;
467
- border-top: 1px solid #ddd;
468
- display: flex;
469
- flex-wrap: wrap;
470
- }
471
-
472
- .card-chip-container {
473
- display: flex;
474
- flex-wrap: wrap;
475
- width: 100%;
476
- gap: 5px;
477
- }
478
-
479
- .card-autor {
480
- display: flex;
481
- align-items: center;
482
- margin-right: 10px;
483
- overflow: hidden;
484
- min-width: 14px;
485
- max-width: calc(100% - 215px);
486
- gap: 5px;
487
- }
488
-
489
- .card-chip {
490
- font-size: 12.8px;
491
- width: fit-content;
492
- border-radius: 15px;
493
- transition: all 150ms ease-in-out;
494
- padding: 2.5px 7px;
495
- color: rgb(31, 105, 193);
496
- background-color: rgba(207, 216, 244, 0.6);
497
- margin-bottom: 5px;
498
- }
499
-
500
- .card-chip:hover {
501
- background-color: rgba(207, 216, 244, 1);
502
- }
503
-
504
- .card-chip.orange {
505
- color: #e14924;
506
- background-color: rgba(228, 92, 58, 0.15);
507
- }
508
-
509
- .card-chip.orange:hover {
510
- background-color: rgba(228, 92, 58, 0.2);
511
- }
512
-
513
- .card-chip.yellow {
514
- color: #f4a304;
515
- background-color: rgba(252, 191, 73, 0.15);
516
- }
517
-
518
- .card-chip.yellow:hover {
519
- background-color: rgba(252, 191, 73, 0.2);
520
- }
521
-
522
- .card-chip.red {
523
- color: rgb(231, 76, 60);
524
- background-color: rgba(231, 76, 60, 0.2);
525
- }
526
-
527
- .card-chip.red:hover {
528
- background-color: rgba(231, 76, 60, 0.25);
529
- }
530
-
531
- .card-chip.green {
532
- color: #0e3213;
533
- background-color: rgba(15, 177, 39, 0.3);
534
- }
535
-
536
- .card-chip.green:hover {
537
- background-color: rgba(15, 177, 39, 0.4);
538
- }
539
-
540
- .card-anexo {
541
- width: 50px;
542
- height: 50px;
543
- margin-right: 5px;
544
- display: flex;
545
- justify-content: center;
546
- align-items: center;
547
- }
548
-
549
- .anexo-item svg {
550
- font-size: 30px;
551
- z-index: 1;
552
- }
553
-
554
- .anexo-item {
555
- width: 100%;
556
- height: 100%;
557
- display: flex;
558
- justify-content: center;
559
- align-items: center;
560
- position: relative;
561
- }
562
-
563
- .anexo-item .transition-anexo-item {
564
- max-width: 100%;
565
- max-height: 100%;
566
- }
567
-
568
- .anexo-item .req-loader {
569
- position: absolute;
570
- top: calc(50% - 12.5px);
571
- right: calc(50% - 12.5px);
572
- }
573
-
574
- .anexo-item .transition-anexo-item img {
575
- max-width: 45px;
576
- max-height: 45px;
577
- }
578
-
579
- .anexo-icone {
580
- opacity: 0.9;
581
- transition: opacity 200ms;
582
- color: #222;
583
- cursor: pointer;
584
- display: flex;
585
- justify-content: center;
586
- align-items: center;
587
- }
588
-
589
- .anexo-icone:hover {
590
- opacity: 1;
591
- }
592
-
593
- .anexo-icone:visited {
594
- color: inherit;
595
- }
596
-
597
- .anexo-icone.pdf {
598
- position: relative;
599
- }
600
-
601
- .anexo-icone.pdf svg {
602
- color: rgb(231, 76, 60);
603
- }
604
-
605
- .anexo-icone.pdf::after {
606
- content: "";
607
- position: absolute;
608
- bottom: 2px;
609
- transform: translateY(2px);
610
- width: 20px;
611
- height: 20px;
612
- background-color: #fff;
613
- }
614
-
615
- .anexo-icone.doc {
616
- color: #15517f;
617
- }
618
-
619
- .anexo-icone.doc::after {
620
- content: "";
621
- position: absolute;
622
- width: 20px;
623
- height: 20px;
624
- background-color: #fff;
625
- }
626
-
627
- .anexo-img {
628
- display: flex;
629
- justify-content: center;
630
- align-items: center;
631
- width: 100%;
632
- height: 100%;
633
- overflow: hidden;
634
- background-color: rgba(0, 0, 0, 0.2);
635
- border-radius: 2.5px;
636
- cursor: pointer;
637
- opacity: 0.9;
638
- transition: opacity 150ms;
639
- }
640
-
641
- .anexo-img:hover {
642
- opacity: 1;
643
- }
644
-
645
- .anexo-img img {
646
- width: 95%;
647
- }
648
-
649
- .card-interatividade {
650
- display: flex;
651
- flex-direction: column;
652
- margin-top: 10px;
653
- margin-bottom: 5px;
654
- font-size: 14.4px;
655
- }
656
-
657
- .card-interatividade-title {
658
- font-weight: bold;
659
- margin-bottom: 5px;
660
- }
661
-
662
- .card-interatividade-list {
663
- margin: 0;
664
- padding: 0;
665
- font-size: 14.4px;
666
- }
667
-
668
- .card-interatividade-list hr {
669
- height: 1px;
670
- background-color: #ccc;
671
- width: 100%;
672
- border: 0;
673
- }
674
-
675
- .card-interatividade-list button {
676
- margin-left: 5px;
677
- border-radius: 5px;
678
- border: unset;
679
- cursor: pointer;
680
- padding: 5px 10px;
681
- background-color: #b5f778;
682
- }
683
-
684
- .card-interatividade-list button:hover {
685
- text-decoration: underline;
686
- }
687
- </style>
1
+ <template>
2
+ <div v-if="origem"
3
+ :class="`${msgNova ? 'msgNova' : `${origem === 'outros' ? 'card-cli' : 'card-ope'} ${customClass || ''}`}`"
4
+ :id="`a${messageIndex ? messageIndex : randomizeValue}`">
5
+ <transition name="fade">
6
+ <span v-if="msgNova" class="novas-mensagens"> Nova mensagem </span>
7
+ </transition>
8
+ <div class="card box-shadow">
9
+ <div class="card-header">
10
+ <div class="card-autor">
11
+ <fa-icon :icon="iconAutor" />
12
+ <p class="text-bold" v-if="autor" v-text="`${tratarTextoLongo(autor)}`" :title="autor"></p>
13
+ <p v-if="origem === 'principal' && autor && login" v-text="returnLoginText" :title="returnLoginText"></p>
14
+ </div>
15
+ <div class="card-right">
16
+ <div class="card-datas">
17
+ <div v-if="data_cri" class="card-data" :title="data_cri === data_mod ? `${dictionary.data_criacao} e ${dictionary.data_mod}: ${origem === 'outros'
18
+ ? formataTimezoneData(data_cri)
19
+ : returnFormataDataHora(data_cri)
20
+ }` : `${dictionary.data_criacao}: ${origem === 'outros'
21
+ ? formataTimezoneData(data_cri)
22
+ : returnFormataDataHora(data_cri)
23
+ }`">
24
+ <span v-text="origem === 'outros'
25
+ ? formataTimezoneData(data_cri)
26
+ : returnFormataDataHora(data_cri)
27
+ "></span>
28
+ </div>
29
+ <div v-if="data_mod && data_mod !== data_cri" class="card-data" :title="`${dictionary.data_mod}: ${origem === 'outros'
30
+ ? formataTimezoneData(data_mod)
31
+ : returnFormataDataHora(data_mod)
32
+ }`">
33
+ <span v-text="origem === 'outros'
34
+ ? formataTimezoneData(data_mod)
35
+ : returnFormataDataHora(data_mod)
36
+ "></span>
37
+ </div>
38
+ </div>
39
+ <div class="card-expand" @click="expandirCard()" v-if="hasExpand" v-tippy :content="'Expandir mensagem'">
40
+ <fa-icon :icon="['fas', 'expand-alt']" />
41
+ </div>
42
+ <div class="card-actions" v-if="customButtons && customButtons.length">
43
+ <span v-for="(button, index) in customButtons" :key="button.id || index" v-show="button.use"
44
+ @click="button.callback(returnParams(button.params))" :class="`${button.customClass || 'menu-mensagem'}`"
45
+ v-tippy :content="button.tippyContent">
46
+ <fa-icon :icon="['fas', button.icon || 'question-circle']" v-if="!button.svgIcon" />
47
+ <span v-else v-html="button.svgIcon" :class="button.svgClass ? button.svgClass : ''"></span>
48
+ </span>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ <div class="card-chip-container">
53
+ <p class="card-chip" :class="[ticketClassCod]" v-if="ticket_id.cod && ticket_id.desc"
54
+ v-text="`${ticket_id.desc} (${ticket_id.cod})`" :title="`${ticket_id.desc} (${ticket_id.cod})`"></p>
55
+ <p v-if="ticket_id.hasOwnProperty('back_doing_business')"
56
+ :class="`${ticket_id.back_doing_business ? 'green' : 'red'} card-chip`" :title="`${dictionary.title_voltaria_fazer_negocio} ${ticket_id.back_doing_business
57
+ ? `${dictionary.title_sim}`
58
+ : `${dictionary.title_nao}`
59
+ }`" v-text="`${dictionary.title_voltaria_fazer_negocio} ${ticket_id.back_doing_business
60
+ ? `${dictionary.title_sim}`
61
+ : `${dictionary.title_nao}`
62
+ }`
63
+ "></p>
64
+ <p v-if="ticket_id.hasOwnProperty('rating')" :class="`${isNumberBiggerThanSix ? 'green' : 'red'} card-chip`"
65
+ :title="`${dictionary.title_avaliacao} ${ticket_id.rating}`"
66
+ v-text="`${dictionary.title_avaliacao} ${ticket_id.rating}`"></p>
67
+ <p v-if="ticket_id.hasOwnProperty('resolved_issue')"
68
+ :class="`${ticket_id.resolved_issue ? 'green' : 'red'} card-chip`" :title="`${dictionary.title_problema_resolvido} ${ticket_id.resolved_issue
69
+ ? `${dictionary.title_sim}`
70
+ : `${dictionary.title_nao}`
71
+ }`" v-text="`${dictionary.title_problema_resolvido} ${ticket_id.resolved_issue
72
+ ? `${dictionary.title_sim}`
73
+ : `${dictionary.title_nao}`
74
+ }`
75
+ "></p>
76
+ </div>
77
+ <p class="card-message" v-html="mensagemFormatada"></p>
78
+ <div class="card-interatividade" v-if="filteredInteratividadeData && filteredInteratividadeData.length">
79
+ <p class="card-interatividade-title">{{ dictionary.ra_infos_interatividade }}:</p>
80
+ <ul class="card-interatividade-list">
81
+ <li v-for="(values, index) in filteredInteratividadeData" :key="index">
82
+ <p v-for="(value, key) in values" :key="key">
83
+ <span v-if="key.indexOf(dictionary.ra_ask_avaliation_title) <= -1"
84
+ v-html="formatInteratividadeValue(key, value)"></span>
85
+ <span v-else>
86
+ <strong v-text="`${key}:`"></strong>
87
+ <button @click="sendLink(filteredInteratividadeData[index])" class="box-shadow" v-text="value"></button>
88
+ </span>
89
+ </p>
90
+ <hr />
91
+ </li>
92
+ </ul>
93
+ </div>
94
+ <div class="card-footer" v-if="anexos && anexos.length">
95
+ <div class="card-anexo" v-for="(anexo, index) in anexos" :key="`${index}`">
96
+ <CardAttachment :anexo="anexo" :dictionary="dictionary" :dominio="dominio" />
97
+ </div>
98
+ </div>
99
+ </div>
100
+ </div>
101
+ </template>
102
+
103
+ <script>
104
+ import { textoLongo } from "@/mixins/formatarTexto";
105
+ import { formataTimezoneData, formataDataHora } from "../../services/textFormatting";
106
+ import CardAttachment from "./CardAttachment";
107
+
108
+ export default {
109
+ components: { CardAttachment },
110
+ props: {
111
+ dictionary: {
112
+ type: Object,
113
+ required: true,
114
+ },
115
+ messageIndex: {
116
+ type: [Number, String],
117
+ required: true,
118
+ },
119
+ dominio: {
120
+ type: String,
121
+ required: true,
122
+ },
123
+ hasExpand: {
124
+ type: Boolean,
125
+ required: false,
126
+ default: true,
127
+ },
128
+ origem: {
129
+ type: String,
130
+ required: true,
131
+ },
132
+ autor: {
133
+ type: String,
134
+ },
135
+ login: {
136
+ type: String,
137
+ },
138
+ mensagem: {
139
+ type: String,
140
+ },
141
+ anexos: {
142
+ type: Array,
143
+ },
144
+ data_cri: {
145
+ type: String,
146
+ },
147
+ data_mod: {
148
+ type: String,
149
+ },
150
+ ticket_id: {
151
+ type: Object,
152
+ },
153
+ ticket_name: {
154
+ type: String,
155
+ },
156
+ msgNova: {
157
+ type: Boolean,
158
+ },
159
+ customClass: {
160
+ type: String
161
+ },
162
+ customButtons: {
163
+ type: Array
164
+ },
165
+ origemExterna: {
166
+ type: String,
167
+ },
168
+ interatividade: {
169
+ type: Array,
170
+ required: false,
171
+ default: () => [],
172
+ },
173
+ },
174
+ mixins: [textoLongo],
175
+ computed: {
176
+ randomizeValue() {
177
+ return `${Math.floor(Math.random() * 7770)}${Date.now()}`;
178
+ },
179
+ mensagemFormatada() {
180
+ if (this.mensagem) {
181
+ const regex = /(\n|&nbsp;)/g;
182
+ if (regex.test(this.mensagem)) return this.mensagem.replace(regex, "<br>");
183
+ }
184
+ return this.mensagem;
185
+ },
186
+ iconAutor() {
187
+ return this.origem === "outros" ? ["fas", "user"] : ["fas", "headset"];
188
+ },
189
+ returnLoginText() {
190
+ if (!this.login) return "";
191
+ if (this.autor) return ` (${this.login})`;
192
+ return `${this.login}`;
193
+ },
194
+ ticketClassCod() {
195
+ if (!this.ticket_id || !this.ticket_id.cod) return "";
196
+ const { cod } = this.ticket_id;
197
+ switch (cod) {
198
+ case 17:
199
+ case "17":
200
+ case 9:
201
+ case "9":
202
+ case 8:
203
+ case "8":
204
+ case "CANCELADA":
205
+ return "red";
206
+ case 3:
207
+ case "3":
208
+ case 6:
209
+ case "6":
210
+ case "AGENDADA":
211
+ return "yellow";
212
+ default:
213
+ return "";
214
+ }
215
+ },
216
+ isNumberBiggerThanSix() {
217
+ if (!this.ticket_id || !this.ticket_id.rating) return false;
218
+ try {
219
+ return parseInt(this.ticket_id.rating) > 6;
220
+ } catch (err) {
221
+ return false;
222
+ }
223
+ },
224
+ filteredInteratividadeData() {
225
+ if (!this.interatividade || !this.interatividade.length) return [];
226
+ const finalData = [];
227
+ const validKeys = [
228
+ "name",
229
+ "value",
230
+ // "ticket_detail_id",
231
+ // "ticket_detail_type_id",
232
+ // "creation_date",
233
+ // "modification_date",
234
+ ];
235
+ const validIds = [7];
236
+ this.interatividade.forEach((values) => {
237
+ if (validIds.includes(values.ticket_detail_type_id)) {
238
+ const currentKeys = Object.keys(values);
239
+ const formattedValues = {};
240
+ if (values.name && values.value) {
241
+ formattedValues[values.name] = values.value;
242
+ }
243
+ currentKeys.forEach((key) => {
244
+ if (validKeys.includes(key)) {
245
+ let formattedKey = "";
246
+ // if (key === "ticket_detail_id") {
247
+ // formattedKey = this.dictionary.ra_ticket_detail_id_title;
248
+ // } else if (key === "ticket_detail_type_id") {
249
+ // formattedKey = this.dictionary.ra_ticket_detail_type_id_title;
250
+ // } else if (key === "creation_date") {
251
+ // formattedKey = this.dictionary.ra_creation_date_title;
252
+ // } else if (key === "modification_date") {
253
+ // formattedKey = this.dictionary.ra_creation_modification_title;
254
+ // }
255
+ if (formattedKey) {
256
+ formattedValues[formattedKey] = values[key];
257
+ }
258
+ }
259
+ });
260
+ if (values.ticket_detail_type_id === 25) {
261
+ formattedValues[
262
+ this.dictionary.ra_ask_avaliation_title
263
+ ] = this.dictionary.ra_ask_avaliation_text;
264
+ }
265
+ finalData.push(formattedValues);
266
+ }
267
+ });
268
+
269
+ return finalData;
270
+ },
271
+ },
272
+ methods: {
273
+ formataTimezoneData(timezoneData) {
274
+ return formataTimezoneData(timezoneData);
275
+ },
276
+ returnFormataDataHora(dataHora) {
277
+ return formataDataHora(dataHora, false, false, this.dictionary);
278
+ },
279
+ expandirCard() {
280
+ this.$emit("expand-card", this.$props);
281
+ // this.$store.dispatch("informacoesCardExpandido", this.$props)
282
+ // this.$store.dispatch("toggleBlocker", { state: true, origin: "expandir-card-reclamacao"})
283
+ },
284
+ formatInteratividadeValue(key, value) {
285
+ const regexISO8601 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/;
286
+ if (regexISO8601.test(value)) {
287
+ const data = new Date(value);
288
+ const dia = String(data.getDate()).padStart(2, "0");
289
+ const mes = String(data.getMonth() + 1).padStart(2, "0");
290
+ const ano = data.getFullYear();
291
+ const horas = String(data.getHours()).padStart(2, "0");
292
+ const minutos = String(data.getMinutes()).padStart(2, "0");
293
+
294
+ value = `${dia}/${mes}/${ano} ${horas}:${minutos}`;
295
+ }
296
+ return `<strong>${key}:</strong> ${value || "---"}`;
297
+ },
298
+ sendLink(obj) {
299
+ this.$emit("send-avaliation-link", obj);
300
+ },
301
+ returnParams(params) {
302
+ const defaultParams = {
303
+ message: this.mensagem,
304
+ };
305
+
306
+ if (!params) return defaultParams;
307
+
308
+ const keys = params.instanceKeys.split("|");
309
+ if (!keys || !keys.length)
310
+ return {
311
+ defaultParams,
312
+ ...params.values,
313
+ };
314
+
315
+ const customParams = { ...params.values };
316
+ keys.forEach((key) => {
317
+ if (this[key]) customParams[key] = this[key];
318
+ else console.warn(`Cant find ${key} on 'this' instance`);
319
+ });
320
+
321
+ return Object.keys(customParams).length ? customParams : defaultParams;
322
+ }
323
+ },
324
+ };
325
+ </script>
326
+
327
+ <style>
328
+ .fade-enter-active,
329
+ .fade-leave-active {
330
+ transition: opacity 200ms;
331
+ }
332
+
333
+ .fade-enter,
334
+ .fade-leave-to {
335
+ opacity: 0;
336
+ }
337
+
338
+ .card-cli,
339
+ .card-ope {
340
+ display: flex;
341
+ width: 95%;
342
+ margin: 5px 0;
343
+ position: relative;
344
+ }
345
+
346
+ .card-cli.msgNova,
347
+ .card-ope.msgNova {
348
+ margin-top: 30px;
349
+ }
350
+
351
+ .novas-mensagens {
352
+ position: absolute;
353
+ top: -30px;
354
+ width: 100%;
355
+ display: flex;
356
+ justify-content: center;
357
+ align-items: center;
358
+ margin: 2.5px 0;
359
+ background-color: lighten(#fff249, 15);
360
+ }
361
+
362
+ .card-cli .card {
363
+ border-left: 3px solid #90b823;
364
+ }
365
+
366
+ .card-ope {
367
+ align-self: flex-end;
368
+ background-color: lighten(#007535, 72);
369
+ }
370
+
371
+ .card-ope .card {
372
+ border-right: 3px solid #007535;
373
+ }
374
+
375
+ .card {
376
+ background-color: rgba(255, 255, 255, 0.9);
377
+ overflow: hidden;
378
+ width: 100%;
379
+ padding: 2.5px 5px;
380
+ border-radius: 7px;
381
+ box-shadow: rgba(0, 0, 0, 0.15) 1px 2px 3px 0px;
382
+ }
383
+
384
+ .card p {
385
+ word-break: break-all;
386
+ }
387
+
388
+ .card-header {
389
+ width: 100%;
390
+ border-bottom: 1px solid #ddd;
391
+ margin-bottom: 5px;
392
+ display: flex;
393
+ justify-content: space-between;
394
+ padding: 10px 5px;
395
+ }
396
+
397
+ .card-header svg {
398
+ font-size: 16px;
399
+ }
400
+
401
+ .card-canal {
402
+ flex: 1;
403
+ margin-right: 10px;
404
+ }
405
+
406
+ .card-datas {
407
+ display: flex;
408
+ flex-direction: column;
409
+ margin-right: 10px;
410
+ background: rgb(0, 136, 69);
411
+ padding: 5px 10px;
412
+ border-top-left-radius: 15px;
413
+ border-bottom-left-radius: 15px;
414
+ color: #fff;
415
+ }
416
+
417
+ .card-right {
418
+ margin-right: -20px;
419
+ display: flex;
420
+ flex-direction: row-reverse;
421
+ align-items: center;
422
+ }
423
+
424
+ .card-data {
425
+ overflow: hidden;
426
+ display: flex;
427
+ align-content: center;
428
+ }
429
+
430
+ .card-data span {
431
+ white-space: nowrap;
432
+ text-overflow: ellipsis;
433
+ overflow: hidden;
434
+ }
435
+
436
+ .card-data svg {
437
+ margin-right: 5px;
438
+ color: #232323;
439
+ }
440
+
441
+ .card-actions {
442
+ display: flex;
443
+ gap: 7px;
444
+ }
445
+
446
+ .menu-mensagem {
447
+ cursor: pointer;
448
+ padding: 1px;
449
+ }
450
+
451
+ .card-expand {
452
+ display: flex;
453
+ justify-content: center;
454
+ align-items: center;
455
+ margin: 0 10px;
456
+ cursor: pointer;
457
+ opacity: 0.8;
458
+ transition: opacity 150ms;
459
+ }
460
+
461
+ .card-expand:hover {
462
+ opacity: 1;
463
+ }
464
+
465
+ .card-footer {
466
+ margin-top: 5px;
467
+ border-top: 1px solid #ddd;
468
+ display: flex;
469
+ flex-wrap: wrap;
470
+ }
471
+
472
+ .card-chip-container {
473
+ display: flex;
474
+ flex-wrap: wrap;
475
+ width: 100%;
476
+ gap: 5px;
477
+ }
478
+
479
+ .card-autor {
480
+ display: flex;
481
+ align-items: center;
482
+ margin-right: 10px;
483
+ overflow: hidden;
484
+ min-width: 14px;
485
+ max-width: calc(100% - 215px);
486
+ gap: 5px;
487
+ }
488
+
489
+ .card-chip {
490
+ font-size: 12.8px;
491
+ width: fit-content;
492
+ border-radius: 15px;
493
+ transition: all 150ms ease-in-out;
494
+ padding: 2.5px 7px;
495
+ color: rgb(31, 105, 193);
496
+ background-color: rgba(207, 216, 244, 0.6);
497
+ margin-bottom: 5px;
498
+ }
499
+
500
+ .card-chip:hover {
501
+ background-color: rgba(207, 216, 244, 1);
502
+ }
503
+
504
+ .card-chip.orange {
505
+ color: #e14924;
506
+ background-color: rgba(228, 92, 58, 0.15);
507
+ }
508
+
509
+ .card-chip.orange:hover {
510
+ background-color: rgba(228, 92, 58, 0.2);
511
+ }
512
+
513
+ .card-chip.yellow {
514
+ color: #f4a304;
515
+ background-color: rgba(252, 191, 73, 0.15);
516
+ }
517
+
518
+ .card-chip.yellow:hover {
519
+ background-color: rgba(252, 191, 73, 0.2);
520
+ }
521
+
522
+ .card-chip.red {
523
+ color: rgb(231, 76, 60);
524
+ background-color: rgba(231, 76, 60, 0.2);
525
+ }
526
+
527
+ .card-chip.red:hover {
528
+ background-color: rgba(231, 76, 60, 0.25);
529
+ }
530
+
531
+ .card-chip.green {
532
+ color: #0e3213;
533
+ background-color: rgba(15, 177, 39, 0.3);
534
+ }
535
+
536
+ .card-chip.green:hover {
537
+ background-color: rgba(15, 177, 39, 0.4);
538
+ }
539
+
540
+ .card-anexo {
541
+ width: 50px;
542
+ height: 50px;
543
+ margin-right: 5px;
544
+ display: flex;
545
+ justify-content: center;
546
+ align-items: center;
547
+ }
548
+
549
+ .anexo-item svg {
550
+ font-size: 30px;
551
+ z-index: 1;
552
+ }
553
+
554
+ .anexo-item {
555
+ width: 100%;
556
+ height: 100%;
557
+ display: flex;
558
+ justify-content: center;
559
+ align-items: center;
560
+ position: relative;
561
+ }
562
+
563
+ .anexo-item .transition-anexo-item {
564
+ max-width: 100%;
565
+ max-height: 100%;
566
+ }
567
+
568
+ .anexo-item .req-loader {
569
+ position: absolute;
570
+ top: calc(50% - 12.5px);
571
+ right: calc(50% - 12.5px);
572
+ }
573
+
574
+ .anexo-item .transition-anexo-item img {
575
+ max-width: 45px;
576
+ max-height: 45px;
577
+ }
578
+
579
+ .anexo-icone {
580
+ opacity: 0.9;
581
+ transition: opacity 200ms;
582
+ color: #222;
583
+ cursor: pointer;
584
+ display: flex;
585
+ justify-content: center;
586
+ align-items: center;
587
+ }
588
+
589
+ .anexo-icone:hover {
590
+ opacity: 1;
591
+ }
592
+
593
+ .anexo-icone:visited {
594
+ color: inherit;
595
+ }
596
+
597
+ .anexo-icone.pdf {
598
+ position: relative;
599
+ }
600
+
601
+ .anexo-icone.pdf svg {
602
+ color: rgb(231, 76, 60);
603
+ }
604
+
605
+ .anexo-icone.pdf::after {
606
+ content: "";
607
+ position: absolute;
608
+ bottom: 2px;
609
+ transform: translateY(2px);
610
+ width: 20px;
611
+ height: 20px;
612
+ background-color: #fff;
613
+ }
614
+
615
+ .anexo-icone.doc {
616
+ color: #15517f;
617
+ }
618
+
619
+ .anexo-icone.doc::after {
620
+ content: "";
621
+ position: absolute;
622
+ width: 20px;
623
+ height: 20px;
624
+ background-color: #fff;
625
+ }
626
+
627
+ .anexo-img {
628
+ display: flex;
629
+ justify-content: center;
630
+ align-items: center;
631
+ width: 100%;
632
+ height: 100%;
633
+ overflow: hidden;
634
+ background-color: rgba(0, 0, 0, 0.2);
635
+ border-radius: 2.5px;
636
+ cursor: pointer;
637
+ opacity: 0.9;
638
+ transition: opacity 150ms;
639
+ }
640
+
641
+ .anexo-img:hover {
642
+ opacity: 1;
643
+ }
644
+
645
+ .anexo-img img {
646
+ width: 95%;
647
+ }
648
+
649
+ .card-interatividade {
650
+ display: flex;
651
+ flex-direction: column;
652
+ margin-top: 10px;
653
+ margin-bottom: 5px;
654
+ font-size: 14.4px;
655
+ }
656
+
657
+ .card-interatividade-title {
658
+ font-weight: bold;
659
+ margin-bottom: 5px;
660
+ }
661
+
662
+ .card-interatividade-list {
663
+ margin: 0;
664
+ padding: 0;
665
+ font-size: 14.4px;
666
+ }
667
+
668
+ .card-interatividade-list hr {
669
+ height: 1px;
670
+ background-color: #ccc;
671
+ width: 100%;
672
+ border: 0;
673
+ }
674
+
675
+ .card-interatividade-list button {
676
+ margin-left: 5px;
677
+ border-radius: 5px;
678
+ border: unset;
679
+ cursor: pointer;
680
+ padding: 5px 10px;
681
+ background-color: #b5f778;
682
+ }
683
+
684
+ .card-interatividade-list button:hover {
685
+ text-decoration: underline;
686
+ }
687
+ </style>