contentoh-components-library 21.3.53 → 21.3.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.development +2 -0
- package/dist/components/atoms/ButtonV2/styles.js +1 -1
- package/dist/components/atoms/Status/styles.js +1 -1
- package/dist/components/atoms/VerticalSideMenuMainPage/index.js +18 -23
- package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +4 -4
- package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/dist/components/molecules/HeaderTop/index.js +68 -11
- package/dist/components/organisms/Chat/Chat.stories.js +21 -1
- package/dist/components/organisms/Chat/ContainerItems/index.js +19 -3
- package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
- package/dist/components/organisms/Chat/ContentChat/index.js +343 -191
- package/dist/components/organisms/Chat/Footer/index.js +48 -39
- package/dist/components/organisms/Chat/index.js +48 -3
- package/dist/components/organisms/DashboardMetric/dashboardMetricUtils.js +27 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
- package/dist/components/organisms/GlobalModal/styles.js +1 -1
- package/dist/components/organisms/OrderDetail/styles.js +1 -1
- package/dist/components/organisms/OrderDetail/utils/Table/styles.js +1 -1
- package/dist/components/pages/Dashboard/Dashboard.stories.js +31 -50
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +198 -81
- package/dist/components/pages/ProviderProductEdition/index.js +725 -429
- package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +72 -89
- package/dist/components/pages/RetailerProductEdition/index.js +267 -278
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/utils.js +61 -2
- package/dist/index.js +13 -0
- package/package.json +7 -6
- package/src/components/atoms/ButtonV2/styles.js +1 -1
- package/src/components/atoms/Status/styles.js +4 -0
- package/src/components/atoms/VerticalSideMenuMainPage/index.js +18 -22
- package/src/components/atoms/VerticalSideMenuMainPage/styles.js +3 -4
- package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/src/components/molecules/HeaderTop/index.js +52 -6
- package/src/components/organisms/Chat/Chat.stories.js +21 -0
- package/src/components/organisms/Chat/ContainerItems/index.js +18 -2
- package/src/components/organisms/Chat/ContainerItems/styles.js +10 -2
- package/src/components/organisms/Chat/ContentChat/index.js +81 -6
- package/src/components/organisms/Chat/Footer/index.js +11 -0
- package/src/components/organisms/Chat/index.js +47 -3
- package/src/components/organisms/DashboardMetric/dashboardMetricUtils.js +18 -1
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/organisms/GlobalModal/styles.js +10 -0
- package/src/components/organisms/OrderDetail/index.js +1 -0
- package/src/components/organisms/OrderDetail/styles.js +1 -1
- package/src/components/organisms/OrderDetail/utils/Table/styles.js +0 -1
- package/src/components/organisms/TableResizable/TableResizable.stories.js +17 -0
- package/src/components/organisms/TableResizable/index.js +119 -0
- package/src/components/organisms/TableResizable/styles.js +133 -0
- package/src/components/organisms/TableResizable/utils.js +46 -0
- package/src/components/pages/Dashboard/Dashboard.stories.js +31 -55
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +214 -88
- package/src/components/pages/ProviderProductEdition/index.js +323 -160
- package/src/components/pages/ProviderProductEdition/styles.js +5 -1
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +75 -91
- package/src/components/pages/RetailerProductEdition/index.js +111 -137
- package/src/components/pages/RetailerProductEdition/styles.js +4 -0
- package/src/components/pages/RetailerProductEdition/utils.js +37 -0
- package/src/index.js +1 -0
|
@@ -53,12 +53,6 @@ var _uuid = require("uuid");
|
|
|
53
53
|
|
|
54
54
|
var _awsSdk = _interopRequireDefault(require("aws-sdk"));
|
|
55
55
|
|
|
56
|
-
var _attributesSent = _interopRequireDefault(require("../../../assets/images/modalsSVGs/attributesSent.svg"));
|
|
57
|
-
|
|
58
|
-
var _descriptionSent = _interopRequireDefault(require("../../../assets/images/modalsSVGs/descriptionSent.svg"));
|
|
59
|
-
|
|
60
|
-
var _uploadingImages = _interopRequireDefault(require("../../../assets/images/modalsSVGs/uploadingImages.svg"));
|
|
61
|
-
|
|
62
56
|
var _index = require("../../molecules/TagAndInput/index");
|
|
63
57
|
|
|
64
58
|
var _GeneralButton = require("../../atoms/GeneralButton");
|
|
@@ -99,6 +93,12 @@ var _VersionSelector = require("../../organisms/VersionSelector");
|
|
|
99
93
|
|
|
100
94
|
var _customHooks = require("../../../global-files/customHooks");
|
|
101
95
|
|
|
96
|
+
var _utils = require("../RetailerProductEdition/utils");
|
|
97
|
+
|
|
98
|
+
var _Modal = require("../../organisms/Modal");
|
|
99
|
+
|
|
100
|
+
var _ButtonV = require("../../atoms/ButtonV2");
|
|
101
|
+
|
|
102
102
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
103
103
|
|
|
104
104
|
var reducerImages = function reducerImages(state, action) {
|
|
@@ -212,7 +212,7 @@ var myBucket = new _awsSdk.default.S3({
|
|
|
212
212
|
});
|
|
213
213
|
|
|
214
214
|
var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
215
|
-
var _product$retailers, _product$retailersAva, _location$state, _location$state2, _datasheets$, _datasheets$$data;
|
|
215
|
+
var _product$retailers, _product$retailersAva, _location$state, _location$state2, _location$state3, _datasheets$, _datasheets$$data;
|
|
216
216
|
|
|
217
217
|
var tabsSections = _ref.tabsSections,
|
|
218
218
|
_ref$productSelected = _ref.productSelected,
|
|
@@ -227,7 +227,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
227
227
|
revision = _ref$revision === void 0 ? false : _ref$revision,
|
|
228
228
|
setShowContentohRequestModal = _ref.setShowContentohRequestModal,
|
|
229
229
|
showSurvey = _ref.showSurvey,
|
|
230
|
-
company = _ref.company
|
|
230
|
+
company = _ref.company,
|
|
231
|
+
addToCart = _ref.addToCart;
|
|
231
232
|
|
|
232
233
|
var _useState = (0, _react.useState)("Descripción"),
|
|
233
234
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -395,66 +396,66 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
395
396
|
productEdit = _useState38[0],
|
|
396
397
|
setProductEdit = _useState38[1];
|
|
397
398
|
|
|
398
|
-
var _useState39 = (0, _react.useState)(null),
|
|
399
|
+
var _useState39 = (0, _react.useState)(product === null || product === void 0 ? void 0 : product.version),
|
|
399
400
|
_useState40 = (0, _slicedToArray2.default)(_useState39, 2),
|
|
400
|
-
|
|
401
|
-
|
|
401
|
+
version = _useState40[0],
|
|
402
|
+
setVersion = _useState40[1];
|
|
402
403
|
|
|
403
|
-
var _useState41 = (0, _react.useState)(
|
|
404
|
-
_useState42 = (0, _slicedToArray2.default)(_useState41,
|
|
405
|
-
|
|
406
|
-
setVersion = _useState42[1];
|
|
404
|
+
var _useState41 = (0, _react.useState)({}),
|
|
405
|
+
_useState42 = (0, _slicedToArray2.default)(_useState41, 1),
|
|
406
|
+
comments = _useState42[0];
|
|
407
407
|
|
|
408
|
-
var _useState43 = (0, _react.useState)(
|
|
409
|
-
_useState44 = (0, _slicedToArray2.default)(_useState43,
|
|
410
|
-
|
|
408
|
+
var _useState43 = (0, _react.useState)(""),
|
|
409
|
+
_useState44 = (0, _slicedToArray2.default)(_useState43, 2),
|
|
410
|
+
comment = _useState44[0],
|
|
411
|
+
setComment = _useState44[1];
|
|
411
412
|
|
|
412
|
-
var _useState45 = (0, _react.useState)(
|
|
413
|
+
var _useState45 = (0, _react.useState)(false),
|
|
413
414
|
_useState46 = (0, _slicedToArray2.default)(_useState45, 2),
|
|
414
|
-
|
|
415
|
-
|
|
415
|
+
crossComment = _useState46[0],
|
|
416
|
+
setCrossComment = _useState46[1];
|
|
416
417
|
|
|
417
|
-
var _useState47 = (0, _react.useState)(
|
|
418
|
+
var _useState47 = (0, _react.useState)([]),
|
|
418
419
|
_useState48 = (0, _slicedToArray2.default)(_useState47, 2),
|
|
419
|
-
|
|
420
|
-
|
|
420
|
+
userGroups = _useState48[0],
|
|
421
|
+
setUserGroups = _useState48[1];
|
|
421
422
|
|
|
422
|
-
var _useState49 = (0, _react.useState)(
|
|
423
|
+
var _useState49 = (0, _react.useState)({}),
|
|
423
424
|
_useState50 = (0, _slicedToArray2.default)(_useState49, 2),
|
|
424
|
-
|
|
425
|
-
|
|
425
|
+
assig = _useState50[0],
|
|
426
|
+
setAssig = _useState50[1];
|
|
426
427
|
|
|
427
|
-
var _useState51 = (0, _react.useState)(
|
|
428
|
+
var _useState51 = (0, _react.useState)([]),
|
|
428
429
|
_useState52 = (0, _slicedToArray2.default)(_useState51, 2),
|
|
429
|
-
|
|
430
|
-
|
|
430
|
+
selectedImages = _useState52[0],
|
|
431
|
+
setSelectedImages = _useState52[1];
|
|
431
432
|
|
|
432
433
|
var _useState53 = (0, _react.useState)([]),
|
|
433
434
|
_useState54 = (0, _slicedToArray2.default)(_useState53, 2),
|
|
434
|
-
|
|
435
|
-
|
|
435
|
+
componentsArray = _useState54[0],
|
|
436
|
+
setComponentsArray = _useState54[1];
|
|
436
437
|
|
|
437
|
-
var _useState55 = (0, _react.useState)(
|
|
438
|
+
var _useState55 = (0, _react.useState)(false),
|
|
438
439
|
_useState56 = (0, _slicedToArray2.default)(_useState55, 2),
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
var _useState57 = (0, _react.useState)(false),
|
|
443
|
-
_useState58 = (0, _slicedToArray2.default)(_useState57, 2),
|
|
444
|
-
checkAll = _useState58[0],
|
|
445
|
-
setCheckAll = _useState58[1];
|
|
440
|
+
checkAll = _useState56[0],
|
|
441
|
+
setCheckAll = _useState56[1];
|
|
446
442
|
|
|
447
443
|
var isRetailer = user === null || user === void 0 ? void 0 : user.is_retailer;
|
|
448
444
|
|
|
449
|
-
var
|
|
445
|
+
var _useState57 = (0, _react.useState)(true),
|
|
446
|
+
_useState58 = (0, _slicedToArray2.default)(_useState57, 2),
|
|
447
|
+
loading = _useState58[0],
|
|
448
|
+
setLoading = _useState58[1];
|
|
449
|
+
|
|
450
|
+
var _useState59 = (0, _react.useState)(false),
|
|
450
451
|
_useState60 = (0, _slicedToArray2.default)(_useState59, 2),
|
|
451
|
-
|
|
452
|
-
|
|
452
|
+
validatedAll = _useState60[0],
|
|
453
|
+
setValidatedAll = _useState60[1];
|
|
453
454
|
|
|
454
455
|
var _useState61 = (0, _react.useState)(false),
|
|
455
456
|
_useState62 = (0, _slicedToArray2.default)(_useState61, 2),
|
|
456
|
-
|
|
457
|
-
|
|
457
|
+
showRejectModal = _useState62[0],
|
|
458
|
+
setShowRejectModal = _useState62[1];
|
|
458
459
|
|
|
459
460
|
var originProp = location === null || location === void 0 ? void 0 : (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.origin;
|
|
460
461
|
|
|
@@ -472,29 +473,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
472
473
|
inCart = _useState66[0],
|
|
473
474
|
setInCart = _useState66[1];
|
|
474
475
|
|
|
475
|
-
var _useState67 = (0, _react.useState)(
|
|
476
|
-
_useState68 = (0, _slicedToArray2.default)(_useState67, 2),
|
|
477
|
-
modalSent = _useState68[0],
|
|
478
|
-
setModalSent = _useState68[1];
|
|
479
|
-
|
|
480
|
-
var _useState69 = (0, _react.useState)(false),
|
|
481
|
-
_useState70 = (0, _slicedToArray2.default)(_useState69, 2),
|
|
482
|
-
modalViewError = _useState70[0],
|
|
483
|
-
setModalViewError = _useState70[1];
|
|
484
|
-
|
|
485
|
-
var _useState71 = (0, _react.useState)(false),
|
|
486
|
-
_useState72 = (0, _slicedToArray2.default)(_useState71, 2),
|
|
487
|
-
showGenericModal = _useState72[0],
|
|
488
|
-
setShowGenericModal = _useState72[1];
|
|
489
|
-
|
|
490
|
-
var _useState73 = (0, _react.useState)({
|
|
476
|
+
var _useState67 = (0, _react.useState)({
|
|
491
477
|
message: "¿Estás seguro de continuar?",
|
|
492
478
|
detail: " ".concat(user.is_retailer ? "Asegurate de haber revisado las tres secciones" : "Envíar el producto a la cadena"),
|
|
493
479
|
button1: {
|
|
494
480
|
name: "Cerrar",
|
|
495
|
-
action:
|
|
496
|
-
return setModalViewTextArea(false);
|
|
497
|
-
}
|
|
481
|
+
action: closeGlobalModal
|
|
498
482
|
},
|
|
499
483
|
button2: {
|
|
500
484
|
name: "Continuar",
|
|
@@ -504,35 +488,378 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
504
488
|
},
|
|
505
489
|
img: _defaultProfileImage.default
|
|
506
490
|
}),
|
|
507
|
-
|
|
508
|
-
dataGenericModal =
|
|
509
|
-
setDataGenericModal =
|
|
510
|
-
|
|
511
|
-
var _useState75 = (0, _react.useState)(false),
|
|
512
|
-
_useState76 = (0, _slicedToArray2.default)(_useState75, 2),
|
|
513
|
-
modalViewTextArea = _useState76[0],
|
|
514
|
-
setModalViewTextArea = _useState76[1];
|
|
491
|
+
_useState68 = (0, _slicedToArray2.default)(_useState67, 2),
|
|
492
|
+
dataGenericModal = _useState68[0],
|
|
493
|
+
setDataGenericModal = _useState68[1];
|
|
515
494
|
|
|
516
|
-
var
|
|
517
|
-
|
|
518
|
-
socketType =
|
|
519
|
-
setSocketType =
|
|
495
|
+
var _useState69 = (0, _react.useState)(null),
|
|
496
|
+
_useState70 = (0, _slicedToArray2.default)(_useState69, 2),
|
|
497
|
+
socketType = _useState70[0],
|
|
498
|
+
setSocketType = _useState70[1];
|
|
520
499
|
|
|
521
|
-
var
|
|
522
|
-
|
|
523
|
-
saving =
|
|
524
|
-
setSaving =
|
|
500
|
+
var _useState71 = (0, _react.useState)(loading),
|
|
501
|
+
_useState72 = (0, _slicedToArray2.default)(_useState71, 2),
|
|
502
|
+
saving = _useState72[0],
|
|
503
|
+
setSaving = _useState72[1];
|
|
525
504
|
|
|
526
|
-
var
|
|
527
|
-
|
|
528
|
-
retailerStatus =
|
|
529
|
-
setRetailerStatus =
|
|
505
|
+
var _useState73 = (0, _react.useState)(product.statusByRetailer),
|
|
506
|
+
_useState74 = (0, _slicedToArray2.default)(_useState73, 2),
|
|
507
|
+
retailerStatus = _useState74[0],
|
|
508
|
+
setRetailerStatus = _useState74[1];
|
|
530
509
|
|
|
531
510
|
var _useCloseModal = (0, _customHooks.useCloseModal)("version-selector"),
|
|
532
511
|
_useCloseModal2 = (0, _slicedToArray2.default)(_useCloseModal, 2),
|
|
533
512
|
showVersionSelector = _useCloseModal2[0],
|
|
534
513
|
setShowVersionSelector = _useCloseModal2[1];
|
|
535
514
|
|
|
515
|
+
var _useState75 = (0, _react.useState)(),
|
|
516
|
+
_useState76 = (0, _slicedToArray2.default)(_useState75, 2),
|
|
517
|
+
globalModal = _useState76[0],
|
|
518
|
+
setGlobalModal = _useState76[1];
|
|
519
|
+
|
|
520
|
+
var updateAuditStatus = /*#__PURE__*/function () {
|
|
521
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(status) {
|
|
522
|
+
var productTemp, retailerStatusCopy, conceptArray;
|
|
523
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
524
|
+
while (1) {
|
|
525
|
+
switch (_context2.prev = _context2.next) {
|
|
526
|
+
case 0:
|
|
527
|
+
productTemp = product;
|
|
528
|
+
productTemp.article_status = status;
|
|
529
|
+
productTemp.datasheet_status = status;
|
|
530
|
+
productTemp.description_status = status;
|
|
531
|
+
productTemp.images_status = status;
|
|
532
|
+
retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
|
|
533
|
+
conceptArray = ["description", "datasheet", "images"];
|
|
534
|
+
Object.keys(retailerStatusCopy).forEach(function (key) {
|
|
535
|
+
conceptArray.forEach(function (concept) {
|
|
536
|
+
if (retailerStatusCopy[key][concept]) {
|
|
537
|
+
retailerStatusCopy[key][concept] = status;
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
});
|
|
541
|
+
setRetailerStatus(retailerStatusCopy);
|
|
542
|
+
productTemp.statusByRetailer = retailerStatusCopy;
|
|
543
|
+
setProduct(productTemp);
|
|
544
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
545
|
+
setProductEdit({
|
|
546
|
+
ArticleId: productTemp.id_article,
|
|
547
|
+
idCategory: productTemp.article.id_category,
|
|
548
|
+
product: productTemp
|
|
549
|
+
});
|
|
550
|
+
sessionStorage.setItem("productEdit", JSON.stringify({
|
|
551
|
+
ArticleId: productTemp.id_article,
|
|
552
|
+
idCategory: productTemp.article.id_category,
|
|
553
|
+
product: productTemp
|
|
554
|
+
}));
|
|
555
|
+
_context2.next = 16;
|
|
556
|
+
return loadData();
|
|
557
|
+
|
|
558
|
+
case 16:
|
|
559
|
+
case "end":
|
|
560
|
+
return _context2.stop();
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}, _callee2);
|
|
564
|
+
}));
|
|
565
|
+
|
|
566
|
+
return function updateAuditStatus(_x2) {
|
|
567
|
+
return _ref3.apply(this, arguments);
|
|
568
|
+
};
|
|
569
|
+
}();
|
|
570
|
+
|
|
571
|
+
var addCart = /*#__PURE__*/function () {
|
|
572
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(retailers) {
|
|
573
|
+
var article, version, articleToOrder, modatlType, resCart;
|
|
574
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
575
|
+
while (1) {
|
|
576
|
+
switch (_context3.prev = _context3.next) {
|
|
577
|
+
case 0:
|
|
578
|
+
article = product.article, version = product.version;
|
|
579
|
+
articleToOrder = [{
|
|
580
|
+
articleId: article.id_article,
|
|
581
|
+
version: version,
|
|
582
|
+
userId: user.id_user,
|
|
583
|
+
discount: 0,
|
|
584
|
+
subtotal: 0,
|
|
585
|
+
companyId: user.id_company,
|
|
586
|
+
datasheet: retailers,
|
|
587
|
+
description: retailers,
|
|
588
|
+
image: retailers,
|
|
589
|
+
attributeTranslations: false,
|
|
590
|
+
descriptionTranslations: false,
|
|
591
|
+
build: "[]",
|
|
592
|
+
manual: "[]",
|
|
593
|
+
userCreated: user.id_user
|
|
594
|
+
}];
|
|
595
|
+
modatlType = "addedToCartError";
|
|
596
|
+
|
|
597
|
+
if (!addToCart) {
|
|
598
|
+
_context3.next = 8;
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
_context3.next = 6;
|
|
603
|
+
return addToCart({
|
|
604
|
+
data: articleToOrder
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
case 6:
|
|
608
|
+
resCart = _context3.sent;
|
|
609
|
+
|
|
610
|
+
if (resCart.data.statusCode === 200) {
|
|
611
|
+
modatlType = "addedToCart";
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
case 8:
|
|
615
|
+
showGlobalModal(modatlType);
|
|
616
|
+
|
|
617
|
+
case 9:
|
|
618
|
+
case "end":
|
|
619
|
+
return _context3.stop();
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}, _callee3);
|
|
623
|
+
}));
|
|
624
|
+
|
|
625
|
+
return function addCart(_x3) {
|
|
626
|
+
return _ref4.apply(this, arguments);
|
|
627
|
+
};
|
|
628
|
+
}();
|
|
629
|
+
|
|
630
|
+
var closeGlobalModal = function closeGlobalModal() {
|
|
631
|
+
return setGlobalModal();
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
var seenByProvider = /*#__PURE__*/function () {
|
|
635
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
636
|
+
var _productTemp$id_order;
|
|
637
|
+
|
|
638
|
+
var productTemp, articleId, orderId, promises, conceptArray;
|
|
639
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
640
|
+
while (1) {
|
|
641
|
+
switch (_context4.prev = _context4.next) {
|
|
642
|
+
case 0:
|
|
643
|
+
productTemp = product;
|
|
644
|
+
articleId = productTemp.id_article;
|
|
645
|
+
orderId = (_productTemp$id_order = productTemp.id_order) !== null && _productTemp$id_order !== void 0 ? _productTemp$id_order : productTemp.orderId;
|
|
646
|
+
promises = [];
|
|
647
|
+
conceptArray = ["description", "datasheet", "images"];
|
|
648
|
+
conceptArray.forEach(function (concept) {
|
|
649
|
+
var sectionStatusKey = "".concat(concept, "_status");
|
|
650
|
+
var evalStatus = product[sectionStatusKey] || (product === null || product === void 0 ? void 0 : product.version_status);
|
|
651
|
+
var data = {
|
|
652
|
+
articleId: articleId,
|
|
653
|
+
orderId: orderId,
|
|
654
|
+
concept: concept,
|
|
655
|
+
evalStatus: evalStatus
|
|
656
|
+
};
|
|
657
|
+
promises.push(_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
658
|
+
headers: {
|
|
659
|
+
Authorization: token
|
|
660
|
+
}
|
|
661
|
+
}));
|
|
662
|
+
});
|
|
663
|
+
_context4.next = 8;
|
|
664
|
+
return Promise.all(promises);
|
|
665
|
+
|
|
666
|
+
case 8:
|
|
667
|
+
closeGlobalModal();
|
|
668
|
+
_context4.next = 11;
|
|
669
|
+
return updateAuditStatus("FAP");
|
|
670
|
+
|
|
671
|
+
case 11:
|
|
672
|
+
case "end":
|
|
673
|
+
return _context4.stop();
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}, _callee4);
|
|
677
|
+
}));
|
|
678
|
+
|
|
679
|
+
return function seenByProvider() {
|
|
680
|
+
return _ref5.apply(this, arguments);
|
|
681
|
+
};
|
|
682
|
+
}();
|
|
683
|
+
|
|
684
|
+
var showGlobalModal = (0, _react.useCallback)(function (type) {
|
|
685
|
+
var formatter = new Intl.ListFormat("es", {
|
|
686
|
+
type: "conjunction"
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
switch (type) {
|
|
690
|
+
case "generic":
|
|
691
|
+
setGlobalModal(dataGenericModal);
|
|
692
|
+
break;
|
|
693
|
+
|
|
694
|
+
case "commentsSent":
|
|
695
|
+
setGlobalModal({
|
|
696
|
+
message: "Gracias, tus comentarios fueron entregados.",
|
|
697
|
+
detail: "Trabajaremos en conjunto para resolverlo.",
|
|
698
|
+
button1: {
|
|
699
|
+
name: "Cerrar",
|
|
700
|
+
action: closeGlobalModal
|
|
701
|
+
},
|
|
702
|
+
img: _defaultProfileImage.default,
|
|
703
|
+
textArea: false
|
|
704
|
+
});
|
|
705
|
+
break;
|
|
706
|
+
|
|
707
|
+
case "RAC":
|
|
708
|
+
var servicesRejected = [];
|
|
709
|
+
var translateServices = {
|
|
710
|
+
datasheet: "ficha técnica",
|
|
711
|
+
description: "descripción",
|
|
712
|
+
images: "imágenes"
|
|
713
|
+
};
|
|
714
|
+
Object.keys(translateServices).forEach(function (service) {
|
|
715
|
+
if (product["".concat(service, "_status")] === "RAC") {
|
|
716
|
+
servicesRejected.push(translateServices[service]);
|
|
717
|
+
}
|
|
718
|
+
});
|
|
719
|
+
var plural = ["Los servicios", "cumplen"];
|
|
720
|
+
var singular = ["El servicio", "cumple"];
|
|
721
|
+
var grammar = servicesRejected.length > 1 ? plural : singular;
|
|
722
|
+
var formatted = formatter.format(servicesRejected);
|
|
723
|
+
var text1 = "".concat(grammar[0], " de ").concat(formatted, " no ").concat(grammar[1], " con lo que la cadena necesita.");
|
|
724
|
+
var text2 = "\xA1Solicita el servicio de Content-oh! para completarlo!";
|
|
725
|
+
var retailers = product.retailersWithService.map(function (retailer) {
|
|
726
|
+
return Number(retailer);
|
|
727
|
+
});
|
|
728
|
+
setGlobalModal({
|
|
729
|
+
message: "Tu producto no cumple con los requerimientos de la cadena",
|
|
730
|
+
customComponent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
731
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
732
|
+
className: "generic-text",
|
|
733
|
+
children: [text1, /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), text2]
|
|
734
|
+
})
|
|
735
|
+
}),
|
|
736
|
+
button1: {
|
|
737
|
+
name: "Continuar",
|
|
738
|
+
action: function () {
|
|
739
|
+
var _action = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
740
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
741
|
+
while (1) {
|
|
742
|
+
switch (_context5.prev = _context5.next) {
|
|
743
|
+
case 0:
|
|
744
|
+
_context5.next = 2;
|
|
745
|
+
return seenByProvider();
|
|
746
|
+
|
|
747
|
+
case 2:
|
|
748
|
+
return _context5.abrupt("return", _context5.sent);
|
|
749
|
+
|
|
750
|
+
case 3:
|
|
751
|
+
case "end":
|
|
752
|
+
return _context5.stop();
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
}, _callee5);
|
|
756
|
+
}));
|
|
757
|
+
|
|
758
|
+
function action() {
|
|
759
|
+
return _action.apply(this, arguments);
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
return action;
|
|
763
|
+
}()
|
|
764
|
+
},
|
|
765
|
+
button2: {
|
|
766
|
+
name: "Solicitar a Content-oh!",
|
|
767
|
+
action: function () {
|
|
768
|
+
var _action2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
769
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
770
|
+
while (1) {
|
|
771
|
+
switch (_context6.prev = _context6.next) {
|
|
772
|
+
case 0:
|
|
773
|
+
_context6.next = 2;
|
|
774
|
+
return addCart(retailers);
|
|
775
|
+
|
|
776
|
+
case 2:
|
|
777
|
+
_context6.next = 4;
|
|
778
|
+
return seenByProvider();
|
|
779
|
+
|
|
780
|
+
case 4:
|
|
781
|
+
case "end":
|
|
782
|
+
return _context6.stop();
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}, _callee6);
|
|
786
|
+
}));
|
|
787
|
+
|
|
788
|
+
function action() {
|
|
789
|
+
return _action2.apply(this, arguments);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
return action;
|
|
793
|
+
}()
|
|
794
|
+
},
|
|
795
|
+
img: _errorModal.default
|
|
796
|
+
});
|
|
797
|
+
break;
|
|
798
|
+
|
|
799
|
+
case "AAC":
|
|
800
|
+
setGlobalModal({
|
|
801
|
+
message: "Felicidades",
|
|
802
|
+
detail: "Tu producto cumple con los requerimientos de la cadena.",
|
|
803
|
+
button1: {
|
|
804
|
+
name: "Continuar",
|
|
805
|
+
action: function () {
|
|
806
|
+
var _action3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
807
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
808
|
+
while (1) {
|
|
809
|
+
switch (_context7.prev = _context7.next) {
|
|
810
|
+
case 0:
|
|
811
|
+
_context7.next = 2;
|
|
812
|
+
return seenByProvider();
|
|
813
|
+
|
|
814
|
+
case 2:
|
|
815
|
+
return _context7.abrupt("return", _context7.sent);
|
|
816
|
+
|
|
817
|
+
case 3:
|
|
818
|
+
case "end":
|
|
819
|
+
return _context7.stop();
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}, _callee7);
|
|
823
|
+
}));
|
|
824
|
+
|
|
825
|
+
function action() {
|
|
826
|
+
return _action3.apply(this, arguments);
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
return action;
|
|
830
|
+
}()
|
|
831
|
+
},
|
|
832
|
+
img: _defaultProfileImage.default
|
|
833
|
+
});
|
|
834
|
+
break;
|
|
835
|
+
|
|
836
|
+
case "addedToCartError":
|
|
837
|
+
setGlobalModal({
|
|
838
|
+
detail: "Parece que algo salió mal al intentar añadir tu producto a tu carrito.",
|
|
839
|
+
button1: {
|
|
840
|
+
name: "Continuar",
|
|
841
|
+
action: closeGlobalModal
|
|
842
|
+
}
|
|
843
|
+
});
|
|
844
|
+
break;
|
|
845
|
+
|
|
846
|
+
case "addedToCart":
|
|
847
|
+
setGlobalModal({
|
|
848
|
+
message: "Producto añadido",
|
|
849
|
+
detail: "Tu producto se añadió al carrito de compras.",
|
|
850
|
+
button1: {
|
|
851
|
+
name: "Continuar",
|
|
852
|
+
action: closeGlobalModal
|
|
853
|
+
},
|
|
854
|
+
img: _defaultProfileImage.default
|
|
855
|
+
});
|
|
856
|
+
break;
|
|
857
|
+
|
|
858
|
+
default:
|
|
859
|
+
closeGlobalModal();
|
|
860
|
+
break;
|
|
861
|
+
}
|
|
862
|
+
}, [activeTab, dataGenericModal, product]);
|
|
536
863
|
(0, _react.useEffect)(function () {
|
|
537
864
|
checkAll && setSelectedImages(images.values);
|
|
538
865
|
}, [checkAll]);
|
|
@@ -543,22 +870,22 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
543
870
|
}, [showModal]);
|
|
544
871
|
|
|
545
872
|
var loadData = /*#__PURE__*/function () {
|
|
546
|
-
var
|
|
873
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
547
874
|
var _product$article, _product$article2, _product$article3, _services$, _services$$values;
|
|
548
875
|
|
|
549
876
|
var services;
|
|
550
|
-
return _regenerator.default.wrap(function
|
|
877
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
551
878
|
while (1) {
|
|
552
|
-
switch (
|
|
879
|
+
switch (_context8.prev = _context8.next) {
|
|
553
880
|
case 0:
|
|
554
|
-
|
|
881
|
+
_context8.next = 2;
|
|
555
882
|
return (0, _data.getRetailerServices)((product === null || product === void 0 ? void 0 : product.id_article) || (product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article), (product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.company_name) || (product === null || product === void 0 ? void 0 : product.categoryName), parseInt((product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_category) || (product === null || product === void 0 ? void 0 : product.id_category)), version);
|
|
556
883
|
|
|
557
884
|
case 2:
|
|
558
|
-
services =
|
|
885
|
+
services = _context8.sent;
|
|
559
886
|
//Converts the data inside the datasheets object to array
|
|
560
887
|
setServices(services);
|
|
561
|
-
|
|
888
|
+
_context8.next = 6;
|
|
562
889
|
return getServices();
|
|
563
890
|
|
|
564
891
|
case 6:
|
|
@@ -576,26 +903,26 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
576
903
|
|
|
577
904
|
case 10:
|
|
578
905
|
case "end":
|
|
579
|
-
return
|
|
906
|
+
return _context8.stop();
|
|
580
907
|
}
|
|
581
908
|
}
|
|
582
|
-
},
|
|
909
|
+
}, _callee8);
|
|
583
910
|
}));
|
|
584
911
|
|
|
585
912
|
return function loadData() {
|
|
586
|
-
return
|
|
913
|
+
return _ref6.apply(this, arguments);
|
|
587
914
|
};
|
|
588
915
|
}();
|
|
589
916
|
|
|
590
917
|
var getServices = /*#__PURE__*/function () {
|
|
591
|
-
var
|
|
918
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
592
919
|
var _product$article4;
|
|
593
920
|
|
|
594
921
|
var productInOrder, idArticle, retailers, active, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse, retailerResponse;
|
|
595
922
|
|
|
596
|
-
return _regenerator.default.wrap(function
|
|
923
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
597
924
|
while (1) {
|
|
598
|
-
switch (
|
|
925
|
+
switch (_context9.prev = _context9.next) {
|
|
599
926
|
case 0:
|
|
600
927
|
productInOrder = product.id_order || product.orderId;
|
|
601
928
|
idArticle = (product === null || product === void 0 ? void 0 : product.id_article) || (product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article);
|
|
@@ -603,15 +930,15 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
603
930
|
active = null;
|
|
604
931
|
|
|
605
932
|
if (!(isRevision() || productInOrder)) {
|
|
606
|
-
|
|
933
|
+
_context9.next = 12;
|
|
607
934
|
break;
|
|
608
935
|
}
|
|
609
936
|
|
|
610
|
-
|
|
937
|
+
_context9.next = 7;
|
|
611
938
|
return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(idArticle, "&orderId=").concat((_product$id_order = product === null || product === void 0 ? void 0 : product.id_order) !== null && _product$id_order !== void 0 ? _product$id_order : product.orderId, "&end=true"));
|
|
612
939
|
|
|
613
940
|
case 7:
|
|
614
|
-
servicesResponse =
|
|
941
|
+
servicesResponse = _context9.sent;
|
|
615
942
|
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;
|
|
616
943
|
retailerResponse = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
|
|
617
944
|
return srv.id_retailer;
|
|
@@ -622,18 +949,18 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
622
949
|
setServicesData(parsedResponse);
|
|
623
950
|
|
|
624
951
|
case 12:
|
|
625
|
-
!activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
|
|
952
|
+
retailers && !activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
|
|
626
953
|
|
|
627
954
|
case 13:
|
|
628
955
|
case "end":
|
|
629
|
-
return
|
|
956
|
+
return _context9.stop();
|
|
630
957
|
}
|
|
631
958
|
}
|
|
632
|
-
},
|
|
959
|
+
}, _callee9);
|
|
633
960
|
}));
|
|
634
961
|
|
|
635
962
|
return function getServices() {
|
|
636
|
-
return
|
|
963
|
+
return _ref7.apply(this, arguments);
|
|
637
964
|
};
|
|
638
965
|
}();
|
|
639
966
|
|
|
@@ -663,13 +990,13 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
663
990
|
};
|
|
664
991
|
|
|
665
992
|
var getCart = /*#__PURE__*/function () {
|
|
666
|
-
var
|
|
993
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
667
994
|
var res, arr;
|
|
668
|
-
return _regenerator.default.wrap(function
|
|
995
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
669
996
|
while (1) {
|
|
670
|
-
switch (
|
|
997
|
+
switch (_context10.prev = _context10.next) {
|
|
671
998
|
case 0:
|
|
672
|
-
|
|
999
|
+
_context10.next = 2;
|
|
673
1000
|
return _axios.default.get(process.env.REACT_APP_CART, {
|
|
674
1001
|
headers: {
|
|
675
1002
|
Authorization: token
|
|
@@ -677,7 +1004,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
677
1004
|
});
|
|
678
1005
|
|
|
679
1006
|
case 2:
|
|
680
|
-
res =
|
|
1007
|
+
res = _context10.sent;
|
|
681
1008
|
arr = JSON.parse(res.data.body).data.map(function (e) {
|
|
682
1009
|
return e.article_id;
|
|
683
1010
|
});
|
|
@@ -687,14 +1014,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
687
1014
|
|
|
688
1015
|
case 5:
|
|
689
1016
|
case "end":
|
|
690
|
-
return
|
|
1017
|
+
return _context10.stop();
|
|
691
1018
|
}
|
|
692
1019
|
}
|
|
693
|
-
},
|
|
1020
|
+
}, _callee10);
|
|
694
1021
|
}));
|
|
695
1022
|
|
|
696
1023
|
return function getCart() {
|
|
697
|
-
return
|
|
1024
|
+
return _ref8.apply(this, arguments);
|
|
698
1025
|
};
|
|
699
1026
|
}();
|
|
700
1027
|
|
|
@@ -709,6 +1036,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
709
1036
|
action: "orderImages",
|
|
710
1037
|
retailerId: activeRetailer.id
|
|
711
1038
|
});
|
|
1039
|
+
if (["RAC", "AAC"].includes(product.article_status)) showGlobalModal(product.article_status);
|
|
712
1040
|
}, [product, version]);
|
|
713
1041
|
(0, _react.useEffect)(function () {
|
|
714
1042
|
setImages({
|
|
@@ -739,7 +1067,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
739
1067
|
}
|
|
740
1068
|
|
|
741
1069
|
setProduct(productTemp);
|
|
742
|
-
setActivePercentage((_retailers$ = retailers[0]) === null || _retailers$ === void 0 ? void 0 : _retailers$.percentage);
|
|
1070
|
+
retailers && setActivePercentage((_retailers$ = retailers[0]) === null || _retailers$ === void 0 ? void 0 : _retailers$.percentage);
|
|
743
1071
|
}, [percentages]);
|
|
744
1072
|
|
|
745
1073
|
var loadInputs = function loadInputs() {
|
|
@@ -819,11 +1147,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
819
1147
|
}, [images]);
|
|
820
1148
|
|
|
821
1149
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
822
|
-
var
|
|
1150
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
823
1151
|
var dataObject, res;
|
|
824
|
-
return _regenerator.default.wrap(function
|
|
1152
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
825
1153
|
while (1) {
|
|
826
|
-
switch (
|
|
1154
|
+
switch (_context11.prev = _context11.next) {
|
|
827
1155
|
case 0:
|
|
828
1156
|
setLoading(true);
|
|
829
1157
|
dataObject = {
|
|
@@ -831,8 +1159,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
831
1159
|
articleData: updatedDescriptions
|
|
832
1160
|
};
|
|
833
1161
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
834
|
-
|
|
835
|
-
|
|
1162
|
+
_context11.prev = 3;
|
|
1163
|
+
_context11.next = 6;
|
|
836
1164
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
837
1165
|
headers: {
|
|
838
1166
|
Authorization: token
|
|
@@ -840,45 +1168,45 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
840
1168
|
});
|
|
841
1169
|
|
|
842
1170
|
case 6:
|
|
843
|
-
res =
|
|
1171
|
+
res = _context11.sent;
|
|
844
1172
|
|
|
845
1173
|
if (!(res.data.statusCode === 200)) {
|
|
846
|
-
|
|
1174
|
+
_context11.next = 11;
|
|
847
1175
|
break;
|
|
848
1176
|
}
|
|
849
1177
|
|
|
850
1178
|
setMessage("Descripciones guardadas con éxito");
|
|
851
|
-
|
|
1179
|
+
_context11.next = 11;
|
|
852
1180
|
return loadData();
|
|
853
1181
|
|
|
854
1182
|
case 11:
|
|
855
|
-
|
|
1183
|
+
_context11.next = 16;
|
|
856
1184
|
break;
|
|
857
1185
|
|
|
858
1186
|
case 13:
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
console.log(
|
|
1187
|
+
_context11.prev = 13;
|
|
1188
|
+
_context11.t0 = _context11["catch"](3);
|
|
1189
|
+
console.log(_context11.t0);
|
|
862
1190
|
|
|
863
1191
|
case 16:
|
|
864
1192
|
case "end":
|
|
865
|
-
return
|
|
1193
|
+
return _context11.stop();
|
|
866
1194
|
}
|
|
867
1195
|
}
|
|
868
|
-
},
|
|
1196
|
+
}, _callee11, null, [[3, 13]]);
|
|
869
1197
|
}));
|
|
870
1198
|
|
|
871
1199
|
return function saveDescriptions() {
|
|
872
|
-
return
|
|
1200
|
+
return _ref9.apply(this, arguments);
|
|
873
1201
|
};
|
|
874
1202
|
}();
|
|
875
1203
|
|
|
876
1204
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
877
|
-
var
|
|
1205
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
878
1206
|
var dataObject, res;
|
|
879
|
-
return _regenerator.default.wrap(function
|
|
1207
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
880
1208
|
while (1) {
|
|
881
|
-
switch (
|
|
1209
|
+
switch (_context12.prev = _context12.next) {
|
|
882
1210
|
case 0:
|
|
883
1211
|
setLoading(true);
|
|
884
1212
|
dataObject = {
|
|
@@ -886,8 +1214,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
886
1214
|
articleData: updatedDatasheets
|
|
887
1215
|
};
|
|
888
1216
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
889
|
-
|
|
890
|
-
|
|
1217
|
+
_context12.prev = 3;
|
|
1218
|
+
_context12.next = 6;
|
|
891
1219
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
892
1220
|
headers: {
|
|
893
1221
|
Authorization: token
|
|
@@ -895,47 +1223,47 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
895
1223
|
});
|
|
896
1224
|
|
|
897
1225
|
case 6:
|
|
898
|
-
res =
|
|
1226
|
+
res = _context12.sent;
|
|
899
1227
|
|
|
900
1228
|
if (!(res.data.statusCode === 200)) {
|
|
901
|
-
|
|
1229
|
+
_context12.next = 11;
|
|
902
1230
|
break;
|
|
903
1231
|
}
|
|
904
1232
|
|
|
905
1233
|
setMessage("Fichas técnicas guardadas");
|
|
906
|
-
|
|
1234
|
+
_context12.next = 11;
|
|
907
1235
|
return loadData();
|
|
908
1236
|
|
|
909
1237
|
case 11:
|
|
910
|
-
|
|
1238
|
+
_context12.next = 16;
|
|
911
1239
|
break;
|
|
912
1240
|
|
|
913
1241
|
case 13:
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
console.log(
|
|
1242
|
+
_context12.prev = 13;
|
|
1243
|
+
_context12.t0 = _context12["catch"](3);
|
|
1244
|
+
console.log(_context12.t0);
|
|
917
1245
|
|
|
918
1246
|
case 16:
|
|
919
1247
|
case "end":
|
|
920
|
-
return
|
|
1248
|
+
return _context12.stop();
|
|
921
1249
|
}
|
|
922
1250
|
}
|
|
923
|
-
},
|
|
1251
|
+
}, _callee12, null, [[3, 13]]);
|
|
924
1252
|
}));
|
|
925
1253
|
|
|
926
1254
|
return function saveDatasheets() {
|
|
927
|
-
return
|
|
1255
|
+
return _ref10.apply(this, arguments);
|
|
928
1256
|
};
|
|
929
1257
|
}();
|
|
930
1258
|
|
|
931
|
-
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1259
|
+
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
932
1260
|
var _images$values2, _data$articleData, _data$articleData2, _data$updateImages;
|
|
933
1261
|
|
|
934
1262
|
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
935
1263
|
|
|
936
|
-
return _regenerator.default.wrap(function
|
|
1264
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
937
1265
|
while (1) {
|
|
938
|
-
switch (
|
|
1266
|
+
switch (_context13.prev = _context13.next) {
|
|
939
1267
|
case 0:
|
|
940
1268
|
imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
|
|
941
1269
|
imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
|
|
@@ -984,19 +1312,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
984
1312
|
}
|
|
985
1313
|
|
|
986
1314
|
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
987
|
-
|
|
1315
|
+
_context13.next = 31;
|
|
988
1316
|
break;
|
|
989
1317
|
}
|
|
990
1318
|
|
|
991
1319
|
setLoading(true);
|
|
992
|
-
|
|
1320
|
+
_context13.prev = 11;
|
|
993
1321
|
data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
|
|
994
1322
|
e.uuid = (0, _uuid.v4)();
|
|
995
1323
|
});
|
|
996
1324
|
setDataImages(data);
|
|
997
1325
|
|
|
998
1326
|
if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
|
|
999
|
-
|
|
1327
|
+
_context13.next = 23;
|
|
1000
1328
|
break;
|
|
1001
1329
|
}
|
|
1002
1330
|
|
|
@@ -1012,28 +1340,28 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1012
1340
|
};
|
|
1013
1341
|
promiseArray.push(myBucket.putObject(params).promise());
|
|
1014
1342
|
});
|
|
1015
|
-
|
|
1343
|
+
_context13.next = 20;
|
|
1016
1344
|
return Promise.all(promiseArray);
|
|
1017
1345
|
|
|
1018
1346
|
case 20:
|
|
1019
1347
|
setImagesUploaded(true);
|
|
1020
|
-
|
|
1348
|
+
_context13.next = 24;
|
|
1021
1349
|
break;
|
|
1022
1350
|
|
|
1023
1351
|
case 23:
|
|
1024
1352
|
setImagesUploaded(true);
|
|
1025
1353
|
|
|
1026
1354
|
case 24:
|
|
1027
|
-
|
|
1355
|
+
_context13.next = 29;
|
|
1028
1356
|
break;
|
|
1029
1357
|
|
|
1030
1358
|
case 26:
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
console.log(
|
|
1359
|
+
_context13.prev = 26;
|
|
1360
|
+
_context13.t0 = _context13["catch"](11);
|
|
1361
|
+
console.log(_context13.t0); // setMainLoading(false);
|
|
1034
1362
|
|
|
1035
1363
|
case 29:
|
|
1036
|
-
|
|
1364
|
+
_context13.next = 32;
|
|
1037
1365
|
break;
|
|
1038
1366
|
|
|
1039
1367
|
case 31:
|
|
@@ -1042,19 +1370,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1042
1370
|
|
|
1043
1371
|
case 32:
|
|
1044
1372
|
case "end":
|
|
1045
|
-
return
|
|
1373
|
+
return _context13.stop();
|
|
1046
1374
|
}
|
|
1047
1375
|
}
|
|
1048
|
-
},
|
|
1376
|
+
}, _callee13, null, [[11, 26]]);
|
|
1049
1377
|
})), [images, imagesUploaded]);
|
|
1050
|
-
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1378
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
1051
1379
|
var res;
|
|
1052
|
-
return _regenerator.default.wrap(function
|
|
1380
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
1053
1381
|
while (1) {
|
|
1054
|
-
switch (
|
|
1382
|
+
switch (_context14.prev = _context14.next) {
|
|
1055
1383
|
case 0:
|
|
1056
1384
|
if (!imagesUploaded) {
|
|
1057
|
-
|
|
1385
|
+
_context14.next = 16;
|
|
1058
1386
|
break;
|
|
1059
1387
|
}
|
|
1060
1388
|
|
|
@@ -1066,8 +1394,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1066
1394
|
if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1067
1395
|
return e;
|
|
1068
1396
|
});
|
|
1069
|
-
|
|
1070
|
-
|
|
1397
|
+
_context14.prev = 2;
|
|
1398
|
+
_context14.next = 5;
|
|
1071
1399
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
|
|
1072
1400
|
headers: {
|
|
1073
1401
|
Authorization: token
|
|
@@ -1075,33 +1403,33 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1075
1403
|
});
|
|
1076
1404
|
|
|
1077
1405
|
case 5:
|
|
1078
|
-
res =
|
|
1406
|
+
res = _context14.sent;
|
|
1079
1407
|
|
|
1080
1408
|
if (!(res.data.statusCode === 200)) {
|
|
1081
|
-
|
|
1409
|
+
_context14.next = 11;
|
|
1082
1410
|
break;
|
|
1083
1411
|
}
|
|
1084
1412
|
|
|
1085
1413
|
setMessage("Imágenes guardadas con éxito");
|
|
1086
1414
|
sessionStorage.removeItem("imagesList");
|
|
1087
|
-
|
|
1415
|
+
_context14.next = 11;
|
|
1088
1416
|
return loadData();
|
|
1089
1417
|
|
|
1090
1418
|
case 11:
|
|
1091
|
-
|
|
1419
|
+
_context14.next = 16;
|
|
1092
1420
|
break;
|
|
1093
1421
|
|
|
1094
1422
|
case 13:
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
console.log(
|
|
1423
|
+
_context14.prev = 13;
|
|
1424
|
+
_context14.t0 = _context14["catch"](2);
|
|
1425
|
+
console.log(_context14.t0);
|
|
1098
1426
|
|
|
1099
1427
|
case 16:
|
|
1100
1428
|
case "end":
|
|
1101
|
-
return
|
|
1429
|
+
return _context14.stop();
|
|
1102
1430
|
}
|
|
1103
1431
|
}
|
|
1104
|
-
},
|
|
1432
|
+
}, _callee14, null, [[2, 13]]);
|
|
1105
1433
|
})), [dataImages, imagesUploaded]);
|
|
1106
1434
|
|
|
1107
1435
|
var getConcept = function getConcept(tab) {
|
|
@@ -1117,74 +1445,43 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1117
1445
|
}
|
|
1118
1446
|
};
|
|
1119
1447
|
|
|
1120
|
-
var getSectionIcon = function getSectionIcon() {
|
|
1121
|
-
switch (activeTab) {
|
|
1122
|
-
case "Ficha técnica":
|
|
1123
|
-
setIcon(_attributesSent.default);
|
|
1124
|
-
break;
|
|
1125
|
-
|
|
1126
|
-
case "Descripción":
|
|
1127
|
-
setIcon(_descriptionSent.default);
|
|
1128
|
-
break;
|
|
1129
|
-
|
|
1130
|
-
case "Imágenes0,,":
|
|
1131
|
-
setIcon(_uploadingImages.default);
|
|
1132
|
-
break;
|
|
1133
|
-
|
|
1134
|
-
default:
|
|
1135
|
-
break;
|
|
1136
|
-
}
|
|
1137
|
-
};
|
|
1138
|
-
|
|
1139
1448
|
var createComment = /*#__PURE__*/function () {
|
|
1140
|
-
var
|
|
1141
|
-
var
|
|
1142
|
-
|
|
1449
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
1450
|
+
var messages,
|
|
1451
|
+
retailerId,
|
|
1452
|
+
data,
|
|
1453
|
+
_args15 = arguments;
|
|
1454
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
1143
1455
|
while (1) {
|
|
1144
|
-
switch (
|
|
1456
|
+
switch (_context15.prev = _context15.next) {
|
|
1145
1457
|
case 0:
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
_context9.next = _context9.t0 === "Ficha técnica" ? 4 : _context9.t0 === "Imágenes" ? 6 : 8;
|
|
1149
|
-
break;
|
|
1150
|
-
|
|
1151
|
-
case 4:
|
|
1152
|
-
concept = "datasheet";
|
|
1153
|
-
return _context9.abrupt("break", 10);
|
|
1154
|
-
|
|
1155
|
-
case 6:
|
|
1156
|
-
concept = "images";
|
|
1157
|
-
return _context9.abrupt("break", 10);
|
|
1158
|
-
|
|
1159
|
-
case 8:
|
|
1160
|
-
concept = "description";
|
|
1161
|
-
return _context9.abrupt("break", 10);
|
|
1162
|
-
|
|
1163
|
-
case 10:
|
|
1458
|
+
messages = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : [];
|
|
1459
|
+
retailerId = _args15.length > 1 ? _args15[1] : undefined;
|
|
1164
1460
|
data = {
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
headers: {
|
|
1461
|
+
paramsBody: {
|
|
1462
|
+
id: product.article.id_article || productEdit.ArticleId,
|
|
1463
|
+
version: version,
|
|
1464
|
+
items: messages,
|
|
1465
|
+
retailerId: retailerId,
|
|
1466
|
+
status: product.status || productEdit.product.status
|
|
1467
|
+
},
|
|
1468
|
+
paramsHeader: {
|
|
1174
1469
|
Authorization: token
|
|
1175
1470
|
}
|
|
1176
|
-
}
|
|
1471
|
+
};
|
|
1472
|
+
setMessage("");
|
|
1473
|
+
return _context15.abrupt("return", (0, _utils.sendMessage)(data));
|
|
1177
1474
|
|
|
1178
|
-
case
|
|
1475
|
+
case 5:
|
|
1179
1476
|
case "end":
|
|
1180
|
-
return
|
|
1477
|
+
return _context15.stop();
|
|
1181
1478
|
}
|
|
1182
1479
|
}
|
|
1183
|
-
},
|
|
1480
|
+
}, _callee15);
|
|
1184
1481
|
}));
|
|
1185
1482
|
|
|
1186
|
-
return function createComment(
|
|
1187
|
-
return
|
|
1483
|
+
return function createComment() {
|
|
1484
|
+
return _ref13.apply(this, arguments);
|
|
1188
1485
|
};
|
|
1189
1486
|
}();
|
|
1190
1487
|
|
|
@@ -1193,16 +1490,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1193
1490
|
}, [activeTab]);
|
|
1194
1491
|
|
|
1195
1492
|
var commentRevised = /*#__PURE__*/function () {
|
|
1196
|
-
var
|
|
1493
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
1197
1494
|
var data;
|
|
1198
|
-
return _regenerator.default.wrap(function
|
|
1495
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
1199
1496
|
while (1) {
|
|
1200
|
-
switch (
|
|
1497
|
+
switch (_context16.prev = _context16.next) {
|
|
1201
1498
|
case 0:
|
|
1202
1499
|
data = {
|
|
1203
1500
|
commentId: comment.id
|
|
1204
1501
|
};
|
|
1205
|
-
|
|
1502
|
+
_context16.next = 3;
|
|
1206
1503
|
return _axios.default.put("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1207
1504
|
headers: {
|
|
1208
1505
|
Authorization: token
|
|
@@ -1214,40 +1511,40 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1214
1511
|
|
|
1215
1512
|
case 4:
|
|
1216
1513
|
case "end":
|
|
1217
|
-
return
|
|
1514
|
+
return _context16.stop();
|
|
1218
1515
|
}
|
|
1219
1516
|
}
|
|
1220
|
-
},
|
|
1517
|
+
}, _callee16);
|
|
1221
1518
|
}));
|
|
1222
1519
|
|
|
1223
1520
|
return function commentRevised() {
|
|
1224
|
-
return
|
|
1521
|
+
return _ref14.apply(this, arguments);
|
|
1225
1522
|
};
|
|
1226
1523
|
}();
|
|
1227
1524
|
|
|
1228
1525
|
var setAssignation = /*#__PURE__*/function () {
|
|
1229
|
-
var
|
|
1526
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(assignationType, assignationId) {
|
|
1230
1527
|
var concept, productTemp, data;
|
|
1231
|
-
return _regenerator.default.wrap(function
|
|
1528
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
1232
1529
|
while (1) {
|
|
1233
|
-
switch (
|
|
1530
|
+
switch (_context17.prev = _context17.next) {
|
|
1234
1531
|
case 0:
|
|
1235
1532
|
concept = "";
|
|
1236
|
-
|
|
1237
|
-
|
|
1533
|
+
_context17.t0 = activeTab;
|
|
1534
|
+
_context17.next = _context17.t0 === "Ficha técnica" ? 4 : _context17.t0 === "Imágenes" ? 6 : 8;
|
|
1238
1535
|
break;
|
|
1239
1536
|
|
|
1240
1537
|
case 4:
|
|
1241
1538
|
concept = "datasheet";
|
|
1242
|
-
return
|
|
1539
|
+
return _context17.abrupt("break", 10);
|
|
1243
1540
|
|
|
1244
1541
|
case 6:
|
|
1245
1542
|
concept = "images";
|
|
1246
|
-
return
|
|
1543
|
+
return _context17.abrupt("break", 10);
|
|
1247
1544
|
|
|
1248
1545
|
case 8:
|
|
1249
1546
|
concept = "description";
|
|
1250
|
-
return
|
|
1547
|
+
return _context17.abrupt("break", 10);
|
|
1251
1548
|
|
|
1252
1549
|
case 10:
|
|
1253
1550
|
productTemp = product;
|
|
@@ -1260,7 +1557,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1260
1557
|
concept: concept,
|
|
1261
1558
|
userId: assignationId
|
|
1262
1559
|
};
|
|
1263
|
-
|
|
1560
|
+
_context17.next = 15;
|
|
1264
1561
|
return (0, _axios.default)({
|
|
1265
1562
|
method: "post",
|
|
1266
1563
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
@@ -1276,35 +1573,17 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1276
1573
|
|
|
1277
1574
|
case 17:
|
|
1278
1575
|
case "end":
|
|
1279
|
-
return
|
|
1576
|
+
return _context17.stop();
|
|
1280
1577
|
}
|
|
1281
1578
|
}
|
|
1282
|
-
},
|
|
1579
|
+
}, _callee17);
|
|
1283
1580
|
}));
|
|
1284
1581
|
|
|
1285
|
-
return function setAssignation(
|
|
1286
|
-
return
|
|
1582
|
+
return function setAssignation(_x4, _x5) {
|
|
1583
|
+
return _ref15.apply(this, arguments);
|
|
1287
1584
|
};
|
|
1288
1585
|
}();
|
|
1289
1586
|
|
|
1290
|
-
var evaluationComplete = function evaluationComplete(tab) {
|
|
1291
|
-
var concept = getConcept(tab);
|
|
1292
|
-
var serv = servicesData.filter(function (item) {
|
|
1293
|
-
return item.service === concept;
|
|
1294
|
-
});
|
|
1295
|
-
|
|
1296
|
-
if (["RequestWithContentoh", "RequestWithoutContentoh"].includes(origin[tab])) {
|
|
1297
|
-
serv = serv.filter(function (f) {
|
|
1298
|
-
return f.id_retailer === activeRetailer.id;
|
|
1299
|
-
});
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
var statusArray = user.is_retailer === 1 ? ["ACA", "RCA"] : ["AP", "RP", "ACA"];
|
|
1303
|
-
return serv.length > 0 && serv.every(function (item) {
|
|
1304
|
-
return statusArray.includes(item.status);
|
|
1305
|
-
});
|
|
1306
|
-
};
|
|
1307
|
-
|
|
1308
1587
|
var downloadImages = function downloadImages() {
|
|
1309
1588
|
var _images$values3;
|
|
1310
1589
|
|
|
@@ -1384,33 +1663,21 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1384
1663
|
}
|
|
1385
1664
|
};
|
|
1386
1665
|
|
|
1387
|
-
var confirmStatusComplete = function confirmStatusComplete() {
|
|
1388
|
-
var datasheet_status = product.datasheet_status,
|
|
1389
|
-
description_status = product.description_status,
|
|
1390
|
-
images_status = product.images_status;
|
|
1391
|
-
var completionStates = user.is_retailer === 1 ? ["ACA", "Evaluated", "NS"] : ["AP", "Evaluated", "NS"];
|
|
1392
|
-
var dsEvaluated = completionStates.includes(datasheet_status);
|
|
1393
|
-
var descsEvaluated = completionStates.includes(description_status);
|
|
1394
|
-
var imgsEvaluated = completionStates.includes(images_status);
|
|
1395
|
-
var AllEvaluated = dsEvaluated && descsEvaluated && imgsEvaluated;
|
|
1396
|
-
return AllEvaluated;
|
|
1397
|
-
};
|
|
1398
|
-
|
|
1399
1666
|
var sendEvaluation = /*#__PURE__*/function () {
|
|
1400
|
-
var
|
|
1401
|
-
var _productTemp$
|
|
1667
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(result) {
|
|
1668
|
+
var _productTemp$id_order2;
|
|
1402
1669
|
|
|
1403
|
-
var concept, productTemp, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, res, newStatuses, orderStatus, serviceStatus, newProductEdit, showSurveyByProvider, showSurveyByRetailer, _JSON$parse, newArticleStatus, newServiceStatus, newStatus, retailerStatusCopy, status;
|
|
1670
|
+
var concept, productTemp, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, res, newStatuses, orderStatus, serviceStatus, newProductEdit, showSurveyByProvider, showSurveyByRetailer, _JSON$parse, newArticleStatus, newServiceStatus, newStatus, _message, messageData, retailerStatusCopy, status;
|
|
1404
1671
|
|
|
1405
|
-
return _regenerator.default.wrap(function
|
|
1672
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
1406
1673
|
while (1) {
|
|
1407
|
-
switch (
|
|
1674
|
+
switch (_context18.prev = _context18.next) {
|
|
1408
1675
|
case 0:
|
|
1409
1676
|
setLoading(true);
|
|
1410
1677
|
concept = getConcept(activeTab);
|
|
1411
1678
|
productTemp = product;
|
|
1412
1679
|
articleId = productTemp.id_article;
|
|
1413
|
-
orderId = (_productTemp$
|
|
1680
|
+
orderId = (_productTemp$id_order2 = productTemp.id_order) !== null && _productTemp$id_order2 !== void 0 ? _productTemp$id_order2 : productTemp.orderId;
|
|
1414
1681
|
sectionStatusKey = "".concat(getConcept(activeTab), "_status");
|
|
1415
1682
|
evalStatus = product[sectionStatusKey] || (product === null || product === void 0 ? void 0 : product.version_status);
|
|
1416
1683
|
data = {
|
|
@@ -1420,16 +1687,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1420
1687
|
evalStatus: evalStatus
|
|
1421
1688
|
};
|
|
1422
1689
|
retailerId = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id;
|
|
1423
|
-
|
|
1690
|
+
_context18.prev = 9;
|
|
1424
1691
|
|
|
1425
1692
|
if (!result) {
|
|
1426
|
-
|
|
1693
|
+
_context18.next = 27;
|
|
1427
1694
|
break;
|
|
1428
1695
|
}
|
|
1429
1696
|
|
|
1430
1697
|
data.result = result;
|
|
1431
1698
|
data.retailerId = retailerId;
|
|
1432
|
-
|
|
1699
|
+
_context18.next = 15;
|
|
1433
1700
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1434
1701
|
headers: {
|
|
1435
1702
|
Authorization: token
|
|
@@ -1437,7 +1704,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1437
1704
|
});
|
|
1438
1705
|
|
|
1439
1706
|
case 15:
|
|
1440
|
-
res =
|
|
1707
|
+
res = _context18.sent;
|
|
1441
1708
|
newStatuses = JSON.parse(res.data.body);
|
|
1442
1709
|
orderStatus = newStatuses.newOrderStatus;
|
|
1443
1710
|
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(getConcept(activeTab), "Status")];
|
|
@@ -1447,11 +1714,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1447
1714
|
showSurveyByProvider = !user.is_retailer && orderStatus[orderId] === "AP";
|
|
1448
1715
|
showSurveyByRetailer = user.is_retailer && orderStatus[orderId] === "ACA";
|
|
1449
1716
|
showSurvey && showSurvey(showSurveyByProvider || showSurveyByRetailer);
|
|
1450
|
-
|
|
1717
|
+
_context18.next = 30;
|
|
1451
1718
|
break;
|
|
1452
1719
|
|
|
1453
1720
|
case 27:
|
|
1454
|
-
|
|
1721
|
+
_context18.next = 29;
|
|
1455
1722
|
return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1456
1723
|
headers: {
|
|
1457
1724
|
Authorization: token
|
|
@@ -1459,62 +1726,86 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1459
1726
|
});
|
|
1460
1727
|
|
|
1461
1728
|
case 29:
|
|
1462
|
-
res =
|
|
1729
|
+
res = _context18.sent;
|
|
1463
1730
|
|
|
1464
1731
|
case 30:
|
|
1465
|
-
if (res.data.statusCode === 200) {
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1732
|
+
if (!(res.data.statusCode === 200)) {
|
|
1733
|
+
_context18.next = 45;
|
|
1734
|
+
break;
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
_JSON$parse = JSON.parse(res.data.body), newArticleStatus = _JSON$parse.newArticleStatus, newServiceStatus = _JSON$parse.newServiceStatus, newStatus = _JSON$parse.newStatus;
|
|
1738
|
+
_message = (0, _utils.createMessage)(product.retailers || product.retailersAvailable, activeRetailer.id, product[sectionStatusKey], newStatus, activeTab);
|
|
1739
|
+
messageData = {
|
|
1740
|
+
paramsBody: {
|
|
1741
|
+
id: product.article.id_article || productEdit.ArticleId,
|
|
1742
|
+
version: version,
|
|
1743
|
+
items: [{
|
|
1744
|
+
type: "status",
|
|
1745
|
+
value: _message
|
|
1746
|
+
}],
|
|
1747
|
+
retailerId: activeRetailer.id,
|
|
1748
|
+
status: product.status || productEdit.product.status
|
|
1749
|
+
},
|
|
1750
|
+
paramsHeader: {
|
|
1751
|
+
Authorization: token
|
|
1476
1752
|
}
|
|
1753
|
+
};
|
|
1754
|
+
_context18.next = 36;
|
|
1755
|
+
return (0, _utils.sendMessage)(messageData);
|
|
1477
1756
|
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1757
|
+
case 36:
|
|
1758
|
+
if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
|
|
1759
|
+
retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
|
|
1760
|
+
retailerStatusCopy[activeRetailer.id][concept] = newStatus;
|
|
1761
|
+
setRetailerStatus(retailerStatusCopy);
|
|
1762
|
+
productTemp.statusByRetailer = retailerStatusCopy;
|
|
1763
|
+
|
|
1764
|
+
if (newServiceStatus) {
|
|
1765
|
+
status = newServiceStatus[articleId]["".concat(concept, "Status")];
|
|
1766
|
+
productTemp["".concat(concept, "_status")] = status;
|
|
1483
1767
|
}
|
|
1484
1768
|
|
|
1485
|
-
|
|
1769
|
+
setProduct(productTemp);
|
|
1770
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1771
|
+
setOrigin(function (prev) {
|
|
1772
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, concept, status));
|
|
1773
|
+
});
|
|
1774
|
+
|
|
1775
|
+
case 45:
|
|
1776
|
+
_context18.next = 50;
|
|
1486
1777
|
break;
|
|
1487
1778
|
|
|
1488
|
-
case
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
console.log(
|
|
1779
|
+
case 47:
|
|
1780
|
+
_context18.prev = 47;
|
|
1781
|
+
_context18.t0 = _context18["catch"](9);
|
|
1782
|
+
console.log(_context18.t0);
|
|
1492
1783
|
|
|
1493
|
-
case
|
|
1784
|
+
case 50:
|
|
1494
1785
|
loadData();
|
|
1495
1786
|
|
|
1496
|
-
case
|
|
1787
|
+
case 51:
|
|
1497
1788
|
case "end":
|
|
1498
|
-
return
|
|
1789
|
+
return _context18.stop();
|
|
1499
1790
|
}
|
|
1500
1791
|
}
|
|
1501
|
-
},
|
|
1792
|
+
}, _callee18, null, [[9, 47]]);
|
|
1502
1793
|
}));
|
|
1503
1794
|
|
|
1504
|
-
return function sendEvaluation(
|
|
1505
|
-
return
|
|
1795
|
+
return function sendEvaluation(_x6) {
|
|
1796
|
+
return _ref16.apply(this, arguments);
|
|
1506
1797
|
};
|
|
1507
1798
|
}();
|
|
1508
1799
|
|
|
1509
1800
|
var validateAll = /*#__PURE__*/function () {
|
|
1510
|
-
var
|
|
1511
|
-
var _product$id_order2, evaluationArray, conceptArray, dataGeneral,
|
|
1801
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(result) {
|
|
1802
|
+
var _product$id_order2, evaluationArray, conceptArray, dataGeneral, messages, userType, productTemp, status, retailerStatusCopy;
|
|
1512
1803
|
|
|
1513
|
-
return _regenerator.default.wrap(function
|
|
1804
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
1514
1805
|
while (1) {
|
|
1515
|
-
switch (
|
|
1806
|
+
switch (_context19.prev = _context19.next) {
|
|
1516
1807
|
case 0:
|
|
1517
|
-
|
|
1808
|
+
_context19.prev = 0;
|
|
1518
1809
|
setLoading(true);
|
|
1519
1810
|
evaluationArray = [];
|
|
1520
1811
|
conceptArray = ["description", "datasheet", "images"];
|
|
@@ -1524,6 +1815,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1524
1815
|
result: result,
|
|
1525
1816
|
isAproved: result === "A"
|
|
1526
1817
|
};
|
|
1818
|
+
messages = [];
|
|
1527
1819
|
servicesData === null || servicesData === void 0 ? void 0 : servicesData.forEach(function (ret) {
|
|
1528
1820
|
var service = ret.service,
|
|
1529
1821
|
id_retailer = ret.id_retailer;
|
|
@@ -1538,23 +1830,32 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1538
1830
|
Authorization: token
|
|
1539
1831
|
}
|
|
1540
1832
|
}));
|
|
1833
|
+
|
|
1834
|
+
if (product["".concat(ret.service, "_status")] !== "NS") {
|
|
1835
|
+
var _message2 = (0, _utils.createMessage)(product.retailers, ret.id_retailer, product["".concat(ret.service, "_status")], "".concat(result, "A"), ret.service);
|
|
1836
|
+
|
|
1837
|
+
messages.push(createComment([{
|
|
1838
|
+
type: "status",
|
|
1839
|
+
value: _message2
|
|
1840
|
+
}], ret.id_retailer));
|
|
1841
|
+
}
|
|
1541
1842
|
});
|
|
1542
|
-
|
|
1843
|
+
_context19.next = 9;
|
|
1543
1844
|
return Promise.all(evaluationArray);
|
|
1544
1845
|
|
|
1545
|
-
case
|
|
1546
|
-
evalResponse = _context13.sent;
|
|
1846
|
+
case 9:
|
|
1547
1847
|
userType = user.is_retailer === 1 ? "CA" : "P";
|
|
1548
1848
|
productTemp = product;
|
|
1549
|
-
|
|
1550
|
-
productTemp.
|
|
1551
|
-
productTemp.
|
|
1552
|
-
productTemp.
|
|
1849
|
+
status = "".concat(result).concat(userType);
|
|
1850
|
+
productTemp.article_status = status;
|
|
1851
|
+
productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : status;
|
|
1852
|
+
productTemp.description_status = productTemp.description_status === "NA" ? "NA" : status;
|
|
1853
|
+
productTemp.images_status = productTemp.images_status === "NA" ? "NA" : status;
|
|
1553
1854
|
retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
|
|
1554
1855
|
Object.keys(retailerStatusCopy).forEach(function (key) {
|
|
1555
1856
|
conceptArray.forEach(function (concept) {
|
|
1556
1857
|
if (retailerStatusCopy[key][concept]) {
|
|
1557
|
-
retailerStatusCopy[key][concept] =
|
|
1858
|
+
retailerStatusCopy[key][concept] = status;
|
|
1558
1859
|
}
|
|
1559
1860
|
});
|
|
1560
1861
|
});
|
|
@@ -1572,37 +1873,41 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1572
1873
|
idCategory: productTemp.article.id_category,
|
|
1573
1874
|
product: productTemp
|
|
1574
1875
|
}));
|
|
1575
|
-
|
|
1876
|
+
_context19.next = 26;
|
|
1877
|
+
return Promise.all(messages);
|
|
1878
|
+
|
|
1879
|
+
case 26:
|
|
1880
|
+
_context19.next = 28;
|
|
1576
1881
|
return loadData();
|
|
1577
1882
|
|
|
1578
|
-
case
|
|
1579
|
-
|
|
1883
|
+
case 28:
|
|
1884
|
+
_context19.next = 33;
|
|
1580
1885
|
break;
|
|
1581
1886
|
|
|
1582
|
-
case 27:
|
|
1583
|
-
_context13.prev = 27;
|
|
1584
|
-
_context13.t0 = _context13["catch"](0);
|
|
1585
|
-
console.log(_context13.t0);
|
|
1586
|
-
|
|
1587
1887
|
case 30:
|
|
1888
|
+
_context19.prev = 30;
|
|
1889
|
+
_context19.t0 = _context19["catch"](0);
|
|
1890
|
+
console.log(_context19.t0);
|
|
1891
|
+
|
|
1892
|
+
case 33:
|
|
1588
1893
|
case "end":
|
|
1589
|
-
return
|
|
1894
|
+
return _context19.stop();
|
|
1590
1895
|
}
|
|
1591
1896
|
}
|
|
1592
|
-
},
|
|
1897
|
+
}, _callee19, null, [[0, 30]]);
|
|
1593
1898
|
}));
|
|
1594
1899
|
|
|
1595
|
-
return function validateAll(
|
|
1596
|
-
return
|
|
1900
|
+
return function validateAll(_x7) {
|
|
1901
|
+
return _ref17.apply(this, arguments);
|
|
1597
1902
|
};
|
|
1598
1903
|
}();
|
|
1599
1904
|
|
|
1600
1905
|
var evaluationToRetailer = /*#__PURE__*/function () {
|
|
1601
|
-
var
|
|
1906
|
+
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(result) {
|
|
1602
1907
|
var data, prod, statusComplete;
|
|
1603
|
-
return _regenerator.default.wrap(function
|
|
1908
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
1604
1909
|
while (1) {
|
|
1605
|
-
switch (
|
|
1910
|
+
switch (_context20.prev = _context20.next) {
|
|
1606
1911
|
case 0:
|
|
1607
1912
|
data = {
|
|
1608
1913
|
articleId: product.id_article,
|
|
@@ -1610,7 +1915,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1610
1915
|
versionId: product.version,
|
|
1611
1916
|
status: result
|
|
1612
1917
|
};
|
|
1613
|
-
|
|
1918
|
+
_context20.next = 3;
|
|
1614
1919
|
return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
|
|
1615
1920
|
headers: {
|
|
1616
1921
|
Authorization: token
|
|
@@ -1627,20 +1932,20 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1627
1932
|
prod.product.services_status = "[\"".concat(statusComplete, "\",\"").concat(statusComplete, "\",\"").concat(statusComplete, "\"]");
|
|
1628
1933
|
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
1629
1934
|
setProduct(prod);
|
|
1630
|
-
|
|
1631
|
-
|
|
1935
|
+
showGlobalModal("generic");
|
|
1936
|
+
_context20.next = 15;
|
|
1632
1937
|
return loadData();
|
|
1633
1938
|
|
|
1634
1939
|
case 15:
|
|
1635
1940
|
case "end":
|
|
1636
|
-
return
|
|
1941
|
+
return _context20.stop();
|
|
1637
1942
|
}
|
|
1638
1943
|
}
|
|
1639
|
-
},
|
|
1944
|
+
}, _callee20);
|
|
1640
1945
|
}));
|
|
1641
1946
|
|
|
1642
|
-
return function evaluationToRetailer(
|
|
1643
|
-
return
|
|
1947
|
+
return function evaluationToRetailer(_x8) {
|
|
1948
|
+
return _ref18.apply(this, arguments);
|
|
1644
1949
|
};
|
|
1645
1950
|
}();
|
|
1646
1951
|
|
|
@@ -1698,7 +2003,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1698
2003
|
}
|
|
1699
2004
|
});
|
|
1700
2005
|
});
|
|
1701
|
-
|
|
2006
|
+
showGlobalModal("generic");
|
|
1702
2007
|
} else if (user.is_retailer) {
|
|
1703
2008
|
if (product.id_order || product.orderId) {
|
|
1704
2009
|
sendEvaluation("A");
|
|
@@ -1713,7 +2018,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1713
2018
|
}
|
|
1714
2019
|
});
|
|
1715
2020
|
});
|
|
1716
|
-
|
|
2021
|
+
showGlobalModal("generic");
|
|
1717
2022
|
}
|
|
1718
2023
|
} else {
|
|
1719
2024
|
sendEvaluation("A");
|
|
@@ -1723,8 +2028,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1723
2028
|
return;
|
|
1724
2029
|
} else if (user.is_retailer) {
|
|
1725
2030
|
if (product.id_order || product.orderId) {
|
|
1726
|
-
|
|
1727
|
-
setModalViewError(true);
|
|
2031
|
+
sendEvaluation("R");
|
|
1728
2032
|
} else {
|
|
1729
2033
|
setDataGenericModal(function (prev) {
|
|
1730
2034
|
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
@@ -1736,11 +2040,10 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1736
2040
|
}
|
|
1737
2041
|
});
|
|
1738
2042
|
});
|
|
1739
|
-
|
|
2043
|
+
showGlobalModal("generic");
|
|
1740
2044
|
}
|
|
1741
2045
|
} else {
|
|
1742
|
-
|
|
1743
|
-
setModalViewError(true);
|
|
2046
|
+
sendEvaluation("R");
|
|
1744
2047
|
}
|
|
1745
2048
|
}
|
|
1746
2049
|
};
|
|
@@ -1750,6 +2053,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1750
2053
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
1751
2054
|
setHeaderTop: setHeaderTop,
|
|
1752
2055
|
withChat: location === null || location === void 0 ? void 0 : (_location$state2 = location.state) === null || _location$state2 === void 0 ? void 0 : _location$state2.withChat,
|
|
2056
|
+
chatType: location === null || location === void 0 ? void 0 : (_location$state3 = location.state) === null || _location$state3 === void 0 ? void 0 : _location$state3.chatType,
|
|
1753
2057
|
productSelected: productSelected,
|
|
1754
2058
|
token: token,
|
|
1755
2059
|
activeRetailer: activeRetailer
|
|
@@ -1801,7 +2105,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1801
2105
|
}
|
|
1802
2106
|
});
|
|
1803
2107
|
});
|
|
1804
|
-
|
|
2108
|
+
showGlobalModal("generic");
|
|
1805
2109
|
} else if (user.is_retailer) {
|
|
1806
2110
|
if (product.id_order || product.orderId) {
|
|
1807
2111
|
validateAll("A");
|
|
@@ -1816,7 +2120,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1816
2120
|
}
|
|
1817
2121
|
});
|
|
1818
2122
|
});
|
|
1819
|
-
|
|
2123
|
+
showGlobalModal("generic");
|
|
1820
2124
|
}
|
|
1821
2125
|
} else {
|
|
1822
2126
|
validateAll("A");
|
|
@@ -1828,7 +2132,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1828
2132
|
} else if (user.is_retailer) {
|
|
1829
2133
|
if (product.id_order || product.orderId) {
|
|
1830
2134
|
setValidatedAll(true);
|
|
1831
|
-
|
|
2135
|
+
setShowRejectModal(true);
|
|
1832
2136
|
} else {
|
|
1833
2137
|
setDataGenericModal(function (prev) {
|
|
1834
2138
|
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
@@ -1840,18 +2144,18 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1840
2144
|
}
|
|
1841
2145
|
});
|
|
1842
2146
|
});
|
|
1843
|
-
|
|
2147
|
+
showGlobalModal("generic");
|
|
1844
2148
|
}
|
|
1845
2149
|
} else {
|
|
2150
|
+
setShowRejectModal(true);
|
|
1846
2151
|
setValidatedAll(true);
|
|
1847
|
-
setModalViewError(true);
|
|
1848
2152
|
}
|
|
1849
2153
|
},
|
|
1850
2154
|
approve: function approve() {
|
|
1851
2155
|
return sendToEvaluation("A");
|
|
1852
2156
|
},
|
|
1853
2157
|
reject: function reject() {
|
|
1854
|
-
|
|
2158
|
+
setShowRejectModal(true);
|
|
1855
2159
|
}
|
|
1856
2160
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
|
|
1857
2161
|
tabsSections: tabsSections,
|
|
@@ -1959,20 +2263,20 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1959
2263
|
reviewed: crossComment
|
|
1960
2264
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1961
2265
|
buttonType: "circular-button accept-button",
|
|
1962
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1963
|
-
return _regenerator.default.wrap(function
|
|
2266
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
2267
|
+
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
1964
2268
|
while (1) {
|
|
1965
|
-
switch (
|
|
2269
|
+
switch (_context21.prev = _context21.next) {
|
|
1966
2270
|
case 0:
|
|
1967
2271
|
setCrossComment(true);
|
|
1968
2272
|
commentRevised();
|
|
1969
2273
|
|
|
1970
2274
|
case 2:
|
|
1971
2275
|
case "end":
|
|
1972
|
-
return
|
|
2276
|
+
return _context21.stop();
|
|
1973
2277
|
}
|
|
1974
2278
|
}
|
|
1975
|
-
},
|
|
2279
|
+
}, _callee21);
|
|
1976
2280
|
}))
|
|
1977
2281
|
})]
|
|
1978
2282
|
})
|
|
@@ -2026,64 +2330,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2026
2330
|
onClick: function onClick() {
|
|
2027
2331
|
return setMessage("");
|
|
2028
2332
|
}
|
|
2029
|
-
}),
|
|
2030
|
-
close:
|
|
2031
|
-
|
|
2032
|
-
},
|
|
2033
|
-
message: message,
|
|
2034
|
-
detail: "",
|
|
2035
|
-
bold: !evaluationComplete(activeTab) && "Aprueba / Rechaza",
|
|
2036
|
-
widthImg: !evaluationComplete(activeTab) ? "160px" : "354px",
|
|
2037
|
-
heightImg: !evaluationComplete(activeTab) ? "84px" : "354px",
|
|
2038
|
-
img: getSectionIcon()
|
|
2039
|
-
}), modalViewError && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GlobalModal, {
|
|
2040
|
-
close: function close() {
|
|
2041
|
-
return setModalViewError(false);
|
|
2042
|
-
},
|
|
2043
|
-
message: "".concat(activeTab, " rechazada"),
|
|
2044
|
-
detail: "Agrega tu comentarios para enviar el rechazo",
|
|
2045
|
-
button1: {
|
|
2046
|
-
name: "Enviar",
|
|
2047
|
-
action: function action(e) {
|
|
2048
|
-
var textArea = document.querySelector("#area");
|
|
2049
|
-
|
|
2050
|
-
if (textArea.value) {
|
|
2051
|
-
textArea.style.border = "none";
|
|
2052
|
-
createComment(e, textArea.value);
|
|
2053
|
-
setModalViewError(false);
|
|
2054
|
-
setModalViewTextArea(true);
|
|
2055
|
-
validatedAll ? validateAll("R") : sendEvaluation("R");
|
|
2056
|
-
} else {
|
|
2057
|
-
textArea.style.border = "2px solid red";
|
|
2058
|
-
}
|
|
2059
|
-
}
|
|
2060
|
-
},
|
|
2061
|
-
img: _errorModal.default,
|
|
2062
|
-
textArea: true
|
|
2063
|
-
}), showGenericModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GlobalModal, {
|
|
2064
|
-
close: function close() {
|
|
2065
|
-
return setShowGenericModal(false);
|
|
2066
|
-
},
|
|
2067
|
-
message: dataGenericModal.message,
|
|
2068
|
-
detail: dataGenericModal.detail,
|
|
2069
|
-
button1: dataGenericModal.button1,
|
|
2070
|
-
button2: dataGenericModal.button2,
|
|
2071
|
-
img: dataGenericModal.img
|
|
2072
|
-
}), modalViewTextArea && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GlobalModal, {
|
|
2073
|
-
close: function close() {
|
|
2074
|
-
return setModalViewTextArea(false);
|
|
2075
|
-
},
|
|
2076
|
-
message: "Gracias, tus comentarios fueron entregados.",
|
|
2077
|
-
detail: "Trabajaremos en conjunto para resolverlo.",
|
|
2078
|
-
button1: {
|
|
2079
|
-
name: "Cerrar",
|
|
2080
|
-
action: function action() {
|
|
2081
|
-
return setModalViewTextArea(false);
|
|
2082
|
-
}
|
|
2083
|
-
},
|
|
2084
|
-
img: _defaultProfileImage.default,
|
|
2085
|
-
textArea: false
|
|
2086
|
-
}), showVersionSelector && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VersionSelector.VersionSelector, {
|
|
2333
|
+
}), globalModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GlobalModal, (0, _objectSpread3.default)({
|
|
2334
|
+
close: closeGlobalModal
|
|
2335
|
+
}, globalModal)), showVersionSelector && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VersionSelector.VersionSelector, {
|
|
2087
2336
|
modalId: "version-selector",
|
|
2088
2337
|
articleId: product.id_article,
|
|
2089
2338
|
setVersion: setVersion,
|
|
@@ -2091,6 +2340,53 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2091
2340
|
currentVersion: version,
|
|
2092
2341
|
setShowVersionSelector: setShowVersionSelector,
|
|
2093
2342
|
jwt: token
|
|
2343
|
+
}), showRejectModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
|
|
2344
|
+
title: "Agregar mensaje de rechazo",
|
|
2345
|
+
show: showRejectModal,
|
|
2346
|
+
customComponent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
|
|
2347
|
+
label: "Caja de Comentario",
|
|
2348
|
+
inputType: "textarea",
|
|
2349
|
+
inputId: "modal-message-box",
|
|
2350
|
+
index: 0,
|
|
2351
|
+
color: "white"
|
|
2352
|
+
}),
|
|
2353
|
+
buttons: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
|
|
2354
|
+
type: "white",
|
|
2355
|
+
label: "Cancelar",
|
|
2356
|
+
size: 12,
|
|
2357
|
+
onClick: function onClick() {
|
|
2358
|
+
setShowRejectModal(false);
|
|
2359
|
+
}
|
|
2360
|
+
}, "btn-Cancelar"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
|
|
2361
|
+
type: "pink",
|
|
2362
|
+
label: "Aceptar",
|
|
2363
|
+
size: 12,
|
|
2364
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
2365
|
+
var body, messages;
|
|
2366
|
+
return _regenerator.default.wrap(function _callee22$(_context22) {
|
|
2367
|
+
while (1) {
|
|
2368
|
+
switch (_context22.prev = _context22.next) {
|
|
2369
|
+
case 0:
|
|
2370
|
+
body = document.querySelector("#modal-message-box .ql-container .ql-editor > p").innerHTML;
|
|
2371
|
+
messages = [{
|
|
2372
|
+
type: "message",
|
|
2373
|
+
value: body === null || body === void 0 ? void 0 : body.replace(/<.*?\/?>/gm, "")
|
|
2374
|
+
}];
|
|
2375
|
+
_context22.next = 4;
|
|
2376
|
+
return createComment(messages, activeRetailer.id);
|
|
2377
|
+
|
|
2378
|
+
case 4:
|
|
2379
|
+
validatedAll ? validateAll("R") : sendToEvaluation("R");
|
|
2380
|
+
setShowRejectModal(false);
|
|
2381
|
+
|
|
2382
|
+
case 6:
|
|
2383
|
+
case "end":
|
|
2384
|
+
return _context22.stop();
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
}, _callee22);
|
|
2388
|
+
}))
|
|
2389
|
+
}, "btn-Aceptar")]
|
|
2094
2390
|
})]
|
|
2095
2391
|
});
|
|
2096
2392
|
};
|