@nixweb/nixloc-ui 1.20.0 → 1.21.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nixweb/nixloc-ui",
3
- "version": "1.20.0",
3
+ "version": "1.21.0",
4
4
  "description": "Componentes UI",
5
5
  "author": "Fábio Ávila <fabio@nixweb.com.br>",
6
6
  "private": false,
@@ -50,6 +50,14 @@ export default {
50
50
  });
51
51
  return sum.reduce((a, b) => a + b, 0);
52
52
  },
53
+ somaGrupoComFiltro(grupoId) {
54
+ return this.d.itensLocacao
55
+ .filter(item => item.grupoId == grupoId) // == aceita string ou number
56
+ .reduce((acc, item) => acc + item.totalValue, 0);
57
+ },
58
+ somaSubGrupo(itensLocacao) {
59
+ return this.somaGrupoComFiltro(this.grupoSemRepeticao(itensLocacao));
60
+ },
53
61
  somaGrupoMaster(grupoMaster) {
54
62
  let sum = [];
55
63
  this.d.itensLocacao.forEach((item) => {
@@ -65,10 +73,14 @@ export default {
65
73
  getPreviewContent() {
66
74
  const previewDiv = this.$refs.preview;
67
75
  this.updateDocumentHtmlFinal(previewDiv.innerHTML);
76
+ },
77
+ grupoSemRepeticao(itensLocacao) {
78
+ return itensLocacao?.[0]?.grupoId ?? null;
68
79
  }
69
80
  },
70
81
  computed: {
71
82
  ...mapGetters("generic", ["groupBy", "event"]),
83
+ // produtoAgrupado e produtoGrupoSubgrupo estão sendo usados no generic.js documentPreview
72
84
  produtoAgrupado() {
73
85
  var group = this.groupBy({ array: this.d.itensLocacao, key: "grupo" });
74
86
  return group;
@@ -102,4 +114,4 @@ export default {
102
114
 
103
115
 
104
116
  };
105
- </script>
117
+ </script>
@@ -258,7 +258,7 @@ export default {
258
258
  let wrapEnd = produtoEnd;
259
259
 
260
260
  // Keep the group/subgroup total row inside the repeated block when present.
261
- const somaMasterToken = "somaGrupo(grupo)";
261
+ const somaMasterToken = "somaSubGrupo";
262
262
  const somaMasterIndex = tbodyHtml.indexOf(somaMasterToken, produtoEnd);
263
263
  if (somaMasterIndex !== -1) {
264
264
  const totalRowStart = tbodyHtml.lastIndexOf("<tr", somaMasterIndex);
@@ -460,10 +460,6 @@ export default {
460
460
  cleanTags: (state) => {
461
461
  state.tags = []
462
462
  },
463
- openModal: (state, name) => {
464
- state.modal.name = name;
465
- state.modal.open = true;
466
- },
467
463
  addFilterStorage: (state, obj) => {
468
464
  const index = state.filterStorage.findIndex(x => x.key === obj.key);
469
465
  if (index !== -1) {
@@ -493,7 +489,7 @@ export default {
493
489
  updateQueryTags: (state, tags) => {
494
490
  state.queryTags = tags;
495
491
  },
496
- _addFilterStorage: (state, obj) => { // está com _addFilterStorage para não ter duplicidade
492
+ _addFilterStorage: (state, obj) => { // está com _addFilterStorage para não ter duplicidade
497
493
  // função abaixo é para não deixar duplicidade
498
494
  const index = state._filterStorage.findIndex(x => x.routeName === obj.routeName);
499
495
  if (index !== -1) {