contentoh-components-library 21.3.51 → 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 -639
- 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 -256
- 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$state, _location$state2,
|
|
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,86 +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
|
|
445
|
-
_useState60 = (0, _slicedToArray2.default)(_useState59, 2),
|
|
446
|
-
validatedAll = _useState60[0],
|
|
447
|
-
setValidatedAll = _useState60[1];
|
|
447
|
+
var isRetailer = user === null || user === void 0 ? void 0 : user.is_retailer;
|
|
448
448
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
449
|
+
var _useState59 = (0, _react.useState)(true),
|
|
450
|
+
_useState60 = (0, _slicedToArray2.default)(_useState59, 2),
|
|
451
|
+
loading = _useState60[0],
|
|
452
|
+
setLoading = _useState60[1];
|
|
452
453
|
|
|
453
|
-
var _useState61 = (0, _react.useState)(
|
|
454
|
-
"Ficha técnica": location === null || location === void 0 ? void 0 : (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.origin,
|
|
455
|
-
Descripción: location === null || location === void 0 ? void 0 : (_location$state2 = location.state) === null || _location$state2 === void 0 ? void 0 : _location$state2.origin,
|
|
456
|
-
Imágenes: location === null || location === void 0 ? void 0 : (_location$state3 = location.state) === null || _location$state3 === void 0 ? void 0 : _location$state3.origin
|
|
457
|
-
}),
|
|
454
|
+
var _useState61 = (0, _react.useState)(false),
|
|
458
455
|
_useState62 = (0, _slicedToArray2.default)(_useState61, 2),
|
|
459
|
-
|
|
460
|
-
|
|
456
|
+
validatedAll = _useState62[0],
|
|
457
|
+
setValidatedAll = _useState62[1];
|
|
461
458
|
|
|
462
|
-
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
|
+
}),
|
|
463
466
|
_useState64 = (0, _slicedToArray2.default)(_useState63, 2),
|
|
464
|
-
|
|
465
|
-
|
|
467
|
+
origin = _useState64[0],
|
|
468
|
+
setOrigin = _useState64[1];
|
|
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];
|
|
484
|
+
|
|
485
|
+
var _useState71 = (0, _react.useState)(false),
|
|
486
|
+
_useState72 = (0, _slicedToArray2.default)(_useState71, 2),
|
|
487
|
+
showGenericModal = _useState72[0],
|
|
488
|
+
setShowGenericModal = _useState72[1];
|
|
466
489
|
|
|
467
|
-
var
|
|
490
|
+
var _useState73 = (0, _react.useState)({
|
|
468
491
|
message: "¿Estás seguro de continuar?",
|
|
469
492
|
detail: " ".concat(user.is_retailer ? "Asegurate de haber revisado las tres secciones" : "Envíar el producto a la cadena"),
|
|
470
493
|
button1: {
|
|
471
494
|
name: "Cerrar",
|
|
472
|
-
action:
|
|
495
|
+
action: function action() {
|
|
496
|
+
return setModalViewTextArea(false);
|
|
497
|
+
}
|
|
473
498
|
},
|
|
474
499
|
button2: {
|
|
475
500
|
name: "Continuar",
|
|
@@ -479,402 +504,35 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
479
504
|
},
|
|
480
505
|
img: _defaultProfileImage.default
|
|
481
506
|
}),
|
|
482
|
-
|
|
483
|
-
dataGenericModal =
|
|
484
|
-
setDataGenericModal =
|
|
507
|
+
_useState74 = (0, _slicedToArray2.default)(_useState73, 2),
|
|
508
|
+
dataGenericModal = _useState74[0],
|
|
509
|
+
setDataGenericModal = _useState74[1];
|
|
485
510
|
|
|
486
|
-
var
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
511
|
+
var _useState75 = (0, _react.useState)(false),
|
|
512
|
+
_useState76 = (0, _slicedToArray2.default)(_useState75, 2),
|
|
513
|
+
modalViewTextArea = _useState76[0],
|
|
514
|
+
setModalViewTextArea = _useState76[1];
|
|
490
515
|
|
|
491
|
-
var
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
516
|
+
var _useState77 = (0, _react.useState)(null),
|
|
517
|
+
_useState78 = (0, _slicedToArray2.default)(_useState77, 2),
|
|
518
|
+
socketType = _useState78[0],
|
|
519
|
+
setSocketType = _useState78[1];
|
|
495
520
|
|
|
496
|
-
var
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
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];
|
|
500
530
|
|
|
501
531
|
var _useCloseModal = (0, _customHooks.useCloseModal)("version-selector"),
|
|
502
532
|
_useCloseModal2 = (0, _slicedToArray2.default)(_useCloseModal, 2),
|
|
503
533
|
showVersionSelector = _useCloseModal2[0],
|
|
504
534
|
setShowVersionSelector = _useCloseModal2[1];
|
|
505
535
|
|
|
506
|
-
var _useState73 = (0, _react.useState)(),
|
|
507
|
-
_useState74 = (0, _slicedToArray2.default)(_useState73, 2),
|
|
508
|
-
globalModal = _useState74[0],
|
|
509
|
-
setGlobalModal = _useState74[1];
|
|
510
|
-
|
|
511
|
-
var updateAuditStatus = /*#__PURE__*/function () {
|
|
512
|
-
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(status) {
|
|
513
|
-
var productTemp, retailerStatusCopy, conceptArray;
|
|
514
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
515
|
-
while (1) {
|
|
516
|
-
switch (_context2.prev = _context2.next) {
|
|
517
|
-
case 0:
|
|
518
|
-
productTemp = product;
|
|
519
|
-
productTemp.article_status = status;
|
|
520
|
-
productTemp.datasheet_status = status;
|
|
521
|
-
productTemp.description_status = status;
|
|
522
|
-
productTemp.images_status = status;
|
|
523
|
-
retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
|
|
524
|
-
conceptArray = ["description", "datasheet", "images"];
|
|
525
|
-
Object.keys(retailerStatusCopy).forEach(function (key) {
|
|
526
|
-
conceptArray.forEach(function (concept) {
|
|
527
|
-
if (retailerStatusCopy[key][concept]) {
|
|
528
|
-
retailerStatusCopy[key][concept] = status;
|
|
529
|
-
}
|
|
530
|
-
});
|
|
531
|
-
});
|
|
532
|
-
setRetailerStatus(retailerStatusCopy);
|
|
533
|
-
productTemp.statusByRetailer = retailerStatusCopy;
|
|
534
|
-
setProduct(productTemp);
|
|
535
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
536
|
-
setProductEdit({
|
|
537
|
-
ArticleId: productTemp.id_article,
|
|
538
|
-
idCategory: productTemp.article.id_category,
|
|
539
|
-
product: productTemp
|
|
540
|
-
});
|
|
541
|
-
sessionStorage.setItem("productEdit", JSON.stringify({
|
|
542
|
-
ArticleId: productTemp.id_article,
|
|
543
|
-
idCategory: productTemp.article.id_category,
|
|
544
|
-
product: productTemp
|
|
545
|
-
}));
|
|
546
|
-
_context2.next = 16;
|
|
547
|
-
return loadData();
|
|
548
|
-
|
|
549
|
-
case 16:
|
|
550
|
-
case "end":
|
|
551
|
-
return _context2.stop();
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
}, _callee2);
|
|
555
|
-
}));
|
|
556
|
-
|
|
557
|
-
return function updateAuditStatus(_x2) {
|
|
558
|
-
return _ref3.apply(this, arguments);
|
|
559
|
-
};
|
|
560
|
-
}();
|
|
561
|
-
|
|
562
|
-
var addCart = /*#__PURE__*/function () {
|
|
563
|
-
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(retailers) {
|
|
564
|
-
var article, version, articleToOrder, modatlType, resCart;
|
|
565
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
566
|
-
while (1) {
|
|
567
|
-
switch (_context3.prev = _context3.next) {
|
|
568
|
-
case 0:
|
|
569
|
-
article = product.article, version = product.version;
|
|
570
|
-
articleToOrder = [{
|
|
571
|
-
articleId: article.id_article,
|
|
572
|
-
version: version,
|
|
573
|
-
userId: user.id_user,
|
|
574
|
-
discount: 0,
|
|
575
|
-
subtotal: 0,
|
|
576
|
-
companyId: user.id_company,
|
|
577
|
-
datasheet: retailers,
|
|
578
|
-
description: retailers,
|
|
579
|
-
image: retailers,
|
|
580
|
-
attributeTranslations: false,
|
|
581
|
-
descriptionTranslations: false,
|
|
582
|
-
build: "[]",
|
|
583
|
-
manual: "[]",
|
|
584
|
-
userCreated: user.id_user
|
|
585
|
-
}];
|
|
586
|
-
modatlType = "addedToCartError";
|
|
587
|
-
|
|
588
|
-
if (!addToCart) {
|
|
589
|
-
_context3.next = 8;
|
|
590
|
-
break;
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
_context3.next = 6;
|
|
594
|
-
return addToCart({
|
|
595
|
-
data: articleToOrder
|
|
596
|
-
});
|
|
597
|
-
|
|
598
|
-
case 6:
|
|
599
|
-
resCart = _context3.sent;
|
|
600
|
-
|
|
601
|
-
if (resCart.data.statusCode === 200) {
|
|
602
|
-
modatlType = "addedToCart";
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
case 8:
|
|
606
|
-
showGlobalModal(modatlType);
|
|
607
|
-
|
|
608
|
-
case 9:
|
|
609
|
-
case "end":
|
|
610
|
-
return _context3.stop();
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
}, _callee3);
|
|
614
|
-
}));
|
|
615
|
-
|
|
616
|
-
return function addCart(_x3) {
|
|
617
|
-
return _ref4.apply(this, arguments);
|
|
618
|
-
};
|
|
619
|
-
}();
|
|
620
|
-
|
|
621
|
-
var closeGlobalModal = function closeGlobalModal() {
|
|
622
|
-
return setGlobalModal();
|
|
623
|
-
};
|
|
624
|
-
|
|
625
|
-
var seenByProvider = /*#__PURE__*/function () {
|
|
626
|
-
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
627
|
-
var _productTemp$id_order;
|
|
628
|
-
|
|
629
|
-
var productTemp, articleId, orderId, promises, conceptArray;
|
|
630
|
-
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
631
|
-
while (1) {
|
|
632
|
-
switch (_context4.prev = _context4.next) {
|
|
633
|
-
case 0:
|
|
634
|
-
productTemp = product;
|
|
635
|
-
articleId = productTemp.id_article;
|
|
636
|
-
orderId = (_productTemp$id_order = productTemp.id_order) !== null && _productTemp$id_order !== void 0 ? _productTemp$id_order : productTemp.orderId;
|
|
637
|
-
promises = [];
|
|
638
|
-
conceptArray = ["description", "datasheet", "images"];
|
|
639
|
-
conceptArray.forEach(function (concept) {
|
|
640
|
-
var sectionStatusKey = "".concat(concept, "_status");
|
|
641
|
-
var evalStatus = product[sectionStatusKey] || (product === null || product === void 0 ? void 0 : product.version_status);
|
|
642
|
-
var data = {
|
|
643
|
-
articleId: articleId,
|
|
644
|
-
orderId: orderId,
|
|
645
|
-
concept: concept,
|
|
646
|
-
evalStatus: evalStatus
|
|
647
|
-
};
|
|
648
|
-
promises.push(_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
649
|
-
headers: {
|
|
650
|
-
Authorization: token
|
|
651
|
-
}
|
|
652
|
-
}));
|
|
653
|
-
});
|
|
654
|
-
_context4.next = 8;
|
|
655
|
-
return Promise.all(promises);
|
|
656
|
-
|
|
657
|
-
case 8:
|
|
658
|
-
closeGlobalModal();
|
|
659
|
-
_context4.next = 11;
|
|
660
|
-
return updateAuditStatus("FAP");
|
|
661
|
-
|
|
662
|
-
case 11:
|
|
663
|
-
case "end":
|
|
664
|
-
return _context4.stop();
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
}, _callee4);
|
|
668
|
-
}));
|
|
669
|
-
|
|
670
|
-
return function seenByProvider() {
|
|
671
|
-
return _ref5.apply(this, arguments);
|
|
672
|
-
};
|
|
673
|
-
}();
|
|
674
|
-
|
|
675
|
-
var showGlobalModal = (0, _react.useCallback)(function (type) {
|
|
676
|
-
var formatter = new Intl.ListFormat("es", {
|
|
677
|
-
type: "conjunction"
|
|
678
|
-
});
|
|
679
|
-
|
|
680
|
-
switch (type) {
|
|
681
|
-
case "error":
|
|
682
|
-
setGlobalModal({
|
|
683
|
-
message: "".concat(activeTab, " rechazada"),
|
|
684
|
-
detail: "Agrega tu comentarios para enviar el rechazo",
|
|
685
|
-
img: _errorModal.default,
|
|
686
|
-
textArea: true,
|
|
687
|
-
button1: {
|
|
688
|
-
name: "Enviar",
|
|
689
|
-
action: function action(e) {
|
|
690
|
-
var textArea = document.querySelector("#area");
|
|
691
|
-
|
|
692
|
-
if (textArea.value) {
|
|
693
|
-
textArea.style.border = "none";
|
|
694
|
-
createComment(e, textArea.value);
|
|
695
|
-
showGlobalModal("commentsSent");
|
|
696
|
-
validatedAll ? validateAll("R") : sendEvaluation("R");
|
|
697
|
-
} else {
|
|
698
|
-
textArea.style.border = "2px solid red";
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
});
|
|
703
|
-
break;
|
|
704
|
-
|
|
705
|
-
case "generic":
|
|
706
|
-
setGlobalModal(dataGenericModal);
|
|
707
|
-
break;
|
|
708
|
-
|
|
709
|
-
case "commentsSent":
|
|
710
|
-
setGlobalModal({
|
|
711
|
-
message: "Gracias, tus comentarios fueron entregados.",
|
|
712
|
-
detail: "Trabajaremos en conjunto para resolverlo.",
|
|
713
|
-
button1: {
|
|
714
|
-
name: "Cerrar",
|
|
715
|
-
action: closeGlobalModal
|
|
716
|
-
},
|
|
717
|
-
img: _defaultProfileImage.default,
|
|
718
|
-
textArea: false
|
|
719
|
-
});
|
|
720
|
-
break;
|
|
721
|
-
|
|
722
|
-
case "RAC":
|
|
723
|
-
var servicesRejected = [];
|
|
724
|
-
var translateServices = {
|
|
725
|
-
datasheet: "ficha técnica",
|
|
726
|
-
description: "descripción",
|
|
727
|
-
images: "imágenes"
|
|
728
|
-
};
|
|
729
|
-
Object.keys(translateServices).forEach(function (service) {
|
|
730
|
-
if (product["".concat(service, "_status")] === "RAC") {
|
|
731
|
-
servicesRejected.push(translateServices[service]);
|
|
732
|
-
}
|
|
733
|
-
});
|
|
734
|
-
var plural = ["Los servicios", "cumplen"];
|
|
735
|
-
var singular = ["El servicio", "cumple"];
|
|
736
|
-
var grammar = servicesRejected.length > 1 ? plural : singular;
|
|
737
|
-
var formatted = formatter.format(servicesRejected);
|
|
738
|
-
var text1 = "".concat(grammar[0], " de ").concat(formatted, " no ").concat(grammar[1], " con lo que la cadena necesita.");
|
|
739
|
-
var text2 = "\xA1Solicita el servicio de Content-oh! para completarlo!";
|
|
740
|
-
var retailers = product.retailersWithService.map(function (retailer) {
|
|
741
|
-
return Number(retailer);
|
|
742
|
-
});
|
|
743
|
-
setGlobalModal({
|
|
744
|
-
message: "Tu producto no cumple con los requerimientos de la cadena",
|
|
745
|
-
customComponent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
746
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
747
|
-
className: "generic-text",
|
|
748
|
-
children: [text1, /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), text2]
|
|
749
|
-
})
|
|
750
|
-
}),
|
|
751
|
-
button1: {
|
|
752
|
-
name: "Continuar",
|
|
753
|
-
action: function () {
|
|
754
|
-
var _action = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
755
|
-
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
756
|
-
while (1) {
|
|
757
|
-
switch (_context5.prev = _context5.next) {
|
|
758
|
-
case 0:
|
|
759
|
-
_context5.next = 2;
|
|
760
|
-
return seenByProvider();
|
|
761
|
-
|
|
762
|
-
case 2:
|
|
763
|
-
return _context5.abrupt("return", _context5.sent);
|
|
764
|
-
|
|
765
|
-
case 3:
|
|
766
|
-
case "end":
|
|
767
|
-
return _context5.stop();
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
}, _callee5);
|
|
771
|
-
}));
|
|
772
|
-
|
|
773
|
-
function action() {
|
|
774
|
-
return _action.apply(this, arguments);
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
return action;
|
|
778
|
-
}()
|
|
779
|
-
},
|
|
780
|
-
button2: {
|
|
781
|
-
name: "Solicitar a Content-oh!",
|
|
782
|
-
action: function () {
|
|
783
|
-
var _action2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
784
|
-
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
785
|
-
while (1) {
|
|
786
|
-
switch (_context6.prev = _context6.next) {
|
|
787
|
-
case 0:
|
|
788
|
-
_context6.next = 2;
|
|
789
|
-
return addCart(retailers);
|
|
790
|
-
|
|
791
|
-
case 2:
|
|
792
|
-
_context6.next = 4;
|
|
793
|
-
return seenByProvider();
|
|
794
|
-
|
|
795
|
-
case 4:
|
|
796
|
-
case "end":
|
|
797
|
-
return _context6.stop();
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
}, _callee6);
|
|
801
|
-
}));
|
|
802
|
-
|
|
803
|
-
function action() {
|
|
804
|
-
return _action2.apply(this, arguments);
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
return action;
|
|
808
|
-
}()
|
|
809
|
-
},
|
|
810
|
-
img: _errorModal.default
|
|
811
|
-
});
|
|
812
|
-
break;
|
|
813
|
-
|
|
814
|
-
case "AAC":
|
|
815
|
-
setGlobalModal({
|
|
816
|
-
message: "Felicidades",
|
|
817
|
-
detail: "Tu producto cumple con los requerimientos de la cadena.",
|
|
818
|
-
button1: {
|
|
819
|
-
name: "Continuar",
|
|
820
|
-
action: function () {
|
|
821
|
-
var _action3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
822
|
-
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
823
|
-
while (1) {
|
|
824
|
-
switch (_context7.prev = _context7.next) {
|
|
825
|
-
case 0:
|
|
826
|
-
_context7.next = 2;
|
|
827
|
-
return seenByProvider();
|
|
828
|
-
|
|
829
|
-
case 2:
|
|
830
|
-
return _context7.abrupt("return", _context7.sent);
|
|
831
|
-
|
|
832
|
-
case 3:
|
|
833
|
-
case "end":
|
|
834
|
-
return _context7.stop();
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
}, _callee7);
|
|
838
|
-
}));
|
|
839
|
-
|
|
840
|
-
function action() {
|
|
841
|
-
return _action3.apply(this, arguments);
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
return action;
|
|
845
|
-
}()
|
|
846
|
-
},
|
|
847
|
-
img: _defaultProfileImage.default
|
|
848
|
-
});
|
|
849
|
-
break;
|
|
850
|
-
|
|
851
|
-
case "addedToCartError":
|
|
852
|
-
setGlobalModal({
|
|
853
|
-
detail: "Parece que algo salió mal al intentar añadir tu producto a tu carrito.",
|
|
854
|
-
button1: {
|
|
855
|
-
name: "Continuar",
|
|
856
|
-
action: closeGlobalModal
|
|
857
|
-
}
|
|
858
|
-
});
|
|
859
|
-
break;
|
|
860
|
-
|
|
861
|
-
case "addedToCart":
|
|
862
|
-
setGlobalModal({
|
|
863
|
-
message: "Producto añadido",
|
|
864
|
-
detail: "Tu producto se añadió al carrito de compras.",
|
|
865
|
-
button1: {
|
|
866
|
-
name: "Continuar",
|
|
867
|
-
action: closeGlobalModal
|
|
868
|
-
},
|
|
869
|
-
img: _defaultProfileImage.default
|
|
870
|
-
});
|
|
871
|
-
break;
|
|
872
|
-
|
|
873
|
-
default:
|
|
874
|
-
closeGlobalModal();
|
|
875
|
-
break;
|
|
876
|
-
}
|
|
877
|
-
}, [activeTab, dataGenericModal, product]);
|
|
878
536
|
(0, _react.useEffect)(function () {
|
|
879
537
|
checkAll && setSelectedImages(images.values);
|
|
880
538
|
}, [checkAll]);
|
|
@@ -885,22 +543,22 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
885
543
|
}, [showModal]);
|
|
886
544
|
|
|
887
545
|
var loadData = /*#__PURE__*/function () {
|
|
888
|
-
var
|
|
546
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
889
547
|
var _product$article, _product$article2, _product$article3, _services$, _services$$values;
|
|
890
548
|
|
|
891
549
|
var services;
|
|
892
|
-
return _regenerator.default.wrap(function
|
|
550
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
893
551
|
while (1) {
|
|
894
|
-
switch (
|
|
552
|
+
switch (_context2.prev = _context2.next) {
|
|
895
553
|
case 0:
|
|
896
|
-
|
|
554
|
+
_context2.next = 2;
|
|
897
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);
|
|
898
556
|
|
|
899
557
|
case 2:
|
|
900
|
-
services =
|
|
558
|
+
services = _context2.sent;
|
|
901
559
|
//Converts the data inside the datasheets object to array
|
|
902
560
|
setServices(services);
|
|
903
|
-
|
|
561
|
+
_context2.next = 6;
|
|
904
562
|
return getServices();
|
|
905
563
|
|
|
906
564
|
case 6:
|
|
@@ -918,26 +576,26 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
918
576
|
|
|
919
577
|
case 10:
|
|
920
578
|
case "end":
|
|
921
|
-
return
|
|
579
|
+
return _context2.stop();
|
|
922
580
|
}
|
|
923
581
|
}
|
|
924
|
-
},
|
|
582
|
+
}, _callee2);
|
|
925
583
|
}));
|
|
926
584
|
|
|
927
585
|
return function loadData() {
|
|
928
|
-
return
|
|
586
|
+
return _ref3.apply(this, arguments);
|
|
929
587
|
};
|
|
930
588
|
}();
|
|
931
589
|
|
|
932
590
|
var getServices = /*#__PURE__*/function () {
|
|
933
|
-
var
|
|
591
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
934
592
|
var _product$article4;
|
|
935
593
|
|
|
936
594
|
var productInOrder, idArticle, retailers, active, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse, retailerResponse;
|
|
937
595
|
|
|
938
|
-
return _regenerator.default.wrap(function
|
|
596
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
939
597
|
while (1) {
|
|
940
|
-
switch (
|
|
598
|
+
switch (_context3.prev = _context3.next) {
|
|
941
599
|
case 0:
|
|
942
600
|
productInOrder = product.id_order || product.orderId;
|
|
943
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);
|
|
@@ -945,15 +603,15 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
945
603
|
active = null;
|
|
946
604
|
|
|
947
605
|
if (!(isRevision() || productInOrder)) {
|
|
948
|
-
|
|
606
|
+
_context3.next = 12;
|
|
949
607
|
break;
|
|
950
608
|
}
|
|
951
609
|
|
|
952
|
-
|
|
610
|
+
_context3.next = 7;
|
|
953
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"));
|
|
954
612
|
|
|
955
613
|
case 7:
|
|
956
|
-
servicesResponse =
|
|
614
|
+
servicesResponse = _context3.sent;
|
|
957
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;
|
|
958
616
|
retailerResponse = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
|
|
959
617
|
return srv.id_retailer;
|
|
@@ -968,14 +626,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
968
626
|
|
|
969
627
|
case 13:
|
|
970
628
|
case "end":
|
|
971
|
-
return
|
|
629
|
+
return _context3.stop();
|
|
972
630
|
}
|
|
973
631
|
}
|
|
974
|
-
},
|
|
632
|
+
}, _callee3);
|
|
975
633
|
}));
|
|
976
634
|
|
|
977
635
|
return function getServices() {
|
|
978
|
-
return
|
|
636
|
+
return _ref4.apply(this, arguments);
|
|
979
637
|
};
|
|
980
638
|
}();
|
|
981
639
|
|
|
@@ -991,13 +649,6 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
991
649
|
var _revision = ["RequestWithContentoh", "RequestWithoutContentoh", "Contentoh"].includes(orgn);
|
|
992
650
|
|
|
993
651
|
if (_isRetailer) {
|
|
994
|
-
console.log({
|
|
995
|
-
origin: origin[activeTab],
|
|
996
|
-
concept: concept,
|
|
997
|
-
orgn: orgn,
|
|
998
|
-
revision: _revision,
|
|
999
|
-
currentService: currentService
|
|
1000
|
-
});
|
|
1001
652
|
if (_revision && currentService === "AP") return true;
|
|
1002
653
|
} else {
|
|
1003
654
|
var _product = productEdit.product;
|
|
@@ -1012,13 +663,13 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1012
663
|
};
|
|
1013
664
|
|
|
1014
665
|
var getCart = /*#__PURE__*/function () {
|
|
1015
|
-
var
|
|
666
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
1016
667
|
var res, arr;
|
|
1017
|
-
return _regenerator.default.wrap(function
|
|
668
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
1018
669
|
while (1) {
|
|
1019
|
-
switch (
|
|
670
|
+
switch (_context4.prev = _context4.next) {
|
|
1020
671
|
case 0:
|
|
1021
|
-
|
|
672
|
+
_context4.next = 2;
|
|
1022
673
|
return _axios.default.get(process.env.REACT_APP_CART, {
|
|
1023
674
|
headers: {
|
|
1024
675
|
Authorization: token
|
|
@@ -1026,7 +677,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1026
677
|
});
|
|
1027
678
|
|
|
1028
679
|
case 2:
|
|
1029
|
-
res =
|
|
680
|
+
res = _context4.sent;
|
|
1030
681
|
arr = JSON.parse(res.data.body).data.map(function (e) {
|
|
1031
682
|
return e.article_id;
|
|
1032
683
|
});
|
|
@@ -1036,14 +687,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1036
687
|
|
|
1037
688
|
case 5:
|
|
1038
689
|
case "end":
|
|
1039
|
-
return
|
|
690
|
+
return _context4.stop();
|
|
1040
691
|
}
|
|
1041
692
|
}
|
|
1042
|
-
},
|
|
693
|
+
}, _callee4);
|
|
1043
694
|
}));
|
|
1044
695
|
|
|
1045
696
|
return function getCart() {
|
|
1046
|
-
return
|
|
697
|
+
return _ref5.apply(this, arguments);
|
|
1047
698
|
};
|
|
1048
699
|
}();
|
|
1049
700
|
|
|
@@ -1058,7 +709,6 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1058
709
|
action: "orderImages",
|
|
1059
710
|
retailerId: activeRetailer.id
|
|
1060
711
|
});
|
|
1061
|
-
if (["RAC", "AAC"].includes(product.article_status)) showGlobalModal(product.article_status);
|
|
1062
712
|
}, [product, version]);
|
|
1063
713
|
(0, _react.useEffect)(function () {
|
|
1064
714
|
setImages({
|
|
@@ -1169,11 +819,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1169
819
|
}, [images]);
|
|
1170
820
|
|
|
1171
821
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
1172
|
-
var
|
|
822
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
1173
823
|
var dataObject, res;
|
|
1174
|
-
return _regenerator.default.wrap(function
|
|
824
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
1175
825
|
while (1) {
|
|
1176
|
-
switch (
|
|
826
|
+
switch (_context5.prev = _context5.next) {
|
|
1177
827
|
case 0:
|
|
1178
828
|
setLoading(true);
|
|
1179
829
|
dataObject = {
|
|
@@ -1181,8 +831,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1181
831
|
articleData: updatedDescriptions
|
|
1182
832
|
};
|
|
1183
833
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1184
|
-
|
|
1185
|
-
|
|
834
|
+
_context5.prev = 3;
|
|
835
|
+
_context5.next = 6;
|
|
1186
836
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
1187
837
|
headers: {
|
|
1188
838
|
Authorization: token
|
|
@@ -1190,45 +840,45 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1190
840
|
});
|
|
1191
841
|
|
|
1192
842
|
case 6:
|
|
1193
|
-
res =
|
|
843
|
+
res = _context5.sent;
|
|
1194
844
|
|
|
1195
845
|
if (!(res.data.statusCode === 200)) {
|
|
1196
|
-
|
|
846
|
+
_context5.next = 11;
|
|
1197
847
|
break;
|
|
1198
848
|
}
|
|
1199
849
|
|
|
1200
850
|
setMessage("Descripciones guardadas con éxito");
|
|
1201
|
-
|
|
851
|
+
_context5.next = 11;
|
|
1202
852
|
return loadData();
|
|
1203
853
|
|
|
1204
854
|
case 11:
|
|
1205
|
-
|
|
855
|
+
_context5.next = 16;
|
|
1206
856
|
break;
|
|
1207
857
|
|
|
1208
858
|
case 13:
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
console.log(
|
|
859
|
+
_context5.prev = 13;
|
|
860
|
+
_context5.t0 = _context5["catch"](3);
|
|
861
|
+
console.log(_context5.t0);
|
|
1212
862
|
|
|
1213
863
|
case 16:
|
|
1214
864
|
case "end":
|
|
1215
|
-
return
|
|
865
|
+
return _context5.stop();
|
|
1216
866
|
}
|
|
1217
867
|
}
|
|
1218
|
-
},
|
|
868
|
+
}, _callee5, null, [[3, 13]]);
|
|
1219
869
|
}));
|
|
1220
870
|
|
|
1221
871
|
return function saveDescriptions() {
|
|
1222
|
-
return
|
|
872
|
+
return _ref6.apply(this, arguments);
|
|
1223
873
|
};
|
|
1224
874
|
}();
|
|
1225
875
|
|
|
1226
876
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
1227
|
-
var
|
|
877
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
1228
878
|
var dataObject, res;
|
|
1229
|
-
return _regenerator.default.wrap(function
|
|
879
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
1230
880
|
while (1) {
|
|
1231
|
-
switch (
|
|
881
|
+
switch (_context6.prev = _context6.next) {
|
|
1232
882
|
case 0:
|
|
1233
883
|
setLoading(true);
|
|
1234
884
|
dataObject = {
|
|
@@ -1236,8 +886,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1236
886
|
articleData: updatedDatasheets
|
|
1237
887
|
};
|
|
1238
888
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1239
|
-
|
|
1240
|
-
|
|
889
|
+
_context6.prev = 3;
|
|
890
|
+
_context6.next = 6;
|
|
1241
891
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
1242
892
|
headers: {
|
|
1243
893
|
Authorization: token
|
|
@@ -1245,47 +895,47 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1245
895
|
});
|
|
1246
896
|
|
|
1247
897
|
case 6:
|
|
1248
|
-
res =
|
|
898
|
+
res = _context6.sent;
|
|
1249
899
|
|
|
1250
900
|
if (!(res.data.statusCode === 200)) {
|
|
1251
|
-
|
|
901
|
+
_context6.next = 11;
|
|
1252
902
|
break;
|
|
1253
903
|
}
|
|
1254
904
|
|
|
1255
905
|
setMessage("Fichas técnicas guardadas");
|
|
1256
|
-
|
|
906
|
+
_context6.next = 11;
|
|
1257
907
|
return loadData();
|
|
1258
908
|
|
|
1259
909
|
case 11:
|
|
1260
|
-
|
|
910
|
+
_context6.next = 16;
|
|
1261
911
|
break;
|
|
1262
912
|
|
|
1263
913
|
case 13:
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
console.log(
|
|
914
|
+
_context6.prev = 13;
|
|
915
|
+
_context6.t0 = _context6["catch"](3);
|
|
916
|
+
console.log(_context6.t0);
|
|
1267
917
|
|
|
1268
918
|
case 16:
|
|
1269
919
|
case "end":
|
|
1270
|
-
return
|
|
920
|
+
return _context6.stop();
|
|
1271
921
|
}
|
|
1272
922
|
}
|
|
1273
|
-
},
|
|
923
|
+
}, _callee6, null, [[3, 13]]);
|
|
1274
924
|
}));
|
|
1275
925
|
|
|
1276
926
|
return function saveDatasheets() {
|
|
1277
|
-
return
|
|
927
|
+
return _ref7.apply(this, arguments);
|
|
1278
928
|
};
|
|
1279
929
|
}();
|
|
1280
930
|
|
|
1281
|
-
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() {
|
|
1282
932
|
var _images$values2, _data$articleData, _data$articleData2, _data$updateImages;
|
|
1283
933
|
|
|
1284
934
|
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
1285
935
|
|
|
1286
|
-
return _regenerator.default.wrap(function
|
|
936
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1287
937
|
while (1) {
|
|
1288
|
-
switch (
|
|
938
|
+
switch (_context7.prev = _context7.next) {
|
|
1289
939
|
case 0:
|
|
1290
940
|
imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
|
|
1291
941
|
imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
|
|
@@ -1334,19 +984,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1334
984
|
}
|
|
1335
985
|
|
|
1336
986
|
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
1337
|
-
|
|
987
|
+
_context7.next = 31;
|
|
1338
988
|
break;
|
|
1339
989
|
}
|
|
1340
990
|
|
|
1341
991
|
setLoading(true);
|
|
1342
|
-
|
|
992
|
+
_context7.prev = 11;
|
|
1343
993
|
data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
|
|
1344
994
|
e.uuid = (0, _uuid.v4)();
|
|
1345
995
|
});
|
|
1346
996
|
setDataImages(data);
|
|
1347
997
|
|
|
1348
998
|
if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
|
|
1349
|
-
|
|
999
|
+
_context7.next = 23;
|
|
1350
1000
|
break;
|
|
1351
1001
|
}
|
|
1352
1002
|
|
|
@@ -1362,28 +1012,28 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1362
1012
|
};
|
|
1363
1013
|
promiseArray.push(myBucket.putObject(params).promise());
|
|
1364
1014
|
});
|
|
1365
|
-
|
|
1015
|
+
_context7.next = 20;
|
|
1366
1016
|
return Promise.all(promiseArray);
|
|
1367
1017
|
|
|
1368
1018
|
case 20:
|
|
1369
1019
|
setImagesUploaded(true);
|
|
1370
|
-
|
|
1020
|
+
_context7.next = 24;
|
|
1371
1021
|
break;
|
|
1372
1022
|
|
|
1373
1023
|
case 23:
|
|
1374
1024
|
setImagesUploaded(true);
|
|
1375
1025
|
|
|
1376
1026
|
case 24:
|
|
1377
|
-
|
|
1027
|
+
_context7.next = 29;
|
|
1378
1028
|
break;
|
|
1379
1029
|
|
|
1380
1030
|
case 26:
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
console.log(
|
|
1031
|
+
_context7.prev = 26;
|
|
1032
|
+
_context7.t0 = _context7["catch"](11);
|
|
1033
|
+
console.log(_context7.t0); // setMainLoading(false);
|
|
1384
1034
|
|
|
1385
1035
|
case 29:
|
|
1386
|
-
|
|
1036
|
+
_context7.next = 32;
|
|
1387
1037
|
break;
|
|
1388
1038
|
|
|
1389
1039
|
case 31:
|
|
@@ -1392,19 +1042,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1392
1042
|
|
|
1393
1043
|
case 32:
|
|
1394
1044
|
case "end":
|
|
1395
|
-
return
|
|
1045
|
+
return _context7.stop();
|
|
1396
1046
|
}
|
|
1397
1047
|
}
|
|
1398
|
-
},
|
|
1048
|
+
}, _callee7, null, [[11, 26]]);
|
|
1399
1049
|
})), [images, imagesUploaded]);
|
|
1400
|
-
(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() {
|
|
1401
1051
|
var res;
|
|
1402
|
-
return _regenerator.default.wrap(function
|
|
1052
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
1403
1053
|
while (1) {
|
|
1404
|
-
switch (
|
|
1054
|
+
switch (_context8.prev = _context8.next) {
|
|
1405
1055
|
case 0:
|
|
1406
1056
|
if (!imagesUploaded) {
|
|
1407
|
-
|
|
1057
|
+
_context8.next = 16;
|
|
1408
1058
|
break;
|
|
1409
1059
|
}
|
|
1410
1060
|
|
|
@@ -1416,8 +1066,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1416
1066
|
if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1417
1067
|
return e;
|
|
1418
1068
|
});
|
|
1419
|
-
|
|
1420
|
-
|
|
1069
|
+
_context8.prev = 2;
|
|
1070
|
+
_context8.next = 5;
|
|
1421
1071
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
|
|
1422
1072
|
headers: {
|
|
1423
1073
|
Authorization: token
|
|
@@ -1425,33 +1075,33 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1425
1075
|
});
|
|
1426
1076
|
|
|
1427
1077
|
case 5:
|
|
1428
|
-
res =
|
|
1078
|
+
res = _context8.sent;
|
|
1429
1079
|
|
|
1430
1080
|
if (!(res.data.statusCode === 200)) {
|
|
1431
|
-
|
|
1081
|
+
_context8.next = 11;
|
|
1432
1082
|
break;
|
|
1433
1083
|
}
|
|
1434
1084
|
|
|
1435
1085
|
setMessage("Imágenes guardadas con éxito");
|
|
1436
1086
|
sessionStorage.removeItem("imagesList");
|
|
1437
|
-
|
|
1087
|
+
_context8.next = 11;
|
|
1438
1088
|
return loadData();
|
|
1439
1089
|
|
|
1440
1090
|
case 11:
|
|
1441
|
-
|
|
1091
|
+
_context8.next = 16;
|
|
1442
1092
|
break;
|
|
1443
1093
|
|
|
1444
1094
|
case 13:
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
console.log(
|
|
1095
|
+
_context8.prev = 13;
|
|
1096
|
+
_context8.t0 = _context8["catch"](2);
|
|
1097
|
+
console.log(_context8.t0);
|
|
1448
1098
|
|
|
1449
1099
|
case 16:
|
|
1450
1100
|
case "end":
|
|
1451
|
-
return
|
|
1101
|
+
return _context8.stop();
|
|
1452
1102
|
}
|
|
1453
1103
|
}
|
|
1454
|
-
},
|
|
1104
|
+
}, _callee8, null, [[2, 13]]);
|
|
1455
1105
|
})), [dataImages, imagesUploaded]);
|
|
1456
1106
|
|
|
1457
1107
|
var getConcept = function getConcept(tab) {
|
|
@@ -1467,29 +1117,48 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1467
1117
|
}
|
|
1468
1118
|
};
|
|
1469
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
|
+
|
|
1470
1139
|
var createComment = /*#__PURE__*/function () {
|
|
1471
|
-
var
|
|
1140
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(e, body, tab) {
|
|
1472
1141
|
var concept, data;
|
|
1473
|
-
return _regenerator.default.wrap(function
|
|
1142
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1474
1143
|
while (1) {
|
|
1475
|
-
switch (
|
|
1144
|
+
switch (_context9.prev = _context9.next) {
|
|
1476
1145
|
case 0:
|
|
1477
1146
|
concept = "";
|
|
1478
|
-
|
|
1479
|
-
|
|
1147
|
+
_context9.t0 = activeTab;
|
|
1148
|
+
_context9.next = _context9.t0 === "Ficha técnica" ? 4 : _context9.t0 === "Imágenes" ? 6 : 8;
|
|
1480
1149
|
break;
|
|
1481
1150
|
|
|
1482
1151
|
case 4:
|
|
1483
1152
|
concept = "datasheet";
|
|
1484
|
-
return
|
|
1153
|
+
return _context9.abrupt("break", 10);
|
|
1485
1154
|
|
|
1486
1155
|
case 6:
|
|
1487
1156
|
concept = "images";
|
|
1488
|
-
return
|
|
1157
|
+
return _context9.abrupt("break", 10);
|
|
1489
1158
|
|
|
1490
1159
|
case 8:
|
|
1491
1160
|
concept = "description";
|
|
1492
|
-
return
|
|
1161
|
+
return _context9.abrupt("break", 10);
|
|
1493
1162
|
|
|
1494
1163
|
case 10:
|
|
1495
1164
|
data = {
|
|
@@ -1499,7 +1168,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1499
1168
|
concept: concept,
|
|
1500
1169
|
version: version
|
|
1501
1170
|
};
|
|
1502
|
-
|
|
1171
|
+
_context9.next = 13;
|
|
1503
1172
|
return _axios.default.post("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1504
1173
|
headers: {
|
|
1505
1174
|
Authorization: token
|
|
@@ -1508,14 +1177,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1508
1177
|
|
|
1509
1178
|
case 13:
|
|
1510
1179
|
case "end":
|
|
1511
|
-
return
|
|
1180
|
+
return _context9.stop();
|
|
1512
1181
|
}
|
|
1513
1182
|
}
|
|
1514
|
-
},
|
|
1183
|
+
}, _callee9);
|
|
1515
1184
|
}));
|
|
1516
1185
|
|
|
1517
|
-
return function createComment(
|
|
1518
|
-
return
|
|
1186
|
+
return function createComment(_x2, _x3, _x4) {
|
|
1187
|
+
return _ref10.apply(this, arguments);
|
|
1519
1188
|
};
|
|
1520
1189
|
}();
|
|
1521
1190
|
|
|
@@ -1524,16 +1193,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1524
1193
|
}, [activeTab]);
|
|
1525
1194
|
|
|
1526
1195
|
var commentRevised = /*#__PURE__*/function () {
|
|
1527
|
-
var
|
|
1196
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
1528
1197
|
var data;
|
|
1529
|
-
return _regenerator.default.wrap(function
|
|
1198
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1530
1199
|
while (1) {
|
|
1531
|
-
switch (
|
|
1200
|
+
switch (_context10.prev = _context10.next) {
|
|
1532
1201
|
case 0:
|
|
1533
1202
|
data = {
|
|
1534
1203
|
commentId: comment.id
|
|
1535
1204
|
};
|
|
1536
|
-
|
|
1205
|
+
_context10.next = 3;
|
|
1537
1206
|
return _axios.default.put("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1538
1207
|
headers: {
|
|
1539
1208
|
Authorization: token
|
|
@@ -1545,40 +1214,40 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1545
1214
|
|
|
1546
1215
|
case 4:
|
|
1547
1216
|
case "end":
|
|
1548
|
-
return
|
|
1217
|
+
return _context10.stop();
|
|
1549
1218
|
}
|
|
1550
1219
|
}
|
|
1551
|
-
},
|
|
1220
|
+
}, _callee10);
|
|
1552
1221
|
}));
|
|
1553
1222
|
|
|
1554
1223
|
return function commentRevised() {
|
|
1555
|
-
return
|
|
1224
|
+
return _ref11.apply(this, arguments);
|
|
1556
1225
|
};
|
|
1557
1226
|
}();
|
|
1558
1227
|
|
|
1559
1228
|
var setAssignation = /*#__PURE__*/function () {
|
|
1560
|
-
var
|
|
1229
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(assignationType, assignationId) {
|
|
1561
1230
|
var concept, productTemp, data;
|
|
1562
|
-
return _regenerator.default.wrap(function
|
|
1231
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1563
1232
|
while (1) {
|
|
1564
|
-
switch (
|
|
1233
|
+
switch (_context11.prev = _context11.next) {
|
|
1565
1234
|
case 0:
|
|
1566
1235
|
concept = "";
|
|
1567
|
-
|
|
1568
|
-
|
|
1236
|
+
_context11.t0 = activeTab;
|
|
1237
|
+
_context11.next = _context11.t0 === "Ficha técnica" ? 4 : _context11.t0 === "Imágenes" ? 6 : 8;
|
|
1569
1238
|
break;
|
|
1570
1239
|
|
|
1571
1240
|
case 4:
|
|
1572
1241
|
concept = "datasheet";
|
|
1573
|
-
return
|
|
1242
|
+
return _context11.abrupt("break", 10);
|
|
1574
1243
|
|
|
1575
1244
|
case 6:
|
|
1576
1245
|
concept = "images";
|
|
1577
|
-
return
|
|
1246
|
+
return _context11.abrupt("break", 10);
|
|
1578
1247
|
|
|
1579
1248
|
case 8:
|
|
1580
1249
|
concept = "description";
|
|
1581
|
-
return
|
|
1250
|
+
return _context11.abrupt("break", 10);
|
|
1582
1251
|
|
|
1583
1252
|
case 10:
|
|
1584
1253
|
productTemp = product;
|
|
@@ -1591,7 +1260,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1591
1260
|
concept: concept,
|
|
1592
1261
|
userId: assignationId
|
|
1593
1262
|
};
|
|
1594
|
-
|
|
1263
|
+
_context11.next = 15;
|
|
1595
1264
|
return (0, _axios.default)({
|
|
1596
1265
|
method: "post",
|
|
1597
1266
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
@@ -1607,17 +1276,35 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1607
1276
|
|
|
1608
1277
|
case 17:
|
|
1609
1278
|
case "end":
|
|
1610
|
-
return
|
|
1279
|
+
return _context11.stop();
|
|
1611
1280
|
}
|
|
1612
1281
|
}
|
|
1613
|
-
},
|
|
1282
|
+
}, _callee11);
|
|
1614
1283
|
}));
|
|
1615
1284
|
|
|
1616
|
-
return function setAssignation(
|
|
1617
|
-
return
|
|
1285
|
+
return function setAssignation(_x5, _x6) {
|
|
1286
|
+
return _ref12.apply(this, arguments);
|
|
1618
1287
|
};
|
|
1619
1288
|
}();
|
|
1620
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
|
+
|
|
1621
1308
|
var downloadImages = function downloadImages() {
|
|
1622
1309
|
var _images$values3;
|
|
1623
1310
|
|
|
@@ -1697,21 +1384,33 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1697
1384
|
}
|
|
1698
1385
|
};
|
|
1699
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
|
+
|
|
1700
1399
|
var sendEvaluation = /*#__PURE__*/function () {
|
|
1701
|
-
var
|
|
1702
|
-
var _productTemp$
|
|
1400
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(result) {
|
|
1401
|
+
var _productTemp$id_order;
|
|
1703
1402
|
|
|
1704
1403
|
var concept, productTemp, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, res, newStatuses, orderStatus, serviceStatus, newProductEdit, showSurveyByProvider, showSurveyByRetailer, _JSON$parse, newArticleStatus, newServiceStatus, newStatus, retailerStatusCopy, status;
|
|
1705
1404
|
|
|
1706
|
-
return _regenerator.default.wrap(function
|
|
1405
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1707
1406
|
while (1) {
|
|
1708
|
-
switch (
|
|
1407
|
+
switch (_context12.prev = _context12.next) {
|
|
1709
1408
|
case 0:
|
|
1710
1409
|
setLoading(true);
|
|
1711
1410
|
concept = getConcept(activeTab);
|
|
1712
1411
|
productTemp = product;
|
|
1713
1412
|
articleId = productTemp.id_article;
|
|
1714
|
-
orderId = (_productTemp$
|
|
1413
|
+
orderId = (_productTemp$id_order = productTemp.id_order) !== null && _productTemp$id_order !== void 0 ? _productTemp$id_order : productTemp.orderId;
|
|
1715
1414
|
sectionStatusKey = "".concat(getConcept(activeTab), "_status");
|
|
1716
1415
|
evalStatus = product[sectionStatusKey] || (product === null || product === void 0 ? void 0 : product.version_status);
|
|
1717
1416
|
data = {
|
|
@@ -1721,16 +1420,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1721
1420
|
evalStatus: evalStatus
|
|
1722
1421
|
};
|
|
1723
1422
|
retailerId = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id;
|
|
1724
|
-
|
|
1423
|
+
_context12.prev = 9;
|
|
1725
1424
|
|
|
1726
1425
|
if (!result) {
|
|
1727
|
-
|
|
1426
|
+
_context12.next = 27;
|
|
1728
1427
|
break;
|
|
1729
1428
|
}
|
|
1730
1429
|
|
|
1731
1430
|
data.result = result;
|
|
1732
1431
|
data.retailerId = retailerId;
|
|
1733
|
-
|
|
1432
|
+
_context12.next = 15;
|
|
1734
1433
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1735
1434
|
headers: {
|
|
1736
1435
|
Authorization: token
|
|
@@ -1738,7 +1437,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1738
1437
|
});
|
|
1739
1438
|
|
|
1740
1439
|
case 15:
|
|
1741
|
-
res =
|
|
1440
|
+
res = _context12.sent;
|
|
1742
1441
|
newStatuses = JSON.parse(res.data.body);
|
|
1743
1442
|
orderStatus = newStatuses.newOrderStatus;
|
|
1744
1443
|
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(getConcept(activeTab), "Status")];
|
|
@@ -1748,11 +1447,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1748
1447
|
showSurveyByProvider = !user.is_retailer && orderStatus[orderId] === "AP";
|
|
1749
1448
|
showSurveyByRetailer = user.is_retailer && orderStatus[orderId] === "ACA";
|
|
1750
1449
|
showSurvey && showSurvey(showSurveyByProvider || showSurveyByRetailer);
|
|
1751
|
-
|
|
1450
|
+
_context12.next = 30;
|
|
1752
1451
|
break;
|
|
1753
1452
|
|
|
1754
1453
|
case 27:
|
|
1755
|
-
|
|
1454
|
+
_context12.next = 29;
|
|
1756
1455
|
return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1757
1456
|
headers: {
|
|
1758
1457
|
Authorization: token
|
|
@@ -1760,7 +1459,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1760
1459
|
});
|
|
1761
1460
|
|
|
1762
1461
|
case 29:
|
|
1763
|
-
res =
|
|
1462
|
+
res = _context12.sent;
|
|
1764
1463
|
|
|
1765
1464
|
case 30:
|
|
1766
1465
|
if (res.data.statusCode === 200) {
|
|
@@ -1783,39 +1482,39 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1783
1482
|
});
|
|
1784
1483
|
}
|
|
1785
1484
|
|
|
1786
|
-
|
|
1485
|
+
_context12.next = 36;
|
|
1787
1486
|
break;
|
|
1788
1487
|
|
|
1789
1488
|
case 33:
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
console.log(
|
|
1489
|
+
_context12.prev = 33;
|
|
1490
|
+
_context12.t0 = _context12["catch"](9);
|
|
1491
|
+
console.log(_context12.t0);
|
|
1793
1492
|
|
|
1794
1493
|
case 36:
|
|
1795
1494
|
loadData();
|
|
1796
1495
|
|
|
1797
1496
|
case 37:
|
|
1798
1497
|
case "end":
|
|
1799
|
-
return
|
|
1498
|
+
return _context12.stop();
|
|
1800
1499
|
}
|
|
1801
1500
|
}
|
|
1802
|
-
},
|
|
1501
|
+
}, _callee12, null, [[9, 33]]);
|
|
1803
1502
|
}));
|
|
1804
1503
|
|
|
1805
|
-
return function sendEvaluation(
|
|
1806
|
-
return
|
|
1504
|
+
return function sendEvaluation(_x7) {
|
|
1505
|
+
return _ref13.apply(this, arguments);
|
|
1807
1506
|
};
|
|
1808
1507
|
}();
|
|
1809
1508
|
|
|
1810
1509
|
var validateAll = /*#__PURE__*/function () {
|
|
1811
|
-
var
|
|
1812
|
-
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;
|
|
1813
1512
|
|
|
1814
|
-
return _regenerator.default.wrap(function
|
|
1513
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1815
1514
|
while (1) {
|
|
1816
|
-
switch (
|
|
1515
|
+
switch (_context13.prev = _context13.next) {
|
|
1817
1516
|
case 0:
|
|
1818
|
-
|
|
1517
|
+
_context13.prev = 0;
|
|
1819
1518
|
setLoading(true);
|
|
1820
1519
|
evaluationArray = [];
|
|
1821
1520
|
conceptArray = ["description", "datasheet", "images"];
|
|
@@ -1840,22 +1539,22 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1840
1539
|
}
|
|
1841
1540
|
}));
|
|
1842
1541
|
});
|
|
1843
|
-
|
|
1542
|
+
_context13.next = 8;
|
|
1844
1543
|
return Promise.all(evaluationArray);
|
|
1845
1544
|
|
|
1846
1545
|
case 8:
|
|
1546
|
+
evalResponse = _context13.sent;
|
|
1847
1547
|
userType = user.is_retailer === 1 ? "CA" : "P";
|
|
1848
1548
|
productTemp = product;
|
|
1849
|
-
|
|
1850
|
-
productTemp.
|
|
1851
|
-
productTemp.
|
|
1852
|
-
productTemp.
|
|
1853
|
-
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);
|
|
1854
1553
|
retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
|
|
1855
1554
|
Object.keys(retailerStatusCopy).forEach(function (key) {
|
|
1856
1555
|
conceptArray.forEach(function (concept) {
|
|
1857
1556
|
if (retailerStatusCopy[key][concept]) {
|
|
1858
|
-
retailerStatusCopy[key][concept] =
|
|
1557
|
+
retailerStatusCopy[key][concept] = "".concat(result).concat(userType);
|
|
1859
1558
|
}
|
|
1860
1559
|
});
|
|
1861
1560
|
});
|
|
@@ -1873,37 +1572,37 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1873
1572
|
idCategory: productTemp.article.id_category,
|
|
1874
1573
|
product: productTemp
|
|
1875
1574
|
}));
|
|
1876
|
-
|
|
1575
|
+
_context13.next = 25;
|
|
1877
1576
|
return loadData();
|
|
1878
1577
|
|
|
1879
1578
|
case 25:
|
|
1880
|
-
|
|
1579
|
+
_context13.next = 30;
|
|
1881
1580
|
break;
|
|
1882
1581
|
|
|
1883
1582
|
case 27:
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
console.log(
|
|
1583
|
+
_context13.prev = 27;
|
|
1584
|
+
_context13.t0 = _context13["catch"](0);
|
|
1585
|
+
console.log(_context13.t0);
|
|
1887
1586
|
|
|
1888
1587
|
case 30:
|
|
1889
1588
|
case "end":
|
|
1890
|
-
return
|
|
1589
|
+
return _context13.stop();
|
|
1891
1590
|
}
|
|
1892
1591
|
}
|
|
1893
|
-
},
|
|
1592
|
+
}, _callee13, null, [[0, 27]]);
|
|
1894
1593
|
}));
|
|
1895
1594
|
|
|
1896
|
-
return function validateAll(
|
|
1897
|
-
return
|
|
1595
|
+
return function validateAll(_x8) {
|
|
1596
|
+
return _ref14.apply(this, arguments);
|
|
1898
1597
|
};
|
|
1899
1598
|
}();
|
|
1900
1599
|
|
|
1901
1600
|
var evaluationToRetailer = /*#__PURE__*/function () {
|
|
1902
|
-
var
|
|
1601
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(result) {
|
|
1903
1602
|
var data, prod, statusComplete;
|
|
1904
|
-
return _regenerator.default.wrap(function
|
|
1603
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
1905
1604
|
while (1) {
|
|
1906
|
-
switch (
|
|
1605
|
+
switch (_context14.prev = _context14.next) {
|
|
1907
1606
|
case 0:
|
|
1908
1607
|
data = {
|
|
1909
1608
|
articleId: product.id_article,
|
|
@@ -1911,7 +1610,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1911
1610
|
versionId: product.version,
|
|
1912
1611
|
status: result
|
|
1913
1612
|
};
|
|
1914
|
-
|
|
1613
|
+
_context14.next = 3;
|
|
1915
1614
|
return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
|
|
1916
1615
|
headers: {
|
|
1917
1616
|
Authorization: token
|
|
@@ -1928,26 +1627,25 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1928
1627
|
prod.product.services_status = "[\"".concat(statusComplete, "\",\"").concat(statusComplete, "\",\"").concat(statusComplete, "\"]");
|
|
1929
1628
|
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
1930
1629
|
setProduct(prod);
|
|
1931
|
-
|
|
1932
|
-
|
|
1630
|
+
setShowGenericModal && setShowGenericModal(false);
|
|
1631
|
+
_context14.next = 15;
|
|
1933
1632
|
return loadData();
|
|
1934
1633
|
|
|
1935
1634
|
case 15:
|
|
1936
1635
|
case "end":
|
|
1937
|
-
return
|
|
1636
|
+
return _context14.stop();
|
|
1938
1637
|
}
|
|
1939
1638
|
}
|
|
1940
|
-
},
|
|
1639
|
+
}, _callee14);
|
|
1941
1640
|
}));
|
|
1942
1641
|
|
|
1943
|
-
return function evaluationToRetailer(
|
|
1944
|
-
return
|
|
1642
|
+
return function evaluationToRetailer(_x9) {
|
|
1643
|
+
return _ref15.apply(this, arguments);
|
|
1945
1644
|
};
|
|
1946
1645
|
}();
|
|
1947
1646
|
|
|
1948
1647
|
var getSectionStatus = function getSectionStatus() {
|
|
1949
1648
|
var concept = getConcept(activeTab);
|
|
1950
|
-
console.log("getSectionStatus", productEdit.product["".concat(concept, "_status")]);
|
|
1951
1649
|
return ["AA", "AP", "R", "CA", "RCA"].includes(productEdit.product["".concat(concept, "_status")]);
|
|
1952
1650
|
};
|
|
1953
1651
|
|
|
@@ -2000,7 +1698,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2000
1698
|
}
|
|
2001
1699
|
});
|
|
2002
1700
|
});
|
|
2003
|
-
|
|
1701
|
+
setShowGenericModal(true);
|
|
2004
1702
|
} else if (user.is_retailer) {
|
|
2005
1703
|
if (product.id_order || product.orderId) {
|
|
2006
1704
|
sendEvaluation("A");
|
|
@@ -2015,7 +1713,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2015
1713
|
}
|
|
2016
1714
|
});
|
|
2017
1715
|
});
|
|
2018
|
-
|
|
1716
|
+
setShowGenericModal(true);
|
|
2019
1717
|
}
|
|
2020
1718
|
} else {
|
|
2021
1719
|
sendEvaluation("A");
|
|
@@ -2026,7 +1724,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2026
1724
|
} else if (user.is_retailer) {
|
|
2027
1725
|
if (product.id_order || product.orderId) {
|
|
2028
1726
|
setValidatedAll(true);
|
|
2029
|
-
|
|
1727
|
+
setModalViewError(true);
|
|
2030
1728
|
} else {
|
|
2031
1729
|
setDataGenericModal(function (prev) {
|
|
2032
1730
|
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
@@ -2038,11 +1736,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2038
1736
|
}
|
|
2039
1737
|
});
|
|
2040
1738
|
});
|
|
2041
|
-
|
|
1739
|
+
setShowGenericModal(true);
|
|
2042
1740
|
}
|
|
2043
1741
|
} else {
|
|
2044
1742
|
setValidatedAll(true);
|
|
2045
|
-
|
|
1743
|
+
setModalViewError(true);
|
|
2046
1744
|
}
|
|
2047
1745
|
}
|
|
2048
1746
|
};
|
|
@@ -2051,7 +1749,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2051
1749
|
headerTop: headerTop,
|
|
2052
1750
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
2053
1751
|
setHeaderTop: setHeaderTop,
|
|
2054
|
-
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,
|
|
2055
1753
|
productSelected: productSelected,
|
|
2056
1754
|
token: token,
|
|
2057
1755
|
activeRetailer: activeRetailer
|
|
@@ -2103,7 +1801,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2103
1801
|
}
|
|
2104
1802
|
});
|
|
2105
1803
|
});
|
|
2106
|
-
|
|
1804
|
+
setShowGenericModal(true);
|
|
2107
1805
|
} else if (user.is_retailer) {
|
|
2108
1806
|
if (product.id_order || product.orderId) {
|
|
2109
1807
|
validateAll("A");
|
|
@@ -2118,7 +1816,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2118
1816
|
}
|
|
2119
1817
|
});
|
|
2120
1818
|
});
|
|
2121
|
-
|
|
1819
|
+
setShowGenericModal(true);
|
|
2122
1820
|
}
|
|
2123
1821
|
} else {
|
|
2124
1822
|
validateAll("A");
|
|
@@ -2130,7 +1828,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2130
1828
|
} else if (user.is_retailer) {
|
|
2131
1829
|
if (product.id_order || product.orderId) {
|
|
2132
1830
|
setValidatedAll(true);
|
|
2133
|
-
|
|
1831
|
+
setModalViewError(true);
|
|
2134
1832
|
} else {
|
|
2135
1833
|
setDataGenericModal(function (prev) {
|
|
2136
1834
|
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
@@ -2142,11 +1840,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2142
1840
|
}
|
|
2143
1841
|
});
|
|
2144
1842
|
});
|
|
2145
|
-
|
|
1843
|
+
setShowGenericModal(true);
|
|
2146
1844
|
}
|
|
2147
1845
|
} else {
|
|
2148
1846
|
setValidatedAll(true);
|
|
2149
|
-
|
|
1847
|
+
setModalViewError(true);
|
|
2150
1848
|
}
|
|
2151
1849
|
},
|
|
2152
1850
|
approve: function approve() {
|
|
@@ -2261,20 +1959,20 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2261
1959
|
reviewed: crossComment
|
|
2262
1960
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
2263
1961
|
buttonType: "circular-button accept-button",
|
|
2264
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2265
|
-
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) {
|
|
2266
1964
|
while (1) {
|
|
2267
|
-
switch (
|
|
1965
|
+
switch (_context15.prev = _context15.next) {
|
|
2268
1966
|
case 0:
|
|
2269
1967
|
setCrossComment(true);
|
|
2270
1968
|
commentRevised();
|
|
2271
1969
|
|
|
2272
1970
|
case 2:
|
|
2273
1971
|
case "end":
|
|
2274
|
-
return
|
|
1972
|
+
return _context15.stop();
|
|
2275
1973
|
}
|
|
2276
1974
|
}
|
|
2277
|
-
},
|
|
1975
|
+
}, _callee15);
|
|
2278
1976
|
}))
|
|
2279
1977
|
})]
|
|
2280
1978
|
})
|
|
@@ -2328,9 +2026,64 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2328
2026
|
onClick: function onClick() {
|
|
2329
2027
|
return setMessage("");
|
|
2330
2028
|
}
|
|
2331
|
-
}),
|
|
2332
|
-
close:
|
|
2333
|
-
|
|
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, {
|
|
2334
2087
|
modalId: "version-selector",
|
|
2335
2088
|
articleId: product.id_article,
|
|
2336
2089
|
setVersion: setVersion,
|