contentoh-components-library 21.4.127 → 21.4.129
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.
- package/dist/components/atoms/GeneralInput/styles.js +1 -1
- package/dist/components/atoms/InputFormatter/index.js +4 -3
- package/dist/components/molecules/GalleryElement/index.js +76 -13
- package/dist/components/organisms/InputGroup/index.js +32 -30
- package/dist/components/pages/ProviderProductEdition/index.js +94 -71
- package/package.json +1 -1
- package/src/components/atoms/GeneralInput/styles.js +17 -9
- package/src/components/atoms/InputFormatter/index.js +2 -1
- package/src/components/molecules/GalleryElement/index.js +73 -10
- package/src/components/organisms/InputGroup/index.js +48 -38
- package/src/components/pages/ProviderProductEdition/index.js +21 -3
|
@@ -15,7 +15,7 @@ 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\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: 12px;\n color: ", ";\n }\n\n &.audit-class {\n input,\n .quill {\n border: 1px solid #8a6caa;\n background-color: #ededfc;\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: 12px;\n color: ", ";\n }\n\n &.audit-class {\n input,\n .quill {\n border: 1px solid #8a6caa;\n background-color: #ededfc;\n }\n }\n\n .btnReviewState {\n display: \"flex\";\n flex-direction: \"column\";\n border: 1px solid lightgray;\n border-radius: 3px;\n z-index: 1000;\n /* position: absolute; */\n }\n\n .btnReviewState button {\n border: none;\n background: white;\n border-radius: 3px;\n }\n .btnReviewState button:hover {\n background: lightgray;\n }\n"])), function (_ref) {
|
|
19
19
|
var isRequired = _ref.isRequired;
|
|
20
20
|
return isRequired ? "red" : "none";
|
|
21
21
|
}, function (_ref2) {
|
|
@@ -27,7 +27,8 @@ var InputFormatter = function InputFormatter(_ref) {
|
|
|
27
27
|
updatedDescriptions = _ref.updatedDescriptions,
|
|
28
28
|
setUpdatedDescriptions = _ref.setUpdatedDescriptions,
|
|
29
29
|
isRequired = _ref.isRequired,
|
|
30
|
-
maxChar = _ref.maxChar
|
|
30
|
+
maxChar = _ref.maxChar,
|
|
31
|
+
disabled = _ref.disabled;
|
|
31
32
|
|
|
32
33
|
var _useState = (0, _react.useState)(mainValue),
|
|
33
34
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -152,8 +153,8 @@ var InputFormatter = function InputFormatter(_ref) {
|
|
|
152
153
|
ref: function ref(el) {
|
|
153
154
|
return setQuill(el);
|
|
154
155
|
},
|
|
155
|
-
defaultValue: getValue(inputValue)
|
|
156
|
-
,
|
|
156
|
+
defaultValue: getValue(inputValue),
|
|
157
|
+
readOnly: disabled,
|
|
157
158
|
modules: {
|
|
158
159
|
toolbar: ["bold"]
|
|
159
160
|
},
|
|
@@ -7,6 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.GalleryElement = void 0;
|
|
9
9
|
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _objectSpread4 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
13
|
+
|
|
10
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
15
|
|
|
12
16
|
var _styles = require("./styles");
|
|
@@ -27,6 +31,8 @@ var _rejectIcon = _interopRequireDefault(require("../../../assets/images/general
|
|
|
27
31
|
|
|
28
32
|
var _acceptIcon = _interopRequireDefault(require("../../../assets/images/generalButton/acceptIcon.svg"));
|
|
29
33
|
|
|
34
|
+
var _Tooltip = require("../../atoms/Tooltip");
|
|
35
|
+
|
|
30
36
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
37
|
|
|
32
38
|
var GalleryElement = function GalleryElement(_ref) {
|
|
@@ -47,13 +53,37 @@ var GalleryElement = function GalleryElement(_ref) {
|
|
|
47
53
|
setSelectedImages = _ref.setSelectedImages,
|
|
48
54
|
setCheckAll = _ref.setCheckAll,
|
|
49
55
|
auditImages = _ref.auditImages,
|
|
50
|
-
compare = _ref.compare
|
|
56
|
+
compare = _ref.compare,
|
|
57
|
+
updateApprovedInputsImages = _ref.updateApprovedInputsImages;
|
|
51
58
|
|
|
52
59
|
var _useState = (0, _react.useState)(false),
|
|
53
60
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
54
61
|
showValidationPanel = _useState2[0],
|
|
55
62
|
setShowValidationPanel = _useState2[1];
|
|
56
63
|
|
|
64
|
+
var _useState3 = (0, _react.useState)({}),
|
|
65
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
66
|
+
showDivStates = _useState4[0],
|
|
67
|
+
setShowDivStates = _useState4[1];
|
|
68
|
+
|
|
69
|
+
var _useState5 = (0, _react.useState)({}),
|
|
70
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
71
|
+
imageStates = _useState6[0],
|
|
72
|
+
setImageStates = _useState6[1];
|
|
73
|
+
|
|
74
|
+
var handleImgClick = function handleImgClick(inputId) {
|
|
75
|
+
setShowDivStates(function (prevStates) {
|
|
76
|
+
return (0, _objectSpread4.default)((0, _objectSpread4.default)({}, prevStates), {}, (0, _defineProperty2.default)({}, inputId, !prevStates[inputId]));
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
var changeImageBtn = function changeImageBtn(inputId, action) {
|
|
81
|
+
setImageStates(function (prevStates) {
|
|
82
|
+
return (0, _objectSpread4.default)((0, _objectSpread4.default)({}, prevStates), {}, (0, _defineProperty2.default)({}, inputId, action === "validate"));
|
|
83
|
+
});
|
|
84
|
+
updateApprovedInputsImages(inputId);
|
|
85
|
+
};
|
|
86
|
+
|
|
57
87
|
var closeValidationPanel = function closeValidationPanel(e) {
|
|
58
88
|
if (!e.target.closest("#validation-panel") || e.target.closest(".validation-option") && showValidationPanel) {
|
|
59
89
|
document.removeEventListener("click", closeValidationPanel, false);
|
|
@@ -85,7 +115,8 @@ var GalleryElement = function GalleryElement(_ref) {
|
|
|
85
115
|
|
|
86
116
|
var isEquals = function isEquals(value, auditValue) {
|
|
87
117
|
return value === auditValue;
|
|
88
|
-
};
|
|
118
|
+
}; //TOMAR EL image_id
|
|
119
|
+
|
|
89
120
|
|
|
90
121
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
91
122
|
className: "".concat(gridLayout ? "grid-gallery" : "row-gallery", " ").concat(compare && !isEquals(image === null || image === void 0 ? void 0 : image.uuid, auditImages === null || auditImages === void 0 ? void 0 : (_auditImages$values$n = auditImages.values[number]) === null || _auditImages$values$n === void 0 ? void 0 : _auditImages$values$n.uuid) ? "audit-class" : ""),
|
|
@@ -166,19 +197,51 @@ var GalleryElement = function GalleryElement(_ref) {
|
|
|
166
197
|
index: number
|
|
167
198
|
});
|
|
168
199
|
}
|
|
169
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
200
|
+
}), (image === null || image === void 0 ? void 0 : image.isApproved) === false && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
170
201
|
style: {
|
|
171
|
-
|
|
202
|
+
display: "flex",
|
|
203
|
+
"justify-content": "center",
|
|
204
|
+
"align-items": "center"
|
|
172
205
|
},
|
|
173
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
206
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.Tooltip, {
|
|
207
|
+
componentTooltip: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
208
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
209
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("b", {
|
|
210
|
+
children: "Comentarios:"
|
|
211
|
+
})
|
|
212
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
213
|
+
children: image.comment
|
|
214
|
+
})]
|
|
215
|
+
}),
|
|
216
|
+
children: !image.isApproved && /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
217
|
+
src: imageStates[image.image_id] ? _acceptIcon.default : _rejectIcon.default,
|
|
218
|
+
alt: "botón rechazar",
|
|
219
|
+
style: {
|
|
220
|
+
cursor: "pointer"
|
|
221
|
+
},
|
|
222
|
+
onClick: function onClick() {
|
|
223
|
+
return handleImgClick(image.image_id);
|
|
224
|
+
}
|
|
225
|
+
}),
|
|
226
|
+
classNameTooltip: "container-tooltip"
|
|
227
|
+
}), showDivStates[image.image_id] && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
228
|
+
className: "btnReviewState",
|
|
229
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
230
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
|
|
231
|
+
id: "aceptbtn",
|
|
232
|
+
onClick: function onClick() {
|
|
233
|
+
return changeImageBtn(image.image_id, "validate");
|
|
234
|
+
},
|
|
235
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
236
|
+
src: _acceptIcon.default,
|
|
237
|
+
alt: "acept button",
|
|
238
|
+
style: {
|
|
239
|
+
cursor: "pointer"
|
|
240
|
+
}
|
|
241
|
+
}), "Validar"]
|
|
242
|
+
})
|
|
243
|
+
})
|
|
244
|
+
})]
|
|
182
245
|
})]
|
|
183
246
|
})]
|
|
184
247
|
})]
|
|
@@ -189,38 +189,38 @@ var InputGroup = function InputGroup(_ref) {
|
|
|
189
189
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
190
190
|
className: "inputs-container",
|
|
191
191
|
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) {
|
|
192
|
-
var _dataInputs$input, _dataInputs$input2, _dataInputs$input3, _dataInputs$input4, _dataInputs$input5, _dataInputs$input6,
|
|
192
|
+
var _dataInputs$input, _dataInputs$input2, _dataInputs$input3, _dataInputs$input4, _dataInputs$input5, _dataInputs$input6, _dataInputs$input7, _auditInputs$input, _dataInputs$input8, _dataInputs$input9, _dataInputs$input10, _dataInputs$input11, _dataInputs$input12, _dataInputs$input13, _dataInputs$input14, _dataInputs$input15, _dataInputs$input16, _dataInputs$input17, _auditInputGroup$inpu, _auditInputGroup$inpu2;
|
|
193
193
|
|
|
194
194
|
return activeSection === "Ficha técnica" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
195
195
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
|
|
196
196
|
//disabled={input === 40001}
|
|
197
|
-
disabled: dataInputs[input].isApproved,
|
|
198
|
-
inputId: (_dataInputs$
|
|
197
|
+
disabled: (_dataInputs$input3 = dataInputs[input]) === null || _dataInputs$input3 === void 0 ? void 0 : _dataInputs$input3.isApproved,
|
|
198
|
+
inputId: (_dataInputs$input4 = dataInputs[input]) === null || _dataInputs$input4 === void 0 ? void 0 : _dataInputs$input4.id,
|
|
199
199
|
version: version,
|
|
200
|
-
inputType: inputTypeValue((_dataInputs$
|
|
201
|
-
label: ((_dataInputs$
|
|
202
|
-
value: compare ? (_auditInputs$input = auditInputs[input]) === null || _auditInputs$input === void 0 ? void 0 : _auditInputs$input.value : (_dataInputs$
|
|
200
|
+
inputType: inputTypeValue((_dataInputs$input5 = dataInputs[input]) === null || _dataInputs$input5 === void 0 ? void 0 : _dataInputs$input5.type),
|
|
201
|
+
label: ((_dataInputs$input6 = dataInputs[input]) === null || _dataInputs$input6 === void 0 ? void 0 : _dataInputs$input6.name) + ((_dataInputs$input7 = dataInputs[input]) !== null && _dataInputs$input7 !== void 0 && _dataInputs$input7.required ? "*" : ""),
|
|
202
|
+
value: compare ? (_auditInputs$input = auditInputs[input]) === null || _auditInputs$input === void 0 ? void 0 : _auditInputs$input.value : (_dataInputs$input8 = dataInputs[input]) === null || _dataInputs$input8 === void 0 ? void 0 : _dataInputs$input8.value,
|
|
203
203
|
inputPlaceHolder: input === null || input === void 0 ? void 0 : input.placeholder,
|
|
204
204
|
articleId: articleId,
|
|
205
|
-
isRequired: (_dataInputs$
|
|
205
|
+
isRequired: (_dataInputs$input9 = dataInputs[input]) === null || _dataInputs$input9 === void 0 ? void 0 : _dataInputs$input9.required,
|
|
206
206
|
updatedDatasheets: updatedDatasheets,
|
|
207
207
|
setUpdatedDatasheets: setUpdatedDatasheets,
|
|
208
|
-
maxChar: (_dataInputs$
|
|
209
|
-
optionList: (_dataInputs$
|
|
210
|
-
description: (_dataInputs$
|
|
208
|
+
maxChar: (_dataInputs$input10 = dataInputs[input]) !== null && _dataInputs$input10 !== void 0 && _dataInputs$input10.max_chars ? (_dataInputs$input11 = dataInputs[input]) === null || _dataInputs$input11 === void 0 ? void 0 : _dataInputs$input11.max_chars : 999,
|
|
209
|
+
optionList: (_dataInputs$input12 = dataInputs[input]) === null || _dataInputs$input12 === void 0 ? void 0 : _dataInputs$input12.option_list,
|
|
210
|
+
description: (_dataInputs$input13 = dataInputs[input]) === null || _dataInputs$input13 === void 0 ? void 0 : _dataInputs$input13.description,
|
|
211
211
|
showTooltip: true,
|
|
212
212
|
auditClass: compare && !isEquals(dataInputs[input].value, auditInputs[input].value) ? "audit-class" : ""
|
|
213
|
-
}, 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) + "-" + compare), /*#__PURE__*/(0, _jsxRuntime.jsx)(InputReviewSection, {
|
|
214
|
-
inputId: (_dataInputs$
|
|
215
|
-
isApproved: (_dataInputs$
|
|
216
|
-
comment: (_dataInputs$
|
|
213
|
+
}, 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) + "-" + compare), ((_dataInputs$input14 = dataInputs[input]) === null || _dataInputs$input14 === void 0 ? void 0 : _dataInputs$input14.isApproved) === false && /*#__PURE__*/(0, _jsxRuntime.jsx)(InputReviewSection, {
|
|
214
|
+
inputId: (_dataInputs$input15 = dataInputs[input]) === null || _dataInputs$input15 === void 0 ? void 0 : _dataInputs$input15.id,
|
|
215
|
+
isApproved: (_dataInputs$input16 = dataInputs[input]) === null || _dataInputs$input16 === void 0 ? void 0 : _dataInputs$input16.isApproved,
|
|
216
|
+
comment: (_dataInputs$input17 = dataInputs[input]) === null || _dataInputs$input17 === void 0 ? void 0 : _dataInputs$input17.comment,
|
|
217
217
|
handleImgClick: handleImgClick,
|
|
218
218
|
changeImageBtn: changeImageBtn,
|
|
219
219
|
showDivState: showDivStates,
|
|
220
220
|
imageStates: imageStates
|
|
221
221
|
})]
|
|
222
222
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
223
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(InputReviewSection, {
|
|
223
|
+
children: [(input === null || input === void 0 ? void 0 : input.isApproved) === false && /*#__PURE__*/(0, _jsxRuntime.jsx)(InputReviewSection, {
|
|
224
224
|
inputId: input === null || input === void 0 ? void 0 : input.id,
|
|
225
225
|
isApproved: input === null || input === void 0 ? void 0 : input.isApproved,
|
|
226
226
|
comment: input === null || input === void 0 ? void 0 : input.comment,
|
|
@@ -235,6 +235,7 @@ var InputGroup = function InputGroup(_ref) {
|
|
|
235
235
|
label: (input === null || input === void 0 ? void 0 : input.name) + (input.required ? "*" : ""),
|
|
236
236
|
value: compare ? auditInputGroup === null || auditInputGroup === void 0 ? void 0 : (_auditInputGroup$inpu = auditInputGroup.inputs[index]) === null || _auditInputGroup$inpu === void 0 ? void 0 : _auditInputGroup$inpu.value : input === null || input === void 0 ? void 0 : input.value,
|
|
237
237
|
isRequired: input.required,
|
|
238
|
+
disabled: input === null || input === void 0 ? void 0 : input.isApproved,
|
|
238
239
|
maxChar: input.max_chars,
|
|
239
240
|
inputPlaceHolder: input === null || input === void 0 ? void 0 : input.placeholder,
|
|
240
241
|
updatedDescriptions: updatedDescriptions,
|
|
@@ -257,41 +258,41 @@ var InputGroup = function InputGroup(_ref) {
|
|
|
257
258
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
258
259
|
className: "inputs-container",
|
|
259
260
|
children: inputGroup === null || inputGroup === void 0 ? void 0 : (_inputGroup$inputs2 = inputGroup.inputs) === null || _inputGroup$inputs2 === void 0 ? void 0 : _inputGroup$inputs2.map(function (input, index) {
|
|
260
|
-
var _dataInputs$
|
|
261
|
+
var _dataInputs$input18, _dataInputs$input19, _dataInputs$input20, _dataInputs$input21, _dataInputs$input22, _dataInputs$input23, _dataInputs$input24, _auditInputs$input2, _dataInputs$input25, _dataInputs$input26, _dataInputs$input27, _dataInputs$input28, _dataInputs$input29, _dataInputs$input30, _dataInputs$input31, _dataInputs$input32, _dataInputs$input33, _dataInputs$input34, _auditInputGroup$inpu3, _auditInputGroup$inpu4;
|
|
261
262
|
|
|
262
263
|
return activeSection === "Ficha técnica" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
263
264
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
|
|
264
265
|
//disabled={input === 40001}
|
|
265
|
-
disabled:
|
|
266
|
-
inputId: (_dataInputs$
|
|
266
|
+
disabled: (_dataInputs$input20 = dataInputs[input]) === null || _dataInputs$input20 === void 0 ? void 0 : _dataInputs$input20.isApproved,
|
|
267
|
+
inputId: (_dataInputs$input21 = dataInputs[input]) === null || _dataInputs$input21 === void 0 ? void 0 : _dataInputs$input21.id,
|
|
267
268
|
version: version,
|
|
268
|
-
inputType: inputTypeValue((_dataInputs$
|
|
269
|
-
label: ((_dataInputs$
|
|
270
|
-
value: compare ? (_auditInputs$input2 = auditInputs[input]) === null || _auditInputs$input2 === void 0 ? void 0 : _auditInputs$input2.value : (_dataInputs$
|
|
269
|
+
inputType: inputTypeValue((_dataInputs$input22 = dataInputs[input]) === null || _dataInputs$input22 === void 0 ? void 0 : _dataInputs$input22.type),
|
|
270
|
+
label: ((_dataInputs$input23 = dataInputs[input]) === null || _dataInputs$input23 === void 0 ? void 0 : _dataInputs$input23.name) + ((_dataInputs$input24 = dataInputs[input]) !== null && _dataInputs$input24 !== void 0 && _dataInputs$input24.required ? "*" : ""),
|
|
271
|
+
value: compare ? (_auditInputs$input2 = auditInputs[input]) === null || _auditInputs$input2 === void 0 ? void 0 : _auditInputs$input2.value : (_dataInputs$input25 = dataInputs[input]) === null || _dataInputs$input25 === void 0 ? void 0 : _dataInputs$input25.value,
|
|
271
272
|
inputPlaceHolder: input === null || input === void 0 ? void 0 : input.placeholder,
|
|
272
273
|
articleId: articleId,
|
|
273
|
-
isRequired: (_dataInputs$
|
|
274
|
+
isRequired: (_dataInputs$input26 = dataInputs[input]) === null || _dataInputs$input26 === void 0 ? void 0 : _dataInputs$input26.required,
|
|
274
275
|
updatedDatasheets: updatedDatasheets,
|
|
275
276
|
setUpdatedDatasheets: setUpdatedDatasheets,
|
|
276
|
-
maxChar: (_dataInputs$
|
|
277
|
-
optionList: (_dataInputs$
|
|
278
|
-
description: (_dataInputs$
|
|
277
|
+
maxChar: (_dataInputs$input27 = dataInputs[input]) !== null && _dataInputs$input27 !== void 0 && _dataInputs$input27.max_chars ? (_dataInputs$input28 = dataInputs[input]) === null || _dataInputs$input28 === void 0 ? void 0 : _dataInputs$input28.max_chars : 999,
|
|
278
|
+
optionList: (_dataInputs$input29 = dataInputs[input]) === null || _dataInputs$input29 === void 0 ? void 0 : _dataInputs$input29.option_list,
|
|
279
|
+
description: (_dataInputs$input30 = dataInputs[input]) === null || _dataInputs$input30 === void 0 ? void 0 : _dataInputs$input30.description,
|
|
279
280
|
showTooltip: true,
|
|
280
281
|
inputGroup: inputGroup,
|
|
281
282
|
dataInputs: dataInputs,
|
|
282
283
|
onChange: setUpdatedBoxData,
|
|
283
284
|
auditClass: compare && !isEquals(dataInputs[input].value, auditInputs[input].value) ? "audit-class" : ""
|
|
284
|
-
}, index + "-" + ((_dataInputs$
|
|
285
|
-
inputId: (_dataInputs$
|
|
286
|
-
isApproved: (_dataInputs$
|
|
287
|
-
comment: (_dataInputs$
|
|
285
|
+
}, index + "-" + ((_dataInputs$input18 = dataInputs[input]) === null || _dataInputs$input18 === void 0 ? void 0 : _dataInputs$input18.value) + "-" + ((_dataInputs$input19 = dataInputs[input]) === null || _dataInputs$input19 === void 0 ? void 0 : _dataInputs$input19.id) + "-" + compare), ((_dataInputs$input31 = dataInputs[input]) === null || _dataInputs$input31 === void 0 ? void 0 : _dataInputs$input31.isApproved) === false && /*#__PURE__*/(0, _jsxRuntime.jsx)(InputReviewSection, {
|
|
286
|
+
inputId: (_dataInputs$input32 = dataInputs[input]) === null || _dataInputs$input32 === void 0 ? void 0 : _dataInputs$input32.id,
|
|
287
|
+
isApproved: (_dataInputs$input33 = dataInputs[input]) === null || _dataInputs$input33 === void 0 ? void 0 : _dataInputs$input33.isApproved,
|
|
288
|
+
comment: (_dataInputs$input34 = dataInputs[input]) === null || _dataInputs$input34 === void 0 ? void 0 : _dataInputs$input34.comment,
|
|
288
289
|
handleImgClick: handleImgClick,
|
|
289
290
|
changeImageBtn: changeImageBtn,
|
|
290
291
|
showDivState: showDivStates,
|
|
291
292
|
imageStates: imageStates
|
|
292
293
|
})]
|
|
293
294
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
294
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(InputReviewSection, {
|
|
295
|
+
children: [(input === null || input === void 0 ? void 0 : input.isApproved) === false && /*#__PURE__*/(0, _jsxRuntime.jsx)(InputReviewSection, {
|
|
295
296
|
inputId: input === null || input === void 0 ? void 0 : input.id,
|
|
296
297
|
isApproved: input === null || input === void 0 ? void 0 : input.isApproved,
|
|
297
298
|
comment: input === null || input === void 0 ? void 0 : input.comment,
|
|
@@ -302,6 +303,7 @@ var InputGroup = function InputGroup(_ref) {
|
|
|
302
303
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
|
|
303
304
|
inputId: input.id,
|
|
304
305
|
index: index,
|
|
306
|
+
disabled: input === null || input === void 0 ? void 0 : input.isApproved,
|
|
305
307
|
inputType: "textarea",
|
|
306
308
|
label: (input === null || input === void 0 ? void 0 : input.name) + (input.required ? "*" : ""),
|
|
307
309
|
value: compare ? auditInputGroup === null || auditInputGroup === void 0 ? void 0 : (_auditInputGroup$inpu3 = auditInputGroup.inputs[index]) === null || _auditInputGroup$inpu3 === void 0 ? void 0 : _auditInputGroup$inpu3.value : input === null || input === void 0 ? void 0 : input.value,
|
|
@@ -17,7 +17,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm
|
|
|
17
17
|
|
|
18
18
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _objectSpread5 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
21
21
|
|
|
22
22
|
var _styles = require("./styles");
|
|
23
23
|
|
|
@@ -120,7 +120,7 @@ var reducerImages = function reducerImages(state, action) {
|
|
|
120
120
|
});
|
|
121
121
|
});
|
|
122
122
|
inputsByRetailer = newInputsByRetailer;
|
|
123
|
-
return (0,
|
|
123
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, action.init), {}, {
|
|
124
124
|
inputsByRetailer: inputsByRetailer,
|
|
125
125
|
valuesInitial: action.init.values,
|
|
126
126
|
inputsInitial: action.init.inputs
|
|
@@ -128,13 +128,13 @@ var reducerImages = function reducerImages(state, action) {
|
|
|
128
128
|
|
|
129
129
|
case "addImg":
|
|
130
130
|
values = [].concat((0, _toConsumableArray2.default)(values), [action.img]);
|
|
131
|
-
return (0,
|
|
131
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state), {}, {
|
|
132
132
|
values: values
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
case "changeImageInfo":
|
|
136
136
|
values[action.index][action.attribute] = action.value;
|
|
137
|
-
return (0,
|
|
137
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state), {}, {
|
|
138
138
|
values: values
|
|
139
139
|
});
|
|
140
140
|
|
|
@@ -147,7 +147,7 @@ var reducerImages = function reducerImages(state, action) {
|
|
|
147
147
|
attrForImgs.general[index].value = action.value;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
return (0,
|
|
150
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state), {}, {
|
|
151
151
|
attrForImgs: attrForImgs,
|
|
152
152
|
values: values
|
|
153
153
|
});
|
|
@@ -156,7 +156,7 @@ var reducerImages = function reducerImages(state, action) {
|
|
|
156
156
|
values = values.filter(function (value) {
|
|
157
157
|
return action.selectedImages.indexOf(value) === -1;
|
|
158
158
|
});
|
|
159
|
-
return (0,
|
|
159
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state), {}, {
|
|
160
160
|
values: values
|
|
161
161
|
});
|
|
162
162
|
|
|
@@ -195,7 +195,7 @@ var reducerImages = function reducerImages(state, action) {
|
|
|
195
195
|
console.log(action.action, error);
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
return (0,
|
|
198
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state), {}, {
|
|
199
199
|
values: values,
|
|
200
200
|
inputs: inputs
|
|
201
201
|
});
|
|
@@ -316,7 +316,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
316
316
|
name: e.target.fileName,
|
|
317
317
|
ext: ext[ext.length - 1],
|
|
318
318
|
width: width,
|
|
319
|
-
height: height
|
|
319
|
+
height: height,
|
|
320
|
+
isApproved: true //VALIDAR QUE SOLO SEA PARA RADIOSHACK
|
|
321
|
+
|
|
320
322
|
}
|
|
321
323
|
};
|
|
322
324
|
setImages(newImg);
|
|
@@ -475,31 +477,40 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
475
477
|
var _useState65 = (0, _react.useState)({}),
|
|
476
478
|
_useState66 = (0, _slicedToArray2.default)(_useState65, 2),
|
|
477
479
|
approvedInputs = _useState66[0],
|
|
478
|
-
setApprovedInputs = _useState66[1];
|
|
480
|
+
setApprovedInputs = _useState66[1];
|
|
479
481
|
|
|
482
|
+
var _useState67 = (0, _react.useState)({}),
|
|
483
|
+
_useState68 = (0, _slicedToArray2.default)(_useState67, 2),
|
|
484
|
+
approvedInputsImages = _useState68[0],
|
|
485
|
+
setApprovedInputsImages = _useState68[1];
|
|
480
486
|
|
|
481
487
|
var updateApprovedInputs = function updateApprovedInputs(inputId) {
|
|
482
488
|
setApprovedInputs(function (prevInputs) {
|
|
483
|
-
return (0,
|
|
489
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, prevInputs), {}, (0, _defineProperty2.default)({}, inputId, true));
|
|
490
|
+
});
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
var updateApprovedInputsImages = function updateApprovedInputsImages(inputId) {
|
|
494
|
+
setApprovedInputsImages(function (prevInputs) {
|
|
495
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, prevInputs), {}, (0, _defineProperty2.default)({}, inputId, true));
|
|
484
496
|
});
|
|
485
|
-
console.log(approvedInputs);
|
|
486
497
|
};
|
|
487
498
|
|
|
488
|
-
var
|
|
499
|
+
var _useState69 = (0, _react.useState)({
|
|
489
500
|
"Ficha técnica": null,
|
|
490
501
|
Descripción: null,
|
|
491
502
|
Imágenes: null
|
|
492
503
|
}),
|
|
493
|
-
_useState68 = (0, _slicedToArray2.default)(_useState67, 2),
|
|
494
|
-
origin = _useState68[0],
|
|
495
|
-
setOrigin = _useState68[1];
|
|
496
|
-
|
|
497
|
-
var _useState69 = (0, _react.useState)(false),
|
|
498
504
|
_useState70 = (0, _slicedToArray2.default)(_useState69, 2),
|
|
499
|
-
|
|
500
|
-
|
|
505
|
+
origin = _useState70[0],
|
|
506
|
+
setOrigin = _useState70[1];
|
|
507
|
+
|
|
508
|
+
var _useState71 = (0, _react.useState)(false),
|
|
509
|
+
_useState72 = (0, _slicedToArray2.default)(_useState71, 2),
|
|
510
|
+
inCart = _useState72[0],
|
|
511
|
+
setInCart = _useState72[1];
|
|
501
512
|
|
|
502
|
-
var
|
|
513
|
+
var _useState73 = (0, _react.useState)({
|
|
503
514
|
message: "¿Estás seguro de continuar?",
|
|
504
515
|
detail: " ".concat(user.is_retailer ? "Asegurate de haber revisado las tres secciones" : "Envíar el producto a la cadena"),
|
|
505
516
|
button1: {
|
|
@@ -514,34 +525,34 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
514
525
|
},
|
|
515
526
|
img: _defaultProfileImage.default
|
|
516
527
|
}),
|
|
517
|
-
_useState72 = (0, _slicedToArray2.default)(_useState71, 2),
|
|
518
|
-
dataGenericModal = _useState72[0],
|
|
519
|
-
setDataGenericModal = _useState72[1];
|
|
520
|
-
|
|
521
|
-
var _useState73 = (0, _react.useState)(null),
|
|
522
528
|
_useState74 = (0, _slicedToArray2.default)(_useState73, 2),
|
|
523
|
-
|
|
524
|
-
|
|
529
|
+
dataGenericModal = _useState74[0],
|
|
530
|
+
setDataGenericModal = _useState74[1];
|
|
525
531
|
|
|
526
|
-
var _useState75 = (0, _react.useState)(
|
|
532
|
+
var _useState75 = (0, _react.useState)(null),
|
|
527
533
|
_useState76 = (0, _slicedToArray2.default)(_useState75, 2),
|
|
528
|
-
|
|
529
|
-
|
|
534
|
+
socketType = _useState76[0],
|
|
535
|
+
setSocketType = _useState76[1];
|
|
530
536
|
|
|
531
|
-
var _useState77 = (0, _react.useState)(
|
|
537
|
+
var _useState77 = (0, _react.useState)(loading),
|
|
532
538
|
_useState78 = (0, _slicedToArray2.default)(_useState77, 2),
|
|
533
|
-
|
|
534
|
-
|
|
539
|
+
saving = _useState78[0],
|
|
540
|
+
setSaving = _useState78[1];
|
|
541
|
+
|
|
542
|
+
var _useState79 = (0, _react.useState)(product.statusByRetailer),
|
|
543
|
+
_useState80 = (0, _slicedToArray2.default)(_useState79, 2),
|
|
544
|
+
retailerStatus = _useState80[0],
|
|
545
|
+
setRetailerStatus = _useState80[1];
|
|
535
546
|
|
|
536
547
|
var _useCloseModal = (0, _customHooks.useCloseModal)("version-selector"),
|
|
537
548
|
_useCloseModal2 = (0, _slicedToArray2.default)(_useCloseModal, 2),
|
|
538
549
|
showVersionSelector = _useCloseModal2[0],
|
|
539
550
|
setShowVersionSelector = _useCloseModal2[1];
|
|
540
551
|
|
|
541
|
-
var
|
|
542
|
-
|
|
543
|
-
globalModal =
|
|
544
|
-
setGlobalModal =
|
|
552
|
+
var _useState81 = (0, _react.useState)(),
|
|
553
|
+
_useState82 = (0, _slicedToArray2.default)(_useState81, 2),
|
|
554
|
+
globalModal = _useState82[0],
|
|
555
|
+
setGlobalModal = _useState82[1];
|
|
545
556
|
|
|
546
557
|
var updateAuditStatus = /*#__PURE__*/function () {
|
|
547
558
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(status) {
|
|
@@ -555,7 +566,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
555
566
|
productTemp.datasheet_status = status;
|
|
556
567
|
productTemp.description_status = status;
|
|
557
568
|
productTemp.images_status = status;
|
|
558
|
-
retailerStatusCopy = (0,
|
|
569
|
+
retailerStatusCopy = (0, _objectSpread5.default)({}, retailerStatus);
|
|
559
570
|
conceptArray = ["description", "datasheet", "images"];
|
|
560
571
|
Object.keys(retailerStatusCopy).forEach(function (key) {
|
|
561
572
|
conceptArray.forEach(function (concept) {
|
|
@@ -1175,7 +1186,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1175
1186
|
imageInputs: imageInputs,
|
|
1176
1187
|
changeImage: setImages,
|
|
1177
1188
|
selectedImages: selectedImages,
|
|
1178
|
-
setSelectedImages: setSelectedImages
|
|
1189
|
+
setSelectedImages: setSelectedImages,
|
|
1190
|
+
updateApprovedInputsImages: updateApprovedInputsImages
|
|
1179
1191
|
}, index);
|
|
1180
1192
|
});
|
|
1181
1193
|
};
|
|
@@ -1289,7 +1301,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1289
1301
|
});
|
|
1290
1302
|
});
|
|
1291
1303
|
});
|
|
1292
|
-
dataObject = (0,
|
|
1304
|
+
dataObject = (0, _objectSpread5.default)({
|
|
1293
1305
|
articleId: product === null || product === void 0 ? void 0 : product.id_article,
|
|
1294
1306
|
articleData: updatedDatasheets
|
|
1295
1307
|
}, parseBoxData.length > 0 && {
|
|
@@ -1403,20 +1415,31 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1403
1415
|
});
|
|
1404
1416
|
}
|
|
1405
1417
|
|
|
1418
|
+
console.log("DATA NEW", data);
|
|
1419
|
+
|
|
1406
1420
|
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
1407
|
-
_context13.next =
|
|
1421
|
+
_context13.next = 33;
|
|
1408
1422
|
break;
|
|
1409
1423
|
}
|
|
1410
1424
|
|
|
1411
1425
|
setLoading(true);
|
|
1412
|
-
_context13.prev =
|
|
1426
|
+
_context13.prev = 12;
|
|
1413
1427
|
data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
|
|
1414
1428
|
e.uuid = (0, _uuid.v4)();
|
|
1415
1429
|
});
|
|
1430
|
+
data.updateImages = data.updateImages.map(function (image) {
|
|
1431
|
+
if (approvedInputsImages[image.image_id] !== undefined) {
|
|
1432
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, image), {}, {
|
|
1433
|
+
isApproved: approvedInputsImages[image.image_id]
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
return image;
|
|
1438
|
+
});
|
|
1416
1439
|
setDataImages(data);
|
|
1417
1440
|
|
|
1418
1441
|
if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
|
|
1419
|
-
_context13.next =
|
|
1442
|
+
_context13.next = 25;
|
|
1420
1443
|
break;
|
|
1421
1444
|
}
|
|
1422
1445
|
|
|
@@ -1432,41 +1455,41 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1432
1455
|
};
|
|
1433
1456
|
promiseArray.push(myBucket.putObject(params).promise());
|
|
1434
1457
|
});
|
|
1435
|
-
_context13.next =
|
|
1458
|
+
_context13.next = 22;
|
|
1436
1459
|
return Promise.all(promiseArray);
|
|
1437
1460
|
|
|
1438
|
-
case
|
|
1461
|
+
case 22:
|
|
1439
1462
|
setImagesUploaded(true);
|
|
1440
|
-
_context13.next =
|
|
1463
|
+
_context13.next = 26;
|
|
1441
1464
|
break;
|
|
1442
1465
|
|
|
1443
|
-
case
|
|
1466
|
+
case 25:
|
|
1444
1467
|
setImagesUploaded(true);
|
|
1445
1468
|
|
|
1446
|
-
case
|
|
1447
|
-
_context13.next =
|
|
1469
|
+
case 26:
|
|
1470
|
+
_context13.next = 31;
|
|
1448
1471
|
break;
|
|
1449
1472
|
|
|
1450
|
-
case
|
|
1451
|
-
_context13.prev =
|
|
1452
|
-
_context13.t0 = _context13["catch"](
|
|
1473
|
+
case 28:
|
|
1474
|
+
_context13.prev = 28;
|
|
1475
|
+
_context13.t0 = _context13["catch"](12);
|
|
1453
1476
|
console.log(_context13.t0); // setMainLoading(false);
|
|
1454
1477
|
|
|
1455
|
-
case
|
|
1456
|
-
_context13.next =
|
|
1478
|
+
case 31:
|
|
1479
|
+
_context13.next = 34;
|
|
1457
1480
|
break;
|
|
1458
1481
|
|
|
1459
|
-
case
|
|
1482
|
+
case 33:
|
|
1460
1483
|
// setMainLoading(false);
|
|
1461
1484
|
setMessage("Completa los campos que solicita cada una de la imágenes o hay imágenes con el mismo tipo de toma.\nRecuerda hay campos obligatorios y no podras avanzar si no estan completos.");
|
|
1462
1485
|
|
|
1463
|
-
case
|
|
1486
|
+
case 34:
|
|
1464
1487
|
case "end":
|
|
1465
1488
|
return _context13.stop();
|
|
1466
1489
|
}
|
|
1467
1490
|
}
|
|
1468
|
-
}, _callee13, null, [[
|
|
1469
|
-
})), [images, imagesUploaded]);
|
|
1491
|
+
}, _callee13, null, [[12, 28]]);
|
|
1492
|
+
})), [approvedInputsImages, images, imagesUploaded]);
|
|
1470
1493
|
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
1471
1494
|
var res;
|
|
1472
1495
|
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
@@ -1825,7 +1848,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1825
1848
|
if (res.data.statusCode === 200) {
|
|
1826
1849
|
_JSON$parse = JSON.parse(res.data.body), newArticleStatus = _JSON$parse.newArticleStatus, newServiceStatus = _JSON$parse.newServiceStatus, newStatus = _JSON$parse.newStatus;
|
|
1827
1850
|
if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
|
|
1828
|
-
retailerStatusCopy = (0,
|
|
1851
|
+
retailerStatusCopy = (0, _objectSpread5.default)({}, retailerStatus);
|
|
1829
1852
|
retailerStatusCopy[activeRetailer.id][concept] = newStatus;
|
|
1830
1853
|
setRetailerStatus(retailerStatusCopy);
|
|
1831
1854
|
productTemp.statusByRetailer = retailerStatusCopy;
|
|
@@ -1838,7 +1861,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1838
1861
|
setProduct(productTemp);
|
|
1839
1862
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1840
1863
|
setOrigin(function (prev) {
|
|
1841
|
-
return (0,
|
|
1864
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, prev), {}, (0, _defineProperty2.default)({}, concept, status));
|
|
1842
1865
|
});
|
|
1843
1866
|
}
|
|
1844
1867
|
|
|
@@ -1888,7 +1911,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1888
1911
|
var service = ret.service,
|
|
1889
1912
|
id_retailer = ret.id_retailer;
|
|
1890
1913
|
var data = {};
|
|
1891
|
-
data = (0,
|
|
1914
|
+
data = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, dataGeneral), {}, {
|
|
1892
1915
|
concept: service,
|
|
1893
1916
|
retailerId: id_retailer,
|
|
1894
1917
|
evalStatus: retailerStatus[id_retailer][service]
|
|
@@ -1910,7 +1933,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1910
1933
|
productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : status;
|
|
1911
1934
|
productTemp.description_status = productTemp.description_status === "NA" ? "NA" : status;
|
|
1912
1935
|
productTemp.images_status = productTemp.images_status === "NA" ? "NA" : status;
|
|
1913
|
-
retailerStatusCopy = (0,
|
|
1936
|
+
retailerStatusCopy = (0, _objectSpread5.default)({}, retailerStatus);
|
|
1914
1937
|
Object.keys(retailerStatusCopy).forEach(function (key) {
|
|
1915
1938
|
conceptArray.forEach(function (concept) {
|
|
1916
1939
|
if (retailerStatusCopy[key][concept]) {
|
|
@@ -2047,7 +2070,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2047
2070
|
if (result === "A") {
|
|
2048
2071
|
if (origin[activeTab] === "RequestWithoutContentoh" && !user.is_retailer && (!product.id_order || !product.orderId)) {
|
|
2049
2072
|
setDataGenericModal(function (prev) {
|
|
2050
|
-
return (0,
|
|
2073
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, prev), {}, {
|
|
2051
2074
|
button2: {
|
|
2052
2075
|
name: "Continuar",
|
|
2053
2076
|
action: function action() {
|
|
@@ -2062,7 +2085,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2062
2085
|
sendEvaluation("A");
|
|
2063
2086
|
} else {
|
|
2064
2087
|
setDataGenericModal(function (prev) {
|
|
2065
|
-
return (0,
|
|
2088
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, prev), {}, {
|
|
2066
2089
|
button2: {
|
|
2067
2090
|
name: "Continuar",
|
|
2068
2091
|
action: function action() {
|
|
@@ -2084,7 +2107,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2084
2107
|
sendEvaluation("R");
|
|
2085
2108
|
} else {
|
|
2086
2109
|
setDataGenericModal(function (prev) {
|
|
2087
|
-
return (0,
|
|
2110
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, prev), {}, {
|
|
2088
2111
|
button2: {
|
|
2089
2112
|
name: "Continuar",
|
|
2090
2113
|
action: function action() {
|
|
@@ -2149,7 +2172,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2149
2172
|
approveAll: function approveAll() {
|
|
2150
2173
|
if (origin === "RequestWithoutContentoh" && !user.is_retailer && (!product.id_order || !product.orderId)) {
|
|
2151
2174
|
setDataGenericModal(function (prev) {
|
|
2152
|
-
return (0,
|
|
2175
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, prev), {}, {
|
|
2153
2176
|
button2: {
|
|
2154
2177
|
name: "Continuar",
|
|
2155
2178
|
action: function action() {
|
|
@@ -2164,7 +2187,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2164
2187
|
validateAll("A");
|
|
2165
2188
|
} else {
|
|
2166
2189
|
setDataGenericModal(function (prev) {
|
|
2167
|
-
return (0,
|
|
2190
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, prev), {}, {
|
|
2168
2191
|
button2: {
|
|
2169
2192
|
name: "Continuar",
|
|
2170
2193
|
action: function action() {
|
|
@@ -2188,7 +2211,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2188
2211
|
setShowRejectModal(true);
|
|
2189
2212
|
} else {
|
|
2190
2213
|
setDataGenericModal(function (prev) {
|
|
2191
|
-
return (0,
|
|
2214
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, prev), {}, {
|
|
2192
2215
|
button2: {
|
|
2193
2216
|
name: "Continuar",
|
|
2194
2217
|
action: function action() {
|
|
@@ -2297,10 +2320,10 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2297
2320
|
headerType: "input-name-header"
|
|
2298
2321
|
})), activeTab === "Imágenes" && ((product === null || product === void 0 ? void 0 : product.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)("section", {
|
|
2299
2322
|
className: "container",
|
|
2300
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0,
|
|
2323
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread5.default)((0, _objectSpread5.default)({}, getRootProps({
|
|
2301
2324
|
className: "dropzone"
|
|
2302
2325
|
})), {}, {
|
|
2303
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", (0,
|
|
2326
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", (0, _objectSpread5.default)({}, getInputProps())), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
|
|
2304
2327
|
children: thumbs()
|
|
2305
2328
|
})]
|
|
2306
2329
|
}))
|
|
@@ -2359,7 +2382,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2359
2382
|
onClick: function onClick() {
|
|
2360
2383
|
return setMessage("");
|
|
2361
2384
|
}
|
|
2362
|
-
}), globalModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GlobalModal, (0,
|
|
2385
|
+
}), globalModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GlobalModal, (0, _objectSpread5.default)({
|
|
2363
2386
|
close: closeGlobalModal
|
|
2364
2387
|
}, globalModal)), showVersionSelector && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VersionSelector.VersionSelector, {
|
|
2365
2388
|
modalId: "version-selector",
|
package/package.json
CHANGED
|
@@ -65,14 +65,22 @@ export const Container = styled.div`
|
|
|
65
65
|
background-color: #ededfc;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
`;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
68
|
|
|
69
|
+
.btnReviewState {
|
|
70
|
+
display: "flex";
|
|
71
|
+
flex-direction: "column";
|
|
72
|
+
border: 1px solid lightgray;
|
|
73
|
+
border-radius: 3px;
|
|
74
|
+
z-index: 1000;
|
|
75
|
+
/* position: absolute; */
|
|
76
|
+
}
|
|
78
77
|
|
|
78
|
+
.btnReviewState button {
|
|
79
|
+
border: none;
|
|
80
|
+
background: white;
|
|
81
|
+
border-radius: 3px;
|
|
82
|
+
}
|
|
83
|
+
.btnReviewState button:hover {
|
|
84
|
+
background: lightgray;
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
@@ -11,6 +11,7 @@ export const InputFormatter = ({
|
|
|
11
11
|
setUpdatedDescriptions,
|
|
12
12
|
isRequired,
|
|
13
13
|
maxChar,
|
|
14
|
+
disabled,
|
|
14
15
|
}) => {
|
|
15
16
|
const [inputValue, setInputValue] = useState(mainValue);
|
|
16
17
|
const [selection, setSelection] = useState(false);
|
|
@@ -117,7 +118,7 @@ export const InputFormatter = ({
|
|
|
117
118
|
id={inputId + ""}
|
|
118
119
|
ref={(el) => setQuill(el)}
|
|
119
120
|
defaultValue={getValue(inputValue)}
|
|
120
|
-
|
|
121
|
+
readOnly={disabled}
|
|
121
122
|
modules={{ toolbar: ["bold"] }}
|
|
122
123
|
onKeyPress={(e) => {
|
|
123
124
|
if (charsCounter >= maxLength && e.key !== "Backspace") {
|
|
@@ -7,6 +7,8 @@ import { useState, useEffect } from "react";
|
|
|
7
7
|
import Select from "../../atoms/Select";
|
|
8
8
|
import rejectIcon from "../../../assets/images/generalButton/rejectIcon.svg";
|
|
9
9
|
import acceptIcon from "../../../assets/images/generalButton/acceptIcon.svg";
|
|
10
|
+
import { Tooltip } from "../../atoms/Tooltip";
|
|
11
|
+
|
|
10
12
|
export const GalleryElement = ({
|
|
11
13
|
image,
|
|
12
14
|
gridLayout = false,
|
|
@@ -22,8 +24,25 @@ export const GalleryElement = ({
|
|
|
22
24
|
setCheckAll,
|
|
23
25
|
auditImages,
|
|
24
26
|
compare,
|
|
27
|
+
updateApprovedInputsImages,
|
|
25
28
|
}) => {
|
|
26
29
|
const [showValidationPanel, setShowValidationPanel] = useState(false);
|
|
30
|
+
const [showDivStates, setShowDivStates] = useState({});
|
|
31
|
+
const [imageStates, setImageStates] = useState({});
|
|
32
|
+
|
|
33
|
+
const handleImgClick = (inputId) => {
|
|
34
|
+
setShowDivStates((prevStates) => ({
|
|
35
|
+
...prevStates,
|
|
36
|
+
[inputId]: !prevStates[inputId],
|
|
37
|
+
}));
|
|
38
|
+
};
|
|
39
|
+
const changeImageBtn = (inputId, action) => {
|
|
40
|
+
setImageStates((prevStates) => ({
|
|
41
|
+
...prevStates,
|
|
42
|
+
[inputId]: action === "validate",
|
|
43
|
+
}));
|
|
44
|
+
updateApprovedInputsImages(inputId);
|
|
45
|
+
};
|
|
27
46
|
|
|
28
47
|
const closeValidationPanel = (e) => {
|
|
29
48
|
if (
|
|
@@ -58,7 +77,7 @@ export const GalleryElement = ({
|
|
|
58
77
|
const isEquals = (value, auditValue) => {
|
|
59
78
|
return value === auditValue;
|
|
60
79
|
};
|
|
61
|
-
|
|
80
|
+
//TOMAR EL image_id
|
|
62
81
|
return (
|
|
63
82
|
<Container
|
|
64
83
|
className={`${gridLayout ? "grid-gallery" : "row-gallery"} ${
|
|
@@ -142,17 +161,61 @@ export const GalleryElement = ({
|
|
|
142
161
|
});
|
|
143
162
|
}}
|
|
144
163
|
/>
|
|
145
|
-
|
|
146
|
-
|
|
164
|
+
|
|
165
|
+
{image?.isApproved === false && (
|
|
166
|
+
<div
|
|
147
167
|
style={{
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
168
|
+
display: "flex",
|
|
169
|
+
"justify-content": "center",
|
|
170
|
+
"align-items": "center",
|
|
151
171
|
}}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
172
|
+
>
|
|
173
|
+
<Tooltip
|
|
174
|
+
componentTooltip={
|
|
175
|
+
<>
|
|
176
|
+
<p>
|
|
177
|
+
<b>Comentarios:</b>
|
|
178
|
+
</p>
|
|
179
|
+
<p>{image.comment}</p>
|
|
180
|
+
</>
|
|
181
|
+
}
|
|
182
|
+
children={
|
|
183
|
+
!image.isApproved && (
|
|
184
|
+
<img
|
|
185
|
+
src={
|
|
186
|
+
imageStates[image.image_id]
|
|
187
|
+
? acceptIcon
|
|
188
|
+
: rejectIcon
|
|
189
|
+
}
|
|
190
|
+
alt={"botón rechazar"}
|
|
191
|
+
style={{ cursor: "pointer" }}
|
|
192
|
+
onClick={() => handleImgClick(image.image_id)}
|
|
193
|
+
/>
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
classNameTooltip={"container-tooltip"}
|
|
197
|
+
/>
|
|
198
|
+
{showDivStates[image.image_id] && (
|
|
199
|
+
<div className="btnReviewState">
|
|
200
|
+
<div>
|
|
201
|
+
<button
|
|
202
|
+
id="aceptbtn"
|
|
203
|
+
onClick={() =>
|
|
204
|
+
changeImageBtn(image.image_id, "validate")
|
|
205
|
+
}
|
|
206
|
+
>
|
|
207
|
+
<img
|
|
208
|
+
src={acceptIcon}
|
|
209
|
+
alt="acept button"
|
|
210
|
+
style={{ cursor: "pointer" }}
|
|
211
|
+
/>
|
|
212
|
+
Validar
|
|
213
|
+
</button>
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
)}
|
|
217
|
+
</div>
|
|
218
|
+
)}
|
|
156
219
|
</>
|
|
157
220
|
)}
|
|
158
221
|
</div>
|
|
@@ -186,7 +186,7 @@ export const InputGroup = ({
|
|
|
186
186
|
compare
|
|
187
187
|
}
|
|
188
188
|
//disabled={input === 40001}
|
|
189
|
-
disabled={dataInputs[input]
|
|
189
|
+
disabled={dataInputs[input]?.isApproved}
|
|
190
190
|
inputId={dataInputs[input]?.id}
|
|
191
191
|
version={version}
|
|
192
192
|
inputType={inputTypeValue(dataInputs[input]?.type)}
|
|
@@ -222,27 +222,31 @@ export const InputGroup = ({
|
|
|
222
222
|
: ""
|
|
223
223
|
}
|
|
224
224
|
/>
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
225
|
+
{dataInputs[input]?.isApproved === false && (
|
|
226
|
+
<InputReviewSection
|
|
227
|
+
inputId={dataInputs[input]?.id}
|
|
228
|
+
isApproved={dataInputs[input]?.isApproved}
|
|
229
|
+
comment={dataInputs[input]?.comment}
|
|
230
|
+
handleImgClick={handleImgClick}
|
|
231
|
+
changeImageBtn={changeImageBtn}
|
|
232
|
+
showDivState={showDivStates}
|
|
233
|
+
imageStates={imageStates}
|
|
234
|
+
/>
|
|
235
|
+
)}
|
|
234
236
|
</>
|
|
235
237
|
) : (
|
|
236
238
|
<>
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
239
|
+
{input?.isApproved === false && (
|
|
240
|
+
<InputReviewSection
|
|
241
|
+
inputId={input?.id}
|
|
242
|
+
isApproved={input?.isApproved}
|
|
243
|
+
comment={input?.comment}
|
|
244
|
+
handleImgClick={handleImgClick}
|
|
245
|
+
changeImageBtn={changeImageBtn}
|
|
246
|
+
showDivState={showDivStates}
|
|
247
|
+
imageStates={imageStates}
|
|
248
|
+
/>
|
|
249
|
+
)}
|
|
246
250
|
<TagAndInput
|
|
247
251
|
key={index + "-" + input?.value + "-" + compare}
|
|
248
252
|
inputId={input.id}
|
|
@@ -255,6 +259,7 @@ export const InputGroup = ({
|
|
|
255
259
|
: input?.value
|
|
256
260
|
}
|
|
257
261
|
isRequired={input.required}
|
|
262
|
+
disabled={input?.isApproved}
|
|
258
263
|
maxChar={input.max_chars}
|
|
259
264
|
inputPlaceHolder={input?.placeholder}
|
|
260
265
|
updatedDescriptions={updatedDescriptions}
|
|
@@ -309,7 +314,7 @@ export const InputGroup = ({
|
|
|
309
314
|
compare
|
|
310
315
|
}
|
|
311
316
|
//disabled={input === 40001}
|
|
312
|
-
disabled={
|
|
317
|
+
disabled={dataInputs[input]?.isApproved}
|
|
313
318
|
inputId={dataInputs[input]?.id}
|
|
314
319
|
version={version}
|
|
315
320
|
inputType={inputTypeValue(dataInputs[input]?.type)}
|
|
@@ -348,31 +353,36 @@ export const InputGroup = ({
|
|
|
348
353
|
: ""
|
|
349
354
|
}
|
|
350
355
|
/>
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
356
|
+
{dataInputs[input]?.isApproved === false && (
|
|
357
|
+
<InputReviewSection
|
|
358
|
+
inputId={dataInputs[input]?.id}
|
|
359
|
+
isApproved={dataInputs[input]?.isApproved}
|
|
360
|
+
comment={dataInputs[input]?.comment}
|
|
361
|
+
handleImgClick={handleImgClick}
|
|
362
|
+
changeImageBtn={changeImageBtn}
|
|
363
|
+
showDivState={showDivStates}
|
|
364
|
+
imageStates={imageStates}
|
|
365
|
+
/>
|
|
366
|
+
)}
|
|
360
367
|
</>
|
|
361
368
|
) : (
|
|
362
369
|
<>
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
370
|
+
{input?.isApproved === false && (
|
|
371
|
+
<InputReviewSection
|
|
372
|
+
inputId={input?.id}
|
|
373
|
+
isApproved={input?.isApproved}
|
|
374
|
+
comment={input?.comment}
|
|
375
|
+
handleImgClick={handleImgClick}
|
|
376
|
+
changeImageBtn={changeImageBtn}
|
|
377
|
+
showDivState={showDivStates}
|
|
378
|
+
imageStates={imageStates}
|
|
379
|
+
/>
|
|
380
|
+
)}
|
|
372
381
|
<TagAndInput
|
|
373
382
|
key={index + "-" + input?.value + "-" + compare}
|
|
374
383
|
inputId={input.id}
|
|
375
384
|
index={index}
|
|
385
|
+
disabled={input?.isApproved}
|
|
376
386
|
inputType={"textarea"}
|
|
377
387
|
label={input?.name + (input.required ? "*" : "")}
|
|
378
388
|
value={
|
|
@@ -177,6 +177,7 @@ export const ProviderProductEdition = ({
|
|
|
177
177
|
ext: ext[ext.length - 1],
|
|
178
178
|
width: width,
|
|
179
179
|
height: height,
|
|
180
|
+
isApproved: true, //VALIDAR QUE SOLO SEA PARA RADIOSHACK
|
|
180
181
|
},
|
|
181
182
|
};
|
|
182
183
|
setImages(newImg);
|
|
@@ -228,14 +229,19 @@ export const ProviderProductEdition = ({
|
|
|
228
229
|
const [validatedAll, setValidatedAll] = useState(false);
|
|
229
230
|
const [showRejectModal, setShowRejectModal] = useState(false);
|
|
230
231
|
const [approvedInputs, setApprovedInputs] = useState({});
|
|
232
|
+
const [approvedInputsImages, setApprovedInputsImages] = useState({});
|
|
231
233
|
|
|
232
|
-
// La función que se pasará al componente hijo
|
|
233
234
|
const updateApprovedInputs = (inputId) => {
|
|
234
235
|
setApprovedInputs((prevInputs) => ({
|
|
235
236
|
...prevInputs,
|
|
236
237
|
[inputId]: true,
|
|
237
238
|
}));
|
|
238
|
-
|
|
239
|
+
};
|
|
240
|
+
const updateApprovedInputsImages = (inputId) => {
|
|
241
|
+
setApprovedInputsImages((prevInputs) => ({
|
|
242
|
+
...prevInputs,
|
|
243
|
+
[inputId]: true,
|
|
244
|
+
}));
|
|
239
245
|
};
|
|
240
246
|
|
|
241
247
|
const [origin, setOrigin] = useState({
|
|
@@ -671,6 +677,7 @@ export const ProviderProductEdition = ({
|
|
|
671
677
|
changeImage={setImages}
|
|
672
678
|
selectedImages={selectedImages}
|
|
673
679
|
setSelectedImages={setSelectedImages}
|
|
680
|
+
updateApprovedInputsImages={updateApprovedInputsImages}
|
|
674
681
|
/>
|
|
675
682
|
));
|
|
676
683
|
};
|
|
@@ -812,12 +819,23 @@ export const ProviderProductEdition = ({
|
|
|
812
819
|
return false;
|
|
813
820
|
});
|
|
814
821
|
}
|
|
822
|
+
console.log("DATA NEW", data);
|
|
823
|
+
|
|
815
824
|
if (valid && duplicated?.length === 0) {
|
|
816
825
|
setLoading(true);
|
|
817
826
|
try {
|
|
818
827
|
data?.articleData?.forEach((e) => {
|
|
819
828
|
e.uuid = uuidv4();
|
|
820
829
|
});
|
|
830
|
+
data.updateImages = data.updateImages.map((image) => {
|
|
831
|
+
if (approvedInputsImages[image.image_id] !== undefined) {
|
|
832
|
+
return {
|
|
833
|
+
...image,
|
|
834
|
+
isApproved: approvedInputsImages[image.image_id],
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
return image;
|
|
838
|
+
});
|
|
821
839
|
setDataImages(data);
|
|
822
840
|
if (data?.articleData?.length > 0) {
|
|
823
841
|
setImagesUploaded(false);
|
|
@@ -851,7 +869,7 @@ export const ProviderProductEdition = ({
|
|
|
851
869
|
);
|
|
852
870
|
}
|
|
853
871
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
854
|
-
}, [images, imagesUploaded]);
|
|
872
|
+
}, [approvedInputsImages, images, imagesUploaded]);
|
|
855
873
|
|
|
856
874
|
useEffect(async () => {
|
|
857
875
|
if (imagesUploaded) {
|