contentoh-components-library 21.0.84 → 21.0.87

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.
@@ -30,7 +30,8 @@ var AsignationOption = function AsignationOption(_ref) {
30
30
  name = _ref.name,
31
31
  team = _ref.team,
32
32
  onClick = _ref.onClick,
33
- btnOnClick = _ref.btnOnClick;
33
+ btnOnClick = _ref.btnOnClick,
34
+ active = _ref.active;
34
35
  var iconsAsignation = {
35
36
  assigned: /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
36
37
  onClick: btnOnClick,
@@ -67,7 +68,9 @@ var AsignationOption = function AsignationOption(_ref) {
67
68
  className: "team-label",
68
69
  children: team
69
70
  })]
70
- }), asignationType && iconsAsignation[asignationType]]
71
+ }), asignationType && iconsAsignation[asignationType], active && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
72
+ className: "green-circle"
73
+ })]
71
74
  });
72
75
  };
73
76
 
@@ -15,6 +15,6 @@ var _variables = require("../../../global-files/variables");
15
15
 
16
16
  var _templateObject;
17
17
 
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n width: fit-content;\n align-items: center;\n cursor: pointer;\n border-radius: 3px;\n padding: 5px;\n\n .profile-image,\n .medium-image {\n & + * {\n margin-left: 15px;\n }\n }\n\n .labels-container {\n font-family: ", ";\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n\n .name-label,\n .team-label {\n inline-size: 100px;\n overflow: hidden;\n }\n\n .name-label {\n color: ", ";\n }\n\n .team-label {\n color: ", ";\n }\n\n & + * {\n margin-left: 11px;\n }\n }\n\n button {\n background-color: transparent;\n cursor: pointer;\n border: none;\n }\n\n &:hover {\n background-color: ", ";\n }\n\n & + * {\n margin-top: 10px;\n }\n"])), _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.s4, _variables.GlobalColors.s3);
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n cursor: pointer;\n border-radius: 3px;\n padding: 5px;\n\n .profile-image,\n .medium-image {\n & + * {\n margin-left: 15px;\n }\n }\n\n .labels-container {\n font-family: ", ";\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n\n .name-label,\n .team-label {\n inline-size: 100px;\n overflow: hidden;\n }\n\n .name-label {\n color: ", ";\n }\n\n .team-label {\n color: ", ";\n }\n\n & + * {\n margin-left: 11px;\n }\n }\n\n .green-circle {\n background-color: ", ";\n width: 20px;\n height: 20px;\n border-radius: 50%;\n }\n\n button {\n background-color: transparent;\n cursor: pointer;\n border: none;\n }\n\n &:hover {\n background-color: ", ";\n }\n\n & + * {\n margin-top: 10px;\n }\n"])), _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.s4, _variables.GlobalColors.exported, _variables.GlobalColors.s3);
19
19
 
20
20
  exports.Container = Container;
@@ -48,7 +48,7 @@ var RetailerSelector = function RetailerSelector(_ref) {
48
48
  altText: activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.name,
49
49
  imageType: "medium-image",
50
50
  onClick: function onClick() {
51
- (retailers === null || retailers === void 0 ? void 0 : retailers.length) > 1 && setRetailersPanel(!retailersPanel);
51
+ (retailers === null || retailers === void 0 ? void 0 : retailers.length) > 0 && setRetailersPanel(!retailersPanel);
52
52
  if (retailersPanel) document.removeEventListener("click", closeRetailersPanel, false);
53
53
  }
54
54
  }), retailersPanel && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -64,7 +64,8 @@ var RetailerSelector = function RetailerSelector(_ref) {
64
64
  setActiveRetailer(retailer);
65
65
  document.removeEventListener("click", closeRetailersPanel, false);
66
66
  setRetailersPanel(false);
67
- }
67
+ },
68
+ active: retailer.id === activeRetailer.id
68
69
  }, "".concat(index, "-").concat(retailer === null || retailer === void 0 ? void 0 : retailer.name));
69
70
  })
70
71
  })]
@@ -15,6 +15,6 @@ var _variables = require("../../../global-files/variables");
15
15
 
16
16
  var _templateObject;
17
17
 
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n .retailers-panel {\n background: ", ";\n border: 1px solid ", ";\n box-sizing: border-box;\n box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.25);\n border-radius: 4px;\n padding: 10px;\n position: absolute;\n top: calc(100% + 10px);\n right: 0;\n z-index: 10;\n }\n"])), _variables.GlobalColors.s2, _variables.GlobalColors.s3);
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n cursor: pointer;\n\n .retailers-panel {\n background: ", ";\n border: 1px solid ", ";\n box-sizing: border-box;\n box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.25);\n border-radius: 4px;\n padding: 10px;\n position: absolute;\n top: calc(100% + 10px);\n right: 0;\n z-index: 10;\n }\n"])), _variables.GlobalColors.s2, _variables.GlobalColors.s3);
19
19
 
20
20
  exports.Container = Container;
@@ -36,107 +36,125 @@ ProviderProductEditionDefault.args = {
36
36
  category: 846,
37
37
  version: 2,
38
38
  productSelected: {
39
- orderId: 2,
40
- status: "AA",
41
- datasheet_status: "AA",
39
+ orderId: 7,
40
+ id_category: "684",
41
+ status: "RECEPTION",
42
+ datasheet_status: null,
42
43
  prio: "none",
43
- version: 2,
44
- description_status: "AP",
45
- images_status: "AA",
44
+ version: 4,
45
+ description_status: null,
46
+ images_status: null,
46
47
  brand: null,
47
- retailerOrder: 0,
48
48
  missing: {
49
- datasheet: 0,
50
- descriptions: 0,
51
- images: -1
52
- },
53
- services: {
54
- datasheets: 1,
55
- descriptions: 1,
56
- images: 1
49
+ datasheet: 33,
50
+ descriptions: 14,
51
+ images: 3
57
52
  },
58
53
  article: {
59
- category: "ILUMINACIÓN|FOCOS|LEDS",
54
+ category: "SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
60
55
  company_name: "COMPANY DEV",
61
- country: "México",
62
- id_category: "2146",
63
- id_datasheet_especialist: 54,
64
- id_datasheet_facilitator: 52,
65
- id_description_especialist: 54,
66
- id_description_facilitator: 52,
67
- id_images_especialist: 55,
68
- id_images_facilitator: 53,
69
- id_order: 2,
70
- id_article: 35319,
71
- id_auditor: 30,
72
- name: "FOCO LED A19 (60W) LUZ AMARILLA",
73
- upc: "120873"
56
+ id_category: "684",
57
+ id_article: 33249,
58
+ name: "Crema dental ",
59
+ timestamp: "2022-06-14T23:24:08.000Z",
60
+ upc: "232435"
74
61
  },
75
62
  retailers: [{
76
- id: 58,
77
- name: "The Home Depot Golden"
63
+ id: 4,
64
+ name: "Walmart Super y Superama"
65
+ }, {
66
+ id: 9,
67
+ name: "Amazon"
68
+ }, {
69
+ id: 1013,
70
+ name: "Cencosud Colombia"
71
+ }, {
72
+ id: 2005,
73
+ name: "ClubCo"
78
74
  }],
75
+ services: {
76
+ datasheets: 1,
77
+ descriptions: 1,
78
+ images: 1
79
+ },
79
80
  retailersAvailable: [{
80
- id: 58,
81
- name: "The Home Depot Golden"
81
+ id: 4,
82
+ name: "Walmart Super y Superama"
83
+ }, {
84
+ id: 9,
85
+ name: "Amazon"
86
+ }, {
87
+ id: 1013,
88
+ name: "Cencosud Colombia"
89
+ }, {
90
+ id: 2005,
91
+ name: "ClubCo"
82
92
  }],
83
- categoryName: "ILUMINACIÓN|FOCOS|LEDS",
84
- upc: "120873",
85
- id_article: 35319,
86
- id_order: 2
93
+ id_article: 33249,
94
+ categoryName: "SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
95
+ version_status: "RECEPTION"
87
96
  },
88
97
  productToEdit: {
89
- ArticleId: 35319,
90
- idCategory: "2146",
98
+ ArticleId: 33249,
99
+ idCategory: "684",
91
100
  product: {
92
- orderId: 2,
93
- status: "AA",
94
- datasheet_status: "AA",
101
+ orderId: 7,
102
+ id_category: "684",
103
+ status: "RECEPTION",
104
+ datasheet_status: null,
95
105
  prio: "none",
96
- version: 2,
97
- description_status: "AP",
98
- images_status: "AA",
106
+ version: 4,
107
+ description_status: null,
108
+ images_status: null,
99
109
  brand: null,
100
- retailerOrder: 0,
101
110
  missing: {
102
- datasheet: 0,
103
- descriptions: 0,
104
- images: -1
105
- },
106
- services: {
107
- datasheets: 1,
108
- descriptions: 1,
109
- images: 1
111
+ datasheet: 33,
112
+ descriptions: 14,
113
+ images: 3
110
114
  },
111
115
  article: {
112
- category: "ILUMINACIÓN|FOCOS|LEDS",
116
+ category: "SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
113
117
  company_name: "COMPANY DEV",
114
- country: "México",
115
- id_category: "2146",
116
- id_datasheet_especialist: 54,
117
- id_datasheet_facilitator: 52,
118
- id_description_especialist: 54,
119
- id_description_facilitator: 52,
120
- id_images_especialist: 55,
121
- id_images_facilitator: 53,
122
- id_order: 2,
123
- id_article: 35319,
124
- id_auditor: 30,
125
- name: "FOCO LED A19 (60W) LUZ AMARILLA",
126
- upc: "120873"
118
+ id_category: "684",
119
+ id_article: 33249,
120
+ name: "Crema dental ",
121
+ timestamp: "2022-06-14T23:24:08.000Z",
122
+ upc: "232435"
127
123
  },
128
124
  retailers: [{
129
- id: 58,
130
- name: "The Home Depot Golden"
125
+ id: 4,
126
+ name: "Walmart Super y Superama"
127
+ }, {
128
+ id: 9,
129
+ name: "Amazon"
130
+ }, {
131
+ id: 1013,
132
+ name: "Cencosud Colombia"
133
+ }, {
134
+ id: 2005,
135
+ name: "ClubCo"
131
136
  }],
137
+ services: {
138
+ datasheets: 1,
139
+ descriptions: 1,
140
+ images: 1
141
+ },
132
142
  retailersAvailable: [{
133
- id: 58,
134
- name: "The Home Depot Golden"
143
+ id: 4,
144
+ name: "Walmart Super y Superama"
145
+ }, {
146
+ id: 9,
147
+ name: "Amazon"
148
+ }, {
149
+ id: 1013,
150
+ name: "Cencosud Colombia"
151
+ }, {
152
+ id: 2005,
153
+ name: "ClubCo"
135
154
  }],
136
- categoryName: "ILUMINACIÓN|FOCOS|LEDS",
137
- upc: "120873",
138
- id_article: 35319,
139
- id_order: 2
155
+ id_article: 33249,
156
+ categoryName: "SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
157
+ version_status: "RECEPTION"
140
158
  }
141
159
  },
142
160
  location: {
@@ -493,28 +493,31 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
493
493
 
494
494
  var getServices = /*#__PURE__*/function () {
495
495
  var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
496
- var productInOrder, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse;
496
+ var _product$article3;
497
+
498
+ var productInOrder, idArticle, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse;
497
499
 
498
500
  return _regenerator.default.wrap(function _callee3$(_context3) {
499
501
  while (1) {
500
502
  switch (_context3.prev = _context3.next) {
501
503
  case 0:
502
504
  productInOrder = product.id_order || product.orderId;
505
+ idArticle = (product === null || product === void 0 ? void 0 : product.id_article) || (product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_article);
503
506
 
504
507
  if (!(isRevision() || productInOrder)) {
505
- _context3.next = 7;
508
+ _context3.next = 8;
506
509
  break;
507
510
  }
508
511
 
509
- _context3.next = 4;
510
- return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : product.id_article, "&orderId=").concat((_product$id_order = product === null || product === void 0 ? void 0 : product.id_order) !== null && _product$id_order !== void 0 ? _product$id_order : product.orderId, "&end=true"));
512
+ _context3.next = 5;
513
+ return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(idArticle, "&orderId=").concat((_product$id_order = product === null || product === void 0 ? void 0 : product.id_order) !== null && _product$id_order !== void 0 ? _product$id_order : product.orderId, "&end=true"));
511
514
 
512
- case 4:
515
+ case 5:
513
516
  servicesResponse = _context3.sent;
514
517
  parsedResponse = JSON.parse(servicesResponse === null || servicesResponse === void 0 ? void 0 : (_servicesResponse$dat = servicesResponse.data) === null || _servicesResponse$dat === void 0 ? void 0 : _servicesResponse$dat.body).data;
515
518
  setServicesData(parsedResponse);
516
519
 
517
- case 7:
520
+ case 8:
518
521
  case "end":
519
522
  return _context3.stop();
520
523
  }
@@ -543,10 +546,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
543
546
 
544
547
  var isRevision = function isRevision() {
545
548
  if (productEdit) {
546
- var _concept = getConcept(activeTab);
547
-
549
+ var concept = getConcept(activeTab);
548
550
  var _isRetailer = user.is_retailer;
549
- var currentService = productEdit === null || productEdit === void 0 ? void 0 : productEdit.product["".concat(_concept, "_status")];
551
+ var currentService = productEdit === null || productEdit === void 0 ? void 0 : productEdit.product["".concat(concept, "_status")];
550
552
  var orgn = origin[activeTab];
551
553
 
552
554
  var _revision = ["RequestWithContentoh", "RequestWithoutContentoh", "Contentoh"].includes(orgn);
@@ -675,15 +677,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
675
677
  if (services.length > 0) {
676
678
  var _services$0$activeRet, _services$2, _services$3;
677
679
 
678
- if ((_services$0$activeRet = services[0][activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id]) !== null && _services$0$activeRet !== void 0 && _services$0$activeRet.data) services[0][activeRetailer.id].data = Object.values(services[0][activeRetailer.id].data);
680
+ if ((_services$0$activeRet = services[0][activeRetailer.id]) !== null && _services$0$activeRet !== void 0 && _services$0$activeRet.data) services[0][activeRetailer.id].data = Object.values(services[0][activeRetailer.id].data);
679
681
  setActivePercentage(Math.round(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.percentage, 0));
680
- var datagroups = services[0][activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id];
682
+ var datagroups = services[0][activeRetailer.id];
681
683
  var inputs = (_services$2 = services[0]) === null || _services$2 === void 0 ? void 0 : _services$2.inputs;
682
684
 
683
685
  var _descriptions = (_services$3 = services[1]) === null || _services$3 === void 0 ? void 0 : _services$3.filter(function (service) {
684
686
  return (service === null || service === void 0 ? void 0 : service.id) === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
685
687
  });
686
688
 
689
+ console.log(services[0], "services[0]");
687
690
  setDatasheets([datagroups, inputs]);
688
691
  setDescriptions(_descriptions);
689
692
  }
@@ -1412,8 +1415,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1412
1415
  };
1413
1416
  }();
1414
1417
 
1415
- var evaluationComplete = function evaluationComplete() {
1416
- var concept = getConcept(activeTab);
1418
+ var evaluationComplete = function evaluationComplete(tab) {
1419
+ console.log(servicesData, "servicesData");
1420
+ var concept = getConcept(tab);
1417
1421
  var serv = servicesData.filter(function (item) {
1418
1422
  return item.service === concept;
1419
1423
  });
@@ -1551,18 +1555,18 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1551
1555
 
1552
1556
  var sendEvaluation = /*#__PURE__*/function () {
1553
1557
  var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
1554
- var data, retailerId, productTemp, _product$id_order2, _product$id_order3, _concept2;
1558
+ var data, retailerId, _product$id_order2, _product$id_order3, _productTemp, concept;
1555
1559
 
1556
1560
  return _regenerator.default.wrap(function _callee13$(_context13) {
1557
1561
  while (1) {
1558
1562
  switch (_context13.prev = _context13.next) {
1559
1563
  case 0:
1564
+ setLoading(true);
1560
1565
  data = {};
1561
1566
  retailerId = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id;
1562
- productTemp = product;
1563
1567
 
1564
1568
  if (!result) {
1565
- _context13.next = 10;
1569
+ _context13.next = 9;
1566
1570
  break;
1567
1571
  }
1568
1572
 
@@ -1573,25 +1577,25 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1573
1577
  result: result,
1574
1578
  retailerId: retailerId
1575
1579
  };
1576
- productTemp["".concat(concept, "_status")] = "".concat(result, "P");
1577
- _context13.next = 8;
1580
+ _context13.next = 7;
1578
1581
  return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1579
1582
  headers: {
1580
1583
  Authorization: token
1581
1584
  }
1582
1585
  });
1583
1586
 
1584
- case 8:
1587
+ case 7:
1585
1588
  _context13.next = 18;
1586
1589
  break;
1587
1590
 
1588
- case 10:
1589
- _concept2 = getConcept(activeTab);
1590
- productTemp["".concat(_concept2, "_status")] = "Evaluated";
1591
+ case 9:
1592
+ _productTemp = product;
1593
+ concept = getConcept(activeTab);
1594
+ _productTemp["".concat(concept, "_status")] = "Evaluated";
1591
1595
  data = {
1592
1596
  articleId: product.id_article,
1593
1597
  orderId: (_product$id_order3 = product.id_order) !== null && _product$id_order3 !== void 0 ? _product$id_order3 : product.orderId,
1594
- concept: _concept2,
1598
+ concept: concept,
1595
1599
  retailerId: retailerId
1596
1600
  };
1597
1601
 
@@ -1601,19 +1605,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1601
1605
  }
1602
1606
  });
1603
1607
 
1604
- setProduct(productTemp);
1608
+ setProduct(_productTemp);
1605
1609
  setProductEdit({
1606
- ArticleId: productTemp.id_article,
1607
- idCategory: productTemp.article.id_category,
1608
- product: productTemp
1610
+ ArticleId: _productTemp.id_article,
1611
+ idCategory: _productTemp.article.id_category,
1612
+ product: _productTemp
1609
1613
  });
1610
1614
  sessionStorage.setItem("productEdit", JSON.stringify({
1611
- ArticleId: productTemp.id_article,
1612
- idCategory: productTemp.article.id_category,
1613
- product: productTemp
1615
+ ArticleId: _productTemp.id_article,
1616
+ idCategory: _productTemp.article.id_category,
1617
+ product: _productTemp
1614
1618
  }));
1615
1619
  setOrigin(function (prev) {
1616
- return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, _concept2, "Evaluated"));
1620
+ return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, concept, "Evaluated"));
1617
1621
  });
1618
1622
 
1619
1623
  case 18:
@@ -1910,10 +1914,10 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1910
1914
  }))
1911
1915
  })]
1912
1916
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1913
- buttonType: evaluationComplete() && (productEdit.product.id_order || productEdit.product.orderId) ? "general-green-button" : "general-button-disabled",
1917
+ buttonType: evaluationComplete(activeTab) && (productEdit.product.id_order || productEdit.product.orderId) ? "general-green-button" : "general-button-disabled",
1914
1918
  label: "Enviar evaluación",
1915
1919
  onClick: function onClick() {
1916
- setModalSent(true);
1920
+ //setModalSent(true);
1917
1921
  sendEvaluation();
1918
1922
  setMessage("\xA1Evaluaci\xF3n de ".concat(translateConcept(), " completada!"));
1919
1923
  }
@@ -1925,15 +1929,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1925
1929
  children: "Los atributos son requeridos por las plataformas de las cadenas, es muy importante completar los campos requeridos ya que pueden rechazar el producto por falta de informaci\xF3n."
1926
1930
  })
1927
1931
  }), inCart ? /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
1928
- type: "button",
1929
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactRouterDom.Link, {
1930
- to: "/checkout",
1931
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
1932
- children: "Articulo en carrito"
1933
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
1934
- children: "Ir a checkout"
1935
- })]
1936
- })
1932
+ type: "button"
1937
1933
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1938
1934
  onClick: function onClick() {
1939
1935
  setShowContentohRequestModal && setShowContentohRequestModal(true);
@@ -1964,10 +1960,10 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1964
1960
  return setModalSent(false);
1965
1961
  },
1966
1962
  message: message,
1967
- detail: detail,
1968
- bold: !evaluationComplete() && "Aprueba / Rechaza",
1969
- widthImg: !evaluationComplete() ? "160px" : "354px",
1970
- heightImg: !evaluationComplete() ? "84px" : "354px",
1963
+ detail: "",
1964
+ bold: !evaluationComplete(activeTab) && "Aprueba / Rechaza",
1965
+ widthImg: !evaluationComplete(activeTab) ? "160px" : "354px",
1966
+ heightImg: !evaluationComplete(activeTab) ? "84px" : "354px",
1971
1967
  img: getSectionIcon()
1972
1968
  }), modalViewError && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GlobalModal, {
1973
1969
  close: function close() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.0.84",
3
+ "version": "21.0.87",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -14,6 +14,7 @@ export const AsignationOption = ({
14
14
  team,
15
15
  onClick,
16
16
  btnOnClick,
17
+ active,
17
18
  }) => {
18
19
  const iconsAsignation = {
19
20
  assigned: (
@@ -38,6 +39,7 @@ export const AsignationOption = ({
38
39
  <p className="team-label">{team}</p>
39
40
  </div>
40
41
  {asignationType && iconsAsignation[asignationType]}
42
+ {active && <div className="green-circle"></div>}
41
43
  </Container>
42
44
  );
43
45
  };
@@ -3,7 +3,6 @@ import { FontFamily, GlobalColors } from "../../../global-files/variables";
3
3
 
4
4
  export const Container = styled.div`
5
5
  display: flex;
6
- width: fit-content;
7
6
  align-items: center;
8
7
  cursor: pointer;
9
8
  border-radius: 3px;
@@ -41,6 +40,13 @@ export const Container = styled.div`
41
40
  }
42
41
  }
43
42
 
43
+ .green-circle {
44
+ background-color: ${GlobalColors.exported};
45
+ width: 20px;
46
+ height: 20px;
47
+ border-radius: 50%;
48
+ }
49
+
44
50
  button {
45
51
  background-color: transparent;
46
52
  cursor: pointer;
@@ -30,7 +30,7 @@ export const RetailerSelector = ({
30
30
  altText={activeRetailer?.name}
31
31
  imageType={"medium-image"}
32
32
  onClick={() => {
33
- retailers?.length > 1 && setRetailersPanel(!retailersPanel);
33
+ retailers?.length > 0 && setRetailersPanel(!retailersPanel);
34
34
  if (retailersPanel)
35
35
  document.removeEventListener("click", closeRetailersPanel, false);
36
36
  }}
@@ -54,6 +54,7 @@ export const RetailerSelector = ({
54
54
  );
55
55
  setRetailersPanel(false);
56
56
  }}
57
+ active={retailer.id === activeRetailer.id}
57
58
  />
58
59
  ))}
59
60
  </div>
@@ -3,6 +3,8 @@ import { GlobalColors } from "../../../global-files/variables";
3
3
 
4
4
  export const Container = styled.div`
5
5
  position: relative;
6
+ cursor: pointer;
7
+
6
8
  .retailers-panel {
7
9
  background: ${GlobalColors.s2};
8
10
  border: 1px solid ${GlobalColors.s3};
@@ -21,115 +21,146 @@ ProviderProductEditionDefault.args = {
21
21
  category: 846,
22
22
  version: 2,
23
23
  productSelected: {
24
- orderId: 2,
25
- status: "AA",
26
- datasheet_status: "AA",
24
+ orderId: 7,
25
+ id_category: "684",
26
+ status: "RECEPTION",
27
+ datasheet_status: null,
27
28
  prio: "none",
28
- version: 2,
29
- description_status: "AP",
30
- images_status: "AA",
29
+ version: 4,
30
+ description_status: null,
31
+ images_status: null,
31
32
  brand: null,
32
- retailerOrder: 0,
33
33
  missing: {
34
- datasheet: 0,
35
- descriptions: 0,
36
- images: -1,
37
- },
38
- services: {
39
- datasheets: 1,
40
- descriptions: 1,
41
- images: 1,
34
+ datasheet: 33,
35
+ descriptions: 14,
36
+ images: 3,
42
37
  },
43
38
  article: {
44
- category: "ILUMINACIÓN|FOCOS|LEDS",
39
+ category: "SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
45
40
  company_name: "COMPANY DEV",
46
- country: "México",
47
- id_category: "2146",
48
- id_datasheet_especialist: 54,
49
- id_datasheet_facilitator: 52,
50
- id_description_especialist: 54,
51
- id_description_facilitator: 52,
52
- id_images_especialist: 55,
53
- id_images_facilitator: 53,
54
- id_order: 2,
55
- id_article: 35319,
56
- id_auditor: 30,
57
- name: "FOCO LED A19 (60W) LUZ AMARILLA",
58
- upc: "120873",
41
+ id_category: "684",
42
+ id_article: 33249,
43
+ name: "Crema dental ",
44
+ timestamp: "2022-06-14T23:24:08.000Z",
45
+ upc: "232435",
59
46
  },
60
47
  retailers: [
61
48
  {
62
- id: 58,
63
- name: "The Home Depot Golden",
49
+ id: 4,
50
+ name: "Walmart Super y Superama",
51
+ },
52
+ {
53
+ id: 9,
54
+ name: "Amazon",
55
+ },
56
+ {
57
+ id: 1013,
58
+ name: "Cencosud Colombia",
59
+ },
60
+ {
61
+ id: 2005,
62
+ name: "ClubCo",
64
63
  },
65
64
  ],
65
+ services: {
66
+ datasheets: 1,
67
+ descriptions: 1,
68
+ images: 1,
69
+ },
66
70
  retailersAvailable: [
67
71
  {
68
- id: 58,
69
- name: "The Home Depot Golden",
72
+ id: 4,
73
+ name: "Walmart Super y Superama",
74
+ },
75
+ {
76
+ id: 9,
77
+ name: "Amazon",
78
+ },
79
+ {
80
+ id: 1013,
81
+ name: "Cencosud Colombia",
82
+ },
83
+ {
84
+ id: 2005,
85
+ name: "ClubCo",
70
86
  },
71
87
  ],
72
- categoryName: "ILUMINACIÓN|FOCOS|LEDS",
73
- upc: "120873",
74
- id_article: 35319,
75
- id_order: 2,
88
+ id_article: 33249,
89
+ categoryName: "SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
90
+ version_status: "RECEPTION",
76
91
  },
77
92
  productToEdit: {
78
- ArticleId: 35319,
79
- idCategory: "2146",
93
+ ArticleId: 33249,
94
+ idCategory: "684",
80
95
  product: {
81
- orderId: 2,
82
- status: "AA",
83
- datasheet_status: "AA",
96
+ orderId: 7,
97
+ id_category: "684",
98
+ status: "RECEPTION",
99
+ datasheet_status: null,
84
100
  prio: "none",
85
- version: 2,
86
- description_status: "AP",
87
- images_status: "AA",
101
+ version: 4,
102
+ description_status: null,
103
+ images_status: null,
88
104
  brand: null,
89
- retailerOrder: 0,
90
105
  missing: {
91
- datasheet: 0,
92
- descriptions: 0,
93
- images: -1,
94
- },
95
- services: {
96
- datasheets: 1,
97
- descriptions: 1,
98
- images: 1,
106
+ datasheet: 33,
107
+ descriptions: 14,
108
+ images: 3,
99
109
  },
100
110
  article: {
101
- category: "ILUMINACIÓN|FOCOS|LEDS",
111
+ category: "SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
102
112
  company_name: "COMPANY DEV",
103
- country: "México",
104
- id_category: "2146",
105
- id_datasheet_especialist: 54,
106
- id_datasheet_facilitator: 52,
107
- id_description_especialist: 54,
108
- id_description_facilitator: 52,
109
- id_images_especialist: 55,
110
- id_images_facilitator: 53,
111
- id_order: 2,
112
- id_article: 35319,
113
- id_auditor: 30,
114
- name: "FOCO LED A19 (60W) LUZ AMARILLA",
115
- upc: "120873",
113
+ id_category: "684",
114
+ id_article: 33249,
115
+ name: "Crema dental ",
116
+ timestamp: "2022-06-14T23:24:08.000Z",
117
+ upc: "232435",
116
118
  },
117
119
  retailers: [
118
120
  {
119
- id: 58,
120
- name: "The Home Depot Golden",
121
+ id: 4,
122
+ name: "Walmart Super y Superama",
123
+ },
124
+ {
125
+ id: 9,
126
+ name: "Amazon",
127
+ },
128
+ {
129
+ id: 1013,
130
+ name: "Cencosud Colombia",
131
+ },
132
+ {
133
+ id: 2005,
134
+ name: "ClubCo",
121
135
  },
122
136
  ],
137
+ services: {
138
+ datasheets: 1,
139
+ descriptions: 1,
140
+ images: 1,
141
+ },
123
142
  retailersAvailable: [
124
143
  {
125
- id: 58,
126
- name: "The Home Depot Golden",
144
+ id: 4,
145
+ name: "Walmart Super y Superama",
146
+ },
147
+ {
148
+ id: 9,
149
+ name: "Amazon",
150
+ },
151
+ {
152
+ id: 1013,
153
+ name: "Cencosud Colombia",
154
+ },
155
+ {
156
+ id: 2005,
157
+ name: "ClubCo",
127
158
  },
128
159
  ],
129
- categoryName: "ILUMINACIÓN|FOCOS|LEDS",
130
- upc: "120873",
131
- id_article: 35319,
132
- id_order: 2,
160
+ id_article: 33249,
161
+ categoryName:
162
+ "SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
163
+ version_status: "RECEPTION",
133
164
  },
134
165
  },
135
166
  location: {
@@ -225,11 +225,14 @@ export const ProviderProductEdition = ({
225
225
 
226
226
  const getServices = async () => {
227
227
  const productInOrder = product.id_order || product.orderId;
228
+ const idArticle = product?.id_article || product?.article?.id_article;
228
229
  if (isRevision() || productInOrder) {
229
230
  const servicesResponse = await axios.get(
230
- `${process.env.REACT_APP_SERVICES_ENDPOINT}?articleId=${
231
- product?.id_article
232
- }&orderId=${product?.id_order ?? product.orderId}&end=true`
231
+ `${
232
+ process.env.REACT_APP_SERVICES_ENDPOINT
233
+ }?articleId=${idArticle}&orderId=${
234
+ product?.id_order ?? product.orderId
235
+ }&end=true`
233
236
  );
234
237
  const parsedResponse = JSON.parse(servicesResponse?.data?.body).data;
235
238
  setServicesData(parsedResponse);
@@ -339,17 +342,18 @@ export const ProviderProductEdition = ({
339
342
 
340
343
  useEffect(() => {
341
344
  if (services.length > 0) {
342
- if (services[0][activeRetailer?.id]?.data)
345
+ if (services[0][activeRetailer.id]?.data)
343
346
  services[0][activeRetailer.id].data = Object.values(
344
347
  services[0][activeRetailer.id].data
345
348
  );
346
349
  setActivePercentage(Math.round(activeRetailer?.percentage, 0));
347
350
 
348
- const datagroups = services[0][activeRetailer?.id];
351
+ const datagroups = services[0][activeRetailer.id];
349
352
  const inputs = services[0]?.inputs;
350
353
  const descriptions = services[1]?.filter(
351
354
  (service) => service?.id === activeRetailer?.id
352
355
  );
356
+ console.log(services[0], "services[0]");
353
357
  setDatasheets([datagroups, inputs]);
354
358
  setDescriptions(descriptions);
355
359
  }
@@ -918,8 +922,9 @@ export const ProviderProductEdition = ({
918
922
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
919
923
  };
920
924
 
921
- const evaluationComplete = () => {
922
- const concept = getConcept(activeTab);
925
+ const evaluationComplete = (tab) => {
926
+ console.log(servicesData, "servicesData");
927
+ const concept = getConcept(tab);
923
928
  let serv = servicesData.filter((item) => item.service === concept);
924
929
  if (
925
930
  ["RequestWithContentoh", "RequestWithoutContentoh"].includes(
@@ -1070,9 +1075,9 @@ export const ProviderProductEdition = ({
1070
1075
  };
1071
1076
 
1072
1077
  const sendEvaluation = async (result) => {
1078
+ setLoading(true);
1073
1079
  let data = {};
1074
1080
  const retailerId = activeRetailer?.id;
1075
- const productTemp = product;
1076
1081
  if (result) {
1077
1082
  data = {
1078
1083
  articleId: product.id_article,
@@ -1081,13 +1086,13 @@ export const ProviderProductEdition = ({
1081
1086
  result: result,
1082
1087
  retailerId,
1083
1088
  };
1084
- productTemp[`${concept}_status`] = `${result}P`;
1085
1089
  await axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
1086
1090
  headers: {
1087
1091
  Authorization: token,
1088
1092
  },
1089
1093
  });
1090
1094
  } else {
1095
+ const productTemp = product;
1091
1096
  const concept = getConcept(activeTab);
1092
1097
  productTemp[`${concept}_status`] = "Evaluated";
1093
1098
  data = {
@@ -1406,14 +1411,14 @@ export const ProviderProductEdition = ({
1406
1411
  )}
1407
1412
  <Button
1408
1413
  buttonType={
1409
- evaluationComplete() &&
1414
+ evaluationComplete(activeTab) &&
1410
1415
  (productEdit.product.id_order || productEdit.product.orderId)
1411
1416
  ? "general-green-button"
1412
1417
  : "general-button-disabled"
1413
1418
  }
1414
1419
  label={"Enviar evaluación"}
1415
1420
  onClick={() => {
1416
- setModalSent(true);
1421
+ //setModalSent(true);
1417
1422
  sendEvaluation();
1418
1423
  setMessage(
1419
1424
  `¡Evaluación de ${translateConcept()} completada!`
@@ -1477,10 +1482,10 @@ export const ProviderProductEdition = ({
1477
1482
  <GlobalModal
1478
1483
  close={() => setModalSent(false)}
1479
1484
  message={message}
1480
- detail={detail}
1481
- bold={!evaluationComplete() && "Aprueba / Rechaza"}
1482
- widthImg={!evaluationComplete() ? "160px" : "354px"}
1483
- heightImg={!evaluationComplete() ? "84px" : "354px"}
1485
+ detail={""}
1486
+ bold={!evaluationComplete(activeTab) && "Aprueba / Rechaza"}
1487
+ widthImg={!evaluationComplete(activeTab) ? "160px" : "354px"}
1488
+ heightImg={!evaluationComplete(activeTab) ? "84px" : "354px"}
1484
1489
  img={getSectionIcon()}
1485
1490
  />
1486
1491
  )}