contentoh-components-library 21.2.53 → 21.2.55

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.
@@ -38,7 +38,8 @@ var DashboardMetric = function DashboardMetric(_ref) {
38
38
  displayLegend = _ref$displayLegend === void 0 ? false : _ref$displayLegend,
39
39
  _ref$showPercent = _ref.showPercent,
40
40
  showPercent = _ref$showPercent === void 0 ? false : _ref$showPercent,
41
- borderColor = _ref.borderColor;
41
+ borderColor = _ref.borderColor,
42
+ total = _ref.total;
42
43
  var labels = type === "doughnut" ? Object.keys(dataObject).map(function (key) {
43
44
  return (0, _dashboardMetricUtils.getFullStatus)(key);
44
45
  }) : Object.keys(dataObject);
@@ -95,9 +96,7 @@ var DashboardMetric = function DashboardMetric(_ref) {
95
96
  fontSize: 25,
96
97
  fontColor: "#707070",
97
98
  textAlign: "center",
98
- value: (values === null || values === void 0 ? void 0 : values.reduce(function (a, b) {
99
- return a + b;
100
- })) || 0
99
+ value: total || 0
101
100
  }
102
101
  },
103
102
  scales: (0, _defineProperty2.default)({}, scale, {
@@ -130,6 +130,11 @@ var Dashboard = function Dashboard(_ref) {
130
130
  applicantsFilter = _useState30[0],
131
131
  setApplicantsFilter = _useState30[1];
132
132
 
133
+ var _useState31 = (0, _react.useState)(0),
134
+ _useState32 = (0, _slicedToArray2.default)(_useState31, 2),
135
+ totalCount = _useState32[0],
136
+ setTotalCount = _useState32[1];
137
+
133
138
  var loadProductVersions = /*#__PURE__*/function () {
134
139
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(queryObject) {
135
140
  var byStatus,
@@ -264,10 +269,11 @@ var Dashboard = function Dashboard(_ref) {
264
269
  label: "Productos terminados",
265
270
  value: ACA
266
271
  }]);
272
+ setTotalCount(orders.total);
267
273
  delete orders.total;
268
274
  setProductsByStatus(orders);
269
275
 
270
- case 13:
276
+ case 14:
271
277
  case "end":
272
278
  return _context3.stop();
273
279
  }
@@ -533,7 +539,8 @@ var Dashboard = function Dashboard(_ref) {
533
539
  type: "doughnut",
534
540
  displayLegend: true,
535
541
  showPercent: true,
536
- displayScale: false
542
+ displayScale: false,
543
+ total: totalCount
537
544
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DashboardMetric.DashboardMetric, {
538
545
  label: "Productos solicitados",
539
546
  description: "Filtra los productos solicitados por fecha y alcance para revisar rápidamente el flujo de trabajo.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.2.53",
3
+ "version": "21.2.55",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -18,6 +18,7 @@ export const DashboardMetric = ({
18
18
  displayLegend = false,
19
19
  showPercent = false,
20
20
  borderColor,
21
+ total,
21
22
  }) => {
22
23
  const labels =
23
24
  type === "doughnut"
@@ -75,7 +76,7 @@ export const DashboardMetric = ({
75
76
  fontSize: 25,
76
77
  fontColor: "#707070",
77
78
  textAlign: "center",
78
- value: values?.reduce((a, b) => a + b) || 0,
79
+ value: total || 0,
79
80
  },
80
81
  },
81
82
  scales: {
@@ -38,6 +38,7 @@ export const Dashboard = ({ jwt, user, company }) => {
38
38
  { id: "retailer", name: "Cadena" },
39
39
  ];
40
40
  const [applicantsFilter, setApplicantsFilter] = useState([]);
41
+ const [totalCount, setTotalCount] = useState(0);
41
42
 
42
43
  const loadProductVersions = async (queryObject, byStatus = false) => {
43
44
  const keys = Object.keys(queryObject);
@@ -98,6 +99,7 @@ export const Dashboard = ({ jwt, user, company }) => {
98
99
  { label: "Productos en proceso", value: inProcess },
99
100
  { label: "Productos terminados", value: ACA },
100
101
  ]);
102
+ setTotalCount(orders.total);
101
103
  delete orders.total;
102
104
  setProductsByStatus(orders);
103
105
  };
@@ -315,6 +317,7 @@ export const Dashboard = ({ jwt, user, company }) => {
315
317
  displayLegend={true}
316
318
  showPercent={true}
317
319
  displayScale={false}
320
+ total={totalCount}
318
321
  />
319
322
  <DashboardMetric
320
323
  label={"Productos solicitados"}