contentoh-components-library 21.0.81 → 21.0.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.
@@ -123,7 +123,7 @@ var myBucket = new _awsSdk.default.S3({
123
123
  });
124
124
 
125
125
  var RetailerProductEdition = function RetailerProductEdition(_ref) {
126
- var _product$retailers, _product$services5, _datasheets$, _datasheets$$data, _product$article13;
126
+ var _product$retailers, _product$services2, _datasheets$, _datasheets$$data, _product$article13;
127
127
 
128
128
  var tabsSections = _ref.tabsSections,
129
129
  _ref$productSelected = _ref.productSelected,
@@ -367,6 +367,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
367
367
  statusArray = _useState64[0],
368
368
  setStatusArray = _useState64[1];
369
369
 
370
+ var _useState65 = (0, _react.useState)(null),
371
+ _useState66 = (0, _slicedToArray2.default)(_useState65, 2),
372
+ socketType = _useState66[0],
373
+ setSocketType = _useState66[1];
374
+
370
375
  (0, _react.useEffect)(function () {
371
376
  checkAll && setSelectedImages(images.values);
372
377
  }, [checkAll]);
@@ -390,7 +395,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
390
395
 
391
396
  setImages({
392
397
  action: "init",
393
- init: services[2]
398
+ init: JSON.parse(sessionStorage.getItem("imagesList")) || services[2]
394
399
  });
395
400
  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);
396
401
  setActiveRetailer(product.retailers ? product.retailers[0] : product.retailersAvailable[0]);
@@ -424,7 +429,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
424
429
  switch (_context3.prev = _context3.next) {
425
430
  case 0:
426
431
  _context3.next = 2;
427
- return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_article, "&orderId=").concat(product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_order, "&end=true"));
432
+ return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_article, "&orderId=").concat((product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_order) || product.orderId, "&end=true"));
428
433
 
429
434
  case 2:
430
435
  servicesResponse = _context3.sent;
@@ -629,15 +634,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
629
634
  }, [activeRetailer, services]);
630
635
 
631
636
  var thumbs = function thumbs() {
632
- var _images$inputs, _images$imageType, _images$imagePackagin, _images$values;
637
+ var _images$imageType, _images$imagePackagin, _images$values;
633
638
 
634
- var imageInputs = images === null || images === void 0 ? void 0 : (_images$inputs = images.inputs) === null || _images$inputs === void 0 ? void 0 : _images$inputs.map(function (e) {
635
- return {
636
- value: e === null || e === void 0 ? void 0 : e.id,
637
- name: e === null || e === void 0 ? void 0 : e.name,
638
- required: e === null || e === void 0 ? void 0 : e.required
639
- };
640
- });
639
+ var imageInputs = socketType.slice();
641
640
  var imageType = images === null || images === void 0 ? void 0 : (_images$imageType = images.imageType) === null || _images$imageType === void 0 ? void 0 : _images$imageType.map(function (e) {
642
641
  return {
643
642
  value: e === null || e === void 0 ? void 0 : e.id,
@@ -656,10 +655,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
656
655
  image: image,
657
656
  gridLayout: imageLayout,
658
657
  id: "gallery-element-" + index,
659
- index: index,
658
+ index: index + "-" + image.name,
659
+ number: index,
660
660
  imageType: imageType,
661
661
  imagePackagingType: imagePackagingType,
662
662
  imageInputs: imageInputs,
663
+ setSocketType: setSocketType,
663
664
  changeImage: setImages,
664
665
  selectedImages: selectedImages,
665
666
  setSelectedImages: setSelectedImages
@@ -776,6 +777,21 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
776
777
  };
777
778
  }();
778
779
 
780
+ (0, _react.useEffect)(function () {
781
+ var _images$inputs;
782
+
783
+ var imageInputs = images === null || images === void 0 ? void 0 : (_images$inputs = images.inputs) === null || _images$inputs === void 0 ? void 0 : _images$inputs.map(function (e) {
784
+ return {
785
+ value: e === null || e === void 0 ? void 0 : e.id,
786
+ name: e === null || e === void 0 ? void 0 : e.name,
787
+ required: e === null || e === void 0 ? void 0 : e.required,
788
+ active: images === null || images === void 0 ? void 0 : images.values.some(function (value) {
789
+ return (value === null || value === void 0 ? void 0 : value.image_id) === (e === null || e === void 0 ? void 0 : e.id);
790
+ })
791
+ };
792
+ });
793
+ setSocketType(imageInputs);
794
+ }, [images]);
779
795
  var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
780
796
  var _images$values2, _product$article10, _data$articleData, _data$articleData2, _data$updateImages;
781
797
 
@@ -900,7 +916,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
900
916
  switch (_context9.prev = _context9.next) {
901
917
  case 0:
902
918
  if (!imagesUploaded) {
903
- _context9.next = 13;
919
+ _context9.next = 14;
904
920
  break;
905
921
  }
906
922
 
@@ -923,21 +939,22 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
923
939
 
924
940
  case 6:
925
941
  setMessage("Imágenes guardadas con éxito");
942
+ sessionStorage.removeItem("imagesList");
926
943
  loadData();
927
- _context9.next = 13;
944
+ _context9.next = 14;
928
945
  break;
929
946
 
930
- case 10:
931
- _context9.prev = 10;
947
+ case 11:
948
+ _context9.prev = 11;
932
949
  _context9.t0 = _context9["catch"](3);
933
950
  console.log(_context9.t0);
934
951
 
935
- case 13:
952
+ case 14:
936
953
  case "end":
937
954
  return _context9.stop();
938
955
  }
939
956
  }
940
- }, _callee9, null, [[3, 10]]);
957
+ }, _callee9, null, [[3, 11]]);
941
958
  })), [dataImages, imagesUploaded]);
942
959
 
943
960
  var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {
@@ -990,8 +1007,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
990
1007
  };
991
1008
 
992
1009
  var approveRejectButtons = function approveRejectButtons(action) {
993
- var concept = getConcept(activeTab);
994
- concept = action ? action : concept;
1010
+ var concept = getConcept(action || activeTab);
995
1011
 
996
1012
  var _servicesData$filter = servicesData.filter(function (srv) {
997
1013
  return srv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && srv.service === concept;
@@ -1150,24 +1166,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1150
1166
  }();
1151
1167
 
1152
1168
  var userAssigned = function userAssigned(tab, rol) {
1153
- var concept = "";
1154
-
1155
- switch (tab) {
1156
- case "Ficha técnica":
1157
- concept = "datasheet";
1158
- break;
1159
-
1160
- case "Imágenes":
1161
- concept = "images";
1162
- break;
1163
-
1164
- default:
1165
- concept = "description";
1166
- break;
1167
- }
1168
-
1169
+ var concept = getConcept(activeTab);
1169
1170
  var allowedRoles = [1, 4, 5, 6, 7, 8];
1170
- var validUser = allowedRoles.indexOf(user === null || user === void 0 ? void 0 : user.id_role) !== -1;
1171
+ var validUser = allowedRoles.includes(user === null || user === void 0 ? void 0 : user.id_role);
1171
1172
 
1172
1173
  if (!rol) {
1173
1174
  switch (user.id_role) {
@@ -1458,24 +1459,39 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1458
1459
  };
1459
1460
 
1460
1461
  var deleteImages = function deleteImages() {
1461
- var data = {
1462
- articleId: product.article.id_article,
1463
- deleteImages: selectedImages
1464
- };
1462
+ setLoading(true);
1463
+ var imagesTemp = images;
1464
+ var values = images.values;
1465
+ var imgsInBack = [];
1466
+ selectedImages.forEach(function (selectedImg) {
1467
+ if (selectedImg.id) imgsInBack.push(selectedImg);
1468
+ });
1469
+ var imgsLeft = values.filter(function (value) {
1470
+ return selectedImages.indexOf(value) === -1;
1471
+ });
1472
+ imagesTemp.values = imgsLeft;
1465
1473
 
1466
- try {
1467
- _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), data, {
1468
- headers: {
1469
- Authorization: token
1470
- }
1471
- });
1474
+ if (imgsInBack.length > 0) {
1475
+ var data = {
1476
+ articleId: product.article.id_article,
1477
+ deleteImages: selectedImages
1478
+ };
1472
1479
 
1473
- loadData();
1474
- } catch (err) {
1475
- console.log(err);
1480
+ try {
1481
+ _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), data, {
1482
+ headers: {
1483
+ Authorization: token
1484
+ }
1485
+ });
1486
+ } catch (err) {
1487
+ console.log(err);
1488
+ }
1476
1489
  }
1477
1490
 
1491
+ sessionStorage.setItem("imagesList", JSON.stringify(imagesTemp));
1492
+ loadData();
1478
1493
  setMessage("");
1494
+ setComponentsArray([]);
1479
1495
  };
1480
1496
 
1481
1497
  var askToDeleteImages = function askToDeleteImages() {
@@ -1495,7 +1511,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1495
1511
  buttonType: "general-button-default",
1496
1512
  label: "Aceptar",
1497
1513
  onClick: function onClick() {
1498
- return deleteImages();
1514
+ setMessage("");
1515
+ deleteImages();
1499
1516
  }
1500
1517
  }, "3")]);
1501
1518
  }
@@ -1599,19 +1616,17 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1599
1616
  isRetailer: isRetailer,
1600
1617
  showSaveButton: true,
1601
1618
  onClickSave: function onClickSave() {
1602
- var _product$services2, _product$services3, _product$services4;
1603
-
1604
1619
  switch (activeTab) {
1605
1620
  case "Descripción":
1606
- (product === null || product === void 0 ? void 0 : (_product$services2 = product.services) === null || _product$services2 === void 0 ? void 0 : _product$services2.descriptions) === 1 && saveDescriptions();
1621
+ (product === null || product === void 0 ? void 0 : product.description_status) !== "NS" && saveDescriptions();
1607
1622
  break;
1608
1623
 
1609
1624
  case "Ficha técnica":
1610
- (product === null || product === void 0 ? void 0 : (_product$services3 = product.services) === null || _product$services3 === void 0 ? void 0 : _product$services3.datasheets) === 1 && saveDatasheets();
1625
+ (product === null || product === void 0 ? void 0 : product.datasheet_status) !== "NS" && saveDatasheets();
1611
1626
  break;
1612
1627
 
1613
1628
  case "Imágenes":
1614
- (product === null || product === void 0 ? void 0 : (_product$services4 = product.services) === null || _product$services4 === void 0 ? void 0 : _product$services4.images) === 1 && updateImages();
1629
+ (product === null || product === void 0 ? void 0 : product.images_status) !== "NS" && updateImages();
1615
1630
  break;
1616
1631
 
1617
1632
  default:
@@ -1621,7 +1636,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1621
1636
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1622
1637
  className: "services-information-container " + (imageLayout && activeTab === "Imágenes" ? "image-services" : ""),
1623
1638
  children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1624
- children: [!imageLayout && activeTab === "Imágenes" && (product === null || product === void 0 ? void 0 : (_product$services5 = product.services) === null || _product$services5 === void 0 ? void 0 : _product$services5.images) === 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
1639
+ children: [!imageLayout && activeTab === "Imágenes" && (product === null || product === void 0 ? void 0 : (_product$services2 = product.services) === null || _product$services2 === void 0 ? void 0 : _product$services2.images) === 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
1625
1640
  setSelectedImages: setSelectedImages,
1626
1641
  checkAll: checkAll,
1627
1642
  setCheckAll: setCheckAll
package/dist/index.js CHANGED
@@ -602,7 +602,7 @@ Object.keys(_index45).forEach(function (key) {
602
602
  });
603
603
  });
604
604
 
605
- var _index46 = require("./components/organisms/ChangePassword/index");
605
+ var _index46 = require("./components/molecules/RetailerSelector/index");
606
606
 
607
607
  Object.keys(_index46).forEach(function (key) {
608
608
  if (key === "default" || key === "__esModule") return;
@@ -615,7 +615,7 @@ Object.keys(_index46).forEach(function (key) {
615
615
  });
616
616
  });
617
617
 
618
- var _index47 = require("./components/organisms/Fullplan/index");
618
+ var _index47 = require("./components/organisms/ChangePassword/index");
619
619
 
620
620
  Object.keys(_index47).forEach(function (key) {
621
621
  if (key === "default" || key === "__esModule") return;
@@ -628,7 +628,7 @@ Object.keys(_index47).forEach(function (key) {
628
628
  });
629
629
  });
630
630
 
631
- var _index48 = require("./components/organisms/FullProductNameHeader/index");
631
+ var _index48 = require("./components/organisms/Fullplan/index");
632
632
 
633
633
  Object.keys(_index48).forEach(function (key) {
634
634
  if (key === "default" || key === "__esModule") return;
@@ -641,7 +641,7 @@ Object.keys(_index48).forEach(function (key) {
641
641
  });
642
642
  });
643
643
 
644
- var _index49 = require("./components/organisms/FullTabsMenu/index");
644
+ var _index49 = require("./components/organisms/FullProductNameHeader/index");
645
645
 
646
646
  Object.keys(_index49).forEach(function (key) {
647
647
  if (key === "default" || key === "__esModule") return;
@@ -654,7 +654,7 @@ Object.keys(_index49).forEach(function (key) {
654
654
  });
655
655
  });
656
656
 
657
- var _index50 = require("./components/organisms/ImageDataTable/index");
657
+ var _index50 = require("./components/organisms/FullTabsMenu/index");
658
658
 
659
659
  Object.keys(_index50).forEach(function (key) {
660
660
  if (key === "default" || key === "__esModule") return;
@@ -667,7 +667,7 @@ Object.keys(_index50).forEach(function (key) {
667
667
  });
668
668
  });
669
669
 
670
- var _index51 = require("./components/organisms/ImagePreviewer/index");
670
+ var _index51 = require("./components/organisms/ImageDataTable/index");
671
671
 
672
672
  Object.keys(_index51).forEach(function (key) {
673
673
  if (key === "default" || key === "__esModule") return;
@@ -680,7 +680,7 @@ Object.keys(_index51).forEach(function (key) {
680
680
  });
681
681
  });
682
682
 
683
- var _index52 = require("./components/organisms/ImagesGroup/index");
683
+ var _index52 = require("./components/organisms/ImagePreviewer/index");
684
684
 
685
685
  Object.keys(_index52).forEach(function (key) {
686
686
  if (key === "default" || key === "__esModule") return;
@@ -693,7 +693,7 @@ Object.keys(_index52).forEach(function (key) {
693
693
  });
694
694
  });
695
695
 
696
- var _index53 = require("./components/organisms/InputGroup/index");
696
+ var _index53 = require("./components/organisms/ImagesGroup/index");
697
697
 
698
698
  Object.keys(_index53).forEach(function (key) {
699
699
  if (key === "default" || key === "__esModule") return;
@@ -706,7 +706,7 @@ Object.keys(_index53).forEach(function (key) {
706
706
  });
707
707
  });
708
708
 
709
- var _index54 = require("./components/organisms/ProductImageModal/index");
709
+ var _index54 = require("./components/organisms/InputGroup/index");
710
710
 
711
711
  Object.keys(_index54).forEach(function (key) {
712
712
  if (key === "default" || key === "__esModule") return;
@@ -719,6 +719,19 @@ Object.keys(_index54).forEach(function (key) {
719
719
  });
720
720
  });
721
721
 
722
+ var _index55 = require("./components/organisms/ProductImageModal/index");
723
+
724
+ Object.keys(_index55).forEach(function (key) {
725
+ if (key === "default" || key === "__esModule") return;
726
+ if (key in exports && exports[key] === _index55[key]) return;
727
+ Object.defineProperty(exports, key, {
728
+ enumerable: true,
729
+ get: function get() {
730
+ return _index55[key];
731
+ }
732
+ });
733
+ });
734
+
722
735
  var _ChangePasswordLogin = require("./components/pages/ChangePasswordLogin");
723
736
 
724
737
  Object.keys(_ChangePasswordLogin).forEach(function (key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.0.81",
3
+ "version": "21.0.84",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -20,6 +20,7 @@ export const GalleryElement = ({
20
20
  selectedImages,
21
21
  setSelectedImages,
22
22
  setCheckAll,
23
+ setSocketType,
23
24
  }) => {
24
25
  const [statusValidation, setStatusValidation] = useState(validation);
25
26
  const [showValidationPanel, setShowValidationPanel] = useState(false);
@@ -76,7 +77,9 @@ export const GalleryElement = ({
76
77
  <Select
77
78
  width="100%"
78
79
  placeholder="Tipo de toma"
79
- options={imageInputs}
80
+ options={imageInputs?.filter(
81
+ (img) => img.value === image.image_id || !img.active
82
+ )}
80
83
  valueSelected={image.image_id}
81
84
  onChange={(e) => {
82
85
  changeImage({
@@ -8,9 +8,12 @@ export const Container = styled.div`
8
8
  border-bottom: 1px solid ${GlobalColors.s2};
9
9
 
10
10
  .input-name-header {
11
- overflow: auto;
11
+ overflow-x: auto;
12
12
  max-width: 40%;
13
13
  white-space: nowrap;
14
+ height: 23px;
15
+ line-height: 23px;
16
+ text-overflow: initial;
14
17
  }
15
18
  .status-asignation-info {
16
19
  display: flex;
@@ -21,68 +21,116 @@ ProviderProductEditionDefault.args = {
21
21
  category: 846,
22
22
  version: 2,
23
23
  productSelected: {
24
- id_article: 32,
25
- id_category: "781",
26
- name: "PRODUCTO 10",
27
- upc: "PRUEBA10",
28
- timestamp: "2021-11-09T23:22:36.000Z",
29
- status: "NULL",
30
- categoryName: "TECNOLOGÍA Y ELECTRÓNICA|VIDEO|DVD Y BLU-RAY",
31
- asignations: [],
24
+ orderId: 2,
25
+ status: "AA",
26
+ datasheet_status: "AA",
27
+ prio: "none",
32
28
  version: 2,
33
- version_status: "AC",
34
- retailersAvailable: [
29
+ description_status: "AP",
30
+ images_status: "AA",
31
+ brand: null,
32
+ retailerOrder: 0,
33
+ missing: {
34
+ datasheet: 0,
35
+ descriptions: 0,
36
+ images: -1,
37
+ },
38
+ services: {
39
+ datasheets: 1,
40
+ descriptions: 1,
41
+ images: 1,
42
+ },
43
+ article: {
44
+ category: "ILUMINACIÓN|FOCOS|LEDS",
45
+ 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",
59
+ },
60
+ retailers: [
35
61
  {
36
- id: 2,
37
- name: "Walmart Mercancías Generales",
38
- country: "México",
39
- id_region: 1,
40
- active: 1,
62
+ id: 58,
63
+ name: "The Home Depot Golden",
41
64
  },
65
+ ],
66
+ retailersAvailable: [
42
67
  {
43
- id: 3,
44
- name: "Sam´s Club",
45
- country: "México",
46
- id_region: 1,
47
- active: 1,
68
+ id: 58,
69
+ name: "The Home Depot Golden",
48
70
  },
49
71
  ],
50
- missing: {},
72
+ categoryName: "ILUMINACIÓN|FOCOS|LEDS",
73
+ upc: "120873",
74
+ id_article: 35319,
75
+ id_order: 2,
51
76
  },
52
77
  productToEdit: {
53
- idCategory: "781",
54
- ArticleId: 32,
55
- product: [
56
- {
57
- id_article: 32,
58
- id_category: "781",
59
- name: "PRODUCTO 10",
60
- upc: "PRUEBA10",
61
- timestamp: "2021-11-09T23:22:36.000Z",
62
- status: "NULL",
63
- categoryName: "TECNOLOGÍA Y ELECTRÓNICA|VIDEO|DVD Y BLU-RAY",
64
- asignations: [],
65
- version: 2,
66
- version_status: "AC",
67
- retailersAvailable: [
68
- {
69
- id: 2,
70
- name: "Walmart Mercancías Generales",
71
- country: "México",
72
- id_region: 1,
73
- active: 1,
74
- },
75
- {
76
- id: 3,
77
- name: "Sam´s Club",
78
- country: "México",
79
- id_region: 1,
80
- active: 1,
81
- },
82
- ],
83
- missing: {},
78
+ ArticleId: 35319,
79
+ idCategory: "2146",
80
+ product: {
81
+ orderId: 2,
82
+ status: "AA",
83
+ datasheet_status: "AA",
84
+ prio: "none",
85
+ version: 2,
86
+ description_status: "AP",
87
+ images_status: "AA",
88
+ brand: null,
89
+ retailerOrder: 0,
90
+ missing: {
91
+ datasheet: 0,
92
+ descriptions: 0,
93
+ images: -1,
84
94
  },
85
- ],
95
+ services: {
96
+ datasheets: 1,
97
+ descriptions: 1,
98
+ images: 1,
99
+ },
100
+ article: {
101
+ category: "ILUMINACIÓN|FOCOS|LEDS",
102
+ 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",
116
+ },
117
+ retailers: [
118
+ {
119
+ id: 58,
120
+ name: "The Home Depot Golden",
121
+ },
122
+ ],
123
+ retailersAvailable: [
124
+ {
125
+ id: 58,
126
+ name: "The Home Depot Golden",
127
+ },
128
+ ],
129
+ categoryName: "ILUMINACIÓN|FOCOS|LEDS",
130
+ upc: "120873",
131
+ id_article: 35319,
132
+ id_order: 2,
133
+ },
86
134
  },
87
135
  location: {
88
136
  product: { articleId: 109485, versionId: 3 },
@@ -118,6 +166,6 @@ ProviderProductEditionDefault.args = {
118
166
  products_limit: "5000",
119
167
  type: "Enterprise",
120
168
  },
121
- src: "https://content-management-profile.s3.amazonaws.com/id-28/28.png?1653957474326",
169
+ src: "https://content-management-profile.s3.amazonaws.com/id-28/28.png?1655246340910",
122
170
  },
123
171
  };
@@ -192,6 +192,7 @@ export const ProviderProductEdition = ({
192
192
  img: face,
193
193
  });
194
194
  const [modalViewTextArea, setModalViewTextArea] = useState(false);
195
+ const [socketType, setSocketType] = useState(null);
195
196
 
196
197
  useEffect(() => {
197
198
  checkAll && setSelectedImages(images.values);
@@ -355,11 +356,7 @@ export const ProviderProductEdition = ({
355
356
  }, [activeRetailer, services]);
356
357
 
357
358
  const thumbs = () => {
358
- const imageInputs = images?.inputs?.map((e) => ({
359
- value: e?.id,
360
- name: e?.name,
361
- required: e?.required,
362
- }));
359
+ const imageInputs = socketType.slice();
363
360
  const imageType = images?.imageType?.map((e) => ({
364
361
  value: e?.id,
365
362
  name: e?.name,
@@ -387,6 +384,16 @@ export const ProviderProductEdition = ({
387
384
  ));
388
385
  };
389
386
 
387
+ useEffect(() => {
388
+ const imageInputs = images?.inputs?.map((e) => ({
389
+ value: e?.id,
390
+ name: e?.name,
391
+ required: e?.required,
392
+ active: images?.values.some((value) => value?.image_id === e?.id),
393
+ }));
394
+ setSocketType(imageInputs);
395
+ }, [images]);
396
+
390
397
  const saveDescriptions = async () => {
391
398
  setLoading(true);
392
399
  const productTemp = product;
@@ -1065,6 +1072,7 @@ export const ProviderProductEdition = ({
1065
1072
  const sendEvaluation = async (result) => {
1066
1073
  let data = {};
1067
1074
  const retailerId = activeRetailer?.id;
1075
+ const productTemp = product;
1068
1076
  if (result) {
1069
1077
  data = {
1070
1078
  articleId: product.id_article,
@@ -1073,6 +1081,7 @@ export const ProviderProductEdition = ({
1073
1081
  result: result,
1074
1082
  retailerId,
1075
1083
  };
1084
+ productTemp[`${concept}_status`] = `${result}P`;
1076
1085
  await axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
1077
1086
  headers: {
1078
1087
  Authorization: token,
@@ -1080,7 +1089,6 @@ export const ProviderProductEdition = ({
1080
1089
  });
1081
1090
  } else {
1082
1091
  const concept = getConcept(activeTab);
1083
- const productTemp = product;
1084
1092
  productTemp[`${concept}_status`] = "Evaluated";
1085
1093
  data = {
1086
1094
  articleId: product.id_article,
@@ -1249,7 +1257,10 @@ export const ProviderProductEdition = ({
1249
1257
  />
1250
1258
  <FullTabsMenu
1251
1259
  tabsSections={tabsSections}
1252
- status={product?.version_status}
1260
+ status={
1261
+ product[`${getConcept(activeTab)}_status`] ||
1262
+ product?.version_status
1263
+ }
1253
1264
  activeTab={activeTab}
1254
1265
  setActiveTab={setActiveTab}
1255
1266
  setImageLayout={setImageLayout}