contentoh-components-library 21.1.49 → 21.1.52
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/StatusTag/index.js +17 -2
- package/dist/components/atoms/StatusTag/styles.js +1 -1
- package/dist/components/molecules/RetailerSelector/index.js +0 -2
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -1
- package/dist/components/organisms/FullTabsMenu/index.js +2 -2
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +87 -119
- package/dist/components/pages/ProviderProductEdition/index.js +328 -380
- package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +37 -0
- package/dist/components/pages/RegistrationLoginFirstStep/index.js +269 -0
- package/dist/components/pages/RegistrationLoginFirstStep/styles.js +20 -0
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +33 -75
- package/dist/components/pages/RetailerProductEdition/index.js +197 -210
- 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/StatusTag/index.js +12 -2
- package/src/components/atoms/StatusTag/styles.js +11 -11
- package/src/components/molecules/RetailerSelector/index.js +0 -1
- package/src/components/molecules/StatusAsignationInfo/index.js +1 -1
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/organisms/FullTabsMenu/index.js +1 -1
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +92 -116
- package/src/components/pages/ProviderProductEdition/index.js +207 -217
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +31 -77
- package/src/components/pages/RetailerProductEdition/index.js +165 -140
- package/src/components/pages/RetailerProductEdition/styles.js +1 -1
- package/src/global-files/data.js +9 -10
- package/src/index.js +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
|
|
|
@@ -389,20 +391,20 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
389
391
|
case 0:
|
|
390
392
|
_context.prev = 0;
|
|
391
393
|
_context.next = 3;
|
|
392
|
-
return (0,
|
|
394
|
+
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), product === null || product === void 0 ? void 0 : product.version);
|
|
393
395
|
|
|
394
396
|
case 3:
|
|
395
397
|
_services = _context.sent;
|
|
396
398
|
//Converts the data inside the datasheets object to array
|
|
397
399
|
setServices(_services);
|
|
398
|
-
getServices(); //
|
|
400
|
+
getServices(); //setActiveRetailer(product?.retailers[0]);
|
|
399
401
|
|
|
400
402
|
setImages({
|
|
401
403
|
action: "init",
|
|
402
404
|
init: _services[2]
|
|
403
405
|
});
|
|
404
406
|
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);
|
|
405
|
-
(0,
|
|
407
|
+
(0, _data2.getPercentage)({
|
|
406
408
|
data: [product]
|
|
407
409
|
}).then(function (res) {
|
|
408
410
|
return setPercentages(res);
|
|
@@ -433,7 +435,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
433
435
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
434
436
|
var _product$article4, _product$article5, _servicesResponse$dat;
|
|
435
437
|
|
|
436
|
-
var servicesResponse, parsedResponse, retailers,
|
|
438
|
+
var servicesResponse, parsedResponse, retailers, active;
|
|
437
439
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
438
440
|
while (1) {
|
|
439
441
|
switch (_context2.prev = _context2.next) {
|
|
@@ -445,16 +447,15 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
445
447
|
servicesResponse = _context2.sent;
|
|
446
448
|
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;
|
|
447
449
|
retailers = product.retailers || product.retailersAvailable;
|
|
448
|
-
|
|
449
|
-
return srv
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
});
|
|
450
|
+
active = retailers === null || retailers === void 0 ? void 0 : retailers.filter(function (retailer) {
|
|
451
|
+
return parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
|
|
452
|
+
return srv.id_retailer;
|
|
453
|
+
}).includes(retailer.id);
|
|
454
|
+
})[0];
|
|
454
455
|
!activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
|
|
455
456
|
setServicesData(parsedResponse);
|
|
456
457
|
|
|
457
|
-
case
|
|
458
|
+
case 8:
|
|
458
459
|
case "end":
|
|
459
460
|
return _context2.stop();
|
|
460
461
|
}
|
|
@@ -468,12 +469,17 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
468
469
|
}();
|
|
469
470
|
|
|
470
471
|
var translateConcept = function translateConcept(concept) {
|
|
471
|
-
var translation =
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
}
|
|
476
|
-
|
|
472
|
+
var translation = "";
|
|
473
|
+
|
|
474
|
+
if (concept === "datasheet") {
|
|
475
|
+
translation = "Ficha técnica";
|
|
476
|
+
} else if (concept === "description") {
|
|
477
|
+
translation = "Descripción";
|
|
478
|
+
} else if (concept === "images") {
|
|
479
|
+
translation = "Imágenes";
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
return translation;
|
|
477
483
|
};
|
|
478
484
|
|
|
479
485
|
var getComments = /*#__PURE__*/function () {
|
|
@@ -526,7 +532,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
526
532
|
getComments();
|
|
527
533
|
_context4.t0 = setUserGroups;
|
|
528
534
|
_context4.next = 5;
|
|
529
|
-
return (0,
|
|
535
|
+
return (0, _data2.fetchUsers)(token);
|
|
530
536
|
|
|
531
537
|
case 5:
|
|
532
538
|
_context4.t1 = _context4.sent;
|
|
@@ -537,15 +543,15 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
537
543
|
break;
|
|
538
544
|
|
|
539
545
|
case 11:
|
|
540
|
-
arr = ["
|
|
546
|
+
arr = ["IN_PROGRESS", "RF", "RA"];
|
|
541
547
|
return _context4.abrupt("break", 19);
|
|
542
548
|
|
|
543
549
|
case 13:
|
|
544
|
-
arr = ["
|
|
550
|
+
arr = ["RF", "AF", "AA", "AP", "AC"];
|
|
545
551
|
return _context4.abrupt("break", 19);
|
|
546
552
|
|
|
547
553
|
case 15:
|
|
548
|
-
arr = ["RP", "
|
|
554
|
+
arr = ["RP", "RC", "AF", "RA"];
|
|
549
555
|
return _context4.abrupt("break", 19);
|
|
550
556
|
|
|
551
557
|
case 17:
|
|
@@ -681,60 +687,49 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
681
687
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
682
688
|
var _product$article9;
|
|
683
689
|
|
|
684
|
-
var productTemp,
|
|
685
|
-
|
|
690
|
+
var productTemp, dataObject;
|
|
686
691
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
687
692
|
while (1) {
|
|
688
693
|
switch (_context5.prev = _context5.next) {
|
|
689
694
|
case 0:
|
|
690
695
|
setLoading(true);
|
|
691
696
|
productTemp = product;
|
|
692
|
-
articleId = product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article;
|
|
693
697
|
dataObject = {
|
|
694
|
-
articleId:
|
|
698
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article,
|
|
695
699
|
articleData: updatedDescriptions
|
|
696
700
|
};
|
|
697
701
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
698
|
-
_context5.prev =
|
|
699
|
-
_context5.next =
|
|
702
|
+
_context5.prev = 4;
|
|
703
|
+
_context5.next = 7;
|
|
700
704
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
701
705
|
headers: {
|
|
702
706
|
Authorization: token
|
|
703
707
|
}
|
|
704
708
|
});
|
|
705
709
|
|
|
706
|
-
case
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
break;
|
|
710
|
+
case 7:
|
|
711
|
+
if (productTemp.status === "ASSIGNED") {
|
|
712
|
+
productTemp.status = "IN_PROGRESS";
|
|
713
|
+
setProduct(productTemp);
|
|
714
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
712
715
|
}
|
|
713
716
|
|
|
714
|
-
_JSON$parse2 = JSON.parse(res.data.body), newStatus = _JSON$parse2.newStatus, newArticleStatus = _JSON$parse2.newArticleStatus;
|
|
715
|
-
if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
|
|
716
|
-
if (newStatus) productTemp.description_status = newStatus;
|
|
717
|
-
setProduct(productTemp);
|
|
718
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
719
717
|
setMessage("Descripciones guardadas con éxito");
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
case 18:
|
|
724
|
-
_context5.next = 23;
|
|
718
|
+
loadData();
|
|
719
|
+
_context5.next = 15;
|
|
725
720
|
break;
|
|
726
721
|
|
|
727
|
-
case
|
|
728
|
-
_context5.prev =
|
|
729
|
-
_context5.t0 = _context5["catch"](
|
|
722
|
+
case 12:
|
|
723
|
+
_context5.prev = 12;
|
|
724
|
+
_context5.t0 = _context5["catch"](4);
|
|
730
725
|
console.log(_context5.t0);
|
|
731
726
|
|
|
732
|
-
case
|
|
727
|
+
case 15:
|
|
733
728
|
case "end":
|
|
734
729
|
return _context5.stop();
|
|
735
730
|
}
|
|
736
731
|
}
|
|
737
|
-
}, _callee5, null, [[
|
|
732
|
+
}, _callee5, null, [[4, 12]]);
|
|
738
733
|
}));
|
|
739
734
|
|
|
740
735
|
return function saveDescriptions() {
|
|
@@ -746,60 +741,50 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
746
741
|
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
747
742
|
var _product$article10;
|
|
748
743
|
|
|
749
|
-
var productTemp,
|
|
750
|
-
|
|
744
|
+
var productTemp, dataObject;
|
|
751
745
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
752
746
|
while (1) {
|
|
753
747
|
switch (_context6.prev = _context6.next) {
|
|
754
748
|
case 0:
|
|
755
749
|
setLoading(true);
|
|
756
750
|
productTemp = product;
|
|
757
|
-
articleId = product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article;
|
|
758
751
|
dataObject = {
|
|
759
|
-
articleId:
|
|
752
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article,
|
|
760
753
|
articleData: updatedDatasheets
|
|
761
754
|
};
|
|
762
755
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
763
|
-
_context6.prev =
|
|
764
|
-
_context6.next =
|
|
756
|
+
_context6.prev = 4;
|
|
757
|
+
_context6.next = 7;
|
|
765
758
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
766
759
|
headers: {
|
|
767
760
|
Authorization: token
|
|
768
761
|
}
|
|
769
762
|
});
|
|
770
763
|
|
|
771
|
-
case
|
|
772
|
-
|
|
764
|
+
case 7:
|
|
765
|
+
setMessage("Fichas técnicas guardadas");
|
|
773
766
|
|
|
774
|
-
if (
|
|
775
|
-
|
|
776
|
-
|
|
767
|
+
if (productTemp.status === "ASSIGNED") {
|
|
768
|
+
productTemp.status = "IN_PROGRESS";
|
|
769
|
+
setProduct(productTemp);
|
|
770
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
777
771
|
}
|
|
778
772
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
if (newStatus) productTemp.datasheet_status = newStatus;
|
|
782
|
-
setProduct(productTemp);
|
|
783
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
784
|
-
setMessage("Fichas técnicas guardadas");
|
|
785
|
-
_context6.next = 18;
|
|
786
|
-
return loadData();
|
|
787
|
-
|
|
788
|
-
case 18:
|
|
789
|
-
_context6.next = 23;
|
|
773
|
+
loadData();
|
|
774
|
+
_context6.next = 15;
|
|
790
775
|
break;
|
|
791
776
|
|
|
792
|
-
case
|
|
793
|
-
_context6.prev =
|
|
794
|
-
_context6.t0 = _context6["catch"](
|
|
777
|
+
case 12:
|
|
778
|
+
_context6.prev = 12;
|
|
779
|
+
_context6.t0 = _context6["catch"](4);
|
|
795
780
|
console.log(_context6.t0);
|
|
796
781
|
|
|
797
|
-
case
|
|
782
|
+
case 15:
|
|
798
783
|
case "end":
|
|
799
784
|
return _context6.stop();
|
|
800
785
|
}
|
|
801
786
|
}
|
|
802
|
-
}, _callee6, null, [[
|
|
787
|
+
}, _callee6, null, [[4, 12]]);
|
|
803
788
|
}));
|
|
804
789
|
|
|
805
790
|
return function saveDatasheets() {
|
|
@@ -825,7 +810,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
825
810
|
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
826
811
|
var _images$values2, _product$article11, _data$articleData, _data$articleData2, _data$updateImages;
|
|
827
812
|
|
|
828
|
-
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
813
|
+
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray, productTemp;
|
|
829
814
|
|
|
830
815
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
831
816
|
while (1) {
|
|
@@ -878,7 +863,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
878
863
|
}
|
|
879
864
|
|
|
880
865
|
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
881
|
-
_context7.next =
|
|
866
|
+
_context7.next = 33;
|
|
882
867
|
break;
|
|
883
868
|
}
|
|
884
869
|
|
|
@@ -918,38 +903,44 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
918
903
|
setImagesUploaded(true);
|
|
919
904
|
|
|
920
905
|
case 24:
|
|
921
|
-
|
|
906
|
+
productTemp = product;
|
|
907
|
+
|
|
908
|
+
if (productTemp.status === "ASSIGNED") {
|
|
909
|
+
productTemp.status = "IN_PROGRESS";
|
|
910
|
+
setProduct(productTemp);
|
|
911
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
_context7.next = 31;
|
|
922
915
|
break;
|
|
923
916
|
|
|
924
|
-
case
|
|
925
|
-
_context7.prev =
|
|
917
|
+
case 28:
|
|
918
|
+
_context7.prev = 28;
|
|
926
919
|
_context7.t0 = _context7["catch"](11);
|
|
927
920
|
console.log(_context7.t0); // setMainLoading(false);
|
|
928
921
|
|
|
929
|
-
case
|
|
930
|
-
_context7.next =
|
|
922
|
+
case 31:
|
|
923
|
+
_context7.next = 34;
|
|
931
924
|
break;
|
|
932
925
|
|
|
933
|
-
case
|
|
926
|
+
case 33:
|
|
934
927
|
// setMainLoading(false);
|
|
935
928
|
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.");
|
|
936
929
|
|
|
937
|
-
case
|
|
930
|
+
case 34:
|
|
938
931
|
case "end":
|
|
939
932
|
return _context7.stop();
|
|
940
933
|
}
|
|
941
934
|
}
|
|
942
|
-
}, _callee7, null, [[11,
|
|
935
|
+
}, _callee7, null, [[11, 28]]);
|
|
943
936
|
})), [images, imagesUploaded]);
|
|
944
937
|
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
945
|
-
var res, productTemp, _JSON$parse4, newStatus, newArticleStatus;
|
|
946
|
-
|
|
947
938
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
948
939
|
while (1) {
|
|
949
940
|
switch (_context8.prev = _context8.next) {
|
|
950
941
|
case 0:
|
|
951
942
|
if (!imagesUploaded) {
|
|
952
|
-
_context8.next =
|
|
943
|
+
_context8.next = 13;
|
|
953
944
|
break;
|
|
954
945
|
}
|
|
955
946
|
|
|
@@ -970,72 +961,58 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
970
961
|
});
|
|
971
962
|
|
|
972
963
|
case 5:
|
|
973
|
-
res = _context8.sent;
|
|
974
|
-
|
|
975
|
-
if (!(res.data.statusCode === 200)) {
|
|
976
|
-
_context8.next = 17;
|
|
977
|
-
break;
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
productTemp = product;
|
|
981
|
-
_JSON$parse4 = JSON.parse(res.data.body), newStatus = _JSON$parse4.newStatus, newArticleStatus = _JSON$parse4.newArticleStatus;
|
|
982
|
-
if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
|
|
983
|
-
if (newStatus) productTemp.images_status = newStatus;
|
|
984
|
-
setProduct(productTemp);
|
|
985
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
986
964
|
setMessage("Imágenes guardadas con éxito");
|
|
987
965
|
sessionStorage.removeItem("imagesList");
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
case 17:
|
|
992
|
-
_context8.next = 22;
|
|
966
|
+
loadData();
|
|
967
|
+
_context8.next = 13;
|
|
993
968
|
break;
|
|
994
969
|
|
|
995
|
-
case
|
|
996
|
-
_context8.prev =
|
|
970
|
+
case 10:
|
|
971
|
+
_context8.prev = 10;
|
|
997
972
|
_context8.t0 = _context8["catch"](2);
|
|
998
973
|
console.log(_context8.t0);
|
|
999
974
|
|
|
1000
|
-
case
|
|
975
|
+
case 13:
|
|
1001
976
|
case "end":
|
|
1002
977
|
return _context8.stop();
|
|
1003
978
|
}
|
|
1004
979
|
}
|
|
1005
|
-
}, _callee8, null, [[2,
|
|
980
|
+
}, _callee8, null, [[2, 10]]);
|
|
1006
981
|
})), [dataImages, imagesUploaded]);
|
|
1007
982
|
|
|
1008
983
|
var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {
|
|
1009
|
-
var _srv$find, _srv$find$status, _product$;
|
|
1010
|
-
|
|
1011
984
|
var srv = servicesData.filter(function (serv) {
|
|
1012
985
|
return serv.service === getConcept(tab);
|
|
1013
986
|
});
|
|
1014
|
-
|
|
987
|
+
|
|
988
|
+
var _srv$filter = srv.filter(function (serv) {
|
|
1015
989
|
return serv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
|
|
1016
|
-
})
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
990
|
+
}),
|
|
991
|
+
_srv$filter2 = (0, _slicedToArray2.default)(_srv$filter, 1),
|
|
992
|
+
srvActive = _srv$filter2[0];
|
|
993
|
+
|
|
994
|
+
var unvalidated = product["".concat(getConcept(tab), "_status")] === "QF" || product["".concat(getConcept(tab), "_status")] === "IN_PROGRESS";
|
|
995
|
+
var auditorUnvalidated = !["RA", "AA", "AC", "AP"].includes(product["".concat(getConcept(tab), "_status")]);
|
|
1020
996
|
|
|
1021
997
|
switch (userId) {
|
|
1022
998
|
case 7:
|
|
1023
999
|
case 8:
|
|
1024
|
-
return
|
|
1000
|
+
return ["RA", "RF"].includes(product === null || product === void 0 ? void 0 : product.status) && //"IN_PROGRESS", "RF", "RA"
|
|
1001
|
+
statusArray.includes(srvActive === null || srvActive === void 0 ? void 0 : srvActive.status) || statusArray.includes(product.status) && srv.filter(function (serv) {
|
|
1025
1002
|
return statusArray.includes(serv.status);
|
|
1026
|
-
}).length === srv.length
|
|
1003
|
+
}).length === srv.length;
|
|
1027
1004
|
|
|
1028
1005
|
case 4:
|
|
1029
1006
|
case 5:
|
|
1030
|
-
return unvalidated && ["
|
|
1007
|
+
return unvalidated && ["IN_PROGRESS", "QF"].includes(product.status) && //"RF", "AF", "AA", "AP", "AC
|
|
1031
1008
|
srv.filter(function (serv) {
|
|
1032
1009
|
return statusArray.includes(serv.status);
|
|
1033
1010
|
}).length === srv.length;
|
|
1034
1011
|
|
|
1035
1012
|
case 6:
|
|
1036
|
-
return statusArray.includes(product.status) && //
|
|
1013
|
+
return statusArray.includes(product.status) && //RP, RC, AF, RA true
|
|
1037
1014
|
srv.every(function (serv) {
|
|
1038
|
-
return ["RA", "AA", "AP", "
|
|
1015
|
+
return ["RA", "AA", "AP", "AC"].includes(serv.status);
|
|
1039
1016
|
}) && auditorUnvalidated;
|
|
1040
1017
|
|
|
1041
1018
|
default:
|
|
@@ -1057,16 +1034,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1057
1034
|
};
|
|
1058
1035
|
|
|
1059
1036
|
var approveRejectButtons = function approveRejectButtons(action) {
|
|
1060
|
-
var _servicesData$find, _servicesData$find$st;
|
|
1061
|
-
|
|
1062
1037
|
var concept = getConcept(action || activeTab);
|
|
1063
|
-
|
|
1038
|
+
|
|
1039
|
+
var _servicesData$filter = servicesData.filter(function (srv) {
|
|
1064
1040
|
return srv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && srv.service === concept;
|
|
1065
|
-
})
|
|
1041
|
+
}),
|
|
1042
|
+
_servicesData$filter2 = (0, _slicedToArray2.default)(_servicesData$filter, 1),
|
|
1043
|
+
retailerStatus = _servicesData$filter2[0];
|
|
1066
1044
|
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
|
|
1045
|
+
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
|
|
1046
|
+
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);
|
|
1070
1047
|
};
|
|
1071
1048
|
|
|
1072
1049
|
var getSectionIcon = function getSectionIcon() {
|
|
@@ -1090,8 +1067,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1090
1067
|
|
|
1091
1068
|
var sendToFacilitator = /*#__PURE__*/function () {
|
|
1092
1069
|
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
|
|
1093
|
-
var concept, productTemp, evalStatus,
|
|
1094
|
-
|
|
1070
|
+
var concept, productTemp, evalStatus, data, specialistDone, statusArr, newStatus;
|
|
1095
1071
|
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1096
1072
|
while (1) {
|
|
1097
1073
|
switch (_context9.prev = _context9.next) {
|
|
@@ -1100,92 +1076,112 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1100
1076
|
_context9.prev = 1;
|
|
1101
1077
|
concept = getConcept(activeTab);
|
|
1102
1078
|
productTemp = (0, _objectSpread2.default)({}, product);
|
|
1103
|
-
evalStatus =
|
|
1104
|
-
|
|
1105
|
-
orderId = product.orderId;
|
|
1106
|
-
data = {
|
|
1107
|
-
articleId: _articleId,
|
|
1108
|
-
orderId: orderId,
|
|
1109
|
-
concept: concept,
|
|
1110
|
-
evalStatus: evalStatus,
|
|
1111
|
-
retailerId: activeRetailer.id
|
|
1112
|
-
};
|
|
1079
|
+
evalStatus = product["".concat(concept, "_status")];
|
|
1080
|
+
data = {};
|
|
1113
1081
|
|
|
1114
1082
|
if (!result) {
|
|
1115
|
-
_context9.next =
|
|
1083
|
+
_context9.next = 13;
|
|
1116
1084
|
break;
|
|
1117
1085
|
}
|
|
1118
1086
|
|
|
1119
|
-
data
|
|
1120
|
-
|
|
1087
|
+
data = {
|
|
1088
|
+
articleId: product.article.id_article,
|
|
1089
|
+
orderId: product.orderId,
|
|
1090
|
+
concept: concept,
|
|
1091
|
+
result: result,
|
|
1092
|
+
evalStatus: evalStatus,
|
|
1093
|
+
retailerId: activeRetailer.id
|
|
1094
|
+
};
|
|
1095
|
+
_context9.next = 10;
|
|
1121
1096
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1122
1097
|
headers: {
|
|
1123
1098
|
Authorization: token
|
|
1124
1099
|
}
|
|
1125
1100
|
});
|
|
1126
1101
|
|
|
1127
|
-
case
|
|
1128
|
-
res = _context9.sent;
|
|
1102
|
+
case 10:
|
|
1129
1103
|
getServices();
|
|
1130
|
-
_context9.next =
|
|
1104
|
+
_context9.next = 31;
|
|
1131
1105
|
break;
|
|
1132
1106
|
|
|
1133
|
-
case
|
|
1134
|
-
specialistDone =
|
|
1107
|
+
case 13:
|
|
1108
|
+
specialistDone = evalStatus === "RF" || evalStatus === "RA" || evalStatus === "IN_PROGRESS";
|
|
1135
1109
|
|
|
1136
1110
|
if (specialistDone) {
|
|
1137
|
-
|
|
1111
|
+
setMessage("".concat(activeTab, " enviada a facilitador"));
|
|
1112
|
+
getSectionIcon();
|
|
1113
|
+
} else if (evalStatus === "QF") {
|
|
1114
|
+
setMessage("Evaluación enviada");
|
|
1115
|
+
getSectionIcon();
|
|
1116
|
+
} else if (evalStatus === "AF") {
|
|
1117
|
+
setMessage("Evaluación enviada");
|
|
1118
|
+
getSectionIcon();
|
|
1119
|
+
} else if (evalStatus === "RP") {
|
|
1120
|
+
setMessage("Evaluación enviada");
|
|
1138
1121
|
getSectionIcon();
|
|
1139
|
-
} else if (
|
|
1140
|
-
|
|
1122
|
+
} else if (evalStatus === "RC") {
|
|
1123
|
+
setMessage("Evaluación enviada");
|
|
1141
1124
|
getSectionIcon();
|
|
1142
1125
|
}
|
|
1143
1126
|
|
|
1144
|
-
|
|
1127
|
+
statusArr = [];
|
|
1128
|
+
servicesData.forEach(function (srv) {
|
|
1129
|
+
srv.service === concept && statusArr.push(srv.status);
|
|
1130
|
+
});
|
|
1131
|
+
productTemp["".concat(concept, "_status")] = (0, _data2.getNewStatus)(statusArr);
|
|
1132
|
+
newStatus = (0, _data2.getNewStatus)([productTemp.datasheet_status, productTemp.description_status, productTemp.images_status]);
|
|
1133
|
+
productTemp.status = newStatus;
|
|
1134
|
+
data = {
|
|
1135
|
+
articleId: product.article.id_article,
|
|
1136
|
+
orderId: product.orderId,
|
|
1137
|
+
concept: concept,
|
|
1138
|
+
evalStatus: evalStatus,
|
|
1139
|
+
retailerId: activeRetailer.id
|
|
1140
|
+
};
|
|
1141
|
+
_context9.t0 = user.id_role;
|
|
1142
|
+
_context9.next = _context9.t0 === 7 ? 24 : _context9.t0 === 8 ? 24 : _context9.t0 === 4 ? 26 : _context9.t0 === 5 ? 26 : 28;
|
|
1143
|
+
break;
|
|
1144
|
+
|
|
1145
|
+
case 24:
|
|
1146
|
+
data.especialist = true;
|
|
1147
|
+
return _context9.abrupt("break", 29);
|
|
1148
|
+
|
|
1149
|
+
case 26:
|
|
1150
|
+
data.facilitator = true;
|
|
1151
|
+
return _context9.abrupt("break", 29);
|
|
1152
|
+
|
|
1153
|
+
case 28:
|
|
1154
|
+
return _context9.abrupt("break", 29);
|
|
1155
|
+
|
|
1156
|
+
case 29:
|
|
1157
|
+
_context9.next = 31;
|
|
1145
1158
|
return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1146
1159
|
headers: {
|
|
1147
1160
|
Authorization: token
|
|
1148
1161
|
}
|
|
1149
1162
|
});
|
|
1150
1163
|
|
|
1151
|
-
case
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
case 21:
|
|
1155
|
-
if (!(res.data.statusCode === 200)) {
|
|
1156
|
-
_context9.next = 30;
|
|
1157
|
-
break;
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
_JSON$parse5 = JSON.parse(res.data.body), newStatus = _JSON$parse5.newStatus, newOrderStatus = _JSON$parse5.newOrderStatus;
|
|
1161
|
-
if (newOrderStatus) productTemp.status = newOrderStatus[orderId];
|
|
1162
|
-
productTemp["".concat(concept, "_status")] = newStatus;
|
|
1163
|
-
_context9.next = 27;
|
|
1164
|
-
return loadData();
|
|
1165
|
-
|
|
1166
|
-
case 27:
|
|
1167
|
-
if (message) setMessage(message);
|
|
1164
|
+
case 31:
|
|
1165
|
+
loadData();
|
|
1168
1166
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1169
1167
|
setProduct(productTemp);
|
|
1170
|
-
|
|
1171
|
-
case 30:
|
|
1172
|
-
_context9.next = 35;
|
|
1168
|
+
_context9.next = 39;
|
|
1173
1169
|
break;
|
|
1174
1170
|
|
|
1175
|
-
case
|
|
1176
|
-
_context9.prev =
|
|
1177
|
-
_context9.
|
|
1178
|
-
console.log(_context9.
|
|
1171
|
+
case 36:
|
|
1172
|
+
_context9.prev = 36;
|
|
1173
|
+
_context9.t1 = _context9["catch"](1);
|
|
1174
|
+
console.log(_context9.t1);
|
|
1179
1175
|
|
|
1180
|
-
case
|
|
1176
|
+
case 39:
|
|
1181
1177
|
setLoading(false);
|
|
1182
1178
|
|
|
1183
|
-
case
|
|
1179
|
+
case 40:
|
|
1184
1180
|
case "end":
|
|
1185
1181
|
return _context9.stop();
|
|
1186
1182
|
}
|
|
1187
1183
|
}
|
|
1188
|
-
}, _callee9, null, [[1,
|
|
1184
|
+
}, _callee9, null, [[1, 36]]);
|
|
1189
1185
|
}));
|
|
1190
1186
|
|
|
1191
1187
|
return function sendToFacilitator(_x) {
|
|
@@ -1292,11 +1288,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1292
1288
|
var dsInputsRequired = [];
|
|
1293
1289
|
var desInputsRequired = 0;
|
|
1294
1290
|
datasheetServicesArray === null || datasheetServicesArray === void 0 ? void 0 : datasheetServicesArray.forEach(function (datasheet) {
|
|
1295
|
-
var _servicesData$
|
|
1291
|
+
var _servicesData$filter3 = servicesData === null || servicesData === void 0 ? void 0 : servicesData.filter(function (srv) {
|
|
1296
1292
|
return srv.id_retailer === datasheet.retailer.id && srv.service === getConcept(activeTab);
|
|
1297
1293
|
}),
|
|
1298
|
-
_servicesData$
|
|
1299
|
-
requested = _servicesData$
|
|
1294
|
+
_servicesData$filter4 = (0, _slicedToArray2.default)(_servicesData$filter3, 1),
|
|
1295
|
+
requested = _servicesData$filter4[0];
|
|
1300
1296
|
|
|
1301
1297
|
requested && (datasheet === null || datasheet === void 0 ? void 0 : datasheet.data) && Object.values(datasheet === null || datasheet === void 0 ? void 0 : datasheet.data).forEach(function (dataGroup) {
|
|
1302
1298
|
return dsInputsRequired.push.apply(dsInputsRequired, (0, _toConsumableArray2.default)(dataGroup.inputs.filter(function (input) {
|
|
@@ -1306,16 +1302,14 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1306
1302
|
});
|
|
1307
1303
|
objetcTemp["Ficha técnica"] = dsInputsRequired.length;
|
|
1308
1304
|
descriptionsServicesArray.forEach(function (description) {
|
|
1309
|
-
var _servicesData$
|
|
1305
|
+
var _servicesData$filter5 = servicesData.filter(function (srv) {
|
|
1310
1306
|
return srv.id_retailer === description.id && srv.service === getConcept(activeTab);
|
|
1311
1307
|
}),
|
|
1312
|
-
_servicesData$
|
|
1313
|
-
requested = _servicesData$
|
|
1308
|
+
_servicesData$filter6 = (0, _slicedToArray2.default)(_servicesData$filter5, 1),
|
|
1309
|
+
requested = _servicesData$filter6[0];
|
|
1314
1310
|
|
|
1315
1311
|
requested && description.inputs.forEach(function (input) {
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
return input.required && (!input.value || ((_input$value = input.value) === null || _input$value === void 0 ? void 0 : _input$value.replace(/(<\/?p>)|(<\/?strong>)|(<br>)/gm, "")) === "") && desInputsRequired++;
|
|
1312
|
+
return input.required && (!input.value || input.value.replace(/(<\/?p>)|(<\/?strong>)|(<br>)/gm, "") === "") && desInputsRequired++;
|
|
1319
1313
|
});
|
|
1320
1314
|
});
|
|
1321
1315
|
objetcTemp["Descripción"] = desInputsRequired;
|
|
@@ -1413,16 +1407,14 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1413
1407
|
case 10:
|
|
1414
1408
|
productTemp = product;
|
|
1415
1409
|
productTemp.article["id_".concat(concept, "_").concat(assignationType)] = assignationId;
|
|
1416
|
-
data = {
|
|
1410
|
+
data = (0, _defineProperty2.default)({
|
|
1417
1411
|
articleList: [{
|
|
1418
1412
|
orderId: product.orderId,
|
|
1419
1413
|
articleId: product === null || product === void 0 ? void 0 : (_product$article13 = product.article) === null || _product$article13 === void 0 ? void 0 : _product$article13.id_article
|
|
1420
1414
|
}],
|
|
1421
|
-
concept: concept
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
_context12.next = 15;
|
|
1425
|
-
return (0, _axios.default)({
|
|
1415
|
+
concept: concept
|
|
1416
|
+
}, "".concat(assignationType, "Id"), assignationId);
|
|
1417
|
+
(0, _axios.default)({
|
|
1426
1418
|
method: "post",
|
|
1427
1419
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
1428
1420
|
data: data,
|
|
@@ -1430,12 +1422,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1430
1422
|
Authorization: token
|
|
1431
1423
|
}
|
|
1432
1424
|
});
|
|
1433
|
-
|
|
1434
|
-
case 15:
|
|
1435
1425
|
loadAssignations(productTemp);
|
|
1436
1426
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1437
1427
|
|
|
1438
|
-
case
|
|
1428
|
+
case 16:
|
|
1439
1429
|
case "end":
|
|
1440
1430
|
return _context12.stop();
|
|
1441
1431
|
}
|
|
@@ -1614,24 +1604,21 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1614
1604
|
productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result, "A");
|
|
1615
1605
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1616
1606
|
setProduct(productTemp);
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
case 20:
|
|
1621
|
-
_context13.next = 25;
|
|
1607
|
+
loadData();
|
|
1608
|
+
_context13.next = 24;
|
|
1622
1609
|
break;
|
|
1623
1610
|
|
|
1624
|
-
case
|
|
1625
|
-
_context13.prev =
|
|
1611
|
+
case 21:
|
|
1612
|
+
_context13.prev = 21;
|
|
1626
1613
|
_context13.t0 = _context13["catch"](0);
|
|
1627
1614
|
console.log(_context13.t0);
|
|
1628
1615
|
|
|
1629
|
-
case
|
|
1616
|
+
case 24:
|
|
1630
1617
|
case "end":
|
|
1631
1618
|
return _context13.stop();
|
|
1632
1619
|
}
|
|
1633
1620
|
}
|
|
1634
|
-
}, _callee13, null, [[0,
|
|
1621
|
+
}, _callee13, null, [[0, 21]]);
|
|
1635
1622
|
}));
|
|
1636
1623
|
|
|
1637
1624
|
return function validateAll(_x7) {
|
|
@@ -1704,7 +1691,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1704
1691
|
})]);
|
|
1705
1692
|
},
|
|
1706
1693
|
showApproveRejectAll: isAuditor && servicesData.every(function (serv) {
|
|
1707
|
-
return ["RA", "AA", "AP", "
|
|
1694
|
+
return ["RA", "AA", "AP", "AC", "AF"].includes(serv.status);
|
|
1708
1695
|
}) && approveRejectButtons() && (auditorAssigned() || userAssigned()),
|
|
1709
1696
|
showValidationButtons: approveRejectButtons() && (auditorAssigned() || userAssigned()),
|
|
1710
1697
|
approveAll: function approveAll() {
|
|
@@ -1853,7 +1840,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1853
1840
|
}, _callee14);
|
|
1854
1841
|
}))
|
|
1855
1842
|
})]
|
|
1856
|
-
}),
|
|
1843
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1857
1844
|
buttonType: evaluationFinished(user.id_role, activeTab, statusArray) && requiredNull[activeTab] === 0 ? "general-green-button" : "general-button-disabled",
|
|
1858
1845
|
label: "Enviar evaluación",
|
|
1859
1846
|
onClick: function onClick() {
|