contentoh-components-library 21.2.1 → 21.2.4

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.
@@ -43,14 +43,13 @@ var DashboardMetric = function DashboardMetric(_ref) {
43
43
  displayScale = _ref$displayScale === void 0 ? false : _ref$displayScale,
44
44
  _ref$retailers = _ref.retailers,
45
45
  retailers = _ref$retailers === void 0 ? [] : _ref$retailers,
46
- setQueryObject = _ref.setQueryObject;
46
+ setQueryObject = _ref.setQueryObject,
47
+ queryObject = _ref.queryObject;
47
48
 
48
49
  var onChangeRetailer = function onChangeRetailer(e) {
49
- setQueryObject(function (current) {
50
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, current), {}, {
51
- retailerId: e.target.value
52
- });
53
- });
50
+ setQueryObject((0, _objectSpread2.default)((0, _objectSpread2.default)({}, queryObject), {}, {
51
+ retailerId: e.target.value
52
+ }));
54
53
  };
55
54
 
56
55
  var _useState = (0, _react.useState)(new Date()),
@@ -79,12 +78,10 @@ var DashboardMetric = function DashboardMetric(_ref) {
79
78
 
80
79
  setStartDate(start);
81
80
  setEndDate(end);
82
- if (end) setQueryObject(function (current) {
83
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, current), {}, {
84
- startDate: "".concat(start.getFullYear(), "-").concat(start.getDate(), "-").concat(start.getMonth() + 1),
85
- endDate: "".concat(end === null || end === void 0 ? void 0 : end.getFullYear(), "-").concat(end === null || end === void 0 ? void 0 : end.getDate(), "-").concat((end === null || end === void 0 ? void 0 : end.getMonth()) + 1)
86
- });
87
- });
81
+ if (end) setQueryObject((0, _objectSpread2.default)((0, _objectSpread2.default)({}, queryObject), {}, {
82
+ startDate: "".concat(start.getFullYear(), "-").concat(start.getMonth() + 1, "-").concat(start.getDate()),
83
+ endDate: "".concat(end.getFullYear(), "-").concat(end.getMonth() + 1, "-").concat(end.getDate())
84
+ }));
88
85
  };
89
86
 
90
87
  var labels = Object.keys(dataObject);
@@ -21,6 +21,8 @@ var _DashboardMetric = require("../../organisms/DashboardMetric");
21
21
 
22
22
  var _react = require("react");
23
23
 
24
+ var _Loading = require("../../atoms/Loading");
25
+
24
26
  var _axios = _interopRequireDefault(require("axios"));
25
27
 
26
28
  var _jsxRuntime = require("react/jsx-runtime");
@@ -41,12 +43,20 @@ var Dashboard = function Dashboard() {
41
43
  requiredProducts = _useState6[0],
42
44
  setRequiredProducts = _useState6[1];
43
45
 
44
- var _useState7 = (0, _react.useState)({}),
46
+ var _useState7 = (0, _react.useState)({
47
+ retailerId: null,
48
+ startDate: null,
49
+ endDate: null
50
+ }),
45
51
  _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
46
52
  orderByStatus = _useState8[0],
47
53
  setOrderByStatus = _useState8[1];
48
54
 
49
- var _useState9 = (0, _react.useState)({}),
55
+ var _useState9 = (0, _react.useState)({
56
+ retailerId: null,
57
+ startDate: null,
58
+ endDate: null
59
+ }),
50
60
  _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
51
61
  orderByRequired = _useState10[0],
52
62
  setOrderByRequired = _useState10[1];
@@ -56,38 +66,51 @@ var Dashboard = function Dashboard() {
56
66
  retailers = _useState12[0],
57
67
  setRetailers = _useState12[1];
58
68
 
69
+ var _useState13 = (0, _react.useState)(true),
70
+ _useState14 = (0, _slicedToArray2.default)(_useState13, 2),
71
+ loading = _useState14[0],
72
+ setLoading = _useState14[1];
73
+
59
74
  var loadProductVersions = /*#__PURE__*/function () {
60
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(byStatus, queryObject) {
61
- var retailerId, startDate, endDate, fullData, query, response, versionList;
75
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(queryObject) {
76
+ var byStatus,
77
+ retailerId,
78
+ startDate,
79
+ endDate,
80
+ query,
81
+ endpoint,
82
+ response,
83
+ _args = arguments;
62
84
  return _regenerator.default.wrap(function _callee$(_context) {
63
85
  while (1) {
64
86
  switch (_context.prev = _context.next) {
65
87
  case 0:
66
- retailerId = queryObject.retailerId, startDate = queryObject.startDate, endDate = queryObject.endDate, fullData = queryObject.fullData;
67
- query = fullData ? "fullData=true" : "retailerId=".concat(retailerId, "&startDate=").concat(startDate, "&endDate=").concat(endDate);
68
- _context.prev = 2;
69
- _context.next = 5;
70
- return _axios.default.get(byStatus ? "".concat(process.env.REACT_APP_READ_ORDERS_BY_STATUS, "?").concat(query) : "".concat(process.env.REACT_APP_READ_REQUIRED_ORDERS, "?retailerId=").concat(retailerId, "&startDate=").concat(startDate, "&endDate=").concat(endDate));
88
+ byStatus = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
89
+ retailerId = queryObject.retailerId, startDate = queryObject.startDate, endDate = queryObject.endDate;
90
+ query = "retailerId=".concat(retailerId, "&startDate=").concat(startDate, "&endDate=").concat(endDate);
91
+ endpoint = byStatus ? process.env.REACT_APP_READ_ORDERS_BY_STATUS : process.env.REACT_APP_READ_REQUIRED_ORDERS;
92
+ _context.prev = 4;
93
+ _context.next = 7;
94
+ return _axios.default.get("".concat(endpoint, "?").concat(query));
71
95
 
72
- case 5:
96
+ case 7:
73
97
  response = _context.sent;
74
- versionList = JSON.parse(response.data.body);
75
- return _context.abrupt("return", versionList);
98
+ return _context.abrupt("return", JSON.parse(response.data.body));
76
99
 
77
- case 10:
78
- _context.prev = 10;
79
- _context.t0 = _context["catch"](2);
100
+ case 11:
101
+ _context.prev = 11;
102
+ _context.t0 = _context["catch"](4);
80
103
  console.log(_context.t0);
81
104
 
82
- case 13:
105
+ case 14:
83
106
  case "end":
84
107
  return _context.stop();
85
108
  }
86
109
  }
87
- }, _callee, null, [[2, 10]]);
110
+ }, _callee, null, [[4, 11]]);
88
111
  }));
89
112
 
90
- return function loadProductVersions(_x, _x2) {
113
+ return function loadProductVersions(_x) {
91
114
  return _ref.apply(this, arguments);
92
115
  };
93
116
  }();
@@ -125,35 +148,39 @@ var Dashboard = function Dashboard() {
125
148
 
126
149
  var loadProductsByStatus = /*#__PURE__*/function () {
127
150
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(orderByStatus) {
128
- var _yield$loadProductVer, orders, fullData;
151
+ var _yield$loadProductVer, orders, fullData, total, R, ACA, PA, inProcess;
129
152
 
130
153
  return _regenerator.default.wrap(function _callee3$(_context3) {
131
154
  while (1) {
132
155
  switch (_context3.prev = _context3.next) {
133
156
  case 0:
134
157
  _context3.next = 2;
135
- return loadProductVersions(true, orderByStatus);
158
+ return loadProductVersions(orderByStatus, true);
136
159
 
137
160
  case 2:
138
161
  _yield$loadProductVer = _context3.sent;
139
162
  orders = _yield$loadProductVer.orders;
140
163
  fullData = _yield$loadProductVer.fullData;
164
+ total = fullData.total, R = fullData.R, ACA = fullData.ACA, PA = fullData.PA;
165
+ inProcess = Object.keys(fullData).reduce(function (prev, curr) {
166
+ return !['total', 'ACA', 'PA', 'R'].includes(curr) ? prev + fullData[curr] : prev;
167
+ }, 0);
141
168
  setMetricsData([{
142
169
  label: "Productos totales",
143
- value: fullData === null || fullData === void 0 ? void 0 : fullData.total
170
+ value: total
144
171
  }, {
145
172
  label: "Productos sin asignar",
146
- value: fullData === null || fullData === void 0 ? void 0 : fullData.PA
173
+ value: PA + R
147
174
  }, {
148
175
  label: "Productos en proceso",
149
- value: fullData === null || fullData === void 0 ? void 0 : fullData.CA
176
+ value: inProcess
150
177
  }, {
151
178
  label: "Productos terminados",
152
- value: fullData === null || fullData === void 0 ? void 0 : fullData.AP
179
+ value: ACA
153
180
  }]);
154
181
  setProductsByStatus(orders);
155
182
 
156
- case 7:
183
+ case 9:
157
184
  case "end":
158
185
  return _context3.stop();
159
186
  }
@@ -161,7 +188,7 @@ var Dashboard = function Dashboard() {
161
188
  }, _callee3);
162
189
  }));
163
190
 
164
- return function loadProductsByStatus(_x3) {
191
+ return function loadProductsByStatus(_x2) {
165
192
  return _ref3.apply(this, arguments);
166
193
  };
167
194
  }();
@@ -175,7 +202,7 @@ var Dashboard = function Dashboard() {
175
202
  switch (_context4.prev = _context4.next) {
176
203
  case 0:
177
204
  _context4.next = 2;
178
- return loadProductVersions(false, orderByRequired);
205
+ return loadProductVersions(orderByRequired);
179
206
 
180
207
  case 2:
181
208
  _yield$loadProductVer2 = _context4.sent;
@@ -190,7 +217,7 @@ var Dashboard = function Dashboard() {
190
217
  }, _callee4);
191
218
  }));
192
219
 
193
- return function loadRequiredProducts(_x4) {
220
+ return function loadRequiredProducts(_x3) {
194
221
  return _ref4.apply(this, arguments);
195
222
  };
196
223
  }();
@@ -198,8 +225,8 @@ var Dashboard = function Dashboard() {
198
225
  (0, _react.useEffect)(function () {
199
226
  var today = new Date();
200
227
  var firstWeekDay = today.getDate() - today.getDay();
201
- var startDate = "".concat(today.getFullYear(), "-").concat(firstWeekDay, "-").concat(today.getMonth() + 1);
202
- var endDate = "".concat(today.getFullYear(), "-").concat(today.getDate(), "-").concat(today.getMonth() + 1);
228
+ var startDate = "".concat(today.getFullYear(), "-").concat(today.getMonth() + 1, "-").concat(firstWeekDay);
229
+ var endDate = "".concat(today.getFullYear(), "-").concat(today.getMonth() + 1, "-").concat(today.getDate());
203
230
  var queryObject = {
204
231
  retailerId: "58",
205
232
  startDate: startDate,
@@ -208,14 +235,13 @@ var Dashboard = function Dashboard() {
208
235
  setOrderByStatus(queryObject);
209
236
  setOrderByRequired(queryObject);
210
237
  getRetailers();
238
+ loadProductsByStatus(queryObject);
239
+ loadRequiredProducts(queryObject);
211
240
  }, []);
212
241
  (0, _react.useEffect)(function () {
213
- loadProductsByStatus(orderByStatus);
214
- }, [orderByStatus]);
215
- (0, _react.useEffect)(function () {
216
- loadRequiredProducts(orderByRequired);
217
- }, [orderByRequired]);
218
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
242
+ (orderByRequired === null || orderByRequired === void 0 ? void 0 : orderByRequired.retailerId) && (orderByStatus === null || orderByStatus === void 0 ? void 0 : orderByStatus.retailerId) && metricsData.length > 0 && setLoading(false);
243
+ }, [orderByRequired, orderByStatus, metricsData]);
244
+ return loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
219
245
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
220
246
  className: "metric-cards",
221
247
  children: metricsData.map(function (metric, index) {
@@ -233,7 +259,10 @@ var Dashboard = function Dashboard() {
233
259
  retailerSelected: orderByStatus.retailerId,
234
260
  retailers: retailers,
235
261
  queryObject: orderByStatus,
236
- setQueryObject: setOrderByStatus
262
+ setQueryObject: function setQueryObject(evt) {
263
+ loadProductsByStatus(evt);
264
+ setOrderByStatus(evt);
265
+ }
237
266
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DashboardMetric.DashboardMetric, {
238
267
  label: "Productos solicitados",
239
268
  description: "Filtra los productos solicitados por fecha y alcance para revisar rápidamente el flujo de trabajo.",
@@ -245,7 +274,10 @@ var Dashboard = function Dashboard() {
245
274
  retailers: retailers,
246
275
  retailerSelected: orderByRequired.retailerId,
247
276
  queryObject: orderByRequired,
248
- setQueryObject: setOrderByRequired
277
+ setQueryObject: function setQueryObject(evt) {
278
+ loadRequiredProducts(evt);
279
+ setOrderByRequired(evt);
280
+ }
249
281
  })]
250
282
  })]
251
283
  });
@@ -31,59 +31,233 @@ RetailerProductEditionDefault.args = {
31
31
  "Ficha técnica": false,
32
32
  Imágenes: false
33
33
  },
34
- token: "eyJraWQiOiJEV3owZnNieXg2MXNFcVduN3RCXC81bVhod3ZNbFZIOTgwUnZcL3RjT0lKdEk9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiIwYjY2YTRhOS03NzkwLTQwMzQtYTMwYS1jMDA4MDg5NjI4NjciLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfbFN6UVo0WjdSIiwiY29nbml0bzp1c2VybmFtZSI6IjBiNjZhNGE5LTc3OTAtNDAzNC1hMzBhLWMwMDgwODk2Mjg2NyIsImF1ZCI6IjUyZDlza2tkY2c4cWpwODhvb2sxdXNlNm1rIiwiZXZlbnRfaWQiOiI4ZjA2YmU0NC04ZWEzLTQ5OWMtOGFjZC0xMDlmMDZiZWI1MjAiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY2MDA3NjQ5MywibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY2MDA4MDA5MywiaWF0IjoxNjYwMDc2NDkzLCJlbWFpbCI6ImJheWFkaTE1MzhAbW5xbG0uY29tIn0.aw_x1A8WR2MCp_Kz-T2Jcg0ZtuKwyzQ23yT_OoKr-aGJmEjSPihmksWgLZr9hJXyfvU0JndaVMM_3DRly1TdtJ264zwH4dZ7Cp9gF4TSXG16HQxIIPUA4NnwdpOnlBdE9E27mCXs4XYnCZ7dRMXnkjpRL4PVbrGji9qbEEJR6TxCJafR-zes1o4HC1KfQ5QF4s5I_LYQYbD-Ot0A1zDiJg34HR9tTILu5f4uc_2Nj8bqqYJsEdKg982WWO9ac2uKRPXQqNL6CsdltnSeQQcnS6Wj5DJTRRoc-lRdE6ekpAvDGPo0Dyj1Q8GYH3uxvM-pVu8J1Z_JOtO5j5mPN9krpA",
34
+ token: "eyJraWQiOiJEV3owZnNieXg2MXNFcVduN3RCXC81bVhod3ZNbFZIOTgwUnZcL3RjT0lKdEk9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiIwYjY2YTRhOS03NzkwLTQwMzQtYTMwYS1jMDA4MDg5NjI4NjciLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfbFN6UVo0WjdSIiwiY29nbml0bzp1c2VybmFtZSI6IjBiNjZhNGE5LTc3OTAtNDAzNC1hMzBhLWMwMDgwODk2Mjg2NyIsImF1ZCI6IjUyZDlza2tkY2c4cWpwODhvb2sxdXNlNm1rIiwiZXZlbnRfaWQiOiIzNmIxMmUwMy0xOWJhLTRiMDktYWJiYS1kZjk3ZTFkNThjZTQiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY2MDE4MjgzNywibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY2MDE4NjQzNywiaWF0IjoxNjYwMTgyODM3LCJlbWFpbCI6ImJheWFkaTE1MzhAbW5xbG0uY29tIn0.MM9nIHkrRIS2o8_s4BR6VTLgyw3ryvPrr-mf6RtnQ4smng2Q3fmtK07zInNcvcrv8EXO5J9z47_NZ5MOJDo1Pz1CV2cOYM7PT5tEn3F-W4SitqDbBw3KxfkqSMxdZUIHLWECGL-u2ATCYU2J4KRVQi8XSP1qbfv1hu9dh-vID8Fq641ccQwEqUDC13pshDPlR08legg7AAPJqoilV7wuvxqTYAK6fGqMS5jcdW2iDmU0ti9gkydXkYRIC-jg446VOmRCpwzKsk4UAPwlrGeodQ0LV1bfWn_-KVspWCRQd6U5WbFxHn0umYe3CvvPpyVmHzD3F_EMxaVyqV5aW5IoIQ",
35
35
  productSelected: {
36
36
  services: {
37
- datasheets: 0,
38
- descriptions: 0,
37
+ datasheets: 1,
38
+ descriptions: 1,
39
39
  images: 1
40
40
  },
41
- orderId: 1789,
42
- status: "ACA",
43
- datasheet_status: "NS",
41
+ orderId: 2296,
42
+ status: "AP",
43
+ datasheet_status: "AP",
44
44
  prio: "none",
45
- version: 2,
46
- description_status: "NS",
47
- images_status: "ACA",
45
+ version: 8,
46
+ description_status: "ACA",
47
+ images_status: "AP",
48
48
  article: {
49
- id_article: 68865,
50
- id_category: "2999",
51
- name: "RESIZE",
52
- upc: "169955",
53
- timestamp: "2022-06-21T16:03:10.000Z",
54
- id_user: 1238,
55
- status: "NULL",
56
- active: 0,
57
- company_id: 819,
49
+ id_article: 14701,
50
+ id_category: "684",
51
+ name: "Pasta Dental Colgate Total 12 Clean Mint de 100 ml",
52
+ upc: "7501035911369",
53
+ timestamp: "2021-10-09T16:33:17.000Z",
54
+ id_user: 203,
55
+ status: "Ex",
56
+ active: 1,
57
+ company_id: 226,
58
58
  SKU: null,
59
59
  Descripcion: null,
60
60
  Proveedor: null,
61
61
  id_proveedor: 0,
62
- company_name: "The Home Depot Resize",
63
- country: "México",
64
- id_order: 1789,
65
- id_datasheet_especialist: null,
66
- id_datasheet_facilitator: null,
67
- id_description_especialist: null,
68
- id_description_facilitator: null,
69
- id_images_especialist: 1250,
70
- id_images_facilitator: 424,
71
- id_auditor: null,
62
+ company_name: "Prueba Test S.A de C.V.",
63
+ country: "null",
64
+ id_order: 2296,
65
+ id_datasheet_especialist: 405,
66
+ id_datasheet_facilitator: 158,
67
+ id_description_especialist: 405,
68
+ id_description_facilitator: 158,
69
+ id_images_especialist: 366,
70
+ id_images_facilitator: 160,
71
+ id_auditor: 9,
72
72
  id_recepcionist: null,
73
- category: "Resizing|Resizing|Resizing",
74
- missingAttributes: null,
75
- missingDescriptions: null,
76
- missingImages: null
73
+ category: "Salud y Belleza|Cuidado Bucal|Pastas Dentales y Aseo Bucal",
74
+ missingAttributes: -1,
75
+ missingDescriptions: 3,
76
+ missingImages: -9
77
77
  },
78
78
  retailers: [{
79
- id: 60,
80
- name: "The Home Depot Resizing",
79
+ id: 4,
80
+ name: "Walmart Super y Superama",
81
81
  country: "México",
82
82
  id_region: 1,
83
- active: 1
83
+ active: 1,
84
+ percentage: 97.61904761904763,
85
+ image: "https://content-management-images.s3.amazonaws.com/retailers/4.png",
86
+ services: ["NA", "NA", "NA"]
87
+ }, {
88
+ id: 5,
89
+ name: "Chedraui",
90
+ country: "México",
91
+ id_region: 1,
92
+ active: 1,
93
+ percentage: 100,
94
+ image: "https://content-management-images.s3.amazonaws.com/retailers/5.png",
95
+ services: ["NA", "NA", "NA"]
96
+ }, {
97
+ id: 6,
98
+ name: "HEB",
99
+ country: "México",
100
+ id_region: 1,
101
+ active: 1,
102
+ percentage: 100,
103
+ image: "https://content-management-images.s3.amazonaws.com/retailers/6.png",
104
+ services: ["AP", "ACA", "AP"]
105
+ }, {
106
+ id: 7,
107
+ name: "Mega",
108
+ country: "México",
109
+ id_region: 1,
110
+ active: 1,
111
+ percentage: 100,
112
+ image: "https://content-management-images.s3.amazonaws.com/retailers/7.png",
113
+ services: ["NA", "NA", "NA"]
114
+ }, {
115
+ id: 8,
116
+ name: "Fragua",
117
+ country: "México",
118
+ id_region: 1,
119
+ active: 1,
120
+ percentage: null,
121
+ image: "https://content-management-images.s3.amazonaws.com/retailers/8.png",
122
+ services: ["NA", "NA", "NA"]
123
+ }, {
124
+ id: 9,
125
+ name: "Amazon",
126
+ country: "México",
127
+ id_region: 1,
128
+ active: 1,
129
+ percentage: 85.18518518518518,
130
+ image: "https://content-management-images.s3.amazonaws.com/retailers/9.png",
131
+ services: ["NA", "NA", "NA"]
132
+ }, {
133
+ id: 12,
134
+ name: "La Comer",
135
+ country: "México",
136
+ id_region: 1,
137
+ active: 1,
138
+ percentage: 100,
139
+ image: "https://content-management-images.s3.amazonaws.com/retailers/12.png",
140
+ services: ["NA", "NA", "NA"]
141
+ }, {
142
+ id: 13,
143
+ name: "Soriana",
144
+ country: "México",
145
+ id_region: 1,
146
+ active: 1,
147
+ percentage: 100,
148
+ image: "https://content-management-images.s3.amazonaws.com/retailers/13.png",
149
+ services: ["NA", "NA", "NA"]
150
+ }, {
151
+ id: 16,
152
+ name: "Rappi",
153
+ country: "México",
154
+ id_region: 1,
155
+ active: 1,
156
+ percentage: 93.33333333333333,
157
+ image: "https://content-management-images.s3.amazonaws.com/retailers/16.png",
158
+ services: ["NA", "NA", "NA"]
159
+ }, {
160
+ id: 17,
161
+ name: "Genérico",
162
+ country: "México",
163
+ id_region: 1,
164
+ active: 1,
165
+ percentage: 100,
166
+ image: "https://content-management-images.s3.amazonaws.com/retailers/17.png",
167
+ services: ["NA", "NA", "NA"]
168
+ }, {
169
+ id: 18,
170
+ name: "Google",
171
+ country: "México",
172
+ id_region: 1,
173
+ active: 1,
174
+ percentage: 96.66666666666667,
175
+ image: "https://content-management-images.s3.amazonaws.com/retailers/18.png",
176
+ services: ["NA", "NA", "NA"]
177
+ }, {
178
+ id: 20,
179
+ name: "Cornershop",
180
+ country: "México",
181
+ id_region: 1,
182
+ active: 1,
183
+ percentage: 91.66666666666667,
184
+ image: "https://content-management-images.s3.amazonaws.com/retailers/20.png",
185
+ services: ["NA", "NA", "NA"]
186
+ }, {
187
+ id: 24,
188
+ name: "Alsuper",
189
+ country: "México",
190
+ id_region: 1,
191
+ active: 1,
192
+ percentage: 95.83333333333333,
193
+ image: "https://content-management-images.s3.amazonaws.com/retailers/24.png",
194
+ services: ["NA", "NA", "NA"]
195
+ }, {
196
+ id: 27,
197
+ name: "IMPIRA México",
198
+ country: "México",
199
+ id_region: 1,
200
+ active: 1,
201
+ percentage: 100,
202
+ image: "https://content-management-images.s3.amazonaws.com/retailers/27.png",
203
+ services: ["NA", "NA", "NA"]
204
+ }, {
205
+ id: 29,
206
+ name: "Farmacias del Ahorro",
207
+ country: "México",
208
+ id_region: 1,
209
+ active: 1,
210
+ percentage: 81.48148148148148,
211
+ image: "https://content-management-images.s3.amazonaws.com/retailers/29.png",
212
+ services: ["NA", "NA", "NA"]
213
+ }, {
214
+ id: 33,
215
+ name: "Merza",
216
+ country: "México",
217
+ id_region: 1,
218
+ active: 1,
219
+ percentage: 66.66666666666667,
220
+ image: "https://content-management-images.s3.amazonaws.com/retailers/33.png",
221
+ services: ["NA", "NA", "NA"]
222
+ }, {
223
+ id: 34,
224
+ name: "San Pablo",
225
+ country: "México",
226
+ id_region: 1,
227
+ active: 1,
228
+ percentage: 95.16666666666667,
229
+ image: "https://content-management-images.s3.amazonaws.com/retailers/34.png",
230
+ services: ["NA", "NA", "NA"]
231
+ }, {
232
+ id: 38,
233
+ name: "Del Sol",
234
+ country: "México",
235
+ id_region: 1,
236
+ active: 1,
237
+ percentage: 100,
238
+ image: "https://content-management-images.s3.amazonaws.com/retailers/38.png",
239
+ services: ["NA", "NA", "NA"]
240
+ }, {
241
+ id: 39,
242
+ name: "Justo",
243
+ country: "México",
244
+ id_region: 1,
245
+ active: 1,
246
+ percentage: 94.73684210526316,
247
+ image: "https://content-management-images.s3.amazonaws.com/retailers/39.png",
248
+ services: ["NA", "NA", "NA"]
249
+ }, {
250
+ id: 62,
251
+ name: "Sanborns Café",
252
+ country: "México",
253
+ id_region: 1,
254
+ active: 1,
255
+ percentage: 100,
256
+ image: "https://content-management-images.s3.amazonaws.com/retailers/62.png",
257
+ services: ["NA", "NA", "NA"]
84
258
  }],
85
- country: "México",
86
- upc: "169955"
259
+ country: "null",
260
+ upc: "7501035911369"
87
261
  },
88
262
  location: {
89
263
  product: {
@@ -92,15 +266,15 @@ RetailerProductEditionDefault.args = {
92
266
  }
93
267
  },
94
268
  user: {
95
- id_user: 425,
96
- name: "Auditor QA",
269
+ id_user: 423,
270
+ name: "Facilitador Textos",
97
271
  last_name: " ",
98
- email: "ladiboh785@mi166.com",
272
+ email: "bayadi1538@mnqlm.com",
99
273
  position: "Tester",
100
274
  telephone: null,
101
275
  country: null,
102
276
  id_company: 254,
103
- id_cognito: "23a3f496-4e38-4e12-9bf5-7f90b77a2f35",
277
+ id_cognito: "0b66a4a9-7790-4034-a30a-c00808962867",
104
278
  birth_Date: null,
105
279
  about_me: null,
106
280
  zip_code: null,
@@ -122,6 +296,6 @@ RetailerProductEditionDefault.args = {
122
296
  products_limit: "1000",
123
297
  type: "Enterprise"
124
298
  },
125
- src: "https://content-management-profile-prod.s3.amazonaws.com/id-425/425.png?1659649029658"
299
+ src: "https://content-management-profile-prod.s3.amazonaws.com/id-423/423.png?1660182839373"
126
300
  }
127
301
  };
@@ -118,7 +118,7 @@ var reducerImages = function reducerImages(state, action) {
118
118
 
119
119
  case "changeAttrValue":
120
120
  var index = attrForImgs.general.findIndex(function (f) {
121
- return f.id = action.id;
121
+ return f.id === action.id;
122
122
  });
123
123
 
124
124
  if (index !== -1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.2.1",
3
+ "version": "21.2.4",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -22,6 +22,7 @@
22
22
  "prop-types": "^15.7.2",
23
23
  "react": "^17.0.2",
24
24
  "react-chartjs-2": "^4.0.1",
25
+ "react-datepicker": "^4.8.0",
25
26
  "react-dom": "^17.0.2",
26
27
  "react-draft-wysiwyg": "^1.14.7",
27
28
  "react-dropzone": "^12.0.4",
@@ -15,9 +15,11 @@ export const DashboardMetric = ({
15
15
  displayScale = false,
16
16
  retailers = [],
17
17
  setQueryObject,
18
+ queryObject
18
19
  }) => {
20
+
19
21
  const onChangeRetailer = (e) => {
20
- setQueryObject((current) => ({ ...current, retailerId: e.target.value }));
22
+ setQueryObject({ ...queryObject, retailerId: e.target.value });
21
23
  };
22
24
 
23
25
  const [startDate, setStartDate] = useState(new Date());
@@ -39,15 +41,13 @@ export const DashboardMetric = ({
39
41
  setStartDate(start);
40
42
  setEndDate(end);
41
43
  if (end)
42
- setQueryObject((current) => ({
43
- ...current,
44
- startDate: `${start.getFullYear()}-${start.getDate()}-${
44
+ setQueryObject({
45
+ ...queryObject,
46
+ startDate: `${start.getFullYear()}-${
45
47
  start.getMonth() + 1
46
- }`,
47
- endDate: `${end?.getFullYear()}-${end?.getDate()}-${
48
- end?.getMonth() + 1
49
- }`,
50
- }));
48
+ }-${start.getDate()}`,
49
+ endDate: `${end.getFullYear()}-${end.getMonth() + 1}-${end.getDate()}`,
50
+ });
51
51
  };
52
52
 
53
53
  const labels = Object.keys(dataObject);