contentoh-components-library 21.4.82 → 21.4.83
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/molecules/ProductNameHeader/index.js +3 -8
- package/dist/components/organisms/EditGroup/index.js +0 -3
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -3
- package/dist/components/organisms/VersionSelector/index.js +169 -101
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +38 -34
- package/dist/components/pages/ProviderProductEdition/index.js +53 -71
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +52 -47
- package/dist/components/pages/RetailerProductEdition/index.js +177 -101
- package/dist/global-files/data.js +26 -11
- package/package.json +1 -2
- package/src/components/atoms/GeneralButton/styles.js +0 -1
- package/src/components/atoms/TabSection/index.js +1 -1
- package/src/components/molecules/ProductNameHeader/index.js +1 -5
- package/src/components/organisms/EditGroup/index.js +1 -3
- package/src/components/organisms/FullProductNameHeader/index.js +0 -2
- package/src/components/organisms/VersionSelector/index.js +100 -100
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +29 -39
- package/src/components/pages/ProviderProductEdition/index.js +21 -34
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +52 -48
- package/src/components/pages/RetailerProductEdition/index.js +144 -32
- package/src/global-files/data.js +33 -7
- package/src/components/atoms/ObservationFlag/ObservationFlag.stories.js +0 -20
- package/src/components/atoms/ObservationFlag/index.js +0 -33
- package/src/components/atoms/ObservationFlag/styles.js +0 -3
|
@@ -482,30 +482,25 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
482
482
|
compare = _useState82[0],
|
|
483
483
|
setCompare = _useState82[1];
|
|
484
484
|
|
|
485
|
-
var _useState83 = (0, _react.useState)(),
|
|
485
|
+
var _useState83 = (0, _react.useState)(false),
|
|
486
486
|
_useState84 = (0, _slicedToArray2.default)(_useState83, 2),
|
|
487
|
-
|
|
488
|
-
|
|
487
|
+
valRejAll = _useState84[0],
|
|
488
|
+
setValRejAll = _useState84[1];
|
|
489
489
|
|
|
490
|
-
var _useState85 = (0, _react.useState)(
|
|
490
|
+
var _useState85 = (0, _react.useState)([]),
|
|
491
491
|
_useState86 = (0, _slicedToArray2.default)(_useState85, 2),
|
|
492
|
-
|
|
493
|
-
|
|
492
|
+
desc = _useState86[0],
|
|
493
|
+
setDesc = _useState86[1];
|
|
494
494
|
|
|
495
495
|
var _useState87 = (0, _react.useState)([]),
|
|
496
496
|
_useState88 = (0, _slicedToArray2.default)(_useState87, 2),
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
fich = _useState88[0],
|
|
498
|
+
setFich = _useState88[1];
|
|
499
499
|
|
|
500
500
|
var _useState89 = (0, _react.useState)([]),
|
|
501
501
|
_useState90 = (0, _slicedToArray2.default)(_useState89, 2),
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
var _useState91 = (0, _react.useState)([]),
|
|
506
|
-
_useState92 = (0, _slicedToArray2.default)(_useState91, 2),
|
|
507
|
-
imag = _useState92[0],
|
|
508
|
-
setImag = _useState92[1];
|
|
502
|
+
imag = _useState90[0],
|
|
503
|
+
setImag = _useState90[1];
|
|
509
504
|
|
|
510
505
|
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
511
506
|
var _ref3, id_article;
|
|
@@ -578,7 +573,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
578
573
|
|
|
579
574
|
var loadData = /*#__PURE__*/function () {
|
|
580
575
|
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
581
|
-
var _product$article4, _product$article5, _product$article6, _services$, _services$$values,
|
|
576
|
+
var _product$article4, _product$article5, _product$article6, _services$, _services$$values, _services;
|
|
582
577
|
|
|
583
578
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
584
579
|
while (1) {
|
|
@@ -603,39 +598,26 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
603
598
|
init: _services[2]
|
|
604
599
|
});
|
|
605
600
|
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);
|
|
606
|
-
data = [{
|
|
607
|
-
id_article: product.article.id_article,
|
|
608
|
-
id_category: product.article.id_category,
|
|
609
|
-
version: product.version,
|
|
610
|
-
id_retailer_array: ((_product$retailersAva = product.retailersAvailable) !== null && _product$retailersAva !== void 0 ? _product$retailersAva : product.retailers).map(function (_ref6) {
|
|
611
|
-
var id = _ref6.id;
|
|
612
|
-
return id;
|
|
613
|
-
})
|
|
614
|
-
}];
|
|
615
|
-
headers = {
|
|
616
|
-
Authorization: token
|
|
617
|
-
};
|
|
618
601
|
(0, _data2.getPercentage)({
|
|
619
|
-
data:
|
|
620
|
-
headers: headers
|
|
602
|
+
data: [product]
|
|
621
603
|
}).then(function (res) {
|
|
622
|
-
setPercentages(res[0]);
|
|
604
|
+
return setPercentages(res[0]);
|
|
623
605
|
});
|
|
624
606
|
setLoading(false);
|
|
625
|
-
_context3.next =
|
|
607
|
+
_context3.next = 16;
|
|
626
608
|
break;
|
|
627
609
|
|
|
628
|
-
case
|
|
629
|
-
_context3.prev =
|
|
610
|
+
case 13:
|
|
611
|
+
_context3.prev = 13;
|
|
630
612
|
_context3.t0 = _context3["catch"](0);
|
|
631
613
|
console.log(_context3.t0);
|
|
632
614
|
|
|
633
|
-
case
|
|
615
|
+
case 16:
|
|
634
616
|
case "end":
|
|
635
617
|
return _context3.stop();
|
|
636
618
|
}
|
|
637
619
|
}
|
|
638
|
-
}, _callee3, null, [[0,
|
|
620
|
+
}, _callee3, null, [[0, 13]]);
|
|
639
621
|
}));
|
|
640
622
|
|
|
641
623
|
return function loadData() {
|
|
@@ -644,7 +626,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
644
626
|
}();
|
|
645
627
|
|
|
646
628
|
var getServices = /*#__PURE__*/function () {
|
|
647
|
-
var
|
|
629
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
648
630
|
var _product$article7, _product$article8, _servicesResponse$dat;
|
|
649
631
|
|
|
650
632
|
var servicesResponse, parsedResponse, retailers, retailerResponse, active;
|
|
@@ -677,7 +659,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
677
659
|
}));
|
|
678
660
|
|
|
679
661
|
return function getServices() {
|
|
680
|
-
return
|
|
662
|
+
return _ref6.apply(this, arguments);
|
|
681
663
|
};
|
|
682
664
|
}();
|
|
683
665
|
|
|
@@ -691,7 +673,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
691
673
|
};
|
|
692
674
|
|
|
693
675
|
var getComments = /*#__PURE__*/function () {
|
|
694
|
-
var
|
|
676
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
695
677
|
var _product$article9, _product$article10, _product$article11;
|
|
696
678
|
|
|
697
679
|
var tab,
|
|
@@ -726,7 +708,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
726
708
|
}));
|
|
727
709
|
|
|
728
710
|
return function getComments() {
|
|
729
|
-
return
|
|
711
|
+
return _ref7.apply(this, arguments);
|
|
730
712
|
};
|
|
731
713
|
}();
|
|
732
714
|
|
|
@@ -843,7 +825,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
843
825
|
setActivePercentage((_retailers$ = retailers[0]) === null || _retailers$ === void 0 ? void 0 : _retailers$.percentage);
|
|
844
826
|
}, [percentages]);
|
|
845
827
|
(0, _react.useEffect)(function () {
|
|
846
|
-
|
|
828
|
+
(0, _utils.getInputsData)(services, activeRetailer, setDatasheets, setDescriptions);
|
|
847
829
|
auditableVersion && loadAuditableData();
|
|
848
830
|
setActivePercentage(Math.round(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.percentage, 0));
|
|
849
831
|
(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && setImages({
|
|
@@ -897,7 +879,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
897
879
|
};
|
|
898
880
|
|
|
899
881
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
900
|
-
var
|
|
882
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
901
883
|
var dataClean, _product$article12, productTemp, articleId, dataObject, res, _JSON$parse2, newStatus, newArticleStatus;
|
|
902
884
|
|
|
903
885
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
@@ -965,12 +947,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
965
947
|
}));
|
|
966
948
|
|
|
967
949
|
return function saveDescriptions() {
|
|
968
|
-
return
|
|
950
|
+
return _ref9.apply(this, arguments);
|
|
969
951
|
};
|
|
970
952
|
}();
|
|
971
953
|
|
|
972
954
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
973
|
-
var
|
|
955
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
974
956
|
var dataClean, _product$article13, productTemp, articleId, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
|
|
975
957
|
|
|
976
958
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
@@ -1038,7 +1020,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1038
1020
|
}));
|
|
1039
1021
|
|
|
1040
1022
|
return function saveDatasheets() {
|
|
1041
|
-
return
|
|
1023
|
+
return _ref10.apply(this, arguments);
|
|
1042
1024
|
};
|
|
1043
1025
|
}();
|
|
1044
1026
|
|
|
@@ -1326,8 +1308,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1326
1308
|
break;
|
|
1327
1309
|
}
|
|
1328
1310
|
|
|
1329
|
-
var services = servicesData.filter(function (
|
|
1330
|
-
var service =
|
|
1311
|
+
var services = servicesData.filter(function (_ref13) {
|
|
1312
|
+
var service = _ref13.service;
|
|
1331
1313
|
return concepts.includes(service);
|
|
1332
1314
|
});
|
|
1333
1315
|
var adminFacilitatorCanEvaluate = services.every(function (srv) {
|
|
@@ -1361,10 +1343,83 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1361
1343
|
default:
|
|
1362
1344
|
break;
|
|
1363
1345
|
}
|
|
1364
|
-
};
|
|
1346
|
+
}; // const sendToFacilitator = async (result) => {
|
|
1347
|
+
// setLoading(true);
|
|
1348
|
+
// try {
|
|
1349
|
+
// let concept = getConcept(activeTab);
|
|
1350
|
+
// const productTemp = { ...product };
|
|
1351
|
+
// const evalStatus = retailerStatus;
|
|
1352
|
+
// const articleId = product.article.id_article;
|
|
1353
|
+
// const orderId = product.orderId;
|
|
1354
|
+
// // const body = {
|
|
1355
|
+
// // orderArticleRetailers: [
|
|
1356
|
+
// // { orderId, articleId, retailersIds: [activeRetailer.id] },
|
|
1357
|
+
// // ],
|
|
1358
|
+
// // isAproved: false,
|
|
1359
|
+
// // service: concept,
|
|
1360
|
+
// // };
|
|
1361
|
+
// const body = {
|
|
1362
|
+
// articleId: product.article.id_article,
|
|
1363
|
+
// orderId: product.orderId,
|
|
1364
|
+
// concept: concept,
|
|
1365
|
+
// result: result,
|
|
1366
|
+
// evalStatus: evalStatus,
|
|
1367
|
+
// retailerId: activeRetailer.id,
|
|
1368
|
+
// };
|
|
1369
|
+
// let res;
|
|
1370
|
+
// let message;
|
|
1371
|
+
// if (result) {
|
|
1372
|
+
// body.isAproved = result === "A";
|
|
1373
|
+
// res = await axios.put(
|
|
1374
|
+
// `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
|
|
1375
|
+
// body,
|
|
1376
|
+
// {
|
|
1377
|
+
// headers: {
|
|
1378
|
+
// Authorization: token,
|
|
1379
|
+
// },
|
|
1380
|
+
// }
|
|
1381
|
+
// );
|
|
1382
|
+
// console.log(JSON.parse(res.data.body), "res");
|
|
1383
|
+
// getServices();
|
|
1384
|
+
// } else {
|
|
1385
|
+
// const specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
|
|
1386
|
+
// if (specialistDone) {
|
|
1387
|
+
// message = `${activeTab} enviada a facilitador`;
|
|
1388
|
+
// getSectionIcon();
|
|
1389
|
+
// } else if (["IE", "AC", "RP", "RCA"].includes(evalStatus)) {
|
|
1390
|
+
// message = "Evaluación enviada";
|
|
1391
|
+
// getSectionIcon();
|
|
1392
|
+
// }
|
|
1393
|
+
// res = await axios.put(
|
|
1394
|
+
// `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
|
|
1395
|
+
// body,
|
|
1396
|
+
// {
|
|
1397
|
+
// headers: {
|
|
1398
|
+
// Authorization: token,
|
|
1399
|
+
// },
|
|
1400
|
+
// }
|
|
1401
|
+
// );
|
|
1402
|
+
// }
|
|
1403
|
+
// if (res.data.statusCode === 200) {
|
|
1404
|
+
// const response = JSON.parse(res.data.body)?.successfulData;
|
|
1405
|
+
// const statusObject =
|
|
1406
|
+
// response[`${orderId}-${articleId}-${activeRetailer.id}`];
|
|
1407
|
+
// productTemp.status = statusObject["generalStatus"];
|
|
1408
|
+
// productTemp[`${concept}_status`] = statusObject[`${concept}Status`];
|
|
1409
|
+
// await loadData();
|
|
1410
|
+
// if (message) setMessage(message);
|
|
1411
|
+
// sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1412
|
+
// setProduct(productTemp);
|
|
1413
|
+
// }
|
|
1414
|
+
// } catch (error) {
|
|
1415
|
+
// console.log(error);
|
|
1416
|
+
// }
|
|
1417
|
+
// setLoading(false);
|
|
1418
|
+
// };
|
|
1419
|
+
|
|
1365
1420
|
|
|
1366
1421
|
var sendToFacilitator = /*#__PURE__*/function () {
|
|
1367
|
-
var
|
|
1422
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(result) {
|
|
1368
1423
|
var concept, productTemp, evalStatus, articleId, orderId, data, res, _message, specialistDone, _JSON$parse5, newStatus, newOrderStatus, newArticleStatus, messageToChat, _data;
|
|
1369
1424
|
|
|
1370
1425
|
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
@@ -1484,7 +1539,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1484
1539
|
}));
|
|
1485
1540
|
|
|
1486
1541
|
return function sendToFacilitator(_x) {
|
|
1487
|
-
return
|
|
1542
|
+
return _ref14.apply(this, arguments);
|
|
1488
1543
|
};
|
|
1489
1544
|
}();
|
|
1490
1545
|
|
|
@@ -1515,7 +1570,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1515
1570
|
};
|
|
1516
1571
|
|
|
1517
1572
|
var createComment = /*#__PURE__*/function () {
|
|
1518
|
-
var
|
|
1573
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1519
1574
|
var messages,
|
|
1520
1575
|
retailerId,
|
|
1521
1576
|
data,
|
|
@@ -1550,7 +1605,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1550
1605
|
}));
|
|
1551
1606
|
|
|
1552
1607
|
return function createComment() {
|
|
1553
|
-
return
|
|
1608
|
+
return _ref15.apply(this, arguments);
|
|
1554
1609
|
};
|
|
1555
1610
|
}();
|
|
1556
1611
|
|
|
@@ -1628,7 +1683,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1628
1683
|
}, [activeTab]);
|
|
1629
1684
|
|
|
1630
1685
|
var commentRevised = /*#__PURE__*/function () {
|
|
1631
|
-
var
|
|
1686
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
1632
1687
|
var data;
|
|
1633
1688
|
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1634
1689
|
while (1) {
|
|
@@ -1658,12 +1713,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1658
1713
|
}));
|
|
1659
1714
|
|
|
1660
1715
|
return function commentRevised() {
|
|
1661
|
-
return
|
|
1716
|
+
return _ref16.apply(this, arguments);
|
|
1662
1717
|
};
|
|
1663
1718
|
}();
|
|
1664
1719
|
|
|
1665
1720
|
var setAssignation = /*#__PURE__*/function () {
|
|
1666
|
-
var
|
|
1721
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(assignationType, assignationId) {
|
|
1667
1722
|
var _product$article16;
|
|
1668
1723
|
|
|
1669
1724
|
var concept, productTemp, data;
|
|
@@ -1722,7 +1777,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1722
1777
|
}));
|
|
1723
1778
|
|
|
1724
1779
|
return function setAssignation(_x2, _x3) {
|
|
1725
|
-
return
|
|
1780
|
+
return _ref17.apply(this, arguments);
|
|
1726
1781
|
};
|
|
1727
1782
|
}();
|
|
1728
1783
|
|
|
@@ -1832,10 +1887,67 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1832
1887
|
}, [services, servicesData, activeTab]);
|
|
1833
1888
|
(0, _react.useEffect)(function () {
|
|
1834
1889
|
setSaving(loading);
|
|
1835
|
-
}, [loading]);
|
|
1890
|
+
}, [loading]); // const validateAll = async (result) => {
|
|
1891
|
+
// try {
|
|
1892
|
+
// setLoading(true);
|
|
1893
|
+
// const evaluationArray = [];
|
|
1894
|
+
// let conceptArray = ["description", "datasheet", "images"];
|
|
1895
|
+
// switch (user.id_role) {
|
|
1896
|
+
// case 4:
|
|
1897
|
+
// conceptArray = ["description", "datasheet"];
|
|
1898
|
+
// break;
|
|
1899
|
+
// case 5:
|
|
1900
|
+
// conceptArray = ["images"];
|
|
1901
|
+
// break;
|
|
1902
|
+
// default:
|
|
1903
|
+
// conceptArray = ["description", "datasheet", "images"];
|
|
1904
|
+
// break;
|
|
1905
|
+
// }
|
|
1906
|
+
// const isAproved = result === "A";
|
|
1907
|
+
// const retailersIds = [];
|
|
1908
|
+
// servicesData?.forEach((ret) => {
|
|
1909
|
+
// if (!retailersIds.includes(ret.id_retailer))
|
|
1910
|
+
// retailersIds.push(ret.id_retailer);
|
|
1911
|
+
// });
|
|
1912
|
+
// const body = {
|
|
1913
|
+
// orderArticleRetailers: [
|
|
1914
|
+
// {
|
|
1915
|
+
// orderId: product.id_order ?? product.orderId,
|
|
1916
|
+
// articleId: product.article.id_article,
|
|
1917
|
+
// retailersIds,
|
|
1918
|
+
// },
|
|
1919
|
+
// ],
|
|
1920
|
+
// isAproved,
|
|
1921
|
+
// };
|
|
1922
|
+
// conceptArray.forEach((concept) => {
|
|
1923
|
+
// body.service = concept;
|
|
1924
|
+
// evaluationArray.push(
|
|
1925
|
+
// axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, body, {
|
|
1926
|
+
// headers: {
|
|
1927
|
+
// Authorization: token,
|
|
1928
|
+
// },
|
|
1929
|
+
// })
|
|
1930
|
+
// );
|
|
1931
|
+
// });
|
|
1932
|
+
// await Promise.all(evaluationArray);
|
|
1933
|
+
// const productTemp = product;
|
|
1934
|
+
// productTemp.status = `${result}A`;
|
|
1935
|
+
// productTemp.datasheet_status =
|
|
1936
|
+
// productTemp.datasheet_status === "NA" ? "NA" : `${result}A`;
|
|
1937
|
+
// productTemp.description_status =
|
|
1938
|
+
// productTemp.description_status === "NA" ? "NA" : `${result}A`;
|
|
1939
|
+
// productTemp.images_status =
|
|
1940
|
+
// productTemp.images_status === "NA" ? "NA" : `${result}A`;
|
|
1941
|
+
// sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1942
|
+
// setProduct(productTemp);
|
|
1943
|
+
// await loadData();
|
|
1944
|
+
// } catch (error) {
|
|
1945
|
+
// console.log(error);
|
|
1946
|
+
// }
|
|
1947
|
+
// };
|
|
1836
1948
|
|
|
1837
1949
|
var validateAll = /*#__PURE__*/function () {
|
|
1838
|
-
var
|
|
1950
|
+
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
|
|
1839
1951
|
var evaluationArray, conceptArray, messages, productTemp, messagesResponse;
|
|
1840
1952
|
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
1841
1953
|
while (1) {
|
|
@@ -1919,45 +2031,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1919
2031
|
}));
|
|
1920
2032
|
|
|
1921
2033
|
return function validateAll(_x4) {
|
|
1922
|
-
return
|
|
1923
|
-
};
|
|
1924
|
-
}();
|
|
1925
|
-
|
|
1926
|
-
var getObservation = /*#__PURE__*/function () {
|
|
1927
|
-
var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
1928
|
-
var response, parseData;
|
|
1929
|
-
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
1930
|
-
while (1) {
|
|
1931
|
-
switch (_context16.prev = _context16.next) {
|
|
1932
|
-
case 0:
|
|
1933
|
-
_context16.next = 2;
|
|
1934
|
-
return _axios.default.get("".concat(process.env.REACT_APP_READ_OBSERVATION, "?articleId=").concat(product.article.id_article, "&orderId=").concat(product === null || product === void 0 ? void 0 : product.orderId), {
|
|
1935
|
-
headers: {
|
|
1936
|
-
Authorization: sessionStorage.getItem("jwt")
|
|
1937
|
-
}
|
|
1938
|
-
});
|
|
1939
|
-
|
|
1940
|
-
case 2:
|
|
1941
|
-
response = _context16.sent;
|
|
1942
|
-
parseData = JSON.parse(response.data.body).data[0];
|
|
1943
|
-
setObservation(parseData.observations);
|
|
1944
|
-
|
|
1945
|
-
case 5:
|
|
1946
|
-
case "end":
|
|
1947
|
-
return _context16.stop();
|
|
1948
|
-
}
|
|
1949
|
-
}
|
|
1950
|
-
}, _callee16);
|
|
1951
|
-
}));
|
|
1952
|
-
|
|
1953
|
-
return function getObservation() {
|
|
1954
|
-
return _ref20.apply(this, arguments);
|
|
2034
|
+
return _ref18.apply(this, arguments);
|
|
1955
2035
|
};
|
|
1956
2036
|
}();
|
|
1957
2037
|
|
|
1958
|
-
(0, _react.useEffect)(function () {
|
|
1959
|
-
getObservation();
|
|
1960
|
-
}, []);
|
|
1961
2038
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
1962
2039
|
headerTop: headerTop,
|
|
1963
2040
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
@@ -2002,7 +2079,6 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
2002
2079
|
className: "product-information",
|
|
2003
2080
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader, {
|
|
2004
2081
|
headerData: product,
|
|
2005
|
-
productObservation: observation,
|
|
2006
2082
|
percent: activePercentage,
|
|
2007
2083
|
activeRetailer: activeRetailer,
|
|
2008
2084
|
servicesData: servicesData,
|
|
@@ -2177,18 +2253,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
2177
2253
|
type: "pink",
|
|
2178
2254
|
label: "Aceptar",
|
|
2179
2255
|
size: 12,
|
|
2180
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2256
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
2181
2257
|
var body, messages;
|
|
2182
|
-
return _regenerator.default.wrap(function
|
|
2258
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
2183
2259
|
while (1) {
|
|
2184
|
-
switch (
|
|
2260
|
+
switch (_context16.prev = _context16.next) {
|
|
2185
2261
|
case 0:
|
|
2186
2262
|
body = document.querySelector("#modal-message-box .ql-container .ql-editor > p").innerHTML;
|
|
2187
2263
|
messages = [{
|
|
2188
2264
|
type: "message",
|
|
2189
2265
|
value: body === null || body === void 0 ? void 0 : body.replace(/<.*?\/?>/gm, "")
|
|
2190
2266
|
}];
|
|
2191
|
-
|
|
2267
|
+
_context16.next = 4;
|
|
2192
2268
|
return createComment(messages, activeRetailer.id);
|
|
2193
2269
|
|
|
2194
2270
|
case 4:
|
|
@@ -2198,10 +2274,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
2198
2274
|
|
|
2199
2275
|
case 7:
|
|
2200
2276
|
case "end":
|
|
2201
|
-
return
|
|
2277
|
+
return _context16.stop();
|
|
2202
2278
|
}
|
|
2203
2279
|
}
|
|
2204
|
-
},
|
|
2280
|
+
}, _callee16);
|
|
2205
2281
|
}))
|
|
2206
2282
|
}, "btn-Aceptar")]
|
|
2207
2283
|
})]
|
|
@@ -134,31 +134,46 @@ var getPercentage = /*#__PURE__*/function () {
|
|
|
134
134
|
|
|
135
135
|
func = /*#__PURE__*/function () {
|
|
136
136
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
137
|
-
var
|
|
138
|
-
|
|
139
|
-
var headers;
|
|
137
|
+
var dataToSend, arrayRetailers, retailers;
|
|
140
138
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
141
139
|
while (1) {
|
|
142
140
|
switch (_context2.prev = _context2.next) {
|
|
143
141
|
case 0:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
142
|
+
dataToSend = [];
|
|
143
|
+
arrayRetailers = [];
|
|
144
|
+
retailers = params.data[0].retailers || params.data[0].retailersAvailable;
|
|
145
|
+
params.data.forEach(function (product, i) {
|
|
146
|
+
dataToSend.push(product.article ? {
|
|
147
|
+
id_article: product.article.id_article,
|
|
148
|
+
id_category: product.article.id_category,
|
|
149
|
+
version: product.version
|
|
150
|
+
} : {
|
|
151
|
+
id_article: product.id_article,
|
|
152
|
+
id_category: product.id_category,
|
|
153
|
+
version: product.version
|
|
154
|
+
});
|
|
155
|
+
retailers.forEach(function (retailer) {
|
|
156
|
+
arrayRetailers.push(retailer.id);
|
|
157
|
+
});
|
|
158
|
+
dataToSend[i].id_retailer_array = arrayRetailers;
|
|
159
|
+
});
|
|
160
|
+
_context2.next = 6;
|
|
148
161
|
return _axios.default.post(process.env.REACT_APP_VALID_EXPORT_ENDPOINT, {
|
|
149
|
-
data:
|
|
162
|
+
data: dataToSend
|
|
150
163
|
}, {
|
|
151
|
-
headers:
|
|
164
|
+
headers: {
|
|
165
|
+
Authorization: sessionStorage.getItem("jwt")
|
|
166
|
+
}
|
|
152
167
|
}).then(function (response) {
|
|
153
168
|
return [response.data];
|
|
154
169
|
}).catch(function (err) {
|
|
155
170
|
return console.log(err, "Errror");
|
|
156
171
|
});
|
|
157
172
|
|
|
158
|
-
case
|
|
173
|
+
case 6:
|
|
159
174
|
return _context2.abrupt("return", _context2.sent);
|
|
160
175
|
|
|
161
|
-
case
|
|
176
|
+
case 7:
|
|
162
177
|
case "end":
|
|
163
178
|
return _context2.stop();
|
|
164
179
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentoh-components-library",
|
|
3
|
-
"version": "21.4.
|
|
3
|
+
"version": "21.4.83",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@aws-amplify/auth": "^4.5.3",
|
|
6
6
|
"@aws-amplify/datastore": "^3.11.0",
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
"babel-preset-react-app": "^10.0.1",
|
|
28
28
|
"caniuse-lite": "^1.0.30001472",
|
|
29
29
|
"chart.js": "^3.7.1",
|
|
30
|
-
"contentoh-components-library": "^21.4.75",
|
|
31
30
|
"draft-js": "^0.11.7",
|
|
32
31
|
"file-saver": "^2.0.5",
|
|
33
32
|
"infinite-react-carousel": "^1.2.11",
|
|
@@ -3,7 +3,6 @@ import { ScreenHeader } from "../../atoms/ScreenHeader/index";
|
|
|
3
3
|
import { Status } from "../../atoms/Status/index";
|
|
4
4
|
import { ProgressBar } from "../../atoms/ProgressBar/index";
|
|
5
5
|
import { PriorityFlag } from "../../atoms/PriorityFlag/index";
|
|
6
|
-
import { ObservationFlag } from "../../atoms/ObservationFlag/index";
|
|
7
6
|
|
|
8
7
|
export const ProductNameHeader = ({
|
|
9
8
|
productName,
|
|
@@ -11,9 +10,7 @@ export const ProductNameHeader = ({
|
|
|
11
10
|
priority,
|
|
12
11
|
date,
|
|
13
12
|
percentRequired,
|
|
14
|
-
productObservation
|
|
15
13
|
}) => {
|
|
16
|
-
const typeFlag = productObservation!== null && productObservation !== "" ? "high" : "low";
|
|
17
14
|
return (
|
|
18
15
|
<Container>
|
|
19
16
|
<ScreenHeader headerType={"product-name-header"} text={productName} />
|
|
@@ -23,8 +20,7 @@ export const ProductNameHeader = ({
|
|
|
23
20
|
progressBarType={statusType}
|
|
24
21
|
percentRequired={percentRequired}
|
|
25
22
|
/>
|
|
26
|
-
|
|
27
|
-
<ObservationFlag observation={typeFlag}contentObservation={productObservation}/>
|
|
23
|
+
<PriorityFlag priority={priority} />
|
|
28
24
|
<ScreenHeader headerType={"date-header"} text={date} />
|
|
29
25
|
</Container>
|
|
30
26
|
);
|
|
@@ -45,8 +45,6 @@ export const EditGroup = ({ token, show, onClose }) => {
|
|
|
45
45
|
const [inputValue, setInputValue] = useState([]);
|
|
46
46
|
const [shouldClose, setShouldClose] = useState(false);
|
|
47
47
|
|
|
48
|
-
const modalRef = useRef();
|
|
49
|
-
|
|
50
48
|
useEffect(() => {}, [groups]);
|
|
51
49
|
|
|
52
50
|
useEffect(() => {
|
|
@@ -246,7 +244,7 @@ export const EditGroup = ({ token, show, onClose }) => {
|
|
|
246
244
|
onClick={onClose}
|
|
247
245
|
>
|
|
248
246
|
<Fade in={show} timeout={400}>
|
|
249
|
-
<Container
|
|
247
|
+
<Container>
|
|
250
248
|
<div className={`contentModal`}>
|
|
251
249
|
<div className="header">
|
|
252
250
|
<h2 className="title-edit">Editar grupos</h2>
|
|
@@ -17,7 +17,6 @@ export const FullProductNameHeader = ({
|
|
|
17
17
|
rejectAll,
|
|
18
18
|
servicesData,
|
|
19
19
|
showApproveRejectAll,
|
|
20
|
-
productObservation
|
|
21
20
|
}) => {
|
|
22
21
|
const [retailers, setRetailers] = useState([]);
|
|
23
22
|
|
|
@@ -53,7 +52,6 @@ export const FullProductNameHeader = ({
|
|
|
53
52
|
percentRequired={percent}
|
|
54
53
|
percent={percent?.toFixed(0)}
|
|
55
54
|
priority={headerData?.prio}
|
|
56
|
-
productObservation={productObservation}
|
|
57
55
|
date={getTime(headerData?.article?.timestamp || headerData?.timestamp)}
|
|
58
56
|
/>
|
|
59
57
|
<div className="features-bar-container">
|