contentoh-components-library 21.4.83 → 21.4.84
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 +8 -3
- package/dist/components/organisms/EditGroup/index.js +0 -11
- package/dist/components/organisms/FullProductNameHeader/index.js +3 -1
- package/dist/components/organisms/VersionSelector/index.js +101 -169
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +34 -38
- package/dist/components/pages/ProviderProductEdition/index.js +71 -53
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +47 -52
- package/dist/components/pages/RetailerProductEdition/index.js +101 -177
- package/dist/global-files/data.js +11 -26
- package/package.json +2 -1
- package/src/components/atoms/GeneralButton/styles.js +1 -0
- package/src/components/atoms/ObservationFlag/ObservationFlag.stories.js +20 -0
- package/src/components/atoms/ObservationFlag/index.js +33 -0
- package/src/components/atoms/ObservationFlag/styles.js +3 -0
- package/src/components/atoms/TabSection/index.js +1 -1
- package/src/components/molecules/ProductNameHeader/index.js +5 -1
- package/src/components/organisms/EditGroup/index.js +0 -8
- package/src/components/organisms/FullProductNameHeader/index.js +2 -0
- package/src/components/organisms/VersionSelector/index.js +100 -100
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +39 -29
- package/src/components/pages/ProviderProductEdition/index.js +34 -21
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +48 -52
- package/src/components/pages/RetailerProductEdition/index.js +32 -144
- package/src/global-files/data.js +7 -33
|
@@ -482,25 +482,30 @@ 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)(),
|
|
486
486
|
_useState84 = (0, _slicedToArray2.default)(_useState83, 2),
|
|
487
|
-
|
|
488
|
-
|
|
487
|
+
observation = _useState84[0],
|
|
488
|
+
setObservation = _useState84[1];
|
|
489
489
|
|
|
490
|
-
var _useState85 = (0, _react.useState)(
|
|
490
|
+
var _useState85 = (0, _react.useState)(false),
|
|
491
491
|
_useState86 = (0, _slicedToArray2.default)(_useState85, 2),
|
|
492
|
-
|
|
493
|
-
|
|
492
|
+
valRejAll = _useState86[0],
|
|
493
|
+
setValRejAll = _useState86[1];
|
|
494
494
|
|
|
495
495
|
var _useState87 = (0, _react.useState)([]),
|
|
496
496
|
_useState88 = (0, _slicedToArray2.default)(_useState87, 2),
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
desc = _useState88[0],
|
|
498
|
+
setDesc = _useState88[1];
|
|
499
499
|
|
|
500
500
|
var _useState89 = (0, _react.useState)([]),
|
|
501
501
|
_useState90 = (0, _slicedToArray2.default)(_useState89, 2),
|
|
502
|
-
|
|
503
|
-
|
|
502
|
+
fich = _useState90[0],
|
|
503
|
+
setFich = _useState90[1];
|
|
504
|
+
|
|
505
|
+
var _useState91 = (0, _react.useState)([]),
|
|
506
|
+
_useState92 = (0, _slicedToArray2.default)(_useState91, 2),
|
|
507
|
+
imag = _useState92[0],
|
|
508
|
+
setImag = _useState92[1];
|
|
504
509
|
|
|
505
510
|
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
506
511
|
var _ref3, id_article;
|
|
@@ -573,7 +578,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
573
578
|
|
|
574
579
|
var loadData = /*#__PURE__*/function () {
|
|
575
580
|
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
576
|
-
var _product$article4, _product$article5, _product$article6, _services$, _services$$values, _services;
|
|
581
|
+
var _product$article4, _product$article5, _product$article6, _services$, _services$$values, _product$retailersAva, _services, data, headers;
|
|
577
582
|
|
|
578
583
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
579
584
|
while (1) {
|
|
@@ -598,26 +603,39 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
598
603
|
init: _services[2]
|
|
599
604
|
});
|
|
600
605
|
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
|
+
};
|
|
601
618
|
(0, _data2.getPercentage)({
|
|
602
|
-
data:
|
|
619
|
+
data: data,
|
|
620
|
+
headers: headers
|
|
603
621
|
}).then(function (res) {
|
|
604
|
-
|
|
622
|
+
setPercentages(res[0]);
|
|
605
623
|
});
|
|
606
624
|
setLoading(false);
|
|
607
|
-
_context3.next =
|
|
625
|
+
_context3.next = 18;
|
|
608
626
|
break;
|
|
609
627
|
|
|
610
|
-
case
|
|
611
|
-
_context3.prev =
|
|
628
|
+
case 15:
|
|
629
|
+
_context3.prev = 15;
|
|
612
630
|
_context3.t0 = _context3["catch"](0);
|
|
613
631
|
console.log(_context3.t0);
|
|
614
632
|
|
|
615
|
-
case
|
|
633
|
+
case 18:
|
|
616
634
|
case "end":
|
|
617
635
|
return _context3.stop();
|
|
618
636
|
}
|
|
619
637
|
}
|
|
620
|
-
}, _callee3, null, [[0,
|
|
638
|
+
}, _callee3, null, [[0, 15]]);
|
|
621
639
|
}));
|
|
622
640
|
|
|
623
641
|
return function loadData() {
|
|
@@ -626,7 +644,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
626
644
|
}();
|
|
627
645
|
|
|
628
646
|
var getServices = /*#__PURE__*/function () {
|
|
629
|
-
var
|
|
647
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
630
648
|
var _product$article7, _product$article8, _servicesResponse$dat;
|
|
631
649
|
|
|
632
650
|
var servicesResponse, parsedResponse, retailers, retailerResponse, active;
|
|
@@ -659,7 +677,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
659
677
|
}));
|
|
660
678
|
|
|
661
679
|
return function getServices() {
|
|
662
|
-
return
|
|
680
|
+
return _ref7.apply(this, arguments);
|
|
663
681
|
};
|
|
664
682
|
}();
|
|
665
683
|
|
|
@@ -673,7 +691,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
673
691
|
};
|
|
674
692
|
|
|
675
693
|
var getComments = /*#__PURE__*/function () {
|
|
676
|
-
var
|
|
694
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
677
695
|
var _product$article9, _product$article10, _product$article11;
|
|
678
696
|
|
|
679
697
|
var tab,
|
|
@@ -708,7 +726,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
708
726
|
}));
|
|
709
727
|
|
|
710
728
|
return function getComments() {
|
|
711
|
-
return
|
|
729
|
+
return _ref8.apply(this, arguments);
|
|
712
730
|
};
|
|
713
731
|
}();
|
|
714
732
|
|
|
@@ -825,7 +843,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
825
843
|
setActivePercentage((_retailers$ = retailers[0]) === null || _retailers$ === void 0 ? void 0 : _retailers$.percentage);
|
|
826
844
|
}, [percentages]);
|
|
827
845
|
(0, _react.useEffect)(function () {
|
|
828
|
-
|
|
846
|
+
//getInputsData(services, activeRetailer, setDatasheets, setDescriptions);
|
|
829
847
|
auditableVersion && loadAuditableData();
|
|
830
848
|
setActivePercentage(Math.round(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.percentage, 0));
|
|
831
849
|
(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && setImages({
|
|
@@ -879,7 +897,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
879
897
|
};
|
|
880
898
|
|
|
881
899
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
882
|
-
var
|
|
900
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
883
901
|
var dataClean, _product$article12, productTemp, articleId, dataObject, res, _JSON$parse2, newStatus, newArticleStatus;
|
|
884
902
|
|
|
885
903
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
@@ -947,12 +965,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
947
965
|
}));
|
|
948
966
|
|
|
949
967
|
return function saveDescriptions() {
|
|
950
|
-
return
|
|
968
|
+
return _ref10.apply(this, arguments);
|
|
951
969
|
};
|
|
952
970
|
}();
|
|
953
971
|
|
|
954
972
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
955
|
-
var
|
|
973
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
956
974
|
var dataClean, _product$article13, productTemp, articleId, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
|
|
957
975
|
|
|
958
976
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
@@ -1020,7 +1038,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1020
1038
|
}));
|
|
1021
1039
|
|
|
1022
1040
|
return function saveDatasheets() {
|
|
1023
|
-
return
|
|
1041
|
+
return _ref11.apply(this, arguments);
|
|
1024
1042
|
};
|
|
1025
1043
|
}();
|
|
1026
1044
|
|
|
@@ -1308,8 +1326,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1308
1326
|
break;
|
|
1309
1327
|
}
|
|
1310
1328
|
|
|
1311
|
-
var services = servicesData.filter(function (
|
|
1312
|
-
var service =
|
|
1329
|
+
var services = servicesData.filter(function (_ref14) {
|
|
1330
|
+
var service = _ref14.service;
|
|
1313
1331
|
return concepts.includes(service);
|
|
1314
1332
|
});
|
|
1315
1333
|
var adminFacilitatorCanEvaluate = services.every(function (srv) {
|
|
@@ -1343,83 +1361,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1343
1361
|
default:
|
|
1344
1362
|
break;
|
|
1345
1363
|
}
|
|
1346
|
-
};
|
|
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
|
-
|
|
1364
|
+
};
|
|
1420
1365
|
|
|
1421
1366
|
var sendToFacilitator = /*#__PURE__*/function () {
|
|
1422
|
-
var
|
|
1367
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(result) {
|
|
1423
1368
|
var concept, productTemp, evalStatus, articleId, orderId, data, res, _message, specialistDone, _JSON$parse5, newStatus, newOrderStatus, newArticleStatus, messageToChat, _data;
|
|
1424
1369
|
|
|
1425
1370
|
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
@@ -1539,7 +1484,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1539
1484
|
}));
|
|
1540
1485
|
|
|
1541
1486
|
return function sendToFacilitator(_x) {
|
|
1542
|
-
return
|
|
1487
|
+
return _ref15.apply(this, arguments);
|
|
1543
1488
|
};
|
|
1544
1489
|
}();
|
|
1545
1490
|
|
|
@@ -1570,7 +1515,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1570
1515
|
};
|
|
1571
1516
|
|
|
1572
1517
|
var createComment = /*#__PURE__*/function () {
|
|
1573
|
-
var
|
|
1518
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1574
1519
|
var messages,
|
|
1575
1520
|
retailerId,
|
|
1576
1521
|
data,
|
|
@@ -1605,7 +1550,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1605
1550
|
}));
|
|
1606
1551
|
|
|
1607
1552
|
return function createComment() {
|
|
1608
|
-
return
|
|
1553
|
+
return _ref16.apply(this, arguments);
|
|
1609
1554
|
};
|
|
1610
1555
|
}();
|
|
1611
1556
|
|
|
@@ -1683,7 +1628,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1683
1628
|
}, [activeTab]);
|
|
1684
1629
|
|
|
1685
1630
|
var commentRevised = /*#__PURE__*/function () {
|
|
1686
|
-
var
|
|
1631
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
1687
1632
|
var data;
|
|
1688
1633
|
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1689
1634
|
while (1) {
|
|
@@ -1713,12 +1658,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1713
1658
|
}));
|
|
1714
1659
|
|
|
1715
1660
|
return function commentRevised() {
|
|
1716
|
-
return
|
|
1661
|
+
return _ref17.apply(this, arguments);
|
|
1717
1662
|
};
|
|
1718
1663
|
}();
|
|
1719
1664
|
|
|
1720
1665
|
var setAssignation = /*#__PURE__*/function () {
|
|
1721
|
-
var
|
|
1666
|
+
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(assignationType, assignationId) {
|
|
1722
1667
|
var _product$article16;
|
|
1723
1668
|
|
|
1724
1669
|
var concept, productTemp, data;
|
|
@@ -1777,7 +1722,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1777
1722
|
}));
|
|
1778
1723
|
|
|
1779
1724
|
return function setAssignation(_x2, _x3) {
|
|
1780
|
-
return
|
|
1725
|
+
return _ref18.apply(this, arguments);
|
|
1781
1726
|
};
|
|
1782
1727
|
}();
|
|
1783
1728
|
|
|
@@ -1887,67 +1832,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1887
1832
|
}, [services, servicesData, activeTab]);
|
|
1888
1833
|
(0, _react.useEffect)(function () {
|
|
1889
1834
|
setSaving(loading);
|
|
1890
|
-
}, [loading]);
|
|
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
|
-
// };
|
|
1835
|
+
}, [loading]);
|
|
1948
1836
|
|
|
1949
1837
|
var validateAll = /*#__PURE__*/function () {
|
|
1950
|
-
var
|
|
1838
|
+
var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
|
|
1951
1839
|
var evaluationArray, conceptArray, messages, productTemp, messagesResponse;
|
|
1952
1840
|
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
1953
1841
|
while (1) {
|
|
@@ -2031,10 +1919,45 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
2031
1919
|
}));
|
|
2032
1920
|
|
|
2033
1921
|
return function validateAll(_x4) {
|
|
2034
|
-
return
|
|
1922
|
+
return _ref19.apply(this, arguments);
|
|
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);
|
|
2035
1955
|
};
|
|
2036
1956
|
}();
|
|
2037
1957
|
|
|
1958
|
+
(0, _react.useEffect)(function () {
|
|
1959
|
+
getObservation();
|
|
1960
|
+
}, []);
|
|
2038
1961
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
2039
1962
|
headerTop: headerTop,
|
|
2040
1963
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
@@ -2079,6 +2002,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
2079
2002
|
className: "product-information",
|
|
2080
2003
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader, {
|
|
2081
2004
|
headerData: product,
|
|
2005
|
+
productObservation: observation,
|
|
2082
2006
|
percent: activePercentage,
|
|
2083
2007
|
activeRetailer: activeRetailer,
|
|
2084
2008
|
servicesData: servicesData,
|
|
@@ -2253,18 +2177,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
2253
2177
|
type: "pink",
|
|
2254
2178
|
label: "Aceptar",
|
|
2255
2179
|
size: 12,
|
|
2256
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2180
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
2257
2181
|
var body, messages;
|
|
2258
|
-
return _regenerator.default.wrap(function
|
|
2182
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
2259
2183
|
while (1) {
|
|
2260
|
-
switch (
|
|
2184
|
+
switch (_context17.prev = _context17.next) {
|
|
2261
2185
|
case 0:
|
|
2262
2186
|
body = document.querySelector("#modal-message-box .ql-container .ql-editor > p").innerHTML;
|
|
2263
2187
|
messages = [{
|
|
2264
2188
|
type: "message",
|
|
2265
2189
|
value: body === null || body === void 0 ? void 0 : body.replace(/<.*?\/?>/gm, "")
|
|
2266
2190
|
}];
|
|
2267
|
-
|
|
2191
|
+
_context17.next = 4;
|
|
2268
2192
|
return createComment(messages, activeRetailer.id);
|
|
2269
2193
|
|
|
2270
2194
|
case 4:
|
|
@@ -2274,10 +2198,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
2274
2198
|
|
|
2275
2199
|
case 7:
|
|
2276
2200
|
case "end":
|
|
2277
|
-
return
|
|
2201
|
+
return _context17.stop();
|
|
2278
2202
|
}
|
|
2279
2203
|
}
|
|
2280
|
-
},
|
|
2204
|
+
}, _callee17);
|
|
2281
2205
|
}))
|
|
2282
2206
|
}, "btn-Aceptar")]
|
|
2283
2207
|
})]
|
|
@@ -134,46 +134,31 @@ 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
|
|
137
|
+
var _params$headers$Autho, _params$headers;
|
|
138
|
+
|
|
139
|
+
var headers;
|
|
138
140
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
139
141
|
while (1) {
|
|
140
142
|
switch (_context2.prev = _context2.next) {
|
|
141
143
|
case 0:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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;
|
|
144
|
+
headers = {
|
|
145
|
+
Authorization: (_params$headers$Autho = params === null || params === void 0 ? void 0 : (_params$headers = params.headers) === null || _params$headers === void 0 ? void 0 : _params$headers.Authorization) !== null && _params$headers$Autho !== void 0 ? _params$headers$Autho : sessionStorage.getItem("jwt")
|
|
146
|
+
};
|
|
147
|
+
_context2.next = 3;
|
|
161
148
|
return _axios.default.post(process.env.REACT_APP_VALID_EXPORT_ENDPOINT, {
|
|
162
|
-
data:
|
|
149
|
+
data: params.data
|
|
163
150
|
}, {
|
|
164
|
-
headers:
|
|
165
|
-
Authorization: sessionStorage.getItem("jwt")
|
|
166
|
-
}
|
|
151
|
+
headers: headers
|
|
167
152
|
}).then(function (response) {
|
|
168
153
|
return [response.data];
|
|
169
154
|
}).catch(function (err) {
|
|
170
155
|
return console.log(err, "Errror");
|
|
171
156
|
});
|
|
172
157
|
|
|
173
|
-
case
|
|
158
|
+
case 3:
|
|
174
159
|
return _context2.abrupt("return", _context2.sent);
|
|
175
160
|
|
|
176
|
-
case
|
|
161
|
+
case 4:
|
|
177
162
|
case "end":
|
|
178
163
|
return _context2.stop();
|
|
179
164
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentoh-components-library",
|
|
3
|
-
"version": "21.4.
|
|
3
|
+
"version": "21.4.84",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@aws-amplify/auth": "^4.5.3",
|
|
6
6
|
"@aws-amplify/datastore": "^3.11.0",
|
|
@@ -27,6 +27,7 @@
|
|
|
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",
|
|
30
31
|
"draft-js": "^0.11.7",
|
|
31
32
|
"file-saver": "^2.0.5",
|
|
32
33
|
"infinite-react-carousel": "^1.2.11",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ObservationFlag } from "./index";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/atoms/ObservationFlag",
|
|
5
|
+
component: ObservationFlag,
|
|
6
|
+
argTypes: {
|
|
7
|
+
observation: {
|
|
8
|
+
options: ["no priority", "low", "medium", "high"],
|
|
9
|
+
control: { type: "select" },
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Template = (args) => <ObservationFlag {...args} />;
|
|
15
|
+
|
|
16
|
+
export const PriorityFlagDefault = Template.bind({});
|
|
17
|
+
|
|
18
|
+
PriorityFlagDefault.args = {
|
|
19
|
+
observation: "no observation",
|
|
20
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import { Tooltip } from "../Tooltip";
|
|
3
|
+
import without from "../../../assets/images/flags/noPriority.svg";
|
|
4
|
+
import high from "../../../assets/images/flags/highPriority.svg";
|
|
5
|
+
import medium from "../../../assets/images/flags/mediumPriority.svg";
|
|
6
|
+
import low from "../../../assets/images/flags/lowPriority.svg";
|
|
7
|
+
|
|
8
|
+
export const ObservationFlag = ({ observation,contentObservation }) => {
|
|
9
|
+
const PriorityFlags = {
|
|
10
|
+
["none"]: without,
|
|
11
|
+
["low"]: low,
|
|
12
|
+
["medium"]: medium,
|
|
13
|
+
["high"]: high,
|
|
14
|
+
};
|
|
15
|
+
return (
|
|
16
|
+
<Tooltip
|
|
17
|
+
componentTooltip={
|
|
18
|
+
<>
|
|
19
|
+
<p>
|
|
20
|
+
<b>Observaciones del producto</b>
|
|
21
|
+
</p>
|
|
22
|
+
<p>{contentObservation} </p>
|
|
23
|
+
</>
|
|
24
|
+
}
|
|
25
|
+
children={
|
|
26
|
+
<Container>
|
|
27
|
+
<img src={PriorityFlags[observation]} alt={observation} />
|
|
28
|
+
</Container>
|
|
29
|
+
}
|
|
30
|
+
classNameTooltip={"container-tooltip"}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -3,6 +3,7 @@ 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";
|
|
6
7
|
|
|
7
8
|
export const ProductNameHeader = ({
|
|
8
9
|
productName,
|
|
@@ -10,7 +11,9 @@ export const ProductNameHeader = ({
|
|
|
10
11
|
priority,
|
|
11
12
|
date,
|
|
12
13
|
percentRequired,
|
|
14
|
+
productObservation
|
|
13
15
|
}) => {
|
|
16
|
+
const typeFlag = productObservation!== null && productObservation !== "" ? "high" : "low";
|
|
14
17
|
return (
|
|
15
18
|
<Container>
|
|
16
19
|
<ScreenHeader headerType={"product-name-header"} text={productName} />
|
|
@@ -20,7 +23,8 @@ export const ProductNameHeader = ({
|
|
|
20
23
|
progressBarType={statusType}
|
|
21
24
|
percentRequired={percentRequired}
|
|
22
25
|
/>
|
|
23
|
-
<PriorityFlag priority={priority} />
|
|
26
|
+
{/* <PriorityFlag priority={priority} /> */}
|
|
27
|
+
<ObservationFlag observation={typeFlag}contentObservation={productObservation}/>
|
|
24
28
|
<ScreenHeader headerType={"date-header"} text={date} />
|
|
25
29
|
</Container>
|
|
26
30
|
);
|