contentoh-components-library 15.0.0 → 18.0.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/dist/assets/images/generalButton/downloadIcon.svg +3 -0
- package/dist/components/atoms/CheckBox/index.js +4 -2
- package/dist/components/atoms/GeneralButton/styles.js +4 -2
- package/dist/components/atoms/GeneralInput/index.js +14 -27
- package/dist/components/atoms/GenericModal/index.js +4 -2
- package/dist/components/atoms/GenericModal/styles.js +1 -1
- package/dist/components/atoms/Input/index.js +1 -1
- package/dist/components/atoms/Input/style.js +4 -4
- package/dist/components/atoms/InputFormatter/Wysiwyg.stories.js +30 -0
- package/dist/components/atoms/InputFormatter/index.js +119 -0
- package/dist/components/atoms/InputFormatter/styles.js +33 -0
- package/dist/components/atoms/LabelToInput/style.js +3 -3
- package/dist/components/atoms/ProductPercentCard/Percent.stories.js +41 -0
- package/dist/components/atoms/ProductPercentCard/index.js +45 -0
- package/dist/components/atoms/ProductPercentCard/styles.js +20 -0
- package/dist/components/molecules/GalleryElement/index.js +24 -2
- package/dist/components/molecules/GalleryHeader/index.js +19 -2
- package/dist/components/molecules/StatusAsignationInfo/index.js +12 -27
- package/dist/components/molecules/TableHeader/index.js +4 -2
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -1
- package/dist/components/organisms/FullTabsMenu/index.js +8 -8
- package/dist/components/organisms/ImageDataTable/index.js +4 -2
- package/dist/components/organisms/ProductImageModal/index.js +2 -3
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +4 -14
- package/dist/components/pages/RetailerProductEdition/index.js +330 -169
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/package.json +5 -1
- package/src/assets/images/generalButton/downloadIcon.svg +3 -0
- package/src/components/atoms/CheckBox/index.js +8 -2
- package/src/components/atoms/GeneralButton/styles.js +14 -0
- package/src/components/atoms/GeneralInput/index.js +12 -29
- package/src/components/atoms/GenericModal/index.js +2 -2
- package/src/components/atoms/GenericModal/styles.js +3 -0
- package/src/components/atoms/Input/index.js +2 -1
- package/src/components/atoms/Input/style.js +9 -5
- package/src/components/atoms/InputFormatter/Wysiwyg.stories.js +12 -0
- package/src/components/atoms/InputFormatter/index.js +76 -0
- package/src/components/atoms/InputFormatter/styles.js +34 -0
- package/src/components/atoms/LabelToInput/style.js +10 -2
- package/src/components/atoms/ProductPercentCard/Percent.stories.js +41 -0
- package/src/components/atoms/ProductPercentCard/index.js +23 -0
- package/src/components/atoms/{Percent → ProductPercentCard}/styles.js +11 -7
- package/src/components/molecules/GalleryElement/index.js +18 -1
- package/src/components/molecules/GalleryHeader/index.js +8 -2
- package/src/components/molecules/StatusAsignationInfo/index.js +12 -24
- package/src/components/molecules/TableHeader/index.js +2 -0
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/organisms/FullTabsMenu/index.js +6 -6
- package/src/components/organisms/ImageDataTable/index.js +2 -0
- package/src/components/organisms/ProductImageModal/index.js +8 -2
- package/src/components/organisms/ProductImageModal/styles.js +3 -0
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +4 -14
- package/src/components/pages/RetailerProductEdition/index.js +250 -90
- package/src/components/pages/RetailerProductEdition/styles.js +11 -3
- package/src/components/atoms/Percent/Percent.stories.js +0 -38
- package/src/components/atoms/Percent/index.js +0 -15
|
@@ -37,6 +37,8 @@ var _react = require("react");
|
|
|
37
37
|
|
|
38
38
|
var _GalleryElement = require("../../molecules/GalleryElement");
|
|
39
39
|
|
|
40
|
+
var _fileSaver = require("file-saver");
|
|
41
|
+
|
|
40
42
|
var _data2 = require("../../../global-files/data");
|
|
41
43
|
|
|
42
44
|
var _GalleryHeader = require("../../molecules/GalleryHeader");
|
|
@@ -63,6 +65,10 @@ var _GeneralButton = require("../../atoms/GeneralButton");
|
|
|
63
65
|
|
|
64
66
|
var _Commentary = require("../../atoms/Commentary");
|
|
65
67
|
|
|
68
|
+
var _GenericModal = require("../../atoms/GenericModal");
|
|
69
|
+
|
|
70
|
+
var _ScreenHeader = require("../../atoms/ScreenHeader");
|
|
71
|
+
|
|
66
72
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
67
73
|
|
|
68
74
|
var reducerImages = function reducerImages(state, action) {
|
|
@@ -113,10 +119,9 @@ var myBucket = new _awsSdk.default.S3({
|
|
|
113
119
|
});
|
|
114
120
|
|
|
115
121
|
var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
116
|
-
var _servicesData$filter$, _servicesData$filter$2, _product$services, _datasheets$, _datasheets$$data, _product$services2, _product$services3;
|
|
122
|
+
var _productSelected$reta, _servicesData$filter$, _servicesData$filter$2, _product$services, _datasheets$, _datasheets$$data, _product$services2, _product$article4, _product$services3;
|
|
117
123
|
|
|
118
124
|
var tabsSections = _ref.tabsSections,
|
|
119
|
-
articleId = _ref.articleId,
|
|
120
125
|
_ref$productSelected = _ref.productSelected,
|
|
121
126
|
productSelected = _ref$productSelected === void 0 ? {} : _ref$productSelected,
|
|
122
127
|
_ref$user = _ref.user,
|
|
@@ -133,7 +138,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
133
138
|
activeImage = _useState4[0],
|
|
134
139
|
setActiveImage = _useState4[1];
|
|
135
140
|
|
|
136
|
-
var _useState5 = (0, _react.useState)(
|
|
141
|
+
var _useState5 = (0, _react.useState)(false),
|
|
137
142
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
138
143
|
imageLayout = _useState6[0],
|
|
139
144
|
setImageLayout = _useState6[1];
|
|
@@ -163,12 +168,6 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
163
168
|
showModal = _useState14[0],
|
|
164
169
|
setShowModal = _useState14[1];
|
|
165
170
|
|
|
166
|
-
var _useState15 = (0, _react.useState)(54),
|
|
167
|
-
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
168
|
-
retailerSelected = _useState16[0],
|
|
169
|
-
setRetailerSelected = _useState16[1]; // revisar después como trabajar esto de mejor forma
|
|
170
|
-
|
|
171
|
-
|
|
172
171
|
var _useDropzone = (0, _reactDropzone.useDropzone)({
|
|
173
172
|
accept: "image/*",
|
|
174
173
|
noKeyboard: true,
|
|
@@ -229,108 +228,126 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
229
228
|
getRootProps = _useDropzone.getRootProps,
|
|
230
229
|
getInputProps = _useDropzone.getInputProps;
|
|
231
230
|
|
|
231
|
+
var _useState15 = (0, _react.useState)([]),
|
|
232
|
+
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
233
|
+
updatedDatasheets = _useState16[0],
|
|
234
|
+
setUpdatedDatasheets = _useState16[1];
|
|
235
|
+
|
|
232
236
|
var _useState17 = (0, _react.useState)([]),
|
|
233
237
|
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
234
|
-
|
|
235
|
-
|
|
238
|
+
updatedDescriptions = _useState18[0],
|
|
239
|
+
setUpdatedDescriptions = _useState18[1];
|
|
236
240
|
|
|
237
|
-
var _useState19 = (0, _react.useState)(
|
|
241
|
+
var _useState19 = (0, _react.useState)(false),
|
|
238
242
|
_useState20 = (0, _slicedToArray2.default)(_useState19, 2),
|
|
239
|
-
|
|
240
|
-
|
|
243
|
+
imagesUploaded = _useState20[0],
|
|
244
|
+
setImagesUploaded = _useState20[1];
|
|
241
245
|
|
|
242
|
-
var _useState21 = (0, _react.useState)(
|
|
246
|
+
var _useState21 = (0, _react.useState)(),
|
|
243
247
|
_useState22 = (0, _slicedToArray2.default)(_useState21, 2),
|
|
244
|
-
|
|
245
|
-
|
|
248
|
+
dataImages = _useState22[0],
|
|
249
|
+
setDataImages = _useState22[1];
|
|
246
250
|
|
|
247
|
-
var _useState23 = (0, _react.useState)()
|
|
248
|
-
_useState24 = (0, _slicedToArray2.default)(_useState23, 2),
|
|
249
|
-
dataImages = _useState24[0],
|
|
250
|
-
setDataImages = _useState24[1];
|
|
251
|
-
|
|
252
|
-
var _useState25 = (0, _react.useState)(new Array(productSelected.retailers.length).fill({
|
|
251
|
+
var _useState23 = (0, _react.useState)(new Array(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$reta = productSelected.retailers) === null || _productSelected$reta === void 0 ? void 0 : _productSelected$reta.length).fill({
|
|
253
252
|
percentage: 0
|
|
254
253
|
})),
|
|
254
|
+
_useState24 = (0, _slicedToArray2.default)(_useState23, 2),
|
|
255
|
+
percentages = _useState24[0],
|
|
256
|
+
setPercentages = _useState24[1];
|
|
257
|
+
|
|
258
|
+
var _useState25 = (0, _react.useState)(0),
|
|
255
259
|
_useState26 = (0, _slicedToArray2.default)(_useState25, 2),
|
|
256
|
-
|
|
257
|
-
|
|
260
|
+
activePercentage = _useState26[0],
|
|
261
|
+
setActivePercentage = _useState26[1];
|
|
258
262
|
|
|
259
|
-
var _useState27 = (0, _react.useState)(
|
|
263
|
+
var _useState27 = (0, _react.useState)({}),
|
|
260
264
|
_useState28 = (0, _slicedToArray2.default)(_useState27, 2),
|
|
261
|
-
|
|
262
|
-
|
|
265
|
+
activeRetailer = _useState28[0],
|
|
266
|
+
setActiveRetailer = _useState28[1];
|
|
263
267
|
|
|
264
|
-
var _useState29 = (0, _react.useState)(
|
|
268
|
+
var _useState29 = (0, _react.useState)([]),
|
|
265
269
|
_useState30 = (0, _slicedToArray2.default)(_useState29, 2),
|
|
266
|
-
|
|
267
|
-
|
|
270
|
+
services = _useState30[0],
|
|
271
|
+
setServices = _useState30[1];
|
|
268
272
|
|
|
269
273
|
var _useState31 = (0, _react.useState)([]),
|
|
270
274
|
_useState32 = (0, _slicedToArray2.default)(_useState31, 2),
|
|
271
|
-
|
|
272
|
-
|
|
275
|
+
servicesData = _useState32[0],
|
|
276
|
+
setServicesData = _useState32[1];
|
|
273
277
|
|
|
274
|
-
var _useState33 = (0, _react.useState)(
|
|
278
|
+
var _useState33 = (0, _react.useState)(""),
|
|
275
279
|
_useState34 = (0, _slicedToArray2.default)(_useState33, 2),
|
|
276
|
-
|
|
277
|
-
|
|
280
|
+
message = _useState34[0],
|
|
281
|
+
setMessage = _useState34[1];
|
|
278
282
|
|
|
279
|
-
var _useState35 = (0, _react.useState)(
|
|
283
|
+
var _useState35 = (0, _react.useState)({}),
|
|
280
284
|
_useState36 = (0, _slicedToArray2.default)(_useState35, 2),
|
|
281
|
-
|
|
282
|
-
|
|
285
|
+
product = _useState36[0],
|
|
286
|
+
setProduct = _useState36[1];
|
|
283
287
|
|
|
284
|
-
var _useState37 = (0, _react.useState)(
|
|
288
|
+
var _useState37 = (0, _react.useState)(null),
|
|
285
289
|
_useState38 = (0, _slicedToArray2.default)(_useState37, 2),
|
|
286
|
-
|
|
287
|
-
|
|
290
|
+
icon = _useState38[0],
|
|
291
|
+
setIcon = _useState38[1];
|
|
288
292
|
|
|
289
|
-
var _useState39 = (0, _react.useState)(null),
|
|
293
|
+
var _useState39 = (0, _react.useState)(productSelected === null || productSelected === void 0 ? void 0 : productSelected.version),
|
|
290
294
|
_useState40 = (0, _slicedToArray2.default)(_useState39, 2),
|
|
291
|
-
|
|
292
|
-
|
|
295
|
+
version = _useState40[0],
|
|
296
|
+
setVersion = _useState40[1];
|
|
293
297
|
|
|
294
|
-
var _useState41 = (0, _react.useState)(
|
|
298
|
+
var _useState41 = (0, _react.useState)({}),
|
|
295
299
|
_useState42 = (0, _slicedToArray2.default)(_useState41, 2),
|
|
296
|
-
|
|
297
|
-
|
|
300
|
+
comments = _useState42[0],
|
|
301
|
+
setComments = _useState42[1];
|
|
298
302
|
|
|
299
|
-
var _useState43 = (0, _react.useState)(
|
|
303
|
+
var _useState43 = (0, _react.useState)(""),
|
|
300
304
|
_useState44 = (0, _slicedToArray2.default)(_useState43, 2),
|
|
301
|
-
|
|
302
|
-
|
|
305
|
+
comment = _useState44[0],
|
|
306
|
+
setComment = _useState44[1];
|
|
303
307
|
|
|
304
|
-
var _useState45 = (0, _react.useState)(
|
|
308
|
+
var _useState45 = (0, _react.useState)(0),
|
|
305
309
|
_useState46 = (0, _slicedToArray2.default)(_useState45, 2),
|
|
306
|
-
|
|
307
|
-
|
|
310
|
+
requiredNull = _useState46[0],
|
|
311
|
+
setRequiredNull = _useState46[1];
|
|
308
312
|
|
|
309
|
-
var _useState47 = (0, _react.useState)(
|
|
313
|
+
var _useState47 = (0, _react.useState)(false),
|
|
310
314
|
_useState48 = (0, _slicedToArray2.default)(_useState47, 2),
|
|
311
|
-
|
|
312
|
-
|
|
315
|
+
crossComment = _useState48[0],
|
|
316
|
+
setCrossComment = _useState48[1];
|
|
313
317
|
|
|
314
|
-
var _useState49 = (0, _react.useState)(
|
|
318
|
+
var _useState49 = (0, _react.useState)([]),
|
|
315
319
|
_useState50 = (0, _slicedToArray2.default)(_useState49, 2),
|
|
316
|
-
|
|
317
|
-
|
|
320
|
+
userGroups = _useState50[0],
|
|
321
|
+
setUserGroups = _useState50[1];
|
|
318
322
|
|
|
319
|
-
var _useState51 = (0, _react.useState)(
|
|
323
|
+
var _useState51 = (0, _react.useState)({}),
|
|
320
324
|
_useState52 = (0, _slicedToArray2.default)(_useState51, 2),
|
|
321
|
-
|
|
322
|
-
|
|
325
|
+
assig = _useState52[0],
|
|
326
|
+
setAssig = _useState52[1];
|
|
323
327
|
|
|
324
|
-
var _useState53 = (0, _react.useState)(
|
|
328
|
+
var _useState53 = (0, _react.useState)([]),
|
|
325
329
|
_useState54 = (0, _slicedToArray2.default)(_useState53, 2),
|
|
326
|
-
|
|
327
|
-
|
|
330
|
+
selectedImages = _useState54[0],
|
|
331
|
+
setSelectedImages = _useState54[1];
|
|
332
|
+
|
|
333
|
+
var _useState55 = (0, _react.useState)([]),
|
|
334
|
+
_useState56 = (0, _slicedToArray2.default)(_useState55, 2),
|
|
335
|
+
componentsArray = _useState56[0],
|
|
336
|
+
setComponentsArray = _useState56[1];
|
|
337
|
+
|
|
338
|
+
var _useState57 = (0, _react.useState)(false),
|
|
339
|
+
_useState58 = (0, _slicedToArray2.default)(_useState57, 2),
|
|
340
|
+
checkAll = _useState58[0],
|
|
341
|
+
setCheckAll = _useState58[1];
|
|
328
342
|
|
|
329
343
|
var isRetailer = user === null || user === void 0 ? void 0 : user.is_retailer;
|
|
344
|
+
(0, _react.useEffect)(function () {
|
|
345
|
+
checkAll && setSelectedImages(images.values);
|
|
346
|
+
}, [checkAll]);
|
|
330
347
|
|
|
331
348
|
var loadData = /*#__PURE__*/function () {
|
|
332
349
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
333
|
-
var _services$, _services$$values;
|
|
350
|
+
var _productSelected$arti, _productSelected$arti2, _services$, _services$$values;
|
|
334
351
|
|
|
335
352
|
var services;
|
|
336
353
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
@@ -338,7 +355,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
338
355
|
switch (_context2.prev = _context2.next) {
|
|
339
356
|
case 0:
|
|
340
357
|
_context2.next = 2;
|
|
341
|
-
return (0, _data2.getRetailerServices)(productSelected.article.id_article, parseInt(productSelected.article.id_category), productSelected.version);
|
|
358
|
+
return (0, _data2.getRetailerServices)(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti = productSelected.article) === null || _productSelected$arti === void 0 ? void 0 : _productSelected$arti.id_article, parseInt(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti2 = productSelected.article) === null || _productSelected$arti2 === void 0 ? void 0 : _productSelected$arti2.id_category), productSelected === null || productSelected === void 0 ? void 0 : productSelected.version);
|
|
342
359
|
|
|
343
360
|
case 2:
|
|
344
361
|
services = _context2.sent;
|
|
@@ -367,6 +384,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
367
384
|
|
|
368
385
|
var getServices = /*#__PURE__*/function () {
|
|
369
386
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(tab) {
|
|
387
|
+
var _selected$article, _selected$article2, _servicesResponse$dat;
|
|
388
|
+
|
|
370
389
|
var serviceActive, selected, servicesResponse, parsedResponse;
|
|
371
390
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
372
391
|
while (1) {
|
|
@@ -392,11 +411,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
392
411
|
case 10:
|
|
393
412
|
selected = productSelected;
|
|
394
413
|
_context3.next = 13;
|
|
395
|
-
return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(selected.article.id_article, "&orderId=").concat(selected.article.id_order, "&end=true"));
|
|
414
|
+
return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(selected === null || selected === void 0 ? void 0 : (_selected$article = selected.article) === null || _selected$article === void 0 ? void 0 : _selected$article.id_article, "&orderId=").concat(selected === null || selected === void 0 ? void 0 : (_selected$article2 = selected.article) === null || _selected$article2 === void 0 ? void 0 : _selected$article2.id_order, "&end=true"));
|
|
396
415
|
|
|
397
416
|
case 13:
|
|
398
417
|
servicesResponse = _context3.sent;
|
|
399
|
-
parsedResponse = JSON.parse(servicesResponse.data.body).data;
|
|
418
|
+
parsedResponse = JSON.parse(servicesResponse === null || servicesResponse === void 0 ? void 0 : (_servicesResponse$dat = servicesResponse.data) === null || _servicesResponse$dat === void 0 ? void 0 : _servicesResponse$dat.body).data;
|
|
400
419
|
setServicesData(parsedResponse);
|
|
401
420
|
|
|
402
421
|
case 16:
|
|
@@ -428,7 +447,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
428
447
|
|
|
429
448
|
var getComments = /*#__PURE__*/function () {
|
|
430
449
|
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
431
|
-
var _productSelected$
|
|
450
|
+
var _productSelected$arti3, _productSelected$arti4, _productSelected$arti5;
|
|
432
451
|
|
|
433
452
|
var tab,
|
|
434
453
|
commentsResponse,
|
|
@@ -440,15 +459,15 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
440
459
|
case 0:
|
|
441
460
|
tab = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : "Descripción";
|
|
442
461
|
_context4.next = 3;
|
|
443
|
-
return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$
|
|
462
|
+
return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti3 = productSelected.article) === null || _productSelected$arti3 === void 0 ? void 0 : _productSelected$arti3.id_article, "&concept=description&orderIdColab=").concat(productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti4 = productSelected.article) === null || _productSelected$arti4 === void 0 ? void 0 : _productSelected$arti4.id_article, "&concept=datasheet&orderIdColab=").concat(productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti5 = productSelected.article) === null || _productSelected$arti5 === void 0 ? void 0 : _productSelected$arti5.id_article, "&concept=images&orderIdColab=").concat(productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId, "&version=").concat(version))]);
|
|
444
463
|
|
|
445
464
|
case 3:
|
|
446
465
|
commentsResponse = _context4.sent;
|
|
447
466
|
comments = {};
|
|
448
467
|
commentsResponse.forEach(function (comment) {
|
|
449
|
-
var _JSON$parse$data
|
|
468
|
+
var _comment$data, _JSON$parse, _JSON$parse$data$, _comment$data2, _comment$data3;
|
|
450
469
|
|
|
451
|
-
return JSON.parse(comment.data.body).data[0] && (comments[translateConcept((_JSON$parse
|
|
470
|
+
return JSON.parse(comment === null || comment === void 0 ? void 0 : (_comment$data = comment.data) === null || _comment$data === void 0 ? void 0 : _comment$data.body).data[0] && (comments[translateConcept((_JSON$parse = JSON.parse(comment === null || comment === void 0 ? void 0 : (_comment$data2 = comment.data) === null || _comment$data2 === void 0 ? void 0 : _comment$data2.body)) === null || _JSON$parse === void 0 ? void 0 : (_JSON$parse$data$ = _JSON$parse.data[0]) === null || _JSON$parse$data$ === void 0 ? void 0 : _JSON$parse$data$.concept)] = JSON.parse(comment === null || comment === void 0 ? void 0 : (_comment$data3 = comment.data) === null || _comment$data3 === void 0 ? void 0 : _comment$data3.body).data[0]);
|
|
452
471
|
});
|
|
453
472
|
setComment(comments[tab]);
|
|
454
473
|
setComments(comments);
|
|
@@ -545,51 +564,62 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
545
564
|
loadAssignations(productSelected);
|
|
546
565
|
}, [userGroups]);
|
|
547
566
|
(0, _react.useEffect)(function () {
|
|
548
|
-
var _productSelected$
|
|
567
|
+
var _productSelected$reta2, _productSelected$reta3;
|
|
549
568
|
|
|
550
|
-
productSelected.retailers.forEach(function (retailer) {
|
|
569
|
+
productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$reta2 = productSelected.retailers) === null || _productSelected$reta2 === void 0 ? void 0 : _productSelected$reta2.forEach(function (retailer) {
|
|
551
570
|
var _percentages$filter$;
|
|
552
571
|
|
|
553
|
-
retailer["percentage"] = (_percentages$filter$ = percentages.filter(function (percent) {
|
|
554
|
-
return retailer.id === percent.id_retailer;
|
|
572
|
+
retailer["percentage"] = percentages === null || percentages === void 0 ? void 0 : (_percentages$filter$ = percentages.filter(function (percent) {
|
|
573
|
+
return (retailer === null || retailer === void 0 ? void 0 : retailer.id) === (percent === null || percent === void 0 ? void 0 : percent.id_retailer);
|
|
555
574
|
})[0]) === null || _percentages$filter$ === void 0 ? void 0 : _percentages$filter$.percentage;
|
|
556
575
|
});
|
|
557
|
-
setActivePercentage(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$
|
|
576
|
+
setActivePercentage(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$reta3 = productSelected.retailers[0]) === null || _productSelected$reta3 === void 0 ? void 0 : _productSelected$reta3.percentage);
|
|
558
577
|
}, [percentages]);
|
|
559
578
|
(0, _react.useEffect)(function () {
|
|
579
|
+
var required = {};
|
|
580
|
+
|
|
560
581
|
if (services.length > 0) {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
582
|
+
var _services$2, _services$3;
|
|
583
|
+
|
|
584
|
+
services[0][activeRetailer.id].data = Object.values(services[0][activeRetailer.id].data);
|
|
585
|
+
setActivePercentage(Math.round(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.percentage, 0));
|
|
586
|
+
var datagroups = services[0][activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id];
|
|
587
|
+
var inputs = (_services$2 = services[0]) === null || _services$2 === void 0 ? void 0 : _services$2.inputs;
|
|
588
|
+
|
|
589
|
+
var _descriptions = (_services$3 = services[1]) === null || _services$3 === void 0 ? void 0 : _services$3.filter(function (service) {
|
|
590
|
+
return (service === null || service === void 0 ? void 0 : service.id) === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
|
|
591
|
+
});
|
|
592
|
+
|
|
593
|
+
setRequiredNull(required);
|
|
594
|
+
setDatasheets([datagroups, inputs]);
|
|
595
|
+
setDescriptions(_descriptions);
|
|
567
596
|
}
|
|
568
597
|
}, [activeRetailer]);
|
|
569
598
|
|
|
570
599
|
var thumbs = function thumbs() {
|
|
571
|
-
var _images$values;
|
|
600
|
+
var _images$inputs, _images$imageType, _images$imagePackagin, _images$values;
|
|
572
601
|
|
|
573
|
-
var imageInputs = images.inputs.map(function (e) {
|
|
602
|
+
var imageInputs = images === null || images === void 0 ? void 0 : (_images$inputs = images.inputs) === null || _images$inputs === void 0 ? void 0 : _images$inputs.map(function (e) {
|
|
574
603
|
return {
|
|
575
|
-
value: e.id,
|
|
576
|
-
name: e.name
|
|
604
|
+
value: e === null || e === void 0 ? void 0 : e.id,
|
|
605
|
+
name: e === null || e === void 0 ? void 0 : e.name
|
|
577
606
|
};
|
|
578
607
|
});
|
|
579
|
-
var imageType = images.imageType.map(function (e) {
|
|
608
|
+
var imageType = images === null || images === void 0 ? void 0 : (_images$imageType = images.imageType) === null || _images$imageType === void 0 ? void 0 : _images$imageType.map(function (e) {
|
|
580
609
|
return {
|
|
581
|
-
value: e.id,
|
|
582
|
-
name: e.name
|
|
610
|
+
value: e === null || e === void 0 ? void 0 : e.id,
|
|
611
|
+
name: e === null || e === void 0 ? void 0 : e.name
|
|
583
612
|
};
|
|
584
613
|
});
|
|
585
|
-
var imagePackagingType = images.imagePackagingType.map(function (e) {
|
|
614
|
+
var imagePackagingType = images === null || images === void 0 ? void 0 : (_images$imagePackagin = images.imagePackagingType) === null || _images$imagePackagin === void 0 ? void 0 : _images$imagePackagin.map(function (e) {
|
|
586
615
|
return {
|
|
587
|
-
value: e.id,
|
|
588
|
-
name: e.name
|
|
616
|
+
value: e === null || e === void 0 ? void 0 : e.id,
|
|
617
|
+
name: e === null || e === void 0 ? void 0 : e.name
|
|
589
618
|
};
|
|
590
619
|
});
|
|
591
620
|
return images === null || images === void 0 ? void 0 : (_images$values = images.values) === null || _images$values === void 0 ? void 0 : _images$values.map(function (image, index) {
|
|
592
621
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryElement.GalleryElement, {
|
|
622
|
+
setCheckAll: setCheckAll,
|
|
593
623
|
image: image,
|
|
594
624
|
gridLayout: imageLayout,
|
|
595
625
|
id: "gallery-element-" + index,
|
|
@@ -597,14 +627,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
597
627
|
imageType: imageType,
|
|
598
628
|
imagePackagingType: imagePackagingType,
|
|
599
629
|
imageInputs: imageInputs,
|
|
600
|
-
changeImage: setImages
|
|
630
|
+
changeImage: setImages,
|
|
631
|
+
selectedImages: selectedImages,
|
|
632
|
+
setSelectedImages: setSelectedImages
|
|
601
633
|
}, index);
|
|
602
634
|
});
|
|
603
635
|
};
|
|
604
636
|
|
|
605
637
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
606
638
|
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
607
|
-
var _productSelected$
|
|
639
|
+
var _productSelected$arti6;
|
|
608
640
|
|
|
609
641
|
var dataObject;
|
|
610
642
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
@@ -612,7 +644,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
612
644
|
switch (_context6.prev = _context6.next) {
|
|
613
645
|
case 0:
|
|
614
646
|
dataObject = {
|
|
615
|
-
articleId: productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$
|
|
647
|
+
articleId: productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti6 = productSelected.article) === null || _productSelected$arti6 === void 0 ? void 0 : _productSelected$arti6.id_article,
|
|
616
648
|
articleData: updatedDescriptions
|
|
617
649
|
};
|
|
618
650
|
_context6.prev = 1;
|
|
@@ -647,7 +679,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
647
679
|
|
|
648
680
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
649
681
|
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
650
|
-
var _productSelected$
|
|
682
|
+
var _productSelected$arti7;
|
|
651
683
|
|
|
652
684
|
var dataObject;
|
|
653
685
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
@@ -655,7 +687,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
655
687
|
switch (_context7.prev = _context7.next) {
|
|
656
688
|
case 0:
|
|
657
689
|
dataObject = {
|
|
658
|
-
articleId: productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$
|
|
690
|
+
articleId: productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti7 = productSelected.article) === null || _productSelected$arti7 === void 0 ? void 0 : _productSelected$arti7.id_article,
|
|
659
691
|
articleData: updatedDatasheets
|
|
660
692
|
};
|
|
661
693
|
_context7.prev = 1;
|
|
@@ -667,21 +699,20 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
667
699
|
});
|
|
668
700
|
|
|
669
701
|
case 4:
|
|
670
|
-
|
|
671
|
-
_context7.next = 10;
|
|
702
|
+
_context7.next = 9;
|
|
672
703
|
break;
|
|
673
704
|
|
|
674
|
-
case
|
|
675
|
-
_context7.prev =
|
|
705
|
+
case 6:
|
|
706
|
+
_context7.prev = 6;
|
|
676
707
|
_context7.t0 = _context7["catch"](1);
|
|
677
708
|
console.log(_context7.t0);
|
|
678
709
|
|
|
679
|
-
case
|
|
710
|
+
case 9:
|
|
680
711
|
case "end":
|
|
681
712
|
return _context7.stop();
|
|
682
713
|
}
|
|
683
714
|
}
|
|
684
|
-
}, _callee7, null, [[1,
|
|
715
|
+
}, _callee7, null, [[1, 6]]);
|
|
685
716
|
}));
|
|
686
717
|
|
|
687
718
|
return function saveDatasheets() {
|
|
@@ -690,49 +721,52 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
690
721
|
}();
|
|
691
722
|
|
|
692
723
|
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
693
|
-
var _images$values2;
|
|
724
|
+
var _images$values2, _product$article, _data$articleData, _data$articleData2, _data$updateImages;
|
|
725
|
+
|
|
726
|
+
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
694
727
|
|
|
695
|
-
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, promiseArray;
|
|
696
728
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
697
729
|
while (1) {
|
|
698
730
|
switch (_context8.prev = _context8.next) {
|
|
699
731
|
case 0:
|
|
700
732
|
imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
|
|
701
|
-
imagesListTemp = imagesList.reduce(function (acc, image) {
|
|
702
|
-
acc[image.image_id] = ++acc[image.image_id] || 0;
|
|
733
|
+
imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
|
|
734
|
+
acc[image === null || image === void 0 ? void 0 : image.image_id] = ++acc[image === null || image === void 0 ? void 0 : image.image_id] || 0;
|
|
703
735
|
return acc;
|
|
704
736
|
}, {});
|
|
705
|
-
duplicated = imagesList.filter(function (image) {
|
|
706
|
-
return imagesListTemp[image.image_id];
|
|
737
|
+
duplicated = imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (image) {
|
|
738
|
+
return imagesListTemp[image === null || image === void 0 ? void 0 : image.image_id];
|
|
707
739
|
});
|
|
708
740
|
attrForImgs = Object.values(images === null || images === void 0 ? void 0 : images.attrForImgs);
|
|
709
741
|
attrForImgs.pop();
|
|
710
742
|
data = {
|
|
711
|
-
articleId:
|
|
712
|
-
attrReqImgs: attrForImgs.map(function (e) {
|
|
743
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article,
|
|
744
|
+
attrReqImgs: attrForImgs === null || attrForImgs === void 0 ? void 0 : attrForImgs.map(function (e) {
|
|
745
|
+
var _e$, _e$2;
|
|
746
|
+
|
|
713
747
|
return {
|
|
714
|
-
attrId: e[0]
|
|
715
|
-
value: e[0].value
|
|
748
|
+
attrId: (_e$ = e[0]) === null || _e$ === void 0 ? void 0 : _e$.id,
|
|
749
|
+
value: (_e$2 = e[0]) === null || _e$2 === void 0 ? void 0 : _e$2.value
|
|
716
750
|
};
|
|
717
751
|
}),
|
|
718
|
-
articleData: imagesList.filter(function (e) {
|
|
752
|
+
articleData: imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (e) {
|
|
719
753
|
return !e.id;
|
|
720
754
|
}),
|
|
721
|
-
updateImages: imagesList.filter(function (e) {
|
|
755
|
+
updateImages: imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (e) {
|
|
722
756
|
return e.id;
|
|
723
757
|
})
|
|
724
758
|
};
|
|
725
|
-
valid = data.articleData.length === 0 ? true : data.articleData.every(function (e, i) {
|
|
726
|
-
if (e.image_id && e.packing_type && e.image_type) {
|
|
759
|
+
valid = (data === null || data === void 0 ? void 0 : (_data$articleData = data.articleData) === null || _data$articleData === void 0 ? void 0 : _data$articleData.length) === 0 ? true : data === null || data === void 0 ? void 0 : (_data$articleData2 = data.articleData) === null || _data$articleData2 === void 0 ? void 0 : _data$articleData2.every(function (e, i) {
|
|
760
|
+
if (e !== null && e !== void 0 && e.image_id && e !== null && e !== void 0 && e.packing_type && e !== null && e !== void 0 && e.image_type) {
|
|
727
761
|
return true;
|
|
728
762
|
}
|
|
729
763
|
|
|
730
764
|
return false;
|
|
731
765
|
});
|
|
732
766
|
|
|
733
|
-
if (valid && data.updateImages.length > 0 && duplicated.length === 0) {
|
|
734
|
-
valid = data.updateImages.every(function (e, i) {
|
|
735
|
-
if (e.image_id && e.packing_type && e.image_type) {
|
|
767
|
+
if (valid && (data === null || data === void 0 ? void 0 : (_data$updateImages = data.updateImages) === null || _data$updateImages === void 0 ? void 0 : _data$updateImages.length) > 0 && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0) {
|
|
768
|
+
valid = data === null || data === void 0 ? void 0 : (_data$updateImages2 = data.updateImages) === null || _data$updateImages2 === void 0 ? void 0 : _data$updateImages2.every(function (e, i) {
|
|
769
|
+
if (e !== null && e !== void 0 && e.image_id && e !== null && e !== void 0 && e.packing_type && e !== null && e !== void 0 && e.image_type) {
|
|
736
770
|
return true;
|
|
737
771
|
}
|
|
738
772
|
|
|
@@ -740,31 +774,31 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
740
774
|
});
|
|
741
775
|
}
|
|
742
776
|
|
|
743
|
-
if (!(valid && duplicated.length === 0)) {
|
|
777
|
+
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
744
778
|
_context8.next = 29;
|
|
745
779
|
break;
|
|
746
780
|
}
|
|
747
781
|
|
|
748
782
|
_context8.prev = 9;
|
|
749
|
-
data.articleData.forEach(function (e) {
|
|
783
|
+
data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
|
|
750
784
|
e.uuid = (0, _uuid.v4)();
|
|
751
785
|
});
|
|
752
786
|
setDataImages(data);
|
|
753
787
|
|
|
754
|
-
if (!(data.articleData.length > 0)) {
|
|
788
|
+
if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
|
|
755
789
|
_context8.next = 21;
|
|
756
790
|
break;
|
|
757
791
|
}
|
|
758
792
|
|
|
759
793
|
setImagesUploaded(false);
|
|
760
794
|
promiseArray = [];
|
|
761
|
-
data.articleData.forEach(function (e) {
|
|
795
|
+
data === null || data === void 0 ? void 0 : (_data$articleData5 = data.articleData) === null || _data$articleData5 === void 0 ? void 0 : _data$articleData5.forEach(function (e) {
|
|
762
796
|
var file = Buffer.from(e.src.replace(/^data:image\/\w+;base64,/, ""), "base64");
|
|
763
797
|
var params = {
|
|
764
798
|
ACL: "public-read",
|
|
765
799
|
Body: file,
|
|
766
800
|
Bucket: S3_BUCKET,
|
|
767
|
-
Key: "id-".concat(data.articleId, "/").concat(version, "/").concat(e.image_id, "-").concat(e.uuid, ".").concat(e.ext)
|
|
801
|
+
Key: "id-".concat(data.articleId, "/").concat(version, "/").concat(e === null || e === void 0 ? void 0 : e.image_id, "-").concat(e === null || e === void 0 ? void 0 : e.uuid, ".").concat(e === null || e === void 0 ? void 0 : e.ext)
|
|
768
802
|
};
|
|
769
803
|
promiseArray.push(myBucket.putObject(params).promise());
|
|
770
804
|
});
|
|
@@ -794,14 +828,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
794
828
|
|
|
795
829
|
case 29:
|
|
796
830
|
// setMainLoading(false);
|
|
797
|
-
|
|
798
|
-
// ...prev,
|
|
799
|
-
// {
|
|
800
|
-
// titleMsg: "Completa los campos que solicita cada una de la imágenes",
|
|
801
|
-
// alertMsg:
|
|
802
|
-
// "Recuerda hay campos obligatorios y no podras avanzar si no estan completos.",
|
|
803
|
-
// },
|
|
804
|
-
// ]);
|
|
831
|
+
setMessage("Completa los campos que solicita cada una de la imágenes o hay imágenes con el mismo tipo de toma.<br>Recuerda hay campos obligatorios y no podras avanzar si no estan completos.");
|
|
805
832
|
|
|
806
833
|
case 30:
|
|
807
834
|
case "end":
|
|
@@ -820,7 +847,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
820
847
|
break;
|
|
821
848
|
}
|
|
822
849
|
|
|
823
|
-
dataImages.articleData = dataImages.articleData.map(function (e) {
|
|
850
|
+
dataImages.articleData = dataImages === null || dataImages === void 0 ? void 0 : dataImages.articleData.map(function (e) {
|
|
824
851
|
delete e.src;
|
|
825
852
|
e.imageID = e.image_id;
|
|
826
853
|
e.packingType = e.packing_type;
|
|
@@ -836,7 +863,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
836
863
|
});
|
|
837
864
|
|
|
838
865
|
case 5:
|
|
839
|
-
|
|
866
|
+
setMessage("Imágenes guardadas con éxito");
|
|
840
867
|
_context9.next = 11;
|
|
841
868
|
break;
|
|
842
869
|
|
|
@@ -874,7 +901,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
874
901
|
}
|
|
875
902
|
|
|
876
903
|
concept = action ? action : concept;
|
|
877
|
-
return productSelected["".concat(concept, "_status")] === "QF" && (user.id_role === 1 || user.id_role === 4 || user.id_role === 5) || productSelected["".concat(concept, "_status")] === "AF" && (user.id_role === 1 || user.id_role === 6) || productSelected["".concat(concept, "_status")] === "RP" && (user.id_role === 1 || user.id_role === 6);
|
|
904
|
+
return productSelected["".concat(concept, "_status")] === "QF" && ((user === null || user === void 0 ? void 0 : user.id_role) === 1 || (user === null || user === void 0 ? void 0 : user.id_role) === 4 || (user === null || user === void 0 ? void 0 : user.id_role) === 5) || productSelected["".concat(concept, "_status")] === "AF" && ((user === null || user === void 0 ? void 0 : user.id_role) === 1 || (user === null || user === void 0 ? void 0 : user.id_role) === 6) || productSelected["".concat(concept, "_status")] === "RP" && ((user === null || user === void 0 ? void 0 : user.id_role) === 1 || (user === null || user === void 0 ? void 0 : user.id_role) === 6);
|
|
878
905
|
};
|
|
879
906
|
|
|
880
907
|
var getSectionIcon = function getSectionIcon() {
|
|
@@ -898,7 +925,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
898
925
|
|
|
899
926
|
var updateCompaniesList = function updateCompaniesList(status, result, retailerId, concept) {
|
|
900
927
|
var serv = servicesData.slice();
|
|
901
|
-
var item = serv.find(function (item) {
|
|
928
|
+
var item = serv === null || serv === void 0 ? void 0 : serv.find(function (item) {
|
|
902
929
|
return item.id_retailer === retailerId && item.service === concept;
|
|
903
930
|
});
|
|
904
931
|
var index = serv.indexOf(item);
|
|
@@ -1138,7 +1165,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1138
1165
|
|
|
1139
1166
|
var createComment = /*#__PURE__*/function () {
|
|
1140
1167
|
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(e, body, tab) {
|
|
1141
|
-
var _product$
|
|
1168
|
+
var _product$article2;
|
|
1142
1169
|
|
|
1143
1170
|
var concept, data;
|
|
1144
1171
|
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
@@ -1164,25 +1191,24 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1164
1191
|
|
|
1165
1192
|
case 10:
|
|
1166
1193
|
data = {
|
|
1167
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$
|
|
1194
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.id_article,
|
|
1168
1195
|
orderId: product === null || product === void 0 ? void 0 : product.orderId,
|
|
1169
1196
|
message: body,
|
|
1170
1197
|
concept: concept,
|
|
1171
1198
|
version: version
|
|
1172
1199
|
};
|
|
1173
|
-
|
|
1174
|
-
_context11.next = 14;
|
|
1200
|
+
_context11.next = 13;
|
|
1175
1201
|
return _axios.default.post("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1176
1202
|
headers: {
|
|
1177
1203
|
Authorization: token
|
|
1178
1204
|
}
|
|
1179
1205
|
});
|
|
1180
1206
|
|
|
1181
|
-
case
|
|
1182
|
-
_context11.next =
|
|
1207
|
+
case 13:
|
|
1208
|
+
_context11.next = 15;
|
|
1183
1209
|
return getComments(tab);
|
|
1184
1210
|
|
|
1185
|
-
case
|
|
1211
|
+
case 15:
|
|
1186
1212
|
case "end":
|
|
1187
1213
|
return _context11.stop();
|
|
1188
1214
|
}
|
|
@@ -1247,7 +1273,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1247
1273
|
|
|
1248
1274
|
var setAssignation = /*#__PURE__*/function () {
|
|
1249
1275
|
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(assignationType, assignationId) {
|
|
1250
|
-
var _product$
|
|
1276
|
+
var _product$article3;
|
|
1251
1277
|
|
|
1252
1278
|
var concept, productTemp, data;
|
|
1253
1279
|
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
@@ -1277,7 +1303,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1277
1303
|
data = (0, _defineProperty2.default)({
|
|
1278
1304
|
articleList: [{
|
|
1279
1305
|
orderId: product.orderId,
|
|
1280
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$
|
|
1306
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_article
|
|
1281
1307
|
}],
|
|
1282
1308
|
concept: concept
|
|
1283
1309
|
}, "".concat(assignationType, "Id"), assignationId);
|
|
@@ -1305,6 +1331,110 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1305
1331
|
};
|
|
1306
1332
|
}();
|
|
1307
1333
|
|
|
1334
|
+
var evaluationComplete = function evaluationComplete(tab) {
|
|
1335
|
+
var concept = "";
|
|
1336
|
+
|
|
1337
|
+
switch (tab) {
|
|
1338
|
+
case "Ficha técnica":
|
|
1339
|
+
concept = "datasheet";
|
|
1340
|
+
break;
|
|
1341
|
+
|
|
1342
|
+
case "Imágenes":
|
|
1343
|
+
concept = "images";
|
|
1344
|
+
break;
|
|
1345
|
+
|
|
1346
|
+
default:
|
|
1347
|
+
concept = "description";
|
|
1348
|
+
break;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
var serv = servicesData.filter(function (item) {
|
|
1352
|
+
return item.service === concept;
|
|
1353
|
+
});
|
|
1354
|
+
var approved = "";
|
|
1355
|
+
var rejected = "";
|
|
1356
|
+
|
|
1357
|
+
if (product.status === "IN_PROGRESS" || product.status === "QF" || product.status === "RF") {
|
|
1358
|
+
approved = "AF";
|
|
1359
|
+
rejected = "RF";
|
|
1360
|
+
|
|
1361
|
+
if (product.status === "QF") {
|
|
1362
|
+
return serv.filter(function (item) {
|
|
1363
|
+
return item.status === approved || item.status === rejected || item.status === "AA" || item.status === "AP";
|
|
1364
|
+
}).length === serv.length;
|
|
1365
|
+
}
|
|
1366
|
+
} else if (product.status === "AF" || product.status === "RA" || product.status === "RP") {
|
|
1367
|
+
approved = "AA";
|
|
1368
|
+
rejected = "RA";
|
|
1369
|
+
|
|
1370
|
+
if (product.status === "RP" || product.status === "AF") {
|
|
1371
|
+
return serv.filter(function (item) {
|
|
1372
|
+
return item.status === approved || item.status === rejected || item.status === "AP";
|
|
1373
|
+
}).length === serv.length;
|
|
1374
|
+
}
|
|
1375
|
+
} else if (product.status === "RC") {
|
|
1376
|
+
approved = "AP";
|
|
1377
|
+
rejected = "RA";
|
|
1378
|
+
return serv.filter(function (item) {
|
|
1379
|
+
return item.status === approved || item.status === rejected;
|
|
1380
|
+
}).length === serv.length;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
return serv.filter(function (item) {
|
|
1384
|
+
return item.status === approved || item.status === rejected;
|
|
1385
|
+
}).length === serv.length;
|
|
1386
|
+
};
|
|
1387
|
+
|
|
1388
|
+
var downloadImages = function downloadImages() {
|
|
1389
|
+
selectedImages.forEach(function (e) {
|
|
1390
|
+
if (e.id) {
|
|
1391
|
+
(0, _fileSaver.saveAs)("https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(e.srcDB), "".concat(product.article.upc, "_").concat(e.name, ".").concat(e.ext));
|
|
1392
|
+
}
|
|
1393
|
+
});
|
|
1394
|
+
};
|
|
1395
|
+
|
|
1396
|
+
var deleteImages = function deleteImages() {
|
|
1397
|
+
var data = {
|
|
1398
|
+
articleId: product.article.id_article,
|
|
1399
|
+
deleteImages: selectedImages
|
|
1400
|
+
};
|
|
1401
|
+
|
|
1402
|
+
try {
|
|
1403
|
+
_axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), data, {
|
|
1404
|
+
headers: {
|
|
1405
|
+
Authorization: token
|
|
1406
|
+
}
|
|
1407
|
+
});
|
|
1408
|
+
} catch (err) {
|
|
1409
|
+
console.log(err);
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
setMessage("");
|
|
1413
|
+
};
|
|
1414
|
+
|
|
1415
|
+
var askToDeleteImages = function askToDeleteImages() {
|
|
1416
|
+
if (selectedImages.length > 0) {
|
|
1417
|
+
setMessage("¿Está seguro de eliminar las imágenes seleccionadas?");
|
|
1418
|
+
setComponentsArray([/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1419
|
+
text: "",
|
|
1420
|
+
Paragraph: "¿Está seguro de eliminar las imágenes seleccionadas?",
|
|
1421
|
+
headerType: "header-and-paragraph"
|
|
1422
|
+
}, "1"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1423
|
+
buttonType: "general-white-button",
|
|
1424
|
+
label: "Cancelar",
|
|
1425
|
+
onClick: function onClick() {
|
|
1426
|
+
return setMessage("");
|
|
1427
|
+
}
|
|
1428
|
+
}, "2"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1429
|
+
buttonType: "general-button-default",
|
|
1430
|
+
label: "Aceptar",
|
|
1431
|
+
onClick: function onClick() {
|
|
1432
|
+
return deleteImages();
|
|
1433
|
+
}
|
|
1434
|
+
}, "3")]);
|
|
1435
|
+
}
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1308
1438
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
1309
1439
|
headerTop: headerTop,
|
|
1310
1440
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
@@ -1326,7 +1456,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1326
1456
|
assignationsImages: assig["Imágenes"],
|
|
1327
1457
|
imagesStatus: productSelected === null || productSelected === void 0 ? void 0 : productSelected.images_status,
|
|
1328
1458
|
setAssignation: setAssignation,
|
|
1329
|
-
isRetailer: isRetailer
|
|
1459
|
+
isRetailer: isRetailer,
|
|
1460
|
+
onClickSave: function onClickSave() {
|
|
1461
|
+
return updateImages();
|
|
1462
|
+
}
|
|
1330
1463
|
})]
|
|
1331
1464
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1332
1465
|
className: "product-information",
|
|
@@ -1353,15 +1486,36 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1353
1486
|
activeTab: activeTab,
|
|
1354
1487
|
setActiveTab: setActiveTab,
|
|
1355
1488
|
setImageLayout: setImageLayout,
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
updateImages: updateImages,
|
|
1489
|
+
downloadImages: downloadImages,
|
|
1490
|
+
askToDeleteImages: askToDeleteImages,
|
|
1359
1491
|
assig: assig[activeTab],
|
|
1360
1492
|
setAssignation: setAssignation,
|
|
1361
|
-
isRetailer: isRetailer
|
|
1493
|
+
isRetailer: isRetailer,
|
|
1494
|
+
onClickSave: function onClickSave() {
|
|
1495
|
+
switch (activeTab) {
|
|
1496
|
+
case "Descripción":
|
|
1497
|
+
saveDescriptions();
|
|
1498
|
+
break;
|
|
1499
|
+
|
|
1500
|
+
case "Ficha técnica":
|
|
1501
|
+
saveDatasheets();
|
|
1502
|
+
break;
|
|
1503
|
+
|
|
1504
|
+
case "Imágenes":
|
|
1505
|
+
updateImages();
|
|
1506
|
+
break;
|
|
1507
|
+
|
|
1508
|
+
default:
|
|
1509
|
+
break;
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1362
1512
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1363
1513
|
className: "services-information-container " + (imageLayout && activeTab === "Imágenes" ? "image-services" : ""),
|
|
1364
|
-
children: [!imageLayout &&
|
|
1514
|
+
children: [!imageLayout && activeTab === "Imágenes" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
|
|
1515
|
+
setSelectedImages: setSelectedImages,
|
|
1516
|
+
checkAll: checkAll,
|
|
1517
|
+
setCheckAll: setCheckAll
|
|
1518
|
+
}), activeTab === "Ficha técnica" && ((product === null || product === void 0 ? void 0 : (_product$services = product.services) === null || _product$services === void 0 ? void 0 : _product$services.datasheets) === 1 ? (_datasheets$ = datasheets[0]) === null || _datasheets$ === void 0 ? void 0 : (_datasheets$$data = _datasheets$.data) === null || _datasheets$$data === void 0 ? void 0 : _datasheets$$data.map(function (dataGroup, index) {
|
|
1365
1519
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
1366
1520
|
articleId: productSelected.article.id_article,
|
|
1367
1521
|
version: version,
|
|
@@ -1378,7 +1532,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1378
1532
|
inputGroup: descriptions[0],
|
|
1379
1533
|
updatedDescriptions: updatedDescriptions,
|
|
1380
1534
|
setUpdatedDescriptions: setUpdatedDescriptions,
|
|
1381
|
-
articleId:
|
|
1535
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article,
|
|
1382
1536
|
version: version,
|
|
1383
1537
|
dinamicHeight: true
|
|
1384
1538
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
@@ -1395,9 +1549,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1395
1549
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
1396
1550
|
children: "no tienes este servicio"
|
|
1397
1551
|
}))]
|
|
1398
|
-
}), (userAssigned(activeTab, "especialist" || "facilitator") || auditorAssigned()) && /*#__PURE__*/(0, _jsxRuntime.
|
|
1552
|
+
}), (userAssigned(activeTab, "especialist" || "facilitator") || auditorAssigned()) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1399
1553
|
className: "commentary-box",
|
|
1400
|
-
children: !comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1554
|
+
children: [!comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1401
1555
|
className: "commentary",
|
|
1402
1556
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
|
|
1403
1557
|
label: "Caja de Comentario",
|
|
@@ -1406,21 +1560,15 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1406
1560
|
inputRows: 4,
|
|
1407
1561
|
inputId: "commentary-box",
|
|
1408
1562
|
index: 0
|
|
1409
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
1563
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1410
1564
|
className: "buttons-box",
|
|
1411
|
-
children:
|
|
1565
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1412
1566
|
buttonType: "general-transparent-button",
|
|
1413
1567
|
label: "Enviar comentario",
|
|
1414
1568
|
onClick: function onClick(e) {
|
|
1415
|
-
return createComment(e, document.
|
|
1569
|
+
return createComment(e, document.querySelector("#description-commentary-box-0 .ql-container .ql-editor > p").innerHTML, activeTab);
|
|
1416
1570
|
}
|
|
1417
|
-
})
|
|
1418
|
-
buttonType: requiredNull !== 0 || !specialistValid(activeTab) || !versionMatch() ? "general-button-disabled" : "general-green-button",
|
|
1419
|
-
label: "Enviar evaluación",
|
|
1420
|
-
onClick: function onClick() {
|
|
1421
|
-
return sendToFacilitator();
|
|
1422
|
-
}
|
|
1423
|
-
})]
|
|
1571
|
+
})
|
|
1424
1572
|
})]
|
|
1425
1573
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1426
1574
|
className: "feedback-box",
|
|
@@ -1445,7 +1593,13 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1445
1593
|
}, _callee15);
|
|
1446
1594
|
}))
|
|
1447
1595
|
})]
|
|
1448
|
-
})
|
|
1596
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1597
|
+
buttonType: !requiredNull[activeTab] === 0 || !approveRejectButtons() || !evaluationComplete(activeTab) ? "general-button-disabled" : "general-green-button",
|
|
1598
|
+
label: "Enviar evaluación",
|
|
1599
|
+
onClick: function onClick() {
|
|
1600
|
+
return sendToFacilitator();
|
|
1601
|
+
}
|
|
1602
|
+
})]
|
|
1449
1603
|
})]
|
|
1450
1604
|
})]
|
|
1451
1605
|
}), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImageModal.ProductImageModal, {
|
|
@@ -1453,6 +1607,13 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1453
1607
|
setShowModal: setShowModal,
|
|
1454
1608
|
sendToFacilitator: sendToFacilitator,
|
|
1455
1609
|
approveRejectButtons: approveRejectButtons
|
|
1610
|
+
}), message.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
|
|
1611
|
+
componentsArray: componentsArray.length > 0 ? componentsArray : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1612
|
+
text: message
|
|
1613
|
+
}),
|
|
1614
|
+
onClick: function onClick() {
|
|
1615
|
+
return setMessage("");
|
|
1616
|
+
}
|
|
1456
1617
|
})]
|
|
1457
1618
|
});
|
|
1458
1619
|
};
|