contentoh-components-library 21.0.81 → 21.0.82

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.
@@ -34,7 +34,7 @@ var GalleryElement = function GalleryElement(_ref) {
34
34
  _ref$id = _ref.id,
35
35
  id = _ref$id === void 0 ? "chk-default" : _ref$id,
36
36
  label = _ref.label,
37
- index = _ref.index,
37
+ number = _ref.number,
38
38
  imageInputs = _ref.imageInputs,
39
39
  imageType = _ref.imageType,
40
40
  imagePackagingType = _ref.imagePackagingType,
@@ -117,7 +117,7 @@ var GalleryElement = function GalleryElement(_ref) {
117
117
  action: "changeImageInfo",
118
118
  attribute: "image_id",
119
119
  value: +e.target.value,
120
- index: index
120
+ index: number
121
121
  });
122
122
  }
123
123
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.default, {
@@ -130,7 +130,7 @@ var GalleryElement = function GalleryElement(_ref) {
130
130
  action: "changeImageInfo",
131
131
  attribute: "image_type",
132
132
  value: +e.target.value,
133
- index: index
133
+ index: number
134
134
  });
135
135
  }
136
136
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.default, {
@@ -143,7 +143,7 @@ var GalleryElement = function GalleryElement(_ref) {
143
143
  action: "changeImageInfo",
144
144
  attribute: "packing_type",
145
145
  value: +e.target.value,
146
- index: index
146
+ index: number
147
147
  });
148
148
  }
149
149
  })]
@@ -75,7 +75,10 @@ var StatusAsignationInfo = function StatusAsignationInfo(_ref) {
75
75
  }, [showAsignationPanel]);
76
76
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
77
77
  id: id,
78
- children: [showSaveButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
78
+ children: [status !== "-" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.StatusTag, {
79
+ statusType: status,
80
+ ovalForm: true
81
+ }), showSaveButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
79
82
  buttonType: "circular-button save-button",
80
83
  onClick: onClickSave
81
84
  }), imagesSection && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
@@ -462,7 +462,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
462
462
 
463
463
  setImages({
464
464
  action: "init",
465
- init: services[2]
465
+ init: JSON.parse(sessionStorage.getItem("imagesList")) || services[2]
466
466
  });
467
467
  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);
468
468
  setActiveRetailer(product.retailers ? product.retailers[0] : product.retailersAvailable[0]);
@@ -711,7 +711,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
711
711
  image: image,
712
712
  gridLayout: imageLayout,
713
713
  id: "gallery-element-" + index,
714
- index: index,
714
+ index: index + "-" + image.name,
715
+ number: index,
715
716
  imageType: imageType,
716
717
  imagePackagingType: imagePackagingType,
717
718
  imageInputs: imageInputs,
@@ -950,7 +951,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
950
951
  switch (_context9.prev = _context9.next) {
951
952
  case 0:
952
953
  if (!imagesUploaded) {
953
- _context9.next = 13;
954
+ _context9.next = 14;
954
955
  break;
955
956
  }
956
957
 
@@ -973,21 +974,22 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
973
974
 
974
975
  case 6:
975
976
  setMessage("Imágenes guardadas con éxito");
977
+ sessionStorage.removeItem("imagesList");
976
978
  loadData();
977
- _context9.next = 13;
979
+ _context9.next = 14;
978
980
  break;
979
981
 
980
- case 10:
981
- _context9.prev = 10;
982
+ case 11:
983
+ _context9.prev = 11;
982
984
  _context9.t0 = _context9["catch"](3);
983
985
  console.log(_context9.t0);
984
986
 
985
- case 13:
987
+ case 14:
986
988
  case "end":
987
989
  return _context9.stop();
988
990
  }
989
991
  }
990
- }, _callee9, null, [[3, 10]]);
992
+ }, _callee9, null, [[3, 11]]);
991
993
  })), [dataImages, imagesUploaded]);
992
994
 
993
995
  var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {// const srv = servicesData.filter((serv) => serv.service === getConcept(tab));
@@ -1422,24 +1424,39 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1422
1424
  };
1423
1425
 
1424
1426
  var deleteImages = function deleteImages() {
1425
- var data = {
1426
- articleId: product.id_article,
1427
- deleteImages: selectedImages
1428
- };
1427
+ setLoading(true);
1428
+ var imagesTemp = images;
1429
+ var values = images.values;
1430
+ var imgsInBack = [];
1431
+ selectedImages.forEach(function (selectedImg) {
1432
+ if (selectedImg.id) imgsInBack.push(selectedImg);
1433
+ });
1434
+ var imgsLeft = values.filter(function (value) {
1435
+ return selectedImages.indexOf(value) === -1;
1436
+ });
1437
+ imagesTemp.values = imgsLeft;
1429
1438
 
1430
- try {
1431
- _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), data, {
1432
- headers: {
1433
- Authorization: token
1434
- }
1435
- });
1439
+ if (imgsInBack.length > 0) {
1440
+ var data = {
1441
+ articleId: product.article.id_article,
1442
+ deleteImages: selectedImages
1443
+ };
1436
1444
 
1437
- loadData();
1438
- } catch (err) {
1439
- console.log(err);
1445
+ try {
1446
+ _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), data, {
1447
+ headers: {
1448
+ Authorization: token
1449
+ }
1450
+ });
1451
+ } catch (err) {
1452
+ console.log(err);
1453
+ }
1440
1454
  }
1441
1455
 
1456
+ sessionStorage.setItem("imagesList", JSON.stringify(imagesTemp));
1457
+ loadData();
1442
1458
  setMessage("");
1459
+ setComponentsArray([]);
1443
1460
  };
1444
1461
 
1445
1462
  var askToDeleteImages = function askToDeleteImages() {
@@ -1459,7 +1476,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1459
1476
  buttonType: "general-button-default",
1460
1477
  label: "Aceptar",
1461
1478
  onClick: function onClick() {
1462
- return deleteImages();
1479
+ setMessage("");
1480
+ deleteImages();
1463
1481
  }
1464
1482
  }, "3")]);
1465
1483
  }
@@ -36,46 +36,59 @@ RetailerProductEditionDefault.args = {
36
36
  category: 846,
37
37
  version: 2,
38
38
  productSelected: {
39
- orderId: 132,
40
- id_category: "612",
39
+ services: {
40
+ datasheets: 1,
41
+ descriptions: 1,
42
+ images: 1
43
+ },
44
+ orderId: 233,
41
45
  status: "IN_PROGRESS",
42
- datasheet_status: "QF",
46
+ datasheet_status: "IN_PROGRESS",
43
47
  prio: "none",
44
48
  version: 2,
45
- description_status: "IN_PROGRESS",
46
- images_status: "IN_PROGRESS",
47
- brand: null,
48
- missing: {
49
- datasheet: 0,
50
- descriptions: 0,
51
- images: 0
52
- },
49
+ description_status: "QF",
50
+ images_status: "QF",
53
51
  article: {
54
- category: "ROPA, ACCESORIOS, FRAGANCIAS Y JOYERÍA|ACCESORIOS|COLLARES",
52
+ id_article: 190965,
53
+ id_category: "697",
54
+ name: "Shampoo hidratante",
55
+ upc: "6545345",
56
+ timestamp: "2022-06-10T15:05:56.000Z",
57
+ id_user: 28,
58
+ status: "NULL",
59
+ active: 1,
60
+ company_id: 1,
55
61
  company_name: "COMPANY DEV",
56
- id_category: "612",
57
- id_article: 109490,
58
- name: "Collar con dije letra ",
59
- timestamp: "2022-05-05T16:45:49.000Z",
60
- upc: "123434"
62
+ country: "México",
63
+ id_order: 233,
64
+ id_datasheet_especialist: 54,
65
+ id_datasheet_facilitator: 52,
66
+ id_description_especialist: 54,
67
+ id_description_facilitator: 52,
68
+ id_images_especialist: 55,
69
+ id_images_facilitator: 53,
70
+ id_auditor: 30,
71
+ id_recepcionist: null,
72
+ category: "SALUD Y BELLEZA|CUIDADO DEL CABELLO|SHAMPOOS Y ACONDICIONADORES",
73
+ missingAttributes: null,
74
+ missingDescriptions: null,
75
+ missingImages: null
61
76
  },
62
77
  retailers: [{
63
- id: 2,
64
- name: "Walmart Mercancías Generales"
65
- }],
66
- services: {
67
- datasheets: 1,
68
- descriptions: 1,
69
- images: 1
70
- },
71
- checked: false,
72
- retailersAvailable: [{
73
- id: 2,
74
- name: "Walmart Mercancías Generales"
78
+ id: 4,
79
+ name: "Walmart Super y Superama",
80
+ country: "México",
81
+ id_region: 1,
82
+ active: 1
83
+ }, {
84
+ id: 26,
85
+ name: "Mercado Libre",
86
+ country: "México",
87
+ id_region: 1,
88
+ active: 1
75
89
  }],
76
- id_article: 109490,
77
- categoryName: "ROPA, ACCESORIOS, FRAGANCIAS Y JOYERÍA|ACCESORIOS|COLLARES",
78
- version_status: "IN_PROGRESS"
90
+ country: "México",
91
+ upc: "6545345"
79
92
  },
80
93
  location: {
81
94
  product: {
@@ -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,
@@ -390,7 +390,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
390
390
 
391
391
  setImages({
392
392
  action: "init",
393
- init: services[2]
393
+ init: JSON.parse(sessionStorage.getItem("imagesList")) || services[2]
394
394
  });
395
395
  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
396
  setActiveRetailer(product.retailers ? product.retailers[0] : product.retailersAvailable[0]);
@@ -424,7 +424,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
424
424
  switch (_context3.prev = _context3.next) {
425
425
  case 0:
426
426
  _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"));
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) || product.orderId, "&end=true"));
428
428
 
429
429
  case 2:
430
430
  servicesResponse = _context3.sent;
@@ -656,7 +656,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
656
656
  image: image,
657
657
  gridLayout: imageLayout,
658
658
  id: "gallery-element-" + index,
659
- index: index,
659
+ index: index + "-" + image.name,
660
+ number: index,
660
661
  imageType: imageType,
661
662
  imagePackagingType: imagePackagingType,
662
663
  imageInputs: imageInputs,
@@ -900,7 +901,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
900
901
  switch (_context9.prev = _context9.next) {
901
902
  case 0:
902
903
  if (!imagesUploaded) {
903
- _context9.next = 13;
904
+ _context9.next = 14;
904
905
  break;
905
906
  }
906
907
 
@@ -923,21 +924,22 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
923
924
 
924
925
  case 6:
925
926
  setMessage("Imágenes guardadas con éxito");
927
+ sessionStorage.removeItem("imagesList");
926
928
  loadData();
927
- _context9.next = 13;
929
+ _context9.next = 14;
928
930
  break;
929
931
 
930
- case 10:
931
- _context9.prev = 10;
932
+ case 11:
933
+ _context9.prev = 11;
932
934
  _context9.t0 = _context9["catch"](3);
933
935
  console.log(_context9.t0);
934
936
 
935
- case 13:
937
+ case 14:
936
938
  case "end":
937
939
  return _context9.stop();
938
940
  }
939
941
  }
940
- }, _callee9, null, [[3, 10]]);
942
+ }, _callee9, null, [[3, 11]]);
941
943
  })), [dataImages, imagesUploaded]);
942
944
 
943
945
  var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {
@@ -1458,24 +1460,39 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1458
1460
  };
1459
1461
 
1460
1462
  var deleteImages = function deleteImages() {
1461
- var data = {
1462
- articleId: product.article.id_article,
1463
- deleteImages: selectedImages
1464
- };
1463
+ setLoading(true);
1464
+ var imagesTemp = images;
1465
+ var values = images.values;
1466
+ var imgsInBack = [];
1467
+ selectedImages.forEach(function (selectedImg) {
1468
+ if (selectedImg.id) imgsInBack.push(selectedImg);
1469
+ });
1470
+ var imgsLeft = values.filter(function (value) {
1471
+ return selectedImages.indexOf(value) === -1;
1472
+ });
1473
+ imagesTemp.values = imgsLeft;
1465
1474
 
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
- });
1475
+ if (imgsInBack.length > 0) {
1476
+ var data = {
1477
+ articleId: product.article.id_article,
1478
+ deleteImages: selectedImages
1479
+ };
1472
1480
 
1473
- loadData();
1474
- } catch (err) {
1475
- console.log(err);
1481
+ try {
1482
+ _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), data, {
1483
+ headers: {
1484
+ Authorization: token
1485
+ }
1486
+ });
1487
+ } catch (err) {
1488
+ console.log(err);
1489
+ }
1476
1490
  }
1477
1491
 
1492
+ sessionStorage.setItem("imagesList", JSON.stringify(imagesTemp));
1493
+ loadData();
1478
1494
  setMessage("");
1495
+ setComponentsArray([]);
1479
1496
  };
1480
1497
 
1481
1498
  var askToDeleteImages = function askToDeleteImages() {
@@ -1495,7 +1512,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1495
1512
  buttonType: "general-button-default",
1496
1513
  label: "Aceptar",
1497
1514
  onClick: function onClick() {
1498
- return deleteImages();
1515
+ setMessage("");
1516
+ deleteImages();
1499
1517
  }
1500
1518
  }, "3")]);
1501
1519
  }
@@ -1599,19 +1617,17 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1599
1617
  isRetailer: isRetailer,
1600
1618
  showSaveButton: true,
1601
1619
  onClickSave: function onClickSave() {
1602
- var _product$services2, _product$services3, _product$services4;
1603
-
1604
1620
  switch (activeTab) {
1605
1621
  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();
1622
+ (product === null || product === void 0 ? void 0 : product.description_status) !== "NS" && saveDescriptions();
1607
1623
  break;
1608
1624
 
1609
1625
  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();
1626
+ (product === null || product === void 0 ? void 0 : product.datasheet_status) !== "NS" && saveDatasheets();
1611
1627
  break;
1612
1628
 
1613
1629
  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();
1630
+ (product === null || product === void 0 ? void 0 : product.images_status) !== "NS" && updateImages();
1615
1631
  break;
1616
1632
 
1617
1633
  default:
@@ -1621,7 +1637,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1621
1637
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1622
1638
  className: "services-information-container " + (imageLayout && activeTab === "Imágenes" ? "image-services" : ""),
1623
1639
  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, {
1640
+ 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
1641
  setSelectedImages: setSelectedImages,
1626
1642
  checkAll: checkAll,
1627
1643
  setCheckAll: setCheckAll
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.82",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",