sim-node-lib 0.0.94 → 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.
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class HtmlBadgerHelper {
|
|
4
|
+
static getTextoByProduto(operacao, produtos) {
|
|
5
|
+
operacao = this.getTextoOperacao(operacao);
|
|
6
|
+
let descriptionList = [];
|
|
7
|
+
if (produtos.length > 0) {
|
|
8
|
+
for (let produto of produtos) {
|
|
9
|
+
descriptionList.push(produto.descricao);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
else
|
|
13
|
+
descriptionList.push('TODOS');
|
|
14
|
+
return this.getHTMLPill('badge-primary', `Produto ${operacao} ${descriptionList.join(', ')}`);
|
|
15
|
+
}
|
|
16
|
+
static getTextoByAgrupadorEmpresa(operacao, agrupadores) {
|
|
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(', ')}`);
|
|
23
|
+
}
|
|
24
|
+
static getTextoByEmpresa(operacao, empresas) {
|
|
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);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else
|
|
33
|
+
descriptionList.push('TODOS');
|
|
34
|
+
return this.getHTMLPill('badge-secondary', `Empresa ${operacao} ${descriptionList.join(', ')}`);
|
|
35
|
+
}
|
|
36
|
+
static getTextoByTag(operacao, tags) {
|
|
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(', ')}`);
|
|
43
|
+
}
|
|
44
|
+
static getTextoByFormaPagamento(operacao, formasPagamento) {
|
|
45
|
+
operacao = this.getTextoOperacao(operacao);
|
|
46
|
+
let descriptionList = [];
|
|
47
|
+
if (formasPagamento.length > 0) {
|
|
48
|
+
for (let formaPagamento of formasPagamento) {
|
|
49
|
+
descriptionList.push(formaPagamento.descricao);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else
|
|
53
|
+
descriptionList.push('TODOS');
|
|
54
|
+
return this.getHTMLPill('badge-info', `Forma Pagamento ${operacao} ${descriptionList.join(', ')}`);
|
|
55
|
+
}
|
|
56
|
+
static getTextoOperacao(operacao) {
|
|
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;
|
|
72
|
+
}
|
|
73
|
+
static getHTMLPill(color, texto) {
|
|
74
|
+
return `<span class="badge ${color}">${texto}</span>`;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.default = HtmlBadgerHelper;
|