vue-intergrall-plugins 0.0.207 → 0.0.210

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>
@@ -3,6 +3,7 @@
3
3
  <InteratividadeFormulario
4
4
  v-if="interatividade && validateInterativity()"
5
5
  :interatividade="interatividade"
6
+ :dominio="dominio"
6
7
  :anexos="anexos"
7
8
  :dictionary="dictionary"
8
9
  />
@@ -26,10 +26,10 @@
26
26
  </div>
27
27
  <h3 class="m-5 text-bold" v-text="`Anexos`"></h3>
28
28
  <div class="d-flex flex-wrap align-items-center">
29
- <div v-for="({ name, url, type, mkuDownload }, fileIndex) in anexos" :key="`file-${fileIndex}`" class="mb-5 mx-5 d-flex">
30
- <img class="box-shadow max-w-75px max-h-75px cursor-pointer" @click="openFile(url, type)" v-if="!type" :src="url" :alt="name" :title="name" />
31
- <fa-icon v-else :icon="returnCurrentIcon(type)" @click="openFile(url, type)" :class="returnCurrentClass(type)" :title="name" />
32
- <a class="d-flex align-items-end ml-3 text-dark" :href="mkuDownload" :download="`${name}`" target="_blank" rel="noreferrer noopener" :title="`Download ${name}`">
29
+ <div v-for="({ name, type, mkuDownload, mku }, fileIndex) in anexos" :key="`file-${fileIndex}`" class="mb-5 mx-5 d-flex">
30
+ <img class="box-shadow max-w-75px max-h-75px cursor-pointer" @click="openFile(mku, type)" v-if="!type" :src="`${dominio}/callcenter/docs.php?mku=${mku}`" :alt="name" :title="name" />
31
+ <fa-icon v-else :icon="returnCurrentIcon(type)" @click="openFile(mku, type)" :class="returnCurrentClass(type)" :title="name" />
32
+ <a class="d-flex align-items-end ml-3 text-dark" :href="`${dominio}/callcenter/docs.php?mku=${mkuDownload}`" :download="`${name}`" target="_blank" rel="noreferrer noopener" :title="`Download ${name}`">
33
33
  <fa-icon :icon="['fas', 'download']" />
34
34
  </a>
35
35
  </div>
@@ -55,17 +55,20 @@ export default {
55
55
  type: Object,
56
56
  required: true
57
57
  },
58
- anexos: {
59
- type: Array,
60
- required: false
58
+ dominio: {
59
+ type: String,
60
+ required: true
61
61
  },
62
62
  dictionary: {
63
63
  type: Object,
64
64
  required: true
65
+ },
66
+ anexos: {
67
+ type: Array,
68
+ required: false
65
69
  }
66
70
  },
67
71
  mounted(){
68
- console.log(this.anexos)
69
72
  if(this.validateInterativity()){
70
73
  this.verifyInfoAditional();
71
74
  }
@@ -81,7 +84,7 @@ export default {
81
84
  const width = window.innerWidth
82
85
  const height = window.innerHeight
83
86
  const options = !isImg ? `width=${width},height=${height}` : "width=auto,height=auto"
84
- window.open(url, "card-file", options)
87
+ window.open(`${this.dominio}/callcenter/docs.php?mku=${url}`, "card-file", options)
85
88
  },
86
89
  validateInterativity(){
87
90
  try {
@@ -96,22 +99,18 @@ export default {
96
99
  try {
97
100
  let { formulario } = this.interatividade
98
101
  formulario = formulario ? formulario : [];
99
- if(!formulario.length){
100
- return;
101
- }
102
- let foundInfosAdd = formulario.filter(f => f.TIPO_TEXTO > 999);
103
- 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);
104
105
  if(foundInfos){
105
106
  this.informacao = foundInfos.map(info => {
106
- if(info.TIPO_TEXTO == 1){
107
- info.TEXTO = info.TEXTO == 'S' ? this.dictionary.msg_sim : this.dictionary.msg_nao
108
- }
109
- return info
110
- })
111
- }
112
- if(foundInfosAdd){
113
- 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
+ })
114
112
  }
113
+ if(foundInfosAdd) this.informacaoAdicional = foundInfosAdd;
115
114
  } catch (e) {
116
115
  console.error("Erro ao pegar o objeto interatividade formulario")
117
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