contentoh-components-library 21.2.27 → 21.2.28
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 +2 -0
- package/.env.production +1 -0
- package/dist/assets/images/customSelect/searchIcon.png +0 -0
- package/dist/components/atoms/VerticalSideMenuMainPage/index.js +46 -53
- package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +18 -29
- package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +54 -0
- package/dist/components/molecules/CustomSelect/SelectItem.js +132 -0
- package/dist/components/molecules/CustomSelect/index.js +178 -0
- package/dist/components/molecules/CustomSelect/styles.js +20 -0
- package/dist/components/organisms/Calendar/styles.js +1 -1
- package/dist/components/organisms/DashboardMetric/index.js +5 -80
- package/dist/components/pages/Dashboard/Dashboard.stories.js +36 -1
- package/dist/components/pages/Dashboard/dashboardUtils.js +129 -0
- package/dist/components/pages/Dashboard/index.js +294 -65
- package/dist/components/pages/Dashboard/styles.js +1 -1
- package/dist/global-files/customHooks.js +0 -1
- package/package.json +1 -1
- package/src/assets/images/customSelect/searchIcon.png +0 -0
- package/src/components/atoms/VerticalSideMenuMainPage/index.js +37 -55
- package/src/components/atoms/VerticalSideMenuMainPage/styles.js +69 -140
- package/src/components/molecules/CustomSelect/CustomSelect.stories.js +27 -0
- package/src/components/molecules/CustomSelect/SelectItem.js +97 -0
- package/src/components/molecules/CustomSelect/index.js +134 -0
- package/src/components/molecules/CustomSelect/styles.js +115 -0
- package/src/components/organisms/Calendar/styles.js +2 -0
- package/src/components/organisms/DashboardMetric/index.js +3 -58
- package/src/components/pages/Dashboard/Dashboard.stories.js +36 -1
- package/src/components/pages/Dashboard/dashboardUtils.js +62 -0
- package/src/components/pages/Dashboard/index.js +190 -26
- package/src/components/pages/Dashboard/styles.js +13 -0
- package/src/global-files/customHooks.js +0 -1
- 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
|
@@ -23,11 +23,18 @@ var _react = require("react");
|
|
|
23
23
|
|
|
24
24
|
var _Loading = require("../../atoms/Loading");
|
|
25
25
|
|
|
26
|
+
var _CustomSelect = require("../../molecules/CustomSelect");
|
|
27
|
+
|
|
28
|
+
var _dashboardUtils = require("./dashboardUtils");
|
|
29
|
+
|
|
26
30
|
var _axios = _interopRequireDefault(require("axios"));
|
|
27
31
|
|
|
28
32
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
33
|
|
|
30
|
-
var Dashboard = function Dashboard() {
|
|
34
|
+
var Dashboard = function Dashboard(_ref) {
|
|
35
|
+
var jwt = _ref.jwt,
|
|
36
|
+
user = _ref.user;
|
|
37
|
+
|
|
31
38
|
var _useState = (0, _react.useState)([]),
|
|
32
39
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
33
40
|
metricsData = _useState2[0],
|
|
@@ -61,7 +68,7 @@ var Dashboard = function Dashboard() {
|
|
|
61
68
|
orderByRequired = _useState10[0],
|
|
62
69
|
setOrderByRequired = _useState10[1];
|
|
63
70
|
|
|
64
|
-
var _useState11 = (0, _react.useState)(
|
|
71
|
+
var _useState11 = (0, _react.useState)([]),
|
|
65
72
|
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
66
73
|
retailers = _useState12[0],
|
|
67
74
|
setRetailers = _useState12[1];
|
|
@@ -71,12 +78,49 @@ var Dashboard = function Dashboard() {
|
|
|
71
78
|
loading = _useState14[0],
|
|
72
79
|
setLoading = _useState14[1];
|
|
73
80
|
|
|
81
|
+
var _useState15 = (0, _react.useState)([]),
|
|
82
|
+
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
83
|
+
providers = _useState16[0],
|
|
84
|
+
setProviders = _useState16[1];
|
|
85
|
+
|
|
86
|
+
var _useState17 = (0, _react.useState)([]),
|
|
87
|
+
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
88
|
+
categories = _useState18[0],
|
|
89
|
+
setCategories = _useState18[1];
|
|
90
|
+
|
|
91
|
+
var _useState19 = (0, _react.useState)([]),
|
|
92
|
+
_useState20 = (0, _slicedToArray2.default)(_useState19, 2),
|
|
93
|
+
retailerId = _useState20[0],
|
|
94
|
+
setRetailerId = _useState20[1];
|
|
95
|
+
|
|
96
|
+
var _useState21 = (0, _react.useState)([]),
|
|
97
|
+
_useState22 = (0, _slicedToArray2.default)(_useState21, 2),
|
|
98
|
+
categoryId = _useState22[0],
|
|
99
|
+
setCategoryId = _useState22[1];
|
|
100
|
+
|
|
101
|
+
var _useState23 = (0, _react.useState)([]),
|
|
102
|
+
_useState24 = (0, _slicedToArray2.default)(_useState23, 2),
|
|
103
|
+
companyId = _useState24[0],
|
|
104
|
+
setCompanyId = _useState24[1];
|
|
105
|
+
|
|
106
|
+
var _useState25 = (0, _react.useState)({
|
|
107
|
+
startDate: new Date("1900-01-01"),
|
|
108
|
+
endDate: new Date()
|
|
109
|
+
}),
|
|
110
|
+
_useState26 = (0, _slicedToArray2.default)(_useState25, 2),
|
|
111
|
+
datesRange = _useState26[0],
|
|
112
|
+
setDatesRange = _useState26[1];
|
|
113
|
+
|
|
114
|
+
var _useState27 = (0, _react.useState)([]),
|
|
115
|
+
_useState28 = (0, _slicedToArray2.default)(_useState27, 2),
|
|
116
|
+
dateOptions = _useState28[0],
|
|
117
|
+
setDateOptions = _useState28[1];
|
|
118
|
+
|
|
74
119
|
var loadProductVersions = /*#__PURE__*/function () {
|
|
75
|
-
var
|
|
120
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(queryObject) {
|
|
76
121
|
var byStatus,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
endDate,
|
|
122
|
+
keys,
|
|
123
|
+
string,
|
|
80
124
|
query,
|
|
81
125
|
endpoint,
|
|
82
126
|
response,
|
|
@@ -86,60 +130,67 @@ var Dashboard = function Dashboard() {
|
|
|
86
130
|
switch (_context.prev = _context.next) {
|
|
87
131
|
case 0:
|
|
88
132
|
byStatus = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
|
|
89
|
-
|
|
90
|
-
|
|
133
|
+
keys = Object.keys(queryObject);
|
|
134
|
+
string = [];
|
|
135
|
+
keys.forEach(function (key) {
|
|
136
|
+
return string.push("".concat(key, "=").concat(queryObject[key]));
|
|
137
|
+
});
|
|
138
|
+
query = string.join("&");
|
|
91
139
|
endpoint = byStatus ? process.env.REACT_APP_READ_ORDERS_BY_STATUS : process.env.REACT_APP_READ_REQUIRED_ORDERS;
|
|
92
|
-
_context.prev =
|
|
93
|
-
_context.next =
|
|
94
|
-
return _axios.default.get("".concat(endpoint, "?").concat(query)
|
|
140
|
+
_context.prev = 6;
|
|
141
|
+
_context.next = 9;
|
|
142
|
+
return _axios.default.get("".concat(endpoint, "?").concat(query), {
|
|
143
|
+
headers: {
|
|
144
|
+
Authorization: jwt
|
|
145
|
+
}
|
|
146
|
+
});
|
|
95
147
|
|
|
96
|
-
case
|
|
148
|
+
case 9:
|
|
97
149
|
response = _context.sent;
|
|
98
150
|
return _context.abrupt("return", JSON.parse(response.data.body));
|
|
99
151
|
|
|
100
|
-
case
|
|
101
|
-
_context.prev =
|
|
102
|
-
_context.t0 = _context["catch"](
|
|
152
|
+
case 13:
|
|
153
|
+
_context.prev = 13;
|
|
154
|
+
_context.t0 = _context["catch"](6);
|
|
103
155
|
console.log(_context.t0);
|
|
104
156
|
|
|
105
|
-
case
|
|
157
|
+
case 16:
|
|
106
158
|
case "end":
|
|
107
159
|
return _context.stop();
|
|
108
160
|
}
|
|
109
161
|
}
|
|
110
|
-
}, _callee, null, [[
|
|
162
|
+
}, _callee, null, [[6, 13]]);
|
|
111
163
|
}));
|
|
112
164
|
|
|
113
165
|
return function loadProductVersions(_x) {
|
|
114
|
-
return
|
|
166
|
+
return _ref2.apply(this, arguments);
|
|
115
167
|
};
|
|
116
168
|
}();
|
|
117
169
|
|
|
118
170
|
var getRetailers = /*#__PURE__*/function () {
|
|
119
|
-
var
|
|
120
|
-
var retailersResponse, parsed, retailers;
|
|
171
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
172
|
+
var isTHDUser, retailersResponse, parsed, retailers;
|
|
121
173
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
122
174
|
while (1) {
|
|
123
175
|
switch (_context2.prev = _context2.next) {
|
|
124
176
|
case 0:
|
|
125
|
-
|
|
177
|
+
isTHDUser = [657, 818, 819].includes(user.id_company);
|
|
178
|
+
_context2.next = 3;
|
|
126
179
|
return _axios.default.get("".concat(process.env.REACT_APP_RETAILER_ENDPOINT), {
|
|
127
180
|
headers: {
|
|
128
|
-
Authorization:
|
|
181
|
+
Authorization: jwt
|
|
129
182
|
}
|
|
130
183
|
});
|
|
131
184
|
|
|
132
|
-
case
|
|
185
|
+
case 3:
|
|
133
186
|
retailersResponse = _context2.sent;
|
|
134
187
|
parsed = JSON.parse(retailersResponse.data.body).data;
|
|
135
|
-
retailers = Object.
|
|
136
|
-
|
|
137
|
-
}).
|
|
138
|
-
return f;
|
|
139
|
-
});
|
|
188
|
+
retailers = isTHDUser ? Object.values(parsed).filter(function (value) {
|
|
189
|
+
return [58, 59, 60, 61].includes(value.id);
|
|
190
|
+
}) : Object.values(parsed);
|
|
140
191
|
setRetailers(retailers);
|
|
141
192
|
|
|
142
|
-
case
|
|
193
|
+
case 7:
|
|
143
194
|
case "end":
|
|
144
195
|
return _context2.stop();
|
|
145
196
|
}
|
|
@@ -148,13 +199,13 @@ var Dashboard = function Dashboard() {
|
|
|
148
199
|
}));
|
|
149
200
|
|
|
150
201
|
return function getRetailers() {
|
|
151
|
-
return
|
|
202
|
+
return _ref3.apply(this, arguments);
|
|
152
203
|
};
|
|
153
204
|
}();
|
|
154
205
|
|
|
155
206
|
var loadProductsByStatus = /*#__PURE__*/function () {
|
|
156
|
-
var
|
|
157
|
-
var
|
|
207
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(orderByStatus) {
|
|
208
|
+
var _ref5, orders, _orders$total, total, _orders$R, R, _orders$ACA, ACA, _orders$PA, PA, inProcess;
|
|
158
209
|
|
|
159
210
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
160
211
|
while (1) {
|
|
@@ -164,12 +215,21 @@ var Dashboard = function Dashboard() {
|
|
|
164
215
|
return loadProductVersions(orderByStatus, true);
|
|
165
216
|
|
|
166
217
|
case 2:
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
218
|
+
_context3.t0 = _context3.sent;
|
|
219
|
+
|
|
220
|
+
if (_context3.t0) {
|
|
221
|
+
_context3.next = 5;
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
_context3.t0 = {};
|
|
226
|
+
|
|
227
|
+
case 5:
|
|
228
|
+
_ref5 = _context3.t0;
|
|
229
|
+
orders = _ref5.orders;
|
|
230
|
+
_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
|
+
inProcess = Object.keys(orders).reduce(function (prev, curr) {
|
|
232
|
+
return !["total", "ACA", "PA", "R"].includes(curr) ? prev + orders[curr] : prev;
|
|
173
233
|
}, 0);
|
|
174
234
|
setMetricsData([{
|
|
175
235
|
label: "Productos totales",
|
|
@@ -184,9 +244,10 @@ var Dashboard = function Dashboard() {
|
|
|
184
244
|
label: "Productos terminados",
|
|
185
245
|
value: ACA
|
|
186
246
|
}]);
|
|
247
|
+
delete orders.total;
|
|
187
248
|
setProductsByStatus(orders);
|
|
188
249
|
|
|
189
|
-
case
|
|
250
|
+
case 12:
|
|
190
251
|
case "end":
|
|
191
252
|
return _context3.stop();
|
|
192
253
|
}
|
|
@@ -195,13 +256,13 @@ var Dashboard = function Dashboard() {
|
|
|
195
256
|
}));
|
|
196
257
|
|
|
197
258
|
return function loadProductsByStatus(_x2) {
|
|
198
|
-
return
|
|
259
|
+
return _ref4.apply(this, arguments);
|
|
199
260
|
};
|
|
200
261
|
}();
|
|
201
262
|
|
|
202
263
|
var loadRequiredProducts = /*#__PURE__*/function () {
|
|
203
|
-
var
|
|
204
|
-
var _yield$
|
|
264
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(orderByRequired) {
|
|
265
|
+
var _yield$loadProductVer, dates;
|
|
205
266
|
|
|
206
267
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
207
268
|
while (1) {
|
|
@@ -211,8 +272,8 @@ var Dashboard = function Dashboard() {
|
|
|
211
272
|
return loadProductVersions(orderByRequired);
|
|
212
273
|
|
|
213
274
|
case 2:
|
|
214
|
-
_yield$
|
|
215
|
-
dates = _yield$
|
|
275
|
+
_yield$loadProductVer = _context4.sent;
|
|
276
|
+
dates = _yield$loadProductVer.dates;
|
|
216
277
|
setRequiredProducts(dates);
|
|
217
278
|
|
|
218
279
|
case 5:
|
|
@@ -224,31 +285,199 @@ var Dashboard = function Dashboard() {
|
|
|
224
285
|
}));
|
|
225
286
|
|
|
226
287
|
return function loadRequiredProducts(_x3) {
|
|
227
|
-
return
|
|
288
|
+
return _ref6.apply(this, arguments);
|
|
228
289
|
};
|
|
229
290
|
}();
|
|
230
291
|
|
|
231
|
-
|
|
292
|
+
var datesSelect = function datesSelect() {
|
|
232
293
|
var today = new Date();
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
294
|
+
setDateOptions([{
|
|
295
|
+
id: 0,
|
|
296
|
+
name: "Rango de fechas"
|
|
297
|
+
}, {
|
|
298
|
+
id: 1,
|
|
299
|
+
name: "Todo el tiempo",
|
|
300
|
+
function: function _function() {
|
|
301
|
+
return setDatesRange({
|
|
302
|
+
startDate: new Date("1900-01-01"),
|
|
303
|
+
endDate: new Date()
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
}, {
|
|
307
|
+
id: 2,
|
|
308
|
+
name: "Hoy",
|
|
309
|
+
function: function _function() {
|
|
310
|
+
return setDatesRange({
|
|
311
|
+
startDate: new Date(),
|
|
312
|
+
endDate: new Date()
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}, {
|
|
316
|
+
id: 3,
|
|
317
|
+
name: "Ayer",
|
|
318
|
+
function: function _function() {
|
|
319
|
+
return setDatesRange({
|
|
320
|
+
startDate: new Date(today.setDate(today.getDate() - 1)),
|
|
321
|
+
endDate: new Date()
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
}, {
|
|
325
|
+
id: 4,
|
|
326
|
+
name: "Esta semana",
|
|
327
|
+
function: function _function() {
|
|
328
|
+
return setDatesRange({
|
|
329
|
+
startDate: new Date(today.setDate(today.getDate() - today.getDay())),
|
|
330
|
+
endDate: new Date()
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}, {
|
|
334
|
+
id: 5,
|
|
335
|
+
name: "La semana pasada",
|
|
336
|
+
function: function _function() {
|
|
337
|
+
return setDatesRange({
|
|
338
|
+
startDate: new Date(today.setDate(today.getDate() - today.getDay() - 7)),
|
|
339
|
+
endDate: new Date(today.setDate(today.getDate() - today.getDay() + 7))
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}, {
|
|
343
|
+
id: 6,
|
|
344
|
+
name: "Este mes",
|
|
345
|
+
function: function _function() {
|
|
346
|
+
return setDatesRange({
|
|
347
|
+
startDate: new Date("".concat(today.getFullYear(), "-").concat(today.getMonth() + 1, "-01")),
|
|
348
|
+
endDate: today
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}, {
|
|
352
|
+
id: 7,
|
|
353
|
+
name: "Este mes",
|
|
354
|
+
function: function _function() {
|
|
355
|
+
return setDatesRange({
|
|
356
|
+
startDate: new Date("".concat(today.getFullYear(), "-").concat(today.getMonth(), "-01")),
|
|
357
|
+
endDate: new Date("".concat(today.getFullYear(), "-").concat(today.getMonth() + 1, "-01"))
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
}]);
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
364
|
+
var today, startDate, endDate, queryObject;
|
|
365
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
366
|
+
while (1) {
|
|
367
|
+
switch (_context5.prev = _context5.next) {
|
|
368
|
+
case 0:
|
|
369
|
+
_context5.t0 = setProviders;
|
|
370
|
+
_context5.next = 3;
|
|
371
|
+
return (0, _dashboardUtils.getProviders)(jwt);
|
|
372
|
+
|
|
373
|
+
case 3:
|
|
374
|
+
_context5.t1 = _context5.sent;
|
|
375
|
+
(0, _context5.t0)(_context5.t1);
|
|
376
|
+
_context5.t2 = setCategories;
|
|
377
|
+
_context5.next = 8;
|
|
378
|
+
return (0, _dashboardUtils.getCategories)();
|
|
379
|
+
|
|
380
|
+
case 8:
|
|
381
|
+
_context5.t3 = _context5.sent;
|
|
382
|
+
(0, _context5.t2)(_context5.t3);
|
|
383
|
+
_context5.next = 12;
|
|
384
|
+
return getRetailers();
|
|
385
|
+
|
|
386
|
+
case 12:
|
|
387
|
+
datesSelect();
|
|
388
|
+
today = new Date();
|
|
389
|
+
startDate = "1900-01-01";
|
|
390
|
+
endDate = "".concat(today.getFullYear(), "-").concat(today.getMonth() + 1, "-").concat(today.getDate());
|
|
391
|
+
queryObject = {
|
|
392
|
+
startDate: startDate,
|
|
393
|
+
endDate: endDate
|
|
394
|
+
};
|
|
395
|
+
setDatesRange({
|
|
396
|
+
startDate: startDate,
|
|
397
|
+
endDate: endDate
|
|
398
|
+
});
|
|
399
|
+
setOrderByStatus(queryObject);
|
|
400
|
+
setOrderByRequired(queryObject);
|
|
401
|
+
loadProductsByStatus(queryObject);
|
|
402
|
+
loadRequiredProducts(queryObject);
|
|
403
|
+
|
|
404
|
+
case 22:
|
|
405
|
+
case "end":
|
|
406
|
+
return _context5.stop();
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}, _callee5);
|
|
410
|
+
})), []);
|
|
247
411
|
(0, _react.useEffect)(function () {
|
|
248
|
-
(orderByRequired === null || orderByRequired === void 0 ? void 0 : orderByRequired.
|
|
412
|
+
(orderByRequired === null || orderByRequired === void 0 ? void 0 : orderByRequired.startDate) && (orderByStatus === null || orderByStatus === void 0 ? void 0 : orderByStatus.endDate) && metricsData.length > 0 && setLoading(false);
|
|
249
413
|
}, [orderByRequired, orderByStatus, metricsData]);
|
|
414
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
415
|
+
var startDate, endDate, queryObject;
|
|
416
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
417
|
+
while (1) {
|
|
418
|
+
switch (_context6.prev = _context6.next) {
|
|
419
|
+
case 0:
|
|
420
|
+
startDate = datesRange.startDate, endDate = datesRange.endDate;
|
|
421
|
+
queryObject = {
|
|
422
|
+
startDate: (0, _dashboardUtils.formatDate)(startDate),
|
|
423
|
+
endDate: (0, _dashboardUtils.formatDate)(endDate)
|
|
424
|
+
};
|
|
425
|
+
companyId.length > 0 && (queryObject["companyId"] = companyId.join(","));
|
|
426
|
+
retailerId.length > 0 && (queryObject["retailerId"] = retailerId.join(","));
|
|
427
|
+
categoryId.length > 0 && (queryObject["categoryId"] = categoryId.join(","));
|
|
428
|
+
_context6.next = 7;
|
|
429
|
+
return loadProductsByStatus(queryObject);
|
|
430
|
+
|
|
431
|
+
case 7:
|
|
432
|
+
_context6.next = 9;
|
|
433
|
+
return loadRequiredProducts(queryObject);
|
|
434
|
+
|
|
435
|
+
case 9:
|
|
436
|
+
case "end":
|
|
437
|
+
return _context6.stop();
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}, _callee6);
|
|
441
|
+
})), [companyId, retailerId, categoryId, datesRange]);
|
|
250
442
|
return loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
251
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
443
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
444
|
+
className: "filters",
|
|
445
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomSelect.CustomSelect, {
|
|
446
|
+
options: dateOptions,
|
|
447
|
+
selectLabel: "Seleccionar Fecha",
|
|
448
|
+
placeHolder: "Buscar Fecha",
|
|
449
|
+
customSelectId: "dates-select",
|
|
450
|
+
parameterArray: datesRange,
|
|
451
|
+
setParameterArray: setDatesRange
|
|
452
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomSelect.CustomSelect, {
|
|
453
|
+
showSearchBar: true,
|
|
454
|
+
options: providers,
|
|
455
|
+
selectLabel: "Seleccionar Proveedor",
|
|
456
|
+
placeHolder: "Buscar Proveedor",
|
|
457
|
+
customSelectId: "providers-select",
|
|
458
|
+
parameterArray: companyId,
|
|
459
|
+
setParameterArray: setCompanyId,
|
|
460
|
+
defaultOption: "Todos los proveedores"
|
|
461
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomSelect.CustomSelect, {
|
|
462
|
+
showSearchBar: true,
|
|
463
|
+
options: categories,
|
|
464
|
+
selectLabel: "Seleccionar Departamento",
|
|
465
|
+
placeHolder: "Buscar Departamento",
|
|
466
|
+
customSelectId: "category-select",
|
|
467
|
+
parameterArray: categoryId,
|
|
468
|
+
setParameterArray: setCategoryId,
|
|
469
|
+
defaultOption: "Todas las categorías"
|
|
470
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomSelect.CustomSelect, {
|
|
471
|
+
showSearchBar: true,
|
|
472
|
+
options: retailers,
|
|
473
|
+
selectLabel: "Seleccionar Alcance",
|
|
474
|
+
placeHolder: "Buscar Cadena",
|
|
475
|
+
customSelectId: "retailers-select",
|
|
476
|
+
parameterArray: retailerId,
|
|
477
|
+
setParameterArray: setRetailerId,
|
|
478
|
+
defaultOption: "Todos los alcances"
|
|
479
|
+
})]
|
|
480
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
252
481
|
className: "metric-cards",
|
|
253
482
|
children: metricsData.map(function (metric, index) {
|
|
254
483
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MetricCard.MetricCard, {
|
|
@@ -263,12 +492,13 @@ var Dashboard = function Dashboard() {
|
|
|
263
492
|
description: "Revisa el avance individual de cada estatus, utiliza los filtros para encontrar información precisa.",
|
|
264
493
|
dataObject: productsByStatus,
|
|
265
494
|
retailerSelected: orderByStatus.retailerId,
|
|
266
|
-
retailers: retailers,
|
|
267
495
|
queryObject: orderByStatus,
|
|
268
496
|
setQueryObject: function setQueryObject(evt) {
|
|
269
497
|
loadProductsByStatus(evt);
|
|
270
498
|
setOrderByStatus(evt);
|
|
271
|
-
}
|
|
499
|
+
},
|
|
500
|
+
type: "doughnut",
|
|
501
|
+
displayLegend: true
|
|
272
502
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DashboardMetric.DashboardMetric, {
|
|
273
503
|
label: "Productos solicitados",
|
|
274
504
|
description: "Filtra los productos solicitados por fecha y alcance para revisar rápidamente el flujo de trabajo.",
|
|
@@ -277,7 +507,6 @@ var Dashboard = function Dashboard() {
|
|
|
277
507
|
indexAxis: "x",
|
|
278
508
|
scale: "x",
|
|
279
509
|
displayScale: true,
|
|
280
|
-
retailers: retailers,
|
|
281
510
|
retailerSelected: orderByRequired.retailerId,
|
|
282
511
|
queryObject: orderByRequired,
|
|
283
512
|
setQueryObject: function setQueryObject(evt) {
|
|
@@ -13,6 +13,6 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
13
13
|
|
|
14
14
|
var _templateObject;
|
|
15
15
|
|
|
16
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n padding: 30px;\n .metric-cards {\n display: flex;\n\n > * + * {\n margin-left: 10px;\n }\n\n & + * {\n margin-top: 10px;\n }\n }\n\n .metrics-main-container {\n display: flex;\n\n > * + * {\n margin-left: 10px;\n }\n }\n"])));
|
|
16
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n padding: 30px;\n\n .filters {\n display: flex;\n & > * {\n & + * {\n margin-left: 10px;\n }\n }\n & + * {\n margin-top: 20px;\n }\n }\n\n .metric-cards {\n display: flex;\n\n > * + * {\n margin-left: 10px;\n }\n\n & + * {\n margin-top: 10px;\n }\n }\n\n .metrics-main-container {\n display: flex;\n\n > * + * {\n margin-left: 10px;\n }\n }\n"])));
|
|
17
17
|
|
|
18
18
|
exports.Container = Container;
|
|
@@ -19,7 +19,6 @@ var useCloseModal = function useCloseModal(id) {
|
|
|
19
19
|
|
|
20
20
|
var closeModal = function closeModal(e) {
|
|
21
21
|
e.stopPropagation();
|
|
22
|
-
e.preventDefault();
|
|
23
22
|
|
|
24
23
|
if (!e.target.closest("#".concat(id)) && showModal) {
|
|
25
24
|
document.removeEventListener("click", closeModal, false);
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -1,64 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Container,
|
|
3
|
-
RouterComponent,
|
|
4
|
-
NavLinkOption,
|
|
5
|
-
ContainerPrincipal,
|
|
6
|
-
GlobalStyle,
|
|
7
|
-
} from "./styles";
|
|
1
|
+
import { Container } from "./styles";
|
|
8
2
|
import iconLogoContentoh from "../../../assets/images/verticalSideMenuMainPage/iconLogoContentoh.svg";
|
|
9
3
|
import iconLogo from "../../../assets/images/verticalSideMenuMainPage/iconLogo.svg";
|
|
10
4
|
import React, { useState } from "react";
|
|
11
|
-
import {
|
|
5
|
+
import { NavLink } from "react-router-dom";
|
|
12
6
|
|
|
13
|
-
export const VerticalSideMenuMainPage = ({
|
|
14
|
-
menuoption = [],
|
|
15
|
-
conteinerdash,
|
|
16
|
-
}) => {
|
|
7
|
+
export const VerticalSideMenuMainPage = ({ menuoption }) => {
|
|
17
8
|
const [trueBar, setTrueBar] = useState();
|
|
18
9
|
return (
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</NavLinkOption>
|
|
50
|
-
</div>
|
|
51
|
-
))}
|
|
52
|
-
</>
|
|
53
|
-
)}
|
|
54
|
-
</RouterComponent>
|
|
55
|
-
))}
|
|
10
|
+
<Container
|
|
11
|
+
className={trueBar}
|
|
12
|
+
bar={trueBar}
|
|
13
|
+
onMouseOver={() => setTrueBar(true)}
|
|
14
|
+
onMouseOut={() => setTrueBar(false)}
|
|
15
|
+
>
|
|
16
|
+
<div className="navbar-top">
|
|
17
|
+
<img
|
|
18
|
+
src={trueBar ? iconLogoContentoh : iconLogo}
|
|
19
|
+
alt="Logo"
|
|
20
|
+
className="logo"
|
|
21
|
+
></img>
|
|
22
|
+
<div className="option">
|
|
23
|
+
{menuoption.map((item, index) => (
|
|
24
|
+
<div key={index}>
|
|
25
|
+
<NavLink to={item.path} className="option-link">
|
|
26
|
+
<img src={item.icon} alt={item.title}></img>
|
|
27
|
+
{trueBar && <p>{item.title}</p>}
|
|
28
|
+
</NavLink>
|
|
29
|
+
{item.suboption !== undefined && (
|
|
30
|
+
<>
|
|
31
|
+
{item?.suboption?.map((subitem) => (
|
|
32
|
+
<div className="sub-option">
|
|
33
|
+
<NavLink to={subitem.path} className="sub-option-link">
|
|
34
|
+
{trueBar && <p>{subitem.title}</p>}
|
|
35
|
+
</NavLink>
|
|
36
|
+
</div>
|
|
37
|
+
))}
|
|
38
|
+
</>
|
|
39
|
+
)}
|
|
56
40
|
</div>
|
|
57
|
-
|
|
58
|
-
</
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<GlobalStyle />
|
|
62
|
-
</Router>
|
|
41
|
+
))}
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</Container>
|
|
63
45
|
);
|
|
64
46
|
};
|