vue-intergrall-plugins 1.1.10 → 1.1.12

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