contentoh-components-library 21.2.51 → 21.2.52
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/.env.development +1 -0
- package/.env.production +2 -1
- package/dist/components/atoms/Graphic/index.js +30 -1
- package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +22 -21
- package/dist/components/molecules/CustomSelect/SelectItem.js +1 -10
- package/dist/components/molecules/CustomSelect/index.js +37 -36
- package/dist/components/molecules/CustomSelect/styles.js +1 -3
- package/dist/components/organisms/DashboardMetric/dashboardMetricUtils.js +1 -1
- package/dist/components/organisms/DashboardMetric/index.js +20 -2
- package/dist/components/organisms/DashboardMetric/styles.js +1 -1
- package/dist/components/pages/Dashboard/Dashboard.stories.js +39 -25
- package/dist/components/pages/Dashboard/dashboardUtils.js +28 -17
- package/dist/components/pages/Dashboard/index.js +49 -16
- package/package.json +1 -1
- package/src/components/atoms/Graphic/index.js +30 -1
- package/src/components/molecules/CustomSelect/CustomSelect.stories.js +11 -19
- package/src/components/molecules/CustomSelect/SelectItem.js +0 -7
- package/src/components/molecules/CustomSelect/index.js +30 -32
- package/src/components/molecules/CustomSelect/styles.js +9 -3
- package/src/components/organisms/DashboardMetric/dashboardMetricUtils.js +1 -1
- package/src/components/organisms/DashboardMetric/index.js +15 -1
- package/src/components/organisms/DashboardMetric/styles.js +31 -0
- package/src/components/pages/Dashboard/Dashboard.stories.js +39 -25
- package/src/components/pages/Dashboard/dashboardUtils.js +18 -8
- package/src/components/pages/Dashboard/index.js +37 -10
- package/dist/assets/images/customSelect/starIcon.svg +0 -14
- package/dist/components/atoms/ListCommercialRetailers/ListCommercialRetailers.stories.js +0 -36
- package/dist/components/atoms/ListCommercialRetailers/index.js +0 -64
- package/dist/components/atoms/ListCommercialRetailers/styles.js +0 -20
- package/dist/components/atoms/MenuCommercialRetailers/MenuCommercialRetailers.stories.js +0 -37
- package/dist/components/atoms/MenuCommercialRetailers/index.js +0 -25
- package/dist/components/atoms/MenuCommercialRetailers/styles.js +0 -20
- package/dist/components/atoms/MenuProductImage/MenuProductImage.stories.js +0 -28
- package/dist/components/atoms/MenuProductImage/index.js +0 -88
- package/dist/components/atoms/MenuProductImage/styles.js +0 -20
- package/dist/components/molecules/ApproveRejetPanel/ApproveRejetPanel.stories.js +0 -25
- package/dist/components/molecules/ApproveRejetPanel/index.js +0 -49
- package/dist/components/molecules/ApproveRejetPanel/styles.js +0 -18
- package/dist/components/molecules/SignInLoginCreationApp/SignInLogin.stories.js +0 -28
- package/dist/components/molecules/SignInLoginCreationApp/index.js +0 -270
- package/dist/components/molecules/SignInLoginCreationApp/styles.js +0 -20
- package/src/assets/images/customSelect/starIcon.svg +0 -14
|
@@ -33,7 +33,8 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
33
33
|
|
|
34
34
|
var Dashboard = function Dashboard(_ref) {
|
|
35
35
|
var jwt = _ref.jwt,
|
|
36
|
-
user = _ref.user
|
|
36
|
+
user = _ref.user,
|
|
37
|
+
company = _ref.company;
|
|
37
38
|
|
|
38
39
|
var _useState = (0, _react.useState)([]),
|
|
39
40
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -116,6 +117,19 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
116
117
|
dateOptions = _useState28[0],
|
|
117
118
|
setDateOptions = _useState28[1];
|
|
118
119
|
|
|
120
|
+
var applicants = [{
|
|
121
|
+
id: "provider",
|
|
122
|
+
name: "Proveedor"
|
|
123
|
+
}, {
|
|
124
|
+
id: "retailer",
|
|
125
|
+
name: "Cadena"
|
|
126
|
+
}];
|
|
127
|
+
|
|
128
|
+
var _useState29 = (0, _react.useState)([]),
|
|
129
|
+
_useState30 = (0, _slicedToArray2.default)(_useState29, 2),
|
|
130
|
+
applicantsFilter = _useState30[0],
|
|
131
|
+
setApplicantsFilter = _useState30[1];
|
|
132
|
+
|
|
119
133
|
var loadProductVersions = /*#__PURE__*/function () {
|
|
120
134
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(queryObject) {
|
|
121
135
|
var byStatus,
|
|
@@ -174,7 +188,7 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
174
188
|
while (1) {
|
|
175
189
|
switch (_context2.prev = _context2.next) {
|
|
176
190
|
case 0:
|
|
177
|
-
isTHDUser =
|
|
191
|
+
isTHDUser = user.is_retailer === 1;
|
|
178
192
|
_context2.next = 3;
|
|
179
193
|
return _axios.default.get("".concat(process.env.REACT_APP_RETAILER_ENDPOINT), {
|
|
180
194
|
headers: {
|
|
@@ -227,6 +241,12 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
227
241
|
case 5:
|
|
228
242
|
_ref5 = _context3.t0;
|
|
229
243
|
orders = _ref5.orders;
|
|
244
|
+
|
|
245
|
+
if (orders.null) {
|
|
246
|
+
orders.total -= orders.null;
|
|
247
|
+
delete orders.null;
|
|
248
|
+
}
|
|
249
|
+
|
|
230
250
|
_orders$total = orders.total, total = _orders$total === void 0 ? 0 : _orders$total, _orders$R = orders.R, R = _orders$R === void 0 ? 0 : _orders$R, _orders$ACA = orders.ACA, ACA = _orders$ACA === void 0 ? 0 : _orders$ACA, _orders$PA = orders.PA, PA = _orders$PA === void 0 ? 0 : _orders$PA;
|
|
231
251
|
inProcess = Object.keys(orders).reduce(function (prev, curr) {
|
|
232
252
|
return !["total", "ACA", "PA", "R"].includes(curr) ? prev + orders[curr] : prev;
|
|
@@ -247,7 +267,7 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
247
267
|
delete orders.total;
|
|
248
268
|
setProductsByStatus(orders);
|
|
249
269
|
|
|
250
|
-
case
|
|
270
|
+
case 13:
|
|
251
271
|
case "end":
|
|
252
272
|
return _context3.stop();
|
|
253
273
|
}
|
|
@@ -368,14 +388,14 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
368
388
|
case 0:
|
|
369
389
|
_context5.t0 = setProviders;
|
|
370
390
|
_context5.next = 3;
|
|
371
|
-
return (0, _dashboardUtils.getProviders)(jwt);
|
|
391
|
+
return (0, _dashboardUtils.getProviders)(jwt, user);
|
|
372
392
|
|
|
373
393
|
case 3:
|
|
374
394
|
_context5.t1 = _context5.sent;
|
|
375
395
|
(0, _context5.t0)(_context5.t1);
|
|
376
396
|
_context5.t2 = setCategories;
|
|
377
397
|
_context5.next = 8;
|
|
378
|
-
return (0, _dashboardUtils.getCategories)();
|
|
398
|
+
return (0, _dashboardUtils.getCategories)(user, company);
|
|
379
399
|
|
|
380
400
|
case 8:
|
|
381
401
|
_context5.t3 = _context5.sent;
|
|
@@ -425,57 +445,70 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
425
445
|
companyId.length > 0 && (queryObject["companyId"] = companyId.join(","));
|
|
426
446
|
retailerId.length > 0 && (queryObject["retailerId"] = retailerId.join(","));
|
|
427
447
|
categoryId.length > 0 && (queryObject["categoryId"] = categoryId.join(","));
|
|
428
|
-
|
|
448
|
+
applicantsFilter.length > 0 && (queryObject["requestedBy"] = applicantsFilter.join(","));
|
|
449
|
+
_context6.next = 8;
|
|
429
450
|
return loadProductsByStatus(queryObject);
|
|
430
451
|
|
|
431
|
-
case
|
|
432
|
-
_context6.next =
|
|
452
|
+
case 8:
|
|
453
|
+
_context6.next = 10;
|
|
433
454
|
return loadRequiredProducts(queryObject);
|
|
434
455
|
|
|
435
|
-
case
|
|
456
|
+
case 10:
|
|
436
457
|
case "end":
|
|
437
458
|
return _context6.stop();
|
|
438
459
|
}
|
|
439
460
|
}
|
|
440
461
|
}, _callee6);
|
|
441
|
-
})), [companyId, retailerId, categoryId, datesRange]);
|
|
462
|
+
})), [companyId, retailerId, categoryId, datesRange, applicantsFilter]);
|
|
442
463
|
return loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
443
464
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
444
465
|
className: "filters",
|
|
445
466
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomSelect.CustomSelect, {
|
|
467
|
+
showFilterString: true,
|
|
446
468
|
options: dateOptions,
|
|
447
|
-
selectLabel: "
|
|
469
|
+
selectLabel: "Todo el tiempo",
|
|
448
470
|
placeHolder: "Buscar Fecha",
|
|
449
471
|
customSelectId: "dates-select",
|
|
450
472
|
parameterArray: datesRange,
|
|
451
473
|
setParameterArray: setDatesRange
|
|
452
474
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomSelect.CustomSelect, {
|
|
475
|
+
showFilterString: true,
|
|
453
476
|
showSearchBar: true,
|
|
454
477
|
options: providers,
|
|
455
|
-
selectLabel: "
|
|
478
|
+
selectLabel: "Todos los proveedores",
|
|
456
479
|
placeHolder: "Buscar Proveedor",
|
|
457
480
|
customSelectId: "providers-select",
|
|
458
481
|
parameterArray: companyId,
|
|
459
482
|
setParameterArray: setCompanyId,
|
|
460
483
|
defaultOption: "Todos los proveedores"
|
|
461
484
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomSelect.CustomSelect, {
|
|
485
|
+
showFilterString: true,
|
|
462
486
|
showSearchBar: true,
|
|
463
487
|
options: categories,
|
|
464
|
-
selectLabel: "
|
|
488
|
+
selectLabel: "Todas las categor\xEDas",
|
|
465
489
|
placeHolder: "Buscar Departamento",
|
|
466
490
|
customSelectId: "category-select",
|
|
467
491
|
parameterArray: categoryId,
|
|
468
492
|
setParameterArray: setCategoryId,
|
|
469
493
|
defaultOption: "Todas las categorías"
|
|
470
494
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomSelect.CustomSelect, {
|
|
495
|
+
showFilterString: true,
|
|
471
496
|
showSearchBar: true,
|
|
472
497
|
options: retailers,
|
|
473
|
-
selectLabel: "
|
|
498
|
+
selectLabel: "Todos los alcances",
|
|
474
499
|
placeHolder: "Buscar Cadena",
|
|
475
500
|
customSelectId: "retailers-select",
|
|
476
501
|
parameterArray: retailerId,
|
|
477
502
|
setParameterArray: setRetailerId,
|
|
478
503
|
defaultOption: "Todos los alcances"
|
|
504
|
+
}), user.is_retailer === 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomSelect.CustomSelect, {
|
|
505
|
+
showFilterString: true,
|
|
506
|
+
options: applicants,
|
|
507
|
+
selectLabel: "Todos los solicitantes",
|
|
508
|
+
customSelectId: "applicants-select",
|
|
509
|
+
parameterArray: applicantsFilter,
|
|
510
|
+
setParameterArray: setApplicantsFilter,
|
|
511
|
+
defaultOption: "Todos los solicitantes"
|
|
479
512
|
})]
|
|
480
513
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
481
514
|
className: "metric-cards",
|
|
@@ -499,14 +532,14 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
499
532
|
},
|
|
500
533
|
type: "doughnut",
|
|
501
534
|
displayLegend: true,
|
|
502
|
-
showPercent: true
|
|
535
|
+
showPercent: true,
|
|
536
|
+
displayScale: false
|
|
503
537
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DashboardMetric.DashboardMetric, {
|
|
504
538
|
label: "Productos solicitados",
|
|
505
539
|
description: "Filtra los productos solicitados por fecha y alcance para revisar rápidamente el flujo de trabajo.",
|
|
506
540
|
dataObject: requiredProducts,
|
|
507
541
|
type: "line",
|
|
508
542
|
indexAxis: "x",
|
|
509
|
-
scale: "x",
|
|
510
543
|
displayScale: true,
|
|
511
544
|
retailerSelected: orderByRequired.retailerId,
|
|
512
545
|
queryObject: orderByRequired,
|
package/package.json
CHANGED
|
@@ -1,11 +1,40 @@
|
|
|
1
1
|
import { Container } from "./styles";
|
|
2
2
|
import { Chart } from "react-chartjs-2";
|
|
3
3
|
import "chart.js/auto";
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
4
5
|
|
|
5
6
|
export const Graphic = ({ data, type, options }) => {
|
|
7
|
+
const counter = {
|
|
8
|
+
id: "counter",
|
|
9
|
+
beforeDraw(chart, args, options) {
|
|
10
|
+
const {
|
|
11
|
+
ctx,
|
|
12
|
+
chartArea: { top, right, bottom, left, width, height },
|
|
13
|
+
} = chart;
|
|
14
|
+
const x = width / 2;
|
|
15
|
+
const y = height / 2 + (options.fontSize * 0.68) / 2;
|
|
16
|
+
ctx.save();
|
|
17
|
+
ctx.beginPath();
|
|
18
|
+
ctx.arc(x, height / 2, 60, 0, 2 * Math.PI);
|
|
19
|
+
ctx.fillStyle = "#E9E9E9";
|
|
20
|
+
ctx.fill();
|
|
21
|
+
ctx.strokeStyle = "#E9E9E9";
|
|
22
|
+
ctx.stroke();
|
|
23
|
+
ctx.font = `${options.fontSize}px ${options.fontFamily}`;
|
|
24
|
+
ctx.textAlign = options.textAlign;
|
|
25
|
+
ctx.fillStyle = options.fontColor;
|
|
26
|
+
ctx.fillText(options.value, x, y);
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
6
30
|
return (
|
|
7
31
|
<Container>
|
|
8
|
-
<Chart
|
|
32
|
+
<Chart
|
|
33
|
+
type={type}
|
|
34
|
+
data={data}
|
|
35
|
+
options={options}
|
|
36
|
+
plugins={type === "doughnut" ? [counter] : null}
|
|
37
|
+
/>
|
|
9
38
|
</Container>
|
|
10
39
|
);
|
|
11
40
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CustomSelect } from "./index";
|
|
2
|
-
import iconStar from "../../../assets/images/customSelect/starIcon.svg";
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
title: "Components/molecules/CustomSelect",
|
|
@@ -9,27 +8,20 @@ export default {
|
|
|
9
8
|
const Template = (args) => <CustomSelect {...args} />;
|
|
10
9
|
export const CustomSelectDefault = Template.bind({});
|
|
11
10
|
CustomSelectDefault.args = {
|
|
12
|
-
|
|
11
|
+
selectLabel: "Todos los departamentos",
|
|
13
12
|
defaultOption: "Todos los departamentos",
|
|
14
13
|
options: [
|
|
15
14
|
{
|
|
16
|
-
id:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
name: "Mis Favoritos",
|
|
15
|
+
id: 1,
|
|
16
|
+
value: "Decoración",
|
|
17
|
+
subOptions: [
|
|
18
|
+
{ id: 1, value: "Espejos" },
|
|
19
|
+
{ id: 2, value: "Persianas" },
|
|
20
|
+
],
|
|
23
21
|
},
|
|
22
|
+
{ id: 2, value: "Eléctrico" },
|
|
23
|
+
{ id: 3, value: "Ferretería" },
|
|
24
|
+
{ id: 4, value: "Herramientas" },
|
|
25
|
+
{ id: 5, value: "Iluminación" },
|
|
24
26
|
],
|
|
25
|
-
onClickItem: (v, id) => {
|
|
26
|
-
if (v) {
|
|
27
|
-
console.log("Agregar a la lista", id);
|
|
28
|
-
} else {
|
|
29
|
-
console.log("Eliminar a la lista", id);
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
icon: iconStar,
|
|
33
|
-
showSearchBar: true,
|
|
34
|
-
customOptions: <p>Esto es un customOptions</p>
|
|
35
27
|
};
|
|
@@ -7,7 +7,6 @@ export const SelecItem = ({
|
|
|
7
7
|
setParameterArray,
|
|
8
8
|
activeFilters,
|
|
9
9
|
setActiveFilters,
|
|
10
|
-
onClickItem,
|
|
11
10
|
}) => {
|
|
12
11
|
const [showSubOptions, setShowSubOptions] = useState(false);
|
|
13
12
|
const [chkGlobal, setChkGlobal] = useState(false);
|
|
@@ -18,9 +17,6 @@ export const SelecItem = ({
|
|
|
18
17
|
id={"main-item-" + option.id}
|
|
19
18
|
label={option.name}
|
|
20
19
|
onChange={(e) => {
|
|
21
|
-
if (onClickItem) {
|
|
22
|
-
onClickItem(e.target.checked, option.id)
|
|
23
|
-
}
|
|
24
20
|
const subOptions = option.subOptions;
|
|
25
21
|
const filtersCopy = { ...activeFilters };
|
|
26
22
|
if (subOptions) {
|
|
@@ -81,9 +77,6 @@ export const SelecItem = ({
|
|
|
81
77
|
activeFilters[option.name][sub.name]
|
|
82
78
|
}
|
|
83
79
|
onChange={(e) => {
|
|
84
|
-
if (onClickItem) {
|
|
85
|
-
onClickItem(e.target.checked, sub.id)
|
|
86
|
-
}
|
|
87
80
|
if (e.target.checked) {
|
|
88
81
|
setParameterArray((current) =>
|
|
89
82
|
[...current, sub.id].sort((a, b) => a - b)
|
|
@@ -13,17 +13,17 @@ export const CustomSelect = ({
|
|
|
13
13
|
customSelectId = "defaultSelectId",
|
|
14
14
|
defaultOption,
|
|
15
15
|
setParameterArray,
|
|
16
|
-
|
|
17
|
-
icon,
|
|
18
|
-
customOptions,
|
|
16
|
+
showFilterString,
|
|
19
17
|
}) => {
|
|
20
|
-
const [filters, setFilters] = useState([]);
|
|
18
|
+
const [filters, setFilters] = useState(options || []);
|
|
21
19
|
const [showList, setShowList] = useCloseModal(customSelectId);
|
|
22
20
|
const [text, setText] = useState("");
|
|
23
21
|
const [showDatePicker, setShowDatePicker] = useCloseModal(customSelectId);
|
|
24
22
|
const [startDate, setStartDate] = useState(new Date());
|
|
25
23
|
const [endDate, setEndDate] = useState(new Date());
|
|
26
24
|
const [activeFilters, setActiveFilters] = useState({});
|
|
25
|
+
const [filtersString, setFiltersString] = useState(selectLabel);
|
|
26
|
+
const [filtersCounter, setFiltersCounter] = useState(0);
|
|
27
27
|
|
|
28
28
|
const onChange = (evt) => {
|
|
29
29
|
setText(evt.target.value);
|
|
@@ -36,21 +36,7 @@ export const CustomSelect = ({
|
|
|
36
36
|
const end = new Date();
|
|
37
37
|
setStartDate(start);
|
|
38
38
|
setEndDate(end);
|
|
39
|
-
|
|
40
|
-
options.forEach((o) => {
|
|
41
|
-
const { name, isSelected, subOptions } = o;
|
|
42
|
-
if (isSelected) obj[name] = {};
|
|
43
|
-
subOptions?.forEach((so) => {
|
|
44
|
-
const { name: nameSO, isSelected: isSelectedSO } = so;
|
|
45
|
-
if (isSelectedSO) {
|
|
46
|
-
if (!obj[name]) obj[name] = {};
|
|
47
|
-
obj[name][nameSO] = true;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
setActiveFilters(obj);
|
|
52
|
-
setFilters(options);
|
|
53
|
-
}, [options]);
|
|
39
|
+
}, []);
|
|
54
40
|
|
|
55
41
|
const onChangeDatePicker = (dates) => {
|
|
56
42
|
const [start, end] = dates;
|
|
@@ -80,19 +66,29 @@ export const CustomSelect = ({
|
|
|
80
66
|
setFilters(filteredArray);
|
|
81
67
|
}, [text]);
|
|
82
68
|
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
let newFiltersString = selectLabel;
|
|
71
|
+
let counter = 0;
|
|
72
|
+
const filtersArray = Object.keys(activeFilters);
|
|
73
|
+
filtersArray.length &&
|
|
74
|
+
filtersArray.forEach((key, index) => {
|
|
75
|
+
if (index === 0) newFiltersString = key;
|
|
76
|
+
else {
|
|
77
|
+
counter++;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
counter > 0 && setFiltersCounter(counter);
|
|
81
|
+
setFiltersString(newFiltersString);
|
|
82
|
+
}, [activeFilters]);
|
|
83
|
+
|
|
83
84
|
return (
|
|
84
|
-
<Container id={customSelectId}
|
|
85
|
+
<Container id={customSelectId}>
|
|
85
86
|
<div className="button-list" onClick={() => setShowList(!showList)}>
|
|
86
|
-
|
|
87
|
-
{
|
|
88
|
-
|
|
89
|
-
) : (
|
|
90
|
-
<div className="arrow-item">◀</div>
|
|
91
|
-
)}
|
|
87
|
+
<p>{filtersString}</p>
|
|
88
|
+
<p>{filtersCounter > 0 && `+${filtersCounter}`}</p>
|
|
89
|
+
<div className="arrow-item">◀</div>
|
|
92
90
|
</div>
|
|
93
|
-
{showList && (
|
|
94
|
-
customOptions
|
|
95
|
-
: (
|
|
91
|
+
{showList && (
|
|
96
92
|
<div className="select-container">
|
|
97
93
|
{showSearchBar && (
|
|
98
94
|
<div className="search-bar-filter">
|
|
@@ -109,9 +105,11 @@ export const CustomSelect = ({
|
|
|
109
105
|
<div
|
|
110
106
|
className="default-option"
|
|
111
107
|
onClick={() => {
|
|
112
|
-
setParameterArray
|
|
108
|
+
setParameterArray([]);
|
|
113
109
|
setActiveFilters({});
|
|
114
110
|
setShowList(false);
|
|
111
|
+
setFiltersString(selectLabel);
|
|
112
|
+
setFiltersCounter(0);
|
|
115
113
|
}}
|
|
116
114
|
>
|
|
117
115
|
<p>{defaultOption}</p>
|
|
@@ -127,6 +125,7 @@ export const CustomSelect = ({
|
|
|
127
125
|
option.function
|
|
128
126
|
? option.function(setShowDatePicker)
|
|
129
127
|
: setShowDatePicker(true);
|
|
128
|
+
setFiltersString(option.name);
|
|
130
129
|
}}
|
|
131
130
|
>
|
|
132
131
|
<p>{option.name}</p>
|
|
@@ -139,13 +138,12 @@ export const CustomSelect = ({
|
|
|
139
138
|
setParameterArray={setParameterArray}
|
|
140
139
|
activeFilters={activeFilters}
|
|
141
140
|
setActiveFilters={setActiveFilters}
|
|
142
|
-
onClickItem={onClickItem}
|
|
143
141
|
/>
|
|
144
142
|
)
|
|
145
143
|
)}
|
|
146
144
|
</div>
|
|
147
145
|
</div>
|
|
148
|
-
)
|
|
146
|
+
)}
|
|
149
147
|
{showDatePicker && (
|
|
150
148
|
<Calendar
|
|
151
149
|
onChange={onChangeDatePicker}
|
|
@@ -4,20 +4,26 @@ import { FontFamily } from "../../../global-files/variables";
|
|
|
4
4
|
export const Container = styled.div`
|
|
5
5
|
width: fit-content;
|
|
6
6
|
position: relative;
|
|
7
|
+
min-width: 150px;
|
|
7
8
|
|
|
8
9
|
.button-list {
|
|
9
10
|
font-family: ${FontFamily.Raleway};
|
|
10
11
|
font-size: 13px;
|
|
11
12
|
display: flex;
|
|
12
|
-
padding:
|
|
13
|
-
//padding: 10px 15px;
|
|
14
|
-
//padding: 5px 5px;
|
|
13
|
+
padding: 10px 15px;
|
|
15
14
|
justify-content: space-between;
|
|
16
15
|
border-radius: 50px;
|
|
17
16
|
background-color: #fff;
|
|
18
17
|
border: 1px solid #f0f0f0;
|
|
19
18
|
cursor: pointer;
|
|
20
19
|
|
|
20
|
+
& > p {
|
|
21
|
+
max-width: 140px;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
text-overflow: ellipsis;
|
|
25
|
+
}
|
|
26
|
+
|
|
21
27
|
.arrow-item {
|
|
22
28
|
transform: rotate(-90deg);
|
|
23
29
|
cursor: pointer;
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
removeOldStatus,
|
|
6
6
|
getStatusColor,
|
|
7
7
|
} from "./dashboardMetricUtils";
|
|
8
|
+
import { FontFamily } from "../../../global-files/variables";
|
|
8
9
|
|
|
9
10
|
export const DashboardMetric = ({
|
|
10
11
|
label,
|
|
@@ -24,7 +25,7 @@ export const DashboardMetric = ({
|
|
|
24
25
|
: Object.keys(dataObject);
|
|
25
26
|
const newObject =
|
|
26
27
|
type === "doughnut" ? removeOldStatus(dataObject) : dataObject;
|
|
27
|
-
const values = Object.values(newObject);
|
|
28
|
+
const values = Object.values(newObject) || [0];
|
|
28
29
|
const colorsArray = Object.keys(newObject).map((key) => getStatusColor(key));
|
|
29
30
|
|
|
30
31
|
const data = {
|
|
@@ -69,6 +70,13 @@ export const DashboardMetric = ({
|
|
|
69
70
|
boxWidth: 8,
|
|
70
71
|
},
|
|
71
72
|
},
|
|
73
|
+
counter: {
|
|
74
|
+
fontFamily: "sans-serif",
|
|
75
|
+
fontSize: 25,
|
|
76
|
+
fontColor: "#707070",
|
|
77
|
+
textAlign: "center",
|
|
78
|
+
value: values?.reduce((a, b) => a + b) || 0,
|
|
79
|
+
},
|
|
72
80
|
},
|
|
73
81
|
scales: {
|
|
74
82
|
[scale]: {
|
|
@@ -77,6 +85,7 @@ export const DashboardMetric = ({
|
|
|
77
85
|
},
|
|
78
86
|
},
|
|
79
87
|
},
|
|
88
|
+
showTooltips: true,
|
|
80
89
|
};
|
|
81
90
|
|
|
82
91
|
return (
|
|
@@ -89,6 +98,11 @@ export const DashboardMetric = ({
|
|
|
89
98
|
<div className="graphic-cotainer">
|
|
90
99
|
<Graphic data={data} options={options} type={type} />
|
|
91
100
|
</div>
|
|
101
|
+
{type === "line" && <p className="x-label">Fechas</p>}
|
|
102
|
+
{type === "line" && <p className="y-label">Productos</p>}
|
|
103
|
+
{/* {type === "doughnut" && values.length > 0 && (
|
|
104
|
+
<p className="center-label">{values?.reduce((a, b) => a + b) || 0}</p>
|
|
105
|
+
)} */}
|
|
92
106
|
</Container>
|
|
93
107
|
);
|
|
94
108
|
};
|
|
@@ -5,6 +5,7 @@ export const Container = styled.div`
|
|
|
5
5
|
border: 1px solid ${GlobalColors.s3};
|
|
6
6
|
border-radius: 5px;
|
|
7
7
|
padding: 24px;
|
|
8
|
+
position: relative;
|
|
8
9
|
|
|
9
10
|
.text-container {
|
|
10
11
|
p {
|
|
@@ -57,4 +58,34 @@ export const Container = styled.div`
|
|
|
57
58
|
height: fill-available;
|
|
58
59
|
}
|
|
59
60
|
}
|
|
61
|
+
|
|
62
|
+
& > p {
|
|
63
|
+
font-family: ${FontFamily.Raleway};
|
|
64
|
+
color: ${GlobalColors.s5};
|
|
65
|
+
font-size: 17px;
|
|
66
|
+
|
|
67
|
+
&.x-label {
|
|
68
|
+
position: absolute;
|
|
69
|
+
left: 50%;
|
|
70
|
+
transform: translate(-50%);
|
|
71
|
+
bottom: 4px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&.y-label {
|
|
75
|
+
position: absolute;
|
|
76
|
+
transform: rotate(-90deg);
|
|
77
|
+
left: -28px;
|
|
78
|
+
top: 50%;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&.center-label {
|
|
82
|
+
position: absolute;
|
|
83
|
+
top: 52%;
|
|
84
|
+
right: 58%;
|
|
85
|
+
font-size: 28px;
|
|
86
|
+
color: #000;
|
|
87
|
+
font-feature-settings: "pnum", "lnum";
|
|
88
|
+
font-family: ${FontFamily.Raleway_600};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
60
91
|
`;
|
|
@@ -9,37 +9,51 @@ const Template = (args) => <Dashboard {...args} />;
|
|
|
9
9
|
export const DashboardDeafult = Template.bind({});
|
|
10
10
|
DashboardDeafult.args = {
|
|
11
11
|
user: {
|
|
12
|
-
id_user:
|
|
13
|
-
name: "
|
|
14
|
-
last_name: "
|
|
15
|
-
email: "
|
|
16
|
-
position: "
|
|
17
|
-
telephone: "
|
|
12
|
+
id_user: 30,
|
|
13
|
+
name: "Admin",
|
|
14
|
+
last_name: "Ulises",
|
|
15
|
+
email: "salmeron.5@hotmail.com",
|
|
16
|
+
position: "Admin",
|
|
17
|
+
telephone: "",
|
|
18
18
|
country: "México",
|
|
19
|
-
id_company:
|
|
20
|
-
id_cognito: "
|
|
19
|
+
id_company: 2,
|
|
20
|
+
id_cognito: "c94a7305-9365-46ff-a423-4b4bc3b8b180",
|
|
21
21
|
birth_Date: null,
|
|
22
|
-
about_me:
|
|
23
|
-
zip_code:
|
|
24
|
-
address:
|
|
25
|
-
job:
|
|
26
|
-
id_stripe: "
|
|
27
|
-
id_role:
|
|
22
|
+
about_me: "",
|
|
23
|
+
zip_code: "",
|
|
24
|
+
address: "",
|
|
25
|
+
job: "",
|
|
26
|
+
id_stripe: "",
|
|
27
|
+
id_role: 6,
|
|
28
28
|
active: 1,
|
|
29
29
|
is_retailer: 0,
|
|
30
30
|
email_notify: 1,
|
|
31
31
|
membership: {
|
|
32
|
-
id:
|
|
33
|
-
start_date: "
|
|
34
|
-
end_date: "
|
|
35
|
-
planID:
|
|
36
|
-
plan: "
|
|
37
|
-
name: "Plan
|
|
38
|
-
user_limit: "
|
|
39
|
-
products_limit: "
|
|
40
|
-
type: "
|
|
32
|
+
id: 2,
|
|
33
|
+
start_date: "2021-11-05T02:35:12.000Z",
|
|
34
|
+
end_date: "2022-11-05T02:34:49.000Z",
|
|
35
|
+
planID: 1,
|
|
36
|
+
plan: "prod_KtkvuFFLpOdP6e",
|
|
37
|
+
name: "Plan Free",
|
|
38
|
+
user_limit: "1",
|
|
39
|
+
products_limit: "3",
|
|
40
|
+
type: "PyMES",
|
|
41
41
|
},
|
|
42
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
42
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-30/30.png?1664606284528",
|
|
43
|
+
},
|
|
44
|
+
company: {
|
|
45
|
+
id_company: 2,
|
|
46
|
+
trade_name: "VINÍCOLA PASO DE SERRA",
|
|
47
|
+
company_name: "VINÍCOLA PASO DE SERRA",
|
|
48
|
+
rfc: null,
|
|
49
|
+
adress: null,
|
|
50
|
+
about_company: null,
|
|
51
|
+
telephone: null,
|
|
52
|
+
web_site: null,
|
|
53
|
+
zip_code: null,
|
|
54
|
+
email: null,
|
|
55
|
+
social_link: null,
|
|
56
|
+
is_retailer: 0,
|
|
43
57
|
},
|
|
44
|
-
jwt: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.
|
|
58
|
+
jwt: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJjOTRhNzMwNS05MzY1LTQ2ZmYtYTQyMy00YjRiYzNiOGIxODAiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjp0cnVlLCJjb2duaXRvOnVzZXJuYW1lIjoiYzk0YTczMDUtOTM2NS00NmZmLWE0MjMtNGI0YmMzYjhiMTgwIiwiY29nbml0bzpyb2xlcyI6WyJhcm46YXdzOmlhbTo6ODk4NjcwMjMyODA3OnJvbGVcL2NvbnRlbnRvaC1kZXYtdXMtZWFzdC0xLWxhbWJkYVJvbGUiXSwiYXVkIjoiNWFjOHRwZ3M2Z2JzcTEzZnJ2cnBpZWVwNDAiLCJldmVudF9pZCI6Ijg3YjQwMTMzLTE0YTMtNDgyOC1iYzE0LWU3ZTgxM2I2YmFmMSIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNjY0NjA2Mjg0LCJuYW1lIjoiQ29sYWJvcmFkb3IiLCJwaG9uZV9udW1iZXIiOiIrNTIxMTExIiwiZXhwIjoxNjY0NjA5ODg0LCJpYXQiOjE2NjQ2MDYyODQsImVtYWlsIjoic2FsbWVyb24uNUBob3RtYWlsLmNvbSJ9.J0L3zmJ2cZdPx4LjjscrZlPG41yCp1tOxE6WLl8K2lT_6fa-fNAQQLekKRmA9RwW--yA6z97xLu1oCjd_ZrErdc_aLMxxA2wCffh068QOD6Vil5aOCNA12QuTz7WhZlz3oOHe7hgx4PIi65u8--mstLqtmTH2_5OfoaTfcYllk1M65w-AfayozTlFaaXQID05nrwuGCc2gBl3SorBhbVvatRzCeZZjWOHRqOrxaJYY0Q97zNS6E0Nd4nPioIibUjGsKh_Hl-RUivSkDcKtszS8OYl4Alia00Ownz74rx7svZy9gpMy8t9TOonSlTTnHqOR5gPyBYO__OZMa55RiGtQ",
|
|
45
59
|
};
|