contentoh-components-library 21.4.60 → 21.4.61

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.
@@ -899,7 +899,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
899
899
  switch (_context8.prev = _context8.next) {
900
900
  case 0:
901
901
  _context8.next = 2;
902
- return (0, _data.getRetailerServices)((product === null || product === void 0 ? void 0 : product.id_article) || (product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article), (product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.company_name) || (product === null || product === void 0 ? void 0 : product.categoryName), parseInt((product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_category) || (product === null || product === void 0 ? void 0 : product.id_category)), version);
902
+ return (0, _data.getRetailerServices)((product === null || product === void 0 ? void 0 : product.id_article) || (product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article), (product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.company_name) || (product === null || product === void 0 ? void 0 : product.categoryName), parseInt((product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_category) || (product === null || product === void 0 ? void 0 : product.id_category)), version, token);
903
903
 
904
904
  case 2:
905
905
  services = _context8.sent;
@@ -1702,7 +1702,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1702
1702
  var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(result) {
1703
1703
  var _productTemp$id_order2;
1704
1704
 
1705
- var concept, productTemp, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, res, body, _JSON$parse, response, newStatuses, statusObject, orderStatus, serviceStatus, newProductEdit, showSurveyByProvider, showSurveyByRetailer, _JSON$parse2, _response, _statusObject, retailerStatusCopy, status;
1705
+ var concept, productTemp, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, res, newStatuses, orderStatus, serviceStatus, newProductEdit, showSurveyByProvider, showSurveyByRetailer, _JSON$parse, newArticleStatus, newServiceStatus, newStatus, retailerStatusCopy, status;
1706
1706
 
1707
1707
  return _regenerator.default.wrap(function _callee18$(_context18) {
1708
1708
  while (1) {
@@ -1723,24 +1723,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1723
1723
  };
1724
1724
  retailerId = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id;
1725
1725
  _context18.prev = 9;
1726
- body = {
1727
- orderArticleRetailers: [{
1728
- orderId: orderId,
1729
- articleId: articleId,
1730
- retailersIds: [activeRetailer.id]
1731
- }],
1732
- isAproved: false,
1733
- service: concept
1734
- };
1735
1726
 
1736
1727
  if (!result) {
1737
- _context18.next = 29;
1728
+ _context18.next = 27;
1738
1729
  break;
1739
1730
  }
1740
1731
 
1741
- body.isAproved = result === "A";
1732
+ data.result = result;
1733
+ data.retailerId = retailerId;
1742
1734
  _context18.next = 15;
1743
- return _axios.default.post("".concat(process.env.REACT_APP_EVALUATION_REFACTOR), body, {
1735
+ return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1744
1736
  headers: {
1745
1737
  Authorization: token
1746
1738
  }
@@ -1748,42 +1740,43 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1748
1740
 
1749
1741
  case 15:
1750
1742
  res = _context18.sent;
1751
- response = (_JSON$parse = JSON.parse(res.data.body)) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse.successfulData;
1752
- newStatuses = response;
1753
- statusObject = response["".concat(orderId, "-").concat(articleId, "-").concat(activeRetailer.id)];
1754
- orderStatus = statusObject["generalStatus"];
1755
- serviceStatus = newStatuses["".concat(getConcept(activeTab), "Status")];
1743
+ newStatuses = JSON.parse(res.data.body);
1744
+ orderStatus = newStatuses.newOrderStatus;
1745
+ serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(getConcept(activeTab), "Status")];
1756
1746
  newProductEdit = productEdit;
1757
1747
  newProductEdit.product[sectionStatusKey] = serviceStatus;
1758
1748
  setProductEdit(newProductEdit);
1759
- showSurveyByProvider = !user.is_retailer && orderStatus === "AP";
1760
- showSurveyByRetailer = user.is_retailer && orderStatus === "ACA";
1749
+ showSurveyByProvider = !user.is_retailer && orderStatus[orderId] === "AP";
1750
+ showSurveyByRetailer = user.is_retailer && orderStatus[orderId] === "ACA";
1761
1751
  showSurvey && showSurvey(showSurveyByProvider || showSurveyByRetailer);
1762
- _context18.next = 32;
1752
+ _context18.next = 30;
1763
1753
  break;
1764
1754
 
1765
- case 29:
1766
- _context18.next = 31;
1767
- return _axios.default.post("".concat(process.env.REACT_APP_EVALUATION_REFACTOR), body, {
1755
+ case 27:
1756
+ _context18.next = 29;
1757
+ return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
1768
1758
  headers: {
1769
1759
  Authorization: token
1770
1760
  }
1771
1761
  });
1772
1762
 
1773
- case 31:
1763
+ case 29:
1774
1764
  res = _context18.sent;
1775
1765
 
1776
- case 32:
1766
+ case 30:
1777
1767
  if (res.data.statusCode === 200) {
1778
- _response = (_JSON$parse2 = JSON.parse(res.data.body)) === null || _JSON$parse2 === void 0 ? void 0 : _JSON$parse2.successfulData;
1779
- _statusObject = _response["".concat(orderId, "-").concat(articleId, "-").concat(activeRetailer.id)];
1780
- productTemp.status = _statusObject["generalStatus"];
1768
+ _JSON$parse = JSON.parse(res.data.body), newArticleStatus = _JSON$parse.newArticleStatus, newServiceStatus = _JSON$parse.newServiceStatus, newStatus = _JSON$parse.newStatus;
1769
+ if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
1781
1770
  retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
1782
- retailerStatusCopy[activeRetailer.id][concept] = _statusObject["".concat(concept, "Status")];
1771
+ retailerStatusCopy[activeRetailer.id][concept] = newStatus;
1783
1772
  setRetailerStatus(retailerStatusCopy);
1784
1773
  productTemp.statusByRetailer = retailerStatusCopy;
1785
- status = _statusObject["".concat(concept, "Status")];
1786
- productTemp["".concat(concept, "_status")] = status;
1774
+
1775
+ if (newServiceStatus) {
1776
+ status = newServiceStatus[articleId]["".concat(concept, "Status")];
1777
+ productTemp["".concat(concept, "_status")] = status;
1778
+ }
1779
+
1787
1780
  setProduct(productTemp);
1788
1781
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1789
1782
  setOrigin(function (prev) {
@@ -1791,23 +1784,23 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1791
1784
  });
1792
1785
  }
1793
1786
 
1794
- _context18.next = 38;
1787
+ _context18.next = 36;
1795
1788
  break;
1796
1789
 
1797
- case 35:
1798
- _context18.prev = 35;
1790
+ case 33:
1791
+ _context18.prev = 33;
1799
1792
  _context18.t0 = _context18["catch"](9);
1800
1793
  console.log(_context18.t0);
1801
1794
 
1802
- case 38:
1795
+ case 36:
1803
1796
  loadData();
1804
1797
 
1805
- case 39:
1798
+ case 37:
1806
1799
  case "end":
1807
1800
  return _context18.stop();
1808
1801
  }
1809
1802
  }
1810
- }, _callee18, null, [[9, 35]]);
1803
+ }, _callee18, null, [[9, 33]]);
1811
1804
  }));
1812
1805
 
1813
1806
  return function sendEvaluation(_x9) {
@@ -1817,7 +1810,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1817
1810
 
1818
1811
  var validateAll = /*#__PURE__*/function () {
1819
1812
  var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(result) {
1820
- var _product$id_order2, evaluationArray, conceptArray, isAproved, retailersIds, body, userType, productTemp, status, retailerStatusCopy;
1813
+ var _product$id_order2, evaluationArray, conceptArray, dataGeneral, userType, productTemp, status, retailerStatusCopy;
1821
1814
 
1822
1815
  return _regenerator.default.wrap(function _callee19$(_context19) {
1823
1816
  while (1) {
@@ -1827,35 +1820,35 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1827
1820
  setLoading(true);
1828
1821
  evaluationArray = [];
1829
1822
  conceptArray = ["description", "datasheet", "images"];
1830
- isAproved = result === "A";
1831
- retailersIds = [];
1832
- servicesData === null || servicesData === void 0 ? void 0 : servicesData.forEach(function (ret) {
1833
- if (!retailersIds.includes(ret.id_retailer)) retailersIds.push(ret.id_retailer);
1834
- });
1835
- body = {
1836
- orderArticleRetailers: [{
1837
- orderId: (_product$id_order2 = product.id_order) !== null && _product$id_order2 !== void 0 ? _product$id_order2 : product.orderId,
1838
- articleId: product.article.id_article,
1839
- retailersIds: retailersIds
1840
- }],
1841
- isAproved: isAproved
1823
+ dataGeneral = {
1824
+ articleId: product.id_article,
1825
+ orderId: (_product$id_order2 = product.id_order) !== null && _product$id_order2 !== void 0 ? _product$id_order2 : product.orderId,
1826
+ result: result,
1827
+ isAproved: result === "A"
1842
1828
  };
1843
- conceptArray.forEach(function (concept) {
1844
- body.service = concept;
1845
- evaluationArray.push(_axios.default.post("".concat(process.env.REACT_APP_EVALUATION_REFACTOR), body, {
1829
+ servicesData === null || servicesData === void 0 ? void 0 : servicesData.forEach(function (ret) {
1830
+ var service = ret.service,
1831
+ id_retailer = ret.id_retailer;
1832
+ var data = {};
1833
+ data = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, dataGeneral), {}, {
1834
+ concept: service,
1835
+ retailerId: id_retailer,
1836
+ evalStatus: retailerStatus[id_retailer][service]
1837
+ });
1838
+ evaluationArray.push(_axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1846
1839
  headers: {
1847
1840
  Authorization: token
1848
1841
  }
1849
1842
  }));
1850
1843
  });
1851
- _context19.next = 11;
1844
+ _context19.next = 8;
1852
1845
  return Promise.all(evaluationArray);
1853
1846
 
1854
- case 11:
1847
+ case 8:
1855
1848
  userType = user.is_retailer === 1 ? "CA" : "P";
1856
1849
  productTemp = product;
1857
1850
  status = "".concat(result).concat(userType);
1858
- productTemp.status = status;
1851
+ productTemp.article_status = status;
1859
1852
  productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : status;
1860
1853
  productTemp.description_status = productTemp.description_status === "NA" ? "NA" : status;
1861
1854
  productTemp.images_status = productTemp.images_status === "NA" ? "NA" : status;
@@ -1881,24 +1874,24 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1881
1874
  idCategory: productTemp.article.id_category,
1882
1875
  product: productTemp
1883
1876
  }));
1884
- _context19.next = 28;
1877
+ _context19.next = 25;
1885
1878
  return loadData();
1886
1879
 
1887
- case 28:
1888
- _context19.next = 33;
1880
+ case 25:
1881
+ _context19.next = 30;
1889
1882
  break;
1890
1883
 
1891
- case 30:
1892
- _context19.prev = 30;
1884
+ case 27:
1885
+ _context19.prev = 27;
1893
1886
  _context19.t0 = _context19["catch"](0);
1894
1887
  console.log(_context19.t0);
1895
1888
 
1896
- case 33:
1889
+ case 30:
1897
1890
  case "end":
1898
1891
  return _context19.stop();
1899
1892
  }
1900
1893
  }
1901
- }, _callee19, null, [[0, 30]]);
1894
+ }, _callee19, null, [[0, 27]]);
1902
1895
  }));
1903
1896
 
1904
1897
  return function validateAll(_x10) {
@@ -1351,7 +1351,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1351
1351
 
1352
1352
  body.isAproved = result === "A";
1353
1353
  _context11.next = 12;
1354
- return _axios.default.post("".concat(process.env.REACT_APP_EVALUATION_REFACTOR), body, {
1354
+ return _axios.default.post("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), body, {
1355
1355
  headers: {
1356
1356
  Authorization: token
1357
1357
  }
@@ -1376,7 +1376,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1376
1376
  }
1377
1377
 
1378
1378
  _context11.next = 21;
1379
- return _axios.default.post("".concat(process.env.REACT_APP_EVALUATION_REFACTOR), body, {
1379
+ return _axios.default.post("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), body, {
1380
1380
  headers: {
1381
1381
  Authorization: token
1382
1382
  }
@@ -1839,7 +1839,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1839
1839
  };
1840
1840
  conceptArray.forEach(function (concept) {
1841
1841
  body.service = concept;
1842
- evaluationArray.push(_axios.default.post("".concat(process.env.REACT_APP_EVALUATION_REFACTOR), body, {
1842
+ evaluationArray.push(_axios.default.post("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), body, {
1843
1843
  headers: {
1844
1844
  Authorization: token
1845
1845
  }
@@ -20,7 +20,7 @@ var _jsBase = require("js-base64");
20
20
  var _uuid = require("uuid");
21
21
 
22
22
  var getRetailerServices = /*#__PURE__*/function () {
23
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(articleId, category, categoryId, version) {
23
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(articleId, category, categoryId, version, token) {
24
24
  var _images$values, responseArray, datasheets, descriptions, images;
25
25
 
26
26
  return _regenerator.default.wrap(function _callee$(_context) {
@@ -29,7 +29,11 @@ var getRetailerServices = /*#__PURE__*/function () {
29
29
  case 0:
30
30
  _context.prev = 0;
31
31
  _context.next = 3;
32
- return Promise.all([_axios.default.post("".concat(process.env.REACT_APP_ARTICLE_DATA_DATASHEET_ENDPOINT, "?idCategory=").concat(categoryId, "&articleId=").concat(articleId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_ARTICLE_DATA_DESCRIPTION_ENDPOINT, "?idCategory=").concat(categoryId, "&articleId=").concat(articleId, "&version=").concat(version)), _axios.default.post("".concat(process.env.REACT_APP_ARTICLE_DATA_IMAGES_ENDPOINT, "?articleId=").concat(articleId, "&version=").concat(version), {
32
+ return Promise.all([_axios.default.post("".concat(process.env.REACT_APP_ARTICLE_DATA_DATASHEET_ENDPOINT, "?idCategory=").concat(categoryId, "&articleId=").concat(articleId, "&version=").concat(version), {}, {
33
+ headers: {
34
+ Authorization: token
35
+ }
36
+ }), _axios.default.get("".concat(process.env.REACT_APP_ARTICLE_DATA_DESCRIPTION_ENDPOINT, "?idCategory=").concat(categoryId, "&articleId=").concat(articleId, "&version=").concat(version)), _axios.default.post("".concat(process.env.REACT_APP_ARTICLE_DATA_IMAGES_ENDPOINT, "?articleId=").concat(articleId, "&version=").concat(version), {
33
37
  category: category
34
38
  })]);
35
39
 
@@ -61,7 +65,7 @@ var getRetailerServices = /*#__PURE__*/function () {
61
65
  }, _callee, null, [[0, 11]]);
62
66
  }));
63
67
 
64
- return function getRetailerServices(_x, _x2, _x3, _x4) {
68
+ return function getRetailerServices(_x, _x2, _x3, _x4, _x5) {
65
69
  return _ref.apply(this, arguments);
66
70
  };
67
71
  }();
@@ -263,7 +267,7 @@ var fetchUsers = /*#__PURE__*/function () {
263
267
  }, _callee4);
264
268
  }));
265
269
 
266
- return function fetchUsers(_x5) {
270
+ return function fetchUsers(_x6) {
267
271
  return _ref4.apply(this, arguments);
268
272
  };
269
273
  }();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.4.60",
3
+ "version": "21.4.61",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -0,0 +1,23 @@
1
+ import styled from "styled-components";
2
+ import { FontFamily, GlobalColors } from "../../../global-files/variables";
3
+
4
+ export const Container = styled.div`
5
+ font-family: ${FontFamily.Raleway_500};
6
+ color: ${GlobalColors.s5};
7
+ font-size: 14px;
8
+ line-height: 21px;
9
+ border-bottom: 2px solid ${GlobalColors.s3};
10
+ width: 149px;
11
+ padding-bottom: 5px;
12
+ transition: 0.1s all;
13
+ cursor: pointer;
14
+
15
+ &.active {
16
+ font-size: 18px;
17
+ border-bottom: 2px solid ${GlobalColors.magenta_s2};
18
+ }
19
+
20
+ & + * {
21
+ margin-left: 10px;
22
+ }
23
+ `;
@@ -491,7 +491,8 @@ export const ProviderProductEdition = ({
491
491
  product?.id_article || product?.article?.id_article,
492
492
  product?.article?.company_name || product?.categoryName,
493
493
  parseInt(product?.article?.id_category || product?.id_category),
494
- version
494
+ version,
495
+ token
495
496
  );
496
497
 
497
498
  //Converts the data inside the datasheets object to array
@@ -1031,62 +1032,54 @@ export const ProviderProductEdition = ({
1031
1032
  const retailerId = activeRetailer?.id;
1032
1033
  let res;
1033
1034
  try {
1034
- const body = {
1035
- orderArticleRetailers: [
1036
- { orderId, articleId, retailersIds: [activeRetailer.id] },
1037
- ],
1038
- isAproved: false,
1039
- service: concept,
1040
- };
1041
1035
  if (result) {
1042
- body.isAproved = result === "A";
1043
- res = await axios.post(
1044
- `${process.env.REACT_APP_EVALUATION_REFACTOR}`,
1045
- body,
1036
+ data.result = result;
1037
+ data.retailerId = retailerId;
1038
+ res = await axios.put(
1039
+ `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
1040
+ data,
1046
1041
  {
1047
1042
  headers: {
1048
1043
  Authorization: token,
1049
1044
  },
1050
1045
  }
1051
1046
  );
1052
-
1053
- const response = JSON.parse(res.data.body)?.successfulData;
1054
- const newStatuses = response;
1055
- const statusObject =
1056
- response[`${orderId}-${articleId}-${activeRetailer.id}`];
1057
- const orderStatus = statusObject["generalStatus"];
1058
- const serviceStatus = newStatuses[`${getConcept(activeTab)}Status`];
1047
+ const newStatuses = JSON.parse(res.data.body);
1048
+ const orderStatus = newStatuses.newOrderStatus;
1049
+ const serviceStatus =
1050
+ newStatuses.newServiceStatus[articleId][
1051
+ `${getConcept(activeTab)}Status`
1052
+ ];
1059
1053
 
1060
1054
  const newProductEdit = productEdit;
1061
1055
  newProductEdit.product[sectionStatusKey] = serviceStatus;
1062
1056
  setProductEdit(newProductEdit);
1063
- const showSurveyByProvider = !user.is_retailer && orderStatus === "AP";
1064
- const showSurveyByRetailer = user.is_retailer && orderStatus === "ACA";
1057
+ const showSurveyByProvider =
1058
+ !user.is_retailer && orderStatus[orderId] === "AP";
1059
+ const showSurveyByRetailer =
1060
+ user.is_retailer && orderStatus[orderId] === "ACA";
1065
1061
  showSurvey && showSurvey(showSurveyByProvider || showSurveyByRetailer);
1066
1062
  } else {
1067
- res = await axios.post(
1068
- `${process.env.REACT_APP_EVALUATION_REFACTOR}`,
1069
- body,
1070
- {
1071
- headers: {
1072
- Authorization: token,
1073
- },
1074
- }
1075
- );
1063
+ res = await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
1064
+ headers: {
1065
+ Authorization: token,
1066
+ },
1067
+ });
1076
1068
  }
1077
1069
  if (res.data.statusCode === 200) {
1078
- const response = JSON.parse(res.data.body)?.successfulData;
1079
- const statusObject =
1080
- response[`${orderId}-${articleId}-${activeRetailer.id}`];
1081
- productTemp.status = statusObject["generalStatus"];
1070
+ const { newArticleStatus, newServiceStatus, newStatus } = JSON.parse(
1071
+ res.data.body
1072
+ );
1073
+ if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
1082
1074
  const retailerStatusCopy = { ...retailerStatus };
1083
- retailerStatusCopy[activeRetailer.id][concept] =
1084
- statusObject[`${concept}Status`];
1075
+ retailerStatusCopy[activeRetailer.id][concept] = newStatus;
1085
1076
  setRetailerStatus(retailerStatusCopy);
1086
1077
  productTemp.statusByRetailer = retailerStatusCopy;
1087
1078
  let status;
1088
- status = statusObject[`${concept}Status`];
1089
- productTemp[`${concept}_status`] = status;
1079
+ if (newServiceStatus) {
1080
+ status = newServiceStatus[articleId][`${concept}Status`];
1081
+ productTemp[`${concept}_status`] = status;
1082
+ }
1090
1083
  setProduct(productTemp);
1091
1084
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1092
1085
  setOrigin((prev) => ({ ...prev, [concept]: status }));
@@ -1102,26 +1095,23 @@ export const ProviderProductEdition = ({
1102
1095
  setLoading(true);
1103
1096
  const evaluationArray = [];
1104
1097
  const conceptArray = ["description", "datasheet", "images"];
1105
- const isAproved = result === "A";
1106
- const retailersIds = [];
1107
- servicesData?.forEach((ret) => {
1108
- if (!retailersIds.includes(ret.id_retailer))
1109
- retailersIds.push(ret.id_retailer);
1110
- });
1111
- const body = {
1112
- orderArticleRetailers: [
1113
- {
1114
- orderId: product.id_order ?? product.orderId,
1115
- articleId: product.article.id_article,
1116
- retailersIds,
1117
- },
1118
- ],
1119
- isAproved,
1098
+ const dataGeneral = {
1099
+ articleId: product.id_article,
1100
+ orderId: product.id_order ?? product.orderId,
1101
+ result,
1102
+ isAproved: result === "A",
1120
1103
  };
1121
- conceptArray.forEach((concept) => {
1122
- body.service = concept;
1104
+ servicesData?.forEach((ret) => {
1105
+ const { service, id_retailer } = ret;
1106
+ let data = {};
1107
+ data = {
1108
+ ...dataGeneral,
1109
+ concept: service,
1110
+ retailerId: id_retailer,
1111
+ evalStatus: retailerStatus[id_retailer][service],
1112
+ };
1123
1113
  evaluationArray.push(
1124
- axios.post(`${process.env.REACT_APP_EVALUATION_REFACTOR}`, body, {
1114
+ axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
1125
1115
  headers: {
1126
1116
  Authorization: token,
1127
1117
  },
@@ -1133,7 +1123,7 @@ export const ProviderProductEdition = ({
1133
1123
 
1134
1124
  const productTemp = product;
1135
1125
  const status = `${result}${userType}`;
1136
- productTemp.status = status;
1126
+ productTemp.article_status = status;
1137
1127
  productTemp.datasheet_status =
1138
1128
  productTemp.datasheet_status === "NA" ? "NA" : status;
1139
1129
  productTemp.description_status =
@@ -1173,6 +1163,13 @@ export const ProviderProductEdition = ({
1173
1163
  }
1174
1164
  };
1175
1165
 
1166
+
1167
+
1168
+
1169
+
1170
+
1171
+
1172
+
1176
1173
  const evaluationToRetailer = async (result) => {
1177
1174
  const data = {
1178
1175
  articleId: product.id_article,
@@ -828,7 +828,7 @@ export const RetailerProductEdition = ({
828
828
  if (result) {
829
829
  body.isAproved = result === "A";
830
830
  res = await axios.post(
831
- `${process.env.REACT_APP_EVALUATION_REFACTOR}`,
831
+ `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
832
832
  body,
833
833
  {
834
834
  headers: {
@@ -849,7 +849,7 @@ export const RetailerProductEdition = ({
849
849
  getSectionIcon();
850
850
  }
851
851
  res = await axios.post(
852
- `${process.env.REACT_APP_EVALUATION_REFACTOR}`,
852
+ `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
853
853
  body,
854
854
  {
855
855
  headers: {
@@ -1233,7 +1233,7 @@ export const RetailerProductEdition = ({
1233
1233
  conceptArray.forEach((concept) => {
1234
1234
  body.service = concept;
1235
1235
  evaluationArray.push(
1236
- axios.post(`${process.env.REACT_APP_EVALUATION_REFACTOR}`, body, {
1236
+ axios.post(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, body, {
1237
1237
  headers: {
1238
1238
  Authorization: token,
1239
1239
  },
@@ -6,12 +6,21 @@ export const getRetailerServices = async (
6
6
  articleId,
7
7
  category,
8
8
  categoryId,
9
- version
9
+ version,
10
+ token
10
11
  ) => {
11
12
  try {
12
13
  const responseArray = await Promise.all([
13
14
  axios.post(
14
- `${process.env.REACT_APP_ARTICLE_DATA_DATASHEET_ENDPOINT}?idCategory=${categoryId}&articleId=${articleId}&version=${version}`
15
+ `${process.env.REACT_APP_ARTICLE_DATA_DATASHEET_ENDPOINT}?idCategory=${categoryId}&articleId=${articleId}&version=${version}`,
16
+ {
17
+
18
+ },
19
+ {
20
+ headers: {
21
+ Authorization: token,
22
+ },
23
+ }
15
24
  ),
16
25
  axios.get(
17
26
  `${process.env.REACT_APP_ARTICLE_DATA_DESCRIPTION_ENDPOINT}?idCategory=${categoryId}&articleId=${articleId}&version=${version}`
@@ -1,202 +0,0 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright [yyyy] [name of copyright owner]
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
- See the License for the specific language governing permissions and
202
- limitations under the License.