contentoh-components-library 21.3.52 → 21.3.53
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 +23 -18
- package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +4 -4
- package/dist/components/organisms/DashboardMetric/dashboardMetricUtils.js +0 -27
- 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 +50 -31
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +89 -127
- package/dist/components/pages/ProviderProductEdition/index.js +392 -647
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +108 -61
- package/dist/components/pages/RetailerProductEdition/index.js +1 -1
- package/dist/index.js +0 -13
- package/package.json +6 -7
- package/src/components/atoms/ButtonV2/styles.js +1 -1
- package/src/components/atoms/Status/styles.js +0 -4
- package/src/components/atoms/VerticalSideMenuMainPage/index.js +22 -18
- package/src/components/atoms/VerticalSideMenuMainPage/styles.js +4 -3
- package/src/components/molecules/AvatarAndValidation/index.js +1 -1
- package/src/components/organisms/DashboardMetric/dashboardMetricUtils.js +1 -18
- package/src/components/organisms/GlobalModal/styles.js +0 -10
- package/src/components/organisms/OrderDetail/index.js +0 -1
- package/src/components/organisms/OrderDetail/styles.js +1 -1
- package/src/components/organisms/OrderDetail/utils/Table/styles.js +1 -0
- package/src/components/pages/Dashboard/Dashboard.stories.js +55 -31
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +96 -135
- package/src/components/pages/ProviderProductEdition/index.js +135 -264
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +111 -61
- package/src/components/pages/RetailerProductEdition/index.js +1 -1
- package/src/index.js +0 -1
- package/dist/assets/fonts/roboto/LICENSE.txt +0 -202
- package/src/components/organisms/TableResizable/TableResizable.stories.js +0 -17
- package/src/components/organisms/TableResizable/index.js +0 -119
- package/src/components/organisms/TableResizable/styles.js +0 -133
- package/src/components/organisms/TableResizable/utils.js +0 -46
|
@@ -53,6 +53,12 @@ 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
|
+
|
|
56
62
|
var _index = require("../../molecules/TagAndInput/index");
|
|
57
63
|
|
|
58
64
|
var _GeneralButton = require("../../atoms/GeneralButton");
|
|
@@ -206,7 +212,7 @@ var myBucket = new _awsSdk.default.S3({
|
|
|
206
212
|
});
|
|
207
213
|
|
|
208
214
|
var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
209
|
-
var _product$retailers, _product$retailersAva, _location$
|
|
215
|
+
var _product$retailers, _product$retailersAva, _location$state, _location$state2, _datasheets$, _datasheets$$data;
|
|
210
216
|
|
|
211
217
|
var tabsSections = _ref.tabsSections,
|
|
212
218
|
_ref$productSelected = _ref.productSelected,
|
|
@@ -221,8 +227,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
221
227
|
revision = _ref$revision === void 0 ? false : _ref$revision,
|
|
222
228
|
setShowContentohRequestModal = _ref.setShowContentohRequestModal,
|
|
223
229
|
showSurvey = _ref.showSurvey,
|
|
224
|
-
company = _ref.company
|
|
225
|
-
addToCart = _ref.addToCart;
|
|
230
|
+
company = _ref.company;
|
|
226
231
|
|
|
227
232
|
var _useState = (0, _react.useState)("Descripción"),
|
|
228
233
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -390,82 +395,106 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
390
395
|
productEdit = _useState38[0],
|
|
391
396
|
setProductEdit = _useState38[1];
|
|
392
397
|
|
|
393
|
-
var _useState39 = (0, _react.useState)(
|
|
398
|
+
var _useState39 = (0, _react.useState)(null),
|
|
394
399
|
_useState40 = (0, _slicedToArray2.default)(_useState39, 2),
|
|
395
|
-
|
|
396
|
-
|
|
400
|
+
icon = _useState40[0],
|
|
401
|
+
setIcon = _useState40[1];
|
|
397
402
|
|
|
398
|
-
var _useState41 = (0, _react.useState)(
|
|
399
|
-
_useState42 = (0, _slicedToArray2.default)(_useState41,
|
|
400
|
-
|
|
403
|
+
var _useState41 = (0, _react.useState)(product === null || product === void 0 ? void 0 : product.version),
|
|
404
|
+
_useState42 = (0, _slicedToArray2.default)(_useState41, 2),
|
|
405
|
+
version = _useState42[0],
|
|
406
|
+
setVersion = _useState42[1];
|
|
401
407
|
|
|
402
|
-
var _useState43 = (0, _react.useState)(
|
|
403
|
-
_useState44 = (0, _slicedToArray2.default)(_useState43,
|
|
404
|
-
|
|
405
|
-
setComment = _useState44[1];
|
|
408
|
+
var _useState43 = (0, _react.useState)({}),
|
|
409
|
+
_useState44 = (0, _slicedToArray2.default)(_useState43, 1),
|
|
410
|
+
comments = _useState44[0];
|
|
406
411
|
|
|
407
|
-
var _useState45 = (0, _react.useState)(
|
|
412
|
+
var _useState45 = (0, _react.useState)(""),
|
|
408
413
|
_useState46 = (0, _slicedToArray2.default)(_useState45, 2),
|
|
409
|
-
|
|
410
|
-
|
|
414
|
+
comment = _useState46[0],
|
|
415
|
+
setComment = _useState46[1];
|
|
411
416
|
|
|
412
|
-
var _useState47 = (0, _react.useState)(
|
|
417
|
+
var _useState47 = (0, _react.useState)(false),
|
|
413
418
|
_useState48 = (0, _slicedToArray2.default)(_useState47, 2),
|
|
414
|
-
|
|
415
|
-
|
|
419
|
+
crossComment = _useState48[0],
|
|
420
|
+
setCrossComment = _useState48[1];
|
|
416
421
|
|
|
417
|
-
var _useState49 = (0, _react.useState)(
|
|
422
|
+
var _useState49 = (0, _react.useState)([]),
|
|
418
423
|
_useState50 = (0, _slicedToArray2.default)(_useState49, 2),
|
|
419
|
-
|
|
420
|
-
|
|
424
|
+
userGroups = _useState50[0],
|
|
425
|
+
setUserGroups = _useState50[1];
|
|
421
426
|
|
|
422
|
-
var _useState51 = (0, _react.useState)(
|
|
427
|
+
var _useState51 = (0, _react.useState)({}),
|
|
423
428
|
_useState52 = (0, _slicedToArray2.default)(_useState51, 2),
|
|
424
|
-
|
|
425
|
-
|
|
429
|
+
assig = _useState52[0],
|
|
430
|
+
setAssig = _useState52[1];
|
|
426
431
|
|
|
427
432
|
var _useState53 = (0, _react.useState)([]),
|
|
428
433
|
_useState54 = (0, _slicedToArray2.default)(_useState53, 2),
|
|
429
|
-
|
|
430
|
-
|
|
434
|
+
selectedImages = _useState54[0],
|
|
435
|
+
setSelectedImages = _useState54[1];
|
|
431
436
|
|
|
432
|
-
var _useState55 = (0, _react.useState)(
|
|
437
|
+
var _useState55 = (0, _react.useState)([]),
|
|
433
438
|
_useState56 = (0, _slicedToArray2.default)(_useState55, 2),
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
var isRetailer = user === null || user === void 0 ? void 0 : user.is_retailer;
|
|
439
|
+
componentsArray = _useState56[0],
|
|
440
|
+
setComponentsArray = _useState56[1];
|
|
438
441
|
|
|
439
|
-
var _useState57 = (0, _react.useState)(
|
|
442
|
+
var _useState57 = (0, _react.useState)(false),
|
|
440
443
|
_useState58 = (0, _slicedToArray2.default)(_useState57, 2),
|
|
441
|
-
|
|
442
|
-
|
|
444
|
+
checkAll = _useState58[0],
|
|
445
|
+
setCheckAll = _useState58[1];
|
|
443
446
|
|
|
444
|
-
var
|
|
447
|
+
var isRetailer = user === null || user === void 0 ? void 0 : user.is_retailer;
|
|
448
|
+
|
|
449
|
+
var _useState59 = (0, _react.useState)(true),
|
|
445
450
|
_useState60 = (0, _slicedToArray2.default)(_useState59, 2),
|
|
446
|
-
|
|
447
|
-
|
|
451
|
+
loading = _useState60[0],
|
|
452
|
+
setLoading = _useState60[1];
|
|
448
453
|
|
|
449
|
-
var _useState61 = (0, _react.useState)(
|
|
450
|
-
"Ficha técnica": null,
|
|
451
|
-
Descripción: null,
|
|
452
|
-
Imágenes: null
|
|
453
|
-
}),
|
|
454
|
+
var _useState61 = (0, _react.useState)(false),
|
|
454
455
|
_useState62 = (0, _slicedToArray2.default)(_useState61, 2),
|
|
455
|
-
|
|
456
|
-
|
|
456
|
+
validatedAll = _useState62[0],
|
|
457
|
+
setValidatedAll = _useState62[1];
|
|
457
458
|
|
|
458
|
-
var
|
|
459
|
+
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
|
+
var _useState63 = (0, _react.useState)({
|
|
462
|
+
"Ficha técnica": originProp,
|
|
463
|
+
Descripción: originProp,
|
|
464
|
+
Imágenes: originProp
|
|
465
|
+
}),
|
|
459
466
|
_useState64 = (0, _slicedToArray2.default)(_useState63, 2),
|
|
460
|
-
|
|
461
|
-
|
|
467
|
+
origin = _useState64[0],
|
|
468
|
+
setOrigin = _useState64[1];
|
|
462
469
|
|
|
463
|
-
var _useState65 = (0, _react.useState)(
|
|
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];
|
|
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)({
|
|
464
491
|
message: "¿Estás seguro de continuar?",
|
|
465
492
|
detail: " ".concat(user.is_retailer ? "Asegurate de haber revisado las tres secciones" : "Envíar el producto a la cadena"),
|
|
466
493
|
button1: {
|
|
467
494
|
name: "Cerrar",
|
|
468
|
-
action:
|
|
495
|
+
action: function action() {
|
|
496
|
+
return setModalViewTextArea(false);
|
|
497
|
+
}
|
|
469
498
|
},
|
|
470
499
|
button2: {
|
|
471
500
|
name: "Continuar",
|
|
@@ -475,402 +504,35 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
475
504
|
},
|
|
476
505
|
img: _defaultProfileImage.default
|
|
477
506
|
}),
|
|
478
|
-
|
|
479
|
-
dataGenericModal =
|
|
480
|
-
setDataGenericModal =
|
|
507
|
+
_useState74 = (0, _slicedToArray2.default)(_useState73, 2),
|
|
508
|
+
dataGenericModal = _useState74[0],
|
|
509
|
+
setDataGenericModal = _useState74[1];
|
|
481
510
|
|
|
482
|
-
var
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
511
|
+
var _useState75 = (0, _react.useState)(false),
|
|
512
|
+
_useState76 = (0, _slicedToArray2.default)(_useState75, 2),
|
|
513
|
+
modalViewTextArea = _useState76[0],
|
|
514
|
+
setModalViewTextArea = _useState76[1];
|
|
486
515
|
|
|
487
|
-
var
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
516
|
+
var _useState77 = (0, _react.useState)(null),
|
|
517
|
+
_useState78 = (0, _slicedToArray2.default)(_useState77, 2),
|
|
518
|
+
socketType = _useState78[0],
|
|
519
|
+
setSocketType = _useState78[1];
|
|
491
520
|
|
|
492
|
-
var
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
521
|
+
var _useState79 = (0, _react.useState)(loading),
|
|
522
|
+
_useState80 = (0, _slicedToArray2.default)(_useState79, 2),
|
|
523
|
+
saving = _useState80[0],
|
|
524
|
+
setSaving = _useState80[1];
|
|
525
|
+
|
|
526
|
+
var _useState81 = (0, _react.useState)(product.statusByRetailer),
|
|
527
|
+
_useState82 = (0, _slicedToArray2.default)(_useState81, 2),
|
|
528
|
+
retailerStatus = _useState82[0],
|
|
529
|
+
setRetailerStatus = _useState82[1];
|
|
496
530
|
|
|
497
531
|
var _useCloseModal = (0, _customHooks.useCloseModal)("version-selector"),
|
|
498
532
|
_useCloseModal2 = (0, _slicedToArray2.default)(_useCloseModal, 2),
|
|
499
533
|
showVersionSelector = _useCloseModal2[0],
|
|
500
534
|
setShowVersionSelector = _useCloseModal2[1];
|
|
501
535
|
|
|
502
|
-
var _useState73 = (0, _react.useState)(),
|
|
503
|
-
_useState74 = (0, _slicedToArray2.default)(_useState73, 2),
|
|
504
|
-
globalModal = _useState74[0],
|
|
505
|
-
setGlobalModal = _useState74[1];
|
|
506
|
-
|
|
507
|
-
var updateAuditStatus = /*#__PURE__*/function () {
|
|
508
|
-
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(status) {
|
|
509
|
-
var productTemp, retailerStatusCopy, conceptArray;
|
|
510
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
511
|
-
while (1) {
|
|
512
|
-
switch (_context2.prev = _context2.next) {
|
|
513
|
-
case 0:
|
|
514
|
-
productTemp = product;
|
|
515
|
-
productTemp.article_status = status;
|
|
516
|
-
productTemp.datasheet_status = status;
|
|
517
|
-
productTemp.description_status = status;
|
|
518
|
-
productTemp.images_status = status;
|
|
519
|
-
retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
|
|
520
|
-
conceptArray = ["description", "datasheet", "images"];
|
|
521
|
-
Object.keys(retailerStatusCopy).forEach(function (key) {
|
|
522
|
-
conceptArray.forEach(function (concept) {
|
|
523
|
-
if (retailerStatusCopy[key][concept]) {
|
|
524
|
-
retailerStatusCopy[key][concept] = status;
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
});
|
|
528
|
-
setRetailerStatus(retailerStatusCopy);
|
|
529
|
-
productTemp.statusByRetailer = retailerStatusCopy;
|
|
530
|
-
setProduct(productTemp);
|
|
531
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
532
|
-
setProductEdit({
|
|
533
|
-
ArticleId: productTemp.id_article,
|
|
534
|
-
idCategory: productTemp.article.id_category,
|
|
535
|
-
product: productTemp
|
|
536
|
-
});
|
|
537
|
-
sessionStorage.setItem("productEdit", JSON.stringify({
|
|
538
|
-
ArticleId: productTemp.id_article,
|
|
539
|
-
idCategory: productTemp.article.id_category,
|
|
540
|
-
product: productTemp
|
|
541
|
-
}));
|
|
542
|
-
_context2.next = 16;
|
|
543
|
-
return loadData();
|
|
544
|
-
|
|
545
|
-
case 16:
|
|
546
|
-
case "end":
|
|
547
|
-
return _context2.stop();
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
}, _callee2);
|
|
551
|
-
}));
|
|
552
|
-
|
|
553
|
-
return function updateAuditStatus(_x2) {
|
|
554
|
-
return _ref3.apply(this, arguments);
|
|
555
|
-
};
|
|
556
|
-
}();
|
|
557
|
-
|
|
558
|
-
var addCart = /*#__PURE__*/function () {
|
|
559
|
-
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(retailers) {
|
|
560
|
-
var article, version, articleToOrder, modatlType, resCart;
|
|
561
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
562
|
-
while (1) {
|
|
563
|
-
switch (_context3.prev = _context3.next) {
|
|
564
|
-
case 0:
|
|
565
|
-
article = product.article, version = product.version;
|
|
566
|
-
articleToOrder = [{
|
|
567
|
-
articleId: article.id_article,
|
|
568
|
-
version: version,
|
|
569
|
-
userId: user.id_user,
|
|
570
|
-
discount: 0,
|
|
571
|
-
subtotal: 0,
|
|
572
|
-
companyId: user.id_company,
|
|
573
|
-
datasheet: retailers,
|
|
574
|
-
description: retailers,
|
|
575
|
-
image: retailers,
|
|
576
|
-
attributeTranslations: false,
|
|
577
|
-
descriptionTranslations: false,
|
|
578
|
-
build: "[]",
|
|
579
|
-
manual: "[]",
|
|
580
|
-
userCreated: user.id_user
|
|
581
|
-
}];
|
|
582
|
-
modatlType = "addedToCartError";
|
|
583
|
-
|
|
584
|
-
if (!addToCart) {
|
|
585
|
-
_context3.next = 8;
|
|
586
|
-
break;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
_context3.next = 6;
|
|
590
|
-
return addToCart({
|
|
591
|
-
data: articleToOrder
|
|
592
|
-
});
|
|
593
|
-
|
|
594
|
-
case 6:
|
|
595
|
-
resCart = _context3.sent;
|
|
596
|
-
|
|
597
|
-
if (resCart.data.statusCode === 200) {
|
|
598
|
-
modatlType = "addedToCart";
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
case 8:
|
|
602
|
-
showGlobalModal(modatlType);
|
|
603
|
-
|
|
604
|
-
case 9:
|
|
605
|
-
case "end":
|
|
606
|
-
return _context3.stop();
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
}, _callee3);
|
|
610
|
-
}));
|
|
611
|
-
|
|
612
|
-
return function addCart(_x3) {
|
|
613
|
-
return _ref4.apply(this, arguments);
|
|
614
|
-
};
|
|
615
|
-
}();
|
|
616
|
-
|
|
617
|
-
var closeGlobalModal = function closeGlobalModal() {
|
|
618
|
-
return setGlobalModal();
|
|
619
|
-
};
|
|
620
|
-
|
|
621
|
-
var seenByProvider = /*#__PURE__*/function () {
|
|
622
|
-
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
623
|
-
var _productTemp$id_order;
|
|
624
|
-
|
|
625
|
-
var productTemp, articleId, orderId, promises, conceptArray;
|
|
626
|
-
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
627
|
-
while (1) {
|
|
628
|
-
switch (_context4.prev = _context4.next) {
|
|
629
|
-
case 0:
|
|
630
|
-
productTemp = product;
|
|
631
|
-
articleId = productTemp.id_article;
|
|
632
|
-
orderId = (_productTemp$id_order = productTemp.id_order) !== null && _productTemp$id_order !== void 0 ? _productTemp$id_order : productTemp.orderId;
|
|
633
|
-
promises = [];
|
|
634
|
-
conceptArray = ["description", "datasheet", "images"];
|
|
635
|
-
conceptArray.forEach(function (concept) {
|
|
636
|
-
var sectionStatusKey = "".concat(concept, "_status");
|
|
637
|
-
var evalStatus = product[sectionStatusKey] || (product === null || product === void 0 ? void 0 : product.version_status);
|
|
638
|
-
var data = {
|
|
639
|
-
articleId: articleId,
|
|
640
|
-
orderId: orderId,
|
|
641
|
-
concept: concept,
|
|
642
|
-
evalStatus: evalStatus
|
|
643
|
-
};
|
|
644
|
-
promises.push(_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
645
|
-
headers: {
|
|
646
|
-
Authorization: token
|
|
647
|
-
}
|
|
648
|
-
}));
|
|
649
|
-
});
|
|
650
|
-
_context4.next = 8;
|
|
651
|
-
return Promise.all(promises);
|
|
652
|
-
|
|
653
|
-
case 8:
|
|
654
|
-
closeGlobalModal();
|
|
655
|
-
_context4.next = 11;
|
|
656
|
-
return updateAuditStatus("FAP");
|
|
657
|
-
|
|
658
|
-
case 11:
|
|
659
|
-
case "end":
|
|
660
|
-
return _context4.stop();
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
}, _callee4);
|
|
664
|
-
}));
|
|
665
|
-
|
|
666
|
-
return function seenByProvider() {
|
|
667
|
-
return _ref5.apply(this, arguments);
|
|
668
|
-
};
|
|
669
|
-
}();
|
|
670
|
-
|
|
671
|
-
var showGlobalModal = (0, _react.useCallback)(function (type) {
|
|
672
|
-
var formatter = new Intl.ListFormat("es", {
|
|
673
|
-
type: "conjunction"
|
|
674
|
-
});
|
|
675
|
-
|
|
676
|
-
switch (type) {
|
|
677
|
-
case "error":
|
|
678
|
-
setGlobalModal({
|
|
679
|
-
message: "".concat(activeTab, " rechazada"),
|
|
680
|
-
detail: "Agrega tu comentarios para enviar el rechazo",
|
|
681
|
-
img: _errorModal.default,
|
|
682
|
-
textArea: true,
|
|
683
|
-
button1: {
|
|
684
|
-
name: "Enviar",
|
|
685
|
-
action: function action(e) {
|
|
686
|
-
var textArea = document.querySelector("#area");
|
|
687
|
-
|
|
688
|
-
if (textArea.value) {
|
|
689
|
-
textArea.style.border = "none";
|
|
690
|
-
createComment(e, textArea.value);
|
|
691
|
-
showGlobalModal("commentsSent");
|
|
692
|
-
validatedAll ? validateAll("R") : sendEvaluation("R");
|
|
693
|
-
} else {
|
|
694
|
-
textArea.style.border = "2px solid red";
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
});
|
|
699
|
-
break;
|
|
700
|
-
|
|
701
|
-
case "generic":
|
|
702
|
-
setGlobalModal(dataGenericModal);
|
|
703
|
-
break;
|
|
704
|
-
|
|
705
|
-
case "commentsSent":
|
|
706
|
-
setGlobalModal({
|
|
707
|
-
message: "Gracias, tus comentarios fueron entregados.",
|
|
708
|
-
detail: "Trabajaremos en conjunto para resolverlo.",
|
|
709
|
-
button1: {
|
|
710
|
-
name: "Cerrar",
|
|
711
|
-
action: closeGlobalModal
|
|
712
|
-
},
|
|
713
|
-
img: _defaultProfileImage.default,
|
|
714
|
-
textArea: false
|
|
715
|
-
});
|
|
716
|
-
break;
|
|
717
|
-
|
|
718
|
-
case "RAC":
|
|
719
|
-
var servicesRejected = [];
|
|
720
|
-
var translateServices = {
|
|
721
|
-
datasheet: "ficha técnica",
|
|
722
|
-
description: "descripción",
|
|
723
|
-
images: "imágenes"
|
|
724
|
-
};
|
|
725
|
-
Object.keys(translateServices).forEach(function (service) {
|
|
726
|
-
if (product["".concat(service, "_status")] === "RAC") {
|
|
727
|
-
servicesRejected.push(translateServices[service]);
|
|
728
|
-
}
|
|
729
|
-
});
|
|
730
|
-
var plural = ["Los servicios", "cumplen"];
|
|
731
|
-
var singular = ["El servicio", "cumple"];
|
|
732
|
-
var grammar = servicesRejected.length > 1 ? plural : singular;
|
|
733
|
-
var formatted = formatter.format(servicesRejected);
|
|
734
|
-
var text1 = "".concat(grammar[0], " de ").concat(formatted, " no ").concat(grammar[1], " con lo que la cadena necesita.");
|
|
735
|
-
var text2 = "\xA1Solicita el servicio de Content-oh! para completarlo!";
|
|
736
|
-
var retailers = product.retailersWithService.map(function (retailer) {
|
|
737
|
-
return Number(retailer);
|
|
738
|
-
});
|
|
739
|
-
setGlobalModal({
|
|
740
|
-
message: "Tu producto no cumple con los requerimientos de la cadena",
|
|
741
|
-
customComponent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
742
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
743
|
-
className: "generic-text",
|
|
744
|
-
children: [text1, /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), text2]
|
|
745
|
-
})
|
|
746
|
-
}),
|
|
747
|
-
button1: {
|
|
748
|
-
name: "Continuar",
|
|
749
|
-
action: function () {
|
|
750
|
-
var _action = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
751
|
-
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
752
|
-
while (1) {
|
|
753
|
-
switch (_context5.prev = _context5.next) {
|
|
754
|
-
case 0:
|
|
755
|
-
_context5.next = 2;
|
|
756
|
-
return seenByProvider();
|
|
757
|
-
|
|
758
|
-
case 2:
|
|
759
|
-
return _context5.abrupt("return", _context5.sent);
|
|
760
|
-
|
|
761
|
-
case 3:
|
|
762
|
-
case "end":
|
|
763
|
-
return _context5.stop();
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
}, _callee5);
|
|
767
|
-
}));
|
|
768
|
-
|
|
769
|
-
function action() {
|
|
770
|
-
return _action.apply(this, arguments);
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
return action;
|
|
774
|
-
}()
|
|
775
|
-
},
|
|
776
|
-
button2: {
|
|
777
|
-
name: "Solicitar a Content-oh!",
|
|
778
|
-
action: function () {
|
|
779
|
-
var _action2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
780
|
-
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
781
|
-
while (1) {
|
|
782
|
-
switch (_context6.prev = _context6.next) {
|
|
783
|
-
case 0:
|
|
784
|
-
_context6.next = 2;
|
|
785
|
-
return addCart(retailers);
|
|
786
|
-
|
|
787
|
-
case 2:
|
|
788
|
-
_context6.next = 4;
|
|
789
|
-
return seenByProvider();
|
|
790
|
-
|
|
791
|
-
case 4:
|
|
792
|
-
case "end":
|
|
793
|
-
return _context6.stop();
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
}, _callee6);
|
|
797
|
-
}));
|
|
798
|
-
|
|
799
|
-
function action() {
|
|
800
|
-
return _action2.apply(this, arguments);
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
return action;
|
|
804
|
-
}()
|
|
805
|
-
},
|
|
806
|
-
img: _errorModal.default
|
|
807
|
-
});
|
|
808
|
-
break;
|
|
809
|
-
|
|
810
|
-
case "AAC":
|
|
811
|
-
setGlobalModal({
|
|
812
|
-
message: "Felicidades",
|
|
813
|
-
detail: "Tu producto cumple con los requerimientos de la cadena.",
|
|
814
|
-
button1: {
|
|
815
|
-
name: "Continuar",
|
|
816
|
-
action: function () {
|
|
817
|
-
var _action3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
818
|
-
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
819
|
-
while (1) {
|
|
820
|
-
switch (_context7.prev = _context7.next) {
|
|
821
|
-
case 0:
|
|
822
|
-
_context7.next = 2;
|
|
823
|
-
return seenByProvider();
|
|
824
|
-
|
|
825
|
-
case 2:
|
|
826
|
-
return _context7.abrupt("return", _context7.sent);
|
|
827
|
-
|
|
828
|
-
case 3:
|
|
829
|
-
case "end":
|
|
830
|
-
return _context7.stop();
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
}, _callee7);
|
|
834
|
-
}));
|
|
835
|
-
|
|
836
|
-
function action() {
|
|
837
|
-
return _action3.apply(this, arguments);
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
return action;
|
|
841
|
-
}()
|
|
842
|
-
},
|
|
843
|
-
img: _defaultProfileImage.default
|
|
844
|
-
});
|
|
845
|
-
break;
|
|
846
|
-
|
|
847
|
-
case "addedToCartError":
|
|
848
|
-
setGlobalModal({
|
|
849
|
-
detail: "Parece que algo salió mal al intentar añadir tu producto a tu carrito.",
|
|
850
|
-
button1: {
|
|
851
|
-
name: "Continuar",
|
|
852
|
-
action: closeGlobalModal
|
|
853
|
-
}
|
|
854
|
-
});
|
|
855
|
-
break;
|
|
856
|
-
|
|
857
|
-
case "addedToCart":
|
|
858
|
-
setGlobalModal({
|
|
859
|
-
message: "Producto añadido",
|
|
860
|
-
detail: "Tu producto se añadió al carrito de compras.",
|
|
861
|
-
button1: {
|
|
862
|
-
name: "Continuar",
|
|
863
|
-
action: closeGlobalModal
|
|
864
|
-
},
|
|
865
|
-
img: _defaultProfileImage.default
|
|
866
|
-
});
|
|
867
|
-
break;
|
|
868
|
-
|
|
869
|
-
default:
|
|
870
|
-
closeGlobalModal();
|
|
871
|
-
break;
|
|
872
|
-
}
|
|
873
|
-
}, [activeTab, dataGenericModal, product]);
|
|
874
536
|
(0, _react.useEffect)(function () {
|
|
875
537
|
checkAll && setSelectedImages(images.values);
|
|
876
538
|
}, [checkAll]);
|
|
@@ -879,36 +541,24 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
879
541
|
setActiveTab("Imágenes");
|
|
880
542
|
}
|
|
881
543
|
}, [showModal]);
|
|
882
|
-
(0, _react.useEffect)(function () {
|
|
883
|
-
var _location$state, _location$state2, _location$state3;
|
|
884
|
-
|
|
885
|
-
console.log({
|
|
886
|
-
location: location
|
|
887
|
-
});
|
|
888
|
-
setOrigin({
|
|
889
|
-
"Ficha técnica": location === null || location === void 0 ? void 0 : (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.origin,
|
|
890
|
-
Descripción: location === null || location === void 0 ? void 0 : (_location$state2 = location.state) === null || _location$state2 === void 0 ? void 0 : _location$state2.origin,
|
|
891
|
-
Imágenes: location === null || location === void 0 ? void 0 : (_location$state3 = location.state) === null || _location$state3 === void 0 ? void 0 : _location$state3.origin
|
|
892
|
-
});
|
|
893
|
-
}, [location === null || location === void 0 ? void 0 : (_location$state4 = location.state) === null || _location$state4 === void 0 ? void 0 : _location$state4.origin]);
|
|
894
544
|
|
|
895
545
|
var loadData = /*#__PURE__*/function () {
|
|
896
|
-
var
|
|
546
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
897
547
|
var _product$article, _product$article2, _product$article3, _services$, _services$$values;
|
|
898
548
|
|
|
899
549
|
var services;
|
|
900
|
-
return _regenerator.default.wrap(function
|
|
550
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
901
551
|
while (1) {
|
|
902
|
-
switch (
|
|
552
|
+
switch (_context2.prev = _context2.next) {
|
|
903
553
|
case 0:
|
|
904
|
-
|
|
554
|
+
_context2.next = 2;
|
|
905
555
|
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);
|
|
906
556
|
|
|
907
557
|
case 2:
|
|
908
|
-
services =
|
|
558
|
+
services = _context2.sent;
|
|
909
559
|
//Converts the data inside the datasheets object to array
|
|
910
560
|
setServices(services);
|
|
911
|
-
|
|
561
|
+
_context2.next = 6;
|
|
912
562
|
return getServices();
|
|
913
563
|
|
|
914
564
|
case 6:
|
|
@@ -926,26 +576,26 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
926
576
|
|
|
927
577
|
case 10:
|
|
928
578
|
case "end":
|
|
929
|
-
return
|
|
579
|
+
return _context2.stop();
|
|
930
580
|
}
|
|
931
581
|
}
|
|
932
|
-
},
|
|
582
|
+
}, _callee2);
|
|
933
583
|
}));
|
|
934
584
|
|
|
935
585
|
return function loadData() {
|
|
936
|
-
return
|
|
586
|
+
return _ref3.apply(this, arguments);
|
|
937
587
|
};
|
|
938
588
|
}();
|
|
939
589
|
|
|
940
590
|
var getServices = /*#__PURE__*/function () {
|
|
941
|
-
var
|
|
591
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
942
592
|
var _product$article4;
|
|
943
593
|
|
|
944
594
|
var productInOrder, idArticle, retailers, active, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse, retailerResponse;
|
|
945
595
|
|
|
946
|
-
return _regenerator.default.wrap(function
|
|
596
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
947
597
|
while (1) {
|
|
948
|
-
switch (
|
|
598
|
+
switch (_context3.prev = _context3.next) {
|
|
949
599
|
case 0:
|
|
950
600
|
productInOrder = product.id_order || product.orderId;
|
|
951
601
|
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);
|
|
@@ -953,15 +603,15 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
953
603
|
active = null;
|
|
954
604
|
|
|
955
605
|
if (!(isRevision() || productInOrder)) {
|
|
956
|
-
|
|
606
|
+
_context3.next = 12;
|
|
957
607
|
break;
|
|
958
608
|
}
|
|
959
609
|
|
|
960
|
-
|
|
610
|
+
_context3.next = 7;
|
|
961
611
|
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"));
|
|
962
612
|
|
|
963
613
|
case 7:
|
|
964
|
-
servicesResponse =
|
|
614
|
+
servicesResponse = _context3.sent;
|
|
965
615
|
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;
|
|
966
616
|
retailerResponse = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
|
|
967
617
|
return srv.id_retailer;
|
|
@@ -976,14 +626,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
976
626
|
|
|
977
627
|
case 13:
|
|
978
628
|
case "end":
|
|
979
|
-
return
|
|
629
|
+
return _context3.stop();
|
|
980
630
|
}
|
|
981
631
|
}
|
|
982
|
-
},
|
|
632
|
+
}, _callee3);
|
|
983
633
|
}));
|
|
984
634
|
|
|
985
635
|
return function getServices() {
|
|
986
|
-
return
|
|
636
|
+
return _ref4.apply(this, arguments);
|
|
987
637
|
};
|
|
988
638
|
}();
|
|
989
639
|
|
|
@@ -999,13 +649,6 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
999
649
|
var _revision = ["RequestWithContentoh", "RequestWithoutContentoh", "Contentoh"].includes(orgn);
|
|
1000
650
|
|
|
1001
651
|
if (_isRetailer) {
|
|
1002
|
-
console.log({
|
|
1003
|
-
origin: origin[activeTab],
|
|
1004
|
-
concept: concept,
|
|
1005
|
-
orgn: orgn,
|
|
1006
|
-
revision: _revision,
|
|
1007
|
-
currentService: currentService
|
|
1008
|
-
});
|
|
1009
652
|
if (_revision && currentService === "AP") return true;
|
|
1010
653
|
} else {
|
|
1011
654
|
var _product = productEdit.product;
|
|
@@ -1020,13 +663,13 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1020
663
|
};
|
|
1021
664
|
|
|
1022
665
|
var getCart = /*#__PURE__*/function () {
|
|
1023
|
-
var
|
|
666
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
1024
667
|
var res, arr;
|
|
1025
|
-
return _regenerator.default.wrap(function
|
|
668
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
1026
669
|
while (1) {
|
|
1027
|
-
switch (
|
|
670
|
+
switch (_context4.prev = _context4.next) {
|
|
1028
671
|
case 0:
|
|
1029
|
-
|
|
672
|
+
_context4.next = 2;
|
|
1030
673
|
return _axios.default.get(process.env.REACT_APP_CART, {
|
|
1031
674
|
headers: {
|
|
1032
675
|
Authorization: token
|
|
@@ -1034,7 +677,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1034
677
|
});
|
|
1035
678
|
|
|
1036
679
|
case 2:
|
|
1037
|
-
res =
|
|
680
|
+
res = _context4.sent;
|
|
1038
681
|
arr = JSON.parse(res.data.body).data.map(function (e) {
|
|
1039
682
|
return e.article_id;
|
|
1040
683
|
});
|
|
@@ -1044,14 +687,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1044
687
|
|
|
1045
688
|
case 5:
|
|
1046
689
|
case "end":
|
|
1047
|
-
return
|
|
690
|
+
return _context4.stop();
|
|
1048
691
|
}
|
|
1049
692
|
}
|
|
1050
|
-
},
|
|
693
|
+
}, _callee4);
|
|
1051
694
|
}));
|
|
1052
695
|
|
|
1053
696
|
return function getCart() {
|
|
1054
|
-
return
|
|
697
|
+
return _ref5.apply(this, arguments);
|
|
1055
698
|
};
|
|
1056
699
|
}();
|
|
1057
700
|
|
|
@@ -1066,7 +709,6 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1066
709
|
action: "orderImages",
|
|
1067
710
|
retailerId: activeRetailer.id
|
|
1068
711
|
});
|
|
1069
|
-
if (["RAC", "AAC"].includes(product.article_status)) showGlobalModal(product.article_status);
|
|
1070
712
|
}, [product, version]);
|
|
1071
713
|
(0, _react.useEffect)(function () {
|
|
1072
714
|
setImages({
|
|
@@ -1177,11 +819,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1177
819
|
}, [images]);
|
|
1178
820
|
|
|
1179
821
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
1180
|
-
var
|
|
822
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
1181
823
|
var dataObject, res;
|
|
1182
|
-
return _regenerator.default.wrap(function
|
|
824
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
1183
825
|
while (1) {
|
|
1184
|
-
switch (
|
|
826
|
+
switch (_context5.prev = _context5.next) {
|
|
1185
827
|
case 0:
|
|
1186
828
|
setLoading(true);
|
|
1187
829
|
dataObject = {
|
|
@@ -1189,8 +831,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1189
831
|
articleData: updatedDescriptions
|
|
1190
832
|
};
|
|
1191
833
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1192
|
-
|
|
1193
|
-
|
|
834
|
+
_context5.prev = 3;
|
|
835
|
+
_context5.next = 6;
|
|
1194
836
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
1195
837
|
headers: {
|
|
1196
838
|
Authorization: token
|
|
@@ -1198,45 +840,45 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1198
840
|
});
|
|
1199
841
|
|
|
1200
842
|
case 6:
|
|
1201
|
-
res =
|
|
843
|
+
res = _context5.sent;
|
|
1202
844
|
|
|
1203
845
|
if (!(res.data.statusCode === 200)) {
|
|
1204
|
-
|
|
846
|
+
_context5.next = 11;
|
|
1205
847
|
break;
|
|
1206
848
|
}
|
|
1207
849
|
|
|
1208
850
|
setMessage("Descripciones guardadas con éxito");
|
|
1209
|
-
|
|
851
|
+
_context5.next = 11;
|
|
1210
852
|
return loadData();
|
|
1211
853
|
|
|
1212
854
|
case 11:
|
|
1213
|
-
|
|
855
|
+
_context5.next = 16;
|
|
1214
856
|
break;
|
|
1215
857
|
|
|
1216
858
|
case 13:
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
console.log(
|
|
859
|
+
_context5.prev = 13;
|
|
860
|
+
_context5.t0 = _context5["catch"](3);
|
|
861
|
+
console.log(_context5.t0);
|
|
1220
862
|
|
|
1221
863
|
case 16:
|
|
1222
864
|
case "end":
|
|
1223
|
-
return
|
|
865
|
+
return _context5.stop();
|
|
1224
866
|
}
|
|
1225
867
|
}
|
|
1226
|
-
},
|
|
868
|
+
}, _callee5, null, [[3, 13]]);
|
|
1227
869
|
}));
|
|
1228
870
|
|
|
1229
871
|
return function saveDescriptions() {
|
|
1230
|
-
return
|
|
872
|
+
return _ref6.apply(this, arguments);
|
|
1231
873
|
};
|
|
1232
874
|
}();
|
|
1233
875
|
|
|
1234
876
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
1235
|
-
var
|
|
877
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
1236
878
|
var dataObject, res;
|
|
1237
|
-
return _regenerator.default.wrap(function
|
|
879
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
1238
880
|
while (1) {
|
|
1239
|
-
switch (
|
|
881
|
+
switch (_context6.prev = _context6.next) {
|
|
1240
882
|
case 0:
|
|
1241
883
|
setLoading(true);
|
|
1242
884
|
dataObject = {
|
|
@@ -1244,8 +886,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1244
886
|
articleData: updatedDatasheets
|
|
1245
887
|
};
|
|
1246
888
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1247
|
-
|
|
1248
|
-
|
|
889
|
+
_context6.prev = 3;
|
|
890
|
+
_context6.next = 6;
|
|
1249
891
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
1250
892
|
headers: {
|
|
1251
893
|
Authorization: token
|
|
@@ -1253,47 +895,47 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1253
895
|
});
|
|
1254
896
|
|
|
1255
897
|
case 6:
|
|
1256
|
-
res =
|
|
898
|
+
res = _context6.sent;
|
|
1257
899
|
|
|
1258
900
|
if (!(res.data.statusCode === 200)) {
|
|
1259
|
-
|
|
901
|
+
_context6.next = 11;
|
|
1260
902
|
break;
|
|
1261
903
|
}
|
|
1262
904
|
|
|
1263
905
|
setMessage("Fichas técnicas guardadas");
|
|
1264
|
-
|
|
906
|
+
_context6.next = 11;
|
|
1265
907
|
return loadData();
|
|
1266
908
|
|
|
1267
909
|
case 11:
|
|
1268
|
-
|
|
910
|
+
_context6.next = 16;
|
|
1269
911
|
break;
|
|
1270
912
|
|
|
1271
913
|
case 13:
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
console.log(
|
|
914
|
+
_context6.prev = 13;
|
|
915
|
+
_context6.t0 = _context6["catch"](3);
|
|
916
|
+
console.log(_context6.t0);
|
|
1275
917
|
|
|
1276
918
|
case 16:
|
|
1277
919
|
case "end":
|
|
1278
|
-
return
|
|
920
|
+
return _context6.stop();
|
|
1279
921
|
}
|
|
1280
922
|
}
|
|
1281
|
-
},
|
|
923
|
+
}, _callee6, null, [[3, 13]]);
|
|
1282
924
|
}));
|
|
1283
925
|
|
|
1284
926
|
return function saveDatasheets() {
|
|
1285
|
-
return
|
|
927
|
+
return _ref7.apply(this, arguments);
|
|
1286
928
|
};
|
|
1287
929
|
}();
|
|
1288
930
|
|
|
1289
|
-
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
931
|
+
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
1290
932
|
var _images$values2, _data$articleData, _data$articleData2, _data$updateImages;
|
|
1291
933
|
|
|
1292
934
|
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
1293
935
|
|
|
1294
|
-
return _regenerator.default.wrap(function
|
|
936
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1295
937
|
while (1) {
|
|
1296
|
-
switch (
|
|
938
|
+
switch (_context7.prev = _context7.next) {
|
|
1297
939
|
case 0:
|
|
1298
940
|
imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
|
|
1299
941
|
imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
|
|
@@ -1342,19 +984,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1342
984
|
}
|
|
1343
985
|
|
|
1344
986
|
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
1345
|
-
|
|
987
|
+
_context7.next = 31;
|
|
1346
988
|
break;
|
|
1347
989
|
}
|
|
1348
990
|
|
|
1349
991
|
setLoading(true);
|
|
1350
|
-
|
|
992
|
+
_context7.prev = 11;
|
|
1351
993
|
data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
|
|
1352
994
|
e.uuid = (0, _uuid.v4)();
|
|
1353
995
|
});
|
|
1354
996
|
setDataImages(data);
|
|
1355
997
|
|
|
1356
998
|
if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
|
|
1357
|
-
|
|
999
|
+
_context7.next = 23;
|
|
1358
1000
|
break;
|
|
1359
1001
|
}
|
|
1360
1002
|
|
|
@@ -1370,28 +1012,28 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1370
1012
|
};
|
|
1371
1013
|
promiseArray.push(myBucket.putObject(params).promise());
|
|
1372
1014
|
});
|
|
1373
|
-
|
|
1015
|
+
_context7.next = 20;
|
|
1374
1016
|
return Promise.all(promiseArray);
|
|
1375
1017
|
|
|
1376
1018
|
case 20:
|
|
1377
1019
|
setImagesUploaded(true);
|
|
1378
|
-
|
|
1020
|
+
_context7.next = 24;
|
|
1379
1021
|
break;
|
|
1380
1022
|
|
|
1381
1023
|
case 23:
|
|
1382
1024
|
setImagesUploaded(true);
|
|
1383
1025
|
|
|
1384
1026
|
case 24:
|
|
1385
|
-
|
|
1027
|
+
_context7.next = 29;
|
|
1386
1028
|
break;
|
|
1387
1029
|
|
|
1388
1030
|
case 26:
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
console.log(
|
|
1031
|
+
_context7.prev = 26;
|
|
1032
|
+
_context7.t0 = _context7["catch"](11);
|
|
1033
|
+
console.log(_context7.t0); // setMainLoading(false);
|
|
1392
1034
|
|
|
1393
1035
|
case 29:
|
|
1394
|
-
|
|
1036
|
+
_context7.next = 32;
|
|
1395
1037
|
break;
|
|
1396
1038
|
|
|
1397
1039
|
case 31:
|
|
@@ -1400,19 +1042,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1400
1042
|
|
|
1401
1043
|
case 32:
|
|
1402
1044
|
case "end":
|
|
1403
|
-
return
|
|
1045
|
+
return _context7.stop();
|
|
1404
1046
|
}
|
|
1405
1047
|
}
|
|
1406
|
-
},
|
|
1048
|
+
}, _callee7, null, [[11, 26]]);
|
|
1407
1049
|
})), [images, imagesUploaded]);
|
|
1408
|
-
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1050
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
1409
1051
|
var res;
|
|
1410
|
-
return _regenerator.default.wrap(function
|
|
1052
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
1411
1053
|
while (1) {
|
|
1412
|
-
switch (
|
|
1054
|
+
switch (_context8.prev = _context8.next) {
|
|
1413
1055
|
case 0:
|
|
1414
1056
|
if (!imagesUploaded) {
|
|
1415
|
-
|
|
1057
|
+
_context8.next = 16;
|
|
1416
1058
|
break;
|
|
1417
1059
|
}
|
|
1418
1060
|
|
|
@@ -1424,8 +1066,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1424
1066
|
if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1425
1067
|
return e;
|
|
1426
1068
|
});
|
|
1427
|
-
|
|
1428
|
-
|
|
1069
|
+
_context8.prev = 2;
|
|
1070
|
+
_context8.next = 5;
|
|
1429
1071
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
|
|
1430
1072
|
headers: {
|
|
1431
1073
|
Authorization: token
|
|
@@ -1433,33 +1075,33 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1433
1075
|
});
|
|
1434
1076
|
|
|
1435
1077
|
case 5:
|
|
1436
|
-
res =
|
|
1078
|
+
res = _context8.sent;
|
|
1437
1079
|
|
|
1438
1080
|
if (!(res.data.statusCode === 200)) {
|
|
1439
|
-
|
|
1081
|
+
_context8.next = 11;
|
|
1440
1082
|
break;
|
|
1441
1083
|
}
|
|
1442
1084
|
|
|
1443
1085
|
setMessage("Imágenes guardadas con éxito");
|
|
1444
1086
|
sessionStorage.removeItem("imagesList");
|
|
1445
|
-
|
|
1087
|
+
_context8.next = 11;
|
|
1446
1088
|
return loadData();
|
|
1447
1089
|
|
|
1448
1090
|
case 11:
|
|
1449
|
-
|
|
1091
|
+
_context8.next = 16;
|
|
1450
1092
|
break;
|
|
1451
1093
|
|
|
1452
1094
|
case 13:
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
console.log(
|
|
1095
|
+
_context8.prev = 13;
|
|
1096
|
+
_context8.t0 = _context8["catch"](2);
|
|
1097
|
+
console.log(_context8.t0);
|
|
1456
1098
|
|
|
1457
1099
|
case 16:
|
|
1458
1100
|
case "end":
|
|
1459
|
-
return
|
|
1101
|
+
return _context8.stop();
|
|
1460
1102
|
}
|
|
1461
1103
|
}
|
|
1462
|
-
},
|
|
1104
|
+
}, _callee8, null, [[2, 13]]);
|
|
1463
1105
|
})), [dataImages, imagesUploaded]);
|
|
1464
1106
|
|
|
1465
1107
|
var getConcept = function getConcept(tab) {
|
|
@@ -1475,29 +1117,48 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1475
1117
|
}
|
|
1476
1118
|
};
|
|
1477
1119
|
|
|
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
|
+
|
|
1478
1139
|
var createComment = /*#__PURE__*/function () {
|
|
1479
|
-
var
|
|
1140
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(e, body, tab) {
|
|
1480
1141
|
var concept, data;
|
|
1481
|
-
return _regenerator.default.wrap(function
|
|
1142
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1482
1143
|
while (1) {
|
|
1483
|
-
switch (
|
|
1144
|
+
switch (_context9.prev = _context9.next) {
|
|
1484
1145
|
case 0:
|
|
1485
1146
|
concept = "";
|
|
1486
|
-
|
|
1487
|
-
|
|
1147
|
+
_context9.t0 = activeTab;
|
|
1148
|
+
_context9.next = _context9.t0 === "Ficha técnica" ? 4 : _context9.t0 === "Imágenes" ? 6 : 8;
|
|
1488
1149
|
break;
|
|
1489
1150
|
|
|
1490
1151
|
case 4:
|
|
1491
1152
|
concept = "datasheet";
|
|
1492
|
-
return
|
|
1153
|
+
return _context9.abrupt("break", 10);
|
|
1493
1154
|
|
|
1494
1155
|
case 6:
|
|
1495
1156
|
concept = "images";
|
|
1496
|
-
return
|
|
1157
|
+
return _context9.abrupt("break", 10);
|
|
1497
1158
|
|
|
1498
1159
|
case 8:
|
|
1499
1160
|
concept = "description";
|
|
1500
|
-
return
|
|
1161
|
+
return _context9.abrupt("break", 10);
|
|
1501
1162
|
|
|
1502
1163
|
case 10:
|
|
1503
1164
|
data = {
|
|
@@ -1507,7 +1168,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1507
1168
|
concept: concept,
|
|
1508
1169
|
version: version
|
|
1509
1170
|
};
|
|
1510
|
-
|
|
1171
|
+
_context9.next = 13;
|
|
1511
1172
|
return _axios.default.post("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1512
1173
|
headers: {
|
|
1513
1174
|
Authorization: token
|
|
@@ -1516,14 +1177,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1516
1177
|
|
|
1517
1178
|
case 13:
|
|
1518
1179
|
case "end":
|
|
1519
|
-
return
|
|
1180
|
+
return _context9.stop();
|
|
1520
1181
|
}
|
|
1521
1182
|
}
|
|
1522
|
-
},
|
|
1183
|
+
}, _callee9);
|
|
1523
1184
|
}));
|
|
1524
1185
|
|
|
1525
|
-
return function createComment(
|
|
1526
|
-
return
|
|
1186
|
+
return function createComment(_x2, _x3, _x4) {
|
|
1187
|
+
return _ref10.apply(this, arguments);
|
|
1527
1188
|
};
|
|
1528
1189
|
}();
|
|
1529
1190
|
|
|
@@ -1532,16 +1193,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1532
1193
|
}, [activeTab]);
|
|
1533
1194
|
|
|
1534
1195
|
var commentRevised = /*#__PURE__*/function () {
|
|
1535
|
-
var
|
|
1196
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
1536
1197
|
var data;
|
|
1537
|
-
return _regenerator.default.wrap(function
|
|
1198
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1538
1199
|
while (1) {
|
|
1539
|
-
switch (
|
|
1200
|
+
switch (_context10.prev = _context10.next) {
|
|
1540
1201
|
case 0:
|
|
1541
1202
|
data = {
|
|
1542
1203
|
commentId: comment.id
|
|
1543
1204
|
};
|
|
1544
|
-
|
|
1205
|
+
_context10.next = 3;
|
|
1545
1206
|
return _axios.default.put("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1546
1207
|
headers: {
|
|
1547
1208
|
Authorization: token
|
|
@@ -1553,40 +1214,40 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1553
1214
|
|
|
1554
1215
|
case 4:
|
|
1555
1216
|
case "end":
|
|
1556
|
-
return
|
|
1217
|
+
return _context10.stop();
|
|
1557
1218
|
}
|
|
1558
1219
|
}
|
|
1559
|
-
},
|
|
1220
|
+
}, _callee10);
|
|
1560
1221
|
}));
|
|
1561
1222
|
|
|
1562
1223
|
return function commentRevised() {
|
|
1563
|
-
return
|
|
1224
|
+
return _ref11.apply(this, arguments);
|
|
1564
1225
|
};
|
|
1565
1226
|
}();
|
|
1566
1227
|
|
|
1567
1228
|
var setAssignation = /*#__PURE__*/function () {
|
|
1568
|
-
var
|
|
1229
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(assignationType, assignationId) {
|
|
1569
1230
|
var concept, productTemp, data;
|
|
1570
|
-
return _regenerator.default.wrap(function
|
|
1231
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1571
1232
|
while (1) {
|
|
1572
|
-
switch (
|
|
1233
|
+
switch (_context11.prev = _context11.next) {
|
|
1573
1234
|
case 0:
|
|
1574
1235
|
concept = "";
|
|
1575
|
-
|
|
1576
|
-
|
|
1236
|
+
_context11.t0 = activeTab;
|
|
1237
|
+
_context11.next = _context11.t0 === "Ficha técnica" ? 4 : _context11.t0 === "Imágenes" ? 6 : 8;
|
|
1577
1238
|
break;
|
|
1578
1239
|
|
|
1579
1240
|
case 4:
|
|
1580
1241
|
concept = "datasheet";
|
|
1581
|
-
return
|
|
1242
|
+
return _context11.abrupt("break", 10);
|
|
1582
1243
|
|
|
1583
1244
|
case 6:
|
|
1584
1245
|
concept = "images";
|
|
1585
|
-
return
|
|
1246
|
+
return _context11.abrupt("break", 10);
|
|
1586
1247
|
|
|
1587
1248
|
case 8:
|
|
1588
1249
|
concept = "description";
|
|
1589
|
-
return
|
|
1250
|
+
return _context11.abrupt("break", 10);
|
|
1590
1251
|
|
|
1591
1252
|
case 10:
|
|
1592
1253
|
productTemp = product;
|
|
@@ -1599,7 +1260,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1599
1260
|
concept: concept,
|
|
1600
1261
|
userId: assignationId
|
|
1601
1262
|
};
|
|
1602
|
-
|
|
1263
|
+
_context11.next = 15;
|
|
1603
1264
|
return (0, _axios.default)({
|
|
1604
1265
|
method: "post",
|
|
1605
1266
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
@@ -1615,17 +1276,35 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1615
1276
|
|
|
1616
1277
|
case 17:
|
|
1617
1278
|
case "end":
|
|
1618
|
-
return
|
|
1279
|
+
return _context11.stop();
|
|
1619
1280
|
}
|
|
1620
1281
|
}
|
|
1621
|
-
},
|
|
1282
|
+
}, _callee11);
|
|
1622
1283
|
}));
|
|
1623
1284
|
|
|
1624
|
-
return function setAssignation(
|
|
1625
|
-
return
|
|
1285
|
+
return function setAssignation(_x5, _x6) {
|
|
1286
|
+
return _ref12.apply(this, arguments);
|
|
1626
1287
|
};
|
|
1627
1288
|
}();
|
|
1628
1289
|
|
|
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
|
+
|
|
1629
1308
|
var downloadImages = function downloadImages() {
|
|
1630
1309
|
var _images$values3;
|
|
1631
1310
|
|
|
@@ -1705,21 +1384,33 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1705
1384
|
}
|
|
1706
1385
|
};
|
|
1707
1386
|
|
|
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
|
+
|
|
1708
1399
|
var sendEvaluation = /*#__PURE__*/function () {
|
|
1709
|
-
var
|
|
1710
|
-
var _productTemp$
|
|
1400
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(result) {
|
|
1401
|
+
var _productTemp$id_order;
|
|
1711
1402
|
|
|
1712
1403
|
var concept, productTemp, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, res, newStatuses, orderStatus, serviceStatus, newProductEdit, showSurveyByProvider, showSurveyByRetailer, _JSON$parse, newArticleStatus, newServiceStatus, newStatus, retailerStatusCopy, status;
|
|
1713
1404
|
|
|
1714
|
-
return _regenerator.default.wrap(function
|
|
1405
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1715
1406
|
while (1) {
|
|
1716
|
-
switch (
|
|
1407
|
+
switch (_context12.prev = _context12.next) {
|
|
1717
1408
|
case 0:
|
|
1718
1409
|
setLoading(true);
|
|
1719
1410
|
concept = getConcept(activeTab);
|
|
1720
1411
|
productTemp = product;
|
|
1721
1412
|
articleId = productTemp.id_article;
|
|
1722
|
-
orderId = (_productTemp$
|
|
1413
|
+
orderId = (_productTemp$id_order = productTemp.id_order) !== null && _productTemp$id_order !== void 0 ? _productTemp$id_order : productTemp.orderId;
|
|
1723
1414
|
sectionStatusKey = "".concat(getConcept(activeTab), "_status");
|
|
1724
1415
|
evalStatus = product[sectionStatusKey] || (product === null || product === void 0 ? void 0 : product.version_status);
|
|
1725
1416
|
data = {
|
|
@@ -1729,16 +1420,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1729
1420
|
evalStatus: evalStatus
|
|
1730
1421
|
};
|
|
1731
1422
|
retailerId = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id;
|
|
1732
|
-
|
|
1423
|
+
_context12.prev = 9;
|
|
1733
1424
|
|
|
1734
1425
|
if (!result) {
|
|
1735
|
-
|
|
1426
|
+
_context12.next = 27;
|
|
1736
1427
|
break;
|
|
1737
1428
|
}
|
|
1738
1429
|
|
|
1739
1430
|
data.result = result;
|
|
1740
1431
|
data.retailerId = retailerId;
|
|
1741
|
-
|
|
1432
|
+
_context12.next = 15;
|
|
1742
1433
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1743
1434
|
headers: {
|
|
1744
1435
|
Authorization: token
|
|
@@ -1746,7 +1437,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1746
1437
|
});
|
|
1747
1438
|
|
|
1748
1439
|
case 15:
|
|
1749
|
-
res =
|
|
1440
|
+
res = _context12.sent;
|
|
1750
1441
|
newStatuses = JSON.parse(res.data.body);
|
|
1751
1442
|
orderStatus = newStatuses.newOrderStatus;
|
|
1752
1443
|
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(getConcept(activeTab), "Status")];
|
|
@@ -1756,11 +1447,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1756
1447
|
showSurveyByProvider = !user.is_retailer && orderStatus[orderId] === "AP";
|
|
1757
1448
|
showSurveyByRetailer = user.is_retailer && orderStatus[orderId] === "ACA";
|
|
1758
1449
|
showSurvey && showSurvey(showSurveyByProvider || showSurveyByRetailer);
|
|
1759
|
-
|
|
1450
|
+
_context12.next = 30;
|
|
1760
1451
|
break;
|
|
1761
1452
|
|
|
1762
1453
|
case 27:
|
|
1763
|
-
|
|
1454
|
+
_context12.next = 29;
|
|
1764
1455
|
return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1765
1456
|
headers: {
|
|
1766
1457
|
Authorization: token
|
|
@@ -1768,7 +1459,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1768
1459
|
});
|
|
1769
1460
|
|
|
1770
1461
|
case 29:
|
|
1771
|
-
res =
|
|
1462
|
+
res = _context12.sent;
|
|
1772
1463
|
|
|
1773
1464
|
case 30:
|
|
1774
1465
|
if (res.data.statusCode === 200) {
|
|
@@ -1791,39 +1482,39 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1791
1482
|
});
|
|
1792
1483
|
}
|
|
1793
1484
|
|
|
1794
|
-
|
|
1485
|
+
_context12.next = 36;
|
|
1795
1486
|
break;
|
|
1796
1487
|
|
|
1797
1488
|
case 33:
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
console.log(
|
|
1489
|
+
_context12.prev = 33;
|
|
1490
|
+
_context12.t0 = _context12["catch"](9);
|
|
1491
|
+
console.log(_context12.t0);
|
|
1801
1492
|
|
|
1802
1493
|
case 36:
|
|
1803
1494
|
loadData();
|
|
1804
1495
|
|
|
1805
1496
|
case 37:
|
|
1806
1497
|
case "end":
|
|
1807
|
-
return
|
|
1498
|
+
return _context12.stop();
|
|
1808
1499
|
}
|
|
1809
1500
|
}
|
|
1810
|
-
},
|
|
1501
|
+
}, _callee12, null, [[9, 33]]);
|
|
1811
1502
|
}));
|
|
1812
1503
|
|
|
1813
|
-
return function sendEvaluation(
|
|
1814
|
-
return
|
|
1504
|
+
return function sendEvaluation(_x7) {
|
|
1505
|
+
return _ref13.apply(this, arguments);
|
|
1815
1506
|
};
|
|
1816
1507
|
}();
|
|
1817
1508
|
|
|
1818
1509
|
var validateAll = /*#__PURE__*/function () {
|
|
1819
|
-
var
|
|
1820
|
-
var _product$id_order2, evaluationArray, conceptArray, dataGeneral, userType, productTemp,
|
|
1510
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
|
|
1511
|
+
var _product$id_order2, evaluationArray, conceptArray, dataGeneral, evalResponse, userType, productTemp, retailerStatusCopy;
|
|
1821
1512
|
|
|
1822
|
-
return _regenerator.default.wrap(function
|
|
1513
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1823
1514
|
while (1) {
|
|
1824
|
-
switch (
|
|
1515
|
+
switch (_context13.prev = _context13.next) {
|
|
1825
1516
|
case 0:
|
|
1826
|
-
|
|
1517
|
+
_context13.prev = 0;
|
|
1827
1518
|
setLoading(true);
|
|
1828
1519
|
evaluationArray = [];
|
|
1829
1520
|
conceptArray = ["description", "datasheet", "images"];
|
|
@@ -1848,22 +1539,22 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1848
1539
|
}
|
|
1849
1540
|
}));
|
|
1850
1541
|
});
|
|
1851
|
-
|
|
1542
|
+
_context13.next = 8;
|
|
1852
1543
|
return Promise.all(evaluationArray);
|
|
1853
1544
|
|
|
1854
1545
|
case 8:
|
|
1546
|
+
evalResponse = _context13.sent;
|
|
1855
1547
|
userType = user.is_retailer === 1 ? "CA" : "P";
|
|
1856
1548
|
productTemp = product;
|
|
1857
|
-
|
|
1858
|
-
productTemp.
|
|
1859
|
-
productTemp.
|
|
1860
|
-
productTemp.
|
|
1861
|
-
productTemp.images_status = productTemp.images_status === "NA" ? "NA" : status;
|
|
1549
|
+
productTemp.article_status = "".concat(result).concat(userType);
|
|
1550
|
+
productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : "".concat(result).concat(userType);
|
|
1551
|
+
productTemp.description_status = productTemp.description_status === "NA" ? "NA" : "".concat(result).concat(userType);
|
|
1552
|
+
productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result).concat(userType);
|
|
1862
1553
|
retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
|
|
1863
1554
|
Object.keys(retailerStatusCopy).forEach(function (key) {
|
|
1864
1555
|
conceptArray.forEach(function (concept) {
|
|
1865
1556
|
if (retailerStatusCopy[key][concept]) {
|
|
1866
|
-
retailerStatusCopy[key][concept] =
|
|
1557
|
+
retailerStatusCopy[key][concept] = "".concat(result).concat(userType);
|
|
1867
1558
|
}
|
|
1868
1559
|
});
|
|
1869
1560
|
});
|
|
@@ -1881,37 +1572,37 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1881
1572
|
idCategory: productTemp.article.id_category,
|
|
1882
1573
|
product: productTemp
|
|
1883
1574
|
}));
|
|
1884
|
-
|
|
1575
|
+
_context13.next = 25;
|
|
1885
1576
|
return loadData();
|
|
1886
1577
|
|
|
1887
1578
|
case 25:
|
|
1888
|
-
|
|
1579
|
+
_context13.next = 30;
|
|
1889
1580
|
break;
|
|
1890
1581
|
|
|
1891
1582
|
case 27:
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
console.log(
|
|
1583
|
+
_context13.prev = 27;
|
|
1584
|
+
_context13.t0 = _context13["catch"](0);
|
|
1585
|
+
console.log(_context13.t0);
|
|
1895
1586
|
|
|
1896
1587
|
case 30:
|
|
1897
1588
|
case "end":
|
|
1898
|
-
return
|
|
1589
|
+
return _context13.stop();
|
|
1899
1590
|
}
|
|
1900
1591
|
}
|
|
1901
|
-
},
|
|
1592
|
+
}, _callee13, null, [[0, 27]]);
|
|
1902
1593
|
}));
|
|
1903
1594
|
|
|
1904
|
-
return function validateAll(
|
|
1905
|
-
return
|
|
1595
|
+
return function validateAll(_x8) {
|
|
1596
|
+
return _ref14.apply(this, arguments);
|
|
1906
1597
|
};
|
|
1907
1598
|
}();
|
|
1908
1599
|
|
|
1909
1600
|
var evaluationToRetailer = /*#__PURE__*/function () {
|
|
1910
|
-
var
|
|
1601
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(result) {
|
|
1911
1602
|
var data, prod, statusComplete;
|
|
1912
|
-
return _regenerator.default.wrap(function
|
|
1603
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
1913
1604
|
while (1) {
|
|
1914
|
-
switch (
|
|
1605
|
+
switch (_context14.prev = _context14.next) {
|
|
1915
1606
|
case 0:
|
|
1916
1607
|
data = {
|
|
1917
1608
|
articleId: product.id_article,
|
|
@@ -1919,7 +1610,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1919
1610
|
versionId: product.version,
|
|
1920
1611
|
status: result
|
|
1921
1612
|
};
|
|
1922
|
-
|
|
1613
|
+
_context14.next = 3;
|
|
1923
1614
|
return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
|
|
1924
1615
|
headers: {
|
|
1925
1616
|
Authorization: token
|
|
@@ -1936,26 +1627,25 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1936
1627
|
prod.product.services_status = "[\"".concat(statusComplete, "\",\"").concat(statusComplete, "\",\"").concat(statusComplete, "\"]");
|
|
1937
1628
|
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
1938
1629
|
setProduct(prod);
|
|
1939
|
-
|
|
1940
|
-
|
|
1630
|
+
setShowGenericModal && setShowGenericModal(false);
|
|
1631
|
+
_context14.next = 15;
|
|
1941
1632
|
return loadData();
|
|
1942
1633
|
|
|
1943
1634
|
case 15:
|
|
1944
1635
|
case "end":
|
|
1945
|
-
return
|
|
1636
|
+
return _context14.stop();
|
|
1946
1637
|
}
|
|
1947
1638
|
}
|
|
1948
|
-
},
|
|
1639
|
+
}, _callee14);
|
|
1949
1640
|
}));
|
|
1950
1641
|
|
|
1951
|
-
return function evaluationToRetailer(
|
|
1952
|
-
return
|
|
1642
|
+
return function evaluationToRetailer(_x9) {
|
|
1643
|
+
return _ref15.apply(this, arguments);
|
|
1953
1644
|
};
|
|
1954
1645
|
}();
|
|
1955
1646
|
|
|
1956
1647
|
var getSectionStatus = function getSectionStatus() {
|
|
1957
1648
|
var concept = getConcept(activeTab);
|
|
1958
|
-
console.log("getSectionStatus", productEdit.product["".concat(concept, "_status")]);
|
|
1959
1649
|
return ["AA", "AP", "R", "CA", "RCA"].includes(productEdit.product["".concat(concept, "_status")]);
|
|
1960
1650
|
};
|
|
1961
1651
|
|
|
@@ -2008,7 +1698,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2008
1698
|
}
|
|
2009
1699
|
});
|
|
2010
1700
|
});
|
|
2011
|
-
|
|
1701
|
+
setShowGenericModal(true);
|
|
2012
1702
|
} else if (user.is_retailer) {
|
|
2013
1703
|
if (product.id_order || product.orderId) {
|
|
2014
1704
|
sendEvaluation("A");
|
|
@@ -2023,7 +1713,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2023
1713
|
}
|
|
2024
1714
|
});
|
|
2025
1715
|
});
|
|
2026
|
-
|
|
1716
|
+
setShowGenericModal(true);
|
|
2027
1717
|
}
|
|
2028
1718
|
} else {
|
|
2029
1719
|
sendEvaluation("A");
|
|
@@ -2034,7 +1724,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2034
1724
|
} else if (user.is_retailer) {
|
|
2035
1725
|
if (product.id_order || product.orderId) {
|
|
2036
1726
|
setValidatedAll(true);
|
|
2037
|
-
|
|
1727
|
+
setModalViewError(true);
|
|
2038
1728
|
} else {
|
|
2039
1729
|
setDataGenericModal(function (prev) {
|
|
2040
1730
|
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
@@ -2046,11 +1736,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2046
1736
|
}
|
|
2047
1737
|
});
|
|
2048
1738
|
});
|
|
2049
|
-
|
|
1739
|
+
setShowGenericModal(true);
|
|
2050
1740
|
}
|
|
2051
1741
|
} else {
|
|
2052
1742
|
setValidatedAll(true);
|
|
2053
|
-
|
|
1743
|
+
setModalViewError(true);
|
|
2054
1744
|
}
|
|
2055
1745
|
}
|
|
2056
1746
|
};
|
|
@@ -2059,7 +1749,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2059
1749
|
headerTop: headerTop,
|
|
2060
1750
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
2061
1751
|
setHeaderTop: setHeaderTop,
|
|
2062
|
-
withChat: location === null || location === void 0 ? void 0 : (_location$
|
|
1752
|
+
withChat: location === null || location === void 0 ? void 0 : (_location$state2 = location.state) === null || _location$state2 === void 0 ? void 0 : _location$state2.withChat,
|
|
2063
1753
|
productSelected: productSelected,
|
|
2064
1754
|
token: token,
|
|
2065
1755
|
activeRetailer: activeRetailer
|
|
@@ -2111,7 +1801,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2111
1801
|
}
|
|
2112
1802
|
});
|
|
2113
1803
|
});
|
|
2114
|
-
|
|
1804
|
+
setShowGenericModal(true);
|
|
2115
1805
|
} else if (user.is_retailer) {
|
|
2116
1806
|
if (product.id_order || product.orderId) {
|
|
2117
1807
|
validateAll("A");
|
|
@@ -2126,7 +1816,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2126
1816
|
}
|
|
2127
1817
|
});
|
|
2128
1818
|
});
|
|
2129
|
-
|
|
1819
|
+
setShowGenericModal(true);
|
|
2130
1820
|
}
|
|
2131
1821
|
} else {
|
|
2132
1822
|
validateAll("A");
|
|
@@ -2138,7 +1828,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2138
1828
|
} else if (user.is_retailer) {
|
|
2139
1829
|
if (product.id_order || product.orderId) {
|
|
2140
1830
|
setValidatedAll(true);
|
|
2141
|
-
|
|
1831
|
+
setModalViewError(true);
|
|
2142
1832
|
} else {
|
|
2143
1833
|
setDataGenericModal(function (prev) {
|
|
2144
1834
|
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
@@ -2150,11 +1840,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2150
1840
|
}
|
|
2151
1841
|
});
|
|
2152
1842
|
});
|
|
2153
|
-
|
|
1843
|
+
setShowGenericModal(true);
|
|
2154
1844
|
}
|
|
2155
1845
|
} else {
|
|
2156
1846
|
setValidatedAll(true);
|
|
2157
|
-
|
|
1847
|
+
setModalViewError(true);
|
|
2158
1848
|
}
|
|
2159
1849
|
},
|
|
2160
1850
|
approve: function approve() {
|
|
@@ -2269,20 +1959,20 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2269
1959
|
reviewed: crossComment
|
|
2270
1960
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
2271
1961
|
buttonType: "circular-button accept-button",
|
|
2272
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2273
|
-
return _regenerator.default.wrap(function
|
|
1962
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
1963
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
2274
1964
|
while (1) {
|
|
2275
|
-
switch (
|
|
1965
|
+
switch (_context15.prev = _context15.next) {
|
|
2276
1966
|
case 0:
|
|
2277
1967
|
setCrossComment(true);
|
|
2278
1968
|
commentRevised();
|
|
2279
1969
|
|
|
2280
1970
|
case 2:
|
|
2281
1971
|
case "end":
|
|
2282
|
-
return
|
|
1972
|
+
return _context15.stop();
|
|
2283
1973
|
}
|
|
2284
1974
|
}
|
|
2285
|
-
},
|
|
1975
|
+
}, _callee15);
|
|
2286
1976
|
}))
|
|
2287
1977
|
})]
|
|
2288
1978
|
})
|
|
@@ -2336,9 +2026,64 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2336
2026
|
onClick: function onClick() {
|
|
2337
2027
|
return setMessage("");
|
|
2338
2028
|
}
|
|
2339
|
-
}),
|
|
2340
|
-
close:
|
|
2341
|
-
|
|
2029
|
+
}), modalSent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GlobalModal, {
|
|
2030
|
+
close: function close() {
|
|
2031
|
+
return setModalSent(false);
|
|
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, {
|
|
2342
2087
|
modalId: "version-selector",
|
|
2343
2088
|
articleId: product.id_article,
|
|
2344
2089
|
setVersion: setVersion,
|