contentoh-components-library 21.2.50 → 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.
Files changed (36) hide show
  1. package/.env.development +1 -0
  2. package/.env.production +2 -1
  3. package/dist/components/atoms/Graphic/index.js +30 -1
  4. package/dist/components/molecules/CustomSelect/index.js +30 -2
  5. package/dist/components/molecules/CustomSelect/styles.js +1 -1
  6. package/dist/components/organisms/DashboardMetric/dashboardMetricUtils.js +1 -1
  7. package/dist/components/organisms/DashboardMetric/index.js +20 -2
  8. package/dist/components/organisms/DashboardMetric/styles.js +1 -1
  9. package/dist/components/pages/Dashboard/Dashboard.stories.js +38 -24
  10. package/dist/components/pages/Dashboard/dashboardUtils.js +28 -17
  11. package/dist/components/pages/Dashboard/index.js +48 -15
  12. package/package.json +1 -1
  13. package/src/components/atoms/Graphic/index.js +30 -1
  14. package/src/components/molecules/CustomSelect/index.js +23 -1
  15. package/src/components/molecules/CustomSelect/styles.js +8 -0
  16. package/src/components/organisms/DashboardMetric/dashboardMetricUtils.js +1 -1
  17. package/src/components/organisms/DashboardMetric/index.js +15 -1
  18. package/src/components/organisms/DashboardMetric/styles.js +31 -0
  19. package/src/components/pages/Dashboard/Dashboard.stories.js +38 -24
  20. package/src/components/pages/Dashboard/dashboardUtils.js +18 -8
  21. package/src/components/pages/Dashboard/index.js +36 -9
  22. package/dist/components/atoms/ListCommercialRetailers/ListCommercialRetailers.stories.js +0 -36
  23. package/dist/components/atoms/ListCommercialRetailers/index.js +0 -64
  24. package/dist/components/atoms/ListCommercialRetailers/styles.js +0 -20
  25. package/dist/components/atoms/MenuCommercialRetailers/MenuCommercialRetailers.stories.js +0 -37
  26. package/dist/components/atoms/MenuCommercialRetailers/index.js +0 -25
  27. package/dist/components/atoms/MenuCommercialRetailers/styles.js +0 -20
  28. package/dist/components/atoms/MenuProductImage/MenuProductImage.stories.js +0 -28
  29. package/dist/components/atoms/MenuProductImage/index.js +0 -88
  30. package/dist/components/atoms/MenuProductImage/styles.js +0 -20
  31. package/dist/components/molecules/ApproveRejetPanel/ApproveRejetPanel.stories.js +0 -25
  32. package/dist/components/molecules/ApproveRejetPanel/index.js +0 -49
  33. package/dist/components/molecules/ApproveRejetPanel/styles.js +0 -18
  34. package/dist/components/molecules/SignInLoginCreationApp/SignInLogin.stories.js +0 -28
  35. package/dist/components/molecules/SignInLoginCreationApp/index.js +0 -270
  36. package/dist/components/molecules/SignInLoginCreationApp/styles.js +0 -20
package/.env.development CHANGED
@@ -20,6 +20,7 @@ REACT_APP_READ_ORDERS_BY_STATUS=https://lqrc8jfjqi.execute-api.us-east-1.amazona
20
20
  REACT_APP_READ_REQUIRED_ORDERS=https://lqrc8jfjqi.execute-api.us-east-1.amazonaws.com/dev/read-required-orders
21
21
  REACT_APP_CATEGORY_ENDPOINT=https://lqrc8jfjqi.execute-api.us-east-1.amazonaws.com/dev/categories
22
22
  REACT_APP_READ_PROVIDERS=https://lqrc8jfjqi.execute-api.us-east-1.amazonaws.com/dev/providers
23
+ REACT_APP_PENDING_INVITATIONS=https://fc069ovhuk.execute-api.us-east-1.amazonaws.com/dev/pending-invitations
23
24
 
24
25
  REACT_APP_IMAGES_BUCKET=content-management-images
25
26
  REACT_APP_KEY_UPLOAD_TO_S3=AKIA5CPHLQTT46EQ5TIK
package/.env.production CHANGED
@@ -1,4 +1,4 @@
1
- REACT_APP_ARTICLE_DATA_ENDPOINT=https://6jqnpjf841.execute-api.us-east-1.amazonaws.com/prod/articles-data
1
+ ºREACT_APP_ARTICLE_DATA_ENDPOINT=https://6jqnpjf841.execute-api.us-east-1.amazonaws.com/prod/articles-data
2
2
  REACT_APP_ARTICLE_DATA_DATASHEET_ENDPOINT=https://6jqnpjf841.execute-api.us-east-1.amazonaws.com/prod/articles-data/datasheets
3
3
  REACT_APP_ARTICLE_DATA_DESCRIPTION_ENDPOINT=https://6jqnpjf841.execute-api.us-east-1.amazonaws.com/prod/articles-data/descriptions
4
4
  REACT_APP_ARTICLE_DATA_IMAGES_ENDPOINT=https://6jqnpjf841.execute-api.us-east-1.amazonaws.com/prod/articles-data/images
@@ -20,6 +20,7 @@ REACT_APP_READ_ORDERS_BY_STATUS=https://6jqnpjf841.execute-api.us-east-1.amazona
20
20
  REACT_APP_READ_REQUIRED_ORDERS=https://6jqnpjf841.execute-api.us-east-1.amazonaws.com/prod/read-required-orders
21
21
  REACT_APP_CATEGORY_ENDPOINT=https://6jqnpjf841.execute-api.us-east-1.amazonaws.com/prod/categories
22
22
  REACT_APP_READ_PROVIDERS=https://6jqnpjf841.execute-api.us-east-1.amazonaws.com/prod/providers
23
+ REACT_APP_PENDING_INVITATIONS=https://6jqnpjf841.execute-api.us-east-1.amazonaws.com/prod/pending-invitations
23
24
 
24
25
  REACT_APP_IMAGES_BUCKET=content-management-images-prod
25
26
  REACT_APP_KEY_UPLOAD_TO_S3=AKIA5CPHLQTT46EQ5TIK
@@ -11,17 +11,46 @@ var _reactChartjs = require("react-chartjs-2");
11
11
 
12
12
  require("chart.js/auto");
13
13
 
14
+ var _react = require("react");
15
+
14
16
  var _jsxRuntime = require("react/jsx-runtime");
15
17
 
16
18
  var Graphic = function Graphic(_ref) {
17
19
  var data = _ref.data,
18
20
  type = _ref.type,
19
21
  options = _ref.options;
22
+ var counter = {
23
+ id: "counter",
24
+ beforeDraw: function beforeDraw(chart, args, options) {
25
+ var ctx = chart.ctx,
26
+ _chart$chartArea = chart.chartArea,
27
+ top = _chart$chartArea.top,
28
+ right = _chart$chartArea.right,
29
+ bottom = _chart$chartArea.bottom,
30
+ left = _chart$chartArea.left,
31
+ width = _chart$chartArea.width,
32
+ height = _chart$chartArea.height;
33
+ var x = width / 2;
34
+ var y = height / 2 + options.fontSize * 0.68 / 2;
35
+ ctx.save();
36
+ ctx.beginPath();
37
+ ctx.arc(x, height / 2, 60, 0, 2 * Math.PI);
38
+ ctx.fillStyle = "#E9E9E9";
39
+ ctx.fill();
40
+ ctx.strokeStyle = "#E9E9E9";
41
+ ctx.stroke();
42
+ ctx.font = "".concat(options.fontSize, "px ").concat(options.fontFamily);
43
+ ctx.textAlign = options.textAlign;
44
+ ctx.fillStyle = options.fontColor;
45
+ ctx.fillText(options.value, x, y);
46
+ }
47
+ };
20
48
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
21
49
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactChartjs.Chart, {
22
50
  type: type,
23
51
  data: data,
24
- options: options
52
+ options: options,
53
+ plugins: type === "doughnut" ? [counter] : null
25
54
  })
26
55
  });
27
56
  };
@@ -35,7 +35,8 @@ var CustomSelect = function CustomSelect(_ref) {
35
35
  _ref$customSelectId = _ref.customSelectId,
36
36
  customSelectId = _ref$customSelectId === void 0 ? "defaultSelectId" : _ref$customSelectId,
37
37
  defaultOption = _ref.defaultOption,
38
- setParameterArray = _ref.setParameterArray;
38
+ setParameterArray = _ref.setParameterArray,
39
+ showFilterString = _ref.showFilterString;
39
40
 
40
41
  var _useState = (0, _react.useState)(options || []),
41
42
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -72,6 +73,16 @@ var CustomSelect = function CustomSelect(_ref) {
72
73
  activeFilters = _useState10[0],
73
74
  setActiveFilters = _useState10[1];
74
75
 
76
+ var _useState11 = (0, _react.useState)(selectLabel),
77
+ _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
78
+ filtersString = _useState12[0],
79
+ setFiltersString = _useState12[1];
80
+
81
+ var _useState13 = (0, _react.useState)(0),
82
+ _useState14 = (0, _slicedToArray2.default)(_useState13, 2),
83
+ filtersCounter = _useState14[0],
84
+ setFiltersCounter = _useState14[1];
85
+
75
86
  var onChange = function onChange(evt) {
76
87
  setText(evt.target.value);
77
88
  };
@@ -111,6 +122,18 @@ var CustomSelect = function CustomSelect(_ref) {
111
122
 
112
123
  setFilters(filteredArray);
113
124
  }, [text]);
125
+ (0, _react.useEffect)(function () {
126
+ var newFiltersString = selectLabel;
127
+ var counter = 0;
128
+ var filtersArray = Object.keys(activeFilters);
129
+ filtersArray.length && filtersArray.forEach(function (key, index) {
130
+ if (index === 0) newFiltersString = key;else {
131
+ counter++;
132
+ }
133
+ });
134
+ counter > 0 && setFiltersCounter(counter);
135
+ setFiltersString(newFiltersString);
136
+ }, [activeFilters]);
114
137
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
115
138
  id: customSelectId,
116
139
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
@@ -119,7 +142,9 @@ var CustomSelect = function CustomSelect(_ref) {
119
142
  return setShowList(!showList);
120
143
  },
121
144
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
122
- children: selectLabel
145
+ children: filtersString
146
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
147
+ children: filtersCounter > 0 && "+".concat(filtersCounter)
123
148
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
124
149
  className: "arrow-item",
125
150
  children: "\u25C0"
@@ -143,6 +168,8 @@ var CustomSelect = function CustomSelect(_ref) {
143
168
  setParameterArray([]);
144
169
  setActiveFilters({});
145
170
  setShowList(false);
171
+ setFiltersString(selectLabel);
172
+ setFiltersCounter(0);
146
173
  },
147
174
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
148
175
  children: defaultOption
@@ -154,6 +181,7 @@ var CustomSelect = function CustomSelect(_ref) {
154
181
  className: "dates-select-item",
155
182
  onClick: function onClick() {
156
183
  option.function ? option.function(setShowDatePicker) : setShowDatePicker(true);
184
+ setFiltersString(option.name);
157
185
  },
158
186
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
159
187
  children: option.name
@@ -15,6 +15,6 @@ var _variables = require("../../../global-files/variables");
15
15
 
16
16
  var _templateObject;
17
17
 
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: fit-content;\n position: relative;\n\n .button-list {\n font-family: ", ";\n font-size: 13px;\n display: flex;\n padding: 10px 15px;\n justify-content: space-between;\n border-radius: 50px;\n background-color: #fff;\n border: 1px solid #f0f0f0;\n cursor: pointer;\n\n .arrow-item {\n transform: rotate(-90deg);\n cursor: pointer;\n font-size: 10px;\n margin-left: 10px;\n }\n & + * {\n margin-top: 10px;\n }\n }\n\n .select-container {\n box-shadow: 0px 2px 4px #00000040;\n border-radius: 5px;\n background-color: #fff;\n padding-bottom: 10px;\n position: absolute;\n z-index: 10;\n .search-bar-filter {\n display: flex;\n align-items: center;\n border: 1px solid #f0f0f0;\n padding-left: 10px;\n\n img {\n width: 15px;\n height: 15px;\n }\n\n input {\n background-color: transparent;\n padding: 10px 10px;\n outline: none;\n border: none;\n }\n }\n .default-option {\n padding-top: 5px;\n cursor: pointer;\n padding: 5px 10px;\n color: #817393;\n font-family: Avenir Next;\n font-weight: 500;\n font-size: 13px;\n line-height: 21px;\n &:hover {\n background-color: #f0f0f0;\n }\n }\n .filters-container {\n overflow: auto;\n max-height: 500px;\n .option-container,\n .default-option {\n cursor: pointer;\n padding: 5px 10px;\n .main-item {\n display: flex;\n justify-content: space-between;\n\n .arrow-item {\n transform: rotate(-90deg);\n cursor: pointer;\n font-size: 10px;\n }\n }\n .sub-menu {\n padding-left: 20px;\n .sub-filter {\n & + * {\n margin-top: 10px;\n }\n }\n }\n\n &:hover {\n background-color: #f0f0f0;\n }\n label {\n white-space: nowrap;\n }\n }\n\n .dates-select-item {\n cursor: pointer;\n padding: 5px 10px;\n color: #817393;\n font-family: Avenir Next;\n font-weight: 500;\n font-size: 13px;\n line-height: 21px;\n &:hover {\n background-color: #f0f0f0;\n }\n }\n }\n }\n"])), _variables.FontFamily.Raleway);
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: fit-content;\n position: relative;\n min-width: 150px;\n\n .button-list {\n font-family: ", ";\n font-size: 13px;\n display: flex;\n padding: 10px 15px;\n justify-content: space-between;\n border-radius: 50px;\n background-color: #fff;\n border: 1px solid #f0f0f0;\n cursor: pointer;\n\n & > p {\n max-width: 140px;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n\n .arrow-item {\n transform: rotate(-90deg);\n cursor: pointer;\n font-size: 10px;\n margin-left: 10px;\n }\n & + * {\n margin-top: 10px;\n }\n }\n\n .select-container {\n box-shadow: 0px 2px 4px #00000040;\n border-radius: 5px;\n background-color: #fff;\n padding-bottom: 10px;\n position: absolute;\n z-index: 10;\n .search-bar-filter {\n display: flex;\n align-items: center;\n border: 1px solid #f0f0f0;\n padding-left: 10px;\n\n img {\n width: 15px;\n height: 15px;\n }\n\n input {\n background-color: transparent;\n padding: 10px 10px;\n outline: none;\n border: none;\n }\n }\n .default-option {\n padding-top: 5px;\n cursor: pointer;\n padding: 5px 10px;\n color: #817393;\n font-family: Avenir Next;\n font-weight: 500;\n font-size: 13px;\n line-height: 21px;\n &:hover {\n background-color: #f0f0f0;\n }\n }\n .filters-container {\n overflow: auto;\n max-height: 500px;\n .option-container,\n .default-option {\n cursor: pointer;\n padding: 5px 10px;\n .main-item {\n display: flex;\n justify-content: space-between;\n\n .arrow-item {\n transform: rotate(-90deg);\n cursor: pointer;\n font-size: 10px;\n }\n }\n .sub-menu {\n padding-left: 20px;\n .sub-filter {\n & + * {\n margin-top: 10px;\n }\n }\n }\n\n &:hover {\n background-color: #f0f0f0;\n }\n label {\n white-space: nowrap;\n }\n }\n\n .dates-select-item {\n cursor: pointer;\n padding: 5px 10px;\n color: #817393;\n font-family: Avenir Next;\n font-weight: 500;\n font-size: 13px;\n line-height: 21px;\n &:hover {\n background-color: #f0f0f0;\n }\n }\n }\n }\n"])), _variables.FontFamily.Raleway);
19
19
 
20
20
  exports.Container = Container;
@@ -40,7 +40,7 @@ var getFullStatus = function getFullStatus(status) {
40
40
  return "Rechazado Proveedor";
41
41
 
42
42
  case "AP":
43
- return "Aprovado Proveedor";
43
+ return "Aprobado Proveedor";
44
44
 
45
45
  case "RCA":
46
46
  return "Rechazado Cadena";
@@ -15,6 +15,8 @@ var _Graphic = require("../../atoms/Graphic");
15
15
 
16
16
  var _dashboardMetricUtils = require("./dashboardMetricUtils");
17
17
 
18
+ var _variables = require("../../../global-files/variables");
19
+
18
20
  var _jsxRuntime = require("react/jsx-runtime");
19
21
 
20
22
  var DashboardMetric = function DashboardMetric(_ref) {
@@ -41,7 +43,7 @@ var DashboardMetric = function DashboardMetric(_ref) {
41
43
  return (0, _dashboardMetricUtils.getFullStatus)(key);
42
44
  }) : Object.keys(dataObject);
43
45
  var newObject = type === "doughnut" ? (0, _dashboardMetricUtils.removeOldStatus)(dataObject) : dataObject;
44
- var values = Object.values(newObject);
46
+ var values = Object.values(newObject) || [0];
45
47
  var colorsArray = Object.keys(newObject).map(function (key) {
46
48
  return (0, _dashboardMetricUtils.getStatusColor)(key);
47
49
  });
@@ -87,13 +89,23 @@ var DashboardMetric = function DashboardMetric(_ref) {
87
89
  usePointStyle: true,
88
90
  boxWidth: 8
89
91
  }
92
+ },
93
+ counter: {
94
+ fontFamily: "sans-serif",
95
+ fontSize: 25,
96
+ fontColor: "#707070",
97
+ textAlign: "center",
98
+ value: (values === null || values === void 0 ? void 0 : values.reduce(function (a, b) {
99
+ return a + b;
100
+ })) || 0
90
101
  }
91
102
  },
92
103
  scales: (0, _defineProperty2.default)({}, scale, {
93
104
  ticks: {
94
105
  display: displayScale
95
106
  }
96
- })
107
+ }),
108
+ showTooltips: true
97
109
  };
98
110
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
99
111
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
@@ -112,6 +124,12 @@ var DashboardMetric = function DashboardMetric(_ref) {
112
124
  options: options,
113
125
  type: type
114
126
  })
127
+ }), type === "line" && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
128
+ className: "x-label",
129
+ children: "Fechas"
130
+ }), type === "line" && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
131
+ className: "y-label",
132
+ children: "Productos"
115
133
  })]
116
134
  });
117
135
  };
@@ -15,6 +15,6 @@ var _variables = require("../../../global-files/variables");
15
15
 
16
16
  var _templateObject;
17
17
 
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n border: 1px solid ", ";\n border-radius: 5px;\n padding: 24px;\n\n .text-container {\n p {\n font-family: ", ";\n color: ", ";\n font-size: 17px;\n\n &:last-of-type {\n font-size: 12px;\n color: ", ";\n }\n\n & + * {\n margin-top: 5px;\n }\n }\n\n & + * {\n margin-top: 15px;\n }\n }\n\n .select-container {\n display: flex;\n\n .select {\n flex: 0.1 1 30%;\n\n select {\n width: 100%;\n }\n\n & + * {\n margin-left: 10px;\n }\n }\n\n & + * {\n margin-top: 10px;\n }\n }\n\n .graphic-cotainer {\n height: 320px;\n border: 1px solid ", ";\n padding: 10px;\n border-radius: 5px;\n\n div {\n height: fill-available;\n }\n }\n"])), _variables.GlobalColors.s3, _variables.FontFamily.Raleway, _variables.GlobalColors.s5, _variables.GlobalColors.s4, _variables.GlobalColors.s3);
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n border: 1px solid ", ";\n border-radius: 5px;\n padding: 24px;\n position: relative;\n\n .text-container {\n p {\n font-family: ", ";\n color: ", ";\n font-size: 17px;\n\n &:last-of-type {\n font-size: 12px;\n color: ", ";\n }\n\n & + * {\n margin-top: 5px;\n }\n }\n\n & + * {\n margin-top: 15px;\n }\n }\n\n .select-container {\n display: flex;\n\n .select {\n flex: 0.1 1 30%;\n\n select {\n width: 100%;\n }\n\n & + * {\n margin-left: 10px;\n }\n }\n\n & + * {\n margin-top: 10px;\n }\n }\n\n .graphic-cotainer {\n height: 320px;\n border: 1px solid ", ";\n padding: 10px;\n border-radius: 5px;\n\n div {\n height: fill-available;\n }\n }\n\n & > p {\n font-family: ", ";\n color: ", ";\n font-size: 17px;\n\n &.x-label {\n position: absolute;\n left: 50%;\n transform: translate(-50%);\n bottom: 4px;\n }\n\n &.y-label {\n position: absolute;\n transform: rotate(-90deg);\n left: -28px;\n top: 50%;\n }\n\n &.center-label {\n position: absolute;\n top: 52%;\n right: 58%;\n font-size: 28px;\n color: #000;\n font-feature-settings: \"pnum\", \"lnum\";\n font-family: ", ";\n }\n }\n"])), _variables.GlobalColors.s3, _variables.FontFamily.Raleway, _variables.GlobalColors.s5, _variables.GlobalColors.s4, _variables.GlobalColors.s3, _variables.FontFamily.Raleway, _variables.GlobalColors.s5, _variables.FontFamily.Raleway_600);
19
19
 
20
20
  exports.Container = Container;
@@ -27,37 +27,51 @@ var DashboardDeafult = Template.bind({});
27
27
  exports.DashboardDeafult = DashboardDeafult;
28
28
  DashboardDeafult.args = {
29
29
  user: {
30
- id_user: 59,
31
- name: "The Home",
32
- last_name: "Depot",
33
- email: "cadena.ismael@allfreemail.net",
30
+ id_user: 30,
31
+ name: "Admin",
32
+ last_name: "Ulises",
33
+ email: "salmeron.5@hotmail.com",
34
34
  position: "Admin",
35
- telephone: "+523111366336",
35
+ telephone: "",
36
36
  country: "México",
37
- id_company: 7,
38
- id_cognito: "5884ae34-59d6-4454-b98e-821518bcc3a7",
37
+ id_company: 2,
38
+ id_cognito: "c94a7305-9365-46ff-a423-4b4bc3b8b180",
39
39
  birth_Date: null,
40
- about_me: null,
41
- zip_code: null,
42
- address: null,
43
- job: null,
40
+ about_me: "",
41
+ zip_code: "",
42
+ address: "",
43
+ job: "",
44
44
  id_stripe: "",
45
- id_role: 0,
45
+ id_role: 6,
46
46
  active: 1,
47
- is_retailer: 1,
47
+ is_retailer: 0,
48
48
  email_notify: 1,
49
49
  membership: {
50
- id: 24,
51
- start_date: "2021-11-23T03:35:50.000Z",
52
- end_date: "2022-11-23T03:35:50.000Z",
53
- planID: 9,
54
- plan: "prod_KtlkzZVGq6bRTO",
55
- name: "Plan Enterprise Full",
56
- user_limit: "30",
57
- products_limit: "10000",
58
- type: "Enterprise"
50
+ id: 2,
51
+ start_date: "2021-11-05T02:35:12.000Z",
52
+ end_date: "2022-11-05T02:34:49.000Z",
53
+ planID: 1,
54
+ plan: "prod_KtkvuFFLpOdP6e",
55
+ name: "Plan Free",
56
+ user_limit: "1",
57
+ products_limit: "3",
58
+ type: "PyMES"
59
59
  },
60
- src: "https://content-management-profile.s3.amazonaws.com/id-59/59.png?1663928202230"
60
+ src: "https://content-management-profile.s3.amazonaws.com/id-30/30.png?1664606284528"
61
+ },
62
+ company: {
63
+ id_company: 2,
64
+ trade_name: "VINÍCOLA PASO DE SERRA",
65
+ company_name: "VINÍCOLA PASO DE SERRA",
66
+ rfc: null,
67
+ adress: null,
68
+ about_company: null,
69
+ telephone: null,
70
+ web_site: null,
71
+ zip_code: null,
72
+ email: null,
73
+ social_link: null,
74
+ is_retailer: 0
61
75
  },
62
- jwt: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI1ODg0YWUzNC01OWQ2LTQ0NTQtYjk4ZS04MjE1MThiY2MzYTciLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6IjU4ODRhZTM0LTU5ZDYtNDQ1NC1iOThlLTgyMTUxOGJjYzNhNyIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJmY2IzMGVjYi1lMjc1LTQyM2UtYjQwMi05YTBjMWNjNzM2YzMiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY2MzkyODIwMCwibmFtZSI6IkNhZGVuYSBJc21hZWwiLCJwaG9uZV9udW1iZXIiOiIrNTIzMTExMzY2MzM2IiwiZXhwIjoxNjYzOTMxODAwLCJpYXQiOjE2NjM5MjgyMDAsImVtYWlsIjoiY2FkZW5hLmlzbWFlbEBhbGxmcmVlbWFpbC5uZXQifQ.E5NPYa6ucsQGTij8gzihdT2zv7gmJwxCZwrbBnQSYXIBw7cMK7U0eC7z4VBEm3tFYCA9SoxIdQtfuGj_lw2-CaXqkkMu4929TtlrrK_nVHYlwsXMSGIW3bComTb2toX8bshD1kd3FnNBFujhrQ-ouuBfQjy2d4fVZA1M4sZi_eT8Lxjo1uI_LfgYxrlS8_IKgfz71NuM-Uc2vxidm2_AG0g7PboSPW24bv1R-Lv272hoR_SmjBPY-I2Pw8DTZwQxWmtoU_MOx1YnY97qx5G6zqbTsjbNYkk97xPb87tKQTo946pB80fOkipTrD2xwhc8AOZQywwKa5NT4nGayDKLdg"
76
+ jwt: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJjOTRhNzMwNS05MzY1LTQ2ZmYtYTQyMy00YjRiYzNiOGIxODAiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjp0cnVlLCJjb2duaXRvOnVzZXJuYW1lIjoiYzk0YTczMDUtOTM2NS00NmZmLWE0MjMtNGI0YmMzYjhiMTgwIiwiY29nbml0bzpyb2xlcyI6WyJhcm46YXdzOmlhbTo6ODk4NjcwMjMyODA3OnJvbGVcL2NvbnRlbnRvaC1kZXYtdXMtZWFzdC0xLWxhbWJkYVJvbGUiXSwiYXVkIjoiNWFjOHRwZ3M2Z2JzcTEzZnJ2cnBpZWVwNDAiLCJldmVudF9pZCI6Ijg3YjQwMTMzLTE0YTMtNDgyOC1iYzE0LWU3ZTgxM2I2YmFmMSIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNjY0NjA2Mjg0LCJuYW1lIjoiQ29sYWJvcmFkb3IiLCJwaG9uZV9udW1iZXIiOiIrNTIxMTExIiwiZXhwIjoxNjY0NjA5ODg0LCJpYXQiOjE2NjQ2MDYyODQsImVtYWlsIjoic2FsbWVyb24uNUBob3RtYWlsLmNvbSJ9.J0L3zmJ2cZdPx4LjjscrZlPG41yCp1tOxE6WLl8K2lT_6fa-fNAQQLekKRmA9RwW--yA6z97xLu1oCjd_ZrErdc_aLMxxA2wCffh068QOD6Vil5aOCNA12QuTz7WhZlz3oOHe7hgx4PIi65u8--mstLqtmTH2_5OfoaTfcYllk1M65w-AfayozTlFaaXQID05nrwuGCc2gBl3SorBhbVvatRzCeZZjWOHRqOrxaJYY0Q97zNS6E0Nd4nPioIibUjGsKh_Hl-RUivSkDcKtszS8OYl4Alia00Ownz74rx7svZy9gpMy8t9TOonSlTTnHqOR5gPyBYO__OZMa55RiGtQ"
63
77
  };
@@ -14,17 +14,18 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
14
14
  var _axios = _interopRequireDefault(require("axios"));
15
15
 
16
16
  var getProviders = /*#__PURE__*/function () {
17
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(jwt, companyId) {
17
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(jwt, user, companyId) {
18
18
  var _JSON$parse;
19
19
 
20
- var query, companies, finalArray;
20
+ var query, companies, _ref2, usersFinanced, _JSON$parse2, providers, finalArray;
21
+
21
22
  return _regenerator.default.wrap(function _callee$(_context) {
22
23
  while (1) {
23
24
  switch (_context.prev = _context.next) {
24
25
  case 0:
25
26
  query = companyId ? "?companyId=".concat(companyId) : "";
26
27
  _context.next = 3;
27
- return _axios.default.get("".concat(process.env.REACT_APP_READ_PROVIDERS).concat(query), {
28
+ return _axios.default.get("".concat(user.is_retailer ? process.env.REACT_APP_PENDING_INVITATIONS : process.env.REACT_APP_READ_PROVIDERS).concat(query), {
28
29
  headers: {
29
30
  Authorization: jwt
30
31
  }
@@ -32,10 +33,12 @@ var getProviders = /*#__PURE__*/function () {
32
33
 
33
34
  case 3:
34
35
  companies = _context.sent;
35
- finalArray = transformProvidersArray(((_JSON$parse = JSON.parse(companies.data.body || "{}")) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse.providers) || []);
36
+ _ref2 = ((_JSON$parse = JSON.parse(companies.data.body || "{}")) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse.data) || {}, usersFinanced = _ref2.usersFinanced;
37
+ _JSON$parse2 = JSON.parse(companies.data.body || "{}"), providers = _JSON$parse2.providers;
38
+ finalArray = transformProvidersArray(providers || usersFinanced || []);
36
39
  return _context.abrupt("return", finalArray);
37
40
 
38
- case 6:
41
+ case 8:
39
42
  case "end":
40
43
  return _context.stop();
41
44
  }
@@ -43,7 +46,7 @@ var getProviders = /*#__PURE__*/function () {
43
46
  }, _callee);
44
47
  }));
45
48
 
46
- return function getProviders(_x, _x2) {
49
+ return function getProviders(_x, _x2, _x3) {
47
50
  return _ref.apply(this, arguments);
48
51
  };
49
52
  }();
@@ -62,20 +65,25 @@ var transformProvidersArray = function transformProvidersArray(array) {
62
65
  };
63
66
 
64
67
  var getCategories = /*#__PURE__*/function () {
65
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
66
- var _JSON$parse2;
68
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(user, company) {
69
+ var _JSON$parse3;
67
70
 
68
- var response, categories, categoriesKeys, subCategories, finalArray, index;
71
+ var isTHDUser, key, query, response, categories, categoriesKeys, subCategories, finalArray, index;
69
72
  return _regenerator.default.wrap(function _callee2$(_context2) {
70
73
  while (1) {
71
74
  switch (_context2.prev = _context2.next) {
72
75
  case 0:
73
- _context2.next = 2;
74
- return _axios.default.get("".concat(process.env.REACT_APP_CATEGORY_ENDPOINT));
75
-
76
- case 2:
76
+ isTHDUser = user.is_retailer === 1;
77
+ key = company.financedRetailers ? "financedRetailers" : "retailers";
78
+ query = isTHDUser || key === "financedRetailers" ? "?id=".concat(encodeURIComponent(company[key].map(function (ret) {
79
+ return ret.id;
80
+ }).join(","))) : "";
81
+ _context2.next = 5;
82
+ return _axios.default.get("".concat(process.env.REACT_APP_CATEGORY_ENDPOINT).concat(query));
83
+
84
+ case 5:
77
85
  response = _context2.sent;
78
- categories = (_JSON$parse2 = JSON.parse(response.data.body)) === null || _JSON$parse2 === void 0 ? void 0 : _JSON$parse2.data;
86
+ categories = (_JSON$parse3 = JSON.parse(response.data.body)) === null || _JSON$parse3 === void 0 ? void 0 : _JSON$parse3.data;
79
87
  categoriesKeys = Object.keys(categories || {});
80
88
  subCategories = categoriesKeys === null || categoriesKeys === void 0 ? void 0 : categoriesKeys.map(function (key) {
81
89
  return categories[key].sub_category;
@@ -101,9 +109,12 @@ var getCategories = /*#__PURE__*/function () {
101
109
  });
102
110
  });
103
111
  });
112
+ finalArray.sort(function (a, b) {
113
+ return a.name.localeCompare(b.name);
114
+ });
104
115
  return _context2.abrupt("return", finalArray);
105
116
 
106
- case 10:
117
+ case 14:
107
118
  case "end":
108
119
  return _context2.stop();
109
120
  }
@@ -111,8 +122,8 @@ var getCategories = /*#__PURE__*/function () {
111
122
  }, _callee2);
112
123
  }));
113
124
 
114
- return function getCategories() {
115
- return _ref2.apply(this, arguments);
125
+ return function getCategories(_x4, _x5) {
126
+ return _ref3.apply(this, arguments);
116
127
  };
117
128
  }();
118
129
 
@@ -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,
@@ -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 12:
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
- _context6.next = 7;
448
+ applicantsFilter.length > 0 && (queryObject["requestedBy"] = applicantsFilter.join(","));
449
+ _context6.next = 8;
429
450
  return loadProductsByStatus(queryObject);
430
451
 
431
- case 7:
432
- _context6.next = 9;
452
+ case 8:
453
+ _context6.next = 10;
433
454
  return loadRequiredProducts(queryObject);
434
455
 
435
- case 9:
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: "Seleccionar Fecha",
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: "Seleccionar Proveedor",
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: "Seleccionar Departamento",
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: "Seleccionar Alcance",
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,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.2.50",
3
+ "version": "21.2.52",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -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 type={type} data={data} options={options} />
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
  };