@churchapps/apphelper 0.1.26 → 0.1.27
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/dist/components/reporting/ChartReport.d.ts.map +1 -1
- package/dist/components/reporting/ChartReport.js +5 -16
- package/dist/components/reporting/ChartReport.js.map +1 -1
- package/dist/components/reporting/TableReport.d.ts.map +1 -1
- package/dist/components/reporting/TableReport.js +4 -19
- package/dist/components/reporting/TableReport.js.map +1 -1
- package/dist/components/reporting/TreeReport.d.ts.map +1 -1
- package/dist/components/reporting/TreeReport.js +5 -16
- package/dist/components/reporting/TreeReport.js.map +1 -1
- package/dist/helpers/ErrorHelper.d.ts.map +1 -1
- package/dist/helpers/ErrorHelper.js +2 -1
- package/dist/helpers/ErrorHelper.js.map +1 -1
- package/dist/helpers/ReportHelper.d.ts +5 -0
- package/dist/helpers/ReportHelper.d.ts.map +1 -0
- package/dist/helpers/ReportHelper.js +38 -0
- package/dist/helpers/ReportHelper.js.map +1 -0
- package/package.json +1 -1
- package/src/components/reporting/ChartReport.tsx +6 -18
- package/src/components/reporting/TableReport.tsx +5 -20
- package/src/components/reporting/TreeReport.tsx +6 -16
- package/src/helpers/ErrorHelper.ts +3 -1
- package/src/helpers/ReportHelper.ts +35 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartReport.d.ts","sourceRoot":"","sources":["../../../src/components/reporting/ChartReport.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,
|
|
1
|
+
{"version":3,"file":"ChartReport.d.ts","sourceRoot":"","sources":["../../../src/components/reporting/ChartReport.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGhF,UAAU,KAAK;IAAG,YAAY,EAAE,qBAAqB,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE;AAEtF,eAAO,MAAM,WAAW,UAAW,KAAK,sBA8EvC,CAAA"}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ChartReport = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const react_google_charts_1 = require("react-google-charts");
|
|
9
|
-
const
|
|
9
|
+
const ReportHelper_1 = require("../../helpers/ReportHelper");
|
|
10
10
|
const ChartReport = (props) => {
|
|
11
11
|
var _a;
|
|
12
12
|
let rows = [];
|
|
@@ -20,7 +20,7 @@ const ChartReport = (props) => {
|
|
|
20
20
|
const result = [];
|
|
21
21
|
const uniqueValues = [];
|
|
22
22
|
props.reportResult.table.forEach(d => {
|
|
23
|
-
const val = getField(props.output.columns[1], d);
|
|
23
|
+
const val = ReportHelper_1.ReportHelper.getField(props.output.columns[1], d);
|
|
24
24
|
if (uniqueValues.indexOf(val) === -1)
|
|
25
25
|
uniqueValues.push(val);
|
|
26
26
|
});
|
|
@@ -41,8 +41,8 @@ const ChartReport = (props) => {
|
|
|
41
41
|
const transformData = (headers) => {
|
|
42
42
|
const result = [];
|
|
43
43
|
props.reportResult.table.forEach(d => {
|
|
44
|
-
const firstVal = getField(props.output.columns[0], d);
|
|
45
|
-
const secondVal = getField(props.output.columns[1], d);
|
|
44
|
+
const firstVal = ReportHelper_1.ReportHelper.getField(props.output.columns[0], d);
|
|
45
|
+
const secondVal = ReportHelper_1.ReportHelper.getField(props.output.columns[1], d);
|
|
46
46
|
const headerIndex = getHeaderIndex(headers, secondVal);
|
|
47
47
|
let row = [];
|
|
48
48
|
if (result.length === 0 || firstVal !== result[result.length - 1][0]) {
|
|
@@ -70,21 +70,10 @@ const ChartReport = (props) => {
|
|
|
70
70
|
rows = [];
|
|
71
71
|
rows.push([props.output.columns[0].header, props.output.columns[1].header]);
|
|
72
72
|
props.reportResult.table.forEach(d => {
|
|
73
|
-
rows.push([getField(props.output.columns[0], d), parseFloat(getField(props.output.columns[1], d))]);
|
|
73
|
+
rows.push([ReportHelper_1.ReportHelper.getField(props.output.columns[0], d), parseFloat(ReportHelper_1.ReportHelper.getField(props.output.columns[1], d))]);
|
|
74
74
|
});
|
|
75
75
|
return rows;
|
|
76
76
|
};
|
|
77
|
-
const getField = (column, dataRow) => {
|
|
78
|
-
var _a;
|
|
79
|
-
let result = ((_a = dataRow[column.value]) === null || _a === void 0 ? void 0 : _a.toString()) || "";
|
|
80
|
-
switch (column.formatter) {
|
|
81
|
-
case "date":
|
|
82
|
-
let dt = new Date(result);
|
|
83
|
-
result = helpers_1.DateHelper.prettyDate(dt);
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
return result;
|
|
87
|
-
};
|
|
88
77
|
let result = react_1.default.createElement("p", null, "There is no data to display");
|
|
89
78
|
if (((_a = props.reportResult.table) === null || _a === void 0 ? void 0 : _a.length) > 0)
|
|
90
79
|
result = (react_1.default.createElement(react_google_charts_1.Chart, { chartType: "ColumnChart", data: getChartData(), width: "100%", height: "400px", options: { height: 400, legend: { position: "top", maxLines: 3 }, bar: { groupWidth: "75%" }, isStacked: true } }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartReport.js","sourceRoot":"","sources":["../../../src/components/reporting/ChartReport.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,6DAA4C;AAE5C,
|
|
1
|
+
{"version":3,"file":"ChartReport.js","sourceRoot":"","sources":["../../../src/components/reporting/ChartReport.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,6DAA4C;AAE5C,6DAA0D;AAInD,MAAM,WAAW,GAAG,CAAC,KAAY,EAAE,EAAE;;IAC1C,IAAI,IAAI,GAAQ,EAAE,CAAC;IAEnB,MAAM,YAAY,GAAG,GAAG,EAAE;QACxB,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,aAAa,EAAE,CAAC;;YAC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;IAE1P,OAAO,MAAM,CAAC;AAEhB,CAAC,CAAA;AA9EY,QAAA,WAAW,eA8EvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableReport.d.ts","sourceRoot":"","sources":["../../../src/components/reporting/TableReport.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"TableReport.d.ts","sourceRoot":"","sources":["../../../src/components/reporting/TableReport.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAIhF,UAAU,KAAK;IAAG,YAAY,EAAE,qBAAqB,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE;AAEtF,eAAO,MAAM,WAAW,UAAW,KAAK,sBAkCvC,CAAA"}
|
|
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.TableReport = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const helpers_1 = require("../../helpers");
|
|
9
8
|
const material_1 = require("@mui/material");
|
|
9
|
+
const ReportHelper_1 = require("../../helpers/ReportHelper");
|
|
10
10
|
const TableReport = (props) => {
|
|
11
11
|
const getHeaders = () => {
|
|
12
12
|
const result = [];
|
|
13
13
|
props.output.columns.forEach((c, i) => {
|
|
14
|
-
result.push(react_1.default.createElement(
|
|
14
|
+
result.push(react_1.default.createElement(material_1.TableCell, { key: i, style: { fontWeight: "bold" } }, c.header));
|
|
15
15
|
});
|
|
16
16
|
return result;
|
|
17
17
|
};
|
|
@@ -20,28 +20,13 @@ const TableReport = (props) => {
|
|
|
20
20
|
props.reportResult.table.forEach(d => {
|
|
21
21
|
const row = [];
|
|
22
22
|
props.output.columns.forEach(c => {
|
|
23
|
-
row.push(react_1.default.createElement(material_1.TableCell, null, getField(c, d)));
|
|
23
|
+
row.push(react_1.default.createElement(material_1.TableCell, null, ReportHelper_1.ReportHelper.getField(c, d)));
|
|
24
24
|
});
|
|
25
25
|
result.push(react_1.default.createElement(material_1.TableRow, null, row));
|
|
26
26
|
});
|
|
27
27
|
return result;
|
|
28
28
|
};
|
|
29
|
-
|
|
30
|
-
var _a;
|
|
31
|
-
let result = "";
|
|
32
|
-
try {
|
|
33
|
-
result = ((_a = dataRow[column.value]) === null || _a === void 0 ? void 0 : _a.toString()) || "";
|
|
34
|
-
}
|
|
35
|
-
catch (_b) { }
|
|
36
|
-
switch (column.formatter) {
|
|
37
|
-
case "date":
|
|
38
|
-
let dt = new Date(result);
|
|
39
|
-
result = helpers_1.DateHelper.prettyDate(dt);
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
return result;
|
|
43
|
-
};
|
|
44
|
-
return (react_1.default.createElement(material_1.Table, { className: "table" },
|
|
29
|
+
return (react_1.default.createElement(material_1.Table, null,
|
|
45
30
|
react_1.default.createElement(material_1.TableHead, null,
|
|
46
31
|
react_1.default.createElement(material_1.TableRow, null, getHeaders())),
|
|
47
32
|
react_1.default.createElement(material_1.TableBody, null, getRows())));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableReport.js","sourceRoot":"","sources":["../../../src/components/reporting/TableReport.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,
|
|
1
|
+
{"version":3,"file":"TableReport.js","sourceRoot":"","sources":["../../../src/components/reporting/TableReport.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,4CAAiF;AACjF,6DAA0D;AAInD,MAAM,WAAW,GAAG,CAAC,KAAY,EAAE,EAAE;IAE1C,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,MAAM,MAAM,GAAkB,EAAE,CAAA;QAChC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACpC,MAAM,CAAC,IAAI,CAAC,8BAAC,oBAAS,IAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,EAAC,UAAU,EAAC,MAAM,EAAC,IAAG,CAAC,CAAC,MAAM,CAAa,CAAC,CAAC;QACrF,CAAC,CAAC,CAAA;QACF,OAAO,MAAM,CAAC;IAChB,CAAC,CAAA;IAED,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,MAAM,MAAM,GAAkB,EAAE,CAAA;QAChC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACnC,MAAM,GAAG,GAAkB,EAAE,CAAC;YAC9B,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;gBAC/B,GAAG,CAAC,IAAI,CAAC,8BAAC,oBAAS,QAAE,2BAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAa,CAAC,CAAC;YACjE,CAAC,CAAC,CAAA;YACF,MAAM,CAAC,IAAI,CAAC,8BAAC,mBAAQ,QAAE,GAAG,CAAY,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC,CAAA;IAED,OAAO,CACL,8BAAC,gBAAK;QACJ,8BAAC,oBAAS;YACR,8BAAC,mBAAQ,QACN,UAAU,EAAE,CACJ,CACD;QACZ,8BAAC,oBAAS,QACP,OAAO,EAAE,CACA,CACN,CACT,CAAC;AACJ,CAAC,CAAA;AAlCY,QAAA,WAAW,eAkCvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeReport.d.ts","sourceRoot":"","sources":["../../../src/components/reporting/TreeReport.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"TreeReport.d.ts","sourceRoot":"","sources":["../../../src/components/reporting/TreeReport.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAI/E,UAAU,KAAK;IAAG,YAAY,EAAE,qBAAqB,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE;AAEtF,eAAO,MAAM,UAAU,UAAW,KAAK,sBA6FtC,CAAA"}
|
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.TreeReport = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const helpers_1 = require("../../helpers");
|
|
9
8
|
const material_1 = require("@mui/material");
|
|
9
|
+
const ReportHelper_1 = require("../../helpers/ReportHelper");
|
|
10
10
|
const TreeReport = (props) => {
|
|
11
11
|
const getPreviousGroupingCount = (depth) => {
|
|
12
12
|
let result = 0;
|
|
@@ -38,9 +38,9 @@ const TreeReport = (props) => {
|
|
|
38
38
|
for (let i = totalGroupings; i < columns.length; i++) {
|
|
39
39
|
const c = columns[i];
|
|
40
40
|
if (i === totalGroupings)
|
|
41
|
-
row.push(react_1.default.createElement(material_1.TableCell, { style: { paddingLeft: 30 * totalGroupings } }, getField(c, d)));
|
|
41
|
+
row.push(react_1.default.createElement(material_1.TableCell, { style: { paddingLeft: 30 * totalGroupings } }, ReportHelper_1.ReportHelper.getField(c, d)));
|
|
42
42
|
else
|
|
43
|
-
row.push(react_1.default.createElement(material_1.TableCell, null, getField(c, d)));
|
|
43
|
+
row.push(react_1.default.createElement(material_1.TableCell, null, ReportHelper_1.ReportHelper.getField(c, d)));
|
|
44
44
|
}
|
|
45
45
|
result.push(react_1.default.createElement(material_1.TableRow, null, row));
|
|
46
46
|
previousData = d;
|
|
@@ -63,9 +63,9 @@ const TreeReport = (props) => {
|
|
|
63
63
|
const c = props.output.columns[i];
|
|
64
64
|
const className = "heading" + (groupNumber + 1);
|
|
65
65
|
if (i === prevCols && i > 0)
|
|
66
|
-
outputRow.push(react_1.default.createElement(material_1.TableCell, { className: className, style: { paddingLeft: 30 * groupNumber } }, getField(c, row)));
|
|
66
|
+
outputRow.push(react_1.default.createElement(material_1.TableCell, { className: className, style: { paddingLeft: 30 * groupNumber } }, ReportHelper_1.ReportHelper.getField(c, row)));
|
|
67
67
|
else
|
|
68
|
-
outputRow.push(react_1.default.createElement(material_1.TableCell, { className: className }, getField(c, row)));
|
|
68
|
+
outputRow.push(react_1.default.createElement(material_1.TableCell, { className: className }, ReportHelper_1.ReportHelper.getField(c, row)));
|
|
69
69
|
}
|
|
70
70
|
return (react_1.default.createElement(material_1.TableRow, null, outputRow));
|
|
71
71
|
};
|
|
@@ -85,17 +85,6 @@ const TreeReport = (props) => {
|
|
|
85
85
|
}
|
|
86
86
|
return firstGroupModified;
|
|
87
87
|
};
|
|
88
|
-
const getField = (column, dataRow) => {
|
|
89
|
-
var _a;
|
|
90
|
-
let result = ((_a = dataRow[column.value]) === null || _a === void 0 ? void 0 : _a.toString()) || "";
|
|
91
|
-
switch (column.formatter) {
|
|
92
|
-
case "date":
|
|
93
|
-
let dt = new Date(result);
|
|
94
|
-
result = helpers_1.DateHelper.prettyDate(dt);
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
return result;
|
|
98
|
-
};
|
|
99
88
|
return (react_1.default.createElement(material_1.Table, { className: "table table-sm report" },
|
|
100
89
|
react_1.default.createElement(material_1.TableHead, { className: "thead-dark" },
|
|
101
90
|
react_1.default.createElement(material_1.TableRow, null, getHeaders())),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeReport.js","sourceRoot":"","sources":["../../../src/components/reporting/TreeReport.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,
|
|
1
|
+
{"version":3,"file":"TreeReport.js","sourceRoot":"","sources":["../../../src/components/reporting/TreeReport.tsx"],"names":[],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AQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAC,CAAC;IACpG,MAAM,CAAC,kBAAkB,EAAC,CAAC,QAAQ,EAAC,iBAAiB,KAAK,IAAI,CAAC;IAE/D,MAAM,CAAC,IAAI,eAAe,MAAM,sBAAsB,iCAA+B,iBAAiB,KAAK,IAAI,UAG9G;IAED,MAAM,CAAC,QAAQ,cAAc,MAAM,WAAU,MAAM,WAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"ErrorHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/ErrorHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAIhF,qBAAa,WAAW;IAEtB,MAAM,CAAC,UAAU,EAAC,MAAM;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAC,CAAC;IACpG,MAAM,CAAC,kBAAkB,EAAC,CAAC,QAAQ,EAAC,iBAAiB,KAAK,IAAI,CAAC;IAE/D,MAAM,CAAC,IAAI,eAAe,MAAM,sBAAsB,iCAA+B,iBAAiB,KAAK,IAAI,UAG9G;IAED,MAAM,CAAC,QAAQ,cAAc,MAAM,WAAU,MAAM,WAAU,MAAM,UAqBlE;CAEF"}
|
|
@@ -24,7 +24,8 @@ ErrorHelper.logError = (errorType, message, details) => {
|
|
|
24
24
|
message: message,
|
|
25
25
|
details: details
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
console.log("ERROR LOG", log);
|
|
28
|
+
if (log.errorType === "401" && log.message.indexOf("/users/login") > -1)
|
|
28
29
|
return;
|
|
29
30
|
ApiHelper_1.ApiHelper.postAnonymous("/errors", [log], "MembershipApi");
|
|
30
31
|
if (_a.customErrorHandler)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorHelper.js","sourceRoot":"","sources":["../../src/helpers/ErrorHelper.ts"],"names":[],"mappings":";;;;AACA,2CAAwC;AAGxC,MAAa,WAAW;;AAAxB,
|
|
1
|
+
{"version":3,"file":"ErrorHelper.js","sourceRoot":"","sources":["../../src/helpers/ErrorHelper.ts"],"names":[],"mappings":";;;;AACA,2CAAwC;AAGxC,MAAa,WAAW;;AAAxB,kCAiCC;;AA5BQ,gBAAI,GAAG,CAAC,UAAuC,EAAE,kBAAuD,EAAE,EAAE;IACjH,EAAW,CAAC,UAAU,GAAG,UAAU,CAAC;IACpC,EAAW,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AACtD,CAAC,AAHU,CAGV;AAEM,oBAAQ,GAAG,CAAC,SAAgB,EAAE,OAAc,EAAE,OAAc,EAAE,EAAE;IACrE,IAAI,EAAI,CAAC,UAAU,EACnB;QACE,MAAM,IAAI,GAAG,EAAI,CAAC,UAAU,EAAE,CAAC;QAC/B,MAAM,GAAG,GAAqB;YAC5B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE,OAAO;SACjB,CAAA;QAED,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QAE9B,IAAI,GAAG,CAAC,SAAS,KAAG,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,GAAC,CAAC,CAAC;YAAE,OAAO;QAC5E,qBAAS,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,EAAE,eAAe,CAAC,CAAC;QAC3D,IAAI,EAAW,CAAC,kBAAkB;YAAE,EAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;KACzE;AACH,CAAC,AArBc,CAqBd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReportHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/ReportHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,qBAAa,YAAY;IAEvB,MAAM,CAAC,QAAQ,WAAY,eAAe,WAAW,GAAG,YA0BvD;CAEF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportHelper = void 0;
|
|
4
|
+
const DateHelper_1 = require("./DateHelper");
|
|
5
|
+
class ReportHelper {
|
|
6
|
+
}
|
|
7
|
+
exports.ReportHelper = ReportHelper;
|
|
8
|
+
ReportHelper.getField = (column, dataRow) => {
|
|
9
|
+
var _a;
|
|
10
|
+
let result = "";
|
|
11
|
+
try {
|
|
12
|
+
result = ((_a = dataRow[column.value]) === null || _a === void 0 ? void 0 : _a.toString()) || "";
|
|
13
|
+
}
|
|
14
|
+
catch (_b) { }
|
|
15
|
+
switch (column.formatter) {
|
|
16
|
+
case "date":
|
|
17
|
+
let dt = new Date(result);
|
|
18
|
+
result = DateHelper_1.DateHelper.prettyDate(dt);
|
|
19
|
+
break;
|
|
20
|
+
case "number":
|
|
21
|
+
try {
|
|
22
|
+
const num = parseFloat(result);
|
|
23
|
+
result = num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
24
|
+
}
|
|
25
|
+
catch (_c) { }
|
|
26
|
+
break;
|
|
27
|
+
case "dollars":
|
|
28
|
+
try {
|
|
29
|
+
const num = parseFloat(result);
|
|
30
|
+
const usd = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" });
|
|
31
|
+
result = usd.format(num).replace(".00", "");
|
|
32
|
+
}
|
|
33
|
+
catch (_d) { }
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=ReportHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReportHelper.js","sourceRoot":"","sources":["../../src/helpers/ReportHelper.ts"],"names":[],"mappings":";;;AAEA,6CAA0C;AAE1C,MAAa,YAAY;;AAAzB,oCA8BC;AA5BQ,qBAAQ,GAAG,CAAC,MAAuB,EAAE,OAAY,EAAE,EAAE;;IAC1D,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,IAAI;QACF,MAAM,GAAG,CAAA,MAAA,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,0CAAE,QAAQ,EAAE,KAAI,EAAE,CAAC;KAClD;IAAC,WAAM,GAAG;IAEX,QAAQ,MAAM,CAAC,SAAS,EAAE;QACxB,KAAK,MAAM;YACT,IAAI,EAAE,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;YAC1B,MAAM,GAAG,uBAAU,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YACnC,MAAM;QACR,KAAK,QAAQ;YACX,IAAI;gBACF,MAAM,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;gBAC/B,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;aAC/D;YAAC,WAAM,GAAE;YACV,MAAM;QACR,KAAK,SAAS;YACZ,IAAI;gBACF,MAAM,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;gBAC/B,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,KAAK,EAAC,UAAU,EAAE,QAAQ,EAAC,KAAK,EAAE,CAAC,CAAC;gBACjF,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;aAC7C;YAAC,WAAM,GAAE;YACV,MAAM;KACT;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Chart } from "react-google-charts";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { ReportOutputInterface, ReportResultInterface } from "../../interfaces";
|
|
4
|
+
import { ReportHelper } from "../../helpers/ReportHelper";
|
|
5
5
|
|
|
6
6
|
interface Props { reportResult: ReportResultInterface, output: ReportOutputInterface }
|
|
7
7
|
|
|
@@ -18,7 +18,7 @@ export const ChartReport = (props: Props) => {
|
|
|
18
18
|
const uniqueValues: string[] = [];
|
|
19
19
|
|
|
20
20
|
props.reportResult.table.forEach(d => {
|
|
21
|
-
const val = getField(props.output.columns[1], d);
|
|
21
|
+
const val = ReportHelper.getField(props.output.columns[1], d);
|
|
22
22
|
if (uniqueValues.indexOf(val) === -1) uniqueValues.push(val);
|
|
23
23
|
});
|
|
24
24
|
|
|
@@ -41,8 +41,8 @@ export const ChartReport = (props: Props) => {
|
|
|
41
41
|
const transformData = (headers: string[]) => {
|
|
42
42
|
const result: any[] = [];
|
|
43
43
|
props.reportResult.table.forEach(d => {
|
|
44
|
-
const firstVal = getField(props.output.columns[0], d);
|
|
45
|
-
const secondVal = getField(props.output.columns[1], d);
|
|
44
|
+
const firstVal = ReportHelper.getField(props.output.columns[0], d);
|
|
45
|
+
const secondVal = ReportHelper.getField(props.output.columns[1], d);
|
|
46
46
|
const headerIndex = getHeaderIndex(headers, secondVal);
|
|
47
47
|
|
|
48
48
|
let row: any[] = []
|
|
@@ -73,23 +73,11 @@ export const ChartReport = (props: Props) => {
|
|
|
73
73
|
rows = [];
|
|
74
74
|
rows.push([props.output.columns[0].header, props.output.columns[1].header]);
|
|
75
75
|
props.reportResult.table.forEach(d => {
|
|
76
|
-
rows.push([getField(props.output.columns[0], d), parseFloat(getField(props.output.columns[1], d))])
|
|
76
|
+
rows.push([ReportHelper.getField(props.output.columns[0], d), parseFloat(ReportHelper.getField(props.output.columns[1], d))])
|
|
77
77
|
});
|
|
78
78
|
return rows;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
const getField = (column: ColumnInterface, dataRow: any) => {
|
|
82
|
-
let result = dataRow[column.value]?.toString() || "";
|
|
83
|
-
|
|
84
|
-
switch (column.formatter) {
|
|
85
|
-
case "date":
|
|
86
|
-
let dt = new Date(result);
|
|
87
|
-
result = DateHelper.prettyDate(dt);
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
return result;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
81
|
let result = <p>There is no data to display</p>
|
|
94
82
|
if (props.reportResult.table?.length > 0) result = (<Chart chartType="ColumnChart" data={getChartData()} width="100%" height="400px" options={{ height: 400, legend: { position: "top", maxLines: 3 }, bar: { groupWidth: "75%" }, isStacked: true }} />);
|
|
95
83
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { DateHelper } from "../../helpers";
|
|
2
|
+
import { ReportOutputInterface, ReportResultInterface } from "../../interfaces";
|
|
4
3
|
import { Table, TableBody, TableRow, TableCell, TableHead } from "@mui/material";
|
|
4
|
+
import { ReportHelper } from "../../helpers/ReportHelper";
|
|
5
5
|
|
|
6
6
|
interface Props { reportResult: ReportResultInterface, output: ReportOutputInterface }
|
|
7
7
|
|
|
@@ -10,7 +10,7 @@ export const TableReport = (props: Props) => {
|
|
|
10
10
|
const getHeaders = () => {
|
|
11
11
|
const result: JSX.Element[] = []
|
|
12
12
|
props.output.columns.forEach((c, i) => {
|
|
13
|
-
result.push(<
|
|
13
|
+
result.push(<TableCell key={i} style={{fontWeight:"bold"}}>{c.header}</TableCell>);
|
|
14
14
|
})
|
|
15
15
|
return result;
|
|
16
16
|
}
|
|
@@ -20,30 +20,15 @@ export const TableReport = (props: Props) => {
|
|
|
20
20
|
props.reportResult.table.forEach(d => {
|
|
21
21
|
const row: JSX.Element[] = [];
|
|
22
22
|
props.output.columns.forEach(c => {
|
|
23
|
-
row.push(<TableCell>{getField(c, d)}</TableCell>);
|
|
23
|
+
row.push(<TableCell>{ReportHelper.getField(c, d)}</TableCell>);
|
|
24
24
|
})
|
|
25
25
|
result.push(<TableRow>{row}</TableRow>);
|
|
26
26
|
});
|
|
27
27
|
return result;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const getField = (column: ColumnInterface, dataRow: any) => {
|
|
31
|
-
let result = ""
|
|
32
|
-
try {
|
|
33
|
-
result = dataRow[column.value]?.toString() || "";
|
|
34
|
-
} catch { }
|
|
35
|
-
|
|
36
|
-
switch (column.formatter) {
|
|
37
|
-
case "date":
|
|
38
|
-
let dt = new Date(result);
|
|
39
|
-
result = DateHelper.prettyDate(dt);
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
30
|
return (
|
|
46
|
-
<Table
|
|
31
|
+
<Table>
|
|
47
32
|
<TableHead>
|
|
48
33
|
<TableRow>
|
|
49
34
|
{getHeaders()}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { DateHelper } from "../../helpers"
|
|
2
|
+
import { ReportOutputInterface, ReportResultInterface } from "../../interfaces"
|
|
4
3
|
import { Table, TableBody, TableRow, TableCell, TableHead } from "@mui/material"
|
|
4
|
+
import { ReportHelper } from "../../helpers/ReportHelper";
|
|
5
5
|
|
|
6
6
|
interface Props { reportResult: ReportResultInterface, output: ReportOutputInterface }
|
|
7
7
|
|
|
@@ -36,8 +36,8 @@ export const TreeReport = (props: Props) => {
|
|
|
36
36
|
groupingRows.forEach(gr => result.push(gr));
|
|
37
37
|
for (let i = totalGroupings; i < columns.length; i++) {
|
|
38
38
|
const c = columns[i];
|
|
39
|
-
if (i === totalGroupings) row.push(<TableCell style={{ paddingLeft: 30 * totalGroupings }}>{getField(c, d)}</TableCell>);
|
|
40
|
-
else row.push(<TableCell>{getField(c, d)}</TableCell>);
|
|
39
|
+
if (i === totalGroupings) row.push(<TableCell style={{ paddingLeft: 30 * totalGroupings }}>{ReportHelper.getField(c, d)}</TableCell>);
|
|
40
|
+
else row.push(<TableCell>{ReportHelper.getField(c, d)}</TableCell>);
|
|
41
41
|
}
|
|
42
42
|
result.push(<TableRow>{row}</TableRow>);
|
|
43
43
|
previousData = d;
|
|
@@ -61,8 +61,8 @@ export const TreeReport = (props: Props) => {
|
|
|
61
61
|
for (let i = prevCols; i < prevCols + g; i++) {
|
|
62
62
|
const c = props.output.columns[i];
|
|
63
63
|
const className = "heading" + (groupNumber + 1);
|
|
64
|
-
if (i === prevCols && i > 0) outputRow.push(<TableCell className={className} style={{ paddingLeft: 30 * groupNumber }}>{getField(c, row)}</TableCell>);
|
|
65
|
-
else outputRow.push(<TableCell className={className}>{getField(c, row)}</TableCell>);
|
|
64
|
+
if (i === prevCols && i > 0) outputRow.push(<TableCell className={className} style={{ paddingLeft: 30 * groupNumber }}>{ReportHelper.getField(c, row)}</TableCell>);
|
|
65
|
+
else outputRow.push(<TableCell className={className}>{ReportHelper.getField(c, row)}</TableCell>);
|
|
66
66
|
}
|
|
67
67
|
return (<TableRow>{outputRow}</TableRow>);
|
|
68
68
|
}
|
|
@@ -85,16 +85,6 @@ export const TreeReport = (props: Props) => {
|
|
|
85
85
|
return firstGroupModified;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
const getField = (column: ColumnInterface, dataRow: any) => {
|
|
89
|
-
let result = dataRow[column.value]?.toString() || "";
|
|
90
|
-
switch (column.formatter) {
|
|
91
|
-
case "date":
|
|
92
|
-
let dt = new Date(result);
|
|
93
|
-
result = DateHelper.prettyDate(dt);
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
return result;
|
|
97
|
-
}
|
|
98
88
|
|
|
99
89
|
return (
|
|
100
90
|
<Table className="table table-sm report">
|
|
@@ -27,7 +27,9 @@ export class ErrorHelper {
|
|
|
27
27
|
details: details
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
console.log("ERROR LOG", log);
|
|
31
|
+
|
|
32
|
+
if (log.errorType==="401" && log.message.indexOf("/users/login")>-1) return;
|
|
31
33
|
ApiHelper.postAnonymous("/errors", [log], "MembershipApi");
|
|
32
34
|
if (ErrorHelper.customErrorHandler) ErrorHelper.customErrorHandler(log);
|
|
33
35
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { parse } from "path";
|
|
2
|
+
import { ColumnInterface } from "../interfaces";
|
|
3
|
+
import { DateHelper } from "./DateHelper";
|
|
4
|
+
|
|
5
|
+
export class ReportHelper {
|
|
6
|
+
|
|
7
|
+
static getField = (column: ColumnInterface, dataRow: any) => {
|
|
8
|
+
let result = ""
|
|
9
|
+
try {
|
|
10
|
+
result = dataRow[column.value]?.toString() || "";
|
|
11
|
+
} catch { }
|
|
12
|
+
|
|
13
|
+
switch (column.formatter) {
|
|
14
|
+
case "date":
|
|
15
|
+
let dt = new Date(result);
|
|
16
|
+
result = DateHelper.prettyDate(dt);
|
|
17
|
+
break;
|
|
18
|
+
case "number":
|
|
19
|
+
try {
|
|
20
|
+
const num = parseFloat(result);
|
|
21
|
+
result = num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
22
|
+
} catch {}
|
|
23
|
+
break;
|
|
24
|
+
case "dollars":
|
|
25
|
+
try {
|
|
26
|
+
const num = parseFloat(result);
|
|
27
|
+
const usd = new Intl.NumberFormat("en-US", { style:"currency", currency:"USD" });
|
|
28
|
+
result = usd.format(num).replace(".00", "");
|
|
29
|
+
} catch {}
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|