contentoh-components-library 21.1.97 → 21.2.0
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 +3 -1
- package/.env.production +3 -1
- package/dist/components/atoms/FeatureTag/styles.js +1 -1
- package/dist/components/atoms/Graphic/Graphic.stories.js +9 -1
- package/dist/components/atoms/Graphic/index.js +4 -9
- package/dist/components/atoms/Graphic/styles.js +1 -1
- package/dist/components/atoms/MetricCard/MetricCard.stories.js +31 -0
- package/dist/components/atoms/MetricCard/index.js +24 -0
- package/dist/components/atoms/MetricCard/styles.js +20 -0
- package/dist/components/atoms/MetricSelect/MetricSelect.stories.js +46 -0
- package/dist/components/atoms/MetricSelect/index.js +36 -0
- package/dist/components/atoms/MetricSelect/styles.js +20 -0
- package/dist/components/organisms/Calendar/Calendar.stories.js +28 -0
- package/dist/components/organisms/Calendar/index.js +33 -0
- package/dist/components/organisms/Calendar/styles.js +20 -0
- package/dist/components/organisms/DashboardMetric/DashboardMetric.stories.js +45 -0
- package/dist/components/organisms/DashboardMetric/index.js +171 -0
- package/dist/components/organisms/DashboardMetric/styles.js +20 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -1
- package/dist/components/pages/Dashboard/Dashboard.stories.js +28 -0
- package/dist/components/pages/Dashboard/index.js +254 -0
- package/dist/components/pages/Dashboard/styles.js +18 -0
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +68 -120
- package/dist/components/pages/ProviderProductEdition/index.js +16 -7
- package/dist/components/pages/RetailerProductEdition/index.js +20 -13
- package/package.json +1 -1
- package/src/components/atoms/FeatureTag/styles.js +6 -0
- package/src/components/atoms/Graphic/Graphic.stories.js +8 -0
- package/src/components/atoms/Graphic/index.js +3 -9
- package/src/components/atoms/Graphic/styles.js +1 -2
- package/src/components/atoms/MetricCard/MetricCard.stories.js +14 -0
- package/src/components/atoms/MetricCard/index.js +10 -0
- package/src/components/atoms/MetricCard/styles.js +30 -0
- package/src/components/atoms/MetricSelect/MetricSelect.stories.js +37 -0
- package/src/components/atoms/MetricSelect/index.js +22 -0
- package/src/components/atoms/MetricSelect/styles.js +20 -0
- package/src/components/organisms/Calendar/Calendar.stories.js +10 -0
- package/src/components/organisms/Calendar/index.js +17 -0
- package/src/components/organisms/Calendar/styles.js +851 -0
- package/src/components/organisms/DashboardMetric/DashboardMetric.stories.js +28 -0
- package/src/components/organisms/DashboardMetric/index.js +128 -0
- package/src/components/organisms/DashboardMetric/styles.js +60 -0
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/pages/Dashboard/Dashboard.stories.js +10 -0
- package/src/components/pages/Dashboard/index.js +126 -0
- package/src/components/pages/Dashboard/styles.js +24 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +77 -145
- package/src/components/pages/ProviderProductEdition/index.js +12 -8
- package/src/components/pages/RetailerProductEdition/index.js +18 -12
|
@@ -72,7 +72,7 @@ var FullProductNameHeader = function FullProductNameHeader(_ref) {
|
|
|
72
72
|
feature: "Prov",
|
|
73
73
|
value: headerData === null || headerData === void 0 ? void 0 : (_headerData$article4 = headerData.article) === null || _headerData$article4 === void 0 ? void 0 : _headerData$article4.company_name
|
|
74
74
|
}, {
|
|
75
|
-
feature: "
|
|
75
|
+
feature: "SKU",
|
|
76
76
|
value: (headerData === null || headerData === void 0 ? void 0 : (_headerData$article5 = headerData.article) === null || _headerData$article5 === void 0 ? void 0 : _headerData$article5.upc) || (headerData === null || headerData === void 0 ? void 0 : headerData.upc)
|
|
77
77
|
}]
|
|
78
78
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AvatarAndValidation.AvatarAndValidation, {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = exports.DashboardDeafult = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
|
+
|
|
12
|
+
var _ = require(".");
|
|
13
|
+
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
|
|
16
|
+
var _default = {
|
|
17
|
+
title: "Components/pages/Dashboard",
|
|
18
|
+
component: _.Dashboard
|
|
19
|
+
};
|
|
20
|
+
exports.default = _default;
|
|
21
|
+
|
|
22
|
+
var Template = function Template(args) {
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Dashboard, (0, _objectSpread2.default)({}, args));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var DashboardDeafult = Template.bind({});
|
|
27
|
+
exports.DashboardDeafult = DashboardDeafult;
|
|
28
|
+
DashboardDeafult.args = {};
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.Dashboard = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _styles = require("./styles");
|
|
17
|
+
|
|
18
|
+
var _MetricCard = require("../../atoms/MetricCard");
|
|
19
|
+
|
|
20
|
+
var _DashboardMetric = require("../../organisms/DashboardMetric");
|
|
21
|
+
|
|
22
|
+
var _react = require("react");
|
|
23
|
+
|
|
24
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
25
|
+
|
|
26
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
+
|
|
28
|
+
var Dashboard = function Dashboard() {
|
|
29
|
+
var _useState = (0, _react.useState)([]),
|
|
30
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
31
|
+
metricsData = _useState2[0],
|
|
32
|
+
setMetricsData = _useState2[1];
|
|
33
|
+
|
|
34
|
+
var _useState3 = (0, _react.useState)({}),
|
|
35
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
36
|
+
productsByStatus = _useState4[0],
|
|
37
|
+
setProductsByStatus = _useState4[1];
|
|
38
|
+
|
|
39
|
+
var _useState5 = (0, _react.useState)([]),
|
|
40
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
41
|
+
requiredProducts = _useState6[0],
|
|
42
|
+
setRequiredProducts = _useState6[1];
|
|
43
|
+
|
|
44
|
+
var _useState7 = (0, _react.useState)({}),
|
|
45
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
46
|
+
orderByStatus = _useState8[0],
|
|
47
|
+
setOrderByStatus = _useState8[1];
|
|
48
|
+
|
|
49
|
+
var _useState9 = (0, _react.useState)({}),
|
|
50
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
51
|
+
orderByRequired = _useState10[0],
|
|
52
|
+
setOrderByRequired = _useState10[1];
|
|
53
|
+
|
|
54
|
+
var _useState11 = (0, _react.useState)({}),
|
|
55
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
56
|
+
retailers = _useState12[0],
|
|
57
|
+
setRetailers = _useState12[1];
|
|
58
|
+
|
|
59
|
+
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;
|
|
62
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
63
|
+
while (1) {
|
|
64
|
+
switch (_context.prev = _context.next) {
|
|
65
|
+
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));
|
|
71
|
+
|
|
72
|
+
case 5:
|
|
73
|
+
response = _context.sent;
|
|
74
|
+
versionList = JSON.parse(response.data.body);
|
|
75
|
+
return _context.abrupt("return", versionList);
|
|
76
|
+
|
|
77
|
+
case 10:
|
|
78
|
+
_context.prev = 10;
|
|
79
|
+
_context.t0 = _context["catch"](2);
|
|
80
|
+
console.log(_context.t0);
|
|
81
|
+
|
|
82
|
+
case 13:
|
|
83
|
+
case "end":
|
|
84
|
+
return _context.stop();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}, _callee, null, [[2, 10]]);
|
|
88
|
+
}));
|
|
89
|
+
|
|
90
|
+
return function loadProductVersions(_x, _x2) {
|
|
91
|
+
return _ref.apply(this, arguments);
|
|
92
|
+
};
|
|
93
|
+
}();
|
|
94
|
+
|
|
95
|
+
var getRetailers = /*#__PURE__*/function () {
|
|
96
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
97
|
+
var retailersResponse;
|
|
98
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
99
|
+
while (1) {
|
|
100
|
+
switch (_context2.prev = _context2.next) {
|
|
101
|
+
case 0:
|
|
102
|
+
_context2.next = 2;
|
|
103
|
+
return _axios.default.get("".concat(process.env.REACT_APP_RETAILER_ENDPOINT), {
|
|
104
|
+
headers: {
|
|
105
|
+
Authorization: sessionStorage.getItem("jwt")
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
case 2:
|
|
110
|
+
retailersResponse = _context2.sent;
|
|
111
|
+
setRetailers(JSON.parse(retailersResponse.data.body).data);
|
|
112
|
+
|
|
113
|
+
case 4:
|
|
114
|
+
case "end":
|
|
115
|
+
return _context2.stop();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}, _callee2);
|
|
119
|
+
}));
|
|
120
|
+
|
|
121
|
+
return function getRetailers() {
|
|
122
|
+
return _ref2.apply(this, arguments);
|
|
123
|
+
};
|
|
124
|
+
}();
|
|
125
|
+
|
|
126
|
+
var loadProductsByStatus = /*#__PURE__*/function () {
|
|
127
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(orderByStatus) {
|
|
128
|
+
var _yield$loadProductVer, orders, fullData;
|
|
129
|
+
|
|
130
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
131
|
+
while (1) {
|
|
132
|
+
switch (_context3.prev = _context3.next) {
|
|
133
|
+
case 0:
|
|
134
|
+
_context3.next = 2;
|
|
135
|
+
return loadProductVersions(true, orderByStatus);
|
|
136
|
+
|
|
137
|
+
case 2:
|
|
138
|
+
_yield$loadProductVer = _context3.sent;
|
|
139
|
+
orders = _yield$loadProductVer.orders;
|
|
140
|
+
fullData = _yield$loadProductVer.fullData;
|
|
141
|
+
setMetricsData([{
|
|
142
|
+
label: "Productos totales",
|
|
143
|
+
value: fullData === null || fullData === void 0 ? void 0 : fullData.total
|
|
144
|
+
}, {
|
|
145
|
+
label: "Productos sin asignar",
|
|
146
|
+
value: fullData === null || fullData === void 0 ? void 0 : fullData.PA
|
|
147
|
+
}, {
|
|
148
|
+
label: "Productos en proceso",
|
|
149
|
+
value: fullData === null || fullData === void 0 ? void 0 : fullData.CA
|
|
150
|
+
}, {
|
|
151
|
+
label: "Productos terminados",
|
|
152
|
+
value: fullData === null || fullData === void 0 ? void 0 : fullData.AP
|
|
153
|
+
}]);
|
|
154
|
+
setProductsByStatus(orders);
|
|
155
|
+
|
|
156
|
+
case 7:
|
|
157
|
+
case "end":
|
|
158
|
+
return _context3.stop();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}, _callee3);
|
|
162
|
+
}));
|
|
163
|
+
|
|
164
|
+
return function loadProductsByStatus(_x3) {
|
|
165
|
+
return _ref3.apply(this, arguments);
|
|
166
|
+
};
|
|
167
|
+
}();
|
|
168
|
+
|
|
169
|
+
var loadRequiredProducts = /*#__PURE__*/function () {
|
|
170
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(orderByRequired) {
|
|
171
|
+
var _yield$loadProductVer2, dates;
|
|
172
|
+
|
|
173
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
174
|
+
while (1) {
|
|
175
|
+
switch (_context4.prev = _context4.next) {
|
|
176
|
+
case 0:
|
|
177
|
+
_context4.next = 2;
|
|
178
|
+
return loadProductVersions(false, orderByRequired);
|
|
179
|
+
|
|
180
|
+
case 2:
|
|
181
|
+
_yield$loadProductVer2 = _context4.sent;
|
|
182
|
+
dates = _yield$loadProductVer2.dates;
|
|
183
|
+
setRequiredProducts(dates);
|
|
184
|
+
|
|
185
|
+
case 5:
|
|
186
|
+
case "end":
|
|
187
|
+
return _context4.stop();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}, _callee4);
|
|
191
|
+
}));
|
|
192
|
+
|
|
193
|
+
return function loadRequiredProducts(_x4) {
|
|
194
|
+
return _ref4.apply(this, arguments);
|
|
195
|
+
};
|
|
196
|
+
}();
|
|
197
|
+
|
|
198
|
+
(0, _react.useEffect)(function () {
|
|
199
|
+
var today = new Date();
|
|
200
|
+
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);
|
|
203
|
+
var queryObject = {
|
|
204
|
+
retailerId: "58",
|
|
205
|
+
startDate: startDate,
|
|
206
|
+
endDate: endDate
|
|
207
|
+
};
|
|
208
|
+
setOrderByStatus(queryObject);
|
|
209
|
+
setOrderByRequired(queryObject);
|
|
210
|
+
getRetailers();
|
|
211
|
+
}, []);
|
|
212
|
+
(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, {
|
|
219
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
220
|
+
className: "metric-cards",
|
|
221
|
+
children: metricsData.map(function (metric, index) {
|
|
222
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MetricCard.MetricCard, {
|
|
223
|
+
label: metric.label,
|
|
224
|
+
number: metric.value
|
|
225
|
+
}, "".concat(index, "-").concat(metric.value));
|
|
226
|
+
})
|
|
227
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
228
|
+
className: "metrics-main-container",
|
|
229
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_DashboardMetric.DashboardMetric, {
|
|
230
|
+
label: "Productos por estatus",
|
|
231
|
+
description: "Revisa el avance individual de cada estatus, utiliza los filtros para encontrar información precisa.",
|
|
232
|
+
dataObject: productsByStatus,
|
|
233
|
+
retailerSelected: orderByStatus.retailerId,
|
|
234
|
+
retailers: retailers,
|
|
235
|
+
queryObject: orderByStatus,
|
|
236
|
+
setQueryObject: setOrderByStatus
|
|
237
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DashboardMetric.DashboardMetric, {
|
|
238
|
+
label: "Productos solicitados",
|
|
239
|
+
description: "Filtra los productos solicitados por fecha y alcance para revisar rápidamente el flujo de trabajo.",
|
|
240
|
+
dataObject: requiredProducts,
|
|
241
|
+
type: "line",
|
|
242
|
+
indexAxis: "x",
|
|
243
|
+
scale: "x",
|
|
244
|
+
displayScale: true,
|
|
245
|
+
retailers: retailers,
|
|
246
|
+
retailerSelected: orderByRequired.retailerId,
|
|
247
|
+
queryObject: orderByRequired,
|
|
248
|
+
setQueryObject: setOrderByRequired
|
|
249
|
+
})]
|
|
250
|
+
})]
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
exports.Dashboard = Dashboard;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.Container = void 0;
|
|
9
|
+
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
11
|
+
|
|
12
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
+
|
|
14
|
+
var _templateObject;
|
|
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"])));
|
|
17
|
+
|
|
18
|
+
exports.Container = Container;
|
|
@@ -36,144 +36,92 @@ ProviderProductEditionDefault.args = {
|
|
|
36
36
|
category: 846,
|
|
37
37
|
version: 2,
|
|
38
38
|
productSelected: {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
orderId: 2446,
|
|
40
|
+
article_status: "AP",
|
|
41
|
+
datasheet_status: "AP",
|
|
42
|
+
description_status: "AP",
|
|
43
|
+
images_status: "ACA",
|
|
44
|
+
prio: "none",
|
|
45
|
+
version: 2,
|
|
46
|
+
brand: null,
|
|
42
47
|
article: {
|
|
43
|
-
category: "
|
|
44
|
-
company_name: "
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
category: "Organizadores y Closets|Accesorios de Lavandería|Organizadores de Lavandería",
|
|
49
|
+
company_name: "WOMEX SA DE CV",
|
|
50
|
+
id_company: 424,
|
|
51
|
+
country: null,
|
|
52
|
+
id_category: "2522",
|
|
53
|
+
id_article: 78773,
|
|
54
|
+
name: "RACK PARA ROPA DOBLE NEGRO",
|
|
55
|
+
upc: "168462"
|
|
50
56
|
},
|
|
51
|
-
asignations: [],
|
|
52
57
|
retailers: [{
|
|
53
58
|
id: 58,
|
|
54
|
-
name: "The Home Depot Golden"
|
|
55
|
-
country: "México",
|
|
56
|
-
id_region: 1,
|
|
57
|
-
active: 1
|
|
58
|
-
}, {
|
|
59
|
-
id: 59,
|
|
60
|
-
name: "The Home Depot Platinum",
|
|
61
|
-
country: "México",
|
|
62
|
-
id_region: 1,
|
|
63
|
-
active: 1
|
|
64
|
-
}, {
|
|
65
|
-
id: 61,
|
|
66
|
-
name: "Home Depot TAB",
|
|
67
|
-
country: "México",
|
|
68
|
-
id_region: 1,
|
|
69
|
-
active: 1
|
|
59
|
+
name: "The Home Depot Golden"
|
|
70
60
|
}],
|
|
71
|
-
|
|
61
|
+
services: {
|
|
62
|
+
datasheets: 1,
|
|
63
|
+
descriptions: 1,
|
|
64
|
+
images: 1
|
|
65
|
+
},
|
|
66
|
+
statusByRetailer: {
|
|
67
|
+
58: {
|
|
68
|
+
datasheet: "AP",
|
|
69
|
+
description: "AP",
|
|
70
|
+
images: "ACA"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
retailersWithService: ["58"],
|
|
74
|
+
id_article: 78773,
|
|
72
75
|
retailersAvailable: [{
|
|
73
76
|
id: 58,
|
|
74
|
-
name: "The Home Depot Golden"
|
|
75
|
-
country: "México",
|
|
76
|
-
id_region: 1,
|
|
77
|
-
active: 1
|
|
78
|
-
}, {
|
|
79
|
-
id: 59,
|
|
80
|
-
name: "The Home Depot Platinum",
|
|
81
|
-
country: "México",
|
|
82
|
-
id_region: 1,
|
|
83
|
-
active: 1
|
|
84
|
-
}, {
|
|
85
|
-
id: 61,
|
|
86
|
-
name: "Home Depot TAB",
|
|
87
|
-
country: "México",
|
|
88
|
-
id_region: 1,
|
|
89
|
-
active: 1
|
|
90
|
-
}],
|
|
91
|
-
upc: "111187",
|
|
92
|
-
name: "SIKA TECHO FRESCO SUPER 15",
|
|
93
|
-
categoryName: "Materiales de Construcción|Impermeabilizantes y Recubrimientos|Selladores",
|
|
94
|
-
id_category: "2249",
|
|
95
|
-
id_article: 29457,
|
|
96
|
-
services: [{
|
|
97
|
-
id_article: 29457,
|
|
98
|
-
service: "datasheet",
|
|
99
|
-
quantity: 1,
|
|
100
|
-
price: 0,
|
|
101
|
-
id_user: 1237,
|
|
102
|
-
datasheet_common: null,
|
|
103
|
-
discount: null
|
|
77
|
+
name: "The Home Depot Golden"
|
|
104
78
|
}]
|
|
105
79
|
},
|
|
106
80
|
productToEdit: {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
product:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
81
|
+
ArticleId: 78773,
|
|
82
|
+
idCategory: "2522",
|
|
83
|
+
product: {
|
|
84
|
+
orderId: 2446,
|
|
85
|
+
article_status: "AP",
|
|
86
|
+
datasheet_status: "AP",
|
|
87
|
+
description_status: "AP",
|
|
88
|
+
images_status: "ACA",
|
|
89
|
+
prio: "none",
|
|
90
|
+
version: 2,
|
|
91
|
+
brand: null,
|
|
113
92
|
article: {
|
|
114
|
-
category: "
|
|
115
|
-
company_name: "
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
93
|
+
category: "Organizadores y Closets|Accesorios de Lavandería|Organizadores de Lavandería",
|
|
94
|
+
company_name: "WOMEX SA DE CV",
|
|
95
|
+
id_company: 424,
|
|
96
|
+
country: null,
|
|
97
|
+
id_category: "2522",
|
|
98
|
+
id_article: 78773,
|
|
99
|
+
name: "RACK PARA ROPA DOBLE NEGRO",
|
|
100
|
+
upc: "168462"
|
|
121
101
|
},
|
|
122
|
-
asignations: [],
|
|
123
102
|
retailers: [{
|
|
124
103
|
id: 58,
|
|
125
|
-
name: "The Home Depot Golden"
|
|
126
|
-
country: "México",
|
|
127
|
-
id_region: 1,
|
|
128
|
-
active: 1
|
|
129
|
-
}, {
|
|
130
|
-
id: 59,
|
|
131
|
-
name: "The Home Depot Platinum",
|
|
132
|
-
country: "México",
|
|
133
|
-
id_region: 1,
|
|
134
|
-
active: 1
|
|
135
|
-
}, {
|
|
136
|
-
id: 61,
|
|
137
|
-
name: "Home Depot TAB",
|
|
138
|
-
country: "México",
|
|
139
|
-
id_region: 1,
|
|
140
|
-
active: 1
|
|
104
|
+
name: "The Home Depot Golden"
|
|
141
105
|
}],
|
|
142
|
-
|
|
106
|
+
services: {
|
|
107
|
+
datasheets: 1,
|
|
108
|
+
descriptions: 1,
|
|
109
|
+
images: 1
|
|
110
|
+
},
|
|
111
|
+
statusByRetailer: {
|
|
112
|
+
58: {
|
|
113
|
+
datasheet: "AP",
|
|
114
|
+
description: "AP",
|
|
115
|
+
images: "ACA"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
retailersWithService: ["58"],
|
|
119
|
+
id_article: 78773,
|
|
143
120
|
retailersAvailable: [{
|
|
144
121
|
id: 58,
|
|
145
|
-
name: "The Home Depot Golden"
|
|
146
|
-
country: "México",
|
|
147
|
-
id_region: 1,
|
|
148
|
-
active: 1
|
|
149
|
-
}, {
|
|
150
|
-
id: 59,
|
|
151
|
-
name: "The Home Depot Platinum",
|
|
152
|
-
country: "México",
|
|
153
|
-
id_region: 1,
|
|
154
|
-
active: 1
|
|
155
|
-
}, {
|
|
156
|
-
id: 61,
|
|
157
|
-
name: "Home Depot TAB",
|
|
158
|
-
country: "México",
|
|
159
|
-
id_region: 1,
|
|
160
|
-
active: 1
|
|
161
|
-
}],
|
|
162
|
-
upc: "111187",
|
|
163
|
-
name: "SIKA TECHO FRESCO SUPER 15",
|
|
164
|
-
categoryName: "Materiales de Construcción|Impermeabilizantes y Recubrimientos|Selladores",
|
|
165
|
-
id_category: "2249",
|
|
166
|
-
id_article: 29457,
|
|
167
|
-
services: [{
|
|
168
|
-
id_article: 29457,
|
|
169
|
-
service: "datasheet",
|
|
170
|
-
quantity: 1,
|
|
171
|
-
price: 0,
|
|
172
|
-
id_user: 1237,
|
|
173
|
-
datasheet_common: null,
|
|
174
|
-
discount: null
|
|
122
|
+
name: "The Home Depot Golden"
|
|
175
123
|
}]
|
|
176
|
-
}
|
|
124
|
+
}
|
|
177
125
|
},
|
|
178
126
|
location: {
|
|
179
127
|
state: {
|
|
@@ -172,7 +172,7 @@ var reducerImages = function reducerImages(state, action) {
|
|
|
172
172
|
|
|
173
173
|
var orderedImages = [];
|
|
174
174
|
var imageIdArray = [];
|
|
175
|
-
if (!_inputsByRetailer[action.retailerId]) _inputsByRetailer[action.retailerId] = [];
|
|
175
|
+
if (action !== null && action !== void 0 && action.retailerId && !_inputsByRetailer[action.retailerId]) _inputsByRetailer[action.retailerId] = [];
|
|
176
176
|
action.retailerId && ((_inputsByRetailer$act = _inputsByRetailer[action.retailerId]) === null || _inputsByRetailer$act === void 0 ? void 0 : _inputsByRetailer$act.filter(function (input) {
|
|
177
177
|
imageIdArray.push(input.id_image);
|
|
178
178
|
valuesInitial.forEach(function (value) {
|
|
@@ -559,11 +559,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
559
559
|
return getServices();
|
|
560
560
|
|
|
561
561
|
case 6:
|
|
562
|
-
if (!originProp) {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
562
|
+
// if (!originProp) {
|
|
563
|
+
// setActiveRetailer(
|
|
564
|
+
// product?.retailers
|
|
565
|
+
// ? product?.retailers[0]
|
|
566
|
+
// : product?.retailersAvailable[0]
|
|
567
|
+
// );
|
|
568
|
+
// }
|
|
569
|
+
// setActiveRetailer(product?.retailers[0]);
|
|
567
570
|
setImages({
|
|
568
571
|
action: "init",
|
|
569
572
|
init: services[2]
|
|
@@ -576,7 +579,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
576
579
|
});
|
|
577
580
|
setLoading(false);
|
|
578
581
|
|
|
579
|
-
case
|
|
582
|
+
case 10:
|
|
580
583
|
case "end":
|
|
581
584
|
return _context2.stop();
|
|
582
585
|
}
|
|
@@ -712,6 +715,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
712
715
|
retailerId: activeRetailer.id
|
|
713
716
|
});
|
|
714
717
|
}, [product, version]);
|
|
718
|
+
(0, _react.useEffect)(function () {
|
|
719
|
+
setImages({
|
|
720
|
+
action: "orderImages",
|
|
721
|
+
retailerId: activeRetailer.id
|
|
722
|
+
});
|
|
723
|
+
}, [activeRetailer]);
|
|
715
724
|
|
|
716
725
|
var loadAssignations = function loadAssignations(currentProduct) {
|
|
717
726
|
setAssig(product === null || product === void 0 ? void 0 : product.asignations);
|
|
@@ -140,24 +140,31 @@ var reducerImages = function reducerImages(state, action) {
|
|
|
140
140
|
|
|
141
141
|
case "orderImages":
|
|
142
142
|
{
|
|
143
|
-
var _inputsByRetailer$act;
|
|
144
|
-
|
|
145
143
|
var _inputsByRetailer = state.inputsByRetailer,
|
|
146
144
|
valuesInitial = state.valuesInitial,
|
|
147
145
|
inputsInitial = state.inputsInitial,
|
|
148
146
|
inputs = state.inputs;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
147
|
+
|
|
148
|
+
try {
|
|
149
|
+
var _inputsByRetailer$act;
|
|
150
|
+
|
|
151
|
+
var orderedImages = [];
|
|
152
|
+
var imageIdArray = [];
|
|
153
|
+
if (action !== null && action !== void 0 && action.retailerId && !_inputsByRetailer[action.retailerId]) _inputsByRetailer[action.retailerId] = [];
|
|
154
|
+
action.retailerId && ((_inputsByRetailer$act = _inputsByRetailer[action.retailerId]) === null || _inputsByRetailer$act === void 0 ? void 0 : _inputsByRetailer$act.filter(function (input) {
|
|
155
|
+
imageIdArray.push(input.id_image);
|
|
156
|
+
valuesInitial.forEach(function (value) {
|
|
157
|
+
if (value.image_id === input.id_image) orderedImages.push(value);
|
|
158
|
+
});
|
|
159
|
+
}));
|
|
160
|
+
inputs = inputsInitial === null || inputsInitial === void 0 ? void 0 : inputsInitial.filter(function (input) {
|
|
161
|
+
return imageIdArray.includes(input.id);
|
|
155
162
|
});
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
163
|
+
values = orderedImages.length > 0 ? orderedImages : [];
|
|
164
|
+
} catch (error) {
|
|
165
|
+
console.log(error);
|
|
166
|
+
}
|
|
167
|
+
|
|
161
168
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
162
169
|
values: values,
|
|
163
170
|
inputs: inputs
|
package/package.json
CHANGED
|
@@ -2,17 +2,11 @@ import { Container } from "./styles";
|
|
|
2
2
|
import { Chart } from "react-chartjs-2";
|
|
3
3
|
import "chart.js/auto";
|
|
4
4
|
|
|
5
|
-
export const Graphic = ({ data }) => {
|
|
6
|
-
|
|
7
|
-
plugins: {
|
|
8
|
-
legend: {
|
|
9
|
-
position: "left",
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
};
|
|
5
|
+
export const Graphic = ({ data, type, options }) => {
|
|
6
|
+
|
|
13
7
|
return (
|
|
14
8
|
<Container>
|
|
15
|
-
<Chart type=
|
|
9
|
+
<Chart type={type} data={data} options={options} />
|
|
16
10
|
</Container>
|
|
17
11
|
);
|
|
18
12
|
};
|