contentoh-components-library 9.0.0 → 12.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/.env.development +12 -10
- package/.env.production +2 -0
- package/dist/components/atoms/ActivedFilter/ActivedFilter.stories.js +7 -1
- package/dist/components/atoms/ActivedFilter/index.js +12 -4
- package/dist/components/atoms/AsignationOption/AsignationOptions.stories.js +7 -1
- package/dist/components/atoms/AsignationOption/index.js +29 -22
- package/dist/components/atoms/AsignationOption/styles.js +1 -1
- package/dist/components/atoms/AtomList/AtomList.stories.js +7 -1
- package/dist/components/atoms/AtomList/index.js +14 -9
- package/dist/components/atoms/Avatar/AsignationImage.stories.js +7 -1
- package/dist/components/atoms/Avatar/index.js +11 -8
- package/dist/components/atoms/Card/Card.stories.js +7 -1
- package/dist/components/atoms/Card/index.js +8 -4
- package/dist/components/atoms/CheckBox/CheckBox.stories.js +7 -1
- package/dist/components/atoms/CheckBox/index.js +16 -12
- package/dist/components/atoms/Commentary/index.js +10 -2
- package/dist/components/atoms/Commentary/styles.js +4 -1
- package/dist/components/atoms/CustomerTypeImage/CustomerTypeImage.stories.js +7 -1
- package/dist/components/atoms/CustomerTypeImage/index.js +8 -6
- package/dist/components/atoms/DropDownButton/DropDownButton.stories.js +7 -1
- package/dist/components/atoms/DropDownButton/index.js +9 -6
- package/dist/components/atoms/EditField/EditField.stories.js +7 -1
- package/dist/components/atoms/EditField/index.js +17 -10
- package/dist/components/atoms/FeatureTag/FeatureTag.stories.js +7 -1
- package/dist/components/atoms/FeatureTag/index.js +11 -5
- package/dist/components/atoms/GeneralButton/GeneralButton.stories.js +7 -1
- package/dist/components/atoms/GeneralButton/index.js +13 -7
- package/dist/components/atoms/GeneralInput/GeneralInput.stories.js +7 -1
- package/dist/components/atoms/GeneralInput/index.js +23 -20
- package/dist/components/atoms/GeneralTextBox/GeneralTextBox.stories.js +7 -1
- package/dist/components/atoms/GeneralTextBox/index.js +12 -7
- package/dist/components/atoms/GenericModal/GenericModal.stories.js +46 -59
- package/dist/components/atoms/GenericModal/index.js +12 -7
- package/dist/components/atoms/GradientPanel/GradientPanel.stories.js +85 -80
- package/dist/components/atoms/GradientPanel/index.js +11 -7
- package/dist/components/atoms/Graphic/Graphic.stories.js +7 -1
- package/dist/components/atoms/Graphic/index.js +9 -5
- package/dist/components/atoms/Input/index.js +14 -7
- package/dist/components/atoms/LabelToInput/index.js +19 -13
- package/dist/components/atoms/LoadImageMenu/LoadImageMenu.stories.js +7 -1
- package/dist/components/atoms/LoadImageMenu/index.js +33 -22
- package/dist/components/atoms/LogoImage/LogoImage.stories.js +7 -1
- package/dist/components/atoms/LogoImage/index.js +8 -6
- package/dist/components/atoms/MenuNotification/MenuNotification.stories.js +7 -1
- package/dist/components/atoms/MenuNotification/index.js +21 -15
- package/dist/components/atoms/MenuProfile/MenuProfile.stories.js +7 -1
- package/dist/components/atoms/MenuProfile/index.js +25 -15
- package/dist/components/atoms/Notification/Notification.stories.js +5 -1
- package/dist/components/atoms/Notification/index.js +15 -9
- package/dist/components/atoms/Percent/Percent.stories.js +7 -1
- package/dist/components/atoms/Percent/index.js +21 -14
- package/dist/components/atoms/PriorityFlag/PriorityFlag.stories.js +7 -1
- package/dist/components/atoms/PriorityFlag/index.js +8 -4
- package/dist/components/atoms/ProductImage/ProductImage.stories.js +7 -1
- package/dist/components/atoms/ProductImage/index.js +11 -8
- package/dist/components/atoms/ProgressBar/ProgressBar.stories.js +7 -1
- package/dist/components/atoms/ProgressBar/index.js +8 -3
- package/dist/components/atoms/ScreenHeader/ScreenHeader.stories.js +7 -1
- package/dist/components/atoms/ScreenHeader/index.js +9 -3
- package/dist/components/atoms/Select/index.js +25 -20
- package/dist/components/atoms/SideMenuButton/SideMenuButton.stories.js +5 -1
- package/dist/components/atoms/SideMenuButton/index.js +10 -4
- package/dist/components/atoms/StatusTag/StatusTag.stories.js +7 -1
- package/dist/components/atoms/StatusTag/index.js +8 -3
- package/dist/components/atoms/TabSection/TabSection.stories.js +7 -1
- package/dist/components/atoms/TabSection/index.js +8 -3
- package/dist/components/atoms/ValidationPanel/ValidationPanel.stories.js +7 -1
- package/dist/components/atoms/ValidationPanel/index.js +39 -27
- package/dist/components/molecules/AddProvidersAndProducts/AddProvidersAndProducts.stories.js +5 -1
- package/dist/components/molecules/AddProvidersAndProducts/index.js +18 -12
- package/dist/components/molecules/AssignedWork/AssignedWork.stories.js +5 -1
- package/dist/components/molecules/AssignedWork/index.js +36 -30
- package/dist/components/molecules/AvatarAndValidation/AvatarAndValidation.stories.js +7 -1
- package/dist/components/molecules/AvatarAndValidation/index.js +22 -17
- package/dist/components/molecules/EditionActiveImage/EditionActiveImage.stories.js +7 -1
- package/dist/components/molecules/EditionActiveImage/index.js +14 -10
- package/dist/components/molecules/FeaturesBar/FeaturesBar.stories.js +7 -1
- package/dist/components/molecules/FeaturesBar/index.js +11 -9
- package/dist/components/molecules/GalleryElement/GalleryElement.stories.js +7 -1
- package/dist/components/molecules/GalleryElement/index.js +69 -55
- package/dist/components/molecules/GalleryHeader/GalleryHeader.stories.js +7 -1
- package/dist/components/molecules/GalleryHeader/index.js +28 -15
- package/dist/components/molecules/HeaderTop/HeaderTop.stories.js +7 -1
- package/dist/components/molecules/HeaderTop/index.js +10 -7
- package/dist/components/molecules/ImageSelector/ImageSelector.stories.js +7 -1
- package/dist/components/molecules/ImageSelector/index.js +15 -13
- package/dist/components/molecules/ParentComponent/ParentComponent.stories.js +10 -2
- package/dist/components/molecules/ParentComponent/index.js +9 -5
- package/dist/components/molecules/PayMethod/PayMethod.stories.js +7 -1
- package/dist/components/molecules/PayMethod/index.js +38 -33
- package/dist/components/molecules/PlanSelection/PlanSelection.stories.js +7 -1
- package/dist/components/molecules/PlanSelection/index.js +14 -11
- package/dist/components/molecules/ProductNameHeader/ProductNameHeader.stories.js +7 -1
- package/dist/components/molecules/ProductNameHeader/index.js +18 -14
- package/dist/components/molecules/ProductNotification/ProductNotification.stories.js +7 -1
- package/dist/components/molecules/ProductNotification/index.js +12 -9
- package/dist/components/molecules/ProfileHeader/ProfileHeader.stories.js +5 -1
- package/dist/components/molecules/ProfileHeader/index.js +21 -15
- package/dist/components/molecules/RetailerSelector/RetailerSelector.stories.js +7 -1
- package/dist/components/molecules/RetailerSelector/index.js +27 -24
- package/dist/components/molecules/SidebarNotification/SidebarNotification.stories.js +5 -1
- package/dist/components/molecules/SidebarNotification/index.js +43 -37
- package/dist/components/molecules/StatusAsignationInfo/StatusAsignationInfo.stories.js +7 -1
- package/dist/components/molecules/StatusAsignationInfo/index.js +115 -88
- package/dist/components/molecules/StatusAsignationInfo/styles.js +1 -1
- package/dist/components/molecules/TableHeader/TableHeader.stories.js +7 -1
- package/dist/components/molecules/TableHeader/index.js +17 -9
- package/dist/components/molecules/TableRow/TableRow.stories.js +7 -1
- package/dist/components/molecules/TableRow/index.js +11 -7
- package/dist/components/molecules/TabsMenu/TabsMenu.stories.js +7 -1
- package/dist/components/molecules/TabsMenu/index.js +13 -10
- package/dist/components/molecules/TagAndInput/TagAndInput.stories.js +7 -1
- package/dist/components/molecules/TagAndInput/index.js +24 -22
- package/dist/components/organisms/FullProductNameHeader/FullProductNameHeader.stories.js +7 -1
- package/dist/components/organisms/FullProductNameHeader/index.js +35 -30
- package/dist/components/organisms/FullTabsMenu/FullTabsMenu.stories.js +7 -1
- package/dist/components/organisms/FullTabsMenu/index.js +26 -19
- package/dist/components/organisms/Fullplan/FullPlan.stories.js +7 -1
- package/dist/components/organisms/Fullplan/index.js +23 -15
- package/dist/components/organisms/ImageDataTable/ImageDataTable.stories.js +7 -1
- package/dist/components/organisms/ImageDataTable/index.js +79 -62
- package/dist/components/organisms/ImagePreviewer/ImagePreviewer.stories.js +7 -1
- package/dist/components/organisms/ImagePreviewer/index.js +12 -8
- package/dist/components/organisms/ImagesGroup/index.js +5 -1
- package/dist/components/organisms/InputGroup/InputGroup.stories.js +7 -1
- package/dist/components/organisms/InputGroup/index.js +39 -37
- package/dist/components/organisms/ProductImageModal/ProductImageModal.stories.js +7 -1
- package/dist/components/organisms/ProductImageModal/index.js +49 -43
- package/dist/components/pages/CustomerLogin/CustomerLogin.stories.js +52 -47
- package/dist/components/pages/CustomerLogin/index.js +18 -12
- package/dist/components/pages/CustomerPayMethod/CustomerPayMethod.stories.js +36 -28
- package/dist/components/pages/CustomerPayMethod/index.js +18 -12
- package/dist/components/pages/CustomerType/CustomerType.stories.js +21 -22
- package/dist/components/pages/CustomerType/index.js +18 -12
- package/dist/components/pages/OnboardPlan/OnboardPlan.stories.js +12 -9
- package/dist/components/pages/OnboardPlan/index.js +18 -12
- package/dist/components/pages/RetailerPlan/RetailerPlan.stories.js +13 -10
- package/dist/components/pages/RetailerPlan/index.js +18 -12
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +8 -1
- package/dist/components/pages/RetailerProductEdition/index.js +538 -244
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/global-files/data.js +51 -4
- package/package.json +8 -1
- package/src/components/atoms/AsignationOption/index.js +1 -1
- package/src/components/atoms/AsignationOption/styles.js +6 -0
- package/src/components/atoms/Commentary/index.js +2 -2
- package/src/components/atoms/Commentary/styles.js +1 -0
- package/src/components/atoms/GeneralButton/index.js +1 -0
- package/src/components/atoms/GeneralInput/index.js +12 -6
- package/src/components/molecules/StatusAsignationInfo/index.js +38 -24
- package/src/components/molecules/StatusAsignationInfo/styles.js +8 -2
- package/src/components/molecules/TableHeader/index.js +9 -1
- package/src/components/organisms/FullTabsMenu/index.js +6 -3
- package/src/components/organisms/ImageDataTable/index.js +4 -0
- package/src/components/organisms/ProductImageModal/index.js +0 -4
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +2 -0
- package/src/components/pages/RetailerProductEdition/index.js +194 -54
- package/src/components/pages/RetailerProductEdition/styles.js +4 -0
- package/src/global-files/data.js +29 -2
|
@@ -9,6 +9,8 @@ exports.RetailerProductEdition = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
13
|
+
|
|
12
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
13
15
|
|
|
14
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
@@ -35,7 +37,7 @@ var _react = require("react");
|
|
|
35
37
|
|
|
36
38
|
var _GalleryElement = require("../../molecules/GalleryElement");
|
|
37
39
|
|
|
38
|
-
var
|
|
40
|
+
var _data2 = require("../../../global-files/data");
|
|
39
41
|
|
|
40
42
|
var _GalleryHeader = require("../../molecules/GalleryHeader");
|
|
41
43
|
|
|
@@ -61,6 +63,8 @@ var _GeneralButton = require("../../atoms/GeneralButton");
|
|
|
61
63
|
|
|
62
64
|
var _Commentary = require("../../atoms/Commentary");
|
|
63
65
|
|
|
66
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
67
|
+
|
|
64
68
|
var reducerImages = function reducerImages(state, action) {
|
|
65
69
|
var values = state.values,
|
|
66
70
|
attrForImgs = state.attrForImgs;
|
|
@@ -117,7 +121,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
117
121
|
_ref$productSelected = _ref.productSelected,
|
|
118
122
|
productSelected = _ref$productSelected === void 0 ? {} : _ref$productSelected,
|
|
119
123
|
_ref$user = _ref.user,
|
|
120
|
-
user = _ref$user === void 0 ? {} : _ref$user
|
|
124
|
+
user = _ref$user === void 0 ? {} : _ref$user,
|
|
125
|
+
token = _ref.token;
|
|
121
126
|
|
|
122
127
|
var _useState = (0, _react.useState)("Descripción"),
|
|
123
128
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -297,10 +302,32 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
297
302
|
comments = _useState44[0],
|
|
298
303
|
setComments = _useState44[1];
|
|
299
304
|
|
|
300
|
-
var _useState45 = (0, _react.useState)(
|
|
305
|
+
var _useState45 = (0, _react.useState)(""),
|
|
301
306
|
_useState46 = (0, _slicedToArray2.default)(_useState45, 2),
|
|
302
|
-
|
|
303
|
-
|
|
307
|
+
comment = _useState46[0],
|
|
308
|
+
setComment = _useState46[1];
|
|
309
|
+
|
|
310
|
+
var _useState47 = (0, _react.useState)(0),
|
|
311
|
+
_useState48 = (0, _slicedToArray2.default)(_useState47, 2),
|
|
312
|
+
requiredNull = _useState48[0],
|
|
313
|
+
setRequiredNull = _useState48[1];
|
|
314
|
+
|
|
315
|
+
var _useState49 = (0, _react.useState)(false),
|
|
316
|
+
_useState50 = (0, _slicedToArray2.default)(_useState49, 2),
|
|
317
|
+
crossComment = _useState50[0],
|
|
318
|
+
setCrossComment = _useState50[1];
|
|
319
|
+
|
|
320
|
+
var _useState51 = (0, _react.useState)([]),
|
|
321
|
+
_useState52 = (0, _slicedToArray2.default)(_useState51, 2),
|
|
322
|
+
userGroups = _useState52[0],
|
|
323
|
+
setUserGroups = _useState52[1];
|
|
324
|
+
|
|
325
|
+
var _useState53 = (0, _react.useState)({}),
|
|
326
|
+
_useState54 = (0, _slicedToArray2.default)(_useState53, 2),
|
|
327
|
+
assig = _useState54[0],
|
|
328
|
+
setAssig = _useState54[1];
|
|
329
|
+
|
|
330
|
+
var isRetailer = user === null || user === void 0 ? void 0 : user.is_retailer;
|
|
304
331
|
|
|
305
332
|
var loadData = /*#__PURE__*/function () {
|
|
306
333
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
@@ -312,12 +339,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
312
339
|
switch (_context2.prev = _context2.next) {
|
|
313
340
|
case 0:
|
|
314
341
|
_context2.next = 2;
|
|
315
|
-
return (0,
|
|
342
|
+
return (0, _data2.getRetailerServices)(productSelected.article.id_article, parseInt(productSelected.article.id_category), productSelected.version);
|
|
316
343
|
|
|
317
344
|
case 2:
|
|
318
345
|
services = _context2.sent;
|
|
319
|
-
|
|
320
|
-
|
|
346
|
+
//Converts the data inside the datasheets object to array
|
|
321
347
|
setServices(services);
|
|
322
348
|
setActiveRetailer(productSelected === null || productSelected === void 0 ? void 0 : productSelected.retailers[0]);
|
|
323
349
|
setImages({
|
|
@@ -327,7 +353,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
327
353
|
if (((_services$ = services[2]) === null || _services$ === void 0 ? void 0 : (_services$$values = _services$.values) === null || _services$$values === void 0 ? void 0 : _services$$values.length) > 0) setActiveImage(0);
|
|
328
354
|
setProduct(productSelected);
|
|
329
355
|
|
|
330
|
-
case
|
|
356
|
+
case 8:
|
|
331
357
|
case "end":
|
|
332
358
|
return _context2.stop();
|
|
333
359
|
}
|
|
@@ -391,7 +417,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
391
417
|
var translation = "";
|
|
392
418
|
|
|
393
419
|
if (concept === "datasheet") {
|
|
394
|
-
translation = "Ficha
|
|
420
|
+
translation = "Ficha técnica";
|
|
395
421
|
} else if (concept === "description") {
|
|
396
422
|
translation = "Descripción";
|
|
397
423
|
} else if (concept === "images") {
|
|
@@ -402,29 +428,33 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
402
428
|
};
|
|
403
429
|
|
|
404
430
|
var getComments = /*#__PURE__*/function () {
|
|
405
|
-
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(
|
|
431
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
406
432
|
var _productSelected$arti, _productSelected$arti2, _productSelected$arti3;
|
|
407
433
|
|
|
408
|
-
var
|
|
434
|
+
var tab,
|
|
435
|
+
commentsResponse,
|
|
436
|
+
comments,
|
|
437
|
+
_args4 = arguments;
|
|
409
438
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
410
439
|
while (1) {
|
|
411
440
|
switch (_context4.prev = _context4.next) {
|
|
412
441
|
case 0:
|
|
413
|
-
|
|
442
|
+
tab = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : "Descripción";
|
|
443
|
+
_context4.next = 3;
|
|
414
444
|
return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti = productSelected.article) === null || _productSelected$arti === void 0 ? void 0 : _productSelected$arti.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$arti2 = productSelected.article) === null || _productSelected$arti2 === void 0 ? void 0 : _productSelected$arti2.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$arti3 = productSelected.article) === null || _productSelected$arti3 === void 0 ? void 0 : _productSelected$arti3.id_article, "&concept=images&orderIdColab=").concat(productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId, "&version=").concat(version))]);
|
|
415
445
|
|
|
416
|
-
case
|
|
446
|
+
case 3:
|
|
417
447
|
commentsResponse = _context4.sent;
|
|
418
448
|
comments = {};
|
|
419
|
-
commentsResponse.
|
|
449
|
+
commentsResponse.forEach(function (comment) {
|
|
420
450
|
var _JSON$parse$data$;
|
|
421
451
|
|
|
422
452
|
return JSON.parse(comment.data.body).data[0] && (comments[translateConcept((_JSON$parse$data$ = JSON.parse(comment.data.body).data[0]) === null || _JSON$parse$data$ === void 0 ? void 0 : _JSON$parse$data$.concept)] = JSON.parse(comment.data.body).data[0]);
|
|
423
453
|
});
|
|
424
|
-
|
|
425
|
-
|
|
454
|
+
setComment(comments[tab]);
|
|
455
|
+
setComments(comments);
|
|
426
456
|
|
|
427
|
-
case
|
|
457
|
+
case 8:
|
|
428
458
|
case "end":
|
|
429
459
|
return _context4.stop();
|
|
430
460
|
}
|
|
@@ -432,21 +462,89 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
432
462
|
}, _callee4);
|
|
433
463
|
}));
|
|
434
464
|
|
|
435
|
-
return function getComments(
|
|
465
|
+
return function getComments() {
|
|
436
466
|
return _ref5.apply(this, arguments);
|
|
437
467
|
};
|
|
438
468
|
}();
|
|
439
469
|
|
|
440
|
-
(0, _react.useEffect)(function () {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
470
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
471
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
472
|
+
while (1) {
|
|
473
|
+
switch (_context5.prev = _context5.next) {
|
|
474
|
+
case 0:
|
|
475
|
+
loadData();
|
|
476
|
+
(0, _data2.getPercentage)({
|
|
477
|
+
data: [productSelected]
|
|
478
|
+
}).then(function (res) {
|
|
479
|
+
return setPercentages(res);
|
|
480
|
+
});
|
|
481
|
+
getServices();
|
|
482
|
+
getComments();
|
|
483
|
+
_context5.t0 = setUserGroups;
|
|
484
|
+
_context5.next = 7;
|
|
485
|
+
return (0, _data2.fetchUsers)(token);
|
|
486
|
+
|
|
487
|
+
case 7:
|
|
488
|
+
_context5.t1 = _context5.sent;
|
|
489
|
+
(0, _context5.t0)(_context5.t1);
|
|
490
|
+
|
|
491
|
+
case 9:
|
|
492
|
+
case "end":
|
|
493
|
+
return _context5.stop();
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}, _callee5);
|
|
497
|
+
})), []);
|
|
498
|
+
|
|
499
|
+
var loadAssignations = function loadAssignations(currentProduct) {
|
|
500
|
+
var _currentProduct$artic, _currentProduct$artic2, _currentProduct$artic3, _currentProduct$artic4, _currentProduct$artic5, _currentProduct$artic6;
|
|
501
|
+
|
|
502
|
+
setAssig({
|
|
503
|
+
Descripción: {
|
|
504
|
+
assignations: [{
|
|
505
|
+
collaboratorType: "especialist",
|
|
506
|
+
id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic = currentProduct.article) === null || _currentProduct$artic === void 0 ? void 0 : _currentProduct$artic.id_description_especialist
|
|
507
|
+
}, {
|
|
508
|
+
collaboratorType: "facilitator",
|
|
509
|
+
id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic2 = currentProduct.article) === null || _currentProduct$artic2 === void 0 ? void 0 : _currentProduct$artic2.id_description_facilitator
|
|
510
|
+
}],
|
|
511
|
+
collaborators: {
|
|
512
|
+
especialist: userGroups[0] || [],
|
|
513
|
+
facilitator: userGroups[2] || []
|
|
514
|
+
}
|
|
515
|
+
},
|
|
516
|
+
"Ficha técnica": {
|
|
517
|
+
assignations: [{
|
|
518
|
+
collaboratorType: "especialist",
|
|
519
|
+
id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic3 = currentProduct.article) === null || _currentProduct$artic3 === void 0 ? void 0 : _currentProduct$artic3.id_datasheet_especialist
|
|
520
|
+
}, {
|
|
521
|
+
collaboratorType: "facilitator",
|
|
522
|
+
id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic4 = currentProduct.article) === null || _currentProduct$artic4 === void 0 ? void 0 : _currentProduct$artic4.id_datasheet_facilitator
|
|
523
|
+
}],
|
|
524
|
+
collaborators: {
|
|
525
|
+
especialist: userGroups[0] || [],
|
|
526
|
+
facilitator: userGroups[2] || []
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
Imágenes: {
|
|
530
|
+
assignations: [{
|
|
531
|
+
collaboratorType: "especialist",
|
|
532
|
+
id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic5 = currentProduct.article) === null || _currentProduct$artic5 === void 0 ? void 0 : _currentProduct$artic5.id_images_especialist
|
|
533
|
+
}, {
|
|
534
|
+
collaboratorType: "facilitator",
|
|
535
|
+
id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic6 = currentProduct.article) === null || _currentProduct$artic6 === void 0 ? void 0 : _currentProduct$artic6.id_images_facilitator
|
|
536
|
+
}],
|
|
537
|
+
collaborators: {
|
|
538
|
+
especialist: userGroups[1] || [],
|
|
539
|
+
facilitator: userGroups[3] || []
|
|
540
|
+
}
|
|
541
|
+
}
|
|
446
542
|
});
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
(0, _react.useEffect)(function () {
|
|
546
|
+
loadAssignations(productSelected);
|
|
547
|
+
}, [userGroups]);
|
|
450
548
|
(0, _react.useEffect)(function () {
|
|
451
549
|
var _productSelected$reta;
|
|
452
550
|
|
|
@@ -492,8 +590,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
492
590
|
};
|
|
493
591
|
});
|
|
494
592
|
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) {
|
|
495
|
-
return /*#__PURE__*/
|
|
496
|
-
key: index,
|
|
593
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryElement.GalleryElement, {
|
|
497
594
|
image: image,
|
|
498
595
|
gridLayout: imageLayout,
|
|
499
596
|
id: "gallery-element-" + index,
|
|
@@ -502,104 +599,104 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
502
599
|
imagePackagingType: imagePackagingType,
|
|
503
600
|
imageInputs: imageInputs,
|
|
504
601
|
changeImage: setImages
|
|
505
|
-
});
|
|
602
|
+
}, index);
|
|
506
603
|
});
|
|
507
604
|
};
|
|
508
605
|
|
|
509
606
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
510
|
-
var
|
|
607
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
511
608
|
var _productSelected$arti4;
|
|
512
609
|
|
|
513
610
|
var dataObject;
|
|
514
|
-
return _regenerator.default.wrap(function
|
|
611
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
515
612
|
while (1) {
|
|
516
|
-
switch (
|
|
613
|
+
switch (_context6.prev = _context6.next) {
|
|
517
614
|
case 0:
|
|
518
615
|
dataObject = {
|
|
519
616
|
articleId: productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti4 = productSelected.article) === null || _productSelected$arti4 === void 0 ? void 0 : _productSelected$arti4.id_article,
|
|
520
617
|
articleData: updatedDescriptions
|
|
521
618
|
};
|
|
522
|
-
|
|
523
|
-
|
|
619
|
+
_context6.prev = 1;
|
|
620
|
+
_context6.next = 4;
|
|
524
621
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
525
622
|
headers: {
|
|
526
|
-
Authorization:
|
|
623
|
+
Authorization: token
|
|
527
624
|
}
|
|
528
625
|
});
|
|
529
626
|
|
|
530
627
|
case 4:
|
|
531
|
-
|
|
628
|
+
_context6.next = 9;
|
|
532
629
|
break;
|
|
533
630
|
|
|
534
631
|
case 6:
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
console.log(
|
|
632
|
+
_context6.prev = 6;
|
|
633
|
+
_context6.t0 = _context6["catch"](1);
|
|
634
|
+
console.log(_context6.t0);
|
|
538
635
|
|
|
539
636
|
case 9:
|
|
540
637
|
case "end":
|
|
541
|
-
return
|
|
638
|
+
return _context6.stop();
|
|
542
639
|
}
|
|
543
640
|
}
|
|
544
|
-
},
|
|
641
|
+
}, _callee6, null, [[1, 6]]);
|
|
545
642
|
}));
|
|
546
643
|
|
|
547
644
|
return function saveDescriptions() {
|
|
548
|
-
return
|
|
645
|
+
return _ref7.apply(this, arguments);
|
|
549
646
|
};
|
|
550
647
|
}();
|
|
551
648
|
|
|
552
649
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
553
|
-
var
|
|
650
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
554
651
|
var _productSelected$arti5;
|
|
555
652
|
|
|
556
653
|
var dataObject;
|
|
557
|
-
return _regenerator.default.wrap(function
|
|
654
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
558
655
|
while (1) {
|
|
559
|
-
switch (
|
|
656
|
+
switch (_context7.prev = _context7.next) {
|
|
560
657
|
case 0:
|
|
561
658
|
dataObject = {
|
|
562
659
|
articleId: productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti5 = productSelected.article) === null || _productSelected$arti5 === void 0 ? void 0 : _productSelected$arti5.id_article,
|
|
563
660
|
articleData: updatedDatasheets
|
|
564
661
|
};
|
|
565
|
-
|
|
566
|
-
|
|
662
|
+
_context7.prev = 1;
|
|
663
|
+
_context7.next = 4;
|
|
567
664
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
568
665
|
headers: {
|
|
569
|
-
Authorization:
|
|
666
|
+
Authorization: token
|
|
570
667
|
}
|
|
571
668
|
});
|
|
572
669
|
|
|
573
670
|
case 4:
|
|
574
671
|
console.log("saved");
|
|
575
|
-
|
|
672
|
+
_context7.next = 10;
|
|
576
673
|
break;
|
|
577
674
|
|
|
578
675
|
case 7:
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
console.log(
|
|
676
|
+
_context7.prev = 7;
|
|
677
|
+
_context7.t0 = _context7["catch"](1);
|
|
678
|
+
console.log(_context7.t0);
|
|
582
679
|
|
|
583
680
|
case 10:
|
|
584
681
|
case "end":
|
|
585
|
-
return
|
|
682
|
+
return _context7.stop();
|
|
586
683
|
}
|
|
587
684
|
}
|
|
588
|
-
},
|
|
685
|
+
}, _callee7, null, [[1, 7]]);
|
|
589
686
|
}));
|
|
590
687
|
|
|
591
688
|
return function saveDatasheets() {
|
|
592
|
-
return
|
|
689
|
+
return _ref8.apply(this, arguments);
|
|
593
690
|
};
|
|
594
691
|
}();
|
|
595
692
|
|
|
596
|
-
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
693
|
+
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
597
694
|
var _images$values2;
|
|
598
695
|
|
|
599
696
|
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, promiseArray;
|
|
600
|
-
return _regenerator.default.wrap(function
|
|
697
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
601
698
|
while (1) {
|
|
602
|
-
switch (
|
|
699
|
+
switch (_context8.prev = _context8.next) {
|
|
603
700
|
case 0:
|
|
604
701
|
imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
|
|
605
702
|
imagesListTemp = imagesList.reduce(function (acc, image) {
|
|
@@ -645,18 +742,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
645
742
|
}
|
|
646
743
|
|
|
647
744
|
if (!(valid && duplicated.length === 0)) {
|
|
648
|
-
|
|
745
|
+
_context8.next = 29;
|
|
649
746
|
break;
|
|
650
747
|
}
|
|
651
748
|
|
|
652
|
-
|
|
749
|
+
_context8.prev = 9;
|
|
653
750
|
data.articleData.forEach(function (e) {
|
|
654
751
|
e.uuid = (0, _uuid.v4)();
|
|
655
752
|
});
|
|
656
753
|
setDataImages(data);
|
|
657
754
|
|
|
658
755
|
if (!(data.articleData.length > 0)) {
|
|
659
|
-
|
|
756
|
+
_context8.next = 21;
|
|
660
757
|
break;
|
|
661
758
|
}
|
|
662
759
|
|
|
@@ -672,28 +769,28 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
672
769
|
};
|
|
673
770
|
promiseArray.push(myBucket.putObject(params).promise());
|
|
674
771
|
});
|
|
675
|
-
|
|
772
|
+
_context8.next = 18;
|
|
676
773
|
return Promise.all(promiseArray);
|
|
677
774
|
|
|
678
775
|
case 18:
|
|
679
776
|
setImagesUploaded(true);
|
|
680
|
-
|
|
777
|
+
_context8.next = 22;
|
|
681
778
|
break;
|
|
682
779
|
|
|
683
780
|
case 21:
|
|
684
781
|
setImagesUploaded(true);
|
|
685
782
|
|
|
686
783
|
case 22:
|
|
687
|
-
|
|
784
|
+
_context8.next = 27;
|
|
688
785
|
break;
|
|
689
786
|
|
|
690
787
|
case 24:
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
console.log(
|
|
788
|
+
_context8.prev = 24;
|
|
789
|
+
_context8.t0 = _context8["catch"](9);
|
|
790
|
+
console.log(_context8.t0); // setMainLoading(false);
|
|
694
791
|
|
|
695
792
|
case 27:
|
|
696
|
-
|
|
793
|
+
_context8.next = 30;
|
|
697
794
|
break;
|
|
698
795
|
|
|
699
796
|
case 29:
|
|
@@ -709,18 +806,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
709
806
|
|
|
710
807
|
case 30:
|
|
711
808
|
case "end":
|
|
712
|
-
return
|
|
809
|
+
return _context8.stop();
|
|
713
810
|
}
|
|
714
811
|
}
|
|
715
|
-
},
|
|
812
|
+
}, _callee8, null, [[9, 24]]);
|
|
716
813
|
})), [images, imagesUploaded]);
|
|
717
|
-
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
718
|
-
return _regenerator.default.wrap(function
|
|
814
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
815
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
719
816
|
while (1) {
|
|
720
|
-
switch (
|
|
817
|
+
switch (_context9.prev = _context9.next) {
|
|
721
818
|
case 0:
|
|
722
819
|
if (!imagesUploaded) {
|
|
723
|
-
|
|
820
|
+
_context9.next = 11;
|
|
724
821
|
break;
|
|
725
822
|
}
|
|
726
823
|
|
|
@@ -731,30 +828,30 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
731
828
|
e.imageType = e.image_type;
|
|
732
829
|
return e;
|
|
733
830
|
});
|
|
734
|
-
|
|
735
|
-
|
|
831
|
+
_context9.prev = 2;
|
|
832
|
+
_context9.next = 5;
|
|
736
833
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
|
|
737
834
|
headers: {
|
|
738
|
-
Authorization:
|
|
835
|
+
Authorization: token
|
|
739
836
|
}
|
|
740
837
|
});
|
|
741
838
|
|
|
742
839
|
case 5:
|
|
743
840
|
console.log("imágenes guardadas con éxito");
|
|
744
|
-
|
|
841
|
+
_context9.next = 11;
|
|
745
842
|
break;
|
|
746
843
|
|
|
747
844
|
case 8:
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
console.log(
|
|
845
|
+
_context9.prev = 8;
|
|
846
|
+
_context9.t0 = _context9["catch"](2);
|
|
847
|
+
console.log(_context9.t0);
|
|
751
848
|
|
|
752
849
|
case 11:
|
|
753
850
|
case "end":
|
|
754
|
-
return
|
|
851
|
+
return _context9.stop();
|
|
755
852
|
}
|
|
756
853
|
}
|
|
757
|
-
},
|
|
854
|
+
}, _callee9, null, [[2, 8]]);
|
|
758
855
|
})), [dataImages, imagesUploaded]);
|
|
759
856
|
|
|
760
857
|
var approveRejectButtons = function approveRejectButtons(action) {
|
|
@@ -857,41 +954,39 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
857
954
|
serv[index].status = "RA";
|
|
858
955
|
}
|
|
859
956
|
}
|
|
860
|
-
}
|
|
861
|
-
|
|
957
|
+
}
|
|
862
958
|
|
|
863
959
|
setServicesData(serv);
|
|
864
960
|
};
|
|
865
961
|
|
|
866
962
|
var sendToFacilitator = /*#__PURE__*/function () {
|
|
867
|
-
var
|
|
963
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(result) {
|
|
868
964
|
var concept, evalStatus, productTemp, specialistDone, data;
|
|
869
|
-
return _regenerator.default.wrap(function
|
|
965
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
870
966
|
while (1) {
|
|
871
|
-
switch (
|
|
967
|
+
switch (_context10.prev = _context10.next) {
|
|
872
968
|
case 0:
|
|
873
|
-
console.log("exce");
|
|
874
969
|
concept = "";
|
|
875
|
-
|
|
876
|
-
|
|
970
|
+
_context10.t0 = activeTab;
|
|
971
|
+
_context10.next = _context10.t0 === "Descripción" ? 4 : _context10.t0 === "Ficha técnica" ? 6 : _context10.t0 === "Imágenes" ? 8 : 10;
|
|
877
972
|
break;
|
|
878
973
|
|
|
879
|
-
case
|
|
974
|
+
case 4:
|
|
880
975
|
concept = "description";
|
|
881
|
-
return
|
|
976
|
+
return _context10.abrupt("break", 11);
|
|
882
977
|
|
|
883
|
-
case
|
|
978
|
+
case 6:
|
|
884
979
|
concept = "datasheet";
|
|
885
|
-
return
|
|
980
|
+
return _context10.abrupt("break", 11);
|
|
886
981
|
|
|
887
|
-
case
|
|
982
|
+
case 8:
|
|
888
983
|
concept = "images";
|
|
889
|
-
return
|
|
984
|
+
return _context10.abrupt("break", 11);
|
|
890
985
|
|
|
891
|
-
case
|
|
892
|
-
return
|
|
986
|
+
case 10:
|
|
987
|
+
return _context10.abrupt("break", 11);
|
|
893
988
|
|
|
894
|
-
case
|
|
989
|
+
case 11:
|
|
895
990
|
evalStatus = "";
|
|
896
991
|
productTemp = (0, _objectSpread2.default)({}, productSelected);
|
|
897
992
|
evalStatus = productSelected["".concat(concept, "_status")];
|
|
@@ -918,7 +1013,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
918
1013
|
data = {};
|
|
919
1014
|
|
|
920
1015
|
if (!result) {
|
|
921
|
-
|
|
1016
|
+
_context10.next = 24;
|
|
922
1017
|
break;
|
|
923
1018
|
}
|
|
924
1019
|
|
|
@@ -931,18 +1026,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
931
1026
|
evalStatus: evalStatus,
|
|
932
1027
|
retailerId: activeRetailer.id
|
|
933
1028
|
};
|
|
934
|
-
|
|
1029
|
+
_context10.next = 22;
|
|
935
1030
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
936
1031
|
headers: {
|
|
937
|
-
Authorization:
|
|
1032
|
+
Authorization: token
|
|
938
1033
|
}
|
|
939
1034
|
});
|
|
940
1035
|
|
|
941
|
-
case
|
|
942
|
-
|
|
1036
|
+
case 22:
|
|
1037
|
+
_context10.next = 37;
|
|
943
1038
|
break;
|
|
944
1039
|
|
|
945
|
-
case
|
|
1040
|
+
case 24:
|
|
946
1041
|
if (specialistDone) {
|
|
947
1042
|
updateCompaniesList(evalStatus, result, activeRetailer.id);
|
|
948
1043
|
}
|
|
@@ -954,41 +1049,41 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
954
1049
|
evalStatus: evalStatus,
|
|
955
1050
|
retailerId: activeRetailer.id
|
|
956
1051
|
};
|
|
957
|
-
|
|
958
|
-
|
|
1052
|
+
_context10.t1 = user.id_role;
|
|
1053
|
+
_context10.next = _context10.t1 === 7 ? 29 : _context10.t1 === 8 ? 29 : _context10.t1 === 4 ? 31 : _context10.t1 === 5 ? 31 : 33;
|
|
959
1054
|
break;
|
|
960
1055
|
|
|
961
|
-
case
|
|
1056
|
+
case 29:
|
|
962
1057
|
data.especialist = true;
|
|
963
|
-
return
|
|
1058
|
+
return _context10.abrupt("break", 34);
|
|
964
1059
|
|
|
965
|
-
case
|
|
1060
|
+
case 31:
|
|
966
1061
|
data.facilitator = true;
|
|
967
|
-
return
|
|
1062
|
+
return _context10.abrupt("break", 34);
|
|
968
1063
|
|
|
969
|
-
case
|
|
970
|
-
return
|
|
1064
|
+
case 33:
|
|
1065
|
+
return _context10.abrupt("break", 34);
|
|
971
1066
|
|
|
972
|
-
case
|
|
1067
|
+
case 34:
|
|
973
1068
|
_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
974
1069
|
headers: {
|
|
975
|
-
Authorization:
|
|
1070
|
+
Authorization: token
|
|
976
1071
|
}
|
|
977
1072
|
});
|
|
978
1073
|
|
|
979
1074
|
setProduct(productTemp);
|
|
980
1075
|
setModalSent(true);
|
|
981
1076
|
|
|
982
|
-
case
|
|
1077
|
+
case 37:
|
|
983
1078
|
case "end":
|
|
984
|
-
return
|
|
1079
|
+
return _context10.stop();
|
|
985
1080
|
}
|
|
986
1081
|
}
|
|
987
|
-
},
|
|
1082
|
+
}, _callee10);
|
|
988
1083
|
}));
|
|
989
1084
|
|
|
990
|
-
return function sendToFacilitator(
|
|
991
|
-
return
|
|
1085
|
+
return function sendToFacilitator(_x3) {
|
|
1086
|
+
return _ref11.apply(this, arguments);
|
|
992
1087
|
};
|
|
993
1088
|
}();
|
|
994
1089
|
|
|
@@ -1042,127 +1137,326 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1042
1137
|
return (productSelected === null || productSelected === void 0 ? void 0 : productSelected.version) === version;
|
|
1043
1138
|
}
|
|
1044
1139
|
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
})
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1140
|
+
var createComment = /*#__PURE__*/function () {
|
|
1141
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(e, body, tab) {
|
|
1142
|
+
var _product$article;
|
|
1143
|
+
|
|
1144
|
+
var concept, data;
|
|
1145
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1146
|
+
while (1) {
|
|
1147
|
+
switch (_context11.prev = _context11.next) {
|
|
1148
|
+
case 0:
|
|
1149
|
+
concept = "";
|
|
1150
|
+
_context11.t0 = activeTab;
|
|
1151
|
+
_context11.next = _context11.t0 === "Ficha técnica" ? 4 : _context11.t0 === "Imágenes" ? 6 : 8;
|
|
1152
|
+
break;
|
|
1153
|
+
|
|
1154
|
+
case 4:
|
|
1155
|
+
concept = "datasheet";
|
|
1156
|
+
return _context11.abrupt("break", 10);
|
|
1157
|
+
|
|
1158
|
+
case 6:
|
|
1159
|
+
concept = "images";
|
|
1160
|
+
return _context11.abrupt("break", 10);
|
|
1161
|
+
|
|
1162
|
+
case 8:
|
|
1163
|
+
concept = "description";
|
|
1164
|
+
return _context11.abrupt("break", 10);
|
|
1165
|
+
|
|
1166
|
+
case 10:
|
|
1167
|
+
data = {
|
|
1168
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article,
|
|
1169
|
+
orderId: product === null || product === void 0 ? void 0 : product.orderId,
|
|
1170
|
+
message: body,
|
|
1171
|
+
concept: concept,
|
|
1172
|
+
version: version
|
|
1173
|
+
};
|
|
1174
|
+
e.preventDefault();
|
|
1175
|
+
_context11.next = 14;
|
|
1176
|
+
return _axios.default.post("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1177
|
+
headers: {
|
|
1178
|
+
Authorization: token
|
|
1179
|
+
}
|
|
1180
|
+
});
|
|
1181
|
+
|
|
1182
|
+
case 14:
|
|
1183
|
+
_context11.next = 16;
|
|
1184
|
+
return getComments(tab);
|
|
1185
|
+
|
|
1186
|
+
case 16:
|
|
1187
|
+
case "end":
|
|
1188
|
+
return _context11.stop();
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
}, _callee11);
|
|
1192
|
+
}));
|
|
1193
|
+
|
|
1194
|
+
return function createComment(_x4, _x5, _x6) {
|
|
1195
|
+
return _ref12.apply(this, arguments);
|
|
1196
|
+
};
|
|
1197
|
+
}();
|
|
1198
|
+
|
|
1199
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1200
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1201
|
+
while (1) {
|
|
1202
|
+
switch (_context12.prev = _context12.next) {
|
|
1203
|
+
case 0:
|
|
1204
|
+
setComment(comments[activeTab]);
|
|
1205
|
+
|
|
1206
|
+
case 1:
|
|
1207
|
+
case "end":
|
|
1208
|
+
return _context12.stop();
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
}, _callee12);
|
|
1212
|
+
})), [activeTab]);
|
|
1213
|
+
|
|
1214
|
+
var commentRevised = /*#__PURE__*/function () {
|
|
1215
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
1216
|
+
var data;
|
|
1217
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1218
|
+
while (1) {
|
|
1219
|
+
switch (_context13.prev = _context13.next) {
|
|
1220
|
+
case 0:
|
|
1221
|
+
data = {
|
|
1222
|
+
commentId: comment.id
|
|
1223
|
+
};
|
|
1224
|
+
_context13.next = 3;
|
|
1225
|
+
return _axios.default.put("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1226
|
+
headers: {
|
|
1227
|
+
Authorization: sessionStorage.getItem("jwt")
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1230
|
+
|
|
1231
|
+
case 3:
|
|
1232
|
+
setCrossComment(false);
|
|
1233
|
+
_context13.next = 6;
|
|
1234
|
+
return getComments();
|
|
1235
|
+
|
|
1236
|
+
case 6:
|
|
1237
|
+
case "end":
|
|
1238
|
+
return _context13.stop();
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
}, _callee13);
|
|
1242
|
+
}));
|
|
1243
|
+
|
|
1244
|
+
return function commentRevised() {
|
|
1245
|
+
return _ref14.apply(this, arguments);
|
|
1246
|
+
};
|
|
1247
|
+
}();
|
|
1248
|
+
|
|
1249
|
+
var setAssignation = /*#__PURE__*/function () {
|
|
1250
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(assignationType, assignationId) {
|
|
1251
|
+
var _product$article2;
|
|
1252
|
+
|
|
1253
|
+
var concept, productTemp, data;
|
|
1254
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
1255
|
+
while (1) {
|
|
1256
|
+
switch (_context14.prev = _context14.next) {
|
|
1257
|
+
case 0:
|
|
1258
|
+
concept = "";
|
|
1259
|
+
_context14.t0 = activeTab;
|
|
1260
|
+
_context14.next = _context14.t0 === "Ficha técnica" ? 4 : _context14.t0 === "Imágenes" ? 6 : 8;
|
|
1261
|
+
break;
|
|
1262
|
+
|
|
1263
|
+
case 4:
|
|
1264
|
+
concept = "datasheet";
|
|
1265
|
+
return _context14.abrupt("break", 10);
|
|
1266
|
+
|
|
1267
|
+
case 6:
|
|
1268
|
+
concept = "images";
|
|
1269
|
+
return _context14.abrupt("break", 10);
|
|
1270
|
+
|
|
1271
|
+
case 8:
|
|
1272
|
+
concept = "description";
|
|
1273
|
+
return _context14.abrupt("break", 10);
|
|
1274
|
+
|
|
1275
|
+
case 10:
|
|
1276
|
+
productTemp = productSelected;
|
|
1277
|
+
productTemp.article["id_".concat(concept, "_").concat(assignationType)] = assignationId;
|
|
1278
|
+
data = (0, _defineProperty2.default)({
|
|
1279
|
+
articleList: [{
|
|
1280
|
+
orderId: product.orderId,
|
|
1281
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.id_article
|
|
1282
|
+
}],
|
|
1283
|
+
concept: concept
|
|
1284
|
+
}, "".concat(assignationType, "Id"), assignationId);
|
|
1285
|
+
(0, _axios.default)({
|
|
1286
|
+
method: "post",
|
|
1287
|
+
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
1288
|
+
data: data,
|
|
1289
|
+
headers: {
|
|
1290
|
+
Authorization: token
|
|
1291
|
+
}
|
|
1292
|
+
});
|
|
1293
|
+
loadAssignations(productTemp);
|
|
1294
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1295
|
+
|
|
1296
|
+
case 16:
|
|
1297
|
+
case "end":
|
|
1298
|
+
return _context14.stop();
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
}, _callee14);
|
|
1302
|
+
}));
|
|
1303
|
+
|
|
1304
|
+
return function setAssignation(_x7, _x8) {
|
|
1305
|
+
return _ref15.apply(this, arguments);
|
|
1306
|
+
};
|
|
1307
|
+
}();
|
|
1308
|
+
|
|
1309
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
1310
|
+
headerTop: headerTop,
|
|
1311
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
1312
|
+
setHeaderTop: setHeaderTop
|
|
1313
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1314
|
+
className: "data-container",
|
|
1315
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1316
|
+
className: "image-data-panel",
|
|
1317
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagePreviewer.ImagePreviewer, {
|
|
1318
|
+
activeImage: images !== null && images !== void 0 && images.values ? images === null || images === void 0 ? void 0 : images.values[activeImage] : {},
|
|
1319
|
+
imagesArray: images,
|
|
1320
|
+
setActiveImage: setActiveImage,
|
|
1321
|
+
setShowModal: setShowModal
|
|
1322
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageDataTable.ImageDataTable, {
|
|
1323
|
+
lists: images,
|
|
1324
|
+
activeImage: images !== null && images !== void 0 && images.values ? images === null || images === void 0 ? void 0 : images.values[activeImage] : {},
|
|
1325
|
+
retailerSelected: activeRetailer.id,
|
|
1326
|
+
setImages: setImages,
|
|
1327
|
+
assignationsImages: assig["Imágenes"],
|
|
1328
|
+
imagesStatus: productSelected === null || productSelected === void 0 ? void 0 : productSelected.images_status,
|
|
1329
|
+
setAssignation: setAssignation,
|
|
1330
|
+
isRetailer: isRetailer
|
|
1331
|
+
})]
|
|
1332
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1333
|
+
className: "product-information",
|
|
1334
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader, {
|
|
1335
|
+
headerData: product,
|
|
1336
|
+
percent: activePercentage,
|
|
1337
|
+
activeRetailer: activeRetailer,
|
|
1338
|
+
setActiveRetailer: setActiveRetailer,
|
|
1339
|
+
approveRejectButtons: approveRejectButtons,
|
|
1340
|
+
sendToFacilitator: sendToFacilitator,
|
|
1341
|
+
auditorAssigned: auditorAssigned,
|
|
1342
|
+
userAssigned: userAssigned(activeTab, "facilitator")
|
|
1343
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
|
|
1344
|
+
tabsSections: tabsSections,
|
|
1345
|
+
status: {
|
|
1346
|
+
Descripción: (_servicesData$filter$ = servicesData.filter(function (service) {
|
|
1347
|
+
return service.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && service.service === "description";
|
|
1348
|
+
})[0]) === null || _servicesData$filter$ === void 0 ? void 0 : _servicesData$filter$.status,
|
|
1349
|
+
"Ficha técnica": (_servicesData$filter$2 = servicesData.filter(function (service) {
|
|
1350
|
+
return service.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && service.service === "datasheet";
|
|
1351
|
+
})[0]) === null || _servicesData$filter$2 === void 0 ? void 0 : _servicesData$filter$2.status,
|
|
1352
|
+
Imágenes: product === null || product === void 0 ? void 0 : product.images_status
|
|
1353
|
+
},
|
|
1354
|
+
profileImage: productData.asigned,
|
|
1355
|
+
activeTab: activeTab,
|
|
1356
|
+
setActiveTab: setActiveTab,
|
|
1357
|
+
setImageLayout: setImageLayout,
|
|
1358
|
+
saveDescriptions: saveDescriptions,
|
|
1359
|
+
saveDatasheets: saveDatasheets,
|
|
1360
|
+
updateImages: updateImages,
|
|
1361
|
+
assig: assig[activeTab],
|
|
1362
|
+
setAssignation: setAssignation,
|
|
1363
|
+
isRetailer: isRetailer
|
|
1364
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1365
|
+
className: "services-information-container " + (imageLayout && activeTab === "Imágenes" ? "image-services" : ""),
|
|
1366
|
+
children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {}), 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
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
1368
|
+
articleId: productSelected.article.id_article,
|
|
1369
|
+
version: version,
|
|
1370
|
+
activeSection: activeTab,
|
|
1371
|
+
inputGroup: dataGroup,
|
|
1372
|
+
dataInputs: datasheets[1],
|
|
1373
|
+
updatedDatasheets: updatedDatasheets,
|
|
1374
|
+
setUpdatedDatasheets: setUpdatedDatasheets
|
|
1375
|
+
}, index + "-" + activeRetailer.name);
|
|
1376
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
1377
|
+
children: "no tienes este servicio"
|
|
1378
|
+
})), activeTab === "Descripción" && ((product === null || product === void 0 ? void 0 : (_product$services2 = product.services) === null || _product$services2 === void 0 ? void 0 : _product$services2.descriptions) === 1 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
1379
|
+
activeSection: activeTab,
|
|
1380
|
+
inputGroup: descriptions[0],
|
|
1381
|
+
updatedDescriptions: updatedDescriptions,
|
|
1382
|
+
setUpdatedDescriptions: setUpdatedDescriptions,
|
|
1383
|
+
articleId: articleId,
|
|
1384
|
+
version: version,
|
|
1385
|
+
dinamicHeight: true
|
|
1386
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
1387
|
+
children: "no tienes este servicio"
|
|
1388
|
+
})), activeTab === "Imágenes" && ((product === null || product === void 0 ? void 0 : (_product$services3 = product.services) === null || _product$services3 === void 0 ? void 0 : _product$services3.images) === 1 ? /*#__PURE__*/(0, _jsxRuntime.jsx)("section", {
|
|
1389
|
+
className: "container",
|
|
1390
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread2.default)((0, _objectSpread2.default)({}, getRootProps({
|
|
1391
|
+
className: "dropzone"
|
|
1392
|
+
})), {}, {
|
|
1393
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", (0, _objectSpread2.default)({}, getInputProps())), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
|
|
1394
|
+
children: thumbs()
|
|
1395
|
+
})]
|
|
1396
|
+
}))
|
|
1397
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
1398
|
+
children: "no tienes este servicio"
|
|
1399
|
+
}))]
|
|
1400
|
+
}), (userAssigned(activeTab, "especialist" || "facilitator") || auditorAssigned()) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1401
|
+
className: "commentary-box",
|
|
1402
|
+
children: !comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1403
|
+
className: "commentary",
|
|
1404
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
|
|
1405
|
+
label: "Caja de Comentario",
|
|
1406
|
+
inputType: "textarea",
|
|
1407
|
+
inputCols: 80,
|
|
1408
|
+
inputRows: 4,
|
|
1409
|
+
inputId: "commentary-box",
|
|
1410
|
+
index: 0
|
|
1411
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1412
|
+
className: "buttons-box",
|
|
1413
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1414
|
+
buttonType: "general-transparent-button",
|
|
1415
|
+
label: "Enviar comentario",
|
|
1416
|
+
onClick: function onClick(e) {
|
|
1417
|
+
return createComment(e, document.getElementById("description-commentary-box-0").value, activeTab);
|
|
1418
|
+
}
|
|
1419
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
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
|
+
})]
|
|
1426
|
+
})]
|
|
1427
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1428
|
+
className: "feedback-box",
|
|
1429
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Commentary.Commentary, {
|
|
1430
|
+
comment: comment.message,
|
|
1431
|
+
reviewed: crossComment
|
|
1432
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1433
|
+
buttonType: "circular-button accept-button",
|
|
1434
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
1435
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
1436
|
+
while (1) {
|
|
1437
|
+
switch (_context15.prev = _context15.next) {
|
|
1438
|
+
case 0:
|
|
1439
|
+
setCrossComment(true);
|
|
1440
|
+
commentRevised();
|
|
1441
|
+
|
|
1442
|
+
case 2:
|
|
1443
|
+
case "end":
|
|
1444
|
+
return _context15.stop();
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
}, _callee15);
|
|
1448
|
+
}))
|
|
1449
|
+
})]
|
|
1450
|
+
})
|
|
1451
|
+
})]
|
|
1452
|
+
})]
|
|
1453
|
+
}), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImageModal.ProductImageModal, {
|
|
1454
|
+
images: images,
|
|
1455
|
+
setShowModal: setShowModal,
|
|
1456
|
+
sendToFacilitator: sendToFacilitator,
|
|
1457
|
+
approveRejectButtons: approveRejectButtons
|
|
1458
|
+
})]
|
|
1459
|
+
});
|
|
1166
1460
|
};
|
|
1167
1461
|
|
|
1168
1462
|
exports.RetailerProductEdition = RetailerProductEdition;
|