@nixweb/nixloc-ui 0.0.156 → 0.0.158

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nixweb/nixloc-ui",
3
- "version": "0.0.156",
3
+ "version": "0.0.158",
4
4
  "description": "Componentes UI",
5
5
  "author": "Fábio Ávila <fabio@nixweb.com.br>",
6
6
  "private": false,
@@ -55,6 +55,7 @@ export default {
55
55
  },
56
56
  props: {
57
57
  legend: [],
58
+ module: String,
58
59
  },
59
60
  data() {
60
61
  return {
@@ -75,7 +76,13 @@ export default {
75
76
  ...mapGetters("generic", ["groupBy"]),
76
77
  ...mapState("generic", ["search", "executedSearch", "clearedSearch"]),
77
78
  grouped() {
78
- var list = this.groupBy({ array: this.legendLocal, key: "groupName" });
79
+ let legend = [];
80
+ this.legendLocal.forEach((item) => {
81
+ if (item.showModule.includes(this.module) || item.showModule == "all")
82
+ legend.push(item);
83
+ });
84
+
85
+ var list = this.groupBy({ array: legend, key: "groupName" });
79
86
  return list;
80
87
  },
81
88
  },
@@ -80,8 +80,11 @@ export default {
80
80
  this.$emit("input", value);
81
81
  },
82
82
  execute() {
83
- if (this.clickedNext) this.clickedNext();
84
- this.removeLoading(["btnClickedNext"]);
83
+ let self = this;
84
+ setTimeout(function () {
85
+ self.removeLoading(["btnClickedNext"]);
86
+ if (self.clickedNext) self.clickedNext();
87
+ }, 350);
85
88
  },
86
89
  },
87
90
  computed: {
@@ -123,7 +126,7 @@ export default {
123
126
 
124
127
  .selected {
125
128
  background-color: white;
126
- border-color: #4680A5;
129
+ border-color: #4680a5;
127
130
  }
128
131
 
129
132
  .icon {
@@ -23,7 +23,7 @@ export default {
23
23
  type: "success",
24
24
  });
25
25
  if (value.type == "postApiError" || value.type == "putApiErro") {
26
- this.$toasted.show("Ops! Algo deu errado", {
26
+ this.$toasted.show("Não foi possível adicionar/modificar", {
27
27
  type: "error",
28
28
  });
29
29
  this.voltarParaTopo();
@@ -34,12 +34,27 @@ export default {
34
34
  type: "success",
35
35
  });
36
36
  if (value.type == "removerTodosApiErro") {
37
- this.$toasted.show("Ops! Algo deu errado", {
37
+ this.$toasted.show("Não foi possível remover", {
38
+ type: "error",
39
+ });
40
+ this.voltarParaTopo();
41
+ }
42
+
43
+ if (value.type == "noPermission") {
44
+ this.$toasted.show("Usuário sem permissão", {
38
45
  type: "error",
39
46
  });
40
47
  this.voltarParaTopo();
41
48
  }
49
+
42
50
  if (value.type == "falhaGenerica") {
51
+ this.$toasted.show("Ops! Falha de servidor", {
52
+ type: "error",
53
+ });
54
+ this.voltarParaTopo();
55
+ }
56
+
57
+ if (value.type == "messageError") {
43
58
  this.$toasted.show("Ops! Algo deu errado", {
44
59
  type: "error",
45
60
  });
@@ -49,7 +49,7 @@
49
49
  <div class="side-by-side">
50
50
  <Button
51
51
  key="showModalLegend"
52
- title="Parâmetros (Alt)"
52
+ title="Parâmetros"
53
53
  type="info"
54
54
  classIcon="fas fa-book-reader"
55
55
  size="small"
@@ -84,7 +84,11 @@
84
84
  <slot></slot>
85
85
  </Modal>
86
86
  <Modal title="Parâmetros" :width="1100" v-show="showModal('legenda')">
87
- <ParameterLegend v-show="modal.open" :legend="parameterLegend" />
87
+ <ParameterLegend
88
+ v-show="modal.open"
89
+ :legend="parameterLegend"
90
+ :module="module"
91
+ />
88
92
  </Modal>
89
93
  <Modal title="Editor de Código" :width="900" v-if="showModal('code')">
90
94
  <CodeEditor v-if="modal.open" />
@@ -167,6 +171,7 @@ export default {
167
171
  panel: Object,
168
172
  parameterExemple: Object,
169
173
  parameterLegend: Array,
174
+ module: String,
170
175
  },
171
176
  data() {
172
177
  return {
@@ -9,73 +9,120 @@
9
9
  >
10
10
  <div slot="content-main">
11
11
  <br />
12
- <div class="div-loading" v-show="loading">
13
- <span
14
- >Aguarde, estamos carregando os dados, isso pode levar alguns
15
- minutos...
16
- </span>
17
- <Loading type="line" :center="false" />
18
- </div>
19
- <Molded v-show="!loading">
20
- <div v-show="!fileName">
21
- <div class="import-icon">
22
- <i class="fas fa-file-import"></i>
23
- </div>
24
- <slot></slot>
25
- <Alert type="info">
26
- <span>
27
- Selecione o arquivo no formato <b> .xlsx </b> baseado na
28
- planilha modelo e aguarde até carregar os dados para
29
- conferência. </span
30
- ><br />
31
- <span>
32
- Até <b> 1000 </b> itens por planilha ou <b> 1MB </b> no arquivo.
33
- </span>
34
- </Alert>
35
- <div class="div-file">
36
- <FileUpload
37
- title="Carregar arquivo"
38
- classIcon="fa-sharp fa-solid fa-upload"
39
- :container="container"
40
- accepted=".xlsx"
41
- allowed=".xlsx"
42
- :disabled="true"
43
- urlPost="/api/v1/adm/file-upload/upload"
44
- urlRemove="/api/v1/adm/file-upload/delete"
45
- :onLoad="successUploadFile"
46
- :nameDataBase="fileName"
47
- v-model="fileName"
48
- />
49
- </div>
50
- </div>
51
- <div v-show="fileName && !loading">
52
- <div class="import-icon">
53
- <i class="fas fa-file-import"></i>
54
- </div>
55
- <span>
56
- Efetue o <b> mapeamento </b> dos campos e clique em iniciar
57
- validação.</span
58
- >
59
- <br />
60
- <div class="div-btn">
61
- <Button
62
- _key="btnBack"
63
- type="info"
64
- title="voltar"
65
- classIcon="fa-solid fa-circle-arrow-left"
66
- size="small"
67
- :clicked="back"
68
- />
69
- <Button
70
- v-if="!isValid"
71
- _key="btnValidate"
72
- type="primary"
73
- title="Iniciar Validação"
74
- :disabled="false"
75
- classIcon="fa-solid fa-arrow-right-arrow-left"
76
- size="small"
77
- :clicked="validate"
78
- />
12
+ <div v-show="!success">
13
+ <b-tabs>
14
+ <b-tab title="Importar">
15
+ <div class="div-loading" v-show="loading">
16
+ <span
17
+ >Aguarde, estamos carregando os dados, isso pode levar alguns
18
+ minutos...
19
+ </span>
20
+ <Loading type="line" :center="false" />
21
+ </div>
22
+ <div v-show="!loading">
23
+ <div v-show="!fileName">
24
+ <div class="import-icon">
25
+ <i class="fas fa-file-import"></i>
26
+ </div>
27
+ <slot></slot>
28
+ <Alert type="info">
29
+ <span>
30
+ Selecione o arquivo no formato <b> .xlsx </b> baseado na
31
+ planilha modelo e aguarde até carregar os dados para
32
+ conferência. </span
33
+ ><br />
34
+ <span>
35
+ Até <b> 1000 </b> itens por planilha ou <b> 1MB </b> no
36
+ arquivo.
37
+ </span>
38
+ </Alert>
39
+ <div class="div-file">
40
+ <FileUpload
41
+ title="Carregar arquivo"
42
+ classIcon="fa-sharp fa-solid fa-upload"
43
+ :container="container"
44
+ accepted=".xlsx"
45
+ allowed=".xlsx"
46
+ :disabled="true"
47
+ urlPost="/api/v1/adm/file-upload/upload"
48
+ urlRemove="/api/v1/adm/file-upload/delete"
49
+ :onLoad="successUploadFile"
50
+ :nameDataBase="fileName"
51
+ v-model="fileName"
52
+ />
53
+ </div>
54
+ </div>
55
+ <div v-show="fileName && !loading">
56
+ <div class="import-icon">
57
+ <i class="fas fa-file-import"></i>
58
+ </div>
59
+ <span>
60
+ Efetue o <b> mapeamento </b> dos campos e clique em iniciar
61
+ validação.</span
62
+ >
63
+ <br />
64
+ <div class="div-btn">
65
+ <Button
66
+ _key="btnBack"
67
+ type="info"
68
+ title="voltar"
69
+ classIcon="fa-solid fa-circle-arrow-left"
70
+ size="small"
71
+ :clicked="back"
72
+ />
73
+ <Button
74
+ v-if="!isValid"
75
+ _key="btnValidate"
76
+ type="primary"
77
+ title="Iniciar Validação"
78
+ :disabled="false"
79
+ classIcon="fa-solid fa-arrow-right-arrow-left"
80
+ size="small"
81
+ :clicked="validate"
82
+ />
83
+ <Button
84
+ v-if="listError.length > 0"
85
+ _key="btnListError"
86
+ type="danger"
87
+ title="Erro(s)"
88
+ classIcon="fa-sharp fa-solid fa-triangle-exclamation"
89
+ size="small"
90
+ :clicked="openListError"
91
+ />
92
+ <Button
93
+ v-if="isValid"
94
+ _key="btnImport"
95
+ type="success"
96
+ title="Importar"
97
+ classIcon="fa-solid fa-file-import"
98
+ size="small"
99
+ :clicked="startImport"
100
+ />
101
+ </div>
102
+ <br />
103
+ <Alert type="danger" v-if="listError.length > 0">
104
+ <span>
105
+ Atenção, foram identificados
106
+ <b>{{ listError.length }}</b> erro(s), corrija-os!
107
+ </span>
108
+ </Alert>
109
+ <Alert type="info">
110
+ <span>
111
+ Total de <b> {{ totalRecords }} </b> registro(s), para o
112
+ mapeamento serão carregados somente os
113
+ <b> 10 </b> primeiros (se houver).
114
+ </span>
115
+ </Alert>
116
+ <TableImport
117
+ v-if="fileName"
118
+ :select="select"
119
+ :headerTable="headerTable"
120
+ :data="data"
121
+ />
122
+ </div>
123
+ </div>
124
+ </b-tab>
125
+ <b-tab title="Histórico">
79
126
  <Button
80
127
  v-if="listError.length > 0"
81
128
  _key="btnListError"
@@ -85,39 +132,36 @@
85
132
  size="small"
86
133
  :clicked="openListError"
87
134
  />
88
- <Button
89
- v-if="isValid"
90
- _key="btnImport"
91
- type="success"
92
- title="Importar"
93
- classIcon="fa-solid fa-file-import"
94
- size="small"
95
- :clicked="startImport"
96
- />
97
- </div>
98
- <br />
99
- <Alert type="danger" v-if="listError.length > 0">
100
- <span>
101
- Atenção, foram identificados
102
- <b>{{ listError.length }}</b> erro(s), corrija-os!
103
- </span>
104
- </Alert>
105
- <Alert type="info">
106
- <span>
107
- Total de <b> {{ totalRecords }} </b> registro(s), para o
108
- mapeamento serão carregados somente os <b> 10 </b> primeiros (se
109
- houver).
110
- </span>
111
- </Alert>
112
-
113
- <TableImport
114
- v-if="fileName"
115
- :select="select"
116
- :headerTable="headerTable"
117
- :data="data"
118
- />
135
+ <ViewTemplateConfiguration
136
+ :templateList="templateList"
137
+ :showSearch="false"
138
+ :showHorizontalFilter="false"
139
+ >
140
+ </ViewTemplateConfiguration>
141
+ </b-tab>
142
+ </b-tabs>
143
+ </div>
144
+ <div v-show="success">
145
+ <div class="div-molded text-center">
146
+ <Molded>
147
+ <div class="msg-success">Importação realizada com sucesso!</div>
148
+ <div class="icon-success">
149
+ <i class="fa-light fa-circle-check"></i>
150
+ </div>
151
+ <div>
152
+ <Button
153
+ _key="btnBack"
154
+ type="info"
155
+ title="voltar"
156
+ classIcon="fa-solid fa-circle-arrow-left"
157
+ size="small"
158
+ :clicked="back"
159
+ />
160
+ </div>
161
+ </Molded>
119
162
  </div>
120
- </Molded>
163
+ </div>
164
+ <br />
121
165
  </div>
122
166
  </Panel>
123
167
  <Modal
@@ -128,6 +172,23 @@
128
172
  >
129
173
  <ListNotifications :listError="listError" />
130
174
  </Modal>
175
+ <Modal
176
+ title="Você tem certeza?"
177
+ :width="500"
178
+ v-show="showModal('confirmDelete')"
179
+ >
180
+ <Alert type="warning">
181
+ <span>
182
+ Atenção, todos os registros relacionados também serão excluídos, esta
183
+ ação é irreversível!
184
+ </span>
185
+ </Alert>
186
+ <Confirmation
187
+ :isModal="false"
188
+ type="danger"
189
+ :confirmed="removeSelected"
190
+ />
191
+ </Modal>
131
192
  </div>
132
193
  </template>
133
194
 
@@ -139,6 +200,8 @@ import FileUpload from "@nixweb/nixloc-ui/src/component/forms/FileUpload";
139
200
  import Loading from "@nixweb/nixloc-ui/src/component/shared/Loading.vue";
140
201
  import Alert from "@nixweb/nixloc-ui/src/component/layout/Alert";
141
202
  import Modal from "@nixweb/nixloc-ui/src/component/forms/Modal";
203
+ import Confirmation from "@nixweb/nixloc-ui/src/component/shared/Confirmation.vue";
204
+ import ViewTemplateConfiguration from "@nixweb/nixloc-ui/src/component/template/ViewTemplateConfiguration";
142
205
 
143
206
  import TableImport from "@nixweb/nixloc-ui/src/component/shared/TableImport.vue";
144
207
  import ListNotifications from "@nixweb/nixloc-ui/src/component/shared/ListNotifications.vue";
@@ -154,12 +217,15 @@ export default {
154
217
  FileUpload,
155
218
  Loading,
156
219
  ListNotifications,
220
+ ViewTemplateConfiguration,
157
221
  TableImport,
158
222
  Alert,
159
223
  Modal,
224
+ Confirmation,
160
225
  },
161
226
  props: {
162
227
  panel: Object,
228
+ templateList: Object,
163
229
  select: Array,
164
230
  container: String,
165
231
  typeImport: Number,
@@ -176,14 +242,16 @@ export default {
176
242
  totalRecords: 0,
177
243
  listError: [],
178
244
  isValid: false,
245
+ idRemove: "",
246
+ success: false,
179
247
  };
180
248
  },
181
249
  computed: {
182
- ...mapGetters("generic", ["showModal"]),
250
+ ...mapGetters("generic", ["showModal", "event"]),
183
251
  },
184
252
  methods: {
185
- ...mapActions("generic", ["postApi"]),
186
- ...mapMutations("generic", ["openModal", "removeLoading"]),
253
+ ...mapActions("generic", ["postApi", "deleteAllApi"]),
254
+ ...mapMutations("generic", ["openModal", "hideModal", "removeLoading"]),
187
255
  successUploadFile() {
188
256
  this.loading = true;
189
257
  let self = this;
@@ -242,11 +310,29 @@ export default {
242
310
  };
243
311
  this.postApi(params).then((response) => {
244
312
  if (response.success) {
245
- alert();
313
+ this.success = true;
314
+ this.removeLoading(["btnImport"]);
246
315
  }
247
316
  this.removeLoading(["btnValidate"]);
248
317
  });
249
318
  },
319
+ removeSelected() {
320
+ let params = {
321
+ url: this.templateList.urlDeleteAllApi,
322
+ selected: [this.idRemove],
323
+ };
324
+ this.deleteAllApi(params).then((response) => {
325
+ if (response.success) {
326
+ this.listError = [];
327
+ this.hideModal();
328
+ } else {
329
+ this.listError = response.content;
330
+ if (this.listError.length == 0) this.isValid = true;
331
+ this.hideModal();
332
+ }
333
+ this.removeLoading(["confirm"]);
334
+ });
335
+ },
250
336
  openListError() {
251
337
  this.openModal("listError");
252
338
  this.removeLoading(["btnListError"]);
@@ -254,9 +340,21 @@ export default {
254
340
  back() {
255
341
  this.fileName = "";
256
342
  this.listError = [];
343
+ this.success = false;
257
344
  this.removeLoading(["btnBack"]);
258
345
  },
259
346
  },
347
+ watch: {
348
+ event: {
349
+ handler(event) {
350
+ if (event.name == "deleteHistoryImport") {
351
+ this.openModal("confirmDelete");
352
+ this.idRemove = this.event.data.id;
353
+ }
354
+ },
355
+ deep: true,
356
+ },
357
+ },
260
358
  };
261
359
  </script>
262
360
 
@@ -279,4 +377,20 @@ export default {
279
377
  .div-loading {
280
378
  margin-top: 10px;
281
379
  }
380
+
381
+ .div-molded {
382
+ width: 550px;
383
+ margin: auto;
384
+ }
385
+
386
+ .msg-success {
387
+ font-size: 18px;
388
+ }
389
+
390
+ .icon-success {
391
+ font-size: 55px;
392
+ color: #38a169;
393
+ margin-top: 10px;
394
+ margin-bottom: 15px;
395
+ }
282
396
  </style>
@@ -102,6 +102,7 @@ export default {
102
102
  let isPayment = th.innerText.includes("t.pagamentoLocacao");
103
103
  let isPeriod = th.innerText.includes("t.periodoLocacao");
104
104
  let isProduct = th.innerText.includes("t.produtoLocacao");
105
+ let isInvoice = th.innerText.includes("t.produtoFatura");
105
106
  let isGrouped = th.innerText.includes("t.produtoAgrupado");
106
107
  let isMoviment = th.innerText.includes("t.produtoMovimentacao");
107
108
  let isCustumerAddress = th.innerText.includes("t.enderecoCliente");
@@ -111,6 +112,9 @@ export default {
111
112
  if (isProduct) {
112
113
  obj.vForSimple = "v-for='produto in d.itensLocacao'";
113
114
  config.push(obj);
115
+ } else if (isInvoice) {
116
+ obj.vForSimple = "v-for='produto in d.itensFatura'";
117
+ config.push(obj);
114
118
  } else if (isPeriod) {
115
119
  obj.vForSimple = "v-for='periodo in d.periodoLocacao'";
116
120
  config.push(obj);
@@ -167,6 +171,7 @@ export default {
167
171
  .replaceAll("t.pagamentoLocacao", "")
168
172
  .replaceAll("t.periodoLocacao", "")
169
173
  .replaceAll("t.produtoLocacao", "")
174
+ .replaceAll("t.produtoFatura", "")
170
175
  .replaceAll("t.produtoAgrupado", "")
171
176
  .replaceAll("t.produtoMovimentacao", "")
172
177
  .replaceAll("t.enderecoCliente", "")
@@ -320,7 +325,7 @@ export default {
320
325
  } else {
321
326
 
322
327
  context.commit('addNotifications', response.data.notifications)
323
- context.commit('addToast', 'postApiError');
328
+ context.commit('addToast', 'messageError');
324
329
 
325
330
  return response.data;
326
331
  }
@@ -329,7 +334,7 @@ export default {
329
334
  if (err.response)
330
335
  if (err.response.status === 403) {
331
336
  context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
332
- context.commit('addToast', 'falhaGenerica');
337
+ context.commit('addToast', 'noPermission');
333
338
  }
334
339
 
335
340
  if (!err.response)
@@ -353,16 +358,15 @@ export default {
353
358
  context.commit('validation/removeFormDirty', null, { root: true });
354
359
  return response.data;
355
360
  } else {
356
- context.commit('addToast', 'putApiErro');
357
361
  context.commit('addNotifications', response.data.notifications)
358
-
362
+ context.commit('addToast', 'messageError');
359
363
  return response.data;
360
364
  }
361
365
  }, (err) => {
362
366
  if (err.response)
363
367
  if (err.response.status === 403) {
364
368
  context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
365
- context.commit('addToast', 'falhaGenerica');
369
+ context.commit('addToast', 'noPermission');
366
370
  }
367
371
 
368
372
  if (!err.response)
@@ -435,7 +439,7 @@ export default {
435
439
  } else {
436
440
  context.commit('addNotifications', response.data.notifications)
437
441
  context.commit('addMethodExecutedApi', 'putApiErro');
438
- context.commit('addToast', 'putApiErro');
442
+ context.commit('addToast', 'messageError');
439
443
  return response.data;
440
444
  }
441
445
 
@@ -443,7 +447,7 @@ export default {
443
447
  if (err.response)
444
448
  if (err.response.status === 403) {
445
449
  context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
446
- context.commit('addToast', 'falhaGenerica');
450
+ context.commit('addToast', 'noPermission');
447
451
  }
448
452
 
449
453
  if (!err.response)
@@ -471,7 +475,7 @@ export default {
471
475
  } else {
472
476
  context.commit('addNotifications', response.data.notifications)
473
477
  context.commit('addMethodExecutedApi', 'deleteAllApiErro');
474
- context.commit('addToast', 'deleteApiErro');
478
+ context.commit('addToast', 'messageError');
475
479
  return response.data;
476
480
  }
477
481
 
@@ -479,7 +483,7 @@ export default {
479
483
  if (err.response)
480
484
  if (err.response.status === 403) {
481
485
  context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
482
- context.commit('addToast', 'falhaGenerica');
486
+ context.commit('addToast', 'noPermission');
483
487
  }
484
488
 
485
489
  if (!err.response)
@@ -503,7 +507,7 @@ export default {
503
507
  return response.data;
504
508
  } else {
505
509
  context.commit('addNotifications', response.data.notifications)
506
- context.commit('addToast', 'deleteApiErro');
510
+ context.commit('addToast', 'messageError');
507
511
  return response.data;
508
512
  }
509
513
 
@@ -511,7 +515,7 @@ export default {
511
515
  if (err.response)
512
516
  if (err.response.status === 403) {
513
517
  context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
514
- context.commit('addToast', 'falhaGenerica');
518
+ context.commit('addToast', 'noPermission');
515
519
  }
516
520
 
517
521
  if (!err.response)
@@ -554,8 +558,9 @@ export default {
554
558
  context.commit('removeNotificarions');
555
559
  return response.data;
556
560
  } else {
557
- context.commit('addToast', 'addApiError');
561
+
558
562
  context.commit('addNotifications', response.data.notifications)
563
+ context.commit('addToast', 'messageError');
559
564
 
560
565
  return response.data;
561
566
  }
@@ -563,7 +568,7 @@ export default {
563
568
  if (err.response)
564
569
  if (err.response.status === 403) {
565
570
  context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
566
- context.commit('addToast', 'falhaGenerica');
571
+ context.commit('addToast', 'noPermission');
567
572
  }
568
573
 
569
574
  if (!err.response)
@@ -595,7 +600,7 @@ export default {
595
600
  if (err.response)
596
601
  if (err.response.status === 403) {
597
602
  context.commit('addNotifications', [{ message: "Usuário sem permissão para executar esta ação!" }])
598
- context.commit('addToast', 'falhaGenerica');
603
+ context.commit('addToast', 'noPermission');
599
604
  }
600
605
 
601
606
  if (!err.response)