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