contentoh-components-library 21.1.63 → 21.1.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.development +1 -0
- package/.env.production +1 -0
- package/dist/components/atoms/GeneralButton/index.js +3 -1
- package/dist/components/atoms/GeneralButton/styles.js +2 -2
- package/dist/components/atoms/InputFormatter/index.js +3 -3
- package/dist/components/atoms/ProductPercentCard/Percent.stories.js +1 -1
- package/dist/components/atoms/ProductPercentCard/styles.js +1 -1
- package/dist/components/atoms/Select/VersionSelect.js +37 -0
- package/dist/components/atoms/Select/index.js +4 -3
- package/dist/components/atoms/Select/style.js +10 -4
- package/dist/components/atoms/SliderToolTip/styles.js +2 -2
- package/dist/components/molecules/AssignedWork/AssignedWork.stories.js +1 -1
- package/dist/components/molecules/AssignedWork/styles.js +1 -1
- package/dist/components/molecules/StatusAsignationInfo/index.js +9 -1
- package/dist/components/molecules/VersionItem/VersionItem.stories.js +28 -0
- package/dist/components/molecules/VersionItem/index.js +64 -0
- package/dist/components/molecules/VersionItem/styles.js +20 -0
- package/dist/components/organisms/CreateVersion/CreateVersion.stories.js +31 -0
- package/dist/components/organisms/CreateVersion/RenderChilds.js +157 -0
- package/dist/components/organisms/CreateVersion/index.js +170 -0
- package/dist/components/organisms/CreateVersion/styles.js +28 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -1
- package/dist/components/organisms/FullTabsMenu/index.js +6 -2
- package/dist/components/organisms/VersionSelector/VersionSelector.stories.js +32 -0
- package/dist/components/organisms/VersionSelector/index.js +129 -0
- package/dist/components/organisms/VersionSelector/styles.js +20 -0
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +102 -112
- package/dist/components/pages/ProviderProductEdition/index.js +449 -431
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +53 -72
- package/dist/components/pages/RetailerProductEdition/index.js +245 -231
- package/dist/global-files/customHooks.js +35 -0
- package/dist/global-files/data.js +8 -8
- package/package.json +2 -2
- package/src/assets/images/versionSelector/acceptIcon.svg +3 -0
- package/src/assets/images/versionSelector/addVersion.svg +5 -0
- package/src/assets/images/versionSelector/closeVersionSelector.svg +4 -0
- package/src/assets/images/versionSelector/createVersion.svg +3 -0
- package/src/assets/images/versionSelector/nullIcon.svg +3 -0
- package/src/assets/images/versionSelector/versionSelected.svg +3 -0
- package/src/components/atoms/GeneralButton/index.js +2 -0
- package/src/components/atoms/GeneralButton/styles.js +18 -0
- package/src/components/atoms/InputFormatter/index.js +6 -3
- package/src/components/atoms/ProductPercentCard/Percent.stories.js +12 -11
- package/src/components/atoms/ProductPercentCard/styles.js +9 -9
- package/src/components/atoms/ProgressBar/styles.js +69 -0
- package/src/components/atoms/Select/VersionSelect.js +25 -0
- package/src/components/atoms/Select/index.js +1 -1
- package/src/components/atoms/Select/style.js +19 -0
- package/src/components/atoms/SliderToolTip/styles.js +18 -14
- package/src/components/molecules/AssignedWork/AssignedWork.stories.js +8 -8
- package/src/components/molecules/AssignedWork/styles.js +10 -9
- package/src/components/molecules/StatusAsignationInfo/index.js +10 -1
- package/src/components/molecules/VersionItem/VersionItem.stories.js +14 -0
- package/src/components/molecules/VersionItem/index.js +47 -0
- package/src/components/molecules/VersionItem/styles.js +32 -0
- package/src/components/organisms/CreateVersion/CreateVersion.stories.js +14 -0
- package/src/components/organisms/CreateVersion/RenderChilds.js +137 -0
- package/src/components/organisms/CreateVersion/index.js +88 -0
- package/src/components/organisms/CreateVersion/styles.js +79 -0
- package/src/components/organisms/FullProductNameHeader/index.js +2 -2
- package/src/components/organisms/FullTabsMenu/index.js +5 -1
- package/src/components/organisms/VersionSelector/VersionSelector.stories.js +15 -0
- package/src/components/organisms/VersionSelector/index.js +75 -0
- package/src/components/organisms/VersionSelector/styles.js +28 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +116 -134
- package/src/components/pages/ProviderProductEdition/index.js +267 -234
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +53 -74
- package/src/components/pages/RetailerProductEdition/index.js +201 -151
- package/src/global-files/customHooks.js +26 -0
- package/src/global-files/data.js +8 -8
- package/src/global-files/global-styles.css +1 -0
|
@@ -9,6 +9,8 @@ exports.RetailerProductEdition = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
13
|
+
|
|
12
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
13
15
|
|
|
14
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
@@ -37,7 +39,7 @@ var _GalleryElement = require("../../molecules/GalleryElement");
|
|
|
37
39
|
|
|
38
40
|
var _fileSaver = require("file-saver");
|
|
39
41
|
|
|
40
|
-
var
|
|
42
|
+
var _data2 = require("../../../global-files/data");
|
|
41
43
|
|
|
42
44
|
var _GalleryHeader = require("../../molecules/GalleryHeader");
|
|
43
45
|
|
|
@@ -73,6 +75,12 @@ var _genericModalCheck = _interopRequireDefault(require("../../../assets/images/
|
|
|
73
75
|
|
|
74
76
|
var _errorModal = _interopRequireDefault(require("../../../assets/images/genericModal/errorModal.svg"));
|
|
75
77
|
|
|
78
|
+
var _VersionSelector = require("../../organisms/VersionSelector");
|
|
79
|
+
|
|
80
|
+
var _customHooks = require("../../../global-files/customHooks");
|
|
81
|
+
|
|
82
|
+
var _CreateVersion = require("../../organisms/CreateVersion");
|
|
83
|
+
|
|
76
84
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
77
85
|
|
|
78
86
|
var reducerImages = function reducerImages(state, action) {
|
|
@@ -380,6 +388,17 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
380
388
|
setSaving = _useState70[1];
|
|
381
389
|
|
|
382
390
|
var isAuditor = user.id_role === 6;
|
|
391
|
+
|
|
392
|
+
var _closeModals = (0, _customHooks.closeModals)("version-selector"),
|
|
393
|
+
_closeModals2 = (0, _slicedToArray2.default)(_closeModals, 2),
|
|
394
|
+
showVersionSelector = _closeModals2[0],
|
|
395
|
+
setShowVersionSelector = _closeModals2[1];
|
|
396
|
+
|
|
397
|
+
var _useState71 = (0, _react.useState)(false),
|
|
398
|
+
_useState72 = (0, _slicedToArray2.default)(_useState71, 2),
|
|
399
|
+
showCreateVersion = _useState72[0],
|
|
400
|
+
setShowCreateVersion = _useState72[1];
|
|
401
|
+
|
|
383
402
|
(0, _react.useEffect)(function () {
|
|
384
403
|
checkAll && setSelectedImages(images.values);
|
|
385
404
|
}, [checkAll]);
|
|
@@ -394,20 +413,20 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
394
413
|
case 0:
|
|
395
414
|
_context.prev = 0;
|
|
396
415
|
_context.next = 3;
|
|
397
|
-
return (0,
|
|
416
|
+
return (0, _data2.getRetailerServices)(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.category, parseInt(product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_category), version);
|
|
398
417
|
|
|
399
418
|
case 3:
|
|
400
419
|
_services = _context.sent;
|
|
401
420
|
//Converts the data inside the datasheets object to array
|
|
402
421
|
setServices(_services);
|
|
403
|
-
getServices(); //
|
|
422
|
+
getServices(); //setActiveRetailer(product?.retailers[0]);
|
|
404
423
|
|
|
405
424
|
setImages({
|
|
406
425
|
action: "init",
|
|
407
426
|
init: _services[2]
|
|
408
427
|
});
|
|
409
428
|
if (((_services$ = _services[2]) === null || _services$ === void 0 ? void 0 : (_services$$values = _services$.values) === null || _services$$values === void 0 ? void 0 : _services$$values.length) > 0) setActiveImage(0);
|
|
410
|
-
(0,
|
|
429
|
+
(0, _data2.getPercentage)({
|
|
411
430
|
data: [product]
|
|
412
431
|
}).then(function (res) {
|
|
413
432
|
return setPercentages(res);
|
|
@@ -438,7 +457,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
438
457
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
439
458
|
var _product$article4, _product$article5, _servicesResponse$dat;
|
|
440
459
|
|
|
441
|
-
var servicesResponse, parsedResponse, retailers,
|
|
460
|
+
var servicesResponse, parsedResponse, retailers, active;
|
|
442
461
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
443
462
|
while (1) {
|
|
444
463
|
switch (_context2.prev = _context2.next) {
|
|
@@ -450,16 +469,15 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
450
469
|
servicesResponse = _context2.sent;
|
|
451
470
|
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;
|
|
452
471
|
retailers = product.retailers || product.retailersAvailable;
|
|
453
|
-
|
|
454
|
-
return srv
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
});
|
|
472
|
+
active = retailers === null || retailers === void 0 ? void 0 : retailers.filter(function (retailer) {
|
|
473
|
+
return parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
|
|
474
|
+
return srv.id_retailer;
|
|
475
|
+
}).includes(retailer.id);
|
|
476
|
+
})[0];
|
|
459
477
|
!activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
|
|
460
478
|
setServicesData(parsedResponse);
|
|
461
479
|
|
|
462
|
-
case
|
|
480
|
+
case 8:
|
|
463
481
|
case "end":
|
|
464
482
|
return _context2.stop();
|
|
465
483
|
}
|
|
@@ -473,12 +491,17 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
473
491
|
}();
|
|
474
492
|
|
|
475
493
|
var translateConcept = function translateConcept(concept) {
|
|
476
|
-
var translation =
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
}
|
|
481
|
-
|
|
494
|
+
var translation = "";
|
|
495
|
+
|
|
496
|
+
if (concept === "datasheet") {
|
|
497
|
+
translation = "Ficha técnica";
|
|
498
|
+
} else if (concept === "description") {
|
|
499
|
+
translation = "Descripción";
|
|
500
|
+
} else if (concept === "images") {
|
|
501
|
+
translation = "Imágenes";
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
return translation;
|
|
482
505
|
};
|
|
483
506
|
|
|
484
507
|
var getComments = /*#__PURE__*/function () {
|
|
@@ -527,46 +550,47 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
527
550
|
while (1) {
|
|
528
551
|
switch (_context4.prev = _context4.next) {
|
|
529
552
|
case 0:
|
|
553
|
+
setLoading(true);
|
|
530
554
|
loadData();
|
|
531
555
|
getComments();
|
|
532
556
|
_context4.t0 = setUserGroups;
|
|
533
|
-
_context4.next =
|
|
534
|
-
return (0,
|
|
557
|
+
_context4.next = 6;
|
|
558
|
+
return (0, _data2.fetchUsers)(token);
|
|
535
559
|
|
|
536
|
-
case
|
|
560
|
+
case 6:
|
|
537
561
|
_context4.t1 = _context4.sent;
|
|
538
562
|
(0, _context4.t0)(_context4.t1);
|
|
539
563
|
arr = [];
|
|
540
564
|
_context4.t2 = user.id_role;
|
|
541
|
-
_context4.next = _context4.t2 === 7 ?
|
|
565
|
+
_context4.next = _context4.t2 === 7 ? 12 : _context4.t2 === 8 ? 12 : _context4.t2 === 4 ? 14 : _context4.t2 === 5 ? 14 : _context4.t2 === 6 ? 16 : 18;
|
|
542
566
|
break;
|
|
543
567
|
|
|
544
|
-
case
|
|
545
|
-
arr = ["
|
|
546
|
-
return _context4.abrupt("break",
|
|
568
|
+
case 12:
|
|
569
|
+
arr = ["IN_PROGRESS", "RF", "RA"];
|
|
570
|
+
return _context4.abrupt("break", 20);
|
|
547
571
|
|
|
548
|
-
case
|
|
549
|
-
arr = ["
|
|
550
|
-
return _context4.abrupt("break",
|
|
572
|
+
case 14:
|
|
573
|
+
arr = ["RF", "AF", "AA", "AP", "AC"];
|
|
574
|
+
return _context4.abrupt("break", 20);
|
|
551
575
|
|
|
552
|
-
case
|
|
553
|
-
arr = ["RP", "
|
|
554
|
-
return _context4.abrupt("break",
|
|
576
|
+
case 16:
|
|
577
|
+
arr = ["RP", "RC", "AF", "RA"];
|
|
578
|
+
return _context4.abrupt("break", 20);
|
|
555
579
|
|
|
556
|
-
case
|
|
580
|
+
case 18:
|
|
557
581
|
arr = [];
|
|
558
|
-
return _context4.abrupt("break",
|
|
582
|
+
return _context4.abrupt("break", 20);
|
|
559
583
|
|
|
560
|
-
case
|
|
584
|
+
case 20:
|
|
561
585
|
setStatusArray(arr);
|
|
562
586
|
|
|
563
|
-
case
|
|
587
|
+
case 21:
|
|
564
588
|
case "end":
|
|
565
589
|
return _context4.stop();
|
|
566
590
|
}
|
|
567
591
|
}
|
|
568
592
|
}, _callee4);
|
|
569
|
-
})), [product]);
|
|
593
|
+
})), [product, version]);
|
|
570
594
|
|
|
571
595
|
var loadAssignations = function loadAssignations(currentProduct) {
|
|
572
596
|
var _currentProduct$artic, _currentProduct$artic2, _currentProduct$artic3, _currentProduct$artic4, _currentProduct$artic5, _currentProduct$artic6;
|
|
@@ -686,60 +710,49 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
686
710
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
687
711
|
var _product$article9;
|
|
688
712
|
|
|
689
|
-
var productTemp,
|
|
690
|
-
|
|
713
|
+
var productTemp, dataObject;
|
|
691
714
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
692
715
|
while (1) {
|
|
693
716
|
switch (_context5.prev = _context5.next) {
|
|
694
717
|
case 0:
|
|
695
718
|
setLoading(true);
|
|
696
719
|
productTemp = product;
|
|
697
|
-
articleId = product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article;
|
|
698
720
|
dataObject = {
|
|
699
|
-
articleId:
|
|
721
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article,
|
|
700
722
|
articleData: updatedDescriptions
|
|
701
723
|
};
|
|
702
724
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
703
|
-
_context5.prev =
|
|
704
|
-
_context5.next =
|
|
725
|
+
_context5.prev = 4;
|
|
726
|
+
_context5.next = 7;
|
|
705
727
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
706
728
|
headers: {
|
|
707
729
|
Authorization: token
|
|
708
730
|
}
|
|
709
731
|
});
|
|
710
732
|
|
|
711
|
-
case
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
break;
|
|
733
|
+
case 7:
|
|
734
|
+
if (productTemp.status === "ASSIGNED") {
|
|
735
|
+
productTemp.status = "IN_PROGRESS";
|
|
736
|
+
setProduct(productTemp);
|
|
737
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
717
738
|
}
|
|
718
739
|
|
|
719
|
-
_JSON$parse2 = JSON.parse(res.data.body), newStatus = _JSON$parse2.newStatus, newArticleStatus = _JSON$parse2.newArticleStatus;
|
|
720
|
-
if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
|
|
721
|
-
if (newStatus) productTemp.description_status = newStatus;
|
|
722
|
-
setProduct(productTemp);
|
|
723
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
724
740
|
setMessage("Descripciones guardadas con éxito");
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
case 18:
|
|
729
|
-
_context5.next = 23;
|
|
741
|
+
loadData();
|
|
742
|
+
_context5.next = 15;
|
|
730
743
|
break;
|
|
731
744
|
|
|
732
|
-
case
|
|
733
|
-
_context5.prev =
|
|
734
|
-
_context5.t0 = _context5["catch"](
|
|
745
|
+
case 12:
|
|
746
|
+
_context5.prev = 12;
|
|
747
|
+
_context5.t0 = _context5["catch"](4);
|
|
735
748
|
console.log(_context5.t0);
|
|
736
749
|
|
|
737
|
-
case
|
|
750
|
+
case 15:
|
|
738
751
|
case "end":
|
|
739
752
|
return _context5.stop();
|
|
740
753
|
}
|
|
741
754
|
}
|
|
742
|
-
}, _callee5, null, [[
|
|
755
|
+
}, _callee5, null, [[4, 12]]);
|
|
743
756
|
}));
|
|
744
757
|
|
|
745
758
|
return function saveDescriptions() {
|
|
@@ -751,60 +764,50 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
751
764
|
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
752
765
|
var _product$article10;
|
|
753
766
|
|
|
754
|
-
var productTemp,
|
|
755
|
-
|
|
767
|
+
var productTemp, dataObject;
|
|
756
768
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
757
769
|
while (1) {
|
|
758
770
|
switch (_context6.prev = _context6.next) {
|
|
759
771
|
case 0:
|
|
760
772
|
setLoading(true);
|
|
761
773
|
productTemp = product;
|
|
762
|
-
articleId = product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article;
|
|
763
774
|
dataObject = {
|
|
764
|
-
articleId:
|
|
775
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article,
|
|
765
776
|
articleData: updatedDatasheets
|
|
766
777
|
};
|
|
767
778
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
768
|
-
_context6.prev =
|
|
769
|
-
_context6.next =
|
|
779
|
+
_context6.prev = 4;
|
|
780
|
+
_context6.next = 7;
|
|
770
781
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
771
782
|
headers: {
|
|
772
783
|
Authorization: token
|
|
773
784
|
}
|
|
774
785
|
});
|
|
775
786
|
|
|
776
|
-
case
|
|
777
|
-
|
|
787
|
+
case 7:
|
|
788
|
+
setMessage("Fichas técnicas guardadas");
|
|
778
789
|
|
|
779
|
-
if (
|
|
780
|
-
|
|
781
|
-
|
|
790
|
+
if (productTemp.status === "ASSIGNED") {
|
|
791
|
+
productTemp.status = "IN_PROGRESS";
|
|
792
|
+
setProduct(productTemp);
|
|
793
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
782
794
|
}
|
|
783
795
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
if (newStatus) productTemp.datasheet_status = newStatus;
|
|
787
|
-
setProduct(productTemp);
|
|
788
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
789
|
-
setMessage("Fichas técnicas guardadas");
|
|
790
|
-
_context6.next = 18;
|
|
791
|
-
return loadData();
|
|
792
|
-
|
|
793
|
-
case 18:
|
|
794
|
-
_context6.next = 23;
|
|
796
|
+
loadData();
|
|
797
|
+
_context6.next = 15;
|
|
795
798
|
break;
|
|
796
799
|
|
|
797
|
-
case
|
|
798
|
-
_context6.prev =
|
|
799
|
-
_context6.t0 = _context6["catch"](
|
|
800
|
+
case 12:
|
|
801
|
+
_context6.prev = 12;
|
|
802
|
+
_context6.t0 = _context6["catch"](4);
|
|
800
803
|
console.log(_context6.t0);
|
|
801
804
|
|
|
802
|
-
case
|
|
805
|
+
case 15:
|
|
803
806
|
case "end":
|
|
804
807
|
return _context6.stop();
|
|
805
808
|
}
|
|
806
809
|
}
|
|
807
|
-
}, _callee6, null, [[
|
|
810
|
+
}, _callee6, null, [[4, 12]]);
|
|
808
811
|
}));
|
|
809
812
|
|
|
810
813
|
return function saveDatasheets() {
|
|
@@ -830,7 +833,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
830
833
|
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
831
834
|
var _images$values2, _product$article11, _data$articleData, _data$articleData2, _data$updateImages;
|
|
832
835
|
|
|
833
|
-
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
836
|
+
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray, productTemp;
|
|
834
837
|
|
|
835
838
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
836
839
|
while (1) {
|
|
@@ -882,7 +885,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
882
885
|
}
|
|
883
886
|
|
|
884
887
|
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
885
|
-
_context7.next =
|
|
888
|
+
_context7.next = 32;
|
|
886
889
|
break;
|
|
887
890
|
}
|
|
888
891
|
|
|
@@ -922,38 +925,44 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
922
925
|
setImagesUploaded(true);
|
|
923
926
|
|
|
924
927
|
case 23:
|
|
925
|
-
|
|
928
|
+
productTemp = product;
|
|
929
|
+
|
|
930
|
+
if (productTemp.status === "ASSIGNED") {
|
|
931
|
+
productTemp.status = "IN_PROGRESS";
|
|
932
|
+
setProduct(productTemp);
|
|
933
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
_context7.next = 30;
|
|
926
937
|
break;
|
|
927
938
|
|
|
928
|
-
case
|
|
929
|
-
_context7.prev =
|
|
939
|
+
case 27:
|
|
940
|
+
_context7.prev = 27;
|
|
930
941
|
_context7.t0 = _context7["catch"](10);
|
|
931
942
|
console.log(_context7.t0); // setMainLoading(false);
|
|
932
943
|
|
|
933
|
-
case
|
|
934
|
-
_context7.next =
|
|
944
|
+
case 30:
|
|
945
|
+
_context7.next = 33;
|
|
935
946
|
break;
|
|
936
947
|
|
|
937
|
-
case
|
|
948
|
+
case 32:
|
|
938
949
|
// setMainLoading(false);
|
|
939
950
|
setMessage("Completa los campos que solicita cada una de la imágenes o hay imágenes con el mismo tipo de toma.\nRecuerda hay campos obligatorios y no podras avanzar si no estan completos.");
|
|
940
951
|
|
|
941
|
-
case
|
|
952
|
+
case 33:
|
|
942
953
|
case "end":
|
|
943
954
|
return _context7.stop();
|
|
944
955
|
}
|
|
945
956
|
}
|
|
946
|
-
}, _callee7, null, [[10,
|
|
957
|
+
}, _callee7, null, [[10, 27]]);
|
|
947
958
|
})), [images, imagesUploaded]);
|
|
948
959
|
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
949
|
-
var res, productTemp, _JSON$parse4, newStatus, newArticleStatus;
|
|
950
|
-
|
|
951
960
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
952
961
|
while (1) {
|
|
953
962
|
switch (_context8.prev = _context8.next) {
|
|
954
963
|
case 0:
|
|
955
964
|
if (!imagesUploaded) {
|
|
956
|
-
_context8.next =
|
|
965
|
+
_context8.next = 13;
|
|
957
966
|
break;
|
|
958
967
|
}
|
|
959
968
|
|
|
@@ -974,72 +983,58 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
974
983
|
});
|
|
975
984
|
|
|
976
985
|
case 5:
|
|
977
|
-
res = _context8.sent;
|
|
978
|
-
|
|
979
|
-
if (!(res.data.statusCode === 200)) {
|
|
980
|
-
_context8.next = 17;
|
|
981
|
-
break;
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
productTemp = product;
|
|
985
|
-
_JSON$parse4 = JSON.parse(res.data.body), newStatus = _JSON$parse4.newStatus, newArticleStatus = _JSON$parse4.newArticleStatus;
|
|
986
|
-
if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
|
|
987
|
-
if (newStatus) productTemp.images_status = newStatus;
|
|
988
|
-
setProduct(productTemp);
|
|
989
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
990
986
|
setMessage("Imágenes guardadas con éxito");
|
|
991
987
|
sessionStorage.removeItem("imagesList");
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
case 17:
|
|
996
|
-
_context8.next = 22;
|
|
988
|
+
loadData();
|
|
989
|
+
_context8.next = 13;
|
|
997
990
|
break;
|
|
998
991
|
|
|
999
|
-
case
|
|
1000
|
-
_context8.prev =
|
|
992
|
+
case 10:
|
|
993
|
+
_context8.prev = 10;
|
|
1001
994
|
_context8.t0 = _context8["catch"](2);
|
|
1002
995
|
console.log(_context8.t0);
|
|
1003
996
|
|
|
1004
|
-
case
|
|
997
|
+
case 13:
|
|
1005
998
|
case "end":
|
|
1006
999
|
return _context8.stop();
|
|
1007
1000
|
}
|
|
1008
1001
|
}
|
|
1009
|
-
}, _callee8, null, [[2,
|
|
1002
|
+
}, _callee8, null, [[2, 10]]);
|
|
1010
1003
|
})), [dataImages, imagesUploaded]);
|
|
1011
1004
|
|
|
1012
1005
|
var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {
|
|
1013
|
-
var _srv$find, _srv$find$status, _product$;
|
|
1014
|
-
|
|
1015
1006
|
var srv = servicesData.filter(function (serv) {
|
|
1016
1007
|
return serv.service === getConcept(tab);
|
|
1017
1008
|
});
|
|
1018
|
-
|
|
1009
|
+
|
|
1010
|
+
var _srv$filter = srv.filter(function (serv) {
|
|
1019
1011
|
return serv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
|
|
1020
|
-
})
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1012
|
+
}),
|
|
1013
|
+
_srv$filter2 = (0, _slicedToArray2.default)(_srv$filter, 1),
|
|
1014
|
+
srvActive = _srv$filter2[0];
|
|
1015
|
+
|
|
1016
|
+
var unvalidated = product["".concat(getConcept(tab), "_status")] === "QF" || product["".concat(getConcept(tab), "_status")] === "IN_PROGRESS";
|
|
1017
|
+
var auditorUnvalidated = !["RA", "AA", "AC", "AP"].includes(product["".concat(getConcept(tab), "_status")]);
|
|
1024
1018
|
|
|
1025
1019
|
switch (userId) {
|
|
1026
1020
|
case 7:
|
|
1027
1021
|
case 8:
|
|
1028
|
-
return
|
|
1022
|
+
return ["RA", "RF"].includes(product === null || product === void 0 ? void 0 : product.status) && //"IN_PROGRESS", "RF", "RA"
|
|
1023
|
+
statusArray.includes(srvActive === null || srvActive === void 0 ? void 0 : srvActive.status) || statusArray.includes(product.status) && srv.filter(function (serv) {
|
|
1029
1024
|
return statusArray.includes(serv.status);
|
|
1030
|
-
}).length === srv.length
|
|
1025
|
+
}).length === srv.length;
|
|
1031
1026
|
|
|
1032
1027
|
case 4:
|
|
1033
1028
|
case 5:
|
|
1034
|
-
return unvalidated && ["
|
|
1029
|
+
return unvalidated && ["IN_PROGRESS", "QF"].includes(product.status) && //"RF", "AF", "AA", "AP", "AC
|
|
1035
1030
|
srv.filter(function (serv) {
|
|
1036
1031
|
return statusArray.includes(serv.status);
|
|
1037
1032
|
}).length === srv.length;
|
|
1038
1033
|
|
|
1039
1034
|
case 6:
|
|
1040
|
-
return statusArray.includes(product.status) && //
|
|
1035
|
+
return statusArray.includes(product.status) && //RP, RC, AF, RA true
|
|
1041
1036
|
srv.every(function (serv) {
|
|
1042
|
-
return ["RA", "AA", "AP", "
|
|
1037
|
+
return ["RA", "AA", "AP", "AC"].includes(serv.status);
|
|
1043
1038
|
}) && auditorUnvalidated;
|
|
1044
1039
|
|
|
1045
1040
|
default:
|
|
@@ -1061,16 +1056,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1061
1056
|
};
|
|
1062
1057
|
|
|
1063
1058
|
var approveRejectButtons = function approveRejectButtons(action) {
|
|
1064
|
-
var _servicesData$find, _servicesData$find$st;
|
|
1065
|
-
|
|
1066
1059
|
var concept = getConcept(action || activeTab);
|
|
1067
|
-
|
|
1060
|
+
|
|
1061
|
+
var _servicesData$filter = servicesData.filter(function (srv) {
|
|
1068
1062
|
return srv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && srv.service === concept;
|
|
1069
|
-
})
|
|
1063
|
+
}),
|
|
1064
|
+
_servicesData$filter2 = (0, _slicedToArray2.default)(_servicesData$filter, 1),
|
|
1065
|
+
retailerStatus = _servicesData$filter2[0];
|
|
1070
1066
|
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
|
|
1067
|
+
return (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "QF" && (user.id_role === 1 || user.id_role === 4 || user.id_role === 5) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "AF" && ( //sessionStorage product
|
|
1068
|
+
user.id_role === 1 || user.id_role === 6) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "RP" && (user.id_role === 1 || user.id_role === 6) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "RC" && (user.id_role === 1 || user.id_role === 6);
|
|
1074
1069
|
};
|
|
1075
1070
|
|
|
1076
1071
|
var getSectionIcon = function getSectionIcon() {
|
|
@@ -1094,8 +1089,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1094
1089
|
|
|
1095
1090
|
var sendToFacilitator = /*#__PURE__*/function () {
|
|
1096
1091
|
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
|
|
1097
|
-
var concept, productTemp, evalStatus,
|
|
1098
|
-
|
|
1092
|
+
var concept, productTemp, evalStatus, data, specialistDone, statusArr, newStatus;
|
|
1099
1093
|
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1100
1094
|
while (1) {
|
|
1101
1095
|
switch (_context9.prev = _context9.next) {
|
|
@@ -1104,92 +1098,112 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1104
1098
|
_context9.prev = 1;
|
|
1105
1099
|
concept = getConcept(activeTab);
|
|
1106
1100
|
productTemp = (0, _objectSpread2.default)({}, product);
|
|
1107
|
-
evalStatus =
|
|
1108
|
-
|
|
1109
|
-
orderId = product.orderId;
|
|
1110
|
-
data = {
|
|
1111
|
-
articleId: _articleId,
|
|
1112
|
-
orderId: orderId,
|
|
1113
|
-
concept: concept,
|
|
1114
|
-
evalStatus: evalStatus,
|
|
1115
|
-
retailerId: activeRetailer.id
|
|
1116
|
-
};
|
|
1101
|
+
evalStatus = product["".concat(concept, "_status")];
|
|
1102
|
+
data = {};
|
|
1117
1103
|
|
|
1118
1104
|
if (!result) {
|
|
1119
|
-
_context9.next =
|
|
1105
|
+
_context9.next = 13;
|
|
1120
1106
|
break;
|
|
1121
1107
|
}
|
|
1122
1108
|
|
|
1123
|
-
data
|
|
1124
|
-
|
|
1109
|
+
data = {
|
|
1110
|
+
articleId: product.article.id_article,
|
|
1111
|
+
orderId: product.orderId,
|
|
1112
|
+
concept: concept,
|
|
1113
|
+
result: result,
|
|
1114
|
+
evalStatus: evalStatus,
|
|
1115
|
+
retailerId: activeRetailer.id
|
|
1116
|
+
};
|
|
1117
|
+
_context9.next = 10;
|
|
1125
1118
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1126
1119
|
headers: {
|
|
1127
1120
|
Authorization: token
|
|
1128
1121
|
}
|
|
1129
1122
|
});
|
|
1130
1123
|
|
|
1131
|
-
case
|
|
1132
|
-
res = _context9.sent;
|
|
1124
|
+
case 10:
|
|
1133
1125
|
getServices();
|
|
1134
|
-
_context9.next =
|
|
1126
|
+
_context9.next = 31;
|
|
1135
1127
|
break;
|
|
1136
1128
|
|
|
1137
|
-
case
|
|
1138
|
-
specialistDone =
|
|
1129
|
+
case 13:
|
|
1130
|
+
specialistDone = evalStatus === "RF" || evalStatus === "RA" || evalStatus === "IN_PROGRESS";
|
|
1139
1131
|
|
|
1140
1132
|
if (specialistDone) {
|
|
1141
|
-
|
|
1133
|
+
setMessage("".concat(activeTab, " enviada a facilitador"));
|
|
1142
1134
|
getSectionIcon();
|
|
1143
|
-
} else if (
|
|
1144
|
-
|
|
1135
|
+
} else if (evalStatus === "QF") {
|
|
1136
|
+
setMessage("Evaluación enviada");
|
|
1137
|
+
getSectionIcon();
|
|
1138
|
+
} else if (evalStatus === "AF") {
|
|
1139
|
+
setMessage("Evaluación enviada");
|
|
1140
|
+
getSectionIcon();
|
|
1141
|
+
} else if (evalStatus === "RP") {
|
|
1142
|
+
setMessage("Evaluación enviada");
|
|
1143
|
+
getSectionIcon();
|
|
1144
|
+
} else if (evalStatus === "RC") {
|
|
1145
|
+
setMessage("Evaluación enviada");
|
|
1145
1146
|
getSectionIcon();
|
|
1146
1147
|
}
|
|
1147
1148
|
|
|
1148
|
-
|
|
1149
|
+
statusArr = [];
|
|
1150
|
+
servicesData.forEach(function (srv) {
|
|
1151
|
+
srv.service === concept && statusArr.push(srv.status);
|
|
1152
|
+
});
|
|
1153
|
+
productTemp["".concat(concept, "_status")] = (0, _data2.getNewStatus)(statusArr);
|
|
1154
|
+
newStatus = (0, _data2.getNewStatus)([productTemp.datasheet_status, productTemp.description_status, productTemp.images_status]);
|
|
1155
|
+
productTemp.status = newStatus;
|
|
1156
|
+
data = {
|
|
1157
|
+
articleId: product.article.id_article,
|
|
1158
|
+
orderId: product.orderId,
|
|
1159
|
+
concept: concept,
|
|
1160
|
+
evalStatus: evalStatus,
|
|
1161
|
+
retailerId: activeRetailer.id
|
|
1162
|
+
};
|
|
1163
|
+
_context9.t0 = user.id_role;
|
|
1164
|
+
_context9.next = _context9.t0 === 7 ? 24 : _context9.t0 === 8 ? 24 : _context9.t0 === 4 ? 26 : _context9.t0 === 5 ? 26 : 28;
|
|
1165
|
+
break;
|
|
1166
|
+
|
|
1167
|
+
case 24:
|
|
1168
|
+
data.especialist = true;
|
|
1169
|
+
return _context9.abrupt("break", 29);
|
|
1170
|
+
|
|
1171
|
+
case 26:
|
|
1172
|
+
data.facilitator = true;
|
|
1173
|
+
return _context9.abrupt("break", 29);
|
|
1174
|
+
|
|
1175
|
+
case 28:
|
|
1176
|
+
return _context9.abrupt("break", 29);
|
|
1177
|
+
|
|
1178
|
+
case 29:
|
|
1179
|
+
_context9.next = 31;
|
|
1149
1180
|
return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1150
1181
|
headers: {
|
|
1151
1182
|
Authorization: token
|
|
1152
1183
|
}
|
|
1153
1184
|
});
|
|
1154
1185
|
|
|
1155
|
-
case
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
case 21:
|
|
1159
|
-
if (!(res.data.statusCode === 200)) {
|
|
1160
|
-
_context9.next = 30;
|
|
1161
|
-
break;
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
_JSON$parse5 = JSON.parse(res.data.body), newStatus = _JSON$parse5.newStatus, newOrderStatus = _JSON$parse5.newOrderStatus;
|
|
1165
|
-
if (newOrderStatus) productTemp.status = newOrderStatus[orderId];
|
|
1166
|
-
productTemp["".concat(concept, "_status")] = newStatus;
|
|
1167
|
-
_context9.next = 27;
|
|
1168
|
-
return loadData();
|
|
1169
|
-
|
|
1170
|
-
case 27:
|
|
1171
|
-
if (_message) setMessage(_message);
|
|
1186
|
+
case 31:
|
|
1187
|
+
loadData();
|
|
1172
1188
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1173
1189
|
setProduct(productTemp);
|
|
1174
|
-
|
|
1175
|
-
case 30:
|
|
1176
|
-
_context9.next = 35;
|
|
1190
|
+
_context9.next = 39;
|
|
1177
1191
|
break;
|
|
1178
1192
|
|
|
1179
|
-
case
|
|
1180
|
-
_context9.prev =
|
|
1181
|
-
_context9.
|
|
1182
|
-
console.log(_context9.
|
|
1193
|
+
case 36:
|
|
1194
|
+
_context9.prev = 36;
|
|
1195
|
+
_context9.t1 = _context9["catch"](1);
|
|
1196
|
+
console.log(_context9.t1);
|
|
1183
1197
|
|
|
1184
|
-
case
|
|
1198
|
+
case 39:
|
|
1185
1199
|
setLoading(false);
|
|
1186
1200
|
|
|
1187
|
-
case
|
|
1201
|
+
case 40:
|
|
1188
1202
|
case "end":
|
|
1189
1203
|
return _context9.stop();
|
|
1190
1204
|
}
|
|
1191
1205
|
}
|
|
1192
|
-
}, _callee9, null, [[1,
|
|
1206
|
+
}, _callee9, null, [[1, 36]]);
|
|
1193
1207
|
}));
|
|
1194
1208
|
|
|
1195
1209
|
return function sendToFacilitator(_x) {
|
|
@@ -1296,11 +1310,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1296
1310
|
var dsInputsRequired = [];
|
|
1297
1311
|
var desInputsRequired = 0;
|
|
1298
1312
|
datasheetServicesArray === null || datasheetServicesArray === void 0 ? void 0 : datasheetServicesArray.forEach(function (datasheet) {
|
|
1299
|
-
var _servicesData$
|
|
1313
|
+
var _servicesData$filter3 = servicesData === null || servicesData === void 0 ? void 0 : servicesData.filter(function (srv) {
|
|
1300
1314
|
return srv.id_retailer === datasheet.retailer.id && srv.service === getConcept(activeTab);
|
|
1301
1315
|
}),
|
|
1302
|
-
_servicesData$
|
|
1303
|
-
requested = _servicesData$
|
|
1316
|
+
_servicesData$filter4 = (0, _slicedToArray2.default)(_servicesData$filter3, 1),
|
|
1317
|
+
requested = _servicesData$filter4[0];
|
|
1304
1318
|
|
|
1305
1319
|
requested && (datasheet === null || datasheet === void 0 ? void 0 : datasheet.data) && Object.values(datasheet === null || datasheet === void 0 ? void 0 : datasheet.data).forEach(function (dataGroup) {
|
|
1306
1320
|
return dsInputsRequired.push.apply(dsInputsRequired, (0, _toConsumableArray2.default)(dataGroup.inputs.filter(function (input) {
|
|
@@ -1309,23 +1323,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1309
1323
|
});
|
|
1310
1324
|
});
|
|
1311
1325
|
objetcTemp["Ficha técnica"] = dsInputsRequired.length;
|
|
1312
|
-
var regex = /(<\/?p>)|(<\/?strong>)|(<br>)/gm;
|
|
1313
1326
|
descriptionsServicesArray.forEach(function (description) {
|
|
1314
|
-
var _servicesData$
|
|
1327
|
+
var _servicesData$filter5 = servicesData.filter(function (srv) {
|
|
1315
1328
|
return srv.id_retailer === description.id && srv.service === getConcept(activeTab);
|
|
1316
1329
|
}),
|
|
1317
|
-
_servicesData$
|
|
1318
|
-
requested = _servicesData$
|
|
1330
|
+
_servicesData$filter6 = (0, _slicedToArray2.default)(_servicesData$filter5, 1),
|
|
1331
|
+
requested = _servicesData$filter6[0];
|
|
1319
1332
|
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
if (input.required && (!input.value || ((_input$value = input.value) === null || _input$value === void 0 ? void 0 : _input$value.replace(regex, "")) === "")) {
|
|
1325
|
-
desInputsRequired++;
|
|
1326
|
-
}
|
|
1327
|
-
});
|
|
1328
|
-
}
|
|
1333
|
+
requested && description.inputs.forEach(function (input) {
|
|
1334
|
+
return input.required && (!input.value || input.value.replace(/(<\/?p>)|(<\/?strong>)|(<br>)/gm, "") === "") && desInputsRequired++;
|
|
1335
|
+
});
|
|
1329
1336
|
});
|
|
1330
1337
|
objetcTemp["Descripción"] = desInputsRequired;
|
|
1331
1338
|
var retailersRequested = [];
|
|
@@ -1422,16 +1429,14 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1422
1429
|
case 10:
|
|
1423
1430
|
productTemp = product;
|
|
1424
1431
|
productTemp.article["id_".concat(concept, "_").concat(assignationType)] = assignationId;
|
|
1425
|
-
data = {
|
|
1432
|
+
data = (0, _defineProperty2.default)({
|
|
1426
1433
|
articleList: [{
|
|
1427
1434
|
orderId: product.orderId,
|
|
1428
1435
|
articleId: product === null || product === void 0 ? void 0 : (_product$article13 = product.article) === null || _product$article13 === void 0 ? void 0 : _product$article13.id_article
|
|
1429
1436
|
}],
|
|
1430
|
-
concept: concept
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
_context12.next = 15;
|
|
1434
|
-
return (0, _axios.default)({
|
|
1437
|
+
concept: concept
|
|
1438
|
+
}, "".concat(assignationType, "Id"), assignationId);
|
|
1439
|
+
(0, _axios.default)({
|
|
1435
1440
|
method: "post",
|
|
1436
1441
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
1437
1442
|
data: data,
|
|
@@ -1439,12 +1444,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1439
1444
|
Authorization: token
|
|
1440
1445
|
}
|
|
1441
1446
|
});
|
|
1442
|
-
|
|
1443
|
-
case 15:
|
|
1444
1447
|
loadAssignations(productTemp);
|
|
1445
1448
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1446
1449
|
|
|
1447
|
-
case
|
|
1450
|
+
case 16:
|
|
1448
1451
|
case "end":
|
|
1449
1452
|
return _context12.stop();
|
|
1450
1453
|
}
|
|
@@ -1623,24 +1626,21 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1623
1626
|
productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result, "A");
|
|
1624
1627
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1625
1628
|
setProduct(productTemp);
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
case 20:
|
|
1630
|
-
_context13.next = 25;
|
|
1629
|
+
loadData();
|
|
1630
|
+
_context13.next = 24;
|
|
1631
1631
|
break;
|
|
1632
1632
|
|
|
1633
|
-
case
|
|
1634
|
-
_context13.prev =
|
|
1633
|
+
case 21:
|
|
1634
|
+
_context13.prev = 21;
|
|
1635
1635
|
_context13.t0 = _context13["catch"](0);
|
|
1636
1636
|
console.log(_context13.t0);
|
|
1637
1637
|
|
|
1638
|
-
case
|
|
1638
|
+
case 24:
|
|
1639
1639
|
case "end":
|
|
1640
1640
|
return _context13.stop();
|
|
1641
1641
|
}
|
|
1642
1642
|
}
|
|
1643
|
-
}, _callee13, null, [[0,
|
|
1643
|
+
}, _callee13, null, [[0, 21]]);
|
|
1644
1644
|
}));
|
|
1645
1645
|
|
|
1646
1646
|
return function validateAll(_x7) {
|
|
@@ -1713,7 +1713,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1713
1713
|
})]);
|
|
1714
1714
|
},
|
|
1715
1715
|
showApproveRejectAll: isAuditor && servicesData.every(function (serv) {
|
|
1716
|
-
return ["RA", "AA", "AP", "
|
|
1716
|
+
return ["RA", "AA", "AP", "AC", "AF"].includes(serv.status);
|
|
1717
1717
|
}) && approveRejectButtons() && (auditorAssigned() || userAssigned()),
|
|
1718
1718
|
showValidationButtons: approveRejectButtons() && (auditorAssigned() || userAssigned()),
|
|
1719
1719
|
approveAll: function approveAll() {
|
|
@@ -1743,6 +1743,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1743
1743
|
})]);
|
|
1744
1744
|
}
|
|
1745
1745
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
|
|
1746
|
+
canAssign: ![7, 8].includes(user.id_role),
|
|
1746
1747
|
tabsSections: tabsSections,
|
|
1747
1748
|
status: retailerStatus,
|
|
1748
1749
|
activeTab: activeTab,
|
|
@@ -1754,6 +1755,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1754
1755
|
setAssignation: setAssignation,
|
|
1755
1756
|
isRetailer: isRetailer,
|
|
1756
1757
|
showSaveButton: auditorAssigned() || userAssigned(),
|
|
1758
|
+
version: version,
|
|
1759
|
+
setShowVersionSelector: setShowVersionSelector,
|
|
1757
1760
|
onClickSave: function onClickSave() {
|
|
1758
1761
|
switch (activeTab) {
|
|
1759
1762
|
case "Descripción":
|
|
@@ -1861,7 +1864,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1861
1864
|
}, _callee14);
|
|
1862
1865
|
}))
|
|
1863
1866
|
})]
|
|
1864
|
-
}),
|
|
1867
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1865
1868
|
buttonType: evaluationFinished(user.id_role, activeTab, statusArray) && requiredNull[activeTab] === 0 ? "general-green-button" : "general-button-disabled",
|
|
1866
1869
|
label: "Enviar evaluación",
|
|
1867
1870
|
onClick: function onClick() {
|
|
@@ -1888,6 +1891,17 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1888
1891
|
onClick: function onClick() {
|
|
1889
1892
|
return setMessage("");
|
|
1890
1893
|
}
|
|
1894
|
+
}), showVersionSelector && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VersionSelector.VersionSelector, {
|
|
1895
|
+
modalId: "version-selector",
|
|
1896
|
+
articleId: product.article.id_article,
|
|
1897
|
+
setVersion: setVersion,
|
|
1898
|
+
companyName: product.article.company_name,
|
|
1899
|
+
currentVersion: version,
|
|
1900
|
+
setShowCreateVersion: setShowCreateVersion
|
|
1901
|
+
}), showCreateVersion && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CreateVersion.CreateVersion, {
|
|
1902
|
+
idArticle: product.article.id_article,
|
|
1903
|
+
version: version,
|
|
1904
|
+
setShowCreateVersion: setShowCreateVersion
|
|
1891
1905
|
})]
|
|
1892
1906
|
});
|
|
1893
1907
|
};
|