contentoh-components-library 21.0.79 → 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.
@@ -36,7 +36,10 @@ var GeneralInput = function GeneralInput(_ref) {
36
36
  setUpdatedDescriptions = _ref.setUpdatedDescriptions,
37
37
  maxChar = _ref.maxChar,
38
38
  isRequired = _ref.isRequired,
39
- version = _ref.version;
39
+ version = _ref.version,
40
+ _ref$optionList = _ref.optionList,
41
+ optionList = _ref$optionList === void 0 ? [] : _ref$optionList,
42
+ description = _ref.description;
40
43
 
41
44
  var _useState = (0, _react.useState)({
42
45
  value: inputValue
@@ -90,9 +93,27 @@ var GeneralInput = function GeneralInput(_ref) {
90
93
 
91
94
  setRequiredEmpty(isRequired && (((_textValue$value = textValue.value) === null || _textValue$value === void 0 ? void 0 : _textValue$value.length) === 0 || textValue.value === undefined));
92
95
  }, [textValue]);
93
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
96
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
94
97
  isRequired: requiredEmpty,
95
- children: inputType === "checkbox" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckBox.CheckBox, {
98
+ children: [(optionList === null || optionList === void 0 ? void 0 : optionList.length) > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("select", {
99
+ id: "dropdown".concat(inputId) //disabled={!enableInputs}
100
+ ,
101
+ onChange: function onChange(e) {
102
+ return onHandleChange(e);
103
+ },
104
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
105
+ value: "",
106
+ selected: true,
107
+ disabled: true,
108
+ children: description
109
+ }), JSON.parse(optionList || "[]").map(function (element) {
110
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
111
+ value: element,
112
+ selected: element === textValue.value ? "selected" : "",
113
+ children: element
114
+ }, element);
115
+ })]
116
+ }, "dropdownK".concat(inputId)) : inputType === "checkbox" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckBox.CheckBox, {
96
117
  id: inputId,
97
118
  onChange: function onChange(e) {
98
119
  return onHandleChange(e);
@@ -121,7 +142,9 @@ var GeneralInput = function GeneralInput(_ref) {
121
142
  setUpdatedDescriptions: setUpdatedDescriptions,
122
143
  maxChar: maxChar,
123
144
  isRequired: isRequired
124
- })
145
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
146
+ children: description
147
+ })]
125
148
  });
126
149
  };
127
150
 
@@ -15,12 +15,15 @@ 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 width: 100%;\n\n > div {\n label {\n &:before {\n outline: 1px solid ", ";\n }\n }\n }\n\n input,\n textarea {\n width: 100%;\n border: 1px solid\n ", ";\n\n font-family: ", ";\n color: ", ";\n font-weight: normal;\n font-size: 12px;\n line-height: 15px;\n padding: 10px;\n outline: none;\n border-radius: 2px;\n resize: none;\n\n &:focus {\n border: 1px solid ", ";\n }\n }\n"])), function (_ref) {
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n\n > div {\n label {\n &:before {\n outline: 1px solid ", ";\n }\n }\n }\n\n input,\n textarea {\n width: 100%;\n border: 1px solid\n ", ";\n\n font-family: ", ";\n color: ", ";\n font-weight: normal;\n font-size: 12px;\n line-height: 15px;\n padding: 10px;\n outline: none;\n border-radius: 2px;\n resize: none;\n\n &:focus {\n border: 1px solid ", ";\n }\n }\n\n select {\n background: #fafafa;\n outline: none;\n border: 1px solid\n ", ";\n width: 100%;\n cursor: pointer;\n font-family: ", ";\n color: ", ";\n font-size: 12px;\n line-height: 21px;\n padding: 10px;\n border-right: 2px solid #e33aa9;\n\n &:focus {\n border: 1px solid ", ";\n }\n }\n\n p {\n font-family: ", ";\n font-size: 11px;\n color: ", ";\n }\n"])), function (_ref) {
19
19
  var isRequired = _ref.isRequired;
20
20
  return isRequired ? "red" : "none";
21
21
  }, function (_ref2) {
22
22
  var isRequired = _ref2.isRequired;
23
23
  return isRequired ? "red" : "".concat(_variables.GlobalColors.s2);
24
- }, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s4, _variables.GlobalColors.magenta_s2);
24
+ }, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s4, _variables.GlobalColors.magenta_s2, function (_ref3) {
25
+ var isRequired = _ref3.isRequired;
26
+ return isRequired ? "red" : "".concat(_variables.GlobalColors.s2);
27
+ }, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s4, _variables.GlobalColors.magenta_s2, _variables.FontFamily.Raleway, _variables.GlobalColors.s4);
25
28
 
26
29
  exports.Container = Container;
@@ -15,7 +15,7 @@ var _variables = require("../../../global-files/variables");
15
15
 
16
16
  var _templateObject;
17
17
 
18
- var Container = _styledComponents.default.h2(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n font-family: ", ";\n font-style: normal;\n font-size: 36px;\n line-height: 42px;\n font-feature-settings: \"pnum\" on, \"lnum\" on;\n color: ", ";\n\n &.with-bold-text {\n span {\n font-family: ", ";\n }\n }\n\n &.product-name-header {\n font-size: 24px;\n line-height: 36px;\n font-weight: 500;\n letter-spacing: -0.015em;\n color: ", ";\n }\n\n &.retailer-name-header {\n font-size: 18px;\n font-weight: 400;\n line-height: 19px;\n color: ", ";\n }\n\n &.input-name-header {\n font-size: 14px;\n line-height: 19px;\n font-weight: 400;\n color: ", ";\n }\n\n &.date-header {\n font-family: ", ";\n color: ", ";\n font-size: 13px;\n font-weight: 400;\n line-height: 18px;\n }\n\n &.table-row-text {\n font-family: ", ";\n color: ", ";\n font-weight: 400;\n font-size: 11px;\n line-height: 18px;\n\n &:last-child {\n min-width: 50px;\n text-align: center;\n }\n }\n\n &.gray-table-row {\n font-family: ", ";\n font-weight: 400;\n font-size: 11px;\n line-height: 19px;\n color: ", ";\n background-color: ", ";\n padding: 1px 3px;\n border-radius: 3px;\n min-width: 50px;\n text-align: center;\n }\n &.header-and-paragraph {\n font-family: ", ";\n font-size: 36px;\n color: ", ";\n p {\n font-family: ", ";\n font-size: 14px;\n color: ", ";\n letter-spacing: -0.015em;\n }\n }\n"])), function (props) {
18
+ var Container = _styledComponents.default.h2(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n font-family: ", ";\n font-style: normal;\n font-size: 36px;\n line-height: 42px;\n font-feature-settings: \"pnum\" on, \"lnum\" on;\n color: ", ";\n position: relative;\n\n &.with-bold-text {\n span {\n font-family: ", ";\n }\n }\n\n &.product-name-header {\n font-size: 24px;\n line-height: 36px;\n font-weight: 500;\n letter-spacing: -0.015em;\n color: ", ";\n }\n\n &.retailer-name-header {\n font-size: 18px;\n font-weight: 400;\n line-height: 19px;\n color: ", ";\n }\n\n &.input-name-header {\n font-size: 14px;\n line-height: 19px;\n height: 19px;\n max-width: 100%;\n font-weight: 400;\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n &.date-header {\n font-family: ", ";\n color: ", ";\n font-size: 13px;\n font-weight: 400;\n line-height: 18px;\n }\n\n &.table-row-text {\n font-family: ", ";\n color: ", ";\n font-weight: 400;\n font-size: 11px;\n line-height: 18px;\n\n &:last-child {\n min-width: 50px;\n text-align: center;\n }\n }\n\n &.gray-table-row {\n font-family: ", ";\n font-weight: 400;\n font-size: 11px;\n line-height: 19px;\n color: ", ";\n background-color: ", ";\n padding: 1px 3px;\n border-radius: 3px;\n min-width: 50px;\n text-align: center;\n }\n &.header-and-paragraph {\n font-family: ", ";\n font-size: 36px;\n color: ", ";\n p {\n font-family: ", ";\n font-size: 14px;\n color: ", ";\n letter-spacing: -0.015em;\n }\n }\n"])), function (props) {
19
19
  return props.fontFamily;
20
20
  }, function (props) {
21
21
  return props.color;
@@ -37,8 +37,7 @@ var VerticalSideMenuMainPage = function VerticalSideMenuMainPage() {
37
37
  trueBar = _useState2[0],
38
38
  setTrueBar = _useState2[1];
39
39
 
40
- var active = function active() {
41
- console.log(window.location.href); //document.getElementById("slidea1").style.border= "1px solid rgb(227, 58, 169)";
40
+ var active = function active() {//document.getElementById("slidea1").style.border= "1px solid rgb(227, 58, 169)";
42
41
  };
43
42
 
44
43
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
@@ -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
  })]
@@ -62,7 +62,6 @@ var RegistrationSecondStep = function RegistrationSecondStep(props) {
62
62
  !privacyCheck && (valid = false);
63
63
 
64
64
  if (valid) {
65
- console.log(valid);
66
65
  nuevoUsuario.password = password;
67
66
  sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
68
67
  valid && props.setPaso(3);
@@ -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", {
@@ -31,13 +31,21 @@ var TagAndInput = function TagAndInput(_ref) {
31
31
  inputCols = _ref.inputCols,
32
32
  inputRows = _ref.inputRows,
33
33
  maxChar = _ref.maxChar,
34
- required = _ref.required;
34
+ required = _ref.required,
35
+ optionList = _ref.optionList,
36
+ description = _ref.description;
35
37
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
36
38
  inputType: inputType,
37
39
  className: "input-container",
38
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ScreenHeader, {
39
- text: label,
40
- headerType: "input-name-header"
40
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
41
+ className: "title-container",
42
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ScreenHeader, {
43
+ text: label,
44
+ headerType: "input-name-header"
45
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
46
+ className: "tooltip",
47
+ children: label
48
+ })]
41
49
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GeneralInput, {
42
50
  inputId: inputId,
43
51
  inputType: inputType,
@@ -55,7 +63,9 @@ var TagAndInput = function TagAndInput(_ref) {
55
63
  inputCols: inputCols,
56
64
  inputRows: inputRows,
57
65
  maxChar: maxChar,
58
- required: required
66
+ required: required,
67
+ optionList: optionList,
68
+ description: description
59
69
  })]
60
70
  }, "generalTagInput-".concat(inputType));
61
71
  };
@@ -11,11 +11,19 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
11
11
 
12
12
  var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
 
14
+ var _variables = require("../../../global-files/variables");
15
+
14
16
  var _templateObject;
15
17
 
16
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n & > :first-child {\n & + * {\n margin-top: ", "px;\n }\n }\n"])), function (_ref) {
17
- var inputType = _ref.inputType;
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .title-container {\n position: relative;\n\n .tooltip {\n display: none;\n position: absolute;\n background-color: ", ";\n color: ", ";\n font-family: ", ";\n font-size: 14px;\n line-height: 19px;\n left: 0;\n top: 0;\n height: fit-content;\n transition: display 2s;\n }\n\n &:hover {\n .tooltip {\n display: block;\n }\n }\n }\n\n & > :first-child {\n & + * {\n margin-top: ", "px;\n }\n }\n & + * {\n margin-top: ", "px;\n }\n"])), _variables.GlobalColors.white, function (_ref) {
19
+ var color = _ref.color;
20
+ return color ? color : _variables.GlobalColors.s5;
21
+ }, _variables.FontFamily.Raleway, function (_ref2) {
22
+ var inputType = _ref2.inputType;
18
23
  return inputType !== "textarea" ? 4 : 15;
24
+ }, function (_ref3) {
25
+ var inputType = _ref3.inputType;
26
+ return inputType !== "textarea" ? 0 : 10;
19
27
  });
20
28
 
21
29
  exports.Container = Container;
@@ -28,7 +28,6 @@ var InputGroup = function InputGroup(_ref) {
28
28
  articleId = _ref.articleId,
29
29
  version = _ref.version,
30
30
  dinamicHeight = _ref.dinamicHeight;
31
- console.log(dataInputs, "dataInputs");
32
31
 
33
32
  var inputTypeValue = function inputTypeValue(type) {
34
33
  switch (type) {
@@ -51,7 +50,7 @@ var InputGroup = function InputGroup(_ref) {
51
50
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
52
51
  className: "inputs-container",
53
52
  children: inputGroup === null || inputGroup === void 0 ? void 0 : (_inputGroup$inputs = inputGroup.inputs) === null || _inputGroup$inputs === void 0 ? void 0 : _inputGroup$inputs.map(function (input, index) {
54
- var _dataInputs$input, _dataInputs$input2, _dataInputs$input3, _dataInputs$input4, _dataInputs$input5, _dataInputs$input6, _dataInputs$input7, _dataInputs$input8, _dataInputs$input9, _dataInputs$input10;
53
+ var _dataInputs$input, _dataInputs$input2, _dataInputs$input3, _dataInputs$input4, _dataInputs$input5, _dataInputs$input6, _dataInputs$input7, _dataInputs$input8, _dataInputs$input9, _dataInputs$input10, _dataInputs$input11, _dataInputs$input12;
55
54
 
56
55
  return activeSection === "Ficha técnica" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
57
56
  inputId: (_dataInputs$input3 = dataInputs[input]) === null || _dataInputs$input3 === void 0 ? void 0 : _dataInputs$input3.id,
@@ -64,7 +63,9 @@ var InputGroup = function InputGroup(_ref) {
64
63
  isRequired: (_dataInputs$input8 = dataInputs[input]) === null || _dataInputs$input8 === void 0 ? void 0 : _dataInputs$input8.required,
65
64
  updatedDatasheets: updatedDatasheets,
66
65
  setUpdatedDatasheets: setUpdatedDatasheets,
67
- maxChar: (_dataInputs$input9 = dataInputs[input]) !== null && _dataInputs$input9 !== void 0 && _dataInputs$input9.max_chars ? (_dataInputs$input10 = dataInputs[input]) === null || _dataInputs$input10 === void 0 ? void 0 : _dataInputs$input10.max_chars : 999
66
+ maxChar: (_dataInputs$input9 = dataInputs[input]) !== null && _dataInputs$input9 !== void 0 && _dataInputs$input9.max_chars ? (_dataInputs$input10 = dataInputs[input]) === null || _dataInputs$input10 === void 0 ? void 0 : _dataInputs$input10.max_chars : 999,
67
+ optionList: (_dataInputs$input11 = dataInputs[input]) === null || _dataInputs$input11 === void 0 ? void 0 : _dataInputs$input11.option_list,
68
+ description: (_dataInputs$input12 = dataInputs[input]) === null || _dataInputs$input12 === void 0 ? void 0 : _dataInputs$input12.description
68
69
  }, index + "-" + ((_dataInputs$input = dataInputs[input]) === null || _dataInputs$input === void 0 ? void 0 : _dataInputs$input.value) + "-" + ((_dataInputs$input2 = dataInputs[input]) === null || _dataInputs$input2 === void 0 ? void 0 : _dataInputs$input2.id)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
69
70
  inputId: input.id,
70
71
  index: index,
@@ -78,7 +79,8 @@ var InputGroup = function InputGroup(_ref) {
78
79
  setUpdatedDescriptions: setUpdatedDescriptions,
79
80
  articleId: articleId,
80
81
  version: version,
81
- dinamicHeight: dinamicHeight
82
+ dinamicHeight: dinamicHeight,
83
+ description: input === null || input === void 0 ? void 0 : input.description
82
84
  }, index + "-" + (input === null || input === void 0 ? void 0 : input.value));
83
85
  })
84
86
  })]
@@ -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 border: 1px solid ", ";\n border-radius: 6px;\n padding: 10px;\n width: 100%;\n\n .retailer-name-header {\n & + * {\n margin-top: 10px;\n }\n }\n &.datasheets-layout {\n padding-right: 0;\n\n .inputs-container {\n display: flex;\n flex-wrap: wrap;\n\n .input-container {\n flex: 1 1 20%;\n margin-right: 10px;\n min-width: 227px;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n }\n }\n }\n\n & + * {\n margin-top: 15px;\n }\n"])), _variables.GlobalColors.s2);
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n border: 1px solid ", ";\n border-radius: 6px;\n padding: 10px;\n width: 100%;\n\n .retailer-name-header {\n & + * {\n margin-top: 10px;\n }\n }\n &.datasheets-layout {\n padding-right: 0;\n\n .inputs-container {\n display: flex;\n flex-wrap: wrap;\n width: 100%;\n gap: 5px;\n\n .input-container {\n flex: 1 1 20%;\n min-width: 227px;\n display: flex;\n flex-direction: column;\n }\n }\n }\n\n & + * {\n margin-top: 15px;\n }\n"])), _variables.GlobalColors.s2);
19
19
 
20
20
  exports.Container = Container;
@@ -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
  }
@@ -41,26 +41,26 @@ RetailerProductEditionDefault.args = {
41
41
  descriptions: 1,
42
42
  images: 1
43
43
  },
44
- orderId: 152,
45
- status: "ASSIGNED",
44
+ orderId: 233,
45
+ status: "IN_PROGRESS",
46
46
  datasheet_status: "IN_PROGRESS",
47
47
  prio: "none",
48
- version: 3,
49
- description_status: "IN_PROGRESS",
50
- images_status: "IN_PROGRESS",
48
+ version: 2,
49
+ description_status: "QF",
50
+ images_status: "QF",
51
51
  article: {
52
- id_article: 343,
53
- id_category: "2898",
54
- name: "Producto prueba dos ",
55
- upc: "2004202212",
56
- timestamp: "2022-04-20T17:01:17.000Z",
52
+ id_article: 190965,
53
+ id_category: "697",
54
+ name: "Shampoo hidratante",
55
+ upc: "6545345",
56
+ timestamp: "2022-06-10T15:05:56.000Z",
57
57
  id_user: 28,
58
58
  status: "NULL",
59
59
  active: 1,
60
60
  company_id: 1,
61
61
  company_name: "COMPANY DEV",
62
62
  country: "México",
63
- id_order: 152,
63
+ id_order: 233,
64
64
  id_datasheet_especialist: 54,
65
65
  id_datasheet_facilitator: 52,
66
66
  id_description_especialist: 54,
@@ -69,20 +69,26 @@ RetailerProductEditionDefault.args = {
69
69
  id_images_facilitator: 53,
70
70
  id_auditor: 30,
71
71
  id_recepcionist: null,
72
- category: "HALLOWEN|DECORACIÓN E INFLABLES|DECORACIÓN E INFLABLES",
72
+ category: "SALUD Y BELLEZA|CUIDADO DEL CABELLO|SHAMPOOS Y ACONDICIONADORES",
73
73
  missingAttributes: null,
74
74
  missingDescriptions: null,
75
75
  missingImages: null
76
76
  },
77
77
  retailers: [{
78
- id: 58,
79
- name: "The Home Depot",
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",
80
86
  country: "México",
81
87
  id_region: 1,
82
88
  active: 1
83
89
  }],
84
90
  country: "México",
85
- upc: "2004202212"
91
+ upc: "6545345"
86
92
  },
87
93
  location: {
88
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
@@ -271,7 +271,6 @@ var getNewStatus = function getNewStatus(statusArray) {
271
271
  statusArray.forEach(function (element) {
272
272
  return lookupString += element + "/";
273
273
  });
274
- console.log(lookupString, "productTemp");
275
274
  if (lookupString.includes("RF")) return "RF";
276
275
  if (lookupString.includes("RA")) return "RA";
277
276
  if (lookupString.includes("RP")) return "RP";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.0.79",
3
+ "version": "21.0.82",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -12,7 +12,7 @@ export const GalleryElement = ({
12
12
  gridLayout = false,
13
13
  id = "chk-default",
14
14
  label,
15
- index,
15
+ number,
16
16
  imageInputs,
17
17
  imageType,
18
18
  imagePackagingType,
@@ -83,7 +83,7 @@ export const GalleryElement = ({
83
83
  action: "changeImageInfo",
84
84
  attribute: "image_id",
85
85
  value: +e.target.value,
86
- index: index,
86
+ index: number,
87
87
  });
88
88
  }}
89
89
  />
@@ -97,7 +97,7 @@ export const GalleryElement = ({
97
97
  action: "changeImageInfo",
98
98
  attribute: "image_type",
99
99
  value: +e.target.value,
100
- index: index,
100
+ index: number,
101
101
  });
102
102
  }}
103
103
  />
@@ -111,7 +111,7 @@ export const GalleryElement = ({
111
111
  action: "changeImageInfo",
112
112
  attribute: "packing_type",
113
113
  value: +e.target.value,
114
- index: index,
114
+ index: number,
115
115
  });
116
116
  }}
117
117
  />
@@ -40,6 +40,7 @@ export const StatusAsignationInfo = ({
40
40
 
41
41
  return (
42
42
  <Container id={id}>
43
+ {status !== "-" && <StatusTag statusType={status} ovalForm={true} />}
43
44
  {showSaveButton && (
44
45
  <Button
45
46
  buttonType={"circular-button save-button"}
@@ -210,7 +210,7 @@ export const ProviderProductEdition = ({
210
210
  //setActiveRetailer(product?.retailers[0]);
211
211
  setImages({
212
212
  action: "init",
213
- init: services[2],
213
+ init: JSON.parse(sessionStorage.getItem("imagesList")) || services[2],
214
214
  });
215
215
  if (services[2]?.values?.length > 0) setActiveImage(0);
216
216
 
@@ -375,7 +375,8 @@ export const ProviderProductEdition = ({
375
375
  image={image}
376
376
  gridLayout={imageLayout}
377
377
  id={"gallery-element-" + index}
378
- index={index}
378
+ index={index + "-" + image.name}
379
+ number={index}
379
380
  imageType={imageType}
380
381
  imagePackagingType={imagePackagingType}
381
382
  imageInputs={imageInputs}
@@ -548,6 +549,7 @@ export const ProviderProductEdition = ({
548
549
  }
549
550
  );
550
551
  setMessage("Imágenes guardadas con éxito");
552
+ sessionStorage.removeItem("imagesList");
551
553
  loadData();
552
554
  } catch (error) {
553
555
  console.log(error);
@@ -940,23 +942,42 @@ export const ProviderProductEdition = ({
940
942
  };
941
943
 
942
944
  const deleteImages = () => {
943
- const data = {
944
- articleId: product.id_article,
945
- deleteImages: selectedImages,
946
- };
947
- try {
948
- axios.put(
949
- `${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
950
- data,
951
- {
952
- headers: { Authorization: token },
953
- }
954
- );
955
- loadData();
956
- } catch (err) {
957
- console.log(err);
945
+ setLoading(true);
946
+ const imagesTemp = images;
947
+ const { values } = images;
948
+ const imgsInBack = [];
949
+
950
+ selectedImages.forEach((selectedImg) => {
951
+ if (selectedImg.id) imgsInBack.push(selectedImg);
952
+ });
953
+
954
+ const imgsLeft = values.filter(
955
+ (value) => selectedImages.indexOf(value) === -1
956
+ );
957
+
958
+ imagesTemp.values = imgsLeft;
959
+
960
+ if (imgsInBack.length > 0) {
961
+ const data = {
962
+ articleId: product.article.id_article,
963
+ deleteImages: selectedImages,
964
+ };
965
+ try {
966
+ axios.put(
967
+ `${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
968
+ data,
969
+ {
970
+ headers: { Authorization: token },
971
+ }
972
+ );
973
+ } catch (err) {
974
+ console.log(err);
975
+ }
958
976
  }
977
+ sessionStorage.setItem("imagesList", JSON.stringify(imagesTemp));
978
+ loadData();
959
979
  setMessage("");
980
+ setComponentsArray([]);
960
981
  };
961
982
 
962
983
  const askToDeleteImages = () => {
@@ -979,7 +1000,10 @@ export const ProviderProductEdition = ({
979
1000
  key={"3"}
980
1001
  buttonType="general-button-default"
981
1002
  label={"Aceptar"}
982
- onClick={() => deleteImages()}
1003
+ onClick={() => {
1004
+ setMessage("");
1005
+ deleteImages();
1006
+ }}
983
1007
  />,
984
1008
  ]);
985
1009
  }
@@ -21,50 +21,63 @@ RetailerProductEditionDefault.args = {
21
21
  category: 846,
22
22
  version: 2,
23
23
  productSelected: {
24
- orderId: 132,
25
- id_category: "612",
24
+ services: {
25
+ datasheets: 1,
26
+ descriptions: 1,
27
+ images: 1,
28
+ },
29
+ orderId: 233,
26
30
  status: "IN_PROGRESS",
27
- datasheet_status: "QF",
31
+ datasheet_status: "IN_PROGRESS",
28
32
  prio: "none",
29
33
  version: 2,
30
- description_status: "IN_PROGRESS",
31
- images_status: "IN_PROGRESS",
32
- brand: null,
33
- missing: {
34
- datasheet: 0,
35
- descriptions: 0,
36
- images: 0,
37
- },
34
+ description_status: "QF",
35
+ images_status: "QF",
38
36
  article: {
39
- category: "ROPA, ACCESORIOS, FRAGANCIAS Y JOYERÍA|ACCESORIOS|COLLARES",
37
+ id_article: 190965,
38
+ id_category: "697",
39
+ name: "Shampoo hidratante",
40
+ upc: "6545345",
41
+ timestamp: "2022-06-10T15:05:56.000Z",
42
+ id_user: 28,
43
+ status: "NULL",
44
+ active: 1,
45
+ company_id: 1,
40
46
  company_name: "COMPANY DEV",
41
- id_category: "612",
42
- id_article: 109490,
43
- name: "Collar con dije letra ",
44
- timestamp: "2022-05-05T16:45:49.000Z",
45
- upc: "123434",
47
+ country: "México",
48
+ id_order: 233,
49
+ id_datasheet_especialist: 54,
50
+ id_datasheet_facilitator: 52,
51
+ id_description_especialist: 54,
52
+ id_description_facilitator: 52,
53
+ id_images_especialist: 55,
54
+ id_images_facilitator: 53,
55
+ id_auditor: 30,
56
+ id_recepcionist: null,
57
+ category:
58
+ "SALUD Y BELLEZA|CUIDADO DEL CABELLO|SHAMPOOS Y ACONDICIONADORES",
59
+ missingAttributes: null,
60
+ missingDescriptions: null,
61
+ missingImages: null,
46
62
  },
47
63
  retailers: [
48
64
  {
49
- id: 2,
50
- name: "Walmart Mercancías Generales",
65
+ id: 4,
66
+ name: "Walmart Super y Superama",
67
+ country: "México",
68
+ id_region: 1,
69
+ active: 1,
51
70
  },
52
- ],
53
- services: {
54
- datasheets: 1,
55
- descriptions: 1,
56
- images: 1,
57
- },
58
- checked: false,
59
- retailersAvailable: [
60
71
  {
61
- id: 2,
62
- name: "Walmart Mercancías Generales",
72
+ id: 26,
73
+ name: "Mercado Libre",
74
+ country: "México",
75
+ id_region: 1,
76
+ active: 1,
63
77
  },
64
78
  ],
65
- id_article: 109490,
66
- categoryName: "ROPA, ACCESORIOS, FRAGANCIAS Y JOYERÍA|ACCESORIOS|COLLARES",
67
- version_status: "IN_PROGRESS",
79
+ country: "México",
80
+ upc: "6545345",
68
81
  },
69
82
  location: {
70
83
  product: { articleId: 109485, versionId: 3 },
@@ -167,7 +167,7 @@ export const RetailerProductEdition = ({
167
167
  //setActiveRetailer(product?.retailers[0]);
168
168
  setImages({
169
169
  action: "init",
170
- init: services[2],
170
+ init: JSON.parse(sessionStorage.getItem("imagesList")) || services[2],
171
171
  });
172
172
  if (services[2]?.values?.length > 0) setActiveImage(0);
173
173
 
@@ -181,7 +181,9 @@ export const RetailerProductEdition = ({
181
181
 
182
182
  const getServices = async () => {
183
183
  const servicesResponse = await axios.get(
184
- `${process.env.REACT_APP_SERVICES_ENDPOINT}?articleId=${product?.article?.id_article}&orderId=${product?.article?.id_order}&end=true`
184
+ `${process.env.REACT_APP_SERVICES_ENDPOINT}?articleId=${
185
+ product?.article?.id_article
186
+ }&orderId=${product?.article?.id_order || product.orderId}&end=true`
185
187
  );
186
188
  const parsedResponse = JSON.parse(servicesResponse?.data?.body).data;
187
189
  setServicesData(parsedResponse);
@@ -357,7 +359,8 @@ export const RetailerProductEdition = ({
357
359
  image={image}
358
360
  gridLayout={imageLayout}
359
361
  id={"gallery-element-" + index}
360
- index={index}
362
+ index={index + "-" + image.name}
363
+ number={index}
361
364
  imageType={imageType}
362
365
  imagePackagingType={imagePackagingType}
363
366
  imageInputs={imageInputs}
@@ -531,6 +534,7 @@ export const RetailerProductEdition = ({
531
534
  }
532
535
  );
533
536
  setMessage("Imágenes guardadas con éxito");
537
+ sessionStorage.removeItem("imagesList");
534
538
  loadData();
535
539
  } catch (error) {
536
540
  console.log(error);
@@ -983,23 +987,42 @@ export const RetailerProductEdition = ({
983
987
  };
984
988
 
985
989
  const deleteImages = () => {
986
- const data = {
987
- articleId: product.article.id_article,
988
- deleteImages: selectedImages,
989
- };
990
- try {
991
- axios.put(
992
- `${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
993
- data,
994
- {
995
- headers: { Authorization: token },
996
- }
997
- );
998
- loadData();
999
- } catch (err) {
1000
- console.log(err);
990
+ setLoading(true);
991
+ const imagesTemp = images;
992
+ const { values } = images;
993
+ const imgsInBack = [];
994
+
995
+ selectedImages.forEach((selectedImg) => {
996
+ if (selectedImg.id) imgsInBack.push(selectedImg);
997
+ });
998
+
999
+ const imgsLeft = values.filter(
1000
+ (value) => selectedImages.indexOf(value) === -1
1001
+ );
1002
+
1003
+ imagesTemp.values = imgsLeft;
1004
+
1005
+ if (imgsInBack.length > 0) {
1006
+ const data = {
1007
+ articleId: product.article.id_article,
1008
+ deleteImages: selectedImages,
1009
+ };
1010
+ try {
1011
+ axios.put(
1012
+ `${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
1013
+ data,
1014
+ {
1015
+ headers: { Authorization: token },
1016
+ }
1017
+ );
1018
+ } catch (err) {
1019
+ console.log(err);
1020
+ }
1001
1021
  }
1022
+ sessionStorage.setItem("imagesList", JSON.stringify(imagesTemp));
1023
+ loadData();
1002
1024
  setMessage("");
1025
+ setComponentsArray([]);
1003
1026
  };
1004
1027
 
1005
1028
  const askToDeleteImages = () => {
@@ -1022,7 +1045,10 @@ export const RetailerProductEdition = ({
1022
1045
  key={"3"}
1023
1046
  buttonType="general-button-default"
1024
1047
  label={"Aceptar"}
1025
- onClick={() => deleteImages()}
1048
+ onClick={() => {
1049
+ setMessage("");
1050
+ deleteImages();
1051
+ }}
1026
1052
  />,
1027
1053
  ]);
1028
1054
  }
@@ -1127,13 +1153,13 @@ export const RetailerProductEdition = ({
1127
1153
  onClickSave={() => {
1128
1154
  switch (activeTab) {
1129
1155
  case "Descripción":
1130
- product?.services?.descriptions === 1 && saveDescriptions();
1156
+ product?.description_status !== "NS" && saveDescriptions();
1131
1157
  break;
1132
1158
  case "Ficha técnica":
1133
- product?.services?.datasheets === 1 && saveDatasheets();
1159
+ product?.datasheet_status !== "NS" && saveDatasheets();
1134
1160
  break;
1135
1161
  case "Imágenes":
1136
- product?.services?.images === 1 && updateImages();
1162
+ product?.images_status !== "NS" && updateImages();
1137
1163
  break;
1138
1164
 
1139
1165
  default: