contentoh-components-library 21.1.59 → 21.1.62
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/GeneralInput/index.js +0 -1
- package/dist/components/atoms/InputFormatter/index.js +3 -3
- package/dist/components/molecules/HeaderTop/index.js +4 -1
- package/dist/components/molecules/RetailerSelector/index.js +31 -0
- package/dist/components/molecules/StatusAsignationInfo/index.js +3 -2
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -1
- package/dist/components/organisms/FullTabsMenu/index.js +3 -1
- package/dist/components/organisms/ImageDataTable/index.js +3 -6
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +115 -65
- package/dist/components/pages/ProviderProductEdition/index.js +333 -382
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +63 -110
- package/dist/components/pages/RetailerProductEdition/index.js +217 -225
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/global-files/data.js +9 -10
- package/dist/index.js +13 -0
- package/package.json +1 -1
- package/src/components/atoms/GeneralInput/index.js +0 -1
- package/src/components/atoms/InputFormatter/index.js +6 -3
- package/src/components/molecules/HeaderTop/index.js +6 -1
- package/src/components/molecules/RetailerSelector/index.js +12 -0
- package/src/components/molecules/StatusAsignationInfo/index.js +3 -2
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/organisms/FullTabsMenu/index.js +2 -0
- package/src/components/organisms/ImageDataTable/index.js +2 -5
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +133 -71
- package/src/components/pages/ProviderProductEdition/index.js +208 -222
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +59 -111
- package/src/components/pages/RetailerProductEdition/index.js +173 -148
- package/src/components/pages/RetailerProductEdition/styles.js +1 -1
- package/src/global-files/data.js +9 -10
- package/src/index.js +1 -0
- package/src/components/atoms/StatusTag/StatusTag.stories.js +0 -28
|
@@ -39,7 +39,7 @@ var _GalleryElement = require("../../molecules/GalleryElement");
|
|
|
39
39
|
|
|
40
40
|
var _fileSaver = require("file-saver");
|
|
41
41
|
|
|
42
|
-
var
|
|
42
|
+
var _data2 = require("../../../global-files/data");
|
|
43
43
|
|
|
44
44
|
var _GalleryHeader = require("../../molecules/GalleryHeader");
|
|
45
45
|
|
|
@@ -406,7 +406,6 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
406
406
|
statusArray = _useState64[0],
|
|
407
407
|
setStatusArray = _useState64[1];
|
|
408
408
|
|
|
409
|
-
console.log(retailerStatus, "retailerStatus");
|
|
410
409
|
var originProp = location === null || location === void 0 ? void 0 : (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.origin;
|
|
411
410
|
|
|
412
411
|
var _useState65 = (0, _react.useState)({
|
|
@@ -474,11 +473,6 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
474
473
|
saving = _useState82[0],
|
|
475
474
|
setSaving = _useState82[1];
|
|
476
475
|
|
|
477
|
-
var _useState83 = (0, _react.useState)(product.statusByRetailer),
|
|
478
|
-
_useState84 = (0, _slicedToArray2.default)(_useState83, 2),
|
|
479
|
-
retailerStatus = _useState84[0],
|
|
480
|
-
setRetailerStatus = _useState84[1];
|
|
481
|
-
|
|
482
476
|
(0, _react.useEffect)(function () {
|
|
483
477
|
checkAll && setSelectedImages(images.values);
|
|
484
478
|
}, [checkAll]);
|
|
@@ -493,7 +487,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
493
487
|
switch (_context2.prev = _context2.next) {
|
|
494
488
|
case 0:
|
|
495
489
|
_context2.next = 2;
|
|
496
|
-
return (0,
|
|
490
|
+
return (0, _data2.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)), product === null || product === void 0 ? void 0 : product.version);
|
|
497
491
|
|
|
498
492
|
case 2:
|
|
499
493
|
services = _context2.sent;
|
|
@@ -503,7 +497,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
503
497
|
|
|
504
498
|
if (!originProp) {
|
|
505
499
|
setActiveRetailer(product !== null && product !== void 0 && product.retailers ? product === null || product === void 0 ? void 0 : product.retailers[0] : product === null || product === void 0 ? void 0 : product.retailersAvailable[0]);
|
|
506
|
-
} //
|
|
500
|
+
} //setActiveRetailer(product?.retailers[0]);
|
|
507
501
|
|
|
508
502
|
|
|
509
503
|
setImages({
|
|
@@ -511,7 +505,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
511
505
|
init: services[2]
|
|
512
506
|
});
|
|
513
507
|
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);
|
|
514
|
-
(0,
|
|
508
|
+
(0, _data2.getPercentage)({
|
|
515
509
|
data: [product]
|
|
516
510
|
}).then(function (res) {
|
|
517
511
|
return setPercentages(res);
|
|
@@ -535,7 +529,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
535
529
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
536
530
|
var _product$article4;
|
|
537
531
|
|
|
538
|
-
var productInOrder, idArticle, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse,
|
|
532
|
+
var productInOrder, idArticle, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse, retailers, active;
|
|
539
533
|
|
|
540
534
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
541
535
|
while (1) {
|
|
@@ -545,7 +539,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
545
539
|
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);
|
|
546
540
|
|
|
547
541
|
if (!(isRevision() || productInOrder)) {
|
|
548
|
-
_context3.next =
|
|
542
|
+
_context3.next = 11;
|
|
549
543
|
break;
|
|
550
544
|
}
|
|
551
545
|
|
|
@@ -555,17 +549,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
555
549
|
case 5:
|
|
556
550
|
servicesResponse = _context3.sent;
|
|
557
551
|
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;
|
|
558
|
-
retailerResponse = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
|
|
559
|
-
return srv.id_retailer;
|
|
560
|
-
});
|
|
561
552
|
retailers = product.retailers || product.retailersAvailable;
|
|
562
|
-
active = retailers === null || retailers === void 0 ? void 0 : retailers.
|
|
563
|
-
return
|
|
564
|
-
|
|
553
|
+
active = retailers === null || retailers === void 0 ? void 0 : retailers.filter(function (retailer) {
|
|
554
|
+
return parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
|
|
555
|
+
return srv.id_retailer;
|
|
556
|
+
}).includes(retailer.id);
|
|
557
|
+
})[0];
|
|
565
558
|
!activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
|
|
566
559
|
setServicesData(parsedResponse);
|
|
567
560
|
|
|
568
|
-
case
|
|
561
|
+
case 11:
|
|
569
562
|
case "end":
|
|
570
563
|
return _context3.stop();
|
|
571
564
|
}
|
|
@@ -593,10 +586,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
593
586
|
if (_revision && currentService === "AP") return true;
|
|
594
587
|
} else {
|
|
595
588
|
var _product = productEdit.product;
|
|
596
|
-
|
|
597
|
-
var isRequestWithContentoh = orgn === "RequestWithContentoh" && currentService === "AA";
|
|
598
|
-
var isContentoh = orgn === "Contentoh" && currentService === "AA";
|
|
599
|
-
if (isContentoh || isRequestWithoutContentoh || isRequestWithContentoh) return true;
|
|
589
|
+
if (orgn === "Contentoh" || ["RECEIVED", "IN_PROGRESS"].includes(currentService) && orgn === "RequestWithoutContentoh" || currentService === "AA" && orgn === "RequestWithContentoh" || currentService === "RC" && orgn === "RequestWithoutContentoh" && (!_product.id_order || !_product.orderId)) return true;
|
|
600
590
|
}
|
|
601
591
|
}
|
|
602
592
|
|
|
@@ -639,36 +629,53 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
639
629
|
};
|
|
640
630
|
}();
|
|
641
631
|
|
|
642
|
-
(0, _react.useEffect)(function () {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
632
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
633
|
+
var arr;
|
|
634
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
635
|
+
while (1) {
|
|
636
|
+
switch (_context5.prev = _context5.next) {
|
|
637
|
+
case 0:
|
|
638
|
+
sessionStorage.setItem("user", JSON.stringify(user));
|
|
639
|
+
loadData();
|
|
640
|
+
getCart();
|
|
641
|
+
_context5.t0 = setUserGroups;
|
|
642
|
+
_context5.next = 6;
|
|
643
|
+
return (0, _data2.fetchUsers)(token);
|
|
644
|
+
|
|
645
|
+
case 6:
|
|
646
|
+
_context5.t1 = _context5.sent;
|
|
647
|
+
(0, _context5.t0)(_context5.t1);
|
|
648
|
+
arr = [];
|
|
649
|
+
_context5.t2 = user.id_role;
|
|
650
|
+
_context5.next = _context5.t2 === 7 ? 12 : _context5.t2 === 8 ? 12 : _context5.t2 === 4 ? 14 : _context5.t2 === 5 ? 14 : _context5.t2 === 6 ? 16 : 18;
|
|
651
|
+
break;
|
|
650
652
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
arr = ["CA", "RC", "RA"];
|
|
655
|
-
break;
|
|
653
|
+
case 12:
|
|
654
|
+
arr = ["IN_PROGRESS", "RF", "RA"];
|
|
655
|
+
return _context5.abrupt("break", 20);
|
|
656
656
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
break;
|
|
657
|
+
case 14:
|
|
658
|
+
arr = ["RF", "AF", "AA", "AP", "AC"];
|
|
659
|
+
return _context5.abrupt("break", 20);
|
|
661
660
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
661
|
+
case 16:
|
|
662
|
+
arr = ["RP", "RC", "AF"];
|
|
663
|
+
return _context5.abrupt("break", 20);
|
|
665
664
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
665
|
+
case 18:
|
|
666
|
+
arr = [];
|
|
667
|
+
return _context5.abrupt("break", 20);
|
|
668
|
+
|
|
669
|
+
case 20:
|
|
670
|
+
setStatusArray(arr);
|
|
669
671
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
+
case 21:
|
|
673
|
+
case "end":
|
|
674
|
+
return _context5.stop();
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
}, _callee5);
|
|
678
|
+
})), [product]);
|
|
672
679
|
|
|
673
680
|
var loadAssignations = function loadAssignations(currentProduct) {
|
|
674
681
|
setAssig(product === null || product === void 0 ? void 0 : product.asignations);
|
|
@@ -683,11 +690,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
683
690
|
var productTemp = product;
|
|
684
691
|
var retailers = (productTemp === null || productTemp === void 0 ? void 0 : productTemp.retailersAvailable) || (productTemp === null || productTemp === void 0 ? void 0 : productTemp.retailers);
|
|
685
692
|
retailers === null || retailers === void 0 ? void 0 : retailers.forEach(function (retailer) {
|
|
686
|
-
var _percentages$
|
|
693
|
+
var _percentages$filter$;
|
|
687
694
|
|
|
688
|
-
retailer["percentage"] = percentages === null || percentages === void 0 ? void 0 : (_percentages$
|
|
695
|
+
retailer["percentage"] = percentages === null || percentages === void 0 ? void 0 : (_percentages$filter$ = percentages.filter(function (percent) {
|
|
689
696
|
return (retailer === null || retailer === void 0 ? void 0 : retailer.id) === (percent === null || percent === void 0 ? void 0 : percent.id_retailer);
|
|
690
|
-
})) === null || _percentages$
|
|
697
|
+
})[0]) === null || _percentages$filter$ === void 0 ? void 0 : _percentages$filter$.percentage;
|
|
691
698
|
});
|
|
692
699
|
setProduct(productTemp);
|
|
693
700
|
setActivePercentage((_retailers$ = retailers[0]) === null || _retailers$ === void 0 ? void 0 : _retailers$.percentage);
|
|
@@ -766,12 +773,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
766
773
|
}, [images]);
|
|
767
774
|
|
|
768
775
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
769
|
-
var
|
|
770
|
-
var dataObject
|
|
771
|
-
|
|
772
|
-
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
776
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
777
|
+
var dataObject;
|
|
778
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
773
779
|
while (1) {
|
|
774
|
-
switch (
|
|
780
|
+
switch (_context6.prev = _context6.next) {
|
|
775
781
|
case 0:
|
|
776
782
|
setLoading(true);
|
|
777
783
|
dataObject = {
|
|
@@ -779,8 +785,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
779
785
|
articleData: updatedDescriptions
|
|
780
786
|
};
|
|
781
787
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
782
|
-
|
|
783
|
-
|
|
788
|
+
_context6.prev = 3;
|
|
789
|
+
_context6.next = 6;
|
|
784
790
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
785
791
|
headers: {
|
|
786
792
|
Authorization: token
|
|
@@ -788,45 +794,35 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
788
794
|
});
|
|
789
795
|
|
|
790
796
|
case 6:
|
|
791
|
-
_res = _context5.sent;
|
|
792
|
-
|
|
793
|
-
if (!(_res.data.statusCode === 200)) {
|
|
794
|
-
_context5.next = 11;
|
|
795
|
-
break;
|
|
796
|
-
}
|
|
797
|
-
|
|
798
797
|
setMessage("Descripciones guardadas con éxito");
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
case 11:
|
|
803
|
-
_context5.next = 16;
|
|
798
|
+
loadData();
|
|
799
|
+
_context6.next = 13;
|
|
804
800
|
break;
|
|
805
801
|
|
|
806
|
-
case
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
console.log(
|
|
802
|
+
case 10:
|
|
803
|
+
_context6.prev = 10;
|
|
804
|
+
_context6.t0 = _context6["catch"](3);
|
|
805
|
+
console.log(_context6.t0);
|
|
810
806
|
|
|
811
|
-
case
|
|
807
|
+
case 13:
|
|
812
808
|
case "end":
|
|
813
|
-
return
|
|
809
|
+
return _context6.stop();
|
|
814
810
|
}
|
|
815
811
|
}
|
|
816
|
-
},
|
|
812
|
+
}, _callee6, null, [[3, 10]]);
|
|
817
813
|
}));
|
|
818
814
|
|
|
819
815
|
return function saveDescriptions() {
|
|
820
|
-
return
|
|
816
|
+
return _ref7.apply(this, arguments);
|
|
821
817
|
};
|
|
822
818
|
}();
|
|
823
819
|
|
|
824
820
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
825
|
-
var
|
|
821
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
826
822
|
var dataObject;
|
|
827
|
-
return _regenerator.default.wrap(function
|
|
823
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
828
824
|
while (1) {
|
|
829
|
-
switch (
|
|
825
|
+
switch (_context7.prev = _context7.next) {
|
|
830
826
|
case 0:
|
|
831
827
|
setLoading(true);
|
|
832
828
|
dataObject = {
|
|
@@ -834,8 +830,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
834
830
|
articleData: updatedDatasheets
|
|
835
831
|
};
|
|
836
832
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
837
|
-
|
|
838
|
-
|
|
833
|
+
_context7.prev = 3;
|
|
834
|
+
_context7.next = 6;
|
|
839
835
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
840
836
|
headers: {
|
|
841
837
|
Authorization: token
|
|
@@ -843,45 +839,37 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
843
839
|
});
|
|
844
840
|
|
|
845
841
|
case 6:
|
|
846
|
-
if (!(res.data.statusCode === 200)) {
|
|
847
|
-
_context6.next = 10;
|
|
848
|
-
break;
|
|
849
|
-
}
|
|
850
|
-
|
|
851
842
|
setMessage("Fichas técnicas guardadas");
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
case 10:
|
|
856
|
-
_context6.next = 15;
|
|
843
|
+
loadData();
|
|
844
|
+
_context7.next = 13;
|
|
857
845
|
break;
|
|
858
846
|
|
|
859
|
-
case
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
console.log(
|
|
847
|
+
case 10:
|
|
848
|
+
_context7.prev = 10;
|
|
849
|
+
_context7.t0 = _context7["catch"](3);
|
|
850
|
+
console.log(_context7.t0);
|
|
863
851
|
|
|
864
|
-
case
|
|
852
|
+
case 13:
|
|
865
853
|
case "end":
|
|
866
|
-
return
|
|
854
|
+
return _context7.stop();
|
|
867
855
|
}
|
|
868
856
|
}
|
|
869
|
-
},
|
|
857
|
+
}, _callee7, null, [[3, 10]]);
|
|
870
858
|
}));
|
|
871
859
|
|
|
872
860
|
return function saveDatasheets() {
|
|
873
|
-
return
|
|
861
|
+
return _ref8.apply(this, arguments);
|
|
874
862
|
};
|
|
875
863
|
}();
|
|
876
864
|
|
|
877
|
-
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
865
|
+
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
878
866
|
var _images$values2, _data$articleData, _data$articleData2, _data$updateImages;
|
|
879
867
|
|
|
880
868
|
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
881
869
|
|
|
882
|
-
return _regenerator.default.wrap(function
|
|
870
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
883
871
|
while (1) {
|
|
884
|
-
switch (
|
|
872
|
+
switch (_context8.prev = _context8.next) {
|
|
885
873
|
case 0:
|
|
886
874
|
imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
|
|
887
875
|
imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
|
|
@@ -930,19 +918,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
930
918
|
}
|
|
931
919
|
|
|
932
920
|
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
933
|
-
|
|
921
|
+
_context8.next = 31;
|
|
934
922
|
break;
|
|
935
923
|
}
|
|
936
924
|
|
|
937
925
|
setLoading(true);
|
|
938
|
-
|
|
926
|
+
_context8.prev = 11;
|
|
939
927
|
data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
|
|
940
928
|
e.uuid = (0, _uuid.v4)();
|
|
941
929
|
});
|
|
942
930
|
setDataImages(data);
|
|
943
931
|
|
|
944
932
|
if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
|
|
945
|
-
|
|
933
|
+
_context8.next = 23;
|
|
946
934
|
break;
|
|
947
935
|
}
|
|
948
936
|
|
|
@@ -958,28 +946,28 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
958
946
|
};
|
|
959
947
|
promiseArray.push(myBucket.putObject(params).promise());
|
|
960
948
|
});
|
|
961
|
-
|
|
949
|
+
_context8.next = 20;
|
|
962
950
|
return Promise.all(promiseArray);
|
|
963
951
|
|
|
964
952
|
case 20:
|
|
965
953
|
setImagesUploaded(true);
|
|
966
|
-
|
|
954
|
+
_context8.next = 24;
|
|
967
955
|
break;
|
|
968
956
|
|
|
969
957
|
case 23:
|
|
970
958
|
setImagesUploaded(true);
|
|
971
959
|
|
|
972
960
|
case 24:
|
|
973
|
-
|
|
961
|
+
_context8.next = 29;
|
|
974
962
|
break;
|
|
975
963
|
|
|
976
964
|
case 26:
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
console.log(
|
|
965
|
+
_context8.prev = 26;
|
|
966
|
+
_context8.t0 = _context8["catch"](11);
|
|
967
|
+
console.log(_context8.t0); // setMainLoading(false);
|
|
980
968
|
|
|
981
969
|
case 29:
|
|
982
|
-
|
|
970
|
+
_context8.next = 32;
|
|
983
971
|
break;
|
|
984
972
|
|
|
985
973
|
case 31:
|
|
@@ -988,20 +976,18 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
988
976
|
|
|
989
977
|
case 32:
|
|
990
978
|
case "end":
|
|
991
|
-
return
|
|
979
|
+
return _context8.stop();
|
|
992
980
|
}
|
|
993
981
|
}
|
|
994
|
-
},
|
|
982
|
+
}, _callee8, null, [[11, 26]]);
|
|
995
983
|
})), [images, imagesUploaded]);
|
|
996
|
-
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
984
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
985
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1000
986
|
while (1) {
|
|
1001
|
-
switch (
|
|
987
|
+
switch (_context9.prev = _context9.next) {
|
|
1002
988
|
case 0:
|
|
1003
989
|
if (!imagesUploaded) {
|
|
1004
|
-
|
|
990
|
+
_context9.next = 13;
|
|
1005
991
|
break;
|
|
1006
992
|
}
|
|
1007
993
|
|
|
@@ -1013,8 +999,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1013
999
|
if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1014
1000
|
return e;
|
|
1015
1001
|
});
|
|
1016
|
-
|
|
1017
|
-
|
|
1002
|
+
_context9.prev = 2;
|
|
1003
|
+
_context9.next = 5;
|
|
1018
1004
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
|
|
1019
1005
|
headers: {
|
|
1020
1006
|
Authorization: token
|
|
@@ -1022,33 +1008,23 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1022
1008
|
});
|
|
1023
1009
|
|
|
1024
1010
|
case 5:
|
|
1025
|
-
_res2 = _context8.sent;
|
|
1026
|
-
|
|
1027
|
-
if (!(_res2.data.statusCode === 200)) {
|
|
1028
|
-
_context8.next = 11;
|
|
1029
|
-
break;
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
1011
|
setMessage("Imágenes guardadas con éxito");
|
|
1033
1012
|
sessionStorage.removeItem("imagesList");
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
case 11:
|
|
1038
|
-
_context8.next = 16;
|
|
1013
|
+
loadData();
|
|
1014
|
+
_context9.next = 13;
|
|
1039
1015
|
break;
|
|
1040
1016
|
|
|
1041
|
-
case
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
console.log(
|
|
1017
|
+
case 10:
|
|
1018
|
+
_context9.prev = 10;
|
|
1019
|
+
_context9.t0 = _context9["catch"](2);
|
|
1020
|
+
console.log(_context9.t0);
|
|
1045
1021
|
|
|
1046
|
-
case
|
|
1022
|
+
case 13:
|
|
1047
1023
|
case "end":
|
|
1048
|
-
return
|
|
1024
|
+
return _context9.stop();
|
|
1049
1025
|
}
|
|
1050
1026
|
}
|
|
1051
|
-
},
|
|
1027
|
+
}, _callee9, null, [[2, 10]]);
|
|
1052
1028
|
})), [dataImages, imagesUploaded]);
|
|
1053
1029
|
|
|
1054
1030
|
var getConcept = function getConcept(tab) {
|
|
@@ -1084,28 +1060,28 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1084
1060
|
};
|
|
1085
1061
|
|
|
1086
1062
|
var createComment = /*#__PURE__*/function () {
|
|
1087
|
-
var
|
|
1063
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(e, body, tab) {
|
|
1088
1064
|
var concept, data;
|
|
1089
|
-
return _regenerator.default.wrap(function
|
|
1065
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1090
1066
|
while (1) {
|
|
1091
|
-
switch (
|
|
1067
|
+
switch (_context10.prev = _context10.next) {
|
|
1092
1068
|
case 0:
|
|
1093
1069
|
concept = "";
|
|
1094
|
-
|
|
1095
|
-
|
|
1070
|
+
_context10.t0 = activeTab;
|
|
1071
|
+
_context10.next = _context10.t0 === "Ficha técnica" ? 4 : _context10.t0 === "Imágenes" ? 6 : 8;
|
|
1096
1072
|
break;
|
|
1097
1073
|
|
|
1098
1074
|
case 4:
|
|
1099
1075
|
concept = "datasheet";
|
|
1100
|
-
return
|
|
1076
|
+
return _context10.abrupt("break", 10);
|
|
1101
1077
|
|
|
1102
1078
|
case 6:
|
|
1103
1079
|
concept = "images";
|
|
1104
|
-
return
|
|
1080
|
+
return _context10.abrupt("break", 10);
|
|
1105
1081
|
|
|
1106
1082
|
case 8:
|
|
1107
1083
|
concept = "description";
|
|
1108
|
-
return
|
|
1084
|
+
return _context10.abrupt("break", 10);
|
|
1109
1085
|
|
|
1110
1086
|
case 10:
|
|
1111
1087
|
data = {
|
|
@@ -1115,7 +1091,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1115
1091
|
concept: concept,
|
|
1116
1092
|
version: version
|
|
1117
1093
|
};
|
|
1118
|
-
|
|
1094
|
+
_context10.next = 13;
|
|
1119
1095
|
return _axios.default.post("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1120
1096
|
headers: {
|
|
1121
1097
|
Authorization: token
|
|
@@ -1124,14 +1100,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1124
1100
|
|
|
1125
1101
|
case 13:
|
|
1126
1102
|
case "end":
|
|
1127
|
-
return
|
|
1103
|
+
return _context10.stop();
|
|
1128
1104
|
}
|
|
1129
1105
|
}
|
|
1130
|
-
},
|
|
1106
|
+
}, _callee10);
|
|
1131
1107
|
}));
|
|
1132
1108
|
|
|
1133
1109
|
return function createComment(_x2, _x3, _x4) {
|
|
1134
|
-
return
|
|
1110
|
+
return _ref11.apply(this, arguments);
|
|
1135
1111
|
};
|
|
1136
1112
|
}();
|
|
1137
1113
|
|
|
@@ -1140,16 +1116,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1140
1116
|
}, [activeTab]);
|
|
1141
1117
|
|
|
1142
1118
|
var commentRevised = /*#__PURE__*/function () {
|
|
1143
|
-
var
|
|
1119
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1144
1120
|
var data;
|
|
1145
|
-
return _regenerator.default.wrap(function
|
|
1121
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1146
1122
|
while (1) {
|
|
1147
|
-
switch (
|
|
1123
|
+
switch (_context11.prev = _context11.next) {
|
|
1148
1124
|
case 0:
|
|
1149
1125
|
data = {
|
|
1150
1126
|
commentId: comment.id
|
|
1151
1127
|
};
|
|
1152
|
-
|
|
1128
|
+
_context11.next = 3;
|
|
1153
1129
|
return _axios.default.put("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1154
1130
|
headers: {
|
|
1155
1131
|
Authorization: token
|
|
@@ -1161,54 +1137,52 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1161
1137
|
|
|
1162
1138
|
case 4:
|
|
1163
1139
|
case "end":
|
|
1164
|
-
return
|
|
1140
|
+
return _context11.stop();
|
|
1165
1141
|
}
|
|
1166
1142
|
}
|
|
1167
|
-
},
|
|
1143
|
+
}, _callee11);
|
|
1168
1144
|
}));
|
|
1169
1145
|
|
|
1170
1146
|
return function commentRevised() {
|
|
1171
|
-
return
|
|
1147
|
+
return _ref12.apply(this, arguments);
|
|
1172
1148
|
};
|
|
1173
1149
|
}();
|
|
1174
1150
|
|
|
1175
1151
|
var setAssignation = /*#__PURE__*/function () {
|
|
1176
|
-
var
|
|
1152
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(assignationType, assignationId) {
|
|
1177
1153
|
var concept, productTemp, data;
|
|
1178
|
-
return _regenerator.default.wrap(function
|
|
1154
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1179
1155
|
while (1) {
|
|
1180
|
-
switch (
|
|
1156
|
+
switch (_context12.prev = _context12.next) {
|
|
1181
1157
|
case 0:
|
|
1182
1158
|
concept = "";
|
|
1183
|
-
|
|
1184
|
-
|
|
1159
|
+
_context12.t0 = activeTab;
|
|
1160
|
+
_context12.next = _context12.t0 === "Ficha técnica" ? 4 : _context12.t0 === "Imágenes" ? 6 : 8;
|
|
1185
1161
|
break;
|
|
1186
1162
|
|
|
1187
1163
|
case 4:
|
|
1188
1164
|
concept = "datasheet";
|
|
1189
|
-
return
|
|
1165
|
+
return _context12.abrupt("break", 10);
|
|
1190
1166
|
|
|
1191
1167
|
case 6:
|
|
1192
1168
|
concept = "images";
|
|
1193
|
-
return
|
|
1169
|
+
return _context12.abrupt("break", 10);
|
|
1194
1170
|
|
|
1195
1171
|
case 8:
|
|
1196
1172
|
concept = "description";
|
|
1197
|
-
return
|
|
1173
|
+
return _context12.abrupt("break", 10);
|
|
1198
1174
|
|
|
1199
1175
|
case 10:
|
|
1200
1176
|
productTemp = product;
|
|
1201
1177
|
productTemp.article["id_".concat(concept, "_").concat(assignationType)] = assignationId;
|
|
1202
|
-
data = {
|
|
1178
|
+
data = (0, _defineProperty2.default)({
|
|
1203
1179
|
articleList: [{
|
|
1204
1180
|
orderId: product.orderId,
|
|
1205
1181
|
articleId: product === null || product === void 0 ? void 0 : product.id_article
|
|
1206
1182
|
}],
|
|
1207
|
-
concept: concept
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
_context11.next = 15;
|
|
1211
|
-
return (0, _axios.default)({
|
|
1183
|
+
concept: concept
|
|
1184
|
+
}, "".concat(assignationType, "Id"), assignationId);
|
|
1185
|
+
(0, _axios.default)({
|
|
1212
1186
|
method: "post",
|
|
1213
1187
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
1214
1188
|
data: data,
|
|
@@ -1216,21 +1190,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1216
1190
|
Authorization: token
|
|
1217
1191
|
}
|
|
1218
1192
|
});
|
|
1219
|
-
|
|
1220
|
-
case 15:
|
|
1221
1193
|
loadAssignations(productTemp);
|
|
1222
1194
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1223
1195
|
|
|
1224
|
-
case
|
|
1196
|
+
case 16:
|
|
1225
1197
|
case "end":
|
|
1226
|
-
return
|
|
1198
|
+
return _context12.stop();
|
|
1227
1199
|
}
|
|
1228
1200
|
}
|
|
1229
|
-
},
|
|
1201
|
+
}, _callee12);
|
|
1230
1202
|
}));
|
|
1231
1203
|
|
|
1232
1204
|
return function setAssignation(_x5, _x6) {
|
|
1233
|
-
return
|
|
1205
|
+
return _ref13.apply(this, arguments);
|
|
1234
1206
|
};
|
|
1235
1207
|
}();
|
|
1236
1208
|
|
|
@@ -1246,7 +1218,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1246
1218
|
});
|
|
1247
1219
|
}
|
|
1248
1220
|
|
|
1249
|
-
var statusArray = user.is_retailer === 1 ? ["
|
|
1221
|
+
var statusArray = user.is_retailer === 1 ? ["AC", "RC"] : ["AP", "RP", "AC"];
|
|
1250
1222
|
return serv.length > 0 && serv.every(function (item) {
|
|
1251
1223
|
return statusArray.includes(item.status);
|
|
1252
1224
|
});
|
|
@@ -1335,7 +1307,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1335
1307
|
var datasheet_status = product.datasheet_status,
|
|
1336
1308
|
description_status = product.description_status,
|
|
1337
1309
|
images_status = product.images_status;
|
|
1338
|
-
var completionStates = user.is_retailer === 1 ? ["
|
|
1310
|
+
var completionStates = user.is_retailer === 1 ? ["AC", "Evaluated", "NS"] : ["AP", "Evaluated", "NS"];
|
|
1339
1311
|
var dsEvaluated = completionStates.includes(datasheet_status);
|
|
1340
1312
|
var descsEvaluated = completionStates.includes(description_status);
|
|
1341
1313
|
var imgsEvaluated = completionStates.includes(images_status);
|
|
@@ -1344,131 +1316,107 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1344
1316
|
};
|
|
1345
1317
|
|
|
1346
1318
|
var sendEvaluation = /*#__PURE__*/function () {
|
|
1347
|
-
var
|
|
1348
|
-
var
|
|
1349
|
-
|
|
1350
|
-
var concept, productTemp, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, res, newStatuses, orderStatus, serviceStatus, newProductEdit, _JSON$parse, newArticleStatus, newServiceStatus, newStatus, retailerStatusCopy, status;
|
|
1319
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
|
|
1320
|
+
var data, retailerId, _product$id_order2, _product$id_order3, productTemp, concept;
|
|
1351
1321
|
|
|
1352
|
-
return _regenerator.default.wrap(function
|
|
1322
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1353
1323
|
while (1) {
|
|
1354
|
-
switch (
|
|
1324
|
+
switch (_context13.prev = _context13.next) {
|
|
1355
1325
|
case 0:
|
|
1356
1326
|
setLoading(true);
|
|
1357
|
-
|
|
1358
|
-
productTemp = product;
|
|
1359
|
-
articleId = productTemp.id_article;
|
|
1360
|
-
orderId = (_productTemp$id_order = productTemp.id_order) !== null && _productTemp$id_order !== void 0 ? _productTemp$id_order : productTemp.orderId;
|
|
1361
|
-
sectionStatusKey = "".concat(getConcept(activeTab), "_status");
|
|
1362
|
-
evalStatus = product[sectionStatusKey] || (product === null || product === void 0 ? void 0 : product.version_status);
|
|
1363
|
-
data = {
|
|
1364
|
-
articleId: articleId,
|
|
1365
|
-
orderId: orderId,
|
|
1366
|
-
concept: concept,
|
|
1367
|
-
evalStatus: evalStatus
|
|
1368
|
-
};
|
|
1327
|
+
data = {};
|
|
1369
1328
|
retailerId = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id;
|
|
1370
|
-
_context12.prev = 9;
|
|
1371
1329
|
|
|
1372
1330
|
if (!result) {
|
|
1373
|
-
|
|
1331
|
+
_context13.next = 9;
|
|
1374
1332
|
break;
|
|
1375
1333
|
}
|
|
1376
1334
|
|
|
1377
|
-
data
|
|
1378
|
-
|
|
1379
|
-
|
|
1335
|
+
data = {
|
|
1336
|
+
articleId: product.id_article,
|
|
1337
|
+
orderId: (_product$id_order2 = product.id_order) !== null && _product$id_order2 !== void 0 ? _product$id_order2 : product.orderId,
|
|
1338
|
+
concept: getConcept(activeTab),
|
|
1339
|
+
result: result,
|
|
1340
|
+
retailerId: retailerId
|
|
1341
|
+
};
|
|
1342
|
+
_context13.next = 7;
|
|
1380
1343
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1381
1344
|
headers: {
|
|
1382
1345
|
Authorization: token
|
|
1383
1346
|
}
|
|
1384
1347
|
});
|
|
1385
1348
|
|
|
1386
|
-
case
|
|
1387
|
-
|
|
1388
|
-
newStatuses = JSON.parse(res.data.body);
|
|
1389
|
-
orderStatus = newStatuses.newOrderStatus;
|
|
1390
|
-
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(getConcept(activeTab), "Status")];
|
|
1391
|
-
newProductEdit = productEdit;
|
|
1392
|
-
newProductEdit.product[sectionStatusKey] = serviceStatus;
|
|
1393
|
-
setProductEdit(newProductEdit);
|
|
1394
|
-
showSurvey && showSurvey(!user.is_retailer && orderStatus[orderId] === "AP");
|
|
1395
|
-
_context12.next = 28;
|
|
1349
|
+
case 7:
|
|
1350
|
+
_context13.next = 19;
|
|
1396
1351
|
break;
|
|
1397
1352
|
|
|
1398
|
-
case
|
|
1399
|
-
|
|
1400
|
-
|
|
1353
|
+
case 9:
|
|
1354
|
+
productTemp = product;
|
|
1355
|
+
concept = getConcept(activeTab);
|
|
1356
|
+
productTemp["".concat(concept, "_status")] = "Evaluated";
|
|
1357
|
+
data = {
|
|
1358
|
+
articleId: product.id_article,
|
|
1359
|
+
orderId: (_product$id_order3 = product.id_order) !== null && _product$id_order3 !== void 0 ? _product$id_order3 : product.orderId,
|
|
1360
|
+
concept: concept
|
|
1361
|
+
};
|
|
1362
|
+
|
|
1363
|
+
_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1401
1364
|
headers: {
|
|
1402
1365
|
Authorization: token
|
|
1403
1366
|
}
|
|
1404
1367
|
});
|
|
1405
1368
|
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
productTemp
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
setProduct(productTemp);
|
|
1424
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1425
|
-
setOrigin(function (prev) {
|
|
1426
|
-
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, concept, status));
|
|
1427
|
-
});
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
_context12.next = 34;
|
|
1431
|
-
break;
|
|
1432
|
-
|
|
1433
|
-
case 31:
|
|
1434
|
-
_context12.prev = 31;
|
|
1435
|
-
_context12.t0 = _context12["catch"](9);
|
|
1436
|
-
console.log(_context12.t0);
|
|
1369
|
+
setProduct(productTemp);
|
|
1370
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1371
|
+
setProductEdit({
|
|
1372
|
+
ArticleId: productTemp.id_article,
|
|
1373
|
+
idCategory: productTemp.article.id_category,
|
|
1374
|
+
product: productTemp
|
|
1375
|
+
});
|
|
1376
|
+
sessionStorage.setItem("productEdit", JSON.stringify({
|
|
1377
|
+
ArticleId: productTemp.id_article,
|
|
1378
|
+
idCategory: productTemp.article.id_category,
|
|
1379
|
+
product: productTemp
|
|
1380
|
+
}));
|
|
1381
|
+
setOrigin(function (prev) {
|
|
1382
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, concept, "Evaluated"));
|
|
1383
|
+
});
|
|
1437
1384
|
|
|
1438
|
-
case
|
|
1385
|
+
case 19:
|
|
1439
1386
|
loadData();
|
|
1387
|
+
showSurvey && showSurvey(confirmStatusComplete());
|
|
1440
1388
|
|
|
1441
|
-
case
|
|
1389
|
+
case 21:
|
|
1442
1390
|
case "end":
|
|
1443
|
-
return
|
|
1391
|
+
return _context13.stop();
|
|
1444
1392
|
}
|
|
1445
1393
|
}
|
|
1446
|
-
},
|
|
1394
|
+
}, _callee13);
|
|
1447
1395
|
}));
|
|
1448
1396
|
|
|
1449
1397
|
return function sendEvaluation(_x7) {
|
|
1450
|
-
return
|
|
1398
|
+
return _ref14.apply(this, arguments);
|
|
1451
1399
|
};
|
|
1452
1400
|
}();
|
|
1453
1401
|
|
|
1454
1402
|
var validateAll = /*#__PURE__*/function () {
|
|
1455
|
-
var
|
|
1456
|
-
var evaluationArray, sendAll, conceptArray, productTemp
|
|
1457
|
-
return _regenerator.default.wrap(function
|
|
1403
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(result) {
|
|
1404
|
+
var evaluationArray, sendAll, conceptArray, productTemp;
|
|
1405
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
1458
1406
|
while (1) {
|
|
1459
|
-
switch (
|
|
1407
|
+
switch (_context14.prev = _context14.next) {
|
|
1460
1408
|
case 0:
|
|
1461
|
-
|
|
1409
|
+
_context14.prev = 0;
|
|
1462
1410
|
setLoading(true);
|
|
1463
1411
|
evaluationArray = [];
|
|
1464
1412
|
sendAll = [];
|
|
1465
1413
|
conceptArray = ["description", "datasheet", "images"];
|
|
1466
1414
|
servicesData === null || servicesData === void 0 ? void 0 : servicesData.forEach(function (ret) {
|
|
1467
|
-
var _product$
|
|
1415
|
+
var _product$id_order4;
|
|
1468
1416
|
|
|
1469
1417
|
var data = {
|
|
1470
1418
|
articleId: product.id_article,
|
|
1471
|
-
orderId: (_product$
|
|
1419
|
+
orderId: (_product$id_order4 = product.id_order) !== null && _product$id_order4 !== void 0 ? _product$id_order4 : product.orderId,
|
|
1472
1420
|
concept: ret.service,
|
|
1473
1421
|
result: result,
|
|
1474
1422
|
retailerId: ret.id_retailer
|
|
@@ -1479,16 +1427,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1479
1427
|
}
|
|
1480
1428
|
}));
|
|
1481
1429
|
});
|
|
1482
|
-
|
|
1430
|
+
_context14.next = 8;
|
|
1483
1431
|
return Promise.all(evaluationArray);
|
|
1484
1432
|
|
|
1485
1433
|
case 8:
|
|
1486
1434
|
conceptArray === null || conceptArray === void 0 ? void 0 : conceptArray.forEach(function (concept) {
|
|
1487
|
-
var _product$
|
|
1435
|
+
var _product$id_order5;
|
|
1488
1436
|
|
|
1489
1437
|
var data = {
|
|
1490
1438
|
articleId: product.id_article,
|
|
1491
|
-
orderId: (_product$
|
|
1439
|
+
orderId: (_product$id_order5 = product.id_order) !== null && _product$id_order5 !== void 0 ? _product$id_order5 : product.orderId,
|
|
1492
1440
|
concept: concept
|
|
1493
1441
|
};
|
|
1494
1442
|
sendAll.push(_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
@@ -1497,25 +1445,15 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1497
1445
|
}
|
|
1498
1446
|
}));
|
|
1499
1447
|
});
|
|
1500
|
-
|
|
1448
|
+
_context14.next = 11;
|
|
1501
1449
|
return Promise.all(sendAll);
|
|
1502
1450
|
|
|
1503
1451
|
case 11:
|
|
1504
1452
|
productTemp = product;
|
|
1505
|
-
productTemp.article_status = "".concat(result, "
|
|
1506
|
-
productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : "".concat(result, "
|
|
1507
|
-
productTemp.description_status = productTemp.description_status === "NA" ? "NA" : "".concat(result, "
|
|
1508
|
-
productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result, "
|
|
1509
|
-
retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
|
|
1510
|
-
Object.keys(retailerStatusCopy).forEach(function (key) {
|
|
1511
|
-
conceptArray.forEach(function (concept) {
|
|
1512
|
-
if (retailerStatusCopy[key][concept]) {
|
|
1513
|
-
retailerStatusCopy[key][concept] = "".concat(result, "CA");
|
|
1514
|
-
}
|
|
1515
|
-
});
|
|
1516
|
-
});
|
|
1517
|
-
setRetailerStatus(retailerStatusCopy);
|
|
1518
|
-
productTemp.statusByRetailer = retailerStatusCopy;
|
|
1453
|
+
productTemp.article_status = "".concat(result, "C");
|
|
1454
|
+
productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : "".concat(result, "C");
|
|
1455
|
+
productTemp.description_status = productTemp.description_status === "NA" ? "NA" : "".concat(result, "C");
|
|
1456
|
+
productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result, "C");
|
|
1519
1457
|
setProduct(productTemp);
|
|
1520
1458
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1521
1459
|
setProductEdit({
|
|
@@ -1528,37 +1466,34 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1528
1466
|
idCategory: productTemp.article.id_category,
|
|
1529
1467
|
product: productTemp
|
|
1530
1468
|
}));
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
case 26:
|
|
1535
|
-
_context13.next = 31;
|
|
1469
|
+
loadData();
|
|
1470
|
+
_context14.next = 26;
|
|
1536
1471
|
break;
|
|
1537
1472
|
|
|
1538
|
-
case
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
console.log(
|
|
1473
|
+
case 23:
|
|
1474
|
+
_context14.prev = 23;
|
|
1475
|
+
_context14.t0 = _context14["catch"](0);
|
|
1476
|
+
console.log(_context14.t0);
|
|
1542
1477
|
|
|
1543
|
-
case
|
|
1478
|
+
case 26:
|
|
1544
1479
|
case "end":
|
|
1545
|
-
return
|
|
1480
|
+
return _context14.stop();
|
|
1546
1481
|
}
|
|
1547
1482
|
}
|
|
1548
|
-
},
|
|
1483
|
+
}, _callee14, null, [[0, 23]]);
|
|
1549
1484
|
}));
|
|
1550
1485
|
|
|
1551
1486
|
return function validateAll(_x8) {
|
|
1552
|
-
return
|
|
1487
|
+
return _ref15.apply(this, arguments);
|
|
1553
1488
|
};
|
|
1554
1489
|
}();
|
|
1555
1490
|
|
|
1556
1491
|
var evaluationToRetailer = /*#__PURE__*/function () {
|
|
1557
|
-
var
|
|
1492
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
|
|
1558
1493
|
var data, prod, statusComplete;
|
|
1559
|
-
return _regenerator.default.wrap(function
|
|
1494
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
1560
1495
|
while (1) {
|
|
1561
|
-
switch (
|
|
1496
|
+
switch (_context15.prev = _context15.next) {
|
|
1562
1497
|
case 0:
|
|
1563
1498
|
data = {
|
|
1564
1499
|
articleId: product.id_article,
|
|
@@ -1566,7 +1501,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1566
1501
|
versionId: product.version,
|
|
1567
1502
|
status: result
|
|
1568
1503
|
};
|
|
1569
|
-
|
|
1504
|
+
_context15.next = 3;
|
|
1570
1505
|
return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
|
|
1571
1506
|
headers: {
|
|
1572
1507
|
Authorization: token
|
|
@@ -1575,7 +1510,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1575
1510
|
|
|
1576
1511
|
case 3:
|
|
1577
1512
|
prod = productEdit;
|
|
1578
|
-
statusComplete = user.is_retailer ? "".concat(result, "
|
|
1513
|
+
statusComplete = user.is_retailer ? "".concat(result, "C") : "".concat(result, "P");
|
|
1579
1514
|
prod.product.datasheet_status = statusComplete;
|
|
1580
1515
|
prod.product.description_status = statusComplete;
|
|
1581
1516
|
prod.product.images_status = statusComplete;
|
|
@@ -1584,33 +1519,33 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1584
1519
|
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
1585
1520
|
setProduct(prod);
|
|
1586
1521
|
setShowGenericModal && setShowGenericModal(false);
|
|
1587
|
-
|
|
1588
|
-
return loadData();
|
|
1522
|
+
loadData();
|
|
1589
1523
|
|
|
1590
|
-
case
|
|
1524
|
+
case 14:
|
|
1591
1525
|
case "end":
|
|
1592
|
-
return
|
|
1526
|
+
return _context15.stop();
|
|
1593
1527
|
}
|
|
1594
1528
|
}
|
|
1595
|
-
},
|
|
1529
|
+
}, _callee15);
|
|
1596
1530
|
}));
|
|
1597
1531
|
|
|
1598
1532
|
return function evaluationToRetailer(_x9) {
|
|
1599
|
-
return
|
|
1533
|
+
return _ref16.apply(this, arguments);
|
|
1600
1534
|
};
|
|
1601
1535
|
}();
|
|
1602
1536
|
|
|
1603
1537
|
var getSectionStatus = function getSectionStatus() {
|
|
1604
1538
|
var concept = getConcept(activeTab);
|
|
1605
|
-
return ["AA", "AP", "
|
|
1539
|
+
return ["AA", "AP", "RECEIVED", "IN_PROGRESS", "RC"].includes(productEdit.product["".concat(concept, "_status")]);
|
|
1606
1540
|
};
|
|
1607
1541
|
|
|
1608
1542
|
var enableActions = function enableActions(versionStatus) {
|
|
1609
1543
|
try {
|
|
1610
|
-
|
|
1544
|
+
var userIsRetailer = user.is_retailer;
|
|
1545
|
+
if (userIsRetailer) return false;
|
|
1611
1546
|
|
|
1612
1547
|
if (versionStatus) {
|
|
1613
|
-
return ["AP", "
|
|
1548
|
+
return ["AP", "AC", "RC", null].includes(versionStatus);
|
|
1614
1549
|
}
|
|
1615
1550
|
|
|
1616
1551
|
return true;
|
|
@@ -1691,49 +1626,53 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1691
1626
|
});
|
|
1692
1627
|
});
|
|
1693
1628
|
setShowGenericModal(true);
|
|
1694
|
-
} else
|
|
1695
|
-
if (
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1629
|
+
} else {
|
|
1630
|
+
if (user.is_retailer) {
|
|
1631
|
+
if (product.id_order || product.orderId) {
|
|
1632
|
+
validateAll("A");
|
|
1633
|
+
} else {
|
|
1634
|
+
setDataGenericModal(function (prev) {
|
|
1635
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
1636
|
+
button2: {
|
|
1637
|
+
name: "Continuar",
|
|
1638
|
+
action: function action() {
|
|
1639
|
+
return evaluationToRetailer("A");
|
|
1640
|
+
}
|
|
1704
1641
|
}
|
|
1705
|
-
}
|
|
1642
|
+
});
|
|
1706
1643
|
});
|
|
1707
|
-
|
|
1708
|
-
|
|
1644
|
+
setShowGenericModal(true);
|
|
1645
|
+
}
|
|
1646
|
+
} else {
|
|
1647
|
+
validateAll("A");
|
|
1709
1648
|
}
|
|
1710
|
-
} else {
|
|
1711
|
-
validateAll("A");
|
|
1712
1649
|
}
|
|
1713
1650
|
},
|
|
1714
1651
|
rejectAll: function rejectAll() {
|
|
1715
1652
|
if (originProp === "RequestWithoutContentoh" && !user.is_retailer && (!product.id_order || !product.orderId)) {
|
|
1716
1653
|
return;
|
|
1717
|
-
} else
|
|
1718
|
-
if (
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1654
|
+
} else {
|
|
1655
|
+
if (user.is_retailer) {
|
|
1656
|
+
if (product.id_order || product.orderId) {
|
|
1657
|
+
validateAll("R");
|
|
1658
|
+
setModalViewError(true);
|
|
1659
|
+
} else {
|
|
1660
|
+
setDataGenericModal(function (prev) {
|
|
1661
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
1662
|
+
button2: {
|
|
1663
|
+
name: "Continuar",
|
|
1664
|
+
action: function action() {
|
|
1665
|
+
return evaluationToRetailer("R");
|
|
1666
|
+
}
|
|
1728
1667
|
}
|
|
1729
|
-
}
|
|
1668
|
+
});
|
|
1730
1669
|
});
|
|
1731
|
-
|
|
1732
|
-
|
|
1670
|
+
setShowGenericModal(true);
|
|
1671
|
+
}
|
|
1672
|
+
} else {
|
|
1673
|
+
validateAll("R");
|
|
1674
|
+
setModalViewError(true);
|
|
1733
1675
|
}
|
|
1734
|
-
} else {
|
|
1735
|
-
validateAll("R");
|
|
1736
|
-
setModalViewError(true);
|
|
1737
1676
|
}
|
|
1738
1677
|
},
|
|
1739
1678
|
approve: function approve() {
|
|
@@ -1749,54 +1688,58 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1749
1688
|
});
|
|
1750
1689
|
});
|
|
1751
1690
|
setShowGenericModal(true);
|
|
1752
|
-
} else
|
|
1753
|
-
if (
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1691
|
+
} else {
|
|
1692
|
+
if (user.is_retailer) {
|
|
1693
|
+
if (product.id_order || product.orderId) {
|
|
1694
|
+
sendEvaluation("A");
|
|
1695
|
+
} else {
|
|
1696
|
+
setDataGenericModal(function (prev) {
|
|
1697
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
1698
|
+
button2: {
|
|
1699
|
+
name: "Continuar",
|
|
1700
|
+
action: function action() {
|
|
1701
|
+
return evaluationToRetailer("A");
|
|
1702
|
+
}
|
|
1762
1703
|
}
|
|
1763
|
-
}
|
|
1704
|
+
});
|
|
1764
1705
|
});
|
|
1765
|
-
|
|
1766
|
-
|
|
1706
|
+
setShowGenericModal(true);
|
|
1707
|
+
}
|
|
1708
|
+
} else {
|
|
1709
|
+
sendEvaluation("A");
|
|
1767
1710
|
}
|
|
1768
|
-
} else {
|
|
1769
|
-
sendEvaluation("A");
|
|
1770
1711
|
}
|
|
1771
1712
|
},
|
|
1772
1713
|
reject: function reject() {
|
|
1773
1714
|
if (origin[activeTab] === "RequestWithoutContentoh" && !user.is_retailer && (!product.id_order || !product.orderId)) {
|
|
1774
1715
|
return;
|
|
1775
|
-
} else
|
|
1776
|
-
if (
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1716
|
+
} else {
|
|
1717
|
+
if (user.is_retailer) {
|
|
1718
|
+
if (product.id_order || product.orderId) {
|
|
1719
|
+
sendEvaluation("R");
|
|
1720
|
+
setModalViewError(true);
|
|
1721
|
+
} else {
|
|
1722
|
+
setDataGenericModal(function (prev) {
|
|
1723
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
1724
|
+
button2: {
|
|
1725
|
+
name: "Continuar",
|
|
1726
|
+
action: function action() {
|
|
1727
|
+
return evaluationToRetailer("R");
|
|
1728
|
+
}
|
|
1786
1729
|
}
|
|
1787
|
-
}
|
|
1730
|
+
});
|
|
1788
1731
|
});
|
|
1789
|
-
|
|
1790
|
-
|
|
1732
|
+
setShowGenericModal(true);
|
|
1733
|
+
}
|
|
1734
|
+
} else {
|
|
1735
|
+
sendEvaluation("R");
|
|
1736
|
+
setModalViewError(true);
|
|
1791
1737
|
}
|
|
1792
|
-
} else {
|
|
1793
|
-
sendEvaluation("R");
|
|
1794
|
-
setModalViewError(true);
|
|
1795
1738
|
}
|
|
1796
1739
|
}
|
|
1797
1740
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
|
|
1798
1741
|
tabsSections: tabsSections,
|
|
1799
|
-
status:
|
|
1742
|
+
status: product["".concat(getConcept(activeTab), "_status")] || (product === null || product === void 0 ? void 0 : product.version_status),
|
|
1800
1743
|
activeTab: activeTab,
|
|
1801
1744
|
setActiveTab: setActiveTab,
|
|
1802
1745
|
setImageLayout: setImageLayout,
|
|
@@ -1870,9 +1813,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1870
1813
|
headerType: "input-name-header"
|
|
1871
1814
|
}))]
|
|
1872
1815
|
})
|
|
1873
|
-
}), isRevision() && getSectionStatus() ? /*#__PURE__*/(0, _jsxRuntime.
|
|
1816
|
+
}), isRevision() && getSectionStatus() ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1874
1817
|
className: "commentary-box",
|
|
1875
|
-
children: !comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1818
|
+
children: [!comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1876
1819
|
className: "commentary",
|
|
1877
1820
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
|
|
1878
1821
|
label: "Caja de Comentario",
|
|
@@ -1898,24 +1841,32 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1898
1841
|
reviewed: crossComment
|
|
1899
1842
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1900
1843
|
buttonType: "circular-button accept-button",
|
|
1901
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1902
|
-
return _regenerator.default.wrap(function
|
|
1844
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
1845
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
1903
1846
|
while (1) {
|
|
1904
|
-
switch (
|
|
1847
|
+
switch (_context16.prev = _context16.next) {
|
|
1905
1848
|
case 0:
|
|
1906
1849
|
setCrossComment(true);
|
|
1907
1850
|
commentRevised();
|
|
1908
1851
|
|
|
1909
1852
|
case 2:
|
|
1910
1853
|
case "end":
|
|
1911
|
-
return
|
|
1854
|
+
return _context16.stop();
|
|
1912
1855
|
}
|
|
1913
1856
|
}
|
|
1914
|
-
},
|
|
1857
|
+
}, _callee16);
|
|
1915
1858
|
}))
|
|
1916
1859
|
})]
|
|
1917
|
-
})
|
|
1918
|
-
|
|
1860
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1861
|
+
buttonType: evaluationComplete(activeTab) && (productEdit.product.id_order || productEdit.product.orderId) ? "general-green-button" : "general-button-disabled",
|
|
1862
|
+
label: "Enviar evaluación",
|
|
1863
|
+
onClick: function onClick() {
|
|
1864
|
+
//setModalSent(true);
|
|
1865
|
+
sendEvaluation();
|
|
1866
|
+
setMessage("\xA1Evaluaci\xF3n de ".concat(activeTab, " completada!"));
|
|
1867
|
+
}
|
|
1868
|
+
})]
|
|
1869
|
+
}) : revision ? null : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1919
1870
|
className: "required-inputs-message",
|
|
1920
1871
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1921
1872
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|