vue-intergrall-plugins 0.0.208 → 0.0.211

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.
@@ -1,24 +1,24 @@
1
1
  <template>
2
2
  <span class="anexo-item">
3
3
  <transition-group name="fade" mode="out-in" class="transition-anexo-item">
4
- <div v-if="carregando" :small="true" key="ra-loader-anexo" class="req-loader slow"></div>
4
+ <div v-if="isLoading" :small="true" key="ra-loader-anexo" class="req-loader slow"></div>
5
5
  <template v-else>
6
- <span v-if="imgAnexo" class="anexo-img box-shadow" @click="abrirAnexo(imgAnexo, true)" key="ra-img-anexo" :title="nomeArquivo">
7
- <img :src="`${imgAnexo}`" :alt="nomeArquivo" />
6
+ <span v-if="imageURL" class="anexo-img box-shadow" @click="openWindowFromURL(imageURL, true)" key="ra-img-anexo" :title="filename">
7
+ <img :src="`${imageURL}`" :alt="filename" />
8
8
  </span>
9
9
  <span
10
10
  v-else
11
- class="anexo-icone"
11
+ class="anexo-icon"
12
12
  key="ra-doc-anexo"
13
- :class="[iconeClass]"
14
- @click="abrirAnexo(docAnexo, false)"
15
- :title="nomeArquivo"
13
+ :class="[iconClass]"
14
+ @click="openWindowFromURL(docURL, false)"
15
+ :title="filename"
16
16
  target="_blank"
17
17
  rel="noreferrer noopener"
18
18
  >
19
- <fa-icon :icon="icone" />
19
+ <fa-icon :icon="icon" />
20
20
  </span>
21
- <a :href="imgAnexo ? imgAnexo : docAnexo" :download="`${nomeArquivo}`" target="_blank" rel="noreferrer noopener" key="ra-download-icon" :title="`Download ${nomeArquivo}`">
21
+ <a :href="imageURL ? imageURL : docURL" :download="`${filename}`" target="_blank" rel="noreferrer noopener" key="ra-download-icon" :title="`Download ${filename}`">
22
22
  <fa-icon :icon="['fas', 'download']" />
23
23
  </a>
24
24
  </template>
@@ -36,9 +36,10 @@
36
36
  </style>
37
37
 
38
38
  <script>
39
- import { gerarVariaveisAnexo } from "../../services/formatMessage"
39
+ import { fileHandler } from "../../mixins/fileHandler"
40
40
 
41
41
  export default {
42
+ mixins: [fileHandler],
42
43
  props: {
43
44
  anexo: {
44
45
  type: Object,
@@ -53,65 +54,8 @@ export default {
53
54
  required: true
54
55
  }
55
56
  },
56
- computed: {
57
- iconeClass() {
58
- return this.tipoDoc === "pdf" ? "pdf" : "doc"
59
- }
60
- },
61
- data() {
62
- return {
63
- carregando: true,
64
- isAnexo: false,
65
- imgAnexo: "",
66
- tipoDoc: "",
67
- docAnexo: "",
68
- nomeArquivo: "",
69
- audio: false,
70
- video: false,
71
- icone: []
72
- }
73
- },
74
57
  mounted() {
75
- this.setVariaveisAnexo()
76
- },
77
- methods: {
78
- setVariaveisAnexo() {
79
- try {
80
- const {
81
- anexo,
82
- imgAnexo,
83
- tipoDoc,
84
- docAnexo,
85
- nomeArquivo,
86
- audio,
87
- video
88
- } = gerarVariaveisAnexo(this.anexo, { dominio: this.dominio });
89
-
90
- this.isAnexo = anexo;
91
- this.imgAnexo = imgAnexo;
92
- this.tipoDoc = tipoDoc;
93
- this.docAnexo = docAnexo;
94
- this.nomeArquivo = nomeArquivo;
95
- this.audio = audio;
96
- this.video = video;
97
-
98
- this.gerarIcone();
99
-
100
- this.carregando = false;
101
- }catch(e) {
102
- console.error("Erro ao gerar as variaveis dos anexos")
103
- console.error(e)
104
- }
105
- },
106
- gerarIcone() {
107
- this.icone = this.tipoDoc === "pdf" ? ['fas', 'file-pdf'] : ['fas', 'file-alt']
108
- },
109
- abrirAnexo(link, isImg) {
110
- const width = window.innerWidth
111
- const height = window.innerHeight
112
- const options = !isImg ? `width=${width},height=${height}` : "width=auto,height=auto"
113
- window.open(link, "anexo-ra", options)
114
- }
58
+ this.setFileVars(this.anexo, { dominio: this.dominio })
115
59
  }
116
60
  }
117
61
  </script>
@@ -84,9 +84,7 @@ export default {
84
84
  const width = window.innerWidth
85
85
  const height = window.innerHeight
86
86
  const options = !isImg ? `width=${width},height=${height}` : "width=auto,height=auto"
87
- let urlformatted = `${this.dominio}/callcenter/docs.php?mku=${url}`;
88
- console.log(urlformatted)
89
- window.open(urlformatted, "card-file", options)
87
+ window.open(`${this.dominio}/callcenter/docs.php?mku=${url}`, "card-file", options)
90
88
  },
91
89
  validateInterativity(){
92
90
  try {
@@ -101,22 +99,18 @@ export default {
101
99
  try {
102
100
  let { formulario } = this.interatividade
103
101
  formulario = formulario ? formulario : [];
104
- if(!formulario.length){
105
- return;
106
- }
107
- let foundInfosAdd = formulario.filter(f => f.TIPO_TEXTO > 999);
108
- let foundInfos = formulario.filter(f => f.TIPO_TEXTO < 1000);
102
+ if(!formulario.length) return
103
+ const foundInfosAdd = formulario.filter(f => f.TIPO_TEXTO > 999);
104
+ const foundInfos = formulario.filter(f => f.TIPO_TEXTO < 1000);
109
105
  if(foundInfos){
110
106
  this.informacao = foundInfos.map(info => {
111
- if(info.TIPO_TEXTO == 1){
112
- info.TEXTO = info.TEXTO == 'S' ? this.dictionary.msg_sim : this.dictionary.msg_nao
113
- }
114
- return info
115
- })
116
- }
117
- if(foundInfosAdd){
118
- this.informacaoAdicional = foundInfosAdd;
107
+ if(info.TIPO_TEXTO == 1){
108
+ info.TEXTO = info.TEXTO == 'S' ? this.dictionary.msg_sim : this.dictionary.msg_nao
109
+ }
110
+ return info
111
+ })
119
112
  }
113
+ if(foundInfosAdd) this.informacaoAdicional = foundInfosAdd;
120
114
  } catch (e) {
121
115
  console.error("Erro ao pegar o objeto interatividade formulario")
122
116
  console.error(e)
@@ -91,9 +91,11 @@
91
91
  for (let key in template) {
92
92
  if (key === "components" && Array.isArray(template[key])) {
93
93
  template[key].map((component) => {
94
- component.parameters.map((param) => {
95
- fullText += param.text;
96
- });
94
+ if(component && component.parameters && component.parameters.length) {
95
+ component.parameters.map((param) => {
96
+ fullText += param.text;
97
+ });
98
+ }
97
99
  });
98
100
  }
99
101
  }
@@ -162,36 +164,38 @@
162
164
  for(let index in this.selectedTemplate) {
163
165
  if(index === "components" && Array.isArray(this.selectedTemplate[index])) {
164
166
  const arrComponents = this.selectedTemplate[index]
165
- arrComponents.map(component => {
166
- if(component && component.parameters && component.parameters.length) {
167
- component.parameters.map(message => {
168
- message.currentText = message.text
169
- let keyIndex = 0
170
- while(keyIndex < keys.length) {
171
- const varName = `{{${keys[keyIndex]}}}`
172
- if(message.text.indexOf(varName) != -1) {
173
- /**Gerando os obejetos de parametros da notificacao para o component */
174
- if(component.type === "header") {
175
- this.selectedTemplate['parameters'][component.type] = {}
176
- //Header s? pode ter uma vari?vel
177
- this.selectedTemplate['parameters'][component.type] = {
178
- tipo: "text",
179
- text: values[keyIndex]
167
+ if(arrComponents && arrComponents.length) {
168
+ arrComponents.map(component => {
169
+ if(component && component.parameters && component.parameters.length) {
170
+ component.parameters.map(message => {
171
+ message.currentText = message.text
172
+ let keyIndex = 0
173
+ while(keyIndex < keys.length) {
174
+ const varName = `{{${keys[keyIndex]}}}`
175
+ if(message.text.indexOf(varName) != -1) {
176
+ /**Gerando os obejetos de parametros da notificacao para o component */
177
+ if(component.type === "header") {
178
+ this.selectedTemplate['parameters'][component.type] = {}
179
+ //Header s? pode ter uma vari?vel
180
+ this.selectedTemplate['parameters'][component.type] = {
181
+ tipo: "text",
182
+ text: values[keyIndex]
183
+ }
184
+ } else if(!this.selectedTemplate['parameters'][component.type]) {
185
+ this.selectedTemplate['parameters'][component.type] = new Array()
180
186
  }
181
- } else if(!this.selectedTemplate['parameters'][component.type]) {
182
- this.selectedTemplate['parameters'][component.type] = new Array()
183
- }
184
- //Aplicando valores das v?riaveis dentro dos outros componentes com execess?o do header
185
- if(this.selectedTemplate['parameters'][component.type] && component.type !== 'header') {
186
- this.selectedTemplate['parameters'][component.type].push(values[keyIndex])
187
+ //Aplicando valores das v?riaveis dentro dos outros componentes com execess?o do header
188
+ if(this.selectedTemplate['parameters'][component.type] && component.type !== 'header') {
189
+ this.selectedTemplate['parameters'][component.type].push(values[keyIndex])
190
+ }
191
+ message.currentText = message.currentText.replace(varName, values[keyIndex])
187
192
  }
188
- message.currentText = message.currentText.replace(varName, values[keyIndex])
193
+ keyIndex++
189
194
  }
190
- keyIndex++
191
- }
192
- })
193
- }
194
- })
195
+ })
196
+ }
197
+ })
198
+ }
195
199
  }
196
200
  }
197
201