sim-node-lib 0.0.95 → 0.0.96
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,9 +1,9 @@
|
|
|
1
|
-
export default class
|
|
2
|
-
static getTextoByProduto(operacao: string, produtos: any[]):
|
|
3
|
-
static getTextoByAgrupadorEmpresa(operacao: string, agrupadores: any[]):
|
|
4
|
-
static getTextoByEmpresa(operacao: string, empresas: any[]):
|
|
5
|
-
static getTextoByTag(operacao: string, tags: any[]):
|
|
6
|
-
static getTextoByFormaPagamento(operacao: string, formasPagamento: any[]):
|
|
7
|
-
static getTextoOperacao(operacao: string):
|
|
8
|
-
static getHTMLPill(color: string, texto: string):
|
|
1
|
+
export default class HtmlBadgerHelper {
|
|
2
|
+
static getTextoByProduto(operacao: string, produtos: any[]): string;
|
|
3
|
+
static getTextoByAgrupadorEmpresa(operacao: string, agrupadores: any[]): string;
|
|
4
|
+
static getTextoByEmpresa(operacao: string, empresas: any[]): string;
|
|
5
|
+
static getTextoByTag(operacao: string, tags: any[]): string;
|
|
6
|
+
static getTextoByFormaPagamento(operacao: string, formasPagamento: any[]): string;
|
|
7
|
+
static getTextoOperacao(operacao: string): string;
|
|
8
|
+
static getHTMLPill(color: string, texto: string): string;
|
|
9
9
|
}
|
|
@@ -1,100 +1,77 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
class
|
|
3
|
+
class HtmlBadgerHelper {
|
|
13
4
|
static getTextoByProduto(operacao, produtos) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
descriptionList.push(produto.descricao);
|
|
20
|
-
}
|
|
5
|
+
operacao = this.getTextoOperacao(operacao);
|
|
6
|
+
let descriptionList = [];
|
|
7
|
+
if (produtos.length > 0) {
|
|
8
|
+
for (let produto of produtos) {
|
|
9
|
+
descriptionList.push(produto.descricao);
|
|
21
10
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
11
|
+
}
|
|
12
|
+
else
|
|
13
|
+
descriptionList.push('TODOS');
|
|
14
|
+
return this.getHTMLPill('badge-primary', `Produto ${operacao} ${descriptionList.join(', ')}`);
|
|
26
15
|
}
|
|
27
16
|
static getTextoByAgrupadorEmpresa(operacao, agrupadores) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return this.getHTMLPill('badge-warning', `Agrupador de Empresa ${operacao} ${descriptionList.join(', ')}`);
|
|
35
|
-
});
|
|
17
|
+
operacao = this.getTextoOperacao(operacao);
|
|
18
|
+
let descriptionList = [];
|
|
19
|
+
for (let agrupador of agrupadores) {
|
|
20
|
+
descriptionList.push(agrupador.descricao);
|
|
21
|
+
}
|
|
22
|
+
return this.getHTMLPill('badge-warning', `Agrupador de Empresa ${operacao} ${descriptionList.join(', ')}`);
|
|
36
23
|
}
|
|
37
24
|
static getTextoByEmpresa(operacao, empresas) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
descriptionList.push(empresa.nom_empresa);
|
|
44
|
-
}
|
|
25
|
+
operacao = this.getTextoOperacao(operacao);
|
|
26
|
+
let descriptionList = [];
|
|
27
|
+
if (empresas.length > 0) {
|
|
28
|
+
for (let empresa of empresas) {
|
|
29
|
+
descriptionList.push(empresa.nom_empresa);
|
|
45
30
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
31
|
+
}
|
|
32
|
+
else
|
|
33
|
+
descriptionList.push('TODOS');
|
|
34
|
+
return this.getHTMLPill('badge-secondary', `Empresa ${operacao} ${descriptionList.join(', ')}`);
|
|
50
35
|
}
|
|
51
36
|
static getTextoByTag(operacao, tags) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return this.getHTMLPill('badge-light', `Tag ${operacao} ${descriptionList.join(', ')}`);
|
|
59
|
-
});
|
|
37
|
+
operacao = this.getTextoOperacao(operacao);
|
|
38
|
+
let descriptionList = [];
|
|
39
|
+
for (let tag of tags) {
|
|
40
|
+
descriptionList.push(tag.nome);
|
|
41
|
+
}
|
|
42
|
+
return this.getHTMLPill('badge-light', `Tag ${operacao} ${descriptionList.join(', ')}`);
|
|
60
43
|
}
|
|
61
44
|
static getTextoByFormaPagamento(operacao, formasPagamento) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
descriptionList.push(formaPagamento.descricao);
|
|
68
|
-
}
|
|
45
|
+
operacao = this.getTextoOperacao(operacao);
|
|
46
|
+
let descriptionList = [];
|
|
47
|
+
if (formasPagamento.length > 0) {
|
|
48
|
+
for (let formaPagamento of formasPagamento) {
|
|
49
|
+
descriptionList.push(formaPagamento.descricao);
|
|
69
50
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
});
|
|
51
|
+
}
|
|
52
|
+
else
|
|
53
|
+
descriptionList.push('TODOS');
|
|
54
|
+
return this.getHTMLPill('badge-info', `Forma Pagamento ${operacao} ${descriptionList.join(', ')}`);
|
|
74
55
|
}
|
|
75
56
|
static getTextoOperacao(operacao) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return resultado;
|
|
92
|
-
});
|
|
57
|
+
let resultado = operacao;
|
|
58
|
+
switch (operacao) {
|
|
59
|
+
case '=':
|
|
60
|
+
operacao = 'igual';
|
|
61
|
+
break;
|
|
62
|
+
case '<>':
|
|
63
|
+
operacao = 'diferente';
|
|
64
|
+
break;
|
|
65
|
+
case 'contem':
|
|
66
|
+
operacao = 'contem';
|
|
67
|
+
break;
|
|
68
|
+
default:
|
|
69
|
+
operacao = 'ERROR';
|
|
70
|
+
}
|
|
71
|
+
return resultado;
|
|
93
72
|
}
|
|
94
73
|
static getHTMLPill(color, texto) {
|
|
95
|
-
return
|
|
96
|
-
return `<span class="badge ${color}">${texto}</span>`;
|
|
97
|
-
});
|
|
74
|
+
return `<span class="badge ${color}">${texto}</span>`;
|
|
98
75
|
}
|
|
99
76
|
}
|
|
100
|
-
exports.default =
|
|
77
|
+
exports.default = HtmlBadgerHelper;
|