contentoh-components-library 21.3.55 → 21.3.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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/organisms/DashboardMetric/dashboardMetricUtils.js +27 -0
- 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 +35 -54
- package/dist/components/pages/Dashboard/index.js +8 -4
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +98 -26
- package/dist/components/pages/ProviderProductEdition/index.js +623 -386
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +103 -153
- package/dist/components/pages/RetailerProductEdition/index.js +33 -35
- 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/organisms/DashboardMetric/dashboardMetricUtils.js +18 -1
- package/src/components/organisms/GlobalModal/styles.js +10 -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 +35 -59
- package/src/components/pages/Dashboard/index.js +4 -3
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +110 -31
- package/src/components/pages/ProviderProductEdition/index.js +244 -131
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +93 -145
- package/src/components/pages/RetailerProductEdition/index.js +24 -22
- 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");
|
|
@@ -227,7 +221,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
227
221
|
revision = _ref$revision === void 0 ? false : _ref$revision,
|
|
228
222
|
setShowContentohRequestModal = _ref.setShowContentohRequestModal,
|
|
229
223
|
showSurvey = _ref.showSurvey,
|
|
230
|
-
company = _ref.company
|
|
224
|
+
company = _ref.company,
|
|
225
|
+
addToCart = _ref.addToCart;
|
|
231
226
|
|
|
232
227
|
var _useState = (0, _react.useState)("Descripción"),
|
|
233
228
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -395,106 +390,84 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
395
390
|
productEdit = _useState38[0],
|
|
396
391
|
setProductEdit = _useState38[1];
|
|
397
392
|
|
|
398
|
-
var _useState39 = (0, _react.useState)(null),
|
|
393
|
+
var _useState39 = (0, _react.useState)(product === null || product === void 0 ? void 0 : product.version),
|
|
399
394
|
_useState40 = (0, _slicedToArray2.default)(_useState39, 2),
|
|
400
|
-
|
|
401
|
-
|
|
395
|
+
version = _useState40[0],
|
|
396
|
+
setVersion = _useState40[1];
|
|
402
397
|
|
|
403
|
-
var _useState41 = (0, _react.useState)(
|
|
404
|
-
_useState42 = (0, _slicedToArray2.default)(_useState41,
|
|
405
|
-
|
|
406
|
-
setVersion = _useState42[1];
|
|
398
|
+
var _useState41 = (0, _react.useState)({}),
|
|
399
|
+
_useState42 = (0, _slicedToArray2.default)(_useState41, 1),
|
|
400
|
+
comments = _useState42[0];
|
|
407
401
|
|
|
408
|
-
var _useState43 = (0, _react.useState)(
|
|
409
|
-
_useState44 = (0, _slicedToArray2.default)(_useState43,
|
|
410
|
-
|
|
402
|
+
var _useState43 = (0, _react.useState)(""),
|
|
403
|
+
_useState44 = (0, _slicedToArray2.default)(_useState43, 2),
|
|
404
|
+
comment = _useState44[0],
|
|
405
|
+
setComment = _useState44[1];
|
|
411
406
|
|
|
412
|
-
var _useState45 = (0, _react.useState)(
|
|
407
|
+
var _useState45 = (0, _react.useState)(false),
|
|
413
408
|
_useState46 = (0, _slicedToArray2.default)(_useState45, 2),
|
|
414
|
-
|
|
415
|
-
|
|
409
|
+
crossComment = _useState46[0],
|
|
410
|
+
setCrossComment = _useState46[1];
|
|
416
411
|
|
|
417
|
-
var _useState47 = (0, _react.useState)(
|
|
412
|
+
var _useState47 = (0, _react.useState)([]),
|
|
418
413
|
_useState48 = (0, _slicedToArray2.default)(_useState47, 2),
|
|
419
|
-
|
|
420
|
-
|
|
414
|
+
userGroups = _useState48[0],
|
|
415
|
+
setUserGroups = _useState48[1];
|
|
421
416
|
|
|
422
|
-
var _useState49 = (0, _react.useState)(
|
|
417
|
+
var _useState49 = (0, _react.useState)({}),
|
|
423
418
|
_useState50 = (0, _slicedToArray2.default)(_useState49, 2),
|
|
424
|
-
|
|
425
|
-
|
|
419
|
+
assig = _useState50[0],
|
|
420
|
+
setAssig = _useState50[1];
|
|
426
421
|
|
|
427
|
-
var _useState51 = (0, _react.useState)(
|
|
422
|
+
var _useState51 = (0, _react.useState)([]),
|
|
428
423
|
_useState52 = (0, _slicedToArray2.default)(_useState51, 2),
|
|
429
|
-
|
|
430
|
-
|
|
424
|
+
selectedImages = _useState52[0],
|
|
425
|
+
setSelectedImages = _useState52[1];
|
|
431
426
|
|
|
432
427
|
var _useState53 = (0, _react.useState)([]),
|
|
433
428
|
_useState54 = (0, _slicedToArray2.default)(_useState53, 2),
|
|
434
|
-
|
|
435
|
-
|
|
429
|
+
componentsArray = _useState54[0],
|
|
430
|
+
setComponentsArray = _useState54[1];
|
|
436
431
|
|
|
437
|
-
var _useState55 = (0, _react.useState)(
|
|
432
|
+
var _useState55 = (0, _react.useState)(false),
|
|
438
433
|
_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];
|
|
434
|
+
checkAll = _useState56[0],
|
|
435
|
+
setCheckAll = _useState56[1];
|
|
446
436
|
|
|
447
437
|
var isRetailer = user === null || user === void 0 ? void 0 : user.is_retailer;
|
|
448
438
|
|
|
449
|
-
var
|
|
450
|
-
|
|
451
|
-
loading =
|
|
452
|
-
setLoading =
|
|
439
|
+
var _useState57 = (0, _react.useState)(true),
|
|
440
|
+
_useState58 = (0, _slicedToArray2.default)(_useState57, 2),
|
|
441
|
+
loading = _useState58[0],
|
|
442
|
+
setLoading = _useState58[1];
|
|
453
443
|
|
|
454
|
-
var
|
|
455
|
-
|
|
456
|
-
validatedAll =
|
|
457
|
-
setValidatedAll =
|
|
444
|
+
var _useState59 = (0, _react.useState)(false),
|
|
445
|
+
_useState60 = (0, _slicedToArray2.default)(_useState59, 2),
|
|
446
|
+
validatedAll = _useState60[0],
|
|
447
|
+
setValidatedAll = _useState60[1];
|
|
458
448
|
|
|
459
449
|
var originProp = location === null || location === void 0 ? void 0 : (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.origin;
|
|
460
450
|
|
|
461
|
-
var
|
|
451
|
+
var _useState61 = (0, _react.useState)({
|
|
462
452
|
"Ficha técnica": originProp,
|
|
463
453
|
Descripción: originProp,
|
|
464
454
|
Imágenes: originProp
|
|
465
455
|
}),
|
|
466
|
-
|
|
467
|
-
origin =
|
|
468
|
-
setOrigin =
|
|
469
|
-
|
|
470
|
-
var _useState65 = (0, _react.useState)(false),
|
|
471
|
-
_useState66 = (0, _slicedToArray2.default)(_useState65, 2),
|
|
472
|
-
inCart = _useState66[0],
|
|
473
|
-
setInCart = _useState66[1];
|
|
474
|
-
|
|
475
|
-
var _useState67 = (0, _react.useState)(false),
|
|
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];
|
|
456
|
+
_useState62 = (0, _slicedToArray2.default)(_useState61, 2),
|
|
457
|
+
origin = _useState62[0],
|
|
458
|
+
setOrigin = _useState62[1];
|
|
484
459
|
|
|
485
|
-
var
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
460
|
+
var _useState63 = (0, _react.useState)(false),
|
|
461
|
+
_useState64 = (0, _slicedToArray2.default)(_useState63, 2),
|
|
462
|
+
inCart = _useState64[0],
|
|
463
|
+
setInCart = _useState64[1];
|
|
489
464
|
|
|
490
|
-
var
|
|
465
|
+
var _useState65 = (0, _react.useState)({
|
|
491
466
|
message: "¿Estás seguro de continuar?",
|
|
492
467
|
detail: " ".concat(user.is_retailer ? "Asegurate de haber revisado las tres secciones" : "Envíar el producto a la cadena"),
|
|
493
468
|
button1: {
|
|
494
469
|
name: "Cerrar",
|
|
495
|
-
action:
|
|
496
|
-
return setModalViewTextArea(false);
|
|
497
|
-
}
|
|
470
|
+
action: closeGlobalModal
|
|
498
471
|
},
|
|
499
472
|
button2: {
|
|
500
473
|
name: "Continuar",
|
|
@@ -504,35 +477,402 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
504
477
|
},
|
|
505
478
|
img: _defaultProfileImage.default
|
|
506
479
|
}),
|
|
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];
|
|
480
|
+
_useState66 = (0, _slicedToArray2.default)(_useState65, 2),
|
|
481
|
+
dataGenericModal = _useState66[0],
|
|
482
|
+
setDataGenericModal = _useState66[1];
|
|
515
483
|
|
|
516
|
-
var
|
|
517
|
-
|
|
518
|
-
socketType =
|
|
519
|
-
setSocketType =
|
|
484
|
+
var _useState67 = (0, _react.useState)(null),
|
|
485
|
+
_useState68 = (0, _slicedToArray2.default)(_useState67, 2),
|
|
486
|
+
socketType = _useState68[0],
|
|
487
|
+
setSocketType = _useState68[1];
|
|
520
488
|
|
|
521
|
-
var
|
|
522
|
-
|
|
523
|
-
saving =
|
|
524
|
-
setSaving =
|
|
489
|
+
var _useState69 = (0, _react.useState)(loading),
|
|
490
|
+
_useState70 = (0, _slicedToArray2.default)(_useState69, 2),
|
|
491
|
+
saving = _useState70[0],
|
|
492
|
+
setSaving = _useState70[1];
|
|
525
493
|
|
|
526
|
-
var
|
|
527
|
-
|
|
528
|
-
retailerStatus =
|
|
529
|
-
setRetailerStatus =
|
|
494
|
+
var _useState71 = (0, _react.useState)(product.statusByRetailer),
|
|
495
|
+
_useState72 = (0, _slicedToArray2.default)(_useState71, 2),
|
|
496
|
+
retailerStatus = _useState72[0],
|
|
497
|
+
setRetailerStatus = _useState72[1];
|
|
530
498
|
|
|
531
499
|
var _useCloseModal = (0, _customHooks.useCloseModal)("version-selector"),
|
|
532
500
|
_useCloseModal2 = (0, _slicedToArray2.default)(_useCloseModal, 2),
|
|
533
501
|
showVersionSelector = _useCloseModal2[0],
|
|
534
502
|
setShowVersionSelector = _useCloseModal2[1];
|
|
535
503
|
|
|
504
|
+
var _useState73 = (0, _react.useState)(),
|
|
505
|
+
_useState74 = (0, _slicedToArray2.default)(_useState73, 2),
|
|
506
|
+
globalModal = _useState74[0],
|
|
507
|
+
setGlobalModal = _useState74[1];
|
|
508
|
+
|
|
509
|
+
var updateAuditStatus = /*#__PURE__*/function () {
|
|
510
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(status) {
|
|
511
|
+
var productTemp, retailerStatusCopy, conceptArray;
|
|
512
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
513
|
+
while (1) {
|
|
514
|
+
switch (_context2.prev = _context2.next) {
|
|
515
|
+
case 0:
|
|
516
|
+
productTemp = product;
|
|
517
|
+
productTemp.article_status = status;
|
|
518
|
+
productTemp.datasheet_status = status;
|
|
519
|
+
productTemp.description_status = status;
|
|
520
|
+
productTemp.images_status = status;
|
|
521
|
+
retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
|
|
522
|
+
conceptArray = ["description", "datasheet", "images"];
|
|
523
|
+
Object.keys(retailerStatusCopy).forEach(function (key) {
|
|
524
|
+
conceptArray.forEach(function (concept) {
|
|
525
|
+
if (retailerStatusCopy[key][concept]) {
|
|
526
|
+
retailerStatusCopy[key][concept] = status;
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
});
|
|
530
|
+
setRetailerStatus(retailerStatusCopy);
|
|
531
|
+
productTemp.statusByRetailer = retailerStatusCopy;
|
|
532
|
+
setProduct(productTemp);
|
|
533
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
534
|
+
setProductEdit({
|
|
535
|
+
ArticleId: productTemp.id_article,
|
|
536
|
+
idCategory: productTemp.article.id_category,
|
|
537
|
+
product: productTemp
|
|
538
|
+
});
|
|
539
|
+
sessionStorage.setItem("productEdit", JSON.stringify({
|
|
540
|
+
ArticleId: productTemp.id_article,
|
|
541
|
+
idCategory: productTemp.article.id_category,
|
|
542
|
+
product: productTemp
|
|
543
|
+
}));
|
|
544
|
+
_context2.next = 16;
|
|
545
|
+
return loadData();
|
|
546
|
+
|
|
547
|
+
case 16:
|
|
548
|
+
case "end":
|
|
549
|
+
return _context2.stop();
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}, _callee2);
|
|
553
|
+
}));
|
|
554
|
+
|
|
555
|
+
return function updateAuditStatus(_x2) {
|
|
556
|
+
return _ref3.apply(this, arguments);
|
|
557
|
+
};
|
|
558
|
+
}();
|
|
559
|
+
|
|
560
|
+
var addCart = /*#__PURE__*/function () {
|
|
561
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(retailers) {
|
|
562
|
+
var article, version, articleToOrder, modatlType, resCart;
|
|
563
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
564
|
+
while (1) {
|
|
565
|
+
switch (_context3.prev = _context3.next) {
|
|
566
|
+
case 0:
|
|
567
|
+
article = product.article, version = product.version;
|
|
568
|
+
articleToOrder = [{
|
|
569
|
+
articleId: article.id_article,
|
|
570
|
+
version: version,
|
|
571
|
+
userId: user.id_user,
|
|
572
|
+
discount: 0,
|
|
573
|
+
subtotal: 0,
|
|
574
|
+
companyId: user.id_company,
|
|
575
|
+
datasheet: retailers,
|
|
576
|
+
description: retailers,
|
|
577
|
+
image: retailers,
|
|
578
|
+
attributeTranslations: false,
|
|
579
|
+
descriptionTranslations: false,
|
|
580
|
+
build: "[]",
|
|
581
|
+
manual: "[]",
|
|
582
|
+
userCreated: user.id_user
|
|
583
|
+
}];
|
|
584
|
+
modatlType = "addedToCartError";
|
|
585
|
+
|
|
586
|
+
if (!addToCart) {
|
|
587
|
+
_context3.next = 8;
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
_context3.next = 6;
|
|
592
|
+
return addToCart({
|
|
593
|
+
data: articleToOrder
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
case 6:
|
|
597
|
+
resCart = _context3.sent;
|
|
598
|
+
|
|
599
|
+
if (resCart.data.statusCode === 200) {
|
|
600
|
+
modatlType = "addedToCart";
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
case 8:
|
|
604
|
+
showGlobalModal(modatlType);
|
|
605
|
+
|
|
606
|
+
case 9:
|
|
607
|
+
case "end":
|
|
608
|
+
return _context3.stop();
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}, _callee3);
|
|
612
|
+
}));
|
|
613
|
+
|
|
614
|
+
return function addCart(_x3) {
|
|
615
|
+
return _ref4.apply(this, arguments);
|
|
616
|
+
};
|
|
617
|
+
}();
|
|
618
|
+
|
|
619
|
+
var closeGlobalModal = function closeGlobalModal() {
|
|
620
|
+
return setGlobalModal();
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
var seenByProvider = /*#__PURE__*/function () {
|
|
624
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
625
|
+
var _productTemp$id_order;
|
|
626
|
+
|
|
627
|
+
var productTemp, articleId, orderId, promises, conceptArray;
|
|
628
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
629
|
+
while (1) {
|
|
630
|
+
switch (_context4.prev = _context4.next) {
|
|
631
|
+
case 0:
|
|
632
|
+
productTemp = product;
|
|
633
|
+
articleId = productTemp.id_article;
|
|
634
|
+
orderId = (_productTemp$id_order = productTemp.id_order) !== null && _productTemp$id_order !== void 0 ? _productTemp$id_order : productTemp.orderId;
|
|
635
|
+
promises = [];
|
|
636
|
+
conceptArray = ["description", "datasheet", "images"];
|
|
637
|
+
conceptArray.forEach(function (concept) {
|
|
638
|
+
var sectionStatusKey = "".concat(concept, "_status");
|
|
639
|
+
var evalStatus = product[sectionStatusKey] || (product === null || product === void 0 ? void 0 : product.version_status);
|
|
640
|
+
var data = {
|
|
641
|
+
articleId: articleId,
|
|
642
|
+
orderId: orderId,
|
|
643
|
+
concept: concept,
|
|
644
|
+
evalStatus: evalStatus
|
|
645
|
+
};
|
|
646
|
+
promises.push(_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
647
|
+
headers: {
|
|
648
|
+
Authorization: token
|
|
649
|
+
}
|
|
650
|
+
}));
|
|
651
|
+
});
|
|
652
|
+
_context4.next = 8;
|
|
653
|
+
return Promise.all(promises);
|
|
654
|
+
|
|
655
|
+
case 8:
|
|
656
|
+
closeGlobalModal();
|
|
657
|
+
_context4.next = 11;
|
|
658
|
+
return updateAuditStatus("FAP");
|
|
659
|
+
|
|
660
|
+
case 11:
|
|
661
|
+
case "end":
|
|
662
|
+
return _context4.stop();
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}, _callee4);
|
|
666
|
+
}));
|
|
667
|
+
|
|
668
|
+
return function seenByProvider() {
|
|
669
|
+
return _ref5.apply(this, arguments);
|
|
670
|
+
};
|
|
671
|
+
}();
|
|
672
|
+
|
|
673
|
+
var showGlobalModal = (0, _react.useCallback)(function (type) {
|
|
674
|
+
var formatter = new Intl.ListFormat("es", {
|
|
675
|
+
type: "conjunction"
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
switch (type) {
|
|
679
|
+
case "error":
|
|
680
|
+
setGlobalModal({
|
|
681
|
+
message: "".concat(activeTab, " rechazada"),
|
|
682
|
+
detail: "Agrega tu comentarios para enviar el rechazo",
|
|
683
|
+
img: _errorModal.default,
|
|
684
|
+
textArea: true,
|
|
685
|
+
button1: {
|
|
686
|
+
name: "Enviar",
|
|
687
|
+
action: function action(e) {
|
|
688
|
+
var textArea = document.querySelector("#area");
|
|
689
|
+
|
|
690
|
+
if (textArea.value) {
|
|
691
|
+
textArea.style.border = "none";
|
|
692
|
+
createComment(e, textArea.value);
|
|
693
|
+
showGlobalModal("commentsSent");
|
|
694
|
+
validatedAll ? validateAll("R") : sendEvaluation("R");
|
|
695
|
+
} else {
|
|
696
|
+
textArea.style.border = "2px solid red";
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
break;
|
|
702
|
+
|
|
703
|
+
case "generic":
|
|
704
|
+
setGlobalModal(dataGenericModal);
|
|
705
|
+
break;
|
|
706
|
+
|
|
707
|
+
case "commentsSent":
|
|
708
|
+
setGlobalModal({
|
|
709
|
+
message: "Gracias, tus comentarios fueron entregados.",
|
|
710
|
+
detail: "Trabajaremos en conjunto para resolverlo.",
|
|
711
|
+
button1: {
|
|
712
|
+
name: "Cerrar",
|
|
713
|
+
action: closeGlobalModal
|
|
714
|
+
},
|
|
715
|
+
img: _defaultProfileImage.default,
|
|
716
|
+
textArea: false
|
|
717
|
+
});
|
|
718
|
+
break;
|
|
719
|
+
|
|
720
|
+
case "RAC":
|
|
721
|
+
var servicesRejected = [];
|
|
722
|
+
var translateServices = {
|
|
723
|
+
datasheet: "ficha técnica",
|
|
724
|
+
description: "descripción",
|
|
725
|
+
images: "imágenes"
|
|
726
|
+
};
|
|
727
|
+
Object.keys(translateServices).forEach(function (service) {
|
|
728
|
+
if (product["".concat(service, "_status")] === "RAC") {
|
|
729
|
+
servicesRejected.push(translateServices[service]);
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
var plural = ["Los servicios", "cumplen"];
|
|
733
|
+
var singular = ["El servicio", "cumple"];
|
|
734
|
+
var grammar = servicesRejected.length > 1 ? plural : singular;
|
|
735
|
+
var formatted = formatter.format(servicesRejected);
|
|
736
|
+
var text1 = "".concat(grammar[0], " de ").concat(formatted, " no ").concat(grammar[1], " con lo que la cadena necesita.");
|
|
737
|
+
var text2 = "\xA1Solicita el servicio de Content-oh! para completarlo!";
|
|
738
|
+
var retailers = product.retailersWithService.map(function (retailer) {
|
|
739
|
+
return Number(retailer);
|
|
740
|
+
});
|
|
741
|
+
setGlobalModal({
|
|
742
|
+
message: "Tu producto no cumple con los requerimientos de la cadena",
|
|
743
|
+
customComponent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
744
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
745
|
+
className: "generic-text",
|
|
746
|
+
children: [text1, /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), text2]
|
|
747
|
+
})
|
|
748
|
+
}),
|
|
749
|
+
button1: {
|
|
750
|
+
name: "Continuar",
|
|
751
|
+
action: function () {
|
|
752
|
+
var _action = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
753
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
754
|
+
while (1) {
|
|
755
|
+
switch (_context5.prev = _context5.next) {
|
|
756
|
+
case 0:
|
|
757
|
+
_context5.next = 2;
|
|
758
|
+
return seenByProvider();
|
|
759
|
+
|
|
760
|
+
case 2:
|
|
761
|
+
return _context5.abrupt("return", _context5.sent);
|
|
762
|
+
|
|
763
|
+
case 3:
|
|
764
|
+
case "end":
|
|
765
|
+
return _context5.stop();
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}, _callee5);
|
|
769
|
+
}));
|
|
770
|
+
|
|
771
|
+
function action() {
|
|
772
|
+
return _action.apply(this, arguments);
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
return action;
|
|
776
|
+
}()
|
|
777
|
+
},
|
|
778
|
+
button2: {
|
|
779
|
+
name: "Solicitar a Content-oh!",
|
|
780
|
+
action: function () {
|
|
781
|
+
var _action2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
782
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
783
|
+
while (1) {
|
|
784
|
+
switch (_context6.prev = _context6.next) {
|
|
785
|
+
case 0:
|
|
786
|
+
_context6.next = 2;
|
|
787
|
+
return addCart(retailers);
|
|
788
|
+
|
|
789
|
+
case 2:
|
|
790
|
+
_context6.next = 4;
|
|
791
|
+
return seenByProvider();
|
|
792
|
+
|
|
793
|
+
case 4:
|
|
794
|
+
case "end":
|
|
795
|
+
return _context6.stop();
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
}, _callee6);
|
|
799
|
+
}));
|
|
800
|
+
|
|
801
|
+
function action() {
|
|
802
|
+
return _action2.apply(this, arguments);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
return action;
|
|
806
|
+
}()
|
|
807
|
+
},
|
|
808
|
+
img: _errorModal.default
|
|
809
|
+
});
|
|
810
|
+
break;
|
|
811
|
+
|
|
812
|
+
case "AAC":
|
|
813
|
+
setGlobalModal({
|
|
814
|
+
message: "Felicidades",
|
|
815
|
+
detail: "Tu producto cumple con los requerimientos de la cadena.",
|
|
816
|
+
button1: {
|
|
817
|
+
name: "Continuar",
|
|
818
|
+
action: function () {
|
|
819
|
+
var _action3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
820
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
821
|
+
while (1) {
|
|
822
|
+
switch (_context7.prev = _context7.next) {
|
|
823
|
+
case 0:
|
|
824
|
+
_context7.next = 2;
|
|
825
|
+
return seenByProvider();
|
|
826
|
+
|
|
827
|
+
case 2:
|
|
828
|
+
return _context7.abrupt("return", _context7.sent);
|
|
829
|
+
|
|
830
|
+
case 3:
|
|
831
|
+
case "end":
|
|
832
|
+
return _context7.stop();
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
}, _callee7);
|
|
836
|
+
}));
|
|
837
|
+
|
|
838
|
+
function action() {
|
|
839
|
+
return _action3.apply(this, arguments);
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
return action;
|
|
843
|
+
}()
|
|
844
|
+
},
|
|
845
|
+
img: _defaultProfileImage.default
|
|
846
|
+
});
|
|
847
|
+
break;
|
|
848
|
+
|
|
849
|
+
case "addedToCartError":
|
|
850
|
+
setGlobalModal({
|
|
851
|
+
detail: "Parece que algo salió mal al intentar añadir tu producto a tu carrito.",
|
|
852
|
+
button1: {
|
|
853
|
+
name: "Continuar",
|
|
854
|
+
action: closeGlobalModal
|
|
855
|
+
}
|
|
856
|
+
});
|
|
857
|
+
break;
|
|
858
|
+
|
|
859
|
+
case "addedToCart":
|
|
860
|
+
setGlobalModal({
|
|
861
|
+
message: "Producto añadido",
|
|
862
|
+
detail: "Tu producto se añadió al carrito de compras.",
|
|
863
|
+
button1: {
|
|
864
|
+
name: "Continuar",
|
|
865
|
+
action: closeGlobalModal
|
|
866
|
+
},
|
|
867
|
+
img: _defaultProfileImage.default
|
|
868
|
+
});
|
|
869
|
+
break;
|
|
870
|
+
|
|
871
|
+
default:
|
|
872
|
+
closeGlobalModal();
|
|
873
|
+
break;
|
|
874
|
+
}
|
|
875
|
+
}, [activeTab, dataGenericModal, product]);
|
|
536
876
|
(0, _react.useEffect)(function () {
|
|
537
877
|
checkAll && setSelectedImages(images.values);
|
|
538
878
|
}, [checkAll]);
|
|
@@ -543,22 +883,22 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
543
883
|
}, [showModal]);
|
|
544
884
|
|
|
545
885
|
var loadData = /*#__PURE__*/function () {
|
|
546
|
-
var
|
|
886
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
547
887
|
var _product$article, _product$article2, _product$article3, _services$, _services$$values;
|
|
548
888
|
|
|
549
889
|
var services;
|
|
550
|
-
return _regenerator.default.wrap(function
|
|
890
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
551
891
|
while (1) {
|
|
552
|
-
switch (
|
|
892
|
+
switch (_context8.prev = _context8.next) {
|
|
553
893
|
case 0:
|
|
554
|
-
|
|
894
|
+
_context8.next = 2;
|
|
555
895
|
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
896
|
|
|
557
897
|
case 2:
|
|
558
|
-
services =
|
|
898
|
+
services = _context8.sent;
|
|
559
899
|
//Converts the data inside the datasheets object to array
|
|
560
900
|
setServices(services);
|
|
561
|
-
|
|
901
|
+
_context8.next = 6;
|
|
562
902
|
return getServices();
|
|
563
903
|
|
|
564
904
|
case 6:
|
|
@@ -576,26 +916,26 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
576
916
|
|
|
577
917
|
case 10:
|
|
578
918
|
case "end":
|
|
579
|
-
return
|
|
919
|
+
return _context8.stop();
|
|
580
920
|
}
|
|
581
921
|
}
|
|
582
|
-
},
|
|
922
|
+
}, _callee8);
|
|
583
923
|
}));
|
|
584
924
|
|
|
585
925
|
return function loadData() {
|
|
586
|
-
return
|
|
926
|
+
return _ref6.apply(this, arguments);
|
|
587
927
|
};
|
|
588
928
|
}();
|
|
589
929
|
|
|
590
930
|
var getServices = /*#__PURE__*/function () {
|
|
591
|
-
var
|
|
931
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
592
932
|
var _product$article4;
|
|
593
933
|
|
|
594
934
|
var productInOrder, idArticle, retailers, active, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse, retailerResponse;
|
|
595
935
|
|
|
596
|
-
return _regenerator.default.wrap(function
|
|
936
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
597
937
|
while (1) {
|
|
598
|
-
switch (
|
|
938
|
+
switch (_context9.prev = _context9.next) {
|
|
599
939
|
case 0:
|
|
600
940
|
productInOrder = product.id_order || product.orderId;
|
|
601
941
|
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 +943,15 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
603
943
|
active = null;
|
|
604
944
|
|
|
605
945
|
if (!(isRevision() || productInOrder)) {
|
|
606
|
-
|
|
946
|
+
_context9.next = 12;
|
|
607
947
|
break;
|
|
608
948
|
}
|
|
609
949
|
|
|
610
|
-
|
|
950
|
+
_context9.next = 7;
|
|
611
951
|
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
952
|
|
|
613
953
|
case 7:
|
|
614
|
-
servicesResponse =
|
|
954
|
+
servicesResponse = _context9.sent;
|
|
615
955
|
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
956
|
retailerResponse = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
|
|
617
957
|
return srv.id_retailer;
|
|
@@ -626,14 +966,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
626
966
|
|
|
627
967
|
case 13:
|
|
628
968
|
case "end":
|
|
629
|
-
return
|
|
969
|
+
return _context9.stop();
|
|
630
970
|
}
|
|
631
971
|
}
|
|
632
|
-
},
|
|
972
|
+
}, _callee9);
|
|
633
973
|
}));
|
|
634
974
|
|
|
635
975
|
return function getServices() {
|
|
636
|
-
return
|
|
976
|
+
return _ref7.apply(this, arguments);
|
|
637
977
|
};
|
|
638
978
|
}();
|
|
639
979
|
|
|
@@ -663,13 +1003,13 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
663
1003
|
};
|
|
664
1004
|
|
|
665
1005
|
var getCart = /*#__PURE__*/function () {
|
|
666
|
-
var
|
|
1006
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
667
1007
|
var res, arr;
|
|
668
|
-
return _regenerator.default.wrap(function
|
|
1008
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
669
1009
|
while (1) {
|
|
670
|
-
switch (
|
|
1010
|
+
switch (_context10.prev = _context10.next) {
|
|
671
1011
|
case 0:
|
|
672
|
-
|
|
1012
|
+
_context10.next = 2;
|
|
673
1013
|
return _axios.default.get(process.env.REACT_APP_CART, {
|
|
674
1014
|
headers: {
|
|
675
1015
|
Authorization: token
|
|
@@ -677,7 +1017,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
677
1017
|
});
|
|
678
1018
|
|
|
679
1019
|
case 2:
|
|
680
|
-
res =
|
|
1020
|
+
res = _context10.sent;
|
|
681
1021
|
arr = JSON.parse(res.data.body).data.map(function (e) {
|
|
682
1022
|
return e.article_id;
|
|
683
1023
|
});
|
|
@@ -687,14 +1027,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
687
1027
|
|
|
688
1028
|
case 5:
|
|
689
1029
|
case "end":
|
|
690
|
-
return
|
|
1030
|
+
return _context10.stop();
|
|
691
1031
|
}
|
|
692
1032
|
}
|
|
693
|
-
},
|
|
1033
|
+
}, _callee10);
|
|
694
1034
|
}));
|
|
695
1035
|
|
|
696
1036
|
return function getCart() {
|
|
697
|
-
return
|
|
1037
|
+
return _ref8.apply(this, arguments);
|
|
698
1038
|
};
|
|
699
1039
|
}();
|
|
700
1040
|
|
|
@@ -709,6 +1049,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
709
1049
|
action: "orderImages",
|
|
710
1050
|
retailerId: activeRetailer.id
|
|
711
1051
|
});
|
|
1052
|
+
if (["RAC", "AAC"].includes(product.article_status)) showGlobalModal(product.article_status);
|
|
712
1053
|
}, [product, version]);
|
|
713
1054
|
(0, _react.useEffect)(function () {
|
|
714
1055
|
setImages({
|
|
@@ -819,11 +1160,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
819
1160
|
}, [images]);
|
|
820
1161
|
|
|
821
1162
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
822
|
-
var
|
|
1163
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
823
1164
|
var dataObject, res;
|
|
824
|
-
return _regenerator.default.wrap(function
|
|
1165
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
825
1166
|
while (1) {
|
|
826
|
-
switch (
|
|
1167
|
+
switch (_context11.prev = _context11.next) {
|
|
827
1168
|
case 0:
|
|
828
1169
|
setLoading(true);
|
|
829
1170
|
dataObject = {
|
|
@@ -831,8 +1172,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
831
1172
|
articleData: updatedDescriptions
|
|
832
1173
|
};
|
|
833
1174
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
834
|
-
|
|
835
|
-
|
|
1175
|
+
_context11.prev = 3;
|
|
1176
|
+
_context11.next = 6;
|
|
836
1177
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
837
1178
|
headers: {
|
|
838
1179
|
Authorization: token
|
|
@@ -840,45 +1181,45 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
840
1181
|
});
|
|
841
1182
|
|
|
842
1183
|
case 6:
|
|
843
|
-
res =
|
|
1184
|
+
res = _context11.sent;
|
|
844
1185
|
|
|
845
1186
|
if (!(res.data.statusCode === 200)) {
|
|
846
|
-
|
|
1187
|
+
_context11.next = 11;
|
|
847
1188
|
break;
|
|
848
1189
|
}
|
|
849
1190
|
|
|
850
1191
|
setMessage("Descripciones guardadas con éxito");
|
|
851
|
-
|
|
1192
|
+
_context11.next = 11;
|
|
852
1193
|
return loadData();
|
|
853
1194
|
|
|
854
1195
|
case 11:
|
|
855
|
-
|
|
1196
|
+
_context11.next = 16;
|
|
856
1197
|
break;
|
|
857
1198
|
|
|
858
1199
|
case 13:
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
console.log(
|
|
1200
|
+
_context11.prev = 13;
|
|
1201
|
+
_context11.t0 = _context11["catch"](3);
|
|
1202
|
+
console.log(_context11.t0);
|
|
862
1203
|
|
|
863
1204
|
case 16:
|
|
864
1205
|
case "end":
|
|
865
|
-
return
|
|
1206
|
+
return _context11.stop();
|
|
866
1207
|
}
|
|
867
1208
|
}
|
|
868
|
-
},
|
|
1209
|
+
}, _callee11, null, [[3, 13]]);
|
|
869
1210
|
}));
|
|
870
1211
|
|
|
871
1212
|
return function saveDescriptions() {
|
|
872
|
-
return
|
|
1213
|
+
return _ref9.apply(this, arguments);
|
|
873
1214
|
};
|
|
874
1215
|
}();
|
|
875
1216
|
|
|
876
1217
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
877
|
-
var
|
|
1218
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
878
1219
|
var dataObject, res;
|
|
879
|
-
return _regenerator.default.wrap(function
|
|
1220
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
880
1221
|
while (1) {
|
|
881
|
-
switch (
|
|
1222
|
+
switch (_context12.prev = _context12.next) {
|
|
882
1223
|
case 0:
|
|
883
1224
|
setLoading(true);
|
|
884
1225
|
dataObject = {
|
|
@@ -886,8 +1227,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
886
1227
|
articleData: updatedDatasheets
|
|
887
1228
|
};
|
|
888
1229
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
889
|
-
|
|
890
|
-
|
|
1230
|
+
_context12.prev = 3;
|
|
1231
|
+
_context12.next = 6;
|
|
891
1232
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
892
1233
|
headers: {
|
|
893
1234
|
Authorization: token
|
|
@@ -895,47 +1236,47 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
895
1236
|
});
|
|
896
1237
|
|
|
897
1238
|
case 6:
|
|
898
|
-
res =
|
|
1239
|
+
res = _context12.sent;
|
|
899
1240
|
|
|
900
1241
|
if (!(res.data.statusCode === 200)) {
|
|
901
|
-
|
|
1242
|
+
_context12.next = 11;
|
|
902
1243
|
break;
|
|
903
1244
|
}
|
|
904
1245
|
|
|
905
1246
|
setMessage("Fichas técnicas guardadas");
|
|
906
|
-
|
|
1247
|
+
_context12.next = 11;
|
|
907
1248
|
return loadData();
|
|
908
1249
|
|
|
909
1250
|
case 11:
|
|
910
|
-
|
|
1251
|
+
_context12.next = 16;
|
|
911
1252
|
break;
|
|
912
1253
|
|
|
913
1254
|
case 13:
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
console.log(
|
|
1255
|
+
_context12.prev = 13;
|
|
1256
|
+
_context12.t0 = _context12["catch"](3);
|
|
1257
|
+
console.log(_context12.t0);
|
|
917
1258
|
|
|
918
1259
|
case 16:
|
|
919
1260
|
case "end":
|
|
920
|
-
return
|
|
1261
|
+
return _context12.stop();
|
|
921
1262
|
}
|
|
922
1263
|
}
|
|
923
|
-
},
|
|
1264
|
+
}, _callee12, null, [[3, 13]]);
|
|
924
1265
|
}));
|
|
925
1266
|
|
|
926
1267
|
return function saveDatasheets() {
|
|
927
|
-
return
|
|
1268
|
+
return _ref10.apply(this, arguments);
|
|
928
1269
|
};
|
|
929
1270
|
}();
|
|
930
1271
|
|
|
931
|
-
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1272
|
+
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
932
1273
|
var _images$values2, _data$articleData, _data$articleData2, _data$updateImages;
|
|
933
1274
|
|
|
934
1275
|
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
935
1276
|
|
|
936
|
-
return _regenerator.default.wrap(function
|
|
1277
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
937
1278
|
while (1) {
|
|
938
|
-
switch (
|
|
1279
|
+
switch (_context13.prev = _context13.next) {
|
|
939
1280
|
case 0:
|
|
940
1281
|
imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
|
|
941
1282
|
imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
|
|
@@ -984,19 +1325,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
984
1325
|
}
|
|
985
1326
|
|
|
986
1327
|
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
987
|
-
|
|
1328
|
+
_context13.next = 31;
|
|
988
1329
|
break;
|
|
989
1330
|
}
|
|
990
1331
|
|
|
991
1332
|
setLoading(true);
|
|
992
|
-
|
|
1333
|
+
_context13.prev = 11;
|
|
993
1334
|
data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
|
|
994
1335
|
e.uuid = (0, _uuid.v4)();
|
|
995
1336
|
});
|
|
996
1337
|
setDataImages(data);
|
|
997
1338
|
|
|
998
1339
|
if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
|
|
999
|
-
|
|
1340
|
+
_context13.next = 23;
|
|
1000
1341
|
break;
|
|
1001
1342
|
}
|
|
1002
1343
|
|
|
@@ -1012,28 +1353,28 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1012
1353
|
};
|
|
1013
1354
|
promiseArray.push(myBucket.putObject(params).promise());
|
|
1014
1355
|
});
|
|
1015
|
-
|
|
1356
|
+
_context13.next = 20;
|
|
1016
1357
|
return Promise.all(promiseArray);
|
|
1017
1358
|
|
|
1018
1359
|
case 20:
|
|
1019
1360
|
setImagesUploaded(true);
|
|
1020
|
-
|
|
1361
|
+
_context13.next = 24;
|
|
1021
1362
|
break;
|
|
1022
1363
|
|
|
1023
1364
|
case 23:
|
|
1024
1365
|
setImagesUploaded(true);
|
|
1025
1366
|
|
|
1026
1367
|
case 24:
|
|
1027
|
-
|
|
1368
|
+
_context13.next = 29;
|
|
1028
1369
|
break;
|
|
1029
1370
|
|
|
1030
1371
|
case 26:
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
console.log(
|
|
1372
|
+
_context13.prev = 26;
|
|
1373
|
+
_context13.t0 = _context13["catch"](11);
|
|
1374
|
+
console.log(_context13.t0); // setMainLoading(false);
|
|
1034
1375
|
|
|
1035
1376
|
case 29:
|
|
1036
|
-
|
|
1377
|
+
_context13.next = 32;
|
|
1037
1378
|
break;
|
|
1038
1379
|
|
|
1039
1380
|
case 31:
|
|
@@ -1042,19 +1383,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1042
1383
|
|
|
1043
1384
|
case 32:
|
|
1044
1385
|
case "end":
|
|
1045
|
-
return
|
|
1386
|
+
return _context13.stop();
|
|
1046
1387
|
}
|
|
1047
1388
|
}
|
|
1048
|
-
},
|
|
1389
|
+
}, _callee13, null, [[11, 26]]);
|
|
1049
1390
|
})), [images, imagesUploaded]);
|
|
1050
|
-
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1391
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
1051
1392
|
var res;
|
|
1052
|
-
return _regenerator.default.wrap(function
|
|
1393
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
1053
1394
|
while (1) {
|
|
1054
|
-
switch (
|
|
1395
|
+
switch (_context14.prev = _context14.next) {
|
|
1055
1396
|
case 0:
|
|
1056
1397
|
if (!imagesUploaded) {
|
|
1057
|
-
|
|
1398
|
+
_context14.next = 16;
|
|
1058
1399
|
break;
|
|
1059
1400
|
}
|
|
1060
1401
|
|
|
@@ -1066,8 +1407,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1066
1407
|
if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1067
1408
|
return e;
|
|
1068
1409
|
});
|
|
1069
|
-
|
|
1070
|
-
|
|
1410
|
+
_context14.prev = 2;
|
|
1411
|
+
_context14.next = 5;
|
|
1071
1412
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
|
|
1072
1413
|
headers: {
|
|
1073
1414
|
Authorization: token
|
|
@@ -1075,33 +1416,33 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1075
1416
|
});
|
|
1076
1417
|
|
|
1077
1418
|
case 5:
|
|
1078
|
-
res =
|
|
1419
|
+
res = _context14.sent;
|
|
1079
1420
|
|
|
1080
1421
|
if (!(res.data.statusCode === 200)) {
|
|
1081
|
-
|
|
1422
|
+
_context14.next = 11;
|
|
1082
1423
|
break;
|
|
1083
1424
|
}
|
|
1084
1425
|
|
|
1085
1426
|
setMessage("Imágenes guardadas con éxito");
|
|
1086
1427
|
sessionStorage.removeItem("imagesList");
|
|
1087
|
-
|
|
1428
|
+
_context14.next = 11;
|
|
1088
1429
|
return loadData();
|
|
1089
1430
|
|
|
1090
1431
|
case 11:
|
|
1091
|
-
|
|
1432
|
+
_context14.next = 16;
|
|
1092
1433
|
break;
|
|
1093
1434
|
|
|
1094
1435
|
case 13:
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
console.log(
|
|
1436
|
+
_context14.prev = 13;
|
|
1437
|
+
_context14.t0 = _context14["catch"](2);
|
|
1438
|
+
console.log(_context14.t0);
|
|
1098
1439
|
|
|
1099
1440
|
case 16:
|
|
1100
1441
|
case "end":
|
|
1101
|
-
return
|
|
1442
|
+
return _context14.stop();
|
|
1102
1443
|
}
|
|
1103
1444
|
}
|
|
1104
|
-
},
|
|
1445
|
+
}, _callee14, null, [[2, 13]]);
|
|
1105
1446
|
})), [dataImages, imagesUploaded]);
|
|
1106
1447
|
|
|
1107
1448
|
var getConcept = function getConcept(tab) {
|
|
@@ -1117,48 +1458,29 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1117
1458
|
}
|
|
1118
1459
|
};
|
|
1119
1460
|
|
|
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
1461
|
var createComment = /*#__PURE__*/function () {
|
|
1140
|
-
var
|
|
1462
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(e, body, tab) {
|
|
1141
1463
|
var concept, data;
|
|
1142
|
-
return _regenerator.default.wrap(function
|
|
1464
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
1143
1465
|
while (1) {
|
|
1144
|
-
switch (
|
|
1466
|
+
switch (_context15.prev = _context15.next) {
|
|
1145
1467
|
case 0:
|
|
1146
1468
|
concept = "";
|
|
1147
|
-
|
|
1148
|
-
|
|
1469
|
+
_context15.t0 = activeTab;
|
|
1470
|
+
_context15.next = _context15.t0 === "Ficha técnica" ? 4 : _context15.t0 === "Imágenes" ? 6 : 8;
|
|
1149
1471
|
break;
|
|
1150
1472
|
|
|
1151
1473
|
case 4:
|
|
1152
1474
|
concept = "datasheet";
|
|
1153
|
-
return
|
|
1475
|
+
return _context15.abrupt("break", 10);
|
|
1154
1476
|
|
|
1155
1477
|
case 6:
|
|
1156
1478
|
concept = "images";
|
|
1157
|
-
return
|
|
1479
|
+
return _context15.abrupt("break", 10);
|
|
1158
1480
|
|
|
1159
1481
|
case 8:
|
|
1160
1482
|
concept = "description";
|
|
1161
|
-
return
|
|
1483
|
+
return _context15.abrupt("break", 10);
|
|
1162
1484
|
|
|
1163
1485
|
case 10:
|
|
1164
1486
|
data = {
|
|
@@ -1168,7 +1490,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1168
1490
|
concept: concept,
|
|
1169
1491
|
version: version
|
|
1170
1492
|
};
|
|
1171
|
-
|
|
1493
|
+
_context15.next = 13;
|
|
1172
1494
|
return _axios.default.post("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1173
1495
|
headers: {
|
|
1174
1496
|
Authorization: token
|
|
@@ -1177,14 +1499,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1177
1499
|
|
|
1178
1500
|
case 13:
|
|
1179
1501
|
case "end":
|
|
1180
|
-
return
|
|
1502
|
+
return _context15.stop();
|
|
1181
1503
|
}
|
|
1182
1504
|
}
|
|
1183
|
-
},
|
|
1505
|
+
}, _callee15);
|
|
1184
1506
|
}));
|
|
1185
1507
|
|
|
1186
|
-
return function createComment(
|
|
1187
|
-
return
|
|
1508
|
+
return function createComment(_x4, _x5, _x6) {
|
|
1509
|
+
return _ref13.apply(this, arguments);
|
|
1188
1510
|
};
|
|
1189
1511
|
}();
|
|
1190
1512
|
|
|
@@ -1193,16 +1515,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1193
1515
|
}, [activeTab]);
|
|
1194
1516
|
|
|
1195
1517
|
var commentRevised = /*#__PURE__*/function () {
|
|
1196
|
-
var
|
|
1518
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
1197
1519
|
var data;
|
|
1198
|
-
return _regenerator.default.wrap(function
|
|
1520
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
1199
1521
|
while (1) {
|
|
1200
|
-
switch (
|
|
1522
|
+
switch (_context16.prev = _context16.next) {
|
|
1201
1523
|
case 0:
|
|
1202
1524
|
data = {
|
|
1203
1525
|
commentId: comment.id
|
|
1204
1526
|
};
|
|
1205
|
-
|
|
1527
|
+
_context16.next = 3;
|
|
1206
1528
|
return _axios.default.put("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1207
1529
|
headers: {
|
|
1208
1530
|
Authorization: token
|
|
@@ -1214,40 +1536,40 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1214
1536
|
|
|
1215
1537
|
case 4:
|
|
1216
1538
|
case "end":
|
|
1217
|
-
return
|
|
1539
|
+
return _context16.stop();
|
|
1218
1540
|
}
|
|
1219
1541
|
}
|
|
1220
|
-
},
|
|
1542
|
+
}, _callee16);
|
|
1221
1543
|
}));
|
|
1222
1544
|
|
|
1223
1545
|
return function commentRevised() {
|
|
1224
|
-
return
|
|
1546
|
+
return _ref14.apply(this, arguments);
|
|
1225
1547
|
};
|
|
1226
1548
|
}();
|
|
1227
1549
|
|
|
1228
1550
|
var setAssignation = /*#__PURE__*/function () {
|
|
1229
|
-
var
|
|
1551
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(assignationType, assignationId) {
|
|
1230
1552
|
var concept, productTemp, data;
|
|
1231
|
-
return _regenerator.default.wrap(function
|
|
1553
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
1232
1554
|
while (1) {
|
|
1233
|
-
switch (
|
|
1555
|
+
switch (_context17.prev = _context17.next) {
|
|
1234
1556
|
case 0:
|
|
1235
1557
|
concept = "";
|
|
1236
|
-
|
|
1237
|
-
|
|
1558
|
+
_context17.t0 = activeTab;
|
|
1559
|
+
_context17.next = _context17.t0 === "Ficha técnica" ? 4 : _context17.t0 === "Imágenes" ? 6 : 8;
|
|
1238
1560
|
break;
|
|
1239
1561
|
|
|
1240
1562
|
case 4:
|
|
1241
1563
|
concept = "datasheet";
|
|
1242
|
-
return
|
|
1564
|
+
return _context17.abrupt("break", 10);
|
|
1243
1565
|
|
|
1244
1566
|
case 6:
|
|
1245
1567
|
concept = "images";
|
|
1246
|
-
return
|
|
1568
|
+
return _context17.abrupt("break", 10);
|
|
1247
1569
|
|
|
1248
1570
|
case 8:
|
|
1249
1571
|
concept = "description";
|
|
1250
|
-
return
|
|
1572
|
+
return _context17.abrupt("break", 10);
|
|
1251
1573
|
|
|
1252
1574
|
case 10:
|
|
1253
1575
|
productTemp = product;
|
|
@@ -1260,7 +1582,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1260
1582
|
concept: concept,
|
|
1261
1583
|
userId: assignationId
|
|
1262
1584
|
};
|
|
1263
|
-
|
|
1585
|
+
_context17.next = 15;
|
|
1264
1586
|
return (0, _axios.default)({
|
|
1265
1587
|
method: "post",
|
|
1266
1588
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
@@ -1276,35 +1598,17 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1276
1598
|
|
|
1277
1599
|
case 17:
|
|
1278
1600
|
case "end":
|
|
1279
|
-
return
|
|
1601
|
+
return _context17.stop();
|
|
1280
1602
|
}
|
|
1281
1603
|
}
|
|
1282
|
-
},
|
|
1604
|
+
}, _callee17);
|
|
1283
1605
|
}));
|
|
1284
1606
|
|
|
1285
|
-
return function setAssignation(
|
|
1286
|
-
return
|
|
1607
|
+
return function setAssignation(_x7, _x8) {
|
|
1608
|
+
return _ref15.apply(this, arguments);
|
|
1287
1609
|
};
|
|
1288
1610
|
}();
|
|
1289
1611
|
|
|
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
1612
|
var downloadImages = function downloadImages() {
|
|
1309
1613
|
var _images$values3;
|
|
1310
1614
|
|
|
@@ -1384,33 +1688,21 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1384
1688
|
}
|
|
1385
1689
|
};
|
|
1386
1690
|
|
|
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
1691
|
var sendEvaluation = /*#__PURE__*/function () {
|
|
1400
|
-
var
|
|
1401
|
-
var _productTemp$
|
|
1692
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(result) {
|
|
1693
|
+
var _productTemp$id_order2;
|
|
1402
1694
|
|
|
1403
1695
|
var concept, productTemp, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, res, newStatuses, orderStatus, serviceStatus, newProductEdit, showSurveyByProvider, showSurveyByRetailer, _JSON$parse, newArticleStatus, newServiceStatus, newStatus, retailerStatusCopy, status;
|
|
1404
1696
|
|
|
1405
|
-
return _regenerator.default.wrap(function
|
|
1697
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
1406
1698
|
while (1) {
|
|
1407
|
-
switch (
|
|
1699
|
+
switch (_context18.prev = _context18.next) {
|
|
1408
1700
|
case 0:
|
|
1409
1701
|
setLoading(true);
|
|
1410
1702
|
concept = getConcept(activeTab);
|
|
1411
1703
|
productTemp = product;
|
|
1412
1704
|
articleId = productTemp.id_article;
|
|
1413
|
-
orderId = (_productTemp$
|
|
1705
|
+
orderId = (_productTemp$id_order2 = productTemp.id_order) !== null && _productTemp$id_order2 !== void 0 ? _productTemp$id_order2 : productTemp.orderId;
|
|
1414
1706
|
sectionStatusKey = "".concat(getConcept(activeTab), "_status");
|
|
1415
1707
|
evalStatus = product[sectionStatusKey] || (product === null || product === void 0 ? void 0 : product.version_status);
|
|
1416
1708
|
data = {
|
|
@@ -1420,16 +1712,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1420
1712
|
evalStatus: evalStatus
|
|
1421
1713
|
};
|
|
1422
1714
|
retailerId = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id;
|
|
1423
|
-
|
|
1715
|
+
_context18.prev = 9;
|
|
1424
1716
|
|
|
1425
1717
|
if (!result) {
|
|
1426
|
-
|
|
1718
|
+
_context18.next = 27;
|
|
1427
1719
|
break;
|
|
1428
1720
|
}
|
|
1429
1721
|
|
|
1430
1722
|
data.result = result;
|
|
1431
1723
|
data.retailerId = retailerId;
|
|
1432
|
-
|
|
1724
|
+
_context18.next = 15;
|
|
1433
1725
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1434
1726
|
headers: {
|
|
1435
1727
|
Authorization: token
|
|
@@ -1437,7 +1729,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1437
1729
|
});
|
|
1438
1730
|
|
|
1439
1731
|
case 15:
|
|
1440
|
-
res =
|
|
1732
|
+
res = _context18.sent;
|
|
1441
1733
|
newStatuses = JSON.parse(res.data.body);
|
|
1442
1734
|
orderStatus = newStatuses.newOrderStatus;
|
|
1443
1735
|
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(getConcept(activeTab), "Status")];
|
|
@@ -1447,11 +1739,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1447
1739
|
showSurveyByProvider = !user.is_retailer && orderStatus[orderId] === "AP";
|
|
1448
1740
|
showSurveyByRetailer = user.is_retailer && orderStatus[orderId] === "ACA";
|
|
1449
1741
|
showSurvey && showSurvey(showSurveyByProvider || showSurveyByRetailer);
|
|
1450
|
-
|
|
1742
|
+
_context18.next = 30;
|
|
1451
1743
|
break;
|
|
1452
1744
|
|
|
1453
1745
|
case 27:
|
|
1454
|
-
|
|
1746
|
+
_context18.next = 29;
|
|
1455
1747
|
return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1456
1748
|
headers: {
|
|
1457
1749
|
Authorization: token
|
|
@@ -1459,7 +1751,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1459
1751
|
});
|
|
1460
1752
|
|
|
1461
1753
|
case 29:
|
|
1462
|
-
res =
|
|
1754
|
+
res = _context18.sent;
|
|
1463
1755
|
|
|
1464
1756
|
case 30:
|
|
1465
1757
|
if (res.data.statusCode === 200) {
|
|
@@ -1482,39 +1774,39 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1482
1774
|
});
|
|
1483
1775
|
}
|
|
1484
1776
|
|
|
1485
|
-
|
|
1777
|
+
_context18.next = 36;
|
|
1486
1778
|
break;
|
|
1487
1779
|
|
|
1488
1780
|
case 33:
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
console.log(
|
|
1781
|
+
_context18.prev = 33;
|
|
1782
|
+
_context18.t0 = _context18["catch"](9);
|
|
1783
|
+
console.log(_context18.t0);
|
|
1492
1784
|
|
|
1493
1785
|
case 36:
|
|
1494
1786
|
loadData();
|
|
1495
1787
|
|
|
1496
1788
|
case 37:
|
|
1497
1789
|
case "end":
|
|
1498
|
-
return
|
|
1790
|
+
return _context18.stop();
|
|
1499
1791
|
}
|
|
1500
1792
|
}
|
|
1501
|
-
},
|
|
1793
|
+
}, _callee18, null, [[9, 33]]);
|
|
1502
1794
|
}));
|
|
1503
1795
|
|
|
1504
|
-
return function sendEvaluation(
|
|
1505
|
-
return
|
|
1796
|
+
return function sendEvaluation(_x9) {
|
|
1797
|
+
return _ref16.apply(this, arguments);
|
|
1506
1798
|
};
|
|
1507
1799
|
}();
|
|
1508
1800
|
|
|
1509
1801
|
var validateAll = /*#__PURE__*/function () {
|
|
1510
|
-
var
|
|
1511
|
-
var _product$id_order2, evaluationArray, conceptArray, dataGeneral,
|
|
1802
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(result) {
|
|
1803
|
+
var _product$id_order2, evaluationArray, conceptArray, dataGeneral, userType, productTemp, status, retailerStatusCopy;
|
|
1512
1804
|
|
|
1513
|
-
return _regenerator.default.wrap(function
|
|
1805
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
1514
1806
|
while (1) {
|
|
1515
|
-
switch (
|
|
1807
|
+
switch (_context19.prev = _context19.next) {
|
|
1516
1808
|
case 0:
|
|
1517
|
-
|
|
1809
|
+
_context19.prev = 0;
|
|
1518
1810
|
setLoading(true);
|
|
1519
1811
|
evaluationArray = [];
|
|
1520
1812
|
conceptArray = ["description", "datasheet", "images"];
|
|
@@ -1539,22 +1831,22 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1539
1831
|
}
|
|
1540
1832
|
}));
|
|
1541
1833
|
});
|
|
1542
|
-
|
|
1834
|
+
_context19.next = 8;
|
|
1543
1835
|
return Promise.all(evaluationArray);
|
|
1544
1836
|
|
|
1545
1837
|
case 8:
|
|
1546
|
-
evalResponse = _context13.sent;
|
|
1547
1838
|
userType = user.is_retailer === 1 ? "CA" : "P";
|
|
1548
1839
|
productTemp = product;
|
|
1549
|
-
|
|
1550
|
-
productTemp.
|
|
1551
|
-
productTemp.
|
|
1552
|
-
productTemp.
|
|
1840
|
+
status = "".concat(result).concat(userType);
|
|
1841
|
+
productTemp.article_status = status;
|
|
1842
|
+
productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : status;
|
|
1843
|
+
productTemp.description_status = productTemp.description_status === "NA" ? "NA" : status;
|
|
1844
|
+
productTemp.images_status = productTemp.images_status === "NA" ? "NA" : status;
|
|
1553
1845
|
retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
|
|
1554
1846
|
Object.keys(retailerStatusCopy).forEach(function (key) {
|
|
1555
1847
|
conceptArray.forEach(function (concept) {
|
|
1556
1848
|
if (retailerStatusCopy[key][concept]) {
|
|
1557
|
-
retailerStatusCopy[key][concept] =
|
|
1849
|
+
retailerStatusCopy[key][concept] = status;
|
|
1558
1850
|
}
|
|
1559
1851
|
});
|
|
1560
1852
|
});
|
|
@@ -1572,37 +1864,37 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1572
1864
|
idCategory: productTemp.article.id_category,
|
|
1573
1865
|
product: productTemp
|
|
1574
1866
|
}));
|
|
1575
|
-
|
|
1867
|
+
_context19.next = 25;
|
|
1576
1868
|
return loadData();
|
|
1577
1869
|
|
|
1578
1870
|
case 25:
|
|
1579
|
-
|
|
1871
|
+
_context19.next = 30;
|
|
1580
1872
|
break;
|
|
1581
1873
|
|
|
1582
1874
|
case 27:
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
console.log(
|
|
1875
|
+
_context19.prev = 27;
|
|
1876
|
+
_context19.t0 = _context19["catch"](0);
|
|
1877
|
+
console.log(_context19.t0);
|
|
1586
1878
|
|
|
1587
1879
|
case 30:
|
|
1588
1880
|
case "end":
|
|
1589
|
-
return
|
|
1881
|
+
return _context19.stop();
|
|
1590
1882
|
}
|
|
1591
1883
|
}
|
|
1592
|
-
},
|
|
1884
|
+
}, _callee19, null, [[0, 27]]);
|
|
1593
1885
|
}));
|
|
1594
1886
|
|
|
1595
|
-
return function validateAll(
|
|
1596
|
-
return
|
|
1887
|
+
return function validateAll(_x10) {
|
|
1888
|
+
return _ref17.apply(this, arguments);
|
|
1597
1889
|
};
|
|
1598
1890
|
}();
|
|
1599
1891
|
|
|
1600
1892
|
var evaluationToRetailer = /*#__PURE__*/function () {
|
|
1601
|
-
var
|
|
1893
|
+
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(result) {
|
|
1602
1894
|
var data, prod, statusComplete;
|
|
1603
|
-
return _regenerator.default.wrap(function
|
|
1895
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
1604
1896
|
while (1) {
|
|
1605
|
-
switch (
|
|
1897
|
+
switch (_context20.prev = _context20.next) {
|
|
1606
1898
|
case 0:
|
|
1607
1899
|
data = {
|
|
1608
1900
|
articleId: product.id_article,
|
|
@@ -1610,7 +1902,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1610
1902
|
versionId: product.version,
|
|
1611
1903
|
status: result
|
|
1612
1904
|
};
|
|
1613
|
-
|
|
1905
|
+
_context20.next = 3;
|
|
1614
1906
|
return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
|
|
1615
1907
|
headers: {
|
|
1616
1908
|
Authorization: token
|
|
@@ -1627,20 +1919,20 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1627
1919
|
prod.product.services_status = "[\"".concat(statusComplete, "\",\"").concat(statusComplete, "\",\"").concat(statusComplete, "\"]");
|
|
1628
1920
|
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
1629
1921
|
setProduct(prod);
|
|
1630
|
-
|
|
1631
|
-
|
|
1922
|
+
showGlobalModal("generic");
|
|
1923
|
+
_context20.next = 15;
|
|
1632
1924
|
return loadData();
|
|
1633
1925
|
|
|
1634
1926
|
case 15:
|
|
1635
1927
|
case "end":
|
|
1636
|
-
return
|
|
1928
|
+
return _context20.stop();
|
|
1637
1929
|
}
|
|
1638
1930
|
}
|
|
1639
|
-
},
|
|
1931
|
+
}, _callee20);
|
|
1640
1932
|
}));
|
|
1641
1933
|
|
|
1642
|
-
return function evaluationToRetailer(
|
|
1643
|
-
return
|
|
1934
|
+
return function evaluationToRetailer(_x11) {
|
|
1935
|
+
return _ref18.apply(this, arguments);
|
|
1644
1936
|
};
|
|
1645
1937
|
}();
|
|
1646
1938
|
|
|
@@ -1698,7 +1990,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1698
1990
|
}
|
|
1699
1991
|
});
|
|
1700
1992
|
});
|
|
1701
|
-
|
|
1993
|
+
showGlobalModal("generic");
|
|
1702
1994
|
} else if (user.is_retailer) {
|
|
1703
1995
|
if (product.id_order || product.orderId) {
|
|
1704
1996
|
sendEvaluation("A");
|
|
@@ -1713,7 +2005,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1713
2005
|
}
|
|
1714
2006
|
});
|
|
1715
2007
|
});
|
|
1716
|
-
|
|
2008
|
+
showGlobalModal("generic");
|
|
1717
2009
|
}
|
|
1718
2010
|
} else {
|
|
1719
2011
|
sendEvaluation("A");
|
|
@@ -1724,7 +2016,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1724
2016
|
} else if (user.is_retailer) {
|
|
1725
2017
|
if (product.id_order || product.orderId) {
|
|
1726
2018
|
setValidatedAll(true);
|
|
1727
|
-
|
|
2019
|
+
showGlobalModal("error");
|
|
1728
2020
|
} else {
|
|
1729
2021
|
setDataGenericModal(function (prev) {
|
|
1730
2022
|
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
@@ -1736,11 +2028,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1736
2028
|
}
|
|
1737
2029
|
});
|
|
1738
2030
|
});
|
|
1739
|
-
|
|
2031
|
+
showGlobalModal("generic");
|
|
1740
2032
|
}
|
|
1741
2033
|
} else {
|
|
1742
2034
|
setValidatedAll(true);
|
|
1743
|
-
|
|
2035
|
+
showGlobalModal("error");
|
|
1744
2036
|
}
|
|
1745
2037
|
}
|
|
1746
2038
|
};
|
|
@@ -1801,7 +2093,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1801
2093
|
}
|
|
1802
2094
|
});
|
|
1803
2095
|
});
|
|
1804
|
-
|
|
2096
|
+
showGlobalModal("generic");
|
|
1805
2097
|
} else if (user.is_retailer) {
|
|
1806
2098
|
if (product.id_order || product.orderId) {
|
|
1807
2099
|
validateAll("A");
|
|
@@ -1816,7 +2108,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1816
2108
|
}
|
|
1817
2109
|
});
|
|
1818
2110
|
});
|
|
1819
|
-
|
|
2111
|
+
showGlobalModal("generic");
|
|
1820
2112
|
}
|
|
1821
2113
|
} else {
|
|
1822
2114
|
validateAll("A");
|
|
@@ -1828,7 +2120,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1828
2120
|
} else if (user.is_retailer) {
|
|
1829
2121
|
if (product.id_order || product.orderId) {
|
|
1830
2122
|
setValidatedAll(true);
|
|
1831
|
-
|
|
2123
|
+
showGlobalModal("error");
|
|
1832
2124
|
} else {
|
|
1833
2125
|
setDataGenericModal(function (prev) {
|
|
1834
2126
|
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
@@ -1840,11 +2132,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1840
2132
|
}
|
|
1841
2133
|
});
|
|
1842
2134
|
});
|
|
1843
|
-
|
|
2135
|
+
showGlobalModal("generic");
|
|
1844
2136
|
}
|
|
1845
2137
|
} else {
|
|
1846
2138
|
setValidatedAll(true);
|
|
1847
|
-
|
|
2139
|
+
showGlobalModal("error");
|
|
1848
2140
|
}
|
|
1849
2141
|
},
|
|
1850
2142
|
approve: function approve() {
|
|
@@ -1959,20 +2251,20 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1959
2251
|
reviewed: crossComment
|
|
1960
2252
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1961
2253
|
buttonType: "circular-button accept-button",
|
|
1962
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1963
|
-
return _regenerator.default.wrap(function
|
|
2254
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
2255
|
+
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
1964
2256
|
while (1) {
|
|
1965
|
-
switch (
|
|
2257
|
+
switch (_context21.prev = _context21.next) {
|
|
1966
2258
|
case 0:
|
|
1967
2259
|
setCrossComment(true);
|
|
1968
2260
|
commentRevised();
|
|
1969
2261
|
|
|
1970
2262
|
case 2:
|
|
1971
2263
|
case "end":
|
|
1972
|
-
return
|
|
2264
|
+
return _context21.stop();
|
|
1973
2265
|
}
|
|
1974
2266
|
}
|
|
1975
|
-
},
|
|
2267
|
+
}, _callee21);
|
|
1976
2268
|
}))
|
|
1977
2269
|
})]
|
|
1978
2270
|
})
|
|
@@ -2026,64 +2318,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2026
2318
|
onClick: function onClick() {
|
|
2027
2319
|
return setMessage("");
|
|
2028
2320
|
}
|
|
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, {
|
|
2321
|
+
}), globalModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GlobalModal, (0, _objectSpread3.default)({
|
|
2322
|
+
close: closeGlobalModal
|
|
2323
|
+
}, globalModal)), showVersionSelector && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VersionSelector.VersionSelector, {
|
|
2087
2324
|
modalId: "version-selector",
|
|
2088
2325
|
articleId: product.id_article,
|
|
2089
2326
|
setVersion: setVersion,
|