contentoh-components-library 14.0.0 → 17.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 -10
- 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 +331 -172
- 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 +1 -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 -8
- package/src/components/organisms/ImageDataTable/index.js +2 -0
- package/src/components/organisms/ProductImageModal/index.js +8 -2
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +4 -14
- package/src/components/pages/RetailerProductEdition/index.js +252 -92
- 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,11 +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
|
-
var
|
|
119
|
-
tabsSections = _ref.tabsSections,
|
|
120
|
-
articleId = _ref.articleId,
|
|
124
|
+
var tabsSections = _ref.tabsSections,
|
|
121
125
|
_ref$productSelected = _ref.productSelected,
|
|
122
126
|
productSelected = _ref$productSelected === void 0 ? {} : _ref$productSelected,
|
|
123
127
|
_ref$user = _ref.user,
|
|
@@ -134,7 +138,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
134
138
|
activeImage = _useState4[0],
|
|
135
139
|
setActiveImage = _useState4[1];
|
|
136
140
|
|
|
137
|
-
var _useState5 = (0, _react.useState)(
|
|
141
|
+
var _useState5 = (0, _react.useState)(false),
|
|
138
142
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
139
143
|
imageLayout = _useState6[0],
|
|
140
144
|
setImageLayout = _useState6[1];
|
|
@@ -164,12 +168,6 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
164
168
|
showModal = _useState14[0],
|
|
165
169
|
setShowModal = _useState14[1];
|
|
166
170
|
|
|
167
|
-
var _useState15 = (0, _react.useState)(54),
|
|
168
|
-
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
169
|
-
retailerSelected = _useState16[0],
|
|
170
|
-
setRetailerSelected = _useState16[1]; // revisar después como trabajar esto de mejor forma
|
|
171
|
-
|
|
172
|
-
|
|
173
171
|
var _useDropzone = (0, _reactDropzone.useDropzone)({
|
|
174
172
|
accept: "image/*",
|
|
175
173
|
noKeyboard: true,
|
|
@@ -230,108 +228,126 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
230
228
|
getRootProps = _useDropzone.getRootProps,
|
|
231
229
|
getInputProps = _useDropzone.getInputProps;
|
|
232
230
|
|
|
231
|
+
var _useState15 = (0, _react.useState)([]),
|
|
232
|
+
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
233
|
+
updatedDatasheets = _useState16[0],
|
|
234
|
+
setUpdatedDatasheets = _useState16[1];
|
|
235
|
+
|
|
233
236
|
var _useState17 = (0, _react.useState)([]),
|
|
234
237
|
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
235
|
-
|
|
236
|
-
|
|
238
|
+
updatedDescriptions = _useState18[0],
|
|
239
|
+
setUpdatedDescriptions = _useState18[1];
|
|
237
240
|
|
|
238
|
-
var _useState19 = (0, _react.useState)(
|
|
241
|
+
var _useState19 = (0, _react.useState)(false),
|
|
239
242
|
_useState20 = (0, _slicedToArray2.default)(_useState19, 2),
|
|
240
|
-
|
|
241
|
-
|
|
243
|
+
imagesUploaded = _useState20[0],
|
|
244
|
+
setImagesUploaded = _useState20[1];
|
|
242
245
|
|
|
243
|
-
var _useState21 = (0, _react.useState)(
|
|
246
|
+
var _useState21 = (0, _react.useState)(),
|
|
244
247
|
_useState22 = (0, _slicedToArray2.default)(_useState21, 2),
|
|
245
|
-
|
|
246
|
-
|
|
248
|
+
dataImages = _useState22[0],
|
|
249
|
+
setDataImages = _useState22[1];
|
|
247
250
|
|
|
248
|
-
var _useState23 = (0, _react.useState)()
|
|
249
|
-
_useState24 = (0, _slicedToArray2.default)(_useState23, 2),
|
|
250
|
-
dataImages = _useState24[0],
|
|
251
|
-
setDataImages = _useState24[1];
|
|
252
|
-
|
|
253
|
-
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({
|
|
254
252
|
percentage: 0
|
|
255
253
|
})),
|
|
254
|
+
_useState24 = (0, _slicedToArray2.default)(_useState23, 2),
|
|
255
|
+
percentages = _useState24[0],
|
|
256
|
+
setPercentages = _useState24[1];
|
|
257
|
+
|
|
258
|
+
var _useState25 = (0, _react.useState)(0),
|
|
256
259
|
_useState26 = (0, _slicedToArray2.default)(_useState25, 2),
|
|
257
|
-
|
|
258
|
-
|
|
260
|
+
activePercentage = _useState26[0],
|
|
261
|
+
setActivePercentage = _useState26[1];
|
|
259
262
|
|
|
260
|
-
var _useState27 = (0, _react.useState)(
|
|
263
|
+
var _useState27 = (0, _react.useState)({}),
|
|
261
264
|
_useState28 = (0, _slicedToArray2.default)(_useState27, 2),
|
|
262
|
-
|
|
263
|
-
|
|
265
|
+
activeRetailer = _useState28[0],
|
|
266
|
+
setActiveRetailer = _useState28[1];
|
|
264
267
|
|
|
265
|
-
var _useState29 = (0, _react.useState)(
|
|
268
|
+
var _useState29 = (0, _react.useState)([]),
|
|
266
269
|
_useState30 = (0, _slicedToArray2.default)(_useState29, 2),
|
|
267
|
-
|
|
268
|
-
|
|
270
|
+
services = _useState30[0],
|
|
271
|
+
setServices = _useState30[1];
|
|
269
272
|
|
|
270
273
|
var _useState31 = (0, _react.useState)([]),
|
|
271
274
|
_useState32 = (0, _slicedToArray2.default)(_useState31, 2),
|
|
272
|
-
|
|
273
|
-
|
|
275
|
+
servicesData = _useState32[0],
|
|
276
|
+
setServicesData = _useState32[1];
|
|
274
277
|
|
|
275
|
-
var _useState33 = (0, _react.useState)(
|
|
278
|
+
var _useState33 = (0, _react.useState)(""),
|
|
276
279
|
_useState34 = (0, _slicedToArray2.default)(_useState33, 2),
|
|
277
|
-
|
|
278
|
-
|
|
280
|
+
message = _useState34[0],
|
|
281
|
+
setMessage = _useState34[1];
|
|
279
282
|
|
|
280
|
-
var _useState35 = (0, _react.useState)(
|
|
283
|
+
var _useState35 = (0, _react.useState)({}),
|
|
281
284
|
_useState36 = (0, _slicedToArray2.default)(_useState35, 2),
|
|
282
|
-
|
|
283
|
-
|
|
285
|
+
product = _useState36[0],
|
|
286
|
+
setProduct = _useState36[1];
|
|
284
287
|
|
|
285
|
-
var _useState37 = (0, _react.useState)(
|
|
288
|
+
var _useState37 = (0, _react.useState)(null),
|
|
286
289
|
_useState38 = (0, _slicedToArray2.default)(_useState37, 2),
|
|
287
|
-
|
|
288
|
-
|
|
290
|
+
icon = _useState38[0],
|
|
291
|
+
setIcon = _useState38[1];
|
|
289
292
|
|
|
290
|
-
var _useState39 = (0, _react.useState)(null),
|
|
293
|
+
var _useState39 = (0, _react.useState)(productSelected === null || productSelected === void 0 ? void 0 : productSelected.version),
|
|
291
294
|
_useState40 = (0, _slicedToArray2.default)(_useState39, 2),
|
|
292
|
-
|
|
293
|
-
|
|
295
|
+
version = _useState40[0],
|
|
296
|
+
setVersion = _useState40[1];
|
|
294
297
|
|
|
295
|
-
var _useState41 = (0, _react.useState)(
|
|
298
|
+
var _useState41 = (0, _react.useState)({}),
|
|
296
299
|
_useState42 = (0, _slicedToArray2.default)(_useState41, 2),
|
|
297
|
-
|
|
298
|
-
|
|
300
|
+
comments = _useState42[0],
|
|
301
|
+
setComments = _useState42[1];
|
|
299
302
|
|
|
300
|
-
var _useState43 = (0, _react.useState)(
|
|
303
|
+
var _useState43 = (0, _react.useState)(""),
|
|
301
304
|
_useState44 = (0, _slicedToArray2.default)(_useState43, 2),
|
|
302
|
-
|
|
303
|
-
|
|
305
|
+
comment = _useState44[0],
|
|
306
|
+
setComment = _useState44[1];
|
|
304
307
|
|
|
305
|
-
var _useState45 = (0, _react.useState)(
|
|
308
|
+
var _useState45 = (0, _react.useState)(0),
|
|
306
309
|
_useState46 = (0, _slicedToArray2.default)(_useState45, 2),
|
|
307
|
-
|
|
308
|
-
|
|
310
|
+
requiredNull = _useState46[0],
|
|
311
|
+
setRequiredNull = _useState46[1];
|
|
309
312
|
|
|
310
|
-
var _useState47 = (0, _react.useState)(
|
|
313
|
+
var _useState47 = (0, _react.useState)(false),
|
|
311
314
|
_useState48 = (0, _slicedToArray2.default)(_useState47, 2),
|
|
312
|
-
|
|
313
|
-
|
|
315
|
+
crossComment = _useState48[0],
|
|
316
|
+
setCrossComment = _useState48[1];
|
|
314
317
|
|
|
315
|
-
var _useState49 = (0, _react.useState)(
|
|
318
|
+
var _useState49 = (0, _react.useState)([]),
|
|
316
319
|
_useState50 = (0, _slicedToArray2.default)(_useState49, 2),
|
|
317
|
-
|
|
318
|
-
|
|
320
|
+
userGroups = _useState50[0],
|
|
321
|
+
setUserGroups = _useState50[1];
|
|
319
322
|
|
|
320
|
-
var _useState51 = (0, _react.useState)(
|
|
323
|
+
var _useState51 = (0, _react.useState)({}),
|
|
321
324
|
_useState52 = (0, _slicedToArray2.default)(_useState51, 2),
|
|
322
|
-
|
|
323
|
-
|
|
325
|
+
assig = _useState52[0],
|
|
326
|
+
setAssig = _useState52[1];
|
|
324
327
|
|
|
325
|
-
var _useState53 = (0, _react.useState)(
|
|
328
|
+
var _useState53 = (0, _react.useState)([]),
|
|
326
329
|
_useState54 = (0, _slicedToArray2.default)(_useState53, 2),
|
|
327
|
-
|
|
328
|
-
|
|
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];
|
|
329
342
|
|
|
330
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]);
|
|
331
347
|
|
|
332
348
|
var loadData = /*#__PURE__*/function () {
|
|
333
349
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
334
|
-
var _services$, _services$$values;
|
|
350
|
+
var _productSelected$arti, _productSelected$arti2, _services$, _services$$values;
|
|
335
351
|
|
|
336
352
|
var services;
|
|
337
353
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
@@ -339,7 +355,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
339
355
|
switch (_context2.prev = _context2.next) {
|
|
340
356
|
case 0:
|
|
341
357
|
_context2.next = 2;
|
|
342
|
-
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);
|
|
343
359
|
|
|
344
360
|
case 2:
|
|
345
361
|
services = _context2.sent;
|
|
@@ -368,6 +384,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
368
384
|
|
|
369
385
|
var getServices = /*#__PURE__*/function () {
|
|
370
386
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(tab) {
|
|
387
|
+
var _selected$article, _selected$article2, _servicesResponse$dat;
|
|
388
|
+
|
|
371
389
|
var serviceActive, selected, servicesResponse, parsedResponse;
|
|
372
390
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
373
391
|
while (1) {
|
|
@@ -393,11 +411,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
393
411
|
case 10:
|
|
394
412
|
selected = productSelected;
|
|
395
413
|
_context3.next = 13;
|
|
396
|
-
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"));
|
|
397
415
|
|
|
398
416
|
case 13:
|
|
399
417
|
servicesResponse = _context3.sent;
|
|
400
|
-
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;
|
|
401
419
|
setServicesData(parsedResponse);
|
|
402
420
|
|
|
403
421
|
case 16:
|
|
@@ -429,7 +447,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
429
447
|
|
|
430
448
|
var getComments = /*#__PURE__*/function () {
|
|
431
449
|
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
432
|
-
var _productSelected$
|
|
450
|
+
var _productSelected$arti3, _productSelected$arti4, _productSelected$arti5;
|
|
433
451
|
|
|
434
452
|
var tab,
|
|
435
453
|
commentsResponse,
|
|
@@ -441,15 +459,15 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
441
459
|
case 0:
|
|
442
460
|
tab = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : "Descripción";
|
|
443
461
|
_context4.next = 3;
|
|
444
|
-
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))]);
|
|
445
463
|
|
|
446
464
|
case 3:
|
|
447
465
|
commentsResponse = _context4.sent;
|
|
448
466
|
comments = {};
|
|
449
467
|
commentsResponse.forEach(function (comment) {
|
|
450
|
-
var _JSON$parse$data
|
|
468
|
+
var _comment$data, _JSON$parse, _JSON$parse$data$, _comment$data2, _comment$data3;
|
|
451
469
|
|
|
452
|
-
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]);
|
|
453
471
|
});
|
|
454
472
|
setComment(comments[tab]);
|
|
455
473
|
setComments(comments);
|
|
@@ -546,51 +564,62 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
546
564
|
loadAssignations(productSelected);
|
|
547
565
|
}, [userGroups]);
|
|
548
566
|
(0, _react.useEffect)(function () {
|
|
549
|
-
var _productSelected$
|
|
567
|
+
var _productSelected$reta2, _productSelected$reta3;
|
|
550
568
|
|
|
551
|
-
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) {
|
|
552
570
|
var _percentages$filter$;
|
|
553
571
|
|
|
554
|
-
retailer["percentage"] = (_percentages$filter$ = percentages.filter(function (percent) {
|
|
555
|
-
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);
|
|
556
574
|
})[0]) === null || _percentages$filter$ === void 0 ? void 0 : _percentages$filter$.percentage;
|
|
557
575
|
});
|
|
558
|
-
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);
|
|
559
577
|
}, [percentages]);
|
|
560
578
|
(0, _react.useEffect)(function () {
|
|
579
|
+
var required = {};
|
|
580
|
+
|
|
561
581
|
if (services.length > 0) {
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
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);
|
|
568
596
|
}
|
|
569
597
|
}, [activeRetailer]);
|
|
570
598
|
|
|
571
599
|
var thumbs = function thumbs() {
|
|
572
|
-
var _images$values;
|
|
600
|
+
var _images$inputs, _images$imageType, _images$imagePackagin, _images$values;
|
|
573
601
|
|
|
574
|
-
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) {
|
|
575
603
|
return {
|
|
576
|
-
value: e.id,
|
|
577
|
-
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
|
|
578
606
|
};
|
|
579
607
|
});
|
|
580
|
-
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) {
|
|
581
609
|
return {
|
|
582
|
-
value: e.id,
|
|
583
|
-
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
|
|
584
612
|
};
|
|
585
613
|
});
|
|
586
|
-
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) {
|
|
587
615
|
return {
|
|
588
|
-
value: e.id,
|
|
589
|
-
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
|
|
590
618
|
};
|
|
591
619
|
});
|
|
592
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) {
|
|
593
621
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryElement.GalleryElement, {
|
|
622
|
+
setCheckAll: setCheckAll,
|
|
594
623
|
image: image,
|
|
595
624
|
gridLayout: imageLayout,
|
|
596
625
|
id: "gallery-element-" + index,
|
|
@@ -598,14 +627,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
598
627
|
imageType: imageType,
|
|
599
628
|
imagePackagingType: imagePackagingType,
|
|
600
629
|
imageInputs: imageInputs,
|
|
601
|
-
changeImage: setImages
|
|
630
|
+
changeImage: setImages,
|
|
631
|
+
selectedImages: selectedImages,
|
|
632
|
+
setSelectedImages: setSelectedImages
|
|
602
633
|
}, index);
|
|
603
634
|
});
|
|
604
635
|
};
|
|
605
636
|
|
|
606
637
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
607
638
|
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
608
|
-
var _productSelected$
|
|
639
|
+
var _productSelected$arti6;
|
|
609
640
|
|
|
610
641
|
var dataObject;
|
|
611
642
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
@@ -613,7 +644,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
613
644
|
switch (_context6.prev = _context6.next) {
|
|
614
645
|
case 0:
|
|
615
646
|
dataObject = {
|
|
616
|
-
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,
|
|
617
648
|
articleData: updatedDescriptions
|
|
618
649
|
};
|
|
619
650
|
_context6.prev = 1;
|
|
@@ -648,7 +679,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
648
679
|
|
|
649
680
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
650
681
|
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
651
|
-
var _productSelected$
|
|
682
|
+
var _productSelected$arti7;
|
|
652
683
|
|
|
653
684
|
var dataObject;
|
|
654
685
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
@@ -656,7 +687,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
656
687
|
switch (_context7.prev = _context7.next) {
|
|
657
688
|
case 0:
|
|
658
689
|
dataObject = {
|
|
659
|
-
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,
|
|
660
691
|
articleData: updatedDatasheets
|
|
661
692
|
};
|
|
662
693
|
_context7.prev = 1;
|
|
@@ -668,21 +699,20 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
668
699
|
});
|
|
669
700
|
|
|
670
701
|
case 4:
|
|
671
|
-
|
|
672
|
-
_context7.next = 10;
|
|
702
|
+
_context7.next = 9;
|
|
673
703
|
break;
|
|
674
704
|
|
|
675
|
-
case
|
|
676
|
-
_context7.prev =
|
|
705
|
+
case 6:
|
|
706
|
+
_context7.prev = 6;
|
|
677
707
|
_context7.t0 = _context7["catch"](1);
|
|
678
708
|
console.log(_context7.t0);
|
|
679
709
|
|
|
680
|
-
case
|
|
710
|
+
case 9:
|
|
681
711
|
case "end":
|
|
682
712
|
return _context7.stop();
|
|
683
713
|
}
|
|
684
714
|
}
|
|
685
|
-
}, _callee7, null, [[1,
|
|
715
|
+
}, _callee7, null, [[1, 6]]);
|
|
686
716
|
}));
|
|
687
717
|
|
|
688
718
|
return function saveDatasheets() {
|
|
@@ -691,49 +721,52 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
691
721
|
}();
|
|
692
722
|
|
|
693
723
|
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
694
|
-
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;
|
|
695
727
|
|
|
696
|
-
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, promiseArray;
|
|
697
728
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
698
729
|
while (1) {
|
|
699
730
|
switch (_context8.prev = _context8.next) {
|
|
700
731
|
case 0:
|
|
701
732
|
imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
|
|
702
|
-
imagesListTemp = imagesList.reduce(function (acc, image) {
|
|
703
|
-
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;
|
|
704
735
|
return acc;
|
|
705
736
|
}, {});
|
|
706
|
-
duplicated = imagesList.filter(function (image) {
|
|
707
|
-
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];
|
|
708
739
|
});
|
|
709
740
|
attrForImgs = Object.values(images === null || images === void 0 ? void 0 : images.attrForImgs);
|
|
710
741
|
attrForImgs.pop();
|
|
711
742
|
data = {
|
|
712
|
-
articleId:
|
|
713
|
-
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
|
+
|
|
714
747
|
return {
|
|
715
|
-
attrId: e[0]
|
|
716
|
-
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
|
|
717
750
|
};
|
|
718
751
|
}),
|
|
719
|
-
articleData: imagesList.filter(function (e) {
|
|
752
|
+
articleData: imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (e) {
|
|
720
753
|
return !e.id;
|
|
721
754
|
}),
|
|
722
|
-
updateImages: imagesList.filter(function (e) {
|
|
755
|
+
updateImages: imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (e) {
|
|
723
756
|
return e.id;
|
|
724
757
|
})
|
|
725
758
|
};
|
|
726
|
-
valid = data.articleData.length === 0 ? true : data.articleData.every(function (e, i) {
|
|
727
|
-
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) {
|
|
728
761
|
return true;
|
|
729
762
|
}
|
|
730
763
|
|
|
731
764
|
return false;
|
|
732
765
|
});
|
|
733
766
|
|
|
734
|
-
if (valid && data.updateImages.length > 0 && duplicated.length === 0) {
|
|
735
|
-
valid = data.updateImages.every(function (e, i) {
|
|
736
|
-
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) {
|
|
737
770
|
return true;
|
|
738
771
|
}
|
|
739
772
|
|
|
@@ -741,31 +774,31 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
741
774
|
});
|
|
742
775
|
}
|
|
743
776
|
|
|
744
|
-
if (!(valid && duplicated.length === 0)) {
|
|
777
|
+
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
745
778
|
_context8.next = 29;
|
|
746
779
|
break;
|
|
747
780
|
}
|
|
748
781
|
|
|
749
782
|
_context8.prev = 9;
|
|
750
|
-
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) {
|
|
751
784
|
e.uuid = (0, _uuid.v4)();
|
|
752
785
|
});
|
|
753
786
|
setDataImages(data);
|
|
754
787
|
|
|
755
|
-
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)) {
|
|
756
789
|
_context8.next = 21;
|
|
757
790
|
break;
|
|
758
791
|
}
|
|
759
792
|
|
|
760
793
|
setImagesUploaded(false);
|
|
761
794
|
promiseArray = [];
|
|
762
|
-
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) {
|
|
763
796
|
var file = Buffer.from(e.src.replace(/^data:image\/\w+;base64,/, ""), "base64");
|
|
764
797
|
var params = {
|
|
765
798
|
ACL: "public-read",
|
|
766
799
|
Body: file,
|
|
767
800
|
Bucket: S3_BUCKET,
|
|
768
|
-
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)
|
|
769
802
|
};
|
|
770
803
|
promiseArray.push(myBucket.putObject(params).promise());
|
|
771
804
|
});
|
|
@@ -795,14 +828,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
795
828
|
|
|
796
829
|
case 29:
|
|
797
830
|
// setMainLoading(false);
|
|
798
|
-
|
|
799
|
-
// ...prev,
|
|
800
|
-
// {
|
|
801
|
-
// titleMsg: "Completa los campos que solicita cada una de la imágenes",
|
|
802
|
-
// alertMsg:
|
|
803
|
-
// "Recuerda hay campos obligatorios y no podras avanzar si no estan completos.",
|
|
804
|
-
// },
|
|
805
|
-
// ]);
|
|
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.");
|
|
806
832
|
|
|
807
833
|
case 30:
|
|
808
834
|
case "end":
|
|
@@ -821,7 +847,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
821
847
|
break;
|
|
822
848
|
}
|
|
823
849
|
|
|
824
|
-
dataImages.articleData = dataImages.articleData.map(function (e) {
|
|
850
|
+
dataImages.articleData = dataImages === null || dataImages === void 0 ? void 0 : dataImages.articleData.map(function (e) {
|
|
825
851
|
delete e.src;
|
|
826
852
|
e.imageID = e.image_id;
|
|
827
853
|
e.packingType = e.packing_type;
|
|
@@ -837,7 +863,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
837
863
|
});
|
|
838
864
|
|
|
839
865
|
case 5:
|
|
840
|
-
|
|
866
|
+
setMessage("Imágenes guardadas con éxito");
|
|
841
867
|
_context9.next = 11;
|
|
842
868
|
break;
|
|
843
869
|
|
|
@@ -875,7 +901,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
875
901
|
}
|
|
876
902
|
|
|
877
903
|
concept = action ? action : concept;
|
|
878
|
-
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);
|
|
879
905
|
};
|
|
880
906
|
|
|
881
907
|
var getSectionIcon = function getSectionIcon() {
|
|
@@ -899,7 +925,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
899
925
|
|
|
900
926
|
var updateCompaniesList = function updateCompaniesList(status, result, retailerId, concept) {
|
|
901
927
|
var serv = servicesData.slice();
|
|
902
|
-
var item = serv.find(function (item) {
|
|
928
|
+
var item = serv === null || serv === void 0 ? void 0 : serv.find(function (item) {
|
|
903
929
|
return item.id_retailer === retailerId && item.service === concept;
|
|
904
930
|
});
|
|
905
931
|
var index = serv.indexOf(item);
|
|
@@ -1139,7 +1165,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1139
1165
|
|
|
1140
1166
|
var createComment = /*#__PURE__*/function () {
|
|
1141
1167
|
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(e, body, tab) {
|
|
1142
|
-
var _product$
|
|
1168
|
+
var _product$article2;
|
|
1143
1169
|
|
|
1144
1170
|
var concept, data;
|
|
1145
1171
|
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
@@ -1165,25 +1191,24 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1165
1191
|
|
|
1166
1192
|
case 10:
|
|
1167
1193
|
data = {
|
|
1168
|
-
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,
|
|
1169
1195
|
orderId: product === null || product === void 0 ? void 0 : product.orderId,
|
|
1170
1196
|
message: body,
|
|
1171
1197
|
concept: concept,
|
|
1172
1198
|
version: version
|
|
1173
1199
|
};
|
|
1174
|
-
|
|
1175
|
-
_context11.next = 14;
|
|
1200
|
+
_context11.next = 13;
|
|
1176
1201
|
return _axios.default.post("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1177
1202
|
headers: {
|
|
1178
1203
|
Authorization: token
|
|
1179
1204
|
}
|
|
1180
1205
|
});
|
|
1181
1206
|
|
|
1182
|
-
case
|
|
1183
|
-
_context11.next =
|
|
1207
|
+
case 13:
|
|
1208
|
+
_context11.next = 15;
|
|
1184
1209
|
return getComments(tab);
|
|
1185
1210
|
|
|
1186
|
-
case
|
|
1211
|
+
case 15:
|
|
1187
1212
|
case "end":
|
|
1188
1213
|
return _context11.stop();
|
|
1189
1214
|
}
|
|
@@ -1248,7 +1273,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1248
1273
|
|
|
1249
1274
|
var setAssignation = /*#__PURE__*/function () {
|
|
1250
1275
|
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(assignationType, assignationId) {
|
|
1251
|
-
var _product$
|
|
1276
|
+
var _product$article3;
|
|
1252
1277
|
|
|
1253
1278
|
var concept, productTemp, data;
|
|
1254
1279
|
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
@@ -1278,7 +1303,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1278
1303
|
data = (0, _defineProperty2.default)({
|
|
1279
1304
|
articleList: [{
|
|
1280
1305
|
orderId: product.orderId,
|
|
1281
|
-
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
|
|
1282
1307
|
}],
|
|
1283
1308
|
concept: concept
|
|
1284
1309
|
}, "".concat(assignationType, "Id"), assignationId);
|
|
@@ -1306,6 +1331,110 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1306
1331
|
};
|
|
1307
1332
|
}();
|
|
1308
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
|
+
|
|
1309
1438
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
1310
1439
|
headerTop: headerTop,
|
|
1311
1440
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
@@ -1327,7 +1456,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1327
1456
|
assignationsImages: assig["Imágenes"],
|
|
1328
1457
|
imagesStatus: productSelected === null || productSelected === void 0 ? void 0 : productSelected.images_status,
|
|
1329
1458
|
setAssignation: setAssignation,
|
|
1330
|
-
isRetailer: isRetailer
|
|
1459
|
+
isRetailer: isRetailer,
|
|
1460
|
+
onClickSave: function onClickSave() {
|
|
1461
|
+
return updateImages();
|
|
1462
|
+
}
|
|
1331
1463
|
})]
|
|
1332
1464
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1333
1465
|
className: "product-information",
|
|
@@ -1351,19 +1483,39 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1351
1483
|
})[0]) === null || _servicesData$filter$2 === void 0 ? void 0 : _servicesData$filter$2.status,
|
|
1352
1484
|
Imágenes: product === null || product === void 0 ? void 0 : product.images_status
|
|
1353
1485
|
},
|
|
1354
|
-
profileImage: productData.asigned,
|
|
1355
1486
|
activeTab: activeTab,
|
|
1356
1487
|
setActiveTab: setActiveTab,
|
|
1357
1488
|
setImageLayout: setImageLayout,
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
updateImages: updateImages,
|
|
1489
|
+
downloadImages: downloadImages,
|
|
1490
|
+
askToDeleteImages: askToDeleteImages,
|
|
1361
1491
|
assig: assig[activeTab],
|
|
1362
1492
|
setAssignation: setAssignation,
|
|
1363
|
-
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
|
+
}
|
|
1364
1512
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1365
1513
|
className: "services-information-container " + (imageLayout && activeTab === "Imágenes" ? "image-services" : ""),
|
|
1366
|
-
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) {
|
|
1367
1519
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
1368
1520
|
articleId: productSelected.article.id_article,
|
|
1369
1521
|
version: version,
|
|
@@ -1380,7 +1532,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1380
1532
|
inputGroup: descriptions[0],
|
|
1381
1533
|
updatedDescriptions: updatedDescriptions,
|
|
1382
1534
|
setUpdatedDescriptions: setUpdatedDescriptions,
|
|
1383
|
-
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,
|
|
1384
1536
|
version: version,
|
|
1385
1537
|
dinamicHeight: true
|
|
1386
1538
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
@@ -1397,9 +1549,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1397
1549
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
1398
1550
|
children: "no tienes este servicio"
|
|
1399
1551
|
}))]
|
|
1400
|
-
}), (userAssigned(activeTab, "especialist" || "facilitator") || auditorAssigned()) && /*#__PURE__*/(0, _jsxRuntime.
|
|
1552
|
+
}), (userAssigned(activeTab, "especialist" || "facilitator") || auditorAssigned()) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1401
1553
|
className: "commentary-box",
|
|
1402
|
-
children: !comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1554
|
+
children: [!comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1403
1555
|
className: "commentary",
|
|
1404
1556
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
|
|
1405
1557
|
label: "Caja de Comentario",
|
|
@@ -1408,21 +1560,15 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1408
1560
|
inputRows: 4,
|
|
1409
1561
|
inputId: "commentary-box",
|
|
1410
1562
|
index: 0
|
|
1411
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
1563
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1412
1564
|
className: "buttons-box",
|
|
1413
|
-
children:
|
|
1565
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1414
1566
|
buttonType: "general-transparent-button",
|
|
1415
1567
|
label: "Enviar comentario",
|
|
1416
1568
|
onClick: function onClick(e) {
|
|
1417
|
-
return createComment(e, document.
|
|
1569
|
+
return createComment(e, document.querySelector("#description-commentary-box-0 .ql-container .ql-editor > p").innerHTML, activeTab);
|
|
1418
1570
|
}
|
|
1419
|
-
})
|
|
1420
|
-
buttonType: requiredNull !== 0 || !specialistValid(activeTab) || !versionMatch() ? "general-button-disabled" : "general-green-button",
|
|
1421
|
-
label: "Enviar evaluación",
|
|
1422
|
-
onClick: function onClick() {
|
|
1423
|
-
return sendToFacilitator();
|
|
1424
|
-
}
|
|
1425
|
-
})]
|
|
1571
|
+
})
|
|
1426
1572
|
})]
|
|
1427
1573
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1428
1574
|
className: "feedback-box",
|
|
@@ -1447,7 +1593,13 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1447
1593
|
}, _callee15);
|
|
1448
1594
|
}))
|
|
1449
1595
|
})]
|
|
1450
|
-
})
|
|
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
|
+
})]
|
|
1451
1603
|
})]
|
|
1452
1604
|
})]
|
|
1453
1605
|
}), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImageModal.ProductImageModal, {
|
|
@@ -1455,6 +1607,13 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1455
1607
|
setShowModal: setShowModal,
|
|
1456
1608
|
sendToFacilitator: sendToFacilitator,
|
|
1457
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
|
+
}
|
|
1458
1617
|
})]
|
|
1459
1618
|
});
|
|
1460
1619
|
};
|