contentoh-components-library 21.5.94 → 21.5.95
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/ai/utils/compare-strings.js +45 -0
- package/dist/components/atoms/GeneralButton/styles.js +1 -1
- package/dist/components/atoms/GeneralInput/index.js +245 -54
- package/dist/components/atoms/GeneralInput/styles.js +7 -3
- package/dist/components/atoms/InputFormatter/index.js +223 -68
- package/dist/components/atoms/InputFormatter/styles.js +20 -4
- package/dist/components/molecules/StatusAsignationInfo/index.js +11 -1
- package/dist/components/molecules/TabsMenu/index.js +13 -12
- package/dist/components/molecules/TagAndInput/index.js +361 -24
- package/dist/components/molecules/TagAndInput/styles.js +2 -2
- package/dist/components/organisms/ChangeStatusModal/index.js +531 -0
- package/dist/components/organisms/ChangeStatusModal/styles.js +85 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +6 -22
- package/dist/components/organisms/InputGroup/index.js +22 -18
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +150 -337
- package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +15 -15
- package/dist/components/pages/ProviderProductEdition/index.js +413 -396
- package/dist/components/pages/ProviderProductEdition/utils.js +1 -0
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +179 -196
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +59 -260
- package/dist/components/pages/RetailerProductEdition/context/reducers/product.js +50 -38
- package/dist/components/pages/RetailerProductEdition/index.js +1719 -2237
- package/dist/components/pages/RetailerProductEdition/styles.js +4 -2
- package/dist/components/pages/RetailerProductEdition/utils.js +251 -2
- package/dist/contexts/AiProductEdition.js +230 -158
- package/dist/global-files/statusDictionary.js +103 -0
- package/package.json +4 -2
- package/src/ai/utils/compare-strings.js +45 -0
- package/src/assets/images/Icons/arrow.png +0 -0
- package/src/assets/images/Icons/cancel.png +0 -0
- package/src/assets/images/Icons/ia-icon.png +0 -0
- package/src/assets/images/Icons/loading.svg +5 -0
- package/src/assets/images/Icons/reload.png +0 -0
- package/src/components/atoms/GeneralButton/styles.js +4 -0
- package/src/components/atoms/GeneralInput/index.js +237 -60
- package/src/components/atoms/GeneralInput/styles.js +81 -0
- package/src/components/atoms/InputFormatter/index.js +200 -51
- package/src/components/atoms/InputFormatter/styles.js +284 -0
- package/src/components/atoms/RetailerSelector/RetailerSelector.stories.js +10 -0
- package/src/components/atoms/RetailerSelector/index.js +3 -0
- package/src/components/atoms/RetailerSelector/styles.js +0 -0
- package/src/components/molecules/StatusAsignationInfo/index.js +9 -1
- package/src/components/molecules/TabsMenu/index.js +12 -11
- package/src/components/molecules/TagAndInput/index.js +286 -21
- package/src/components/molecules/TagAndInput/styles.js +59 -17
- package/src/components/organisms/ChangeStatusModal/index.jsx +488 -0
- package/src/components/organisms/ChangeStatusModal/styles.js +333 -0
- package/src/components/organisms/FullProductNameHeader/index.js +4 -28
- package/src/components/organisms/FullTabsMenu/index.js +1 -1
- package/src/components/organisms/InputGroup/index.js +12 -4
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +174 -202
- package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +14 -14
- package/src/components/pages/ProviderProductEdition/index.js +496 -475
- package/src/components/pages/ProviderProductEdition/utils.js +2 -2
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +201 -224
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +575 -0
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +62 -0
- package/src/components/pages/RetailerProductEdition/context/reducers/active-state.js +344 -0
- package/src/components/pages/RetailerProductEdition/context/reducers/inputs.js +155 -0
- package/src/components/pages/RetailerProductEdition/context/reducers/product.js +114 -0
- package/src/components/pages/RetailerProductEdition/context/reducers/system.js +60 -0
- package/src/components/pages/RetailerProductEdition/index.js +1545 -1718
- package/src/components/pages/RetailerProductEdition/index_old.js +1979 -0
- package/src/components/pages/RetailerProductEdition/stories/Auditor.stories.js +101 -0
- package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +115 -0
- package/src/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +174 -0
- package/src/components/pages/RetailerProductEdition/styles.js +67 -2
- package/src/components/pages/RetailerProductEdition/utils.js +240 -0
- package/src/contexts/AiProductEdition.jsx +339 -0
- package/src/global-files/statusDictionary.js +103 -0
|
@@ -9,457 +9,247 @@ exports.RetailerProductEdition = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
15
|
-
|
|
16
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
17
|
-
|
|
18
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
19
|
-
|
|
20
|
-
var _styles = require("./styles");
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
21
13
|
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
var _ImagePreviewer = require("../../organisms/ImagePreviewer");
|
|
14
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));
|
|
25
15
|
|
|
26
|
-
var
|
|
16
|
+
var _objectSpread5 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
27
17
|
|
|
28
|
-
var
|
|
18
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
29
19
|
|
|
30
|
-
var
|
|
20
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
31
21
|
|
|
32
|
-
var
|
|
22
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
33
23
|
|
|
34
24
|
var _react = require("react");
|
|
35
25
|
|
|
36
|
-
var _GalleryElement = require("../../molecules/GalleryElement");
|
|
37
|
-
|
|
38
|
-
var _fileSaver = require("file-saver");
|
|
39
|
-
|
|
40
|
-
var _Commentary = require("../../atoms/Commentary");
|
|
41
|
-
|
|
42
|
-
var _data2 = require("../../../global-files/data");
|
|
43
|
-
|
|
44
|
-
var _GalleryHeader = require("../../molecules/GalleryHeader");
|
|
45
|
-
|
|
46
|
-
var _ProductImageModal = require("../../organisms/ProductImageModal");
|
|
47
|
-
|
|
48
|
-
var _reactDropzone = require("react-dropzone");
|
|
49
|
-
|
|
50
26
|
var _axios = _interopRequireDefault(require("axios"));
|
|
51
27
|
|
|
52
|
-
var
|
|
28
|
+
var _reactDropzone = require("react-dropzone");
|
|
53
29
|
|
|
54
|
-
var
|
|
30
|
+
var _fileSaver = require("file-saver");
|
|
55
31
|
|
|
56
|
-
var
|
|
32
|
+
var _providerProductEdition = require("./context/provider-product-edition.context");
|
|
57
33
|
|
|
58
|
-
var
|
|
34
|
+
var _utils = require("./utils");
|
|
59
35
|
|
|
60
|
-
var
|
|
36
|
+
var _data = require("../../../global-files/data");
|
|
61
37
|
|
|
62
|
-
var
|
|
38
|
+
var _customHooks = require("../../../global-files/customHooks");
|
|
63
39
|
|
|
64
40
|
var _GeneralButton = require("../../atoms/GeneralButton");
|
|
65
41
|
|
|
66
42
|
var _GenericModal = require("../../atoms/GenericModal");
|
|
67
43
|
|
|
68
|
-
var _ScreenHeader = require("../../atoms/ScreenHeader");
|
|
69
|
-
|
|
70
44
|
var _Loading = require("../../atoms/Loading");
|
|
71
45
|
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
var _VersionSelector = require("../../organisms/VersionSelector");
|
|
75
|
-
|
|
76
|
-
var _customHooks = require("../../../global-files/customHooks");
|
|
77
|
-
|
|
78
|
-
var _utils = require("./utils");
|
|
79
|
-
|
|
80
|
-
var _Modal = require("../../organisms/Modal");
|
|
46
|
+
var _ScreenHeader = require("../../atoms/ScreenHeader");
|
|
81
47
|
|
|
82
48
|
var _ButtonV = require("../../atoms/ButtonV2");
|
|
83
49
|
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
87
|
-
|
|
88
|
-
var reducerImages = function reducerImages(state, action) {
|
|
89
|
-
var _action$init, _action$init$inputsBy;
|
|
90
|
-
|
|
91
|
-
var values = state.values,
|
|
92
|
-
attrForImgs = state.attrForImgs,
|
|
93
|
-
inputsByRetailer = state.inputsByRetailer;
|
|
94
|
-
|
|
95
|
-
switch (action.action) {
|
|
96
|
-
case "init":
|
|
97
|
-
var newInputsByRetailer = {};
|
|
98
|
-
action === null || action === void 0 ? void 0 : (_action$init = action.init) === null || _action$init === void 0 ? void 0 : (_action$init$inputsBy = _action$init.inputsByRetailer) === null || _action$init$inputsBy === void 0 ? void 0 : _action$init$inputsBy.forEach(function (inputs) {
|
|
99
|
-
inputs === null || inputs === void 0 ? void 0 : inputs.forEach(function (input) {
|
|
100
|
-
if (!newInputsByRetailer["".concat(input.id_retailer)]) newInputsByRetailer["".concat(input.id_retailer)] = [];
|
|
101
|
-
newInputsByRetailer["".concat(input.id_retailer)].push(input);
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
inputsByRetailer = newInputsByRetailer;
|
|
105
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, action.init), {}, {
|
|
106
|
-
inputsByRetailer: inputsByRetailer,
|
|
107
|
-
valuesInitial: action.init.values,
|
|
108
|
-
inputsInitial: action.init.inputs
|
|
109
|
-
});
|
|
50
|
+
var _GalleryElement = require("../../molecules/GalleryElement");
|
|
110
51
|
|
|
111
|
-
|
|
112
|
-
values = [].concat((0, _toConsumableArray2.default)(values), [action.img]);
|
|
113
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
114
|
-
values: values
|
|
115
|
-
});
|
|
52
|
+
var _GalleryHeader = require("../../molecules/GalleryHeader");
|
|
116
53
|
|
|
117
|
-
|
|
118
|
-
values[action.index][action.attribute] = action.value;
|
|
119
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
120
|
-
values: values
|
|
121
|
-
});
|
|
54
|
+
var _HeaderTop = require("../../molecules/HeaderTop");
|
|
122
55
|
|
|
123
|
-
|
|
124
|
-
values[action.index][action.attribute] = action.value;
|
|
125
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
126
|
-
values: values
|
|
127
|
-
});
|
|
56
|
+
var _index = require("../../molecules/TagAndInput/index");
|
|
128
57
|
|
|
129
|
-
|
|
130
|
-
var index = attrForImgs.general.findIndex(function (f) {
|
|
131
|
-
return f.id === action.id;
|
|
132
|
-
});
|
|
58
|
+
var _FullProductNameHeader = require("../../organisms/FullProductNameHeader");
|
|
133
59
|
|
|
134
|
-
|
|
135
|
-
attrForImgs.general[index].value = action.value;
|
|
136
|
-
}
|
|
60
|
+
var _FullTabsMenu = require("../../organisms/FullTabsMenu");
|
|
137
61
|
|
|
138
|
-
|
|
139
|
-
attrForImgs: attrForImgs,
|
|
140
|
-
values: values
|
|
141
|
-
});
|
|
62
|
+
var _ImageDataTable = require("../../organisms/ImageDataTable");
|
|
142
63
|
|
|
143
|
-
|
|
144
|
-
values = values.filter(function (value) {
|
|
145
|
-
return action.selectedImages.indexOf(value) === -1;
|
|
146
|
-
});
|
|
147
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
148
|
-
values: values
|
|
149
|
-
});
|
|
64
|
+
var _ImagePreviewer = require("../../organisms/ImagePreviewer");
|
|
150
65
|
|
|
151
|
-
|
|
152
|
-
{
|
|
153
|
-
var _inputsByRetailer = state.inputsByRetailer,
|
|
154
|
-
valuesInitial = state.valuesInitial,
|
|
155
|
-
inputsInitial = state.inputsInitial,
|
|
156
|
-
inputs = state.inputs;
|
|
66
|
+
var _InputGroup = require("../../organisms/InputGroup");
|
|
157
67
|
|
|
158
|
-
|
|
159
|
-
var _inputsByRetailer$act;
|
|
68
|
+
var _ProductImageModal = require("../../organisms/ProductImageModal");
|
|
160
69
|
|
|
161
|
-
|
|
162
|
-
var imageIdArray = [];
|
|
70
|
+
var _VersionSelector = require("../../organisms/VersionSelector");
|
|
163
71
|
|
|
164
|
-
|
|
165
|
-
_inputsByRetailer[action.retailerId] = [];
|
|
166
|
-
}
|
|
72
|
+
var _Modal = require("../../organisms/Modal");
|
|
167
73
|
|
|
168
|
-
|
|
169
|
-
imageIdArray.push(input.id_image);
|
|
170
|
-
valuesInitial.forEach( /*#__PURE__*/function () {
|
|
171
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(value) {
|
|
172
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
173
|
-
while (1) {
|
|
174
|
-
switch (_context2.prev = _context2.next) {
|
|
175
|
-
case 0:
|
|
176
|
-
if (value.ext == "mp4") {
|
|
177
|
-
convertirVideoABase64("https://" + process.env.REACT_APP_IMAGES_BUCKET + ".s3.amazonaws.com/" + value.srcDB).then( /*#__PURE__*/function () {
|
|
178
|
-
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(base64) {
|
|
179
|
-
var videoSrc;
|
|
180
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
181
|
-
while (1) {
|
|
182
|
-
switch (_context.prev = _context.next) {
|
|
183
|
-
case 0:
|
|
184
|
-
videoSrc = "data:video/mp4;base64," + base64.split(",")[1]; // Añade el tipo MIME adecuado
|
|
185
|
-
|
|
186
|
-
_context.next = 3;
|
|
187
|
-
return (0, _generateThumnail.default)(videoSrc, 2);
|
|
188
|
-
|
|
189
|
-
case 3:
|
|
190
|
-
value.src = _context.sent;
|
|
191
|
-
|
|
192
|
-
case 4:
|
|
193
|
-
case "end":
|
|
194
|
-
return _context.stop();
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}, _callee);
|
|
198
|
-
}));
|
|
199
|
-
|
|
200
|
-
return function (_x2) {
|
|
201
|
-
return _ref2.apply(this, arguments);
|
|
202
|
-
};
|
|
203
|
-
}()).catch(function (error) {
|
|
204
|
-
console.error("Error:", error);
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
if (value.image_id === input.id_image) orderedImages.push(value);
|
|
209
|
-
|
|
210
|
-
case 2:
|
|
211
|
-
case "end":
|
|
212
|
-
return _context2.stop();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}, _callee2);
|
|
216
|
-
}));
|
|
74
|
+
var _genericModalCheck = _interopRequireDefault(require("../../../assets/images/genericModal/genericModalCheck.svg"));
|
|
217
75
|
|
|
218
|
-
|
|
219
|
-
return _ref.apply(this, arguments);
|
|
220
|
-
};
|
|
221
|
-
}());
|
|
222
|
-
}));
|
|
223
|
-
inputs = inputsInitial === null || inputsInitial === void 0 ? void 0 : inputsInitial.filter(function (input) {
|
|
224
|
-
return imageIdArray.includes(input.id);
|
|
225
|
-
});
|
|
226
|
-
values = orderedImages.length > 0 ? orderedImages : [];
|
|
227
|
-
} catch (error) {
|
|
228
|
-
console.log(error);
|
|
229
|
-
}
|
|
76
|
+
var _errorModal = _interopRequireDefault(require("../../../assets/images/genericModal/errorModal.svg"));
|
|
230
77
|
|
|
231
|
-
|
|
232
|
-
values: values,
|
|
233
|
-
inputs: inputs
|
|
234
|
-
});
|
|
235
|
-
}
|
|
78
|
+
var _genericModalWarning = _interopRequireDefault(require("../../../assets/images/genericModal/genericModalWarning.svg"));
|
|
236
79
|
|
|
237
|
-
|
|
238
|
-
return state;
|
|
239
|
-
}
|
|
240
|
-
};
|
|
80
|
+
var _attributesSent = _interopRequireDefault(require("../../../assets/images/modalsSVGs/attributesSent.svg"));
|
|
241
81
|
|
|
242
|
-
var
|
|
243
|
-
var REGION = "us-east-1";
|
|
82
|
+
var _descriptionSent = _interopRequireDefault(require("../../../assets/images/modalsSVGs/descriptionSent.svg"));
|
|
244
83
|
|
|
245
|
-
|
|
246
|
-
return new Promise(function (resolve, reject) {
|
|
247
|
-
var xhr = new XMLHttpRequest();
|
|
248
|
-
xhr.open("GET", url, true);
|
|
249
|
-
xhr.responseType = "blob";
|
|
84
|
+
var _uploadingImages = _interopRequireDefault(require("../../../assets/images/modalsSVGs/uploadingImages.svg"));
|
|
250
85
|
|
|
251
|
-
|
|
252
|
-
if (xhr.status === 200) {
|
|
253
|
-
var blob = xhr.response;
|
|
254
|
-
var reader = new FileReader();
|
|
86
|
+
var _styles = require("./styles");
|
|
255
87
|
|
|
256
|
-
|
|
257
|
-
resolve(reader.result);
|
|
258
|
-
};
|
|
88
|
+
var _Commentary = require("../../atoms/Commentary");
|
|
259
89
|
|
|
260
|
-
|
|
261
|
-
} else {
|
|
262
|
-
reject(new Error("Error al cargar el video"));
|
|
263
|
-
}
|
|
264
|
-
};
|
|
90
|
+
var _AiProductEdition = require("../../../contexts/AiProductEdition");
|
|
265
91
|
|
|
266
|
-
|
|
267
|
-
reject(new Error("Error de red al cargar el video"));
|
|
268
|
-
};
|
|
92
|
+
var _ChangeStatusModal = _interopRequireDefault(require("../../organisms/ChangeStatusModal"));
|
|
269
93
|
|
|
270
|
-
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
function obtenerDuracionVideoBase64(base64Data) {
|
|
275
|
-
return new Promise(function (resolve, reject) {
|
|
276
|
-
var video = document.createElement("video");
|
|
277
|
-
video.src = base64Data;
|
|
278
|
-
video.addEventListener("loadedmetadata", function () {
|
|
279
|
-
resolve(video.duration);
|
|
280
|
-
});
|
|
281
|
-
video.addEventListener("error", reject);
|
|
282
|
-
});
|
|
283
|
-
}
|
|
94
|
+
var _material = require("@mui/material");
|
|
284
95
|
|
|
285
|
-
|
|
286
|
-
accessKeyId: process.env.REACT_APP_KUTS3,
|
|
287
|
-
secretAccessKey: process.env.REACT_APP_AKUTS3
|
|
288
|
-
});
|
|
96
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
289
97
|
|
|
290
|
-
var
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
98
|
+
var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
99
|
+
var _location$state, _location$state2, _state$active_retaile4, _state$active_retaile5, _state$images_values$2, _state$images_values10, _state$images_values11, _state$product8, _state$active_retaile6, _state$active_retaile7, _state$active_retaile8, _state$active_retaile9, _state$product9, _state$product10, _state$product11, _state$datasheets_inp, _state$datasheets_inp2, _state$product12, _state$images_values12, _state$comment;
|
|
100
|
+
|
|
101
|
+
var tabsSections = _ref.tabsSections,
|
|
102
|
+
_ref$productSelected = _ref.productSelected,
|
|
103
|
+
productSelected = _ref$productSelected === void 0 ? {} : _ref$productSelected,
|
|
104
|
+
_ref$user = _ref.user,
|
|
105
|
+
user = _ref$user === void 0 ? {} : _ref$user,
|
|
106
|
+
token = _ref.token,
|
|
107
|
+
location = _ref.location;
|
|
108
|
+
|
|
109
|
+
var _useProviderProductEd = (0, _providerProductEdition.useProviderProductEdition)(),
|
|
110
|
+
state = _useProviderProductEd.state,
|
|
111
|
+
dispatch = _useProviderProductEd.dispatch,
|
|
112
|
+
saveDatasheets = _useProviderProductEd.saveDatasheets,
|
|
113
|
+
saveDescriptions = _useProviderProductEd.saveDescriptions,
|
|
114
|
+
updateImages = _useProviderProductEd.updateImages,
|
|
115
|
+
saveImageAttrs = _useProviderProductEd.saveImageAttrs,
|
|
116
|
+
deleteImages = _useProviderProductEd.deleteImages,
|
|
117
|
+
handleOnDownloadImages = _useProviderProductEd.handleOnDownloadImages,
|
|
118
|
+
createComment = _useProviderProductEd.createComment;
|
|
296
119
|
|
|
297
|
-
var
|
|
298
|
-
var _product$retailers, _location$state, _location$state2, _product$services2, _datasheets$, _datasheets$$data, _product$article22;
|
|
120
|
+
var isRetailer = user === null || user === void 0 ? void 0 : user.is_retailer;
|
|
299
121
|
|
|
300
|
-
var
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
user = _ref3$user === void 0 ? {} : _ref3$user,
|
|
305
|
-
token = _ref3.token,
|
|
306
|
-
location = _ref3.location;
|
|
122
|
+
var _useCloseModal = (0, _customHooks.useCloseModal)("version-selector"),
|
|
123
|
+
_useCloseModal2 = (0, _slicedToArray2.default)(_useCloseModal, 2),
|
|
124
|
+
showVersionSelector = _useCloseModal2[0],
|
|
125
|
+
setShowVersionSelector = _useCloseModal2[1];
|
|
307
126
|
|
|
308
|
-
var _useState = (0, _react.useState)(
|
|
127
|
+
var _useState = (0, _react.useState)(null),
|
|
309
128
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
310
|
-
|
|
311
|
-
|
|
129
|
+
auditableVersion = _useState2[0],
|
|
130
|
+
setAuditableVersion = _useState2[1];
|
|
312
131
|
|
|
313
|
-
var _useState3 = (0, _react.useState)(),
|
|
132
|
+
var _useState3 = (0, _react.useState)(0),
|
|
314
133
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
315
|
-
|
|
316
|
-
|
|
134
|
+
headerTop = _useState4[0],
|
|
135
|
+
setHeaderTop = _useState4[1];
|
|
317
136
|
|
|
318
137
|
var _useState5 = (0, _react.useState)(false),
|
|
319
138
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
320
|
-
|
|
321
|
-
|
|
139
|
+
shotThd = _useState6[0],
|
|
140
|
+
setShotThd = _useState6[1];
|
|
322
141
|
|
|
323
|
-
var _useState7 = (0, _react.useState)(
|
|
142
|
+
var _useState7 = (0, _react.useState)(),
|
|
324
143
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
325
|
-
|
|
326
|
-
|
|
144
|
+
observation = _useState8[0],
|
|
145
|
+
setObservation = _useState8[1];
|
|
327
146
|
|
|
328
|
-
var _useState9 = (0, _react.useState)(
|
|
147
|
+
var _useState9 = (0, _react.useState)(false),
|
|
329
148
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
330
|
-
|
|
331
|
-
|
|
149
|
+
showRejectModal = _useState10[0],
|
|
150
|
+
setShowRejectModal = _useState10[1];
|
|
332
151
|
|
|
333
|
-
var _useState11 = (0, _react.useState)(
|
|
152
|
+
var _useState11 = (0, _react.useState)(false),
|
|
334
153
|
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
var _useReducer = (0, _react.useReducer)(reducerImages, {}),
|
|
339
|
-
_useReducer2 = (0, _slicedToArray2.default)(_useReducer, 2),
|
|
340
|
-
images = _useReducer2[0],
|
|
341
|
-
setImages = _useReducer2[1];
|
|
154
|
+
isObservationVisible = _useState12[0],
|
|
155
|
+
setObservationVisible = _useState12[1];
|
|
342
156
|
|
|
343
157
|
var _useState13 = (0, _react.useState)(false),
|
|
344
158
|
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
345
|
-
|
|
346
|
-
|
|
159
|
+
imageLayout = _useState14[0],
|
|
160
|
+
setImageLayout = _useState14[1];
|
|
347
161
|
|
|
348
162
|
var _useState15 = (0, _react.useState)(false),
|
|
349
163
|
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
350
|
-
|
|
351
|
-
|
|
164
|
+
crossComment = _useState16[0],
|
|
165
|
+
setCrossComment = _useState16[1];
|
|
166
|
+
|
|
167
|
+
var _useState17 = (0, _react.useState)([]),
|
|
168
|
+
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
169
|
+
statusArray = _useState18[0],
|
|
170
|
+
setStatusArray = _useState18[1];
|
|
171
|
+
|
|
172
|
+
var _useState19 = (0, _react.useState)(false),
|
|
173
|
+
_useState20 = (0, _slicedToArray2.default)(_useState19, 2),
|
|
174
|
+
rejectAll = _useState20[0],
|
|
175
|
+
setRejectAll = _useState20[1];
|
|
176
|
+
|
|
177
|
+
var _useState21 = (0, _react.useState)([]),
|
|
178
|
+
_useState22 = (0, _slicedToArray2.default)(_useState21, 2),
|
|
179
|
+
auditServices = _useState22[0],
|
|
180
|
+
setAuditServices = _useState22[1];
|
|
181
|
+
|
|
182
|
+
var _useState23 = (0, _react.useState)([]),
|
|
183
|
+
_useState24 = (0, _slicedToArray2.default)(_useState23, 2),
|
|
184
|
+
auditDatasheets = _useState24[0],
|
|
185
|
+
setAuditDatasheets = _useState24[1];
|
|
186
|
+
|
|
187
|
+
var _useState25 = (0, _react.useState)([]),
|
|
188
|
+
_useState26 = (0, _slicedToArray2.default)(_useState25, 2),
|
|
189
|
+
auditDescriptions = _useState26[0],
|
|
190
|
+
setAuditDescriptions = _useState26[1];
|
|
191
|
+
|
|
192
|
+
var _useState27 = (0, _react.useState)(false),
|
|
193
|
+
_useState28 = (0, _slicedToArray2.default)(_useState27, 2),
|
|
194
|
+
showModal = _useState28[0],
|
|
195
|
+
setShowModal = _useState28[1];
|
|
196
|
+
|
|
197
|
+
var _useState29 = (0, _react.useState)(false),
|
|
198
|
+
_useState30 = (0, _slicedToArray2.default)(_useState29, 2),
|
|
199
|
+
compare = _useState30[0],
|
|
200
|
+
setCompare = _useState30[1];
|
|
352
201
|
|
|
353
202
|
var _useDropzone = (0, _reactDropzone.useDropzone)({
|
|
354
|
-
accept: "image
|
|
203
|
+
accept: "image/*",
|
|
355
204
|
noKeyboard: true,
|
|
356
205
|
multiple: true,
|
|
357
206
|
noClick: true,
|
|
358
207
|
onDrop: function onDrop(acceptedFiles) {
|
|
359
|
-
var newImages = [];
|
|
360
208
|
acceptedFiles.map(function (file) {
|
|
361
209
|
var reader = new FileReader();
|
|
362
210
|
reader.fileName = file.name;
|
|
363
211
|
|
|
364
212
|
reader.onload = /*#__PURE__*/function () {
|
|
365
|
-
var
|
|
366
|
-
var
|
|
367
|
-
return _regenerator.default.wrap(function
|
|
213
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(e) {
|
|
214
|
+
var fileName, fileExtension, fileDataURL, img;
|
|
215
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
368
216
|
while (1) {
|
|
369
|
-
switch (
|
|
217
|
+
switch (_context.prev = _context.next) {
|
|
370
218
|
case 0:
|
|
371
|
-
|
|
219
|
+
fileName = e.target.fileName;
|
|
220
|
+
fileExtension = fileName.split(".").pop();
|
|
221
|
+
fileDataURL = e.target.result;
|
|
372
222
|
img = new Image();
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
img.src = _context3.sent;
|
|
391
|
-
setTimeout(function () {
|
|
392
|
-
var width = img.width;
|
|
393
|
-
var height = img.height;
|
|
394
|
-
var newImg = {
|
|
395
|
-
action: "addImg",
|
|
396
|
-
img: {
|
|
397
|
-
src: img.src,
|
|
398
|
-
//e.target.result,
|
|
399
|
-
name: e.target.fileName,
|
|
400
|
-
ext: ext[ext.length - 1],
|
|
401
|
-
width: width,
|
|
402
|
-
height: height,
|
|
403
|
-
video_src: ext[ext.length - 1] == "mp4" ? e.target.result : ""
|
|
404
|
-
}
|
|
405
|
-
};
|
|
406
|
-
setImages(newImg);
|
|
407
|
-
}, 500);
|
|
408
|
-
_context3.next = 8;
|
|
409
|
-
break;
|
|
410
|
-
|
|
411
|
-
case 7:
|
|
412
|
-
setModalAlert({
|
|
413
|
-
show: true,
|
|
414
|
-
title: "Hubo un error al subir el video",
|
|
415
|
-
message: "Los videos deben durar entre 15 segundos y 10 minutos"
|
|
416
|
-
});
|
|
417
|
-
|
|
418
|
-
case 8:
|
|
419
|
-
case "end":
|
|
420
|
-
return _context3.stop();
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}, _callee3);
|
|
424
|
-
}));
|
|
425
|
-
|
|
426
|
-
return function (_x4) {
|
|
427
|
-
return _ref5.apply(this, arguments);
|
|
428
|
-
};
|
|
429
|
-
}()).catch(function (error) {
|
|
430
|
-
console.error("Error al obtener la duración del video:", error);
|
|
223
|
+
img.src = fileDataURL;
|
|
224
|
+
|
|
225
|
+
img.onload = function () {
|
|
226
|
+
var width = img.width;
|
|
227
|
+
var height = img.height;
|
|
228
|
+
var newImg = {
|
|
229
|
+
src: fileDataURL,
|
|
230
|
+
name: fileName,
|
|
231
|
+
ext: fileExtension,
|
|
232
|
+
width: width,
|
|
233
|
+
height: height,
|
|
234
|
+
isApproved: true // VALIDAR QUE SOLO SEA PARA RADIOSHACK
|
|
235
|
+
|
|
236
|
+
};
|
|
237
|
+
dispatch({
|
|
238
|
+
type: "ADD_IMAGE_VALUE",
|
|
239
|
+
payload: newImg
|
|
431
240
|
});
|
|
432
|
-
}
|
|
433
|
-
img.src = e.target.result;
|
|
434
|
-
setTimeout(function () {
|
|
435
|
-
var width = img.width;
|
|
436
|
-
var height = img.height;
|
|
437
|
-
var newImg = {
|
|
438
|
-
action: "addImg",
|
|
439
|
-
img: {
|
|
440
|
-
src: img.src,
|
|
441
|
-
//e.target.result,
|
|
442
|
-
name: e.target.fileName,
|
|
443
|
-
ext: ext[ext.length - 1],
|
|
444
|
-
width: width,
|
|
445
|
-
height: height,
|
|
446
|
-
video_src: ext[ext.length - 1] == "mp4" ? e.target.result : ""
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
setImages(newImg);
|
|
450
|
-
}, 500);
|
|
451
|
-
}
|
|
241
|
+
};
|
|
452
242
|
|
|
453
|
-
case
|
|
243
|
+
case 6:
|
|
454
244
|
case "end":
|
|
455
|
-
return
|
|
245
|
+
return _context.stop();
|
|
456
246
|
}
|
|
457
247
|
}
|
|
458
|
-
},
|
|
248
|
+
}, _callee);
|
|
459
249
|
}));
|
|
460
250
|
|
|
461
|
-
return function (
|
|
462
|
-
return
|
|
251
|
+
return function (_x) {
|
|
252
|
+
return _ref2.apply(this, arguments);
|
|
463
253
|
};
|
|
464
254
|
}();
|
|
465
255
|
|
|
@@ -473,315 +263,197 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
473
263
|
}
|
|
474
264
|
}),
|
|
475
265
|
getRootProps = _useDropzone.getRootProps,
|
|
476
|
-
getInputProps = _useDropzone.getInputProps
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
480
|
-
updatedDatasheets = _useState18[0],
|
|
481
|
-
setUpdatedDatasheets = _useState18[1];
|
|
266
|
+
getInputProps = _useDropzone.getInputProps,
|
|
267
|
+
isDragActive = _useDropzone.isDragActive,
|
|
268
|
+
open = _useDropzone.open;
|
|
482
269
|
|
|
483
|
-
var
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
var _useState21 = (0, _react.useState)(false),
|
|
489
|
-
_useState22 = (0, _slicedToArray2.default)(_useState21, 2),
|
|
490
|
-
imagesUploaded = _useState22[0],
|
|
491
|
-
setImagesUploaded = _useState22[1];
|
|
270
|
+
var _useState31 = (0, _react.useState)(false),
|
|
271
|
+
_useState32 = (0, _slicedToArray2.default)(_useState31, 2),
|
|
272
|
+
openChangeStatusModal = _useState32[0],
|
|
273
|
+
setOpenChangeStatusModal = _useState32[1];
|
|
492
274
|
|
|
493
|
-
var
|
|
494
|
-
|
|
495
|
-
dataImages = _useState24[0],
|
|
496
|
-
setDataImages = _useState24[1];
|
|
275
|
+
var thumbs = function thumbs() {
|
|
276
|
+
var _state$images_values, _state$images_values$, _state$images_values4, _state$images_values5, _state$images_values6, _state$images_values7, _state$images_values8, _state$images_values9;
|
|
497
277
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
})),
|
|
501
|
-
_useState26 = (0, _slicedToArray2.default)(_useState25, 2),
|
|
502
|
-
percentages = _useState26[0],
|
|
503
|
-
setPercentages = _useState26[1]; // const [percentages, setPercentages] = useState([{ retailers: {} }]);
|
|
278
|
+
var imageInputs = (_state$images_values = state.images_values) === null || _state$images_values === void 0 ? void 0 : (_state$images_values$ = _state$images_values.inputs) === null || _state$images_values$ === void 0 ? void 0 : _state$images_values$.map(function (e) {
|
|
279
|
+
var _state$images_values2, _state$images_values3;
|
|
504
280
|
|
|
281
|
+
return {
|
|
282
|
+
value: e === null || e === void 0 ? void 0 : e.id,
|
|
283
|
+
name: e === null || e === void 0 ? void 0 : e.name,
|
|
284
|
+
required: e === null || e === void 0 ? void 0 : e.required,
|
|
285
|
+
active: (_state$images_values2 = state.images_values) === null || _state$images_values2 === void 0 ? void 0 : (_state$images_values3 = _state$images_values2.values) === null || _state$images_values3 === void 0 ? void 0 : _state$images_values3.some(function (value) {
|
|
286
|
+
return (value === null || value === void 0 ? void 0 : value.image_id) === (e === null || e === void 0 ? void 0 : e.id);
|
|
287
|
+
})
|
|
288
|
+
};
|
|
289
|
+
});
|
|
290
|
+
var imageType = (_state$images_values4 = state.images_values) === null || _state$images_values4 === void 0 ? void 0 : (_state$images_values5 = _state$images_values4.imageType) === null || _state$images_values5 === void 0 ? void 0 : _state$images_values5.map(function (e) {
|
|
291
|
+
return {
|
|
292
|
+
value: e === null || e === void 0 ? void 0 : e.id,
|
|
293
|
+
name: e === null || e === void 0 ? void 0 : e.name
|
|
294
|
+
};
|
|
295
|
+
});
|
|
296
|
+
var imagePackagingType = (_state$images_values6 = state.images_values) === null || _state$images_values6 === void 0 ? void 0 : (_state$images_values7 = _state$images_values6.imagePackagingType) === null || _state$images_values7 === void 0 ? void 0 : _state$images_values7.map(function (e) {
|
|
297
|
+
return {
|
|
298
|
+
value: e === null || e === void 0 ? void 0 : e.id,
|
|
299
|
+
name: e === null || e === void 0 ? void 0 : e.name
|
|
300
|
+
};
|
|
301
|
+
});
|
|
302
|
+
return (_state$images_values8 = state.images_values) === null || _state$images_values8 === void 0 ? void 0 : (_state$images_values9 = _state$images_values8.values) === null || _state$images_values9 === void 0 ? void 0 : _state$images_values9.map(function (image, index) {
|
|
303
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryElement.GalleryElement, {
|
|
304
|
+
id: "gallery-element-" + index,
|
|
305
|
+
index: index + "-" + image.name,
|
|
306
|
+
image: image,
|
|
307
|
+
number: index,
|
|
308
|
+
gridLayout: imageLayout,
|
|
309
|
+
imageType: imageType,
|
|
310
|
+
imagePackagingType: imagePackagingType,
|
|
311
|
+
imageInputs: imageInputs,
|
|
312
|
+
selectedImages: state.selected_images,
|
|
313
|
+
setCheckAll: handleOnSetCheckAll,
|
|
314
|
+
changeImage: function changeImage(item) {
|
|
315
|
+
dispatch({
|
|
316
|
+
type: "UPDATE_IMAGE_VALUE",
|
|
317
|
+
payload: item
|
|
318
|
+
});
|
|
319
|
+
},
|
|
320
|
+
setSelectedImages: function setSelectedImages(item) {
|
|
321
|
+
return dispatch({
|
|
322
|
+
type: "SET_SELECTED_IMAGE",
|
|
323
|
+
payload: item
|
|
324
|
+
});
|
|
325
|
+
},
|
|
326
|
+
updateApprovedInputsImages: function updateApprovedInputsImages(item) {
|
|
327
|
+
return console.log("updateApprovedInputsImages", item);
|
|
328
|
+
}
|
|
329
|
+
}, index);
|
|
330
|
+
});
|
|
331
|
+
};
|
|
505
332
|
|
|
506
|
-
var
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
333
|
+
var initializeProduct = /*#__PURE__*/function () {
|
|
334
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
335
|
+
var product, productNormalized, users, id_article, response, parseData;
|
|
336
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
337
|
+
while (1) {
|
|
338
|
+
switch (_context2.prev = _context2.next) {
|
|
339
|
+
case 0:
|
|
340
|
+
_context2.prev = 0;
|
|
341
|
+
product = productSelected ? productSelected : JSON.parse(sessionStorage.getItem("productSelected"));
|
|
342
|
+
productNormalized = (0, _utils.normalizeProduct)(product);
|
|
343
|
+
dispatch({
|
|
344
|
+
type: "SET_PRODUCT",
|
|
345
|
+
payload: productNormalized
|
|
346
|
+
});
|
|
347
|
+
dispatch({
|
|
348
|
+
type: "SET_ACTIVE_RETAILER",
|
|
349
|
+
payload: productNormalized.categoryRetailerInOrder[0]
|
|
350
|
+
});
|
|
351
|
+
setShotThd([58, 59, 60, 61].includes(productNormalized.categoryRetailerInOrder[0].id_retailer)); // Configurar statusArray según el rol del usuario
|
|
510
352
|
|
|
511
|
-
|
|
512
|
-
_useState30 = (0, _slicedToArray2.default)(_useState29, 2),
|
|
513
|
-
activeRetailer = _useState30[0],
|
|
514
|
-
setActiveRetailer = _useState30[1];
|
|
353
|
+
setStatusArray((0, _utils.getStatusArrayByRole)(user.id_role)); // Cargar usuarios y asignaciones
|
|
515
354
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
services = _useState32[0],
|
|
519
|
-
setServices = _useState32[1];
|
|
520
|
-
|
|
521
|
-
var _useState33 = (0, _react.useState)([]),
|
|
522
|
-
_useState34 = (0, _slicedToArray2.default)(_useState33, 2),
|
|
523
|
-
servicesData = _useState34[0],
|
|
524
|
-
setServicesData = _useState34[1];
|
|
525
|
-
|
|
526
|
-
var _useState35 = (0, _react.useState)(""),
|
|
527
|
-
_useState36 = (0, _slicedToArray2.default)(_useState35, 2),
|
|
528
|
-
message = _useState36[0],
|
|
529
|
-
setMessage = _useState36[1];
|
|
530
|
-
|
|
531
|
-
var _useState37 = (0, _react.useState)(JSON.parse(sessionStorage.getItem("productSelected")) ? JSON.parse(sessionStorage.getItem("productSelected")) : productSelected),
|
|
532
|
-
_useState38 = (0, _slicedToArray2.default)(_useState37, 2),
|
|
533
|
-
product = _useState38[0],
|
|
534
|
-
setProduct = _useState38[1];
|
|
535
|
-
|
|
536
|
-
var _useState39 = (0, _react.useState)(null),
|
|
537
|
-
_useState40 = (0, _slicedToArray2.default)(_useState39, 2),
|
|
538
|
-
icon = _useState40[0],
|
|
539
|
-
setIcon = _useState40[1];
|
|
540
|
-
|
|
541
|
-
var _useState41 = (0, _react.useState)(product === null || product === void 0 ? void 0 : product.version),
|
|
542
|
-
_useState42 = (0, _slicedToArray2.default)(_useState41, 2),
|
|
543
|
-
version = _useState42[0],
|
|
544
|
-
setVersion = _useState42[1];
|
|
545
|
-
|
|
546
|
-
var _useState43 = (0, _react.useState)({}),
|
|
547
|
-
_useState44 = (0, _slicedToArray2.default)(_useState43, 2),
|
|
548
|
-
comments = _useState44[0],
|
|
549
|
-
setComments = _useState44[1];
|
|
550
|
-
|
|
551
|
-
var _useState45 = (0, _react.useState)(""),
|
|
552
|
-
_useState46 = (0, _slicedToArray2.default)(_useState45, 2),
|
|
553
|
-
comment = _useState46[0],
|
|
554
|
-
setComment = _useState46[1];
|
|
555
|
-
|
|
556
|
-
var _useState47 = (0, _react.useState)({
|
|
557
|
-
"Ficha técnica": 0,
|
|
558
|
-
Descripción: 0,
|
|
559
|
-
Imágenes: 0
|
|
560
|
-
}),
|
|
561
|
-
_useState48 = (0, _slicedToArray2.default)(_useState47, 2),
|
|
562
|
-
requiredNull = _useState48[0],
|
|
563
|
-
setRequiredNull = _useState48[1];
|
|
564
|
-
|
|
565
|
-
var _useState49 = (0, _react.useState)(false),
|
|
566
|
-
_useState50 = (0, _slicedToArray2.default)(_useState49, 2),
|
|
567
|
-
crossComment = _useState50[0],
|
|
568
|
-
setCrossComment = _useState50[1];
|
|
569
|
-
|
|
570
|
-
var _useState51 = (0, _react.useState)([]),
|
|
571
|
-
_useState52 = (0, _slicedToArray2.default)(_useState51, 2),
|
|
572
|
-
userGroups = _useState52[0],
|
|
573
|
-
setUserGroups = _useState52[1];
|
|
574
|
-
|
|
575
|
-
var _useState53 = (0, _react.useState)({}),
|
|
576
|
-
_useState54 = (0, _slicedToArray2.default)(_useState53, 2),
|
|
577
|
-
assig = _useState54[0],
|
|
578
|
-
setAssig = _useState54[1];
|
|
579
|
-
|
|
580
|
-
var _useState55 = (0, _react.useState)([]),
|
|
581
|
-
_useState56 = (0, _slicedToArray2.default)(_useState55, 2),
|
|
582
|
-
selectedImages = _useState56[0],
|
|
583
|
-
setSelectedImages = _useState56[1];
|
|
584
|
-
|
|
585
|
-
var _useState57 = (0, _react.useState)([]),
|
|
586
|
-
_useState58 = (0, _slicedToArray2.default)(_useState57, 2),
|
|
587
|
-
componentsArray = _useState58[0],
|
|
588
|
-
setComponentsArray = _useState58[1];
|
|
589
|
-
|
|
590
|
-
var _useState59 = (0, _react.useState)(false),
|
|
591
|
-
_useState60 = (0, _slicedToArray2.default)(_useState59, 2),
|
|
592
|
-
checkAll = _useState60[0],
|
|
593
|
-
setCheckAll = _useState60[1];
|
|
355
|
+
_context2.next = 9;
|
|
356
|
+
return (0, _data.fetchUsers)(token);
|
|
594
357
|
|
|
595
|
-
|
|
358
|
+
case 9:
|
|
359
|
+
users = _context2.sent;
|
|
596
360
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
361
|
+
if (users.length > 0) {
|
|
362
|
+
dispatch({
|
|
363
|
+
type: "SET_COLLABORATOR_ASSIGNATIONS",
|
|
364
|
+
payload: (0, _utils.buildCollaboratorAssignations)(productNormalized, users)
|
|
365
|
+
});
|
|
366
|
+
}
|
|
601
367
|
|
|
602
|
-
|
|
603
|
-
_useState64 = (0, _slicedToArray2.default)(_useState63, 2),
|
|
604
|
-
retailerStatus = _useState64[0],
|
|
605
|
-
setRetailerStatus = _useState64[1];
|
|
368
|
+
id_article = productNormalized.id_article;
|
|
606
369
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
370
|
+
if (!id_article) {
|
|
371
|
+
_context2.next = 15;
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
611
374
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
socketType = _useState68[0],
|
|
615
|
-
setSocketType = _useState68[1];
|
|
375
|
+
_context2.next = 15;
|
|
376
|
+
return (0, _utils.getAuditVersion)(id_article, setAuditableVersion, token);
|
|
616
377
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
378
|
+
case 15:
|
|
379
|
+
if (!(id_article && productNormalized.id_order)) {
|
|
380
|
+
_context2.next = 21;
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
621
383
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
384
|
+
_context2.next = 18;
|
|
385
|
+
return _axios.default.get(process.env.REACT_APP_READ_OBSERVATION, {
|
|
386
|
+
params: {
|
|
387
|
+
articleId: id_article,
|
|
388
|
+
orderId: productNormalized.id_order
|
|
389
|
+
},
|
|
390
|
+
headers: {
|
|
391
|
+
Authorization: sessionStorage.getItem("jwt")
|
|
392
|
+
}
|
|
393
|
+
});
|
|
626
394
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
auditableVersion = _useState72[0],
|
|
632
|
-
setAuditableVersion = _useState72[1];
|
|
633
|
-
|
|
634
|
-
var _useState73 = (0, _react.useState)([]),
|
|
635
|
-
_useState74 = (0, _slicedToArray2.default)(_useState73, 2),
|
|
636
|
-
auditServices = _useState74[0],
|
|
637
|
-
setAuditServices = _useState74[1];
|
|
638
|
-
|
|
639
|
-
var _useState75 = (0, _react.useState)([]),
|
|
640
|
-
_useState76 = (0, _slicedToArray2.default)(_useState75, 2),
|
|
641
|
-
auditDatasheets = _useState76[0],
|
|
642
|
-
setAuditDatasheets = _useState76[1];
|
|
643
|
-
|
|
644
|
-
var _useState77 = (0, _react.useState)([]),
|
|
645
|
-
_useState78 = (0, _slicedToArray2.default)(_useState77, 2),
|
|
646
|
-
auditDescriptions = _useState78[0],
|
|
647
|
-
setAuditDescriptions = _useState78[1];
|
|
648
|
-
|
|
649
|
-
var _useState79 = (0, _react.useState)([]),
|
|
650
|
-
_useState80 = (0, _slicedToArray2.default)(_useState79, 2),
|
|
651
|
-
auditImages = _useState80[0],
|
|
652
|
-
setAuditImages = _useState80[1];
|
|
653
|
-
|
|
654
|
-
var _useState81 = (0, _react.useState)(false),
|
|
655
|
-
_useState82 = (0, _slicedToArray2.default)(_useState81, 2),
|
|
656
|
-
compare = _useState82[0],
|
|
657
|
-
setCompare = _useState82[1];
|
|
658
|
-
|
|
659
|
-
var _useState83 = (0, _react.useState)(),
|
|
660
|
-
_useState84 = (0, _slicedToArray2.default)(_useState83, 2),
|
|
661
|
-
observation = _useState84[0],
|
|
662
|
-
setObservation = _useState84[1];
|
|
663
|
-
|
|
664
|
-
var _useState85 = (0, _react.useState)(false),
|
|
665
|
-
_useState86 = (0, _slicedToArray2.default)(_useState85, 2),
|
|
666
|
-
valRejAll = _useState86[0],
|
|
667
|
-
setValRejAll = _useState86[1];
|
|
668
|
-
|
|
669
|
-
var _useState87 = (0, _react.useState)({
|
|
670
|
-
show: false,
|
|
671
|
-
title: "",
|
|
672
|
-
message: "",
|
|
673
|
-
errorInputMessage: false
|
|
674
|
-
}),
|
|
675
|
-
_useState88 = (0, _slicedToArray2.default)(_useState87, 2),
|
|
676
|
-
modalAlert = _useState88[0],
|
|
677
|
-
setModalAlert = _useState88[1];
|
|
678
|
-
|
|
679
|
-
var _useState89 = (0, _react.useState)([]),
|
|
680
|
-
_useState90 = (0, _slicedToArray2.default)(_useState89, 2),
|
|
681
|
-
desc = _useState90[0],
|
|
682
|
-
setDesc = _useState90[1];
|
|
683
|
-
|
|
684
|
-
var _useState91 = (0, _react.useState)([]),
|
|
685
|
-
_useState92 = (0, _slicedToArray2.default)(_useState91, 2),
|
|
686
|
-
fich = _useState92[0],
|
|
687
|
-
setFich = _useState92[1];
|
|
688
|
-
|
|
689
|
-
var _useState93 = (0, _react.useState)([]),
|
|
690
|
-
_useState94 = (0, _slicedToArray2.default)(_useState93, 2),
|
|
691
|
-
imag = _useState94[0],
|
|
692
|
-
setImag = _useState94[1];
|
|
693
|
-
|
|
694
|
-
var _useState95 = (0, _react.useState)(false),
|
|
695
|
-
_useState96 = (0, _slicedToArray2.default)(_useState95, 2),
|
|
696
|
-
isObservationVisible = _useState96[0],
|
|
697
|
-
setObservationVisible = _useState96[1];
|
|
698
|
-
|
|
699
|
-
var toggleObservation = function toggleObservation() {
|
|
700
|
-
setObservationVisible(!isObservationVisible);
|
|
701
|
-
}; // const handleClickOutside = (event) => {
|
|
702
|
-
// if (
|
|
703
|
-
// isObservationVisible &&
|
|
704
|
-
// !event.target.closest(".Observation") &&
|
|
705
|
-
// !event.target.closest(".Container")
|
|
706
|
-
// ) {
|
|
707
|
-
// hideObservation();
|
|
708
|
-
// }
|
|
709
|
-
// };
|
|
710
|
-
// useEffect(() => {
|
|
711
|
-
// document.addEventListener("click", handleClickOutside);
|
|
712
|
-
// return () => {
|
|
713
|
-
// document.removeEventListener("click", handleClickOutside);
|
|
714
|
-
// };
|
|
715
|
-
// }, [isObservationVisible]);
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
var hideObservation = function hideObservation() {
|
|
719
|
-
setObservationVisible(false);
|
|
720
|
-
};
|
|
395
|
+
case 18:
|
|
396
|
+
response = _context2.sent;
|
|
397
|
+
parseData = JSON.parse(response.data.body).data[0];
|
|
398
|
+
setObservation(parseData.observations);
|
|
721
399
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
createComment(e, commentText, activeTab);
|
|
726
|
-
};
|
|
400
|
+
case 21:
|
|
401
|
+
_context2.next = 26;
|
|
402
|
+
break;
|
|
727
403
|
|
|
728
|
-
|
|
729
|
-
|
|
404
|
+
case 23:
|
|
405
|
+
_context2.prev = 23;
|
|
406
|
+
_context2.t0 = _context2["catch"](0);
|
|
407
|
+
console.log("Error setting product data: ", _context2.t0);
|
|
730
408
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
409
|
+
case 26:
|
|
410
|
+
case "end":
|
|
411
|
+
return _context2.stop();
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}, _callee2, null, [[0, 23]]);
|
|
415
|
+
}));
|
|
736
416
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
417
|
+
return function initializeProduct() {
|
|
418
|
+
return _ref3.apply(this, arguments);
|
|
419
|
+
};
|
|
420
|
+
}(); // Setter del producto y carga inicial (optimizado para evitar cascada)
|
|
741
421
|
|
|
742
|
-
_context5.next = 4;
|
|
743
|
-
return (0, _utils.getAuditVersion)(id_article, setAuditableVersion, token);
|
|
744
422
|
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
}, _callee5);
|
|
751
|
-
})), []);
|
|
423
|
+
(0, _react.useEffect)(function () {
|
|
424
|
+
initializeProduct();
|
|
425
|
+
}, []);
|
|
752
426
|
|
|
753
427
|
var loadAuditableData = /*#__PURE__*/function () {
|
|
754
|
-
var
|
|
755
|
-
var
|
|
428
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
429
|
+
var _state$product, _state$product2, _state$product3;
|
|
756
430
|
|
|
757
|
-
|
|
431
|
+
var auditServices;
|
|
432
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
758
433
|
while (1) {
|
|
759
|
-
switch (
|
|
434
|
+
switch (_context3.prev = _context3.next) {
|
|
760
435
|
case 0:
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
break;
|
|
764
|
-
}
|
|
436
|
+
_context3.next = 2;
|
|
437
|
+
return (0, _data.getRetailerServices)((_state$product = state.product) === null || _state$product === void 0 ? void 0 : _state$product.id_article, (_state$product2 = state.product) === null || _state$product2 === void 0 ? void 0 : _state$product2.categoryName, parseInt((_state$product3 = state.product) === null || _state$product3 === void 0 ? void 0 : _state$product3.id_category), auditableVersion.version, token);
|
|
765
438
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
(
|
|
772
|
-
|
|
773
|
-
setAuditImages(_auditServices[2]);
|
|
439
|
+
case 2:
|
|
440
|
+
auditServices = _context3.sent;
|
|
441
|
+
(0, _utils.getInputsData)(auditServices, {
|
|
442
|
+
id: state.active_retailer.id_retailer
|
|
443
|
+
}, setAuditDatasheets, setAuditDescriptions);
|
|
444
|
+
setAuditServices(auditServices);
|
|
445
|
+
setAuditImages(auditServices[2]);
|
|
774
446
|
|
|
775
|
-
case
|
|
447
|
+
case 6:
|
|
776
448
|
case "end":
|
|
777
|
-
return
|
|
449
|
+
return _context3.stop();
|
|
778
450
|
}
|
|
779
451
|
}
|
|
780
|
-
},
|
|
452
|
+
}, _callee3);
|
|
781
453
|
}));
|
|
782
454
|
|
|
783
455
|
return function loadAuditableData() {
|
|
784
|
-
return
|
|
456
|
+
return _ref4.apply(this, arguments);
|
|
785
457
|
};
|
|
786
458
|
}();
|
|
787
459
|
|
|
@@ -790,1225 +462,915 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
790
462
|
loadAuditableData();
|
|
791
463
|
}
|
|
792
464
|
}, [auditableVersion]);
|
|
793
|
-
(0, _react.useEffect)(function () {
|
|
794
|
-
checkAll && setSelectedImages(images.values);
|
|
795
|
-
}, [checkAll]);
|
|
796
465
|
|
|
797
466
|
var loadData = /*#__PURE__*/function () {
|
|
798
|
-
var
|
|
799
|
-
var
|
|
800
|
-
|
|
801
|
-
|
|
467
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
468
|
+
var enableLoading,
|
|
469
|
+
versionSelected,
|
|
470
|
+
_JSON$parse$0$relatio,
|
|
471
|
+
_JSON$parse,
|
|
472
|
+
_JSON$parse$,
|
|
473
|
+
_percentagesRes$,
|
|
474
|
+
_state$product4,
|
|
475
|
+
id_article,
|
|
476
|
+
version,
|
|
477
|
+
id_order,
|
|
478
|
+
_state$active_retaile,
|
|
479
|
+
category,
|
|
480
|
+
id_category,
|
|
481
|
+
id_retailer,
|
|
482
|
+
data,
|
|
483
|
+
headers,
|
|
484
|
+
_yield$Promise$all,
|
|
485
|
+
_yield$Promise$all2,
|
|
486
|
+
services,
|
|
487
|
+
percentagesRes,
|
|
488
|
+
servicesDataRes,
|
|
489
|
+
commentsResponse,
|
|
490
|
+
percentages,
|
|
491
|
+
commentsMap,
|
|
492
|
+
orderMap,
|
|
493
|
+
orderedValues,
|
|
494
|
+
retailerDatasheets,
|
|
495
|
+
datasheetsActiveRetailer,
|
|
496
|
+
descriptionsActiveRetailer,
|
|
497
|
+
filteredValues,
|
|
498
|
+
_args4 = arguments;
|
|
499
|
+
|
|
500
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
802
501
|
while (1) {
|
|
803
|
-
switch (
|
|
502
|
+
switch (_context4.prev = _context4.next) {
|
|
804
503
|
case 0:
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
})) !== null && _ref10 !== void 0 ? _ref10 : [];
|
|
812
|
-
uniqueIds = (0, _toConsumableArray2.default)(new Set(ids));
|
|
813
|
-
activeRetailerId = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id;
|
|
814
|
-
|
|
815
|
-
if (!activeRetailerId) {
|
|
816
|
-
firstValid = product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : (_product$article4$cat = _product$article4.categoryRetailer) === null || _product$article4$cat === void 0 ? void 0 : _product$article4$cat.find(function (item) {
|
|
817
|
-
return uniqueIds.includes(item.id_retailer || item.retailer_id);
|
|
818
|
-
});
|
|
819
|
-
|
|
820
|
-
if (firstValid) {
|
|
821
|
-
activeRetailerId = firstValid.id_retailer || firstValid.retailer_id;
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
categoryRetailer = (_ref11 = (_product$article$cate = product === null || product === void 0 ? void 0 : (_product$article5 = product.article) === null || _product$article5 === void 0 ? void 0 : (_product$article5$cat = _product$article5.categoryRetailer) === null || _product$article5$cat === void 0 ? void 0 : _product$article5$cat.filter(function (item) {
|
|
826
|
-
return uniqueIds.includes(item.id_retailer) && item.id_retailer === activeRetailerId;
|
|
827
|
-
})) !== null && _product$article$cate !== void 0 ? _product$article$cate : product === null || product === void 0 ? void 0 : (_product$article6 = product.article) === null || _product$article6 === void 0 ? void 0 : (_product$article6$cat = _product$article6.categoryRetailer) === null || _product$article6$cat === void 0 ? void 0 : _product$article6$cat.filter(function (item) {
|
|
828
|
-
return uniqueIds.includes(item.retailer_id) && item.retailer_id === activeRetailerId;
|
|
829
|
-
})) !== null && _ref11 !== void 0 ? _ref11 : [];
|
|
830
|
-
categoryName = (_categoryRetailer$ = categoryRetailer[0]) === null || _categoryRetailer$ === void 0 ? void 0 : _categoryRetailer$.category_name;
|
|
831
|
-
categoryId = (_categoryRetailer$2 = categoryRetailer[0]) === null || _categoryRetailer$2 === void 0 ? void 0 : _categoryRetailer$2.id_category;
|
|
832
|
-
category_name = categoryName !== null && categoryName !== void 0 ? categoryName : (product === null || product === void 0 ? void 0 : (_product$article7 = product.article) === null || _product$article7 === void 0 ? void 0 : _product$article7.company_name) || (product === null || product === void 0 ? void 0 : product.categoryName);
|
|
833
|
-
category_id = categoryId !== null && categoryId !== void 0 ? categoryId : parseInt((product === null || product === void 0 ? void 0 : (_product$article8 = product.article) === null || _product$article8 === void 0 ? void 0 : _product$article8.id_category) || (product === null || product === void 0 ? void 0 : product.id_category));
|
|
834
|
-
retailer_id = (_activeRetailerId = activeRetailerId) !== null && _activeRetailerId !== void 0 ? _activeRetailerId : categoryRetailer === null || categoryRetailer === void 0 ? void 0 : categoryRetailer.id_retailer;
|
|
835
|
-
_context7.next = 14;
|
|
836
|
-
return (0, _data2.getRetailerServices)((product === null || product === void 0 ? void 0 : product.id_article) || (product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article), category_name, category_id, version, token, retailer_id);
|
|
837
|
-
|
|
838
|
-
case 14:
|
|
839
|
-
_services = _context7.sent;
|
|
840
|
-
|
|
841
|
-
if (auditableVersion && retailer_id) {
|
|
842
|
-
loadAuditableData();
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
setServices(_services);
|
|
846
|
-
_context7.next = 19;
|
|
847
|
-
return getServices();
|
|
848
|
-
|
|
849
|
-
case 19:
|
|
850
|
-
generalServices = _context7.sent;
|
|
851
|
-
setImages({
|
|
852
|
-
action: "init",
|
|
853
|
-
init: _services[2]
|
|
504
|
+
enableLoading = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : true;
|
|
505
|
+
versionSelected = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : null;
|
|
506
|
+
_context4.prev = 2;
|
|
507
|
+
if (enableLoading) dispatch({
|
|
508
|
+
type: "SET_LOADING",
|
|
509
|
+
payload: true
|
|
854
510
|
});
|
|
855
|
-
|
|
511
|
+
_state$product4 = state.product, id_article = _state$product4.id_article, version = _state$product4.version, id_order = _state$product4.id_order;
|
|
512
|
+
_state$active_retaile = state.active_retailer, category = _state$active_retaile.category, id_category = _state$active_retaile.id_category, id_retailer = _state$active_retaile.id_retailer; // Payloads y headers
|
|
513
|
+
|
|
856
514
|
data = [{
|
|
857
|
-
id_article:
|
|
515
|
+
id_article: id_article,
|
|
516
|
+
version: versionSelected ? versionSelected : version,
|
|
858
517
|
relations: [{
|
|
859
|
-
id_retailer:
|
|
860
|
-
id_category:
|
|
861
|
-
}]
|
|
862
|
-
version: product.version
|
|
518
|
+
id_retailer: id_retailer,
|
|
519
|
+
id_category: id_category
|
|
520
|
+
}]
|
|
863
521
|
}];
|
|
864
522
|
headers = {
|
|
865
523
|
Authorization: token
|
|
866
524
|
};
|
|
867
|
-
|
|
525
|
+
_context4.next = 10;
|
|
526
|
+
return Promise.all([(0, _data.getRetailerServices)(id_article, category, id_category, versionSelected !== null && versionSelected !== void 0 ? versionSelected : version, token, id_retailer), (0, _data.getPercentage)({
|
|
868
527
|
data: data,
|
|
869
528
|
headers: headers
|
|
870
|
-
})
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
529
|
+
}), (0, _data.getServicesData)({
|
|
530
|
+
articleId: id_article,
|
|
531
|
+
orderId: id_order,
|
|
532
|
+
end: true,
|
|
533
|
+
token: token
|
|
534
|
+
}), // Obtener comentarios en paralelo
|
|
535
|
+
Promise.all([_axios.default.get(process.env.REACT_APP_COMMENTS_ENDPOINT, {
|
|
536
|
+
params: {
|
|
537
|
+
articleId: id_article,
|
|
538
|
+
concept: "description",
|
|
539
|
+
orderIdColab: id_order,
|
|
540
|
+
version: versionSelected !== null && versionSelected !== void 0 ? versionSelected : version
|
|
541
|
+
}
|
|
542
|
+
}), _axios.default.get(process.env.REACT_APP_COMMENTS_ENDPOINT, {
|
|
543
|
+
params: {
|
|
544
|
+
articleId: id_article,
|
|
545
|
+
concept: "datasheet",
|
|
546
|
+
orderIdColab: id_order,
|
|
547
|
+
version: versionSelected !== null && versionSelected !== void 0 ? versionSelected : version
|
|
548
|
+
}
|
|
549
|
+
}), _axios.default.get(process.env.REACT_APP_COMMENTS_ENDPOINT, {
|
|
550
|
+
params: {
|
|
551
|
+
articleId: id_article,
|
|
552
|
+
concept: "images",
|
|
553
|
+
orderIdColab: id_order,
|
|
554
|
+
version: versionSelected !== null && versionSelected !== void 0 ? versionSelected : version
|
|
555
|
+
}
|
|
556
|
+
})])]);
|
|
882
557
|
|
|
883
|
-
case
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
558
|
+
case 10:
|
|
559
|
+
_yield$Promise$all = _context4.sent;
|
|
560
|
+
_yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 4);
|
|
561
|
+
services = _yield$Promise$all2[0];
|
|
562
|
+
percentagesRes = _yield$Promise$all2[1];
|
|
563
|
+
servicesDataRes = _yield$Promise$all2[2];
|
|
564
|
+
commentsResponse = _yield$Promise$all2[3];
|
|
565
|
+
dispatch({
|
|
566
|
+
type: "SET_RETAILER_STATUS",
|
|
567
|
+
payload: servicesDataRes.map(function (service) {
|
|
568
|
+
return {
|
|
569
|
+
retailer_id: service === null || service === void 0 ? void 0 : service.id_retailer,
|
|
570
|
+
service: service === null || service === void 0 ? void 0 : service.service,
|
|
571
|
+
status: service === null || service === void 0 ? void 0 : service.status,
|
|
572
|
+
task_user_group_id: service === null || service === void 0 ? void 0 : service.task_user_group_id
|
|
573
|
+
};
|
|
574
|
+
})
|
|
575
|
+
}); // Extraer relaciones del response
|
|
901
576
|
|
|
902
|
-
|
|
903
|
-
setLoading(true);
|
|
904
|
-
loadData();
|
|
905
|
-
}, [activeRetailer]);
|
|
577
|
+
percentages = (_JSON$parse$0$relatio = (_JSON$parse = JSON.parse(percentagesRes === null || percentagesRes === void 0 ? void 0 : (_percentagesRes$ = percentagesRes[0]) === null || _percentagesRes$ === void 0 ? void 0 : _percentagesRes$.body)) === null || _JSON$parse === void 0 ? void 0 : (_JSON$parse$ = _JSON$parse[0]) === null || _JSON$parse$ === void 0 ? void 0 : _JSON$parse$.relations) !== null && _JSON$parse$0$relatio !== void 0 ? _JSON$parse$0$relatio : []; // Procesar comentarios
|
|
906
578
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
579
|
+
commentsMap = {};
|
|
580
|
+
commentsResponse.forEach(function (commentRes) {
|
|
581
|
+
var _commentRes$data;
|
|
910
582
|
|
|
911
|
-
|
|
912
|
-
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
913
|
-
while (1) {
|
|
914
|
-
switch (_context8.prev = _context8.next) {
|
|
915
|
-
case 0:
|
|
916
|
-
_context8.next = 2;
|
|
917
|
-
return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article11 = product.article) === null || _product$article11 === void 0 ? void 0 : _product$article11.id_article, "&orderId=").concat((product === null || product === void 0 ? void 0 : (_product$article12 = product.article) === null || _product$article12 === void 0 ? void 0 : _product$article12.id_order) || product.orderId, "&end=true"));
|
|
583
|
+
var commentData = JSON.parse(commentRes === null || commentRes === void 0 ? void 0 : (_commentRes$data = commentRes.data) === null || _commentRes$data === void 0 ? void 0 : _commentRes$data.body).data[0];
|
|
918
584
|
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
retailerResponse = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
|
|
924
|
-
return srv.id_retailer;
|
|
585
|
+
if (commentData) {
|
|
586
|
+
var tab = (0, _utils.translateConcept)(commentData.concept);
|
|
587
|
+
commentsMap[tab] = commentData;
|
|
588
|
+
}
|
|
925
589
|
});
|
|
926
|
-
|
|
927
|
-
|
|
590
|
+
dispatch({
|
|
591
|
+
type: "SET_COMMENTS",
|
|
592
|
+
payload: commentsMap
|
|
593
|
+
}); // Ordenamiento de imágenes
|
|
594
|
+
|
|
595
|
+
orderMap = services[2].inputsByRetailer.flat().reduce(function (acc, item) {
|
|
596
|
+
acc[item.id_image] = item.order;
|
|
597
|
+
return acc;
|
|
598
|
+
}, {});
|
|
599
|
+
orderedValues = (0, _toConsumableArray2.default)(services[2].values).sort(function (a, b) {
|
|
600
|
+
var _orderMap$a$image_id, _orderMap$b$image_id;
|
|
601
|
+
|
|
602
|
+
var orderA = (_orderMap$a$image_id = orderMap[a.image_id]) !== null && _orderMap$a$image_id !== void 0 ? _orderMap$a$image_id : Number.MAX_SAFE_INTEGER;
|
|
603
|
+
var orderB = (_orderMap$b$image_id = orderMap[b.image_id]) !== null && _orderMap$b$image_id !== void 0 ? _orderMap$b$image_id : Number.MAX_SAFE_INTEGER;
|
|
604
|
+
return orderA - orderB;
|
|
605
|
+
}); // Procesamiento de inputs del retailer activo (evita cascada con state.services)
|
|
606
|
+
|
|
607
|
+
retailerDatasheets = services[0][id_retailer];
|
|
608
|
+
datasheetsActiveRetailer = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, retailerDatasheets), {}, {
|
|
609
|
+
data: Object.values(retailerDatasheets.data)
|
|
928
610
|
});
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
611
|
+
descriptionsActiveRetailer = services[1].filter(function (item) {
|
|
612
|
+
return item.id === id_retailer;
|
|
613
|
+
});
|
|
614
|
+
filteredValues = services[2].values.filter(function (value) {
|
|
615
|
+
return services[2].inputsByRetailer.some(function (retailerInput) {
|
|
616
|
+
return retailerInput.some(function (input) {
|
|
617
|
+
return input.id_retailer === id_retailer && input.id_image === value.image_id;
|
|
618
|
+
});
|
|
619
|
+
});
|
|
620
|
+
}); // Dispatch consolidado
|
|
621
|
+
|
|
622
|
+
dispatch({
|
|
623
|
+
type: "SET_SERVICES",
|
|
624
|
+
payload: {
|
|
625
|
+
datasheets: services[0],
|
|
626
|
+
descriptions: services[1],
|
|
627
|
+
images: (0, _objectSpread5.default)((0, _objectSpread5.default)({}, services[2]), {}, {
|
|
628
|
+
values: orderedValues
|
|
629
|
+
})
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
dispatch({
|
|
633
|
+
type: "SET_PERCENTAGES",
|
|
634
|
+
payload: percentages
|
|
635
|
+
});
|
|
636
|
+
dispatch({
|
|
637
|
+
type: "SET_ACTIVE_PERCENTAGES",
|
|
638
|
+
payload: percentages.find(function (_ref6) {
|
|
639
|
+
var rId = _ref6.id_retailer;
|
|
640
|
+
return rId === id_retailer;
|
|
641
|
+
})
|
|
642
|
+
});
|
|
643
|
+
dispatch({
|
|
644
|
+
type: "SET_SERVICES_DATA",
|
|
645
|
+
payload: servicesDataRes
|
|
646
|
+
}); // Setear inputs del retailer activo directamente (evita cascada)
|
|
647
|
+
|
|
648
|
+
dispatch({
|
|
649
|
+
type: "SET_DATASHEETS_INPUTS",
|
|
650
|
+
payload: [datasheetsActiveRetailer, services[0].inputs]
|
|
651
|
+
});
|
|
652
|
+
dispatch({
|
|
653
|
+
type: "SET_DESCRIPTIONS_INPUTS",
|
|
654
|
+
payload: descriptionsActiveRetailer
|
|
655
|
+
});
|
|
656
|
+
dispatch({
|
|
657
|
+
type: "SET_IMAGES_VALUES",
|
|
658
|
+
payload: (0, _objectSpread5.default)((0, _objectSpread5.default)({}, services[2]), {}, {
|
|
659
|
+
values: filteredValues
|
|
660
|
+
})
|
|
661
|
+
}); // Calcular campos requeridos sin valor
|
|
662
|
+
|
|
663
|
+
dispatch({
|
|
664
|
+
type: "SET_MISSING_REQUIRED_FIELDS",
|
|
665
|
+
payload: (0, _utils.calculateRequiredNull)(services, servicesDataRes, id_retailer)
|
|
666
|
+
}); // Auditable
|
|
667
|
+
|
|
668
|
+
if (auditableVersion && id_retailer) {
|
|
669
|
+
loadAuditableData();
|
|
670
|
+
}
|
|
957
671
|
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
comments,
|
|
961
|
-
_args9 = arguments;
|
|
962
|
-
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
963
|
-
while (1) {
|
|
964
|
-
switch (_context9.prev = _context9.next) {
|
|
965
|
-
case 0:
|
|
966
|
-
tab = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : "Descripción";
|
|
967
|
-
_context9.next = 3;
|
|
968
|
-
return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article13 = product.article) === null || _product$article13 === void 0 ? void 0 : _product$article13.id_article, "&concept=description&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article14 = product.article) === null || _product$article14 === void 0 ? void 0 : _product$article14.id_article, "&concept=datasheet&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article15 = product.article) === null || _product$article15 === void 0 ? void 0 : _product$article15.id_article, "&concept=images&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version))]);
|
|
672
|
+
_context4.next = 42;
|
|
673
|
+
break;
|
|
969
674
|
|
|
970
|
-
case
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
675
|
+
case 38:
|
|
676
|
+
_context4.prev = 38;
|
|
677
|
+
_context4.t0 = _context4["catch"](2);
|
|
678
|
+
console.log("Error loading data: ", _context4.t0);
|
|
679
|
+
dispatch({
|
|
680
|
+
type: "SET_ERRORS",
|
|
681
|
+
payload: [_context4.t0.message]
|
|
682
|
+
});
|
|
975
683
|
|
|
976
|
-
|
|
684
|
+
case 42:
|
|
685
|
+
_context4.prev = 42;
|
|
686
|
+
dispatch({
|
|
687
|
+
type: "SET_LOADING",
|
|
688
|
+
payload: false
|
|
977
689
|
});
|
|
978
|
-
|
|
979
|
-
setComments(comments);
|
|
690
|
+
return _context4.finish(42);
|
|
980
691
|
|
|
981
|
-
case
|
|
692
|
+
case 45:
|
|
982
693
|
case "end":
|
|
983
|
-
return
|
|
694
|
+
return _context4.stop();
|
|
984
695
|
}
|
|
985
696
|
}
|
|
986
|
-
},
|
|
697
|
+
}, _callee4, null, [[2, 38, 42, 45]]);
|
|
987
698
|
}));
|
|
988
699
|
|
|
989
|
-
return function
|
|
990
|
-
return
|
|
700
|
+
return function loadData() {
|
|
701
|
+
return _ref5.apply(this, arguments);
|
|
991
702
|
};
|
|
992
703
|
}();
|
|
993
704
|
|
|
994
|
-
(0, _react.useEffect)(
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
case 0:
|
|
1000
|
-
setLoading(true); // loadData();
|
|
1001
|
-
|
|
1002
|
-
getComments();
|
|
1003
|
-
_context10.t0 = setUserGroups;
|
|
1004
|
-
_context10.next = 5;
|
|
1005
|
-
return (0, _data2.fetchUsers)(token);
|
|
1006
|
-
|
|
1007
|
-
case 5:
|
|
1008
|
-
_context10.t1 = _context10.sent;
|
|
1009
|
-
(0, _context10.t0)(_context10.t1);
|
|
1010
|
-
arr = [];
|
|
1011
|
-
_context10.t2 = user.id_role;
|
|
1012
|
-
_context10.next = _context10.t2 === 7 ? 11 : _context10.t2 === 8 ? 11 : _context10.t2 === 4 ? 13 : _context10.t2 === 5 ? 13 : _context10.t2 === 6 ? 15 : 17;
|
|
1013
|
-
break;
|
|
1014
|
-
|
|
1015
|
-
case 11:
|
|
1016
|
-
arr = ["PA", "AS", "CA", "RC", "RA", "RP", "RCA"];
|
|
1017
|
-
return _context10.abrupt("break", 19);
|
|
1018
|
-
|
|
1019
|
-
case 13:
|
|
1020
|
-
arr = ["RC", "AC", "AA", "AP", "ACA"];
|
|
1021
|
-
return _context10.abrupt("break", 19);
|
|
1022
|
-
|
|
1023
|
-
case 15:
|
|
1024
|
-
arr = ["RP", "RCA", "AC", "RA"];
|
|
1025
|
-
return _context10.abrupt("break", 19);
|
|
1026
|
-
|
|
1027
|
-
case 17:
|
|
1028
|
-
arr = [];
|
|
1029
|
-
return _context10.abrupt("break", 19);
|
|
1030
|
-
|
|
1031
|
-
case 19:
|
|
1032
|
-
setStatusArray(arr);
|
|
1033
|
-
setLoading(false);
|
|
1034
|
-
|
|
1035
|
-
case 21:
|
|
1036
|
-
case "end":
|
|
1037
|
-
return _context10.stop();
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
}, _callee10);
|
|
1041
|
-
})), [product, version]);
|
|
705
|
+
(0, _react.useEffect)(function () {
|
|
706
|
+
if (state.active_retailer) {
|
|
707
|
+
loadData();
|
|
708
|
+
}
|
|
709
|
+
}, [state.active_retailer]);
|
|
1042
710
|
|
|
1043
|
-
var
|
|
1044
|
-
|
|
711
|
+
var handleOnChangeCurrentImage = function handleOnChangeCurrentImage(index) {
|
|
712
|
+
if (typeof index === "number") {
|
|
713
|
+
dispatch({
|
|
714
|
+
type: "SET_CURRENT_IMAGE",
|
|
715
|
+
payload: index
|
|
716
|
+
});
|
|
717
|
+
} else if ((0, _typeof2.default)(index) === "object") {
|
|
718
|
+
dispatch({
|
|
719
|
+
type: "CHANGE_ATTR_VALUE",
|
|
720
|
+
payload: index
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
};
|
|
1045
724
|
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic = currentProduct.article) === null || _currentProduct$artic === void 0 ? void 0 : _currentProduct$artic.id_description_especialist
|
|
1051
|
-
}, {
|
|
1052
|
-
collaboratorType: "facilitator",
|
|
1053
|
-
id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic2 = currentProduct.article) === null || _currentProduct$artic2 === void 0 ? void 0 : _currentProduct$artic2.id_description_facilitator
|
|
1054
|
-
}],
|
|
1055
|
-
collaborators: {
|
|
1056
|
-
especialist: userGroups[0] || [],
|
|
1057
|
-
facilitator: userGroups[2] || []
|
|
1058
|
-
}
|
|
1059
|
-
},
|
|
1060
|
-
"Ficha técnica": {
|
|
1061
|
-
assignations: [{
|
|
1062
|
-
collaboratorType: "especialist",
|
|
1063
|
-
id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic3 = currentProduct.article) === null || _currentProduct$artic3 === void 0 ? void 0 : _currentProduct$artic3.id_datasheet_especialist
|
|
1064
|
-
}, {
|
|
1065
|
-
collaboratorType: "facilitator",
|
|
1066
|
-
id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic4 = currentProduct.article) === null || _currentProduct$artic4 === void 0 ? void 0 : _currentProduct$artic4.id_datasheet_facilitator
|
|
1067
|
-
}],
|
|
1068
|
-
collaborators: {
|
|
1069
|
-
especialist: userGroups[0] || [],
|
|
1070
|
-
facilitator: userGroups[2] || []
|
|
1071
|
-
}
|
|
1072
|
-
},
|
|
1073
|
-
Imágenes: {
|
|
1074
|
-
assignations: [{
|
|
1075
|
-
collaboratorType: "especialist",
|
|
1076
|
-
id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic5 = currentProduct.article) === null || _currentProduct$artic5 === void 0 ? void 0 : _currentProduct$artic5.id_images_especialist
|
|
1077
|
-
}, {
|
|
1078
|
-
collaboratorType: "facilitator",
|
|
1079
|
-
id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic6 = currentProduct.article) === null || _currentProduct$artic6 === void 0 ? void 0 : _currentProduct$artic6.id_images_facilitator
|
|
1080
|
-
}],
|
|
1081
|
-
collaborators: {
|
|
1082
|
-
especialist: userGroups[1] || [],
|
|
1083
|
-
facilitator: userGroups[3] || []
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
725
|
+
var handleOnShowModalGallery = function handleOnShowModalGallery() {
|
|
726
|
+
dispatch({
|
|
727
|
+
type: "SET_ACTIVE_TAB",
|
|
728
|
+
payload: "Imágenes"
|
|
1086
729
|
});
|
|
730
|
+
setShowModal(true);
|
|
1087
731
|
};
|
|
1088
732
|
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
var _percentages$, _percentages$$relatio, _percentages$$relatio2;
|
|
1094
|
-
|
|
1095
|
-
var retailerPercentages = percentages === null || percentages === void 0 ? void 0 : (_percentages$ = percentages[0]) === null || _percentages$ === void 0 ? void 0 : (_percentages$$relatio = _percentages$.relations) === null || _percentages$$relatio === void 0 ? void 0 : (_percentages$$relatio2 = _percentages$$relatio[0]) === null || _percentages$$relatio2 === void 0 ? void 0 : _percentages$$relatio2.percentagesGeneral;
|
|
1096
|
-
var requiredPercentage = retailerPercentages === null || retailerPercentages === void 0 ? void 0 : retailerPercentages.required;
|
|
1097
|
-
setActivePercentage(requiredPercentage); // const retailers = product?.retailersAvailable || product?.retailers;
|
|
1098
|
-
// if (
|
|
1099
|
-
// Object.keys(percentages[product.article.id_article] ?? {})?.length > 0
|
|
1100
|
-
// ) {
|
|
1101
|
-
// retailers?.forEach((retailer, index) => {
|
|
1102
|
-
// retailer["percentage"] = Number(
|
|
1103
|
-
// percentages[product.article.id_article][retailer.id]
|
|
1104
|
-
// ?.percentageRequired
|
|
1105
|
-
// );
|
|
1106
|
-
// });
|
|
1107
|
-
// }
|
|
1108
|
-
// setActivePercentage(retailers[0]?.percentage);
|
|
1109
|
-
}, [percentages]);
|
|
1110
|
-
(0, _react.useEffect)(function () {
|
|
1111
|
-
(0, _utils.getInputsData)(services, activeRetailer, setDatasheets, setDescriptions);
|
|
1112
|
-
auditableVersion && loadAuditableData();
|
|
1113
|
-
setActivePercentage(Math.round(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.percentage, 0));
|
|
1114
|
-
(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && setImages({
|
|
1115
|
-
action: "orderImages",
|
|
1116
|
-
retailerId: activeRetailer.id
|
|
733
|
+
var handleOnChangeActiveRetailer = function handleOnChangeActiveRetailer(retailer) {
|
|
734
|
+
dispatch({
|
|
735
|
+
type: "SET_ACTIVE_RETAILER",
|
|
736
|
+
payload: retailer
|
|
1117
737
|
});
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
var thumbs = function thumbs() {
|
|
1121
|
-
var _images$imageType, _images$imagePackagin, _images$imageShotType, _images$values;
|
|
738
|
+
};
|
|
1122
739
|
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
name: e === null || e === void 0 ? void 0 : e.name
|
|
1128
|
-
};
|
|
1129
|
-
});
|
|
1130
|
-
var imagePackagingType = images === null || images === void 0 ? void 0 : (_images$imagePackagin = images.imagePackagingType) === null || _images$imagePackagin === void 0 ? void 0 : _images$imagePackagin.map(function (e) {
|
|
1131
|
-
return {
|
|
1132
|
-
value: e === null || e === void 0 ? void 0 : e.id,
|
|
1133
|
-
name: e === null || e === void 0 ? void 0 : e.name
|
|
1134
|
-
};
|
|
1135
|
-
});
|
|
1136
|
-
var imageShotType = images === null || images === void 0 ? void 0 : (_images$imageShotType = images.imageShotType) === null || _images$imageShotType === void 0 ? void 0 : _images$imageShotType.map(function (e) {
|
|
1137
|
-
return {
|
|
1138
|
-
value: e === null || e === void 0 ? void 0 : e.id,
|
|
1139
|
-
name: e === null || e === void 0 ? void 0 : e.type_shot
|
|
1140
|
-
};
|
|
1141
|
-
});
|
|
1142
|
-
return images === null || images === void 0 ? void 0 : (_images$values = images.values) === null || _images$values === void 0 ? void 0 : _images$values.map(function (image, index) {
|
|
1143
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryElement.GalleryElement, {
|
|
1144
|
-
setCheckAll: setCheckAll,
|
|
1145
|
-
image: image,
|
|
1146
|
-
gridLayout: imageLayout,
|
|
1147
|
-
id: "gallery-element-" + index,
|
|
1148
|
-
index: index + "-" + image.name + "-" + compare,
|
|
1149
|
-
number: index,
|
|
1150
|
-
imageType: imageType,
|
|
1151
|
-
imagePackagingType: imagePackagingType,
|
|
1152
|
-
imageInputs: imageInputs,
|
|
1153
|
-
imageShotType: imageShotType,
|
|
1154
|
-
setSocketType: setSocketType,
|
|
1155
|
-
changeImage: setImages,
|
|
1156
|
-
selectedImages: selectedImages,
|
|
1157
|
-
setSelectedImages: setSelectedImages,
|
|
1158
|
-
auditImages: auditImages,
|
|
1159
|
-
compare: compare
|
|
1160
|
-
}, index + "-" + image.name);
|
|
740
|
+
var handleOnChangeActiveTab = function handleOnChangeActiveTab(tab) {
|
|
741
|
+
dispatch({
|
|
742
|
+
type: "SET_ACTIVE_TAB",
|
|
743
|
+
payload: tab
|
|
1161
744
|
});
|
|
1162
745
|
};
|
|
1163
746
|
|
|
1164
|
-
var
|
|
1165
|
-
|
|
1166
|
-
|
|
747
|
+
var handleOnToggleImageLayout = function handleOnToggleImageLayout() {
|
|
748
|
+
setImageLayout(!imageLayout);
|
|
749
|
+
};
|
|
1167
750
|
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
case 0:
|
|
1172
|
-
dataClean = updatedDescriptions.filter(function (f) {
|
|
1173
|
-
return f.value !== "";
|
|
1174
|
-
});
|
|
751
|
+
var handleOnToggleObservation = function handleOnToggleObservation() {
|
|
752
|
+
setObservationVisible(!isObservationVisible);
|
|
753
|
+
};
|
|
1175
754
|
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
}
|
|
755
|
+
var handleOnHideObservation = function handleOnHideObservation() {
|
|
756
|
+
setObservationVisible(false);
|
|
757
|
+
};
|
|
1180
758
|
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
articleId = product === null || product === void 0 ? void 0 : (_product$article16 = product.article) === null || _product$article16 === void 0 ? void 0 : _product$article16.id_article;
|
|
1184
|
-
dataObject = {
|
|
1185
|
-
articleId: articleId,
|
|
1186
|
-
articleData: dataClean
|
|
1187
|
-
};
|
|
1188
|
-
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1189
|
-
_context11.prev = 7;
|
|
1190
|
-
_context11.next = 10;
|
|
1191
|
-
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
1192
|
-
headers: {
|
|
1193
|
-
Authorization: token
|
|
1194
|
-
}
|
|
1195
|
-
});
|
|
759
|
+
var isAuditorAssigned = function isAuditorAssigned() {
|
|
760
|
+
var _state$product5;
|
|
1196
761
|
|
|
1197
|
-
|
|
1198
|
-
|
|
762
|
+
return ((_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : _state$product5.id_auditor) === (user === null || user === void 0 ? void 0 : user.id_user);
|
|
763
|
+
};
|
|
1199
764
|
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
break;
|
|
1203
|
-
}
|
|
765
|
+
var isUserAssignedToService = function isUserAssignedToService(tab, rol) {
|
|
766
|
+
var _state$product6;
|
|
1204
767
|
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
setProduct(productTemp);
|
|
1209
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1210
|
-
setUpdatedDescriptions([]);
|
|
1211
|
-
setMessage("Descripciones guardadas con éxito");
|
|
1212
|
-
_context11.next = 21;
|
|
1213
|
-
return loadData();
|
|
768
|
+
var concept = (0, _utils.getConceptByTab)(state.active_tab);
|
|
769
|
+
var allowedRoles = [1, 4, 5, 6, 7, 8];
|
|
770
|
+
var validUser = allowedRoles.includes(user === null || user === void 0 ? void 0 : user.id_role); // Determinar rol por defecto si no se pasa
|
|
1214
771
|
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
772
|
+
if (!rol) {
|
|
773
|
+
if (user.id_role === 4 || user.id_role === 5) {
|
|
774
|
+
rol = "facilitator";
|
|
775
|
+
} else if (user.id_role === 7 || user.id_role === 8) {
|
|
776
|
+
rol = "especialist";
|
|
777
|
+
}
|
|
778
|
+
}
|
|
1218
779
|
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
780
|
+
var isAdmin = user.id_role === 1;
|
|
781
|
+
var idUserAssigned = (_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6["id_".concat(concept, "_").concat(rol)];
|
|
782
|
+
var isAssigned = idUserAssigned === user.id_user;
|
|
783
|
+
return isAdmin || isAssigned && validUser;
|
|
784
|
+
};
|
|
1223
785
|
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
setLoading(false);
|
|
1227
|
-
return _context11.finish(26);
|
|
786
|
+
var canShowSingleEvaluationButtons = function canShowSingleEvaluationButtons(action) {
|
|
787
|
+
var _state$services_data, _state$services_data$, _state$services_data$2;
|
|
1228
788
|
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
}, _callee11, null, [[7, 23, 26, 29]]);
|
|
1235
|
-
}));
|
|
789
|
+
var concept = (0, _utils.getConceptByTab)(action || state.active_tab);
|
|
790
|
+
var retailerStatus = (_state$services_data = state.services_data) === null || _state$services_data === void 0 ? void 0 : (_state$services_data$ = _state$services_data.find(function (srv) {
|
|
791
|
+
var _state$active_retaile2;
|
|
1236
792
|
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
793
|
+
return srv.id_retailer === ((_state$active_retaile2 = state.active_retailer) === null || _state$active_retaile2 === void 0 ? void 0 : _state$active_retaile2.id_retailer) && srv.service === concept;
|
|
794
|
+
})) === null || _state$services_data$ === void 0 ? void 0 : (_state$services_data$2 = _state$services_data$.status) === null || _state$services_data$2 === void 0 ? void 0 : _state$services_data$2.replace(/.*\//, "");
|
|
795
|
+
var adminFacilitatorCanEvaluate = retailerStatus === "IE" && [1, 4, 5].includes(user.id_role);
|
|
796
|
+
var adminAuditorCanEvaluate = ["AC", "RP", "RCA", "SAC"].includes(retailerStatus) && [1, 6].includes(user.id_role);
|
|
797
|
+
return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
|
|
798
|
+
};
|
|
1241
799
|
|
|
1242
|
-
var
|
|
1243
|
-
var
|
|
1244
|
-
|
|
800
|
+
var canShowBulkEvaluationButtons = function canShowBulkEvaluationButtons() {
|
|
801
|
+
var concepts = (0, _utils.getConceptsByRole)(user.id_role);
|
|
802
|
+
var services = state.services_data.filter(function (_ref7) {
|
|
803
|
+
var service = _ref7.service;
|
|
804
|
+
return concepts.includes(service);
|
|
805
|
+
});
|
|
806
|
+
var adminFacilitatorCanEvaluate = services.every(function (srv) {
|
|
807
|
+
var _srv$status;
|
|
1245
808
|
|
|
1246
|
-
return
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
dataClean = updatedDatasheets.filter(function (f) {
|
|
1251
|
-
return f.value !== "";
|
|
1252
|
-
});
|
|
809
|
+
return (srv === null || srv === void 0 ? void 0 : (_srv$status = srv.status) === null || _srv$status === void 0 ? void 0 : _srv$status.replace(/.*\//, "")) === "IE";
|
|
810
|
+
}) && [1, 4, 5].includes(user.id_role);
|
|
811
|
+
var adminAuditorCanEvaluate = state.services_data.every(function (srv) {
|
|
812
|
+
var _srv$status2;
|
|
1253
813
|
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
814
|
+
return ["AC", "RP", "RCA"].includes(srv === null || srv === void 0 ? void 0 : (_srv$status2 = srv.status) === null || _srv$status2 === void 0 ? void 0 : _srv$status2.replace(/.*\//, ""));
|
|
815
|
+
}) && [1, 6].includes(user.id_role);
|
|
816
|
+
return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
|
|
817
|
+
};
|
|
1258
818
|
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
Authorization: token
|
|
1272
|
-
}
|
|
1273
|
-
});
|
|
819
|
+
var getStatusByCurrentServiceAndRetailer = function getStatusByCurrentServiceAndRetailer() {
|
|
820
|
+
var _statusByRetailer$fil;
|
|
821
|
+
|
|
822
|
+
var statusByRetailer = state.product.statusByRetailer;
|
|
823
|
+
if (!statusByRetailer) return "-";
|
|
824
|
+
var currentService = (0, _utils.getConceptByTab)(state.active_tab);
|
|
825
|
+
var currentRetailer = state.active_retailer.id_retailer;
|
|
826
|
+
var currentStatus = ((_statusByRetailer$fil = statusByRetailer.filter(function (item) {
|
|
827
|
+
return item.retailer_id === currentRetailer && item.service === currentService;
|
|
828
|
+
})[0]) === null || _statusByRetailer$fil === void 0 ? void 0 : _statusByRetailer$fil.status) || "-";
|
|
829
|
+
return currentStatus;
|
|
830
|
+
};
|
|
1274
831
|
|
|
1275
|
-
|
|
1276
|
-
|
|
832
|
+
var handleOnClickSaveImages = function handleOnClickSaveImages() {
|
|
833
|
+
var _state$product7, _state$product7$servi;
|
|
1277
834
|
|
|
1278
|
-
|
|
1279
|
-
|
|
835
|
+
if (((_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : (_state$product7$servi = _state$product7.services) === null || _state$product7$servi === void 0 ? void 0 : _state$product7$servi.images) === 1) {
|
|
836
|
+
saveImageAttrs(token);
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
|
|
840
|
+
var handleOnClickSave = /*#__PURE__*/function () {
|
|
841
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
842
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
843
|
+
while (1) {
|
|
844
|
+
switch (_context5.prev = _context5.next) {
|
|
845
|
+
case 0:
|
|
846
|
+
if (!state.saving) {
|
|
847
|
+
_context5.next = 2;
|
|
1280
848
|
break;
|
|
1281
849
|
}
|
|
1282
850
|
|
|
1283
|
-
|
|
1284
|
-
if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
|
|
1285
|
-
if (newStatus) productTemp.datasheet_status = newStatus;
|
|
1286
|
-
setProduct(productTemp);
|
|
1287
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1288
|
-
setUpdatedDatasheets([]);
|
|
1289
|
-
setMessage("Fichas técnicas guardadas");
|
|
1290
|
-
_context12.next = 21;
|
|
1291
|
-
return loadData();
|
|
851
|
+
return _context5.abrupt("return");
|
|
1292
852
|
|
|
1293
|
-
case
|
|
1294
|
-
|
|
853
|
+
case 2:
|
|
854
|
+
_context5.t0 = state.active_tab;
|
|
855
|
+
_context5.next = _context5.t0 === "Descripción" ? 5 : _context5.t0 === "Ficha técnica" ? 8 : _context5.t0 === "Imágenes" ? 11 : 14;
|
|
1295
856
|
break;
|
|
1296
857
|
|
|
1297
|
-
case
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
console.log(_context12.t0);
|
|
858
|
+
case 5:
|
|
859
|
+
_context5.next = 7;
|
|
860
|
+
return saveDescriptions(token);
|
|
1301
861
|
|
|
1302
|
-
case
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
862
|
+
case 7:
|
|
863
|
+
return _context5.abrupt("break", 15);
|
|
864
|
+
|
|
865
|
+
case 8:
|
|
866
|
+
_context5.next = 10;
|
|
867
|
+
return saveDatasheets(token);
|
|
868
|
+
|
|
869
|
+
case 10:
|
|
870
|
+
return _context5.abrupt("break", 15);
|
|
871
|
+
|
|
872
|
+
case 11:
|
|
873
|
+
_context5.next = 13;
|
|
874
|
+
return updateImages(token);
|
|
875
|
+
|
|
876
|
+
case 13:
|
|
877
|
+
return _context5.abrupt("break", 15);
|
|
878
|
+
|
|
879
|
+
case 14:
|
|
880
|
+
return _context5.abrupt("break", 15);
|
|
1306
881
|
|
|
1307
|
-
case
|
|
882
|
+
case 15:
|
|
883
|
+
_context5.next = 17;
|
|
884
|
+
return loadData(false);
|
|
885
|
+
|
|
886
|
+
case 17:
|
|
1308
887
|
case "end":
|
|
1309
|
-
return
|
|
888
|
+
return _context5.stop();
|
|
1310
889
|
}
|
|
1311
890
|
}
|
|
1312
|
-
},
|
|
891
|
+
}, _callee5);
|
|
1313
892
|
}));
|
|
1314
893
|
|
|
1315
|
-
return function
|
|
1316
|
-
return
|
|
894
|
+
return function handleOnClickSave() {
|
|
895
|
+
return _ref8.apply(this, arguments);
|
|
1317
896
|
};
|
|
1318
897
|
}();
|
|
1319
898
|
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
var _images$values2;
|
|
1325
|
-
|
|
1326
|
-
return {
|
|
1327
|
-
value: e === null || e === void 0 ? void 0 : e.id,
|
|
1328
|
-
name: e === null || e === void 0 ? void 0 : e.name,
|
|
1329
|
-
required: e === null || e === void 0 ? void 0 : e.required,
|
|
1330
|
-
active: images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.some(function (value) {
|
|
1331
|
-
return (value === null || value === void 0 ? void 0 : value.image_id) === (e === null || e === void 0 ? void 0 : e.id);
|
|
1332
|
-
})
|
|
1333
|
-
};
|
|
899
|
+
var handleOnSetUpdatedDescriptions = function handleOnSetUpdatedDescriptions(items) {
|
|
900
|
+
dispatch({
|
|
901
|
+
type: "SET_UPDATED_DESCRIPTIONS_INPUTS",
|
|
902
|
+
payload: items
|
|
1334
903
|
});
|
|
1335
|
-
|
|
1336
|
-
}, [images]);
|
|
1337
|
-
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
1338
|
-
var _images$values3, _images$attrForImgs, _product$article18, _data$articleData, _data$articleData2, _data$updateImages;
|
|
1339
|
-
|
|
1340
|
-
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
1341
|
-
|
|
1342
|
-
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1343
|
-
while (1) {
|
|
1344
|
-
switch (_context13.prev = _context13.next) {
|
|
1345
|
-
case 0:
|
|
1346
|
-
imagesList = images === null || images === void 0 ? void 0 : (_images$values3 = images.values) === null || _images$values3 === void 0 ? void 0 : _images$values3.slice();
|
|
1347
|
-
imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
|
|
1348
|
-
acc[image === null || image === void 0 ? void 0 : image.image_id] = ++acc[image === null || image === void 0 ? void 0 : image.image_id] || 0;
|
|
1349
|
-
return acc;
|
|
1350
|
-
}, {});
|
|
1351
|
-
duplicated = imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (image) {
|
|
1352
|
-
return imagesListTemp[image === null || image === void 0 ? void 0 : image.image_id];
|
|
1353
|
-
});
|
|
1354
|
-
attrForImgs = Object.values((_images$attrForImgs = images === null || images === void 0 ? void 0 : images.attrForImgs) !== null && _images$attrForImgs !== void 0 ? _images$attrForImgs : {}).pop();
|
|
1355
|
-
data = {
|
|
1356
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$article18 = product.article) === null || _product$article18 === void 0 ? void 0 : _product$article18.id_article,
|
|
1357
|
-
attrReqImgs: attrForImgs === null || attrForImgs === void 0 ? void 0 : attrForImgs.map(function (e) {
|
|
1358
|
-
var _e$value;
|
|
1359
|
-
|
|
1360
|
-
return {
|
|
1361
|
-
attrId: e.id,
|
|
1362
|
-
value: (_e$value = e.value) !== null && _e$value !== void 0 ? _e$value : "-"
|
|
1363
|
-
};
|
|
1364
|
-
}),
|
|
1365
|
-
articleData: imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (e) {
|
|
1366
|
-
return !e.id;
|
|
1367
|
-
}),
|
|
1368
|
-
updateImages: imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (e) {
|
|
1369
|
-
return e.id;
|
|
1370
|
-
})
|
|
1371
|
-
};
|
|
1372
|
-
if (product !== null && product !== void 0 && product.orderId) data["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1373
|
-
valid = (data === null || data === void 0 ? void 0 : (_data$articleData = data.articleData) === null || _data$articleData === void 0 ? void 0 : _data$articleData.length) === 0 ? true : data === null || data === void 0 ? void 0 : (_data$articleData2 = data.articleData) === null || _data$articleData2 === void 0 ? void 0 : _data$articleData2.every(function (e, i) {
|
|
1374
|
-
// if (e?.image_id && e?.packing_type && e?.image_type) {
|
|
1375
|
-
if (e !== null && e !== void 0 && e.image_id) {
|
|
1376
|
-
return true;
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
|
-
return false;
|
|
1380
|
-
});
|
|
1381
|
-
|
|
1382
|
-
if (valid && (data === null || data === void 0 ? void 0 : (_data$updateImages = data.updateImages) === null || _data$updateImages === void 0 ? void 0 : _data$updateImages.length) > 0 && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0) {
|
|
1383
|
-
valid = data === null || data === void 0 ? void 0 : (_data$updateImages2 = data.updateImages) === null || _data$updateImages2 === void 0 ? void 0 : _data$updateImages2.every(function (e, i) {
|
|
1384
|
-
// if (e?.image_id && e?.packing_type && e?.image_type) {
|
|
1385
|
-
if (e !== null && e !== void 0 && e.image_id) {
|
|
1386
|
-
return true;
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
return false;
|
|
1390
|
-
});
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
1394
|
-
_context13.next = 33;
|
|
1395
|
-
break;
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
|
-
setLoading(true);
|
|
1399
|
-
_context13.prev = 10;
|
|
1400
|
-
data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
|
|
1401
|
-
e.uuid = (0, _uuid.v4)();
|
|
1402
|
-
});
|
|
1403
|
-
setDataImages(data);
|
|
1404
|
-
|
|
1405
|
-
if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
|
|
1406
|
-
_context13.next = 22;
|
|
1407
|
-
break;
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
setImagesUploaded(false);
|
|
1411
|
-
promiseArray = [];
|
|
1412
|
-
data === null || data === void 0 ? void 0 : (_data$articleData5 = data.articleData) === null || _data$articleData5 === void 0 ? void 0 : _data$articleData5.forEach(function (e) {
|
|
1413
|
-
var file;
|
|
904
|
+
};
|
|
1414
905
|
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
906
|
+
var handleOnSetUpdatedDatasheets = function handleOnSetUpdatedDatasheets(items) {
|
|
907
|
+
dispatch({
|
|
908
|
+
type: "SET_UPDATED_DATASHEETS_INPUTS",
|
|
909
|
+
payload: items
|
|
910
|
+
});
|
|
911
|
+
};
|
|
1421
912
|
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
return Promise.all(promiseArray);
|
|
1432
|
-
|
|
1433
|
-
case 19:
|
|
1434
|
-
setImagesUploaded(true);
|
|
1435
|
-
_context13.next = 23;
|
|
1436
|
-
break;
|
|
1437
|
-
|
|
1438
|
-
case 22:
|
|
1439
|
-
setImagesUploaded(true);
|
|
1440
|
-
|
|
1441
|
-
case 23:
|
|
1442
|
-
_context13.next = 28;
|
|
1443
|
-
break;
|
|
1444
|
-
|
|
1445
|
-
case 25:
|
|
1446
|
-
_context13.prev = 25;
|
|
1447
|
-
_context13.t0 = _context13["catch"](10);
|
|
1448
|
-
console.log(_context13.t0); // setMainLoading(false);
|
|
1449
|
-
|
|
1450
|
-
case 28:
|
|
1451
|
-
_context13.prev = 28;
|
|
1452
|
-
setLoading(false);
|
|
1453
|
-
return _context13.finish(28);
|
|
1454
|
-
|
|
1455
|
-
case 31:
|
|
1456
|
-
_context13.next = 34;
|
|
1457
|
-
break;
|
|
1458
|
-
|
|
1459
|
-
case 33:
|
|
1460
|
-
// setMainLoading(false);
|
|
1461
|
-
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
|
-
|
|
1463
|
-
case 34:
|
|
1464
|
-
case "end":
|
|
1465
|
-
return _context13.stop();
|
|
913
|
+
var handleOnAskToDeleteImages = function handleOnAskToDeleteImages() {
|
|
914
|
+
if (state.selected_images.length === 0) {
|
|
915
|
+
dispatch({
|
|
916
|
+
type: "SET_MODAL",
|
|
917
|
+
payload: {
|
|
918
|
+
show: true,
|
|
919
|
+
title: "Eliminar imágenes",
|
|
920
|
+
message: "No has seleccionado ninguna imagen para eliminar.",
|
|
921
|
+
image: _genericModalWarning.default
|
|
1466
922
|
}
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
1471
|
-
var res, _product$article19, productTemp, _JSON$parse4, newStatus, newArticleStatus;
|
|
1472
|
-
|
|
1473
|
-
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
1474
|
-
while (1) {
|
|
1475
|
-
switch (_context14.prev = _context14.next) {
|
|
1476
|
-
case 0:
|
|
1477
|
-
if (!imagesUploaded) {
|
|
1478
|
-
_context14.next = 14;
|
|
1479
|
-
break;
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
dataImages.articleData = dataImages === null || dataImages === void 0 ? void 0 : dataImages.articleData.map(function (e) {
|
|
1483
|
-
delete e.src;
|
|
1484
|
-
e.imageID = e.image_id; // e.packingType = e.packing_type;
|
|
1485
|
-
// e.imageType = e.image_type;
|
|
923
|
+
});
|
|
924
|
+
return;
|
|
925
|
+
}
|
|
1486
926
|
|
|
1487
|
-
|
|
1488
|
-
|
|
927
|
+
dispatch({
|
|
928
|
+
type: "SET_MODAL",
|
|
929
|
+
payload: {
|
|
930
|
+
show: true,
|
|
931
|
+
title: "Eliminar imágenes",
|
|
932
|
+
message: "¿Estás seguro de que deseas eliminar las imágenes seleccionadas?",
|
|
933
|
+
image: _genericModalWarning.default,
|
|
934
|
+
buttons: [{
|
|
935
|
+
text: "Cancelar",
|
|
936
|
+
buttonType: "general-white-button",
|
|
937
|
+
action: function action() {
|
|
938
|
+
return dispatch({
|
|
939
|
+
type: "SET_MODAL",
|
|
940
|
+
payload: {
|
|
941
|
+
show: false
|
|
942
|
+
}
|
|
1489
943
|
});
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
944
|
+
}
|
|
945
|
+
}, {
|
|
946
|
+
text: "Eliminar",
|
|
947
|
+
buttonType: "general-button-default",
|
|
948
|
+
action: function action() {
|
|
949
|
+
dispatch({
|
|
950
|
+
type: "SET_MODAL",
|
|
951
|
+
payload: {
|
|
952
|
+
show: false
|
|
1495
953
|
}
|
|
1496
954
|
});
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
if (res.data.statusCode === 200) {
|
|
1502
|
-
productTemp = product;
|
|
1503
|
-
_JSON$parse4 = JSON.parse(res.data.body), newStatus = _JSON$parse4.newStatus, newArticleStatus = _JSON$parse4.newArticleStatus;
|
|
1504
|
-
if (newArticleStatus) productTemp.status = newArticleStatus[product === null || product === void 0 ? void 0 : (_product$article19 = product.article) === null || _product$article19 === void 0 ? void 0 : _product$article19.id_article];
|
|
1505
|
-
if (newStatus) productTemp.images_status = newStatus;
|
|
1506
|
-
setProduct(productTemp);
|
|
1507
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1508
|
-
setImages({});
|
|
1509
|
-
setMessage("Imágenes guardadas con éxito");
|
|
1510
|
-
sessionStorage.removeItem("imagesList");
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
_context14.next = 9;
|
|
1514
|
-
return loadData();
|
|
1515
|
-
|
|
1516
|
-
case 9:
|
|
1517
|
-
_context14.next = 14;
|
|
1518
|
-
break;
|
|
1519
|
-
|
|
1520
|
-
case 11:
|
|
1521
|
-
_context14.prev = 11;
|
|
1522
|
-
_context14.t0 = _context14["catch"](2);
|
|
1523
|
-
console.log(_context14.t0);
|
|
1524
|
-
|
|
1525
|
-
case 14:
|
|
1526
|
-
case "end":
|
|
1527
|
-
return _context14.stop();
|
|
1528
|
-
}
|
|
955
|
+
deleteImages(token);
|
|
956
|
+
}
|
|
957
|
+
}]
|
|
1529
958
|
}
|
|
1530
|
-
}, _callee14, null, [[2, 11]]);
|
|
1531
|
-
})), [dataImages, imagesUploaded]);
|
|
1532
|
-
|
|
1533
|
-
var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {
|
|
1534
|
-
var _srv$find, _srv$find$status, _product$;
|
|
1535
|
-
|
|
1536
|
-
var srv = servicesData.filter(function (serv) {
|
|
1537
|
-
return serv.service === getConcept(tab);
|
|
1538
959
|
});
|
|
1539
|
-
var srvActive = (_srv$find = srv.find(function (serv) {
|
|
1540
|
-
return serv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
|
|
1541
|
-
})) === null || _srv$find === void 0 ? void 0 : (_srv$find$status = _srv$find.status) === null || _srv$find$status === void 0 ? void 0 : _srv$find$status.replace(/.*\//, "");
|
|
1542
|
-
var currStatus = (_product$ = product["".concat(getConcept(tab), "_status")]) === null || _product$ === void 0 ? void 0 : _product$.replace(/.*\//, "");
|
|
1543
|
-
var unvalidated = ["IE", "CA"].includes(currStatus);
|
|
1544
|
-
var auditorUnvalidated = !["RA", "AA", "ACA", "AP"].includes(currStatus);
|
|
1545
|
-
|
|
1546
|
-
switch (userId) {
|
|
1547
|
-
case 7:
|
|
1548
|
-
case 8:
|
|
1549
|
-
return statusArray.includes(srvActive) && statusArray.includes(product === null || product === void 0 ? void 0 : product.status) || srv.filter(function (serv) {
|
|
1550
|
-
var _serv$status;
|
|
1551
|
-
|
|
1552
|
-
return statusArray.includes((_serv$status = serv.status) === null || _serv$status === void 0 ? void 0 : _serv$status.replace(/.*\//, ""));
|
|
1553
|
-
}).length === srv.length;
|
|
1554
|
-
|
|
1555
|
-
case 4:
|
|
1556
|
-
case 5:
|
|
1557
|
-
return unvalidated && ["CA", "IE"].includes(product.status) && // "RC", "AC", "AA", "AP", "ACA"
|
|
1558
|
-
srv.filter(function (serv) {
|
|
1559
|
-
return statusArray.includes(serv.status);
|
|
1560
|
-
}).length === srv.length;
|
|
1561
|
-
|
|
1562
|
-
case 6:
|
|
1563
|
-
return statusArray.includes(product.status) && // RP, RCA, AC, RA true
|
|
1564
|
-
srv.every(function (serv) {
|
|
1565
|
-
return ["RA", "AA", "AP", "ACA"].includes(serv.status);
|
|
1566
|
-
}) && auditorUnvalidated;
|
|
1567
|
-
|
|
1568
|
-
default:
|
|
1569
|
-
break;
|
|
1570
|
-
}
|
|
1571
|
-
};
|
|
1572
|
-
|
|
1573
|
-
var getConcept = function getConcept(tab) {
|
|
1574
|
-
switch (tab) {
|
|
1575
|
-
case "Descripción":
|
|
1576
|
-
return "description";
|
|
1577
|
-
|
|
1578
|
-
case "Ficha técnica":
|
|
1579
|
-
return "datasheet";
|
|
1580
|
-
|
|
1581
|
-
case "Imágenes":
|
|
1582
|
-
return "images";
|
|
1583
|
-
}
|
|
1584
|
-
};
|
|
1585
|
-
|
|
1586
|
-
var approveRejectButtons = function approveRejectButtons(action) {
|
|
1587
|
-
var _servicesData$find, _servicesData$find$st;
|
|
1588
|
-
|
|
1589
|
-
var concept = getConcept(action || activeTab);
|
|
1590
|
-
var retailerStatus = (_servicesData$find = servicesData.find(function (srv) {
|
|
1591
|
-
return srv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && srv.service === concept;
|
|
1592
|
-
})) === null || _servicesData$find === void 0 ? void 0 : (_servicesData$find$st = _servicesData$find.status) === null || _servicesData$find$st === void 0 ? void 0 : _servicesData$find$st.replace(/.*\//, ""); //sessionStorage product
|
|
1593
|
-
|
|
1594
|
-
var adminFacilitatorCanEvaluate = retailerStatus === "IE" && [1, 4, 5].includes(user.id_role);
|
|
1595
|
-
var adminAuditorCanEvaluate = ["AC", "RP", "RCA", "SAC"].includes(retailerStatus) && [1, 6].includes(user.id_role);
|
|
1596
|
-
return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
|
|
1597
960
|
};
|
|
1598
961
|
|
|
1599
|
-
var
|
|
1600
|
-
var
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
case 5:
|
|
1608
|
-
concepts = ["images"];
|
|
1609
|
-
break;
|
|
1610
|
-
|
|
1611
|
-
default:
|
|
1612
|
-
concepts = ["description", "datasheet", "images"];
|
|
1613
|
-
break;
|
|
1614
|
-
}
|
|
1615
|
-
|
|
1616
|
-
var services = servicesData.filter(function (_ref19) {
|
|
1617
|
-
var service = _ref19.service;
|
|
1618
|
-
return concepts.includes(service);
|
|
1619
|
-
});
|
|
1620
|
-
var adminFacilitatorCanEvaluate = services.every(function (srv) {
|
|
1621
|
-
var _srv$status;
|
|
962
|
+
var handleOnApproveSingleService = /*#__PURE__*/function () {
|
|
963
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
964
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
965
|
+
while (1) {
|
|
966
|
+
switch (_context6.prev = _context6.next) {
|
|
967
|
+
case 0:
|
|
968
|
+
_context6.next = 2;
|
|
969
|
+
return sendSingleEvaluation("A");
|
|
1622
970
|
|
|
1623
|
-
|
|
1624
|
-
|
|
971
|
+
case 2:
|
|
972
|
+
case "end":
|
|
973
|
+
return _context6.stop();
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
}, _callee6);
|
|
977
|
+
}));
|
|
1625
978
|
|
|
1626
|
-
|
|
1627
|
-
|
|
979
|
+
return function handleOnApproveSingleService() {
|
|
980
|
+
return _ref9.apply(this, arguments);
|
|
981
|
+
};
|
|
982
|
+
}();
|
|
1628
983
|
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
|
|
984
|
+
var handleOnRejectSingleService = function handleOnRejectSingleService() {
|
|
985
|
+
setShowRejectModal(true);
|
|
1632
986
|
};
|
|
1633
987
|
|
|
1634
|
-
var
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
setIcon(_attributesSent.default);
|
|
1638
|
-
break;
|
|
1639
|
-
|
|
1640
|
-
case "Descripción":
|
|
1641
|
-
setIcon(_descriptionSent.default);
|
|
1642
|
-
break;
|
|
1643
|
-
|
|
1644
|
-
case "Imágenes":
|
|
1645
|
-
setIcon(_uploadingImages.default);
|
|
1646
|
-
break;
|
|
1647
|
-
|
|
1648
|
-
default:
|
|
1649
|
-
break;
|
|
1650
|
-
}
|
|
1651
|
-
};
|
|
988
|
+
var sendSingleEvaluation = /*#__PURE__*/function () {
|
|
989
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(result) {
|
|
990
|
+
var _state$product$id_ord, _state$active_retaile3;
|
|
1652
991
|
|
|
1653
|
-
|
|
1654
|
-
var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
|
|
1655
|
-
var concept, productTemp, evalStatus, articleId, orderId, data, res, _message, specialistDone, _JSON$parse5, newStatus, newOrderStatus, newArticleStatus, messageToChat, _data;
|
|
992
|
+
var concept, articleId, orderId, sectionStatusKey, evalStatus, retailerId, data, res, message, icon, activeTab, newStatuses, serviceStatus, updatedStatusByRetailer, updatedProduct, specialistDone, _objectSpread2, _state$services_data2, _JSON$parse2, newStatus, newOrderStatus, newArticleStatus, _updatedProduct, updatedServicesData, sessionProduct, _objectSpread3, productInSession, updatedProductInSession;
|
|
1656
993
|
|
|
1657
|
-
return _regenerator.default.wrap(function
|
|
994
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1658
995
|
while (1) {
|
|
1659
|
-
switch (
|
|
996
|
+
switch (_context7.prev = _context7.next) {
|
|
1660
997
|
case 0:
|
|
1661
|
-
if (!
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
998
|
+
if (!state.saving) {
|
|
999
|
+
_context7.next = 2;
|
|
1000
|
+
break;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
return _context7.abrupt("return");
|
|
1004
|
+
|
|
1005
|
+
case 2:
|
|
1006
|
+
dispatch({
|
|
1007
|
+
type: "SET_SAVING",
|
|
1008
|
+
payload: true
|
|
1009
|
+
});
|
|
1010
|
+
concept = (0, _utils.getConceptByTab)(state.active_tab);
|
|
1011
|
+
articleId = state.product.id_article;
|
|
1012
|
+
orderId = (_state$product$id_ord = state.product.id_order) !== null && _state$product$id_ord !== void 0 ? _state$product$id_ord : state.product.orderId;
|
|
1013
|
+
sectionStatusKey = "".concat(concept, "_status");
|
|
1014
|
+
evalStatus = state.product[sectionStatusKey];
|
|
1015
|
+
retailerId = (_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer;
|
|
1668
1016
|
data = {
|
|
1669
1017
|
articleId: articleId,
|
|
1670
1018
|
orderId: orderId,
|
|
1671
1019
|
concept: concept,
|
|
1672
1020
|
evalStatus: evalStatus,
|
|
1673
|
-
retailerId:
|
|
1021
|
+
retailerId: retailerId
|
|
1674
1022
|
};
|
|
1023
|
+
activeTab = state.active_tab;
|
|
1024
|
+
_context7.prev = 11;
|
|
1675
1025
|
|
|
1676
1026
|
if (!result) {
|
|
1677
|
-
|
|
1027
|
+
_context7.next = 26;
|
|
1678
1028
|
break;
|
|
1679
1029
|
}
|
|
1680
1030
|
|
|
1681
1031
|
data.result = result;
|
|
1682
|
-
|
|
1032
|
+
data.retailerId = retailerId;
|
|
1033
|
+
_context7.next = 17;
|
|
1683
1034
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1684
1035
|
headers: {
|
|
1685
1036
|
Authorization: token
|
|
1686
1037
|
}
|
|
1687
1038
|
});
|
|
1688
1039
|
|
|
1689
|
-
case
|
|
1690
|
-
res =
|
|
1691
|
-
|
|
1692
|
-
|
|
1040
|
+
case 17:
|
|
1041
|
+
res = _context7.sent;
|
|
1042
|
+
newStatuses = JSON.parse(res.data.body);
|
|
1043
|
+
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")]; // Actualizar el producto con los nuevos estados
|
|
1044
|
+
|
|
1045
|
+
updatedStatusByRetailer = state.product.statusByRetailer.map(function (item) {
|
|
1046
|
+
return item.retailer_id === retailerId && item.service === concept ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
|
|
1047
|
+
status: serviceStatus
|
|
1048
|
+
}) : item;
|
|
1049
|
+
});
|
|
1050
|
+
updatedProduct = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1051
|
+
statusByRetailer: updatedStatusByRetailer
|
|
1052
|
+
});
|
|
1053
|
+
dispatch({
|
|
1054
|
+
type: "SET_PRODUCT",
|
|
1055
|
+
payload: updatedProduct
|
|
1056
|
+
}); // Mostrar modal de éxito
|
|
1057
|
+
|
|
1058
|
+
dispatch({
|
|
1059
|
+
type: "SET_MODAL",
|
|
1060
|
+
payload: {
|
|
1061
|
+
show: true,
|
|
1062
|
+
title: "",
|
|
1063
|
+
message: result === "A" ? "Aprobado con éxito" : "Rechazado con éxito",
|
|
1064
|
+
image: _genericModalCheck.default
|
|
1065
|
+
}
|
|
1066
|
+
});
|
|
1067
|
+
_context7.next = 31;
|
|
1693
1068
|
break;
|
|
1694
1069
|
|
|
1695
|
-
case
|
|
1070
|
+
case 26:
|
|
1071
|
+
//Caso del botón "Enviar evaluación"
|
|
1072
|
+
//Se construye el mensaje y se actualiza el estatus
|
|
1696
1073
|
specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
|
|
1697
1074
|
|
|
1698
1075
|
if (specialistDone) {
|
|
1699
|
-
|
|
1700
|
-
|
|
1076
|
+
message = "".concat(activeTab, " enviada a facilitador");
|
|
1077
|
+
icon = activeTab === "Descripción" ? _descriptionSent.default : activeTab === "Ficha técnica" ? _attributesSent.default : _uploadingImages.default;
|
|
1701
1078
|
} else if (["IE", "AC", "RP", "RCA"].includes(evalStatus)) {
|
|
1702
|
-
|
|
1703
|
-
|
|
1079
|
+
message = "Evaluación enviada";
|
|
1080
|
+
icon = _genericModalCheck.default;
|
|
1704
1081
|
}
|
|
1705
1082
|
|
|
1706
|
-
|
|
1083
|
+
_context7.next = 30;
|
|
1707
1084
|
return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1708
1085
|
headers: {
|
|
1709
1086
|
Authorization: token
|
|
1710
1087
|
}
|
|
1711
1088
|
});
|
|
1712
1089
|
|
|
1713
|
-
case
|
|
1714
|
-
res =
|
|
1715
|
-
|
|
1716
|
-
case 21:
|
|
1717
|
-
if (!(res.data.statusCode === 200)) {
|
|
1718
|
-
_context15.next = 34;
|
|
1719
|
-
break;
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
_JSON$parse5 = JSON.parse(res.data.body), newStatus = _JSON$parse5.newStatus, newOrderStatus = _JSON$parse5.newOrderStatus, newArticleStatus = _JSON$parse5.newArticleStatus;
|
|
1723
|
-
messageToChat = (0, _utils.createMessage)(product.retailers, activeRetailer.id, evalStatus, newStatus, activeTab);
|
|
1724
|
-
_data = {
|
|
1725
|
-
paramsBody: {
|
|
1726
|
-
id: product.article.id_article,
|
|
1727
|
-
version: version,
|
|
1728
|
-
items: [{
|
|
1729
|
-
type: "status",
|
|
1730
|
-
value: messageToChat
|
|
1731
|
-
}],
|
|
1732
|
-
retailerId: activeRetailer.id,
|
|
1733
|
-
status: product.status
|
|
1734
|
-
},
|
|
1735
|
-
paramsHeader: {
|
|
1736
|
-
Authorization: token
|
|
1737
|
-
}
|
|
1738
|
-
};
|
|
1739
|
-
_context15.next = 27;
|
|
1740
|
-
return (0, _utils.sendMessage)(_data);
|
|
1741
|
-
|
|
1742
|
-
case 27:
|
|
1743
|
-
if (newOrderStatus) productTemp.status = newArticleStatus[articleId];
|
|
1744
|
-
productTemp["".concat(concept, "_status")] = newStatus;
|
|
1745
|
-
_context15.next = 31;
|
|
1746
|
-
return loadData();
|
|
1090
|
+
case 30:
|
|
1091
|
+
res = _context7.sent;
|
|
1747
1092
|
|
|
1748
1093
|
case 31:
|
|
1749
|
-
if (
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1094
|
+
if (res.data.statusCode === 200) {
|
|
1095
|
+
_JSON$parse2 = JSON.parse(res.data.body), newStatus = _JSON$parse2.newStatus, newOrderStatus = _JSON$parse2.newOrderStatus, newArticleStatus = _JSON$parse2.newArticleStatus; // const retailers = state.product.categoryRetailer.map((r) => ({
|
|
1096
|
+
// id: r.id_retailer,
|
|
1097
|
+
// name: r.retailerName,
|
|
1098
|
+
// }));
|
|
1099
|
+
// const messageToChat = createMessage(
|
|
1100
|
+
// retailers,
|
|
1101
|
+
// retailerId,
|
|
1102
|
+
// evalStatus,
|
|
1103
|
+
// newStatus,
|
|
1104
|
+
// activeTab,
|
|
1105
|
+
// );
|
|
1106
|
+
// const messageData = {
|
|
1107
|
+
// paramsBody: {
|
|
1108
|
+
// id: articleId,
|
|
1109
|
+
// version: state.product.version,
|
|
1110
|
+
// items: [{ type: "status", value: messageToChat }],
|
|
1111
|
+
// retailerId: retailerId,
|
|
1112
|
+
// status: state.product.status,
|
|
1113
|
+
// },
|
|
1114
|
+
// paramsHeader: { Authorization: token },
|
|
1115
|
+
// };
|
|
1116
|
+
// await sendMessage(messageData);
|
|
1117
|
+
|
|
1118
|
+
_updatedProduct = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, (_objectSpread2 = {}, (0, _defineProperty2.default)(_objectSpread2, "".concat(concept, "_status"), newStatus), (0, _defineProperty2.default)(_objectSpread2, "statusByRetailer", state.product.statusByRetailer.map(function (item) {
|
|
1119
|
+
if (item.retailer_id === retailerId && item.service === concept) {
|
|
1120
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
|
|
1121
|
+
status: newStatus
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1775
1124
|
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
var allowedRoles = [1, 4, 5, 6, 7, 8];
|
|
1779
|
-
var validUser = allowedRoles.includes(user === null || user === void 0 ? void 0 : user.id_role);
|
|
1125
|
+
return item;
|
|
1126
|
+
})), _objectSpread2)); //Actualizamos el services_data en el servicio específico del retailer actual
|
|
1780
1127
|
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1128
|
+
updatedServicesData = (_state$services_data2 = state.services_data) === null || _state$services_data2 === void 0 ? void 0 : _state$services_data2.map(function (service) {
|
|
1129
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, service), {}, {
|
|
1130
|
+
status: (service === null || service === void 0 ? void 0 : service.id_retailer) === retailerId && (service === null || service === void 0 ? void 0 : service.service) === concept ? newStatus : service === null || service === void 0 ? void 0 : service.status
|
|
1131
|
+
});
|
|
1132
|
+
});
|
|
1133
|
+
sessionProduct = sessionStorage.getItem("productSelected");
|
|
1134
|
+
|
|
1135
|
+
if (sessionProduct) {
|
|
1136
|
+
productInSession = JSON.parse(sessionProduct);
|
|
1137
|
+
updatedProductInSession = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, productInSession), {}, (_objectSpread3 = {}, (0, _defineProperty2.default)(_objectSpread3, "".concat(concept, "_status"), newStatus), (0, _defineProperty2.default)(_objectSpread3, "statusByRetailer", state.product.statusByRetailer.map(function (item) {
|
|
1138
|
+
if (item.retailer_id === retailerId && item.service === concept) {
|
|
1139
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
|
|
1140
|
+
status: newStatus
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1794
1143
|
|
|
1795
|
-
|
|
1796
|
-
|
|
1144
|
+
return item;
|
|
1145
|
+
})), _objectSpread3));
|
|
1146
|
+
sessionStorage.setItem("productSelected", JSON.stringify(updatedProductInSession));
|
|
1147
|
+
}
|
|
1797
1148
|
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1149
|
+
if (message) {
|
|
1150
|
+
dispatch({
|
|
1151
|
+
type: "SET_MODAL",
|
|
1152
|
+
payload: {
|
|
1153
|
+
show: true,
|
|
1154
|
+
title: "",
|
|
1155
|
+
message: message,
|
|
1156
|
+
image: _genericModalCheck.default
|
|
1157
|
+
}
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1801
1160
|
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1161
|
+
dispatch({
|
|
1162
|
+
type: "SET_PRODUCT",
|
|
1163
|
+
payload: _updatedProduct
|
|
1164
|
+
});
|
|
1165
|
+
dispatch({
|
|
1166
|
+
type: "SET_SERVICES_DATA",
|
|
1167
|
+
payload: updatedServicesData
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1805
1170
|
|
|
1806
|
-
|
|
1807
|
-
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
1808
|
-
while (1) {
|
|
1809
|
-
switch (_context16.prev = _context16.next) {
|
|
1810
|
-
case 0:
|
|
1811
|
-
concept = "";
|
|
1812
|
-
_context16.t0 = activeTab;
|
|
1813
|
-
_context16.next = _context16.t0 === "Ficha técnica" ? 4 : _context16.t0 === "Imágenes" ? 6 : 8;
|
|
1171
|
+
_context7.next = 38;
|
|
1814
1172
|
break;
|
|
1815
1173
|
|
|
1816
|
-
case
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
case 10:
|
|
1829
|
-
data = {
|
|
1830
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$article20 = product.article) === null || _product$article20 === void 0 ? void 0 : _product$article20.id_article,
|
|
1831
|
-
orderId: product === null || product === void 0 ? void 0 : product.orderId,
|
|
1832
|
-
message: body === null || body === void 0 ? void 0 : body.replace(/<.*?\/?>/gm, ""),
|
|
1833
|
-
concept: concept,
|
|
1834
|
-
version: version
|
|
1835
|
-
};
|
|
1836
|
-
_context16.next = 13;
|
|
1837
|
-
return _axios.default.post("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1838
|
-
headers: {
|
|
1839
|
-
Authorization: token
|
|
1174
|
+
case 34:
|
|
1175
|
+
_context7.prev = 34;
|
|
1176
|
+
_context7.t0 = _context7["catch"](11);
|
|
1177
|
+
console.error("Error sending evaluation:", _context7.t0);
|
|
1178
|
+
dispatch({
|
|
1179
|
+
type: "SET_MODAL",
|
|
1180
|
+
payload: {
|
|
1181
|
+
show: true,
|
|
1182
|
+
title: "Error",
|
|
1183
|
+
message: "Hubo un error al procesar la evaluación",
|
|
1184
|
+
image: _errorModal.default
|
|
1840
1185
|
}
|
|
1841
1186
|
});
|
|
1842
1187
|
|
|
1843
|
-
case
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1188
|
+
case 38:
|
|
1189
|
+
_context7.prev = 38;
|
|
1190
|
+
dispatch({
|
|
1191
|
+
type: "SET_SAVING",
|
|
1192
|
+
payload: false
|
|
1193
|
+
});
|
|
1194
|
+
return _context7.finish(38);
|
|
1850
1195
|
|
|
1851
|
-
case
|
|
1196
|
+
case 41:
|
|
1852
1197
|
case "end":
|
|
1853
|
-
return
|
|
1198
|
+
return _context7.stop();
|
|
1854
1199
|
}
|
|
1855
1200
|
}
|
|
1856
|
-
},
|
|
1201
|
+
}, _callee7, null, [[11, 34, 38, 41]]);
|
|
1857
1202
|
}));
|
|
1858
1203
|
|
|
1859
|
-
return function
|
|
1860
|
-
return
|
|
1204
|
+
return function sendSingleEvaluation(_x2) {
|
|
1205
|
+
return _ref10.apply(this, arguments);
|
|
1861
1206
|
};
|
|
1862
1207
|
}();
|
|
1863
1208
|
|
|
1864
|
-
var
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
var dsInputsRequired = [];
|
|
1873
|
-
var desInputsRequired = 0;
|
|
1874
|
-
datasheetServicesArray === null || datasheetServicesArray === void 0 ? void 0 : datasheetServicesArray.forEach(function (datasheet) {
|
|
1875
|
-
var _servicesData$filter = servicesData === null || servicesData === void 0 ? void 0 : servicesData.filter(function (srv) {
|
|
1876
|
-
return srv.id_retailer === datasheet.retailer.id && srv.service === getConcept(activeTab);
|
|
1877
|
-
}),
|
|
1878
|
-
_servicesData$filter2 = (0, _slicedToArray2.default)(_servicesData$filter, 1),
|
|
1879
|
-
requested = _servicesData$filter2[0];
|
|
1880
|
-
|
|
1881
|
-
requested && (datasheet === null || datasheet === void 0 ? void 0 : datasheet.data) && Object.values(datasheet === null || datasheet === void 0 ? void 0 : datasheet.data).forEach(function (dataGroup) {
|
|
1882
|
-
dsInputsRequired.push.apply(dsInputsRequired, (0, _toConsumableArray2.default)(dataGroup.inputs.filter(function (input) {
|
|
1883
|
-
return allDatasheetInputs[input].required && allDatasheetInputs[input].id_retailer === activeRetailer.id && (allDatasheetInputs[input].value === undefined || !allDatasheetInputs[input].value);
|
|
1884
|
-
})));
|
|
1885
|
-
});
|
|
1886
|
-
});
|
|
1887
|
-
objetcTemp["Ficha técnica"] = dsInputsRequired.length;
|
|
1888
|
-
var regex = /(<\/?p>)|(<\/?strong>)|(<br>)/gm;
|
|
1889
|
-
descriptionsServicesArray.forEach(function (description) {
|
|
1890
|
-
if (description.id != activeRetailer.id) return;
|
|
1209
|
+
var handleOnApproveAllServices = /*#__PURE__*/function () {
|
|
1210
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
1211
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
1212
|
+
while (1) {
|
|
1213
|
+
switch (_context8.prev = _context8.next) {
|
|
1214
|
+
case 0:
|
|
1215
|
+
_context8.next = 2;
|
|
1216
|
+
return sendBulkEvaluation("A");
|
|
1891
1217
|
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1218
|
+
case 2:
|
|
1219
|
+
case "end":
|
|
1220
|
+
return _context8.stop();
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
}, _callee8);
|
|
1224
|
+
}));
|
|
1897
1225
|
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1226
|
+
return function handleOnApproveAllServices() {
|
|
1227
|
+
return _ref11.apply(this, arguments);
|
|
1228
|
+
};
|
|
1229
|
+
}();
|
|
1901
1230
|
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
});
|
|
1906
|
-
}
|
|
1907
|
-
});
|
|
1908
|
-
objetcTemp["Descripción"] = desInputsRequired;
|
|
1909
|
-
var retailersRequested = [];
|
|
1910
|
-
(_services$2 = services[2]) === null || _services$2 === void 0 ? void 0 : (_services$2$retailerM = _services$2.retailerMandatories) === null || _services$2$retailerM === void 0 ? void 0 : _services$2$retailerM.forEach(function (retMan) {
|
|
1911
|
-
return retMan.forEach(function (rm) {
|
|
1912
|
-
return retailersRequested.push(rm);
|
|
1913
|
-
});
|
|
1914
|
-
});
|
|
1915
|
-
var requiredImages = (_services$3 = services[2]) === null || _services$3 === void 0 ? void 0 : (_services$3$inputs = _services$3.inputs) === null || _services$3$inputs === void 0 ? void 0 : _services$3$inputs.filter(function (e) {
|
|
1916
|
-
return e.required === 1 && retailersRequested.filter(function (ret) {
|
|
1917
|
-
return ret.id_image === e.id && servicesData.filter(function (srv) {
|
|
1918
|
-
return srv.id_retailer === ret.id_retailer;
|
|
1919
|
-
}).length > 0;
|
|
1920
|
-
}).length > 0;
|
|
1921
|
-
});
|
|
1922
|
-
var requiredCounter = 0;
|
|
1923
|
-
requiredImages === null || requiredImages === void 0 ? void 0 : requiredImages.forEach(function (req) {
|
|
1924
|
-
return services[2].values.filter(function (img) {
|
|
1925
|
-
return img.image_id === req.id;
|
|
1926
|
-
}).length === 0 && requiredCounter++;
|
|
1927
|
-
});
|
|
1928
|
-
objetcTemp["Imágenes"] = requiredCounter;
|
|
1929
|
-
setRequiredNull(objetcTemp);
|
|
1930
|
-
} catch (error) {
|
|
1931
|
-
console.log(error);
|
|
1932
|
-
}
|
|
1231
|
+
var handleOnRejectAllServices = function handleOnRejectAllServices() {
|
|
1232
|
+
setRejectAll(true);
|
|
1233
|
+
setShowRejectModal(true);
|
|
1933
1234
|
};
|
|
1934
1235
|
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1236
|
+
var sendBulkEvaluation = /*#__PURE__*/function () {
|
|
1237
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
|
|
1238
|
+
var _state$services_data3, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, updatedServicesData;
|
|
1938
1239
|
|
|
1939
|
-
|
|
1940
|
-
var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
1941
|
-
var data;
|
|
1942
|
-
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
1240
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1943
1241
|
while (1) {
|
|
1944
|
-
switch (
|
|
1242
|
+
switch (_context9.prev = _context9.next) {
|
|
1945
1243
|
case 0:
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1244
|
+
dispatch({
|
|
1245
|
+
type: "SET_SAVING",
|
|
1246
|
+
payload: true
|
|
1247
|
+
});
|
|
1248
|
+
_context9.prev = 1;
|
|
1249
|
+
evaluationArray = [];
|
|
1250
|
+
conceptArray = (0, _utils.getConceptsByRole)(user.id_role);
|
|
1251
|
+
(_state$services_data3 = state.services_data) === null || _state$services_data3 === void 0 ? void 0 : _state$services_data3.forEach(function (ret, idx) {
|
|
1252
|
+
var retailer_service = ret.service,
|
|
1253
|
+
id_retailer = ret.id_retailer,
|
|
1254
|
+
status_retailer_service = ret.status;
|
|
1255
|
+
var lastStatusLevel = status_retailer_service.replace(/.*\//, "");
|
|
1256
|
+
|
|
1257
|
+
if (conceptArray.includes(retailer_service) && statusArray !== null && statusArray !== void 0 && statusArray.includes(lastStatusLevel)) {
|
|
1258
|
+
var data = {
|
|
1259
|
+
articleId: state.product.id_article,
|
|
1260
|
+
orderId: state.product.id_order,
|
|
1261
|
+
concept: retailer_service,
|
|
1262
|
+
result: result,
|
|
1263
|
+
evalStatus: status_retailer_service,
|
|
1264
|
+
retailerId: id_retailer
|
|
1265
|
+
};
|
|
1266
|
+
evaluationArray.push(_axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1267
|
+
headers: {
|
|
1268
|
+
Authorization: token
|
|
1269
|
+
}
|
|
1270
|
+
}));
|
|
1271
|
+
}
|
|
1272
|
+
});
|
|
1273
|
+
_context9.next = 7;
|
|
1274
|
+
return Promise.all(evaluationArray);
|
|
1275
|
+
|
|
1276
|
+
case 7:
|
|
1277
|
+
status = "".concat(result, "A"); // Actualizar el statusByRetailer para todos los retailers y conceptos
|
|
1278
|
+
|
|
1279
|
+
updatedStatusByRetailer = state.product.statusByRetailer.map(function (item) {
|
|
1280
|
+
return conceptArray.includes(item.service) ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
|
|
1281
|
+
status: status
|
|
1282
|
+
}) : item;
|
|
1283
|
+
}); // Actualizar el producto con los nuevos estados
|
|
1284
|
+
|
|
1285
|
+
updatedProduct = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1286
|
+
article_status: status,
|
|
1287
|
+
status: status,
|
|
1288
|
+
datasheet_status: state.product.datasheet_status === "NA" ? "NA" : status,
|
|
1289
|
+
description_status: state.product.description_status === "NA" ? "NA" : status,
|
|
1290
|
+
images_status: state.product.images_status === "NA" ? "NA" : status,
|
|
1291
|
+
statusByRetailer: updatedStatusByRetailer
|
|
1292
|
+
});
|
|
1293
|
+
dispatch({
|
|
1294
|
+
type: "SET_PRODUCT",
|
|
1295
|
+
payload: updatedProduct
|
|
1296
|
+
});
|
|
1297
|
+
updatedServicesData = state.services_data.map(function (service) {
|
|
1298
|
+
return conceptArray.includes(service.service) ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, service), {}, {
|
|
1299
|
+
status: status
|
|
1300
|
+
}) : service;
|
|
1301
|
+
});
|
|
1302
|
+
dispatch({
|
|
1303
|
+
type: "SET_SERVICES_DATA",
|
|
1304
|
+
payload: updatedServicesData
|
|
1305
|
+
}); // sessionStorage.setItem(
|
|
1306
|
+
// "productSelected",
|
|
1307
|
+
// JSON.stringify(updatedProduct),
|
|
1308
|
+
// );
|
|
1309
|
+
// sessionStorage.setItem(
|
|
1310
|
+
// "productEdit",
|
|
1311
|
+
// JSON.stringify({
|
|
1312
|
+
// ArticleId: updatedProduct.id_article,
|
|
1313
|
+
// idCategory: updatedProduct.id_category,
|
|
1314
|
+
// product: updatedProduct,
|
|
1315
|
+
// }),
|
|
1316
|
+
// );
|
|
1317
|
+
// Mostrar modal de éxito
|
|
1318
|
+
|
|
1319
|
+
dispatch({
|
|
1320
|
+
type: "SET_MODAL",
|
|
1321
|
+
payload: {
|
|
1322
|
+
show: true,
|
|
1323
|
+
title: "",
|
|
1324
|
+
message: result === "A" ? "Todos los servicios aprobados con éxito" : "Todos los servicios rechazados con éxito",
|
|
1325
|
+
image: _genericModalCheck.default
|
|
1953
1326
|
}
|
|
1954
1327
|
});
|
|
1328
|
+
_context9.next = 19;
|
|
1329
|
+
break;
|
|
1955
1330
|
|
|
1956
|
-
case
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1331
|
+
case 16:
|
|
1332
|
+
_context9.prev = 16;
|
|
1333
|
+
_context9.t0 = _context9["catch"](1);
|
|
1334
|
+
console.error("Error in bulk evaluation:", _context9.t0);
|
|
1960
1335
|
|
|
1961
|
-
case
|
|
1336
|
+
case 19:
|
|
1337
|
+
_context9.prev = 19;
|
|
1338
|
+
dispatch({
|
|
1339
|
+
type: "SET_SAVING",
|
|
1340
|
+
payload: false
|
|
1341
|
+
});
|
|
1342
|
+
return _context9.finish(19);
|
|
1343
|
+
|
|
1344
|
+
case 22:
|
|
1962
1345
|
case "end":
|
|
1963
|
-
return
|
|
1346
|
+
return _context9.stop();
|
|
1964
1347
|
}
|
|
1965
1348
|
}
|
|
1966
|
-
},
|
|
1349
|
+
}, _callee9, null, [[1, 16, 19, 22]]);
|
|
1967
1350
|
}));
|
|
1968
1351
|
|
|
1969
|
-
return function
|
|
1970
|
-
return
|
|
1352
|
+
return function sendBulkEvaluation(_x3) {
|
|
1353
|
+
return _ref12.apply(this, arguments);
|
|
1971
1354
|
};
|
|
1972
1355
|
}();
|
|
1973
1356
|
|
|
1974
|
-
var
|
|
1975
|
-
var
|
|
1976
|
-
var
|
|
1977
|
-
|
|
1978
|
-
var concept, productTemp, data;
|
|
1979
|
-
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
1357
|
+
var handleOnChangeAssignations = /*#__PURE__*/function () {
|
|
1358
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(assignationType, assignationId) {
|
|
1359
|
+
var concept, data, updatedProduct;
|
|
1360
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1980
1361
|
while (1) {
|
|
1981
|
-
switch (
|
|
1362
|
+
switch (_context10.prev = _context10.next) {
|
|
1982
1363
|
case 0:
|
|
1983
|
-
concept =
|
|
1984
|
-
_context18.t0 = activeTab;
|
|
1985
|
-
_context18.next = _context18.t0 === "Ficha técnica" ? 4 : _context18.t0 === "Imágenes" ? 6 : 8;
|
|
1986
|
-
break;
|
|
1987
|
-
|
|
1988
|
-
case 4:
|
|
1989
|
-
concept = "datasheet";
|
|
1990
|
-
return _context18.abrupt("break", 10);
|
|
1991
|
-
|
|
1992
|
-
case 6:
|
|
1993
|
-
concept = "images";
|
|
1994
|
-
return _context18.abrupt("break", 10);
|
|
1995
|
-
|
|
1996
|
-
case 8:
|
|
1997
|
-
concept = "description";
|
|
1998
|
-
return _context18.abrupt("break", 10);
|
|
1999
|
-
|
|
2000
|
-
case 10:
|
|
2001
|
-
productTemp = product;
|
|
2002
|
-
productTemp.article["id_".concat(concept, "_").concat(assignationType)] = assignationId;
|
|
1364
|
+
concept = (0, _utils.getConceptByTab)(state.active_tab);
|
|
2003
1365
|
data = {
|
|
2004
1366
|
articleList: [{
|
|
2005
|
-
orderId: product.
|
|
2006
|
-
articleId: product
|
|
1367
|
+
orderId: state.product.id_order,
|
|
1368
|
+
articleId: state.product.id_article
|
|
2007
1369
|
}],
|
|
2008
1370
|
concept: concept,
|
|
2009
1371
|
userId: assignationId
|
|
2010
1372
|
};
|
|
2011
|
-
|
|
1373
|
+
_context10.next = 4;
|
|
2012
1374
|
return (0, _axios.default)({
|
|
2013
1375
|
method: "post",
|
|
2014
1376
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
@@ -2018,583 +1380,414 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2018
1380
|
}
|
|
2019
1381
|
});
|
|
2020
1382
|
|
|
2021
|
-
case
|
|
2022
|
-
|
|
2023
|
-
|
|
1383
|
+
case 4:
|
|
1384
|
+
updatedProduct = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, (0, _defineProperty2.default)({}, "id_".concat(concept, "_").concat(assignationType), assignationId));
|
|
1385
|
+
dispatch({
|
|
1386
|
+
type: "SET_PRODUCT",
|
|
1387
|
+
payload: updatedProduct
|
|
1388
|
+
});
|
|
2024
1389
|
|
|
2025
|
-
case
|
|
1390
|
+
case 6:
|
|
2026
1391
|
case "end":
|
|
2027
|
-
return
|
|
1392
|
+
return _context10.stop();
|
|
2028
1393
|
}
|
|
2029
1394
|
}
|
|
2030
|
-
},
|
|
1395
|
+
}, _callee10);
|
|
2031
1396
|
}));
|
|
2032
1397
|
|
|
2033
|
-
return function
|
|
2034
|
-
return
|
|
1398
|
+
return function handleOnChangeAssignations(_x4, _x5) {
|
|
1399
|
+
return _ref13.apply(this, arguments);
|
|
2035
1400
|
};
|
|
2036
1401
|
}();
|
|
2037
1402
|
|
|
2038
|
-
var
|
|
2039
|
-
|
|
1403
|
+
var handleOnSetAssignation = function handleOnSetAssignation() {
|
|
1404
|
+
console.log("handleOnSetAssignation - pendiente de implementar");
|
|
1405
|
+
};
|
|
2040
1406
|
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
1407
|
+
var handleOnSetImages = function handleOnSetImages() {
|
|
1408
|
+
console.log("handleOnSetImages - pendiente de implementar");
|
|
1409
|
+
};
|
|
1410
|
+
|
|
1411
|
+
var handleOnSetCheckAll = function handleOnSetCheckAll(isChecked) {
|
|
1412
|
+
dispatch({
|
|
1413
|
+
type: "TOGGLE_CHECK_ALL_IMAGES",
|
|
1414
|
+
payload: isChecked
|
|
2049
1415
|
});
|
|
2050
1416
|
};
|
|
2051
1417
|
|
|
2052
|
-
var
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
1418
|
+
var handleOnSetSelectedImages = function handleOnSetSelectedImages() {
|
|
1419
|
+
/*
|
|
1420
|
+
Esta función no se utiliza actualmente.
|
|
1421
|
+
En la versión anterior se usaban dos funciones distintas para el checkbox
|
|
1422
|
+
"Seleccionar todo":
|
|
1423
|
+
- Una para cambiar el valor booleano del checkbox.
|
|
1424
|
+
- Otra para actualizar el array de imágenes seleccionadas.
|
|
1425
|
+
En la versión actual se unificó la lógica en una sola función,
|
|
1426
|
+
`handleOnSetCheckAll`, que recibe el valor `true` o `false` del checkbox
|
|
1427
|
+
"Seleccionar todo" y, a partir de este, agrega o elimina todas las imágenes
|
|
1428
|
+
del array de imágenes seleccionadas.
|
|
1429
|
+
*/
|
|
1430
|
+
console.log("setSelectedImages");
|
|
1431
|
+
};
|
|
1432
|
+
|
|
1433
|
+
var handleOnSubmitComment = /*#__PURE__*/function () {
|
|
1434
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(e) {
|
|
1435
|
+
var commentText;
|
|
1436
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
2056
1437
|
while (1) {
|
|
2057
|
-
switch (
|
|
1438
|
+
switch (_context11.prev = _context11.next) {
|
|
2058
1439
|
case 0:
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
});
|
|
2065
|
-
imgsLeft = values.filter(function (value) {
|
|
2066
|
-
return selectedImages.indexOf(value) === -1;
|
|
2067
|
-
});
|
|
1440
|
+
e.preventDefault();
|
|
1441
|
+
commentText = document.querySelector("#commentary-box .ql-container .ql-editor > p").innerHTML;
|
|
1442
|
+
_context11.prev = 2;
|
|
1443
|
+
_context11.next = 5;
|
|
1444
|
+
return createComment(commentText, token);
|
|
2068
1445
|
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
orderId: product.orderId
|
|
2078
|
-
};
|
|
2079
|
-
_context19.prev = 7;
|
|
2080
|
-
_context19.next = 10;
|
|
2081
|
-
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), data, {
|
|
2082
|
-
headers: {
|
|
2083
|
-
Authorization: token
|
|
1446
|
+
case 5:
|
|
1447
|
+
dispatch({
|
|
1448
|
+
type: "SET_MODAL",
|
|
1449
|
+
payload: {
|
|
1450
|
+
show: true,
|
|
1451
|
+
title: "",
|
|
1452
|
+
message: "Comentario guardado con éxito",
|
|
1453
|
+
image: _genericModalCheck.default
|
|
2084
1454
|
}
|
|
2085
1455
|
});
|
|
2086
|
-
|
|
2087
|
-
case 10:
|
|
2088
|
-
_context19.next = 15;
|
|
1456
|
+
_context11.next = 12;
|
|
2089
1457
|
break;
|
|
2090
1458
|
|
|
2091
|
-
case
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
console.
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
1459
|
+
case 8:
|
|
1460
|
+
_context11.prev = 8;
|
|
1461
|
+
_context11.t0 = _context11["catch"](2);
|
|
1462
|
+
console.error("Error saving comment:", _context11.t0);
|
|
1463
|
+
dispatch({
|
|
1464
|
+
type: "SET_MODAL",
|
|
1465
|
+
payload: {
|
|
1466
|
+
show: true,
|
|
1467
|
+
title: "Error",
|
|
1468
|
+
message: "Hubo un error al guardar el comentario",
|
|
1469
|
+
image: _errorModal.default
|
|
1470
|
+
}
|
|
2100
1471
|
});
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
})]);
|
|
2104
|
-
setLoading(false);
|
|
2105
|
-
setMessage("");
|
|
2106
|
-
setComponentsArray([]);
|
|
2107
|
-
|
|
2108
|
-
case 20:
|
|
1472
|
+
|
|
1473
|
+
case 12:
|
|
2109
1474
|
case "end":
|
|
2110
|
-
return
|
|
1475
|
+
return _context11.stop();
|
|
2111
1476
|
}
|
|
2112
1477
|
}
|
|
2113
|
-
},
|
|
1478
|
+
}, _callee11, null, [[2, 8]]);
|
|
2114
1479
|
}));
|
|
2115
1480
|
|
|
2116
|
-
return function
|
|
2117
|
-
return
|
|
1481
|
+
return function handleOnSubmitComment(_x6) {
|
|
1482
|
+
return _ref14.apply(this, arguments);
|
|
2118
1483
|
};
|
|
2119
1484
|
}();
|
|
2120
1485
|
|
|
2121
|
-
var
|
|
2122
|
-
|
|
2123
|
-
setMessage("¿Está seguro de eliminar las imágenes seleccionadas?");
|
|
2124
|
-
setComponentsArray([/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
2125
|
-
text: "¿Está seguro de eliminar las imágenes seleccionadas?",
|
|
2126
|
-
headerType: "retailer-name-header",
|
|
2127
|
-
color: "white"
|
|
2128
|
-
}, "1"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
2129
|
-
buttonType: "general-white-button",
|
|
2130
|
-
label: "Cancelar",
|
|
2131
|
-
onClick: function onClick() {
|
|
2132
|
-
return setMessage("");
|
|
2133
|
-
}
|
|
2134
|
-
}, "2"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
2135
|
-
buttonType: "general-button-default",
|
|
2136
|
-
label: "Aceptar",
|
|
2137
|
-
onClick: function onClick() {
|
|
2138
|
-
setMessage("");
|
|
2139
|
-
deleteImages();
|
|
2140
|
-
}
|
|
2141
|
-
}, "3")]);
|
|
2142
|
-
}
|
|
1486
|
+
var handleOnSendEvaluationToFacilitator = function handleOnSendEvaluationToFacilitator() {
|
|
1487
|
+
sendSingleEvaluation();
|
|
2143
1488
|
};
|
|
2144
1489
|
|
|
2145
|
-
var
|
|
2146
|
-
var
|
|
2147
|
-
var concept = getConcept(tab);
|
|
2148
|
-
var retailerService = {};
|
|
1490
|
+
var isEvaluationFinished = function isEvaluationFinished(id_rol, tab, statusArray) {
|
|
1491
|
+
var _servicesByTab$find, _servicesByTab$find$s, _product$, _srv;
|
|
2149
1492
|
|
|
2150
|
-
var
|
|
2151
|
-
|
|
1493
|
+
var servicesData = state.services_data;
|
|
1494
|
+
var activeRetailer = state.active_retailer;
|
|
1495
|
+
var product = state.product;
|
|
1496
|
+
var concept = (0, _utils.getConceptByTab)(tab);
|
|
1497
|
+
var servicesByTab = servicesData === null || servicesData === void 0 ? void 0 : servicesData.filter(function (serv) {
|
|
1498
|
+
return serv.service === concept;
|
|
2152
1499
|
});
|
|
1500
|
+
var statusBySelectedRetailerService = servicesByTab === null || servicesByTab === void 0 ? void 0 : (_servicesByTab$find = servicesByTab.find(function (serv) {
|
|
1501
|
+
return serv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id_retailer);
|
|
1502
|
+
})) === null || _servicesByTab$find === void 0 ? void 0 : (_servicesByTab$find$s = _servicesByTab$find.status) === null || _servicesByTab$find$s === void 0 ? void 0 : _servicesByTab$find$s.replace(/.*\//, "");
|
|
1503
|
+
var currentProducStatus = product === null || product === void 0 ? void 0 : (_product$ = product["".concat(concept, "_status")]) === null || _product$ === void 0 ? void 0 : _product$.replace(/.*\//, "");
|
|
1504
|
+
var unvalidated = ["IE", "CA"].includes(currentProducStatus);
|
|
1505
|
+
var auditorUnvalidated = !["RA", "AA", "ACA", "AP"].includes(currentProducStatus);
|
|
1506
|
+
var result;
|
|
1507
|
+
|
|
1508
|
+
switch (id_rol) {
|
|
1509
|
+
case 7:
|
|
1510
|
+
case 8:
|
|
1511
|
+
var canSendEvaluation = statusArray.includes(statusBySelectedRetailerService); // const conditionTwo = statusArray.includes(product?.status);
|
|
1512
|
+
// const conditionThree =
|
|
1513
|
+
// servicesByTab.filter((service) =>
|
|
1514
|
+
// statusArray.includes(service.status?.replace(/.*\//, "")),
|
|
1515
|
+
// ).length === servicesByTab.length;
|
|
1516
|
+
// return (canSendEvaluation && conditionTwo) || conditionThree;
|
|
2153
1517
|
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
retailerService = _arr$filter2[0];
|
|
2157
|
-
return retailerService ? retailerService.status : "NS";
|
|
2158
|
-
};
|
|
2159
|
-
|
|
2160
|
-
(0, _react.useEffect)(function () {
|
|
2161
|
-
var status = getRetailerStatus(servicesData, activeTab);
|
|
2162
|
-
setRetailerStatus(status);
|
|
2163
|
-
}, [activeTab, servicesData, activeRetailer]);
|
|
2164
|
-
(0, _react.useEffect)(function () {
|
|
2165
|
-
services.length > 0 && getRequired(services);
|
|
2166
|
-
}, [services, servicesData, activeTab]);
|
|
2167
|
-
(0, _react.useEffect)(function () {
|
|
2168
|
-
setSaving(loading);
|
|
2169
|
-
}, [loading]);
|
|
2170
|
-
|
|
2171
|
-
var validateAll = /*#__PURE__*/function () {
|
|
2172
|
-
var _ref25 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(result) {
|
|
2173
|
-
var evaluationArray, conceptArray, messages, productTemp, messagesResponse;
|
|
2174
|
-
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
2175
|
-
while (1) {
|
|
2176
|
-
switch (_context20.prev = _context20.next) {
|
|
2177
|
-
case 0:
|
|
2178
|
-
_context20.prev = 0;
|
|
2179
|
-
setLoading(true);
|
|
2180
|
-
evaluationArray = [];
|
|
2181
|
-
conceptArray = [];
|
|
2182
|
-
_context20.t0 = user.id_role;
|
|
2183
|
-
_context20.next = _context20.t0 === 4 ? 7 : _context20.t0 === 5 ? 9 : 11;
|
|
2184
|
-
break;
|
|
2185
|
-
|
|
2186
|
-
case 7:
|
|
2187
|
-
conceptArray = ["description", "datasheet"];
|
|
2188
|
-
return _context20.abrupt("break", 13);
|
|
2189
|
-
|
|
2190
|
-
case 9:
|
|
2191
|
-
conceptArray = ["images"];
|
|
2192
|
-
return _context20.abrupt("break", 13);
|
|
2193
|
-
|
|
2194
|
-
case 11:
|
|
2195
|
-
conceptArray = ["description", "datasheet", "images"];
|
|
2196
|
-
return _context20.abrupt("break", 13);
|
|
2197
|
-
|
|
2198
|
-
case 13:
|
|
2199
|
-
messages = [];
|
|
2200
|
-
servicesData === null || servicesData === void 0 ? void 0 : servicesData.forEach(function (ret) {
|
|
2201
|
-
if (conceptArray.includes(ret.service)) {
|
|
2202
|
-
var _product$id_order;
|
|
2203
|
-
|
|
2204
|
-
var data = {
|
|
2205
|
-
articleId: product.article.id_article,
|
|
2206
|
-
orderId: (_product$id_order = product.id_order) !== null && _product$id_order !== void 0 ? _product$id_order : product.orderId,
|
|
2207
|
-
concept: ret.service,
|
|
2208
|
-
result: result,
|
|
2209
|
-
evalStatus: ret.status,
|
|
2210
|
-
retailerId: ret.id_retailer
|
|
2211
|
-
};
|
|
2212
|
-
evaluationArray.push(_axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
2213
|
-
headers: {
|
|
2214
|
-
Authorization: token
|
|
2215
|
-
}
|
|
2216
|
-
}));
|
|
2217
|
-
}
|
|
2218
|
-
});
|
|
2219
|
-
_context20.next = 17;
|
|
2220
|
-
return Promise.all(evaluationArray);
|
|
2221
|
-
|
|
2222
|
-
case 17:
|
|
2223
|
-
productTemp = product;
|
|
2224
|
-
productTemp.status = "".concat(result, "A");
|
|
2225
|
-
productTemp.datasheet_status = productTemp.datasheet_status === "NS" ? "NS" : "".concat(result, "A");
|
|
2226
|
-
productTemp.description_status = productTemp.description_status === "NS" ? "NS" : "".concat(result, "A");
|
|
2227
|
-
productTemp.images_status = productTemp.images_status === "NS" ? "NS" : "".concat(result, "A");
|
|
2228
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
2229
|
-
setProduct(productTemp);
|
|
2230
|
-
_context20.next = 26;
|
|
2231
|
-
return Promise.all(messages);
|
|
2232
|
-
|
|
2233
|
-
case 26:
|
|
2234
|
-
messagesResponse = _context20.sent;
|
|
2235
|
-
_context20.next = 29;
|
|
2236
|
-
return loadData();
|
|
2237
|
-
|
|
2238
|
-
case 29:
|
|
2239
|
-
_context20.next = 34;
|
|
2240
|
-
break;
|
|
2241
|
-
|
|
2242
|
-
case 31:
|
|
2243
|
-
_context20.prev = 31;
|
|
2244
|
-
_context20.t1 = _context20["catch"](0);
|
|
2245
|
-
console.log(_context20.t1);
|
|
2246
|
-
|
|
2247
|
-
case 34:
|
|
2248
|
-
_context20.prev = 34;
|
|
2249
|
-
setLoading(false);
|
|
2250
|
-
return _context20.finish(34);
|
|
2251
|
-
|
|
2252
|
-
case 37:
|
|
2253
|
-
case "end":
|
|
2254
|
-
return _context20.stop();
|
|
2255
|
-
}
|
|
2256
|
-
}
|
|
2257
|
-
}, _callee20, null, [[0, 31, 34, 37]]);
|
|
2258
|
-
}));
|
|
2259
|
-
|
|
2260
|
-
return function validateAll(_x11) {
|
|
2261
|
-
return _ref25.apply(this, arguments);
|
|
2262
|
-
};
|
|
2263
|
-
}();
|
|
1518
|
+
return canSendEvaluation;
|
|
2264
1519
|
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
_context21.next = 2;
|
|
2273
|
-
return _axios.default.get("".concat(process.env.REACT_APP_READ_OBSERVATION, "?articleId=").concat(product.article.id_article, "&orderId=").concat(product === null || product === void 0 ? void 0 : product.orderId), {
|
|
2274
|
-
headers: {
|
|
2275
|
-
Authorization: sessionStorage.getItem("jwt")
|
|
2276
|
-
}
|
|
2277
|
-
});
|
|
1520
|
+
case 4:
|
|
1521
|
+
case 5:
|
|
1522
|
+
var filteredSrv45 = servicesByTab === null || servicesByTab === void 0 ? void 0 : servicesByTab.filter(function (serv) {
|
|
1523
|
+
return statusArray.includes(serv === null || serv === void 0 ? void 0 : serv.status);
|
|
1524
|
+
});
|
|
1525
|
+
var condition45 = unvalidated && ["CA", "IE"].includes(product === null || product === void 0 ? void 0 : product.status) && (filteredSrv45 === null || filteredSrv45 === void 0 ? void 0 : filteredSrv45.length) === (servicesByTab === null || servicesByTab === void 0 ? void 0 : servicesByTab.length);
|
|
1526
|
+
return condition45;
|
|
2278
1527
|
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
1528
|
+
case 6:
|
|
1529
|
+
var statusInArray = statusArray.includes(product === null || product === void 0 ? void 0 : product.status);
|
|
1530
|
+
var allSrvValid = (_srv = srv) === null || _srv === void 0 ? void 0 : _srv.every(function (serv) {
|
|
1531
|
+
return ["RA", "AA", "AP", "ACA"].includes(serv === null || serv === void 0 ? void 0 : serv.status);
|
|
1532
|
+
});
|
|
1533
|
+
var condition6 = statusInArray && allSrvValid && auditorUnvalidated;
|
|
1534
|
+
return condition6;
|
|
2283
1535
|
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
}, _callee21);
|
|
2290
|
-
}));
|
|
1536
|
+
default:
|
|
1537
|
+
console.log("Default case - returning false");
|
|
1538
|
+
return false;
|
|
1539
|
+
}
|
|
1540
|
+
};
|
|
2291
1541
|
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
1542
|
+
var handleOnChangeProductVersion = function handleOnChangeProductVersion(version) {
|
|
1543
|
+
dispatch({
|
|
1544
|
+
type: "SET_PRODUCT_VERSION",
|
|
1545
|
+
payload: version
|
|
1546
|
+
});
|
|
1547
|
+
loadData(true, version);
|
|
1548
|
+
};
|
|
2296
1549
|
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
setActiveImage: setActiveImage,
|
|
2320
|
-
setShowModal: setShowModal
|
|
2321
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageDataTable.ImageDataTable, {
|
|
2322
|
-
lists: images,
|
|
2323
|
-
activeImage: images !== null && images !== void 0 && images.values ? images === null || images === void 0 ? void 0 : images.values[activeImage] : {},
|
|
2324
|
-
retailerSelected: activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id,
|
|
2325
|
-
setImages: setImages,
|
|
2326
|
-
assignationsImages: assig["Imágenes"],
|
|
2327
|
-
imagesStatus: product === null || product === void 0 ? void 0 : product.images_status,
|
|
2328
|
-
setAssignation: setAssignation,
|
|
2329
|
-
isRetailer: isRetailer,
|
|
2330
|
-
onClickSave: function onClickSave() {
|
|
2331
|
-
var _product$services;
|
|
2332
|
-
|
|
2333
|
-
return (product === null || product === void 0 ? void 0 : (_product$services = product.services) === null || _product$services === void 0 ? void 0 : _product$services.images) === 1 && updateImages();
|
|
2334
|
-
},
|
|
2335
|
-
showSaveButton: auditorAssigned() || userAssigned(),
|
|
2336
|
-
setShowVersionSelector: setShowVersionSelector,
|
|
2337
|
-
version: version,
|
|
2338
|
-
shotThd: shotThd
|
|
1550
|
+
var ProductEditionSkeleton = function ProductEditionSkeleton() {
|
|
1551
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
1552
|
+
headerTop: 0,
|
|
1553
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1554
|
+
px: 1.5,
|
|
1555
|
+
py: 1,
|
|
1556
|
+
pb: 0,
|
|
1557
|
+
display: "flex",
|
|
1558
|
+
alignItems: "center",
|
|
1559
|
+
justifyContent: "space-between",
|
|
1560
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1561
|
+
variant: "text",
|
|
1562
|
+
width: 300,
|
|
1563
|
+
height: 40
|
|
1564
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
1565
|
+
direction: "row",
|
|
1566
|
+
spacing: 2,
|
|
1567
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1568
|
+
variant: "circular",
|
|
1569
|
+
width: 32,
|
|
1570
|
+
height: 32
|
|
1571
|
+
})
|
|
2339
1572
|
})]
|
|
2340
1573
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2341
|
-
className: "
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
1574
|
+
className: "data-container",
|
|
1575
|
+
style: {
|
|
1576
|
+
display: "flex",
|
|
1577
|
+
gap: "8px",
|
|
1578
|
+
padding: "0 12px 12px"
|
|
1579
|
+
},
|
|
1580
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1581
|
+
className: "image-data-panel",
|
|
1582
|
+
style: {
|
|
1583
|
+
flex: "0 0 320px",
|
|
1584
|
+
display: "flex",
|
|
1585
|
+
flexDirection: "column",
|
|
1586
|
+
gap: "20px"
|
|
2352
1587
|
},
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
desc: desc,
|
|
2383
|
-
setDesc: setDesc,
|
|
2384
|
-
fich: fich,
|
|
2385
|
-
setFich: setFich,
|
|
2386
|
-
imag: imag,
|
|
2387
|
-
setImag: setImag,
|
|
2388
|
-
updatedDescriptions: updatedDescriptions,
|
|
2389
|
-
setUpdatedDescriptions: setUpdatedDescriptions,
|
|
2390
|
-
updatedDatasheets: updatedDatasheets,
|
|
2391
|
-
setUpdatedDatasheets: setUpdatedDatasheets,
|
|
2392
|
-
images: images,
|
|
2393
|
-
setImages: setImages,
|
|
2394
|
-
selectedImages: selectedImages,
|
|
2395
|
-
setSelectedImages: setSelectedImages,
|
|
2396
|
-
setShowVersionSelector: setShowVersionSelector,
|
|
2397
|
-
onClickSave: function onClickSave() {
|
|
2398
|
-
switch (activeTab) {
|
|
2399
|
-
case "Descripción":
|
|
2400
|
-
!saving && (product === null || product === void 0 ? void 0 : product.description_status) !== "NS" && saveDescriptions();
|
|
2401
|
-
break;
|
|
2402
|
-
|
|
2403
|
-
case "Ficha técnica":
|
|
2404
|
-
!saving && (product === null || product === void 0 ? void 0 : product.datasheet_status) !== "NS" && saveDatasheets();
|
|
2405
|
-
break;
|
|
2406
|
-
|
|
2407
|
-
case "Imágenes":
|
|
2408
|
-
!saving && (product === null || product === void 0 ? void 0 : product.images_status) !== "NS" && updateImages();
|
|
2409
|
-
break;
|
|
2410
|
-
|
|
2411
|
-
default:
|
|
2412
|
-
break;
|
|
2413
|
-
}
|
|
2414
|
-
},
|
|
2415
|
-
canAssign: ![7, 8].includes(user.id_role)
|
|
2416
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
2417
|
-
className: "services-information-container " + (imageLayout && activeTab === "Imágenes" ? "image-services" : ""),
|
|
2418
|
-
children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
2419
|
-
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, {
|
|
2420
|
-
setSelectedImages: setSelectedImages,
|
|
2421
|
-
checkAll: checkAll,
|
|
2422
|
-
setCheckAll: setCheckAll,
|
|
2423
|
-
shotThd: shotThd
|
|
2424
|
-
}), activeTab === "Ficha técnica" && ((product === null || product === void 0 ? void 0 : product.datasheet_status) !== "NS" ? (_datasheets$ = datasheets[0]) === null || _datasheets$ === void 0 ? void 0 : (_datasheets$$data = _datasheets$.data) === null || _datasheets$$data === void 0 ? void 0 : _datasheets$$data.map(function (dataGroup, index) {
|
|
2425
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
2426
|
-
articleId: product.article.id_article,
|
|
2427
|
-
version: version,
|
|
2428
|
-
activeSection: activeTab,
|
|
2429
|
-
inputGroup: dataGroup,
|
|
2430
|
-
dataInputs: datasheets[1],
|
|
2431
|
-
auditInputs: auditDatasheets[1],
|
|
2432
|
-
updatedDatasheets: updatedDatasheets,
|
|
2433
|
-
setUpdatedDatasheets: setUpdatedDatasheets,
|
|
2434
|
-
compare: compare
|
|
2435
|
-
}, index + "-" + activeRetailer.name);
|
|
2436
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
2437
|
-
text: "No cuentas con este servicio",
|
|
2438
|
-
headerType: "input-name-header"
|
|
2439
|
-
})), activeTab === "Descripción" && ((product === null || product === void 0 ? void 0 : product.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
2440
|
-
activeSection: activeTab,
|
|
2441
|
-
inputGroup: descriptions[0],
|
|
2442
|
-
auditInputGroup: auditDescriptions[0],
|
|
2443
|
-
updatedDescriptions: updatedDescriptions,
|
|
2444
|
-
setUpdatedDescriptions: setUpdatedDescriptions,
|
|
2445
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$article22 = product.article) === null || _product$article22 === void 0 ? void 0 : _product$article22.id_article,
|
|
2446
|
-
version: version,
|
|
2447
|
-
dinamicHeight: true,
|
|
2448
|
-
compare: compare
|
|
2449
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
2450
|
-
text: "No cuentas con este servicio",
|
|
2451
|
-
headerType: "input-name-header"
|
|
2452
|
-
})), activeTab === "Imágenes" && ((product === null || product === void 0 ? void 0 : product.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)("section", {
|
|
2453
|
-
className: "container",
|
|
2454
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread2.default)((0, _objectSpread2.default)({}, getRootProps({
|
|
2455
|
-
className: "dropzone"
|
|
2456
|
-
})), {}, {
|
|
2457
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", (0, _objectSpread2.default)({}, getInputProps())), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
|
|
2458
|
-
children: thumbs()
|
|
1588
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1589
|
+
variant: "rounded",
|
|
1590
|
+
width: "100%",
|
|
1591
|
+
height: 400
|
|
1592
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
1593
|
+
direction: "row",
|
|
1594
|
+
spacing: 2,
|
|
1595
|
+
justifyContent: "center",
|
|
1596
|
+
children: [1, 2, 3, 4].map(function (item) {
|
|
1597
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1598
|
+
variant: "rounded",
|
|
1599
|
+
width: 60,
|
|
1600
|
+
height: 80
|
|
1601
|
+
}, item);
|
|
1602
|
+
})
|
|
1603
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
1604
|
+
mt: 2,
|
|
1605
|
+
children: [1, 2, 3, 4].map(function (item) {
|
|
1606
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1607
|
+
display: "flex",
|
|
1608
|
+
justifyContent: "space-between",
|
|
1609
|
+
py: 1,
|
|
1610
|
+
borderBottom: "1px solid #f0f0f0",
|
|
1611
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1612
|
+
variant: "text",
|
|
1613
|
+
width: "40%"
|
|
1614
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1615
|
+
variant: "text",
|
|
1616
|
+
width: "20%"
|
|
2459
1617
|
})]
|
|
2460
|
-
})
|
|
2461
|
-
})
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
1618
|
+
}, item);
|
|
1619
|
+
})
|
|
1620
|
+
})]
|
|
1621
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1622
|
+
className: "product-information",
|
|
1623
|
+
style: {
|
|
1624
|
+
flex: 1,
|
|
1625
|
+
display: "flex",
|
|
1626
|
+
flexDirection: "column",
|
|
1627
|
+
gap: "14px"
|
|
1628
|
+
},
|
|
1629
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1630
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1631
|
+
variant: "text",
|
|
1632
|
+
width: "80%",
|
|
1633
|
+
height: 50
|
|
1634
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
1635
|
+
direction: "row",
|
|
1636
|
+
spacing: 2,
|
|
1637
|
+
alignItems: "center",
|
|
1638
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1639
|
+
variant: "rounded",
|
|
1640
|
+
width: 180,
|
|
1641
|
+
height: 24
|
|
1642
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1643
|
+
variant: "rounded",
|
|
1644
|
+
width: 300,
|
|
1645
|
+
height: 24
|
|
1646
|
+
})]
|
|
2484
1647
|
})]
|
|
2485
|
-
})
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
1648
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1649
|
+
display: "flex",
|
|
1650
|
+
gap: 4,
|
|
1651
|
+
pb: 1,
|
|
1652
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1653
|
+
variant: "text",
|
|
1654
|
+
width: 140,
|
|
1655
|
+
height: 45
|
|
1656
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1657
|
+
variant: "text",
|
|
1658
|
+
width: 140,
|
|
1659
|
+
height: 45
|
|
1660
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1661
|
+
variant: "text",
|
|
1662
|
+
width: 140,
|
|
1663
|
+
height: 45
|
|
1664
|
+
})]
|
|
1665
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
1666
|
+
display: "flex",
|
|
1667
|
+
flexDirection: "column",
|
|
1668
|
+
gap: 4,
|
|
1669
|
+
children: [1, 2, 3].map(function (item) {
|
|
1670
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1671
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1672
|
+
display: "flex",
|
|
1673
|
+
justifyContent: "space-between",
|
|
1674
|
+
alignItems: "center",
|
|
1675
|
+
mb: 1,
|
|
1676
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1677
|
+
variant: "text",
|
|
1678
|
+
width: "30%",
|
|
1679
|
+
height: 24
|
|
1680
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1681
|
+
variant: "rounded",
|
|
1682
|
+
width: 175,
|
|
1683
|
+
height: 25,
|
|
1684
|
+
sx: {
|
|
1685
|
+
borderRadius: "7.5px"
|
|
2503
1686
|
}
|
|
2504
|
-
}
|
|
2505
|
-
},
|
|
2506
|
-
|
|
1687
|
+
})]
|
|
1688
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1689
|
+
variant: "rounded",
|
|
1690
|
+
width: "100%",
|
|
1691
|
+
height: 70
|
|
1692
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
1693
|
+
display: "flex",
|
|
1694
|
+
justifyContent: "flex-end",
|
|
1695
|
+
mt: 0.5,
|
|
1696
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1697
|
+
variant: "text",
|
|
1698
|
+
width: 60
|
|
1699
|
+
})
|
|
1700
|
+
})]
|
|
1701
|
+
}, item);
|
|
1702
|
+
})
|
|
1703
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1704
|
+
mt: "auto",
|
|
1705
|
+
pt: 4,
|
|
1706
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1707
|
+
variant: "rounded",
|
|
1708
|
+
width: "100%",
|
|
1709
|
+
height: 120
|
|
1710
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1711
|
+
display: "flex",
|
|
1712
|
+
justifyContent: "flex-end",
|
|
1713
|
+
gap: 2,
|
|
1714
|
+
mt: 2,
|
|
1715
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1716
|
+
variant: "rounded",
|
|
1717
|
+
width: 180,
|
|
1718
|
+
height: 45,
|
|
1719
|
+
sx: {
|
|
1720
|
+
borderRadius: "24px"
|
|
1721
|
+
}
|
|
1722
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1723
|
+
variant: "rounded",
|
|
1724
|
+
width: 180,
|
|
1725
|
+
height: 45,
|
|
1726
|
+
sx: {
|
|
1727
|
+
borderRadius: "24px"
|
|
1728
|
+
}
|
|
1729
|
+
})]
|
|
2507
1730
|
})]
|
|
2508
|
-
}), [7, 8].includes(user.id_role) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
2509
|
-
buttonType: evaluationFinished(user.id_role, activeTab, statusArray) && requiredNull[activeTab] === 0 ? "general-green-button" : "general-button-disabled",
|
|
2510
|
-
label: "Enviar evaluación",
|
|
2511
|
-
onClick: function onClick() {
|
|
2512
|
-
return sendToFacilitator();
|
|
2513
|
-
}
|
|
2514
1731
|
})]
|
|
2515
1732
|
})]
|
|
2516
1733
|
})]
|
|
2517
|
-
})
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
type: "white",
|
|
2554
|
-
label: "Cancelar",
|
|
2555
|
-
size: 12,
|
|
2556
|
-
onClick: function onClick() {
|
|
2557
|
-
setShowRejectModal(false);
|
|
2558
|
-
}
|
|
2559
|
-
}, "btn-Cancelar"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
|
|
2560
|
-
type: "pink",
|
|
2561
|
-
label: "Aceptar",
|
|
2562
|
-
size: 12,
|
|
2563
|
-
onClick: /*#__PURE__*/function () {
|
|
2564
|
-
var _ref28 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(e) {
|
|
2565
|
-
var elements, brCounter, container, existingAlert, alert, fullMessage;
|
|
2566
|
-
return _regenerator.default.wrap(function _callee23$(_context23) {
|
|
1734
|
+
});
|
|
1735
|
+
};
|
|
1736
|
+
|
|
1737
|
+
if (state.loading || !state.services || !state.product) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
1738
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ProductEditionSkeleton, {})
|
|
1739
|
+
});
|
|
1740
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_AiProductEdition.AiProductEditionProvider, {
|
|
1741
|
+
isCreatorsEdition: true,
|
|
1742
|
+
user: user,
|
|
1743
|
+
token: token,
|
|
1744
|
+
state: state,
|
|
1745
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
1746
|
+
headerTop: headerTop,
|
|
1747
|
+
children: [showRejectModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
|
|
1748
|
+
title: rejectAll ? "Agregar mensaje para rechazar todo" : "Agregar mensaje de rechazo",
|
|
1749
|
+
show: showRejectModal,
|
|
1750
|
+
customComponent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
|
|
1751
|
+
inputType: "textarea",
|
|
1752
|
+
inputId: "modal-message-box",
|
|
1753
|
+
index: 0,
|
|
1754
|
+
color: "white"
|
|
1755
|
+
}),
|
|
1756
|
+
buttons: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
|
|
1757
|
+
type: "white",
|
|
1758
|
+
label: "Cancelar",
|
|
1759
|
+
size: 12,
|
|
1760
|
+
onClick: function onClick() {
|
|
1761
|
+
setShowRejectModal(false);
|
|
1762
|
+
}
|
|
1763
|
+
}, "btn-Cancelar"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
|
|
1764
|
+
type: "pink",
|
|
1765
|
+
label: "Aceptar",
|
|
1766
|
+
size: 12,
|
|
1767
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1768
|
+
var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
|
|
1769
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
2567
1770
|
while (1) {
|
|
2568
|
-
switch (
|
|
1771
|
+
switch (_context12.prev = _context12.next) {
|
|
2569
1772
|
case 0:
|
|
2570
1773
|
elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
|
|
2571
1774
|
|
|
2572
1775
|
if (!(!elements || elements.length === 0)) {
|
|
2573
|
-
|
|
1776
|
+
_context12.next = 4;
|
|
2574
1777
|
break;
|
|
2575
1778
|
}
|
|
2576
1779
|
|
|
2577
1780
|
console.error("Elemento no encontrado");
|
|
2578
|
-
return
|
|
1781
|
+
return _context12.abrupt("return");
|
|
2579
1782
|
|
|
2580
1783
|
case 4:
|
|
2581
|
-
|
|
2582
|
-
elements.forEach(function (el) {
|
|
1784
|
+
isMessageEmpty = Array.from(elements).every(function (el) {
|
|
2583
1785
|
var body = el.innerHTML;
|
|
2584
|
-
|
|
2585
|
-
if (typeof body !== "string") {
|
|
2586
|
-
console.log("El contenido de body no es una cadena", body);
|
|
2587
|
-
isMessageEmpty = true;
|
|
2588
|
-
return;
|
|
2589
|
-
}
|
|
2590
|
-
|
|
2591
|
-
if (!body || body.replace(/<.*?\/?>/gm, "").trim() === "") {
|
|
2592
|
-
brCounter++;
|
|
2593
|
-
}
|
|
1786
|
+
return !body || body.replace(/<.*?\/?>/gm, "").trim() === "";
|
|
2594
1787
|
});
|
|
2595
1788
|
|
|
2596
|
-
if (!
|
|
2597
|
-
|
|
1789
|
+
if (!isMessageEmpty) {
|
|
1790
|
+
_context12.next = 10;
|
|
2598
1791
|
break;
|
|
2599
1792
|
}
|
|
2600
1793
|
|
|
@@ -2602,65 +1795,354 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2602
1795
|
existingAlert = container.querySelector(".alert-error");
|
|
2603
1796
|
|
|
2604
1797
|
if (!existingAlert) {
|
|
2605
|
-
|
|
2606
|
-
|
|
1798
|
+
alert = document.createElement("div");
|
|
1799
|
+
alert.className = "alert-error";
|
|
1800
|
+
alert.style.cssText = "\n color: #d32f2f;\n background-color: #ffebee;\n border: 1px solid #ef5350;\n border-radius: 4px;\n padding: 12px 16px;\n margin-top: 10px;\n font-size: 14px;\n display: flex;\n align-items: center;\n gap: 8px;\n font-family: 'Roboto', sans-serif;\n text-align: center;\n ";
|
|
1801
|
+
alert.innerHTML = "<span>El mensaje no puede estar vac\xEDo.</span>";
|
|
1802
|
+
container.appendChild(alert);
|
|
2607
1803
|
}
|
|
2608
1804
|
|
|
2609
|
-
return
|
|
2610
|
-
|
|
2611
|
-
case
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
container.appendChild(alert);
|
|
2618
|
-
return _context23.abrupt("return");
|
|
2619
|
-
|
|
2620
|
-
case 17:
|
|
2621
|
-
fullMessage = "";
|
|
2622
|
-
elements.forEach(function (element) {
|
|
2623
|
-
var body = element.innerHTML;
|
|
2624
|
-
fullMessage += body;
|
|
2625
|
-
});
|
|
2626
|
-
fullMessage = fullMessage.replace(/<br\s*\/?>/gi, "\n");
|
|
2627
|
-
_context23.next = 22;
|
|
2628
|
-
return createComment(e, fullMessage, activeTab);
|
|
1805
|
+
return _context12.abrupt("return");
|
|
1806
|
+
|
|
1807
|
+
case 10:
|
|
1808
|
+
fullMessage = Array.from(elements).map(function (element) {
|
|
1809
|
+
return element.innerHTML;
|
|
1810
|
+
}).join("").replace(/<br\s*\/?>/gi, "\n");
|
|
1811
|
+
_context12.next = 13;
|
|
1812
|
+
return createComment(fullMessage, token);
|
|
2629
1813
|
|
|
2630
|
-
case
|
|
2631
|
-
|
|
2632
|
-
setMessage("Rechazado");
|
|
1814
|
+
case 13:
|
|
1815
|
+
rejectAll ? sendBulkEvaluation("R") : sendSingleEvaluation("R");
|
|
2633
1816
|
setShowRejectModal(false);
|
|
2634
1817
|
|
|
2635
|
-
case
|
|
1818
|
+
case 15:
|
|
2636
1819
|
case "end":
|
|
2637
|
-
return
|
|
1820
|
+
return _context12.stop();
|
|
2638
1821
|
}
|
|
2639
1822
|
}
|
|
2640
|
-
},
|
|
2641
|
-
}))
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
1823
|
+
}, _callee12);
|
|
1824
|
+
}))
|
|
1825
|
+
}, "btn-Aceptar")]
|
|
1826
|
+
}), state.modal.show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
|
|
1827
|
+
componentsArray: [state.modal.image && /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
1828
|
+
src: state.modal.image,
|
|
1829
|
+
alt: "modal icon"
|
|
1830
|
+
}, "1"), state.modal.title && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1831
|
+
headerType: "retailer-name-header",
|
|
1832
|
+
text: state.modal.title,
|
|
1833
|
+
color: "white"
|
|
1834
|
+
}, "2"), state.modal.message && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1835
|
+
headerType: "retailer-name-header",
|
|
1836
|
+
text: state.modal.message,
|
|
1837
|
+
color: "white"
|
|
1838
|
+
}, "3"), state.modal.buttons && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1839
|
+
style: {
|
|
1840
|
+
marginTop: "16px"
|
|
1841
|
+
},
|
|
1842
|
+
children: state.modal.buttons.map(function (button, index) {
|
|
1843
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1844
|
+
buttonType: button.buttonType,
|
|
1845
|
+
label: button.text,
|
|
1846
|
+
onClick: button.action
|
|
1847
|
+
}, index);
|
|
1848
|
+
})
|
|
1849
|
+
}, "4")].filter(Boolean),
|
|
1850
|
+
onClick: function onClick() {
|
|
1851
|
+
return dispatch({
|
|
1852
|
+
type: "SET_MODAL",
|
|
1853
|
+
payload: {
|
|
1854
|
+
show: false,
|
|
1855
|
+
title: "",
|
|
1856
|
+
message: "",
|
|
1857
|
+
image: null
|
|
1858
|
+
}
|
|
2659
1859
|
});
|
|
2660
|
-
}
|
|
2661
|
-
}
|
|
1860
|
+
}
|
|
1861
|
+
}), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImageModal.ProductImageModal, {
|
|
1862
|
+
images: state.images_values,
|
|
1863
|
+
setShowModal: setShowModal,
|
|
1864
|
+
approveRejectButtons: canShowSingleEvaluationButtons(),
|
|
1865
|
+
sendToFacilitator: handleOnSendEvaluationToFacilitator
|
|
1866
|
+
}), showVersionSelector && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VersionSelector.VersionSelector, {
|
|
1867
|
+
modalId: "version-selector",
|
|
1868
|
+
articleId: state.product.id_article,
|
|
1869
|
+
setVersion: handleOnChangeProductVersion,
|
|
1870
|
+
companyName: state.product.company,
|
|
1871
|
+
currentVersion: state.product.version,
|
|
1872
|
+
setShowVersionSelector: setShowVersionSelector,
|
|
1873
|
+
jwt: token
|
|
1874
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
1875
|
+
setHeaderTop: setHeaderTop,
|
|
1876
|
+
auditableVersion: auditableVersion,
|
|
1877
|
+
setCompare: setCompare,
|
|
1878
|
+
isAuditor: [1, 6].includes(user.id_role),
|
|
1879
|
+
withChat: location === null || location === void 0 ? void 0 : (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.withChat,
|
|
1880
|
+
chatType: location === null || location === void 0 ? void 0 : (_location$state2 = location.state) === null || _location$state2 === void 0 ? void 0 : _location$state2.chatType,
|
|
1881
|
+
productSelected: state.product,
|
|
1882
|
+
token: token,
|
|
1883
|
+
activeRetailer: {
|
|
1884
|
+
id: (_state$active_retaile4 = state.active_retailer) === null || _state$active_retaile4 === void 0 ? void 0 : _state$active_retaile4.id_retailer,
|
|
1885
|
+
name: (_state$active_retaile5 = state.active_retailer) === null || _state$active_retaile5 === void 0 ? void 0 : _state$active_retaile5.retailer
|
|
1886
|
+
}
|
|
1887
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1888
|
+
className: "data-container",
|
|
1889
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1890
|
+
className: "image-data-panel",
|
|
1891
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagePreviewer.ImagePreviewer, {
|
|
1892
|
+
activeImage: (_state$images_values$2 = state.images_values.values[state.current_image]) !== null && _state$images_values$2 !== void 0 ? _state$images_values$2 : {},
|
|
1893
|
+
imagesArray: state.images_values || [],
|
|
1894
|
+
setActiveImage: handleOnChangeCurrentImage,
|
|
1895
|
+
setShowModal: handleOnShowModalGallery
|
|
1896
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageDataTable.ImageDataTable // states
|
|
1897
|
+
, {
|
|
1898
|
+
lists: state.images_values || [],
|
|
1899
|
+
activeImage: (_state$images_values10 = state.images_values) !== null && _state$images_values10 !== void 0 && _state$images_values10.values ? (_state$images_values11 = state.images_values) === null || _state$images_values11 === void 0 ? void 0 : _state$images_values11.values[state.current_image] : {},
|
|
1900
|
+
assignationsImages: state.collaborator_assignations["Imágenes"],
|
|
1901
|
+
imagesStatus: ((_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8.images_status) || "-",
|
|
1902
|
+
retailerSelected: (_state$active_retaile6 = state.active_retailer) === null || _state$active_retaile6 === void 0 ? void 0 : _state$active_retaile6.id_retailer,
|
|
1903
|
+
isRetailer: isRetailer,
|
|
1904
|
+
version: state.product.version,
|
|
1905
|
+
shotThd: shotThd,
|
|
1906
|
+
setShowVersionSelector: setShowVersionSelector // actions
|
|
1907
|
+
,
|
|
1908
|
+
setImages: handleOnChangeCurrentImage,
|
|
1909
|
+
setAssignation: handleOnChangeAssignations // No se usa?
|
|
1910
|
+
,
|
|
1911
|
+
onClickSave: handleOnClickSaveImages,
|
|
1912
|
+
showSaveButton: isAuditorAssigned() || isUserAssignedToService()
|
|
1913
|
+
})]
|
|
1914
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1915
|
+
className: "product-information",
|
|
1916
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader // states
|
|
1917
|
+
, {
|
|
1918
|
+
headerData: state.product,
|
|
1919
|
+
productObservation: observation,
|
|
1920
|
+
percent: state.active_percentage.percentagesGeneral.required,
|
|
1921
|
+
activeRetailer: {
|
|
1922
|
+
id: (_state$active_retaile7 = state.active_retailer) === null || _state$active_retaile7 === void 0 ? void 0 : _state$active_retaile7.id_retailer,
|
|
1923
|
+
name: (_state$active_retaile8 = state.active_retailer) === null || _state$active_retaile8 === void 0 ? void 0 : _state$active_retaile8.retailer,
|
|
1924
|
+
image: (_state$active_retaile9 = state.active_retailer) === null || _state$active_retaile9 === void 0 ? void 0 : _state$active_retaile9.image
|
|
1925
|
+
},
|
|
1926
|
+
servicesData: state.services_data ? state.services_data : null,
|
|
1927
|
+
isObservationVisible: isObservationVisible // actions
|
|
1928
|
+
,
|
|
1929
|
+
setActiveRetailer: handleOnChangeActiveRetailer,
|
|
1930
|
+
approve: handleOnApproveSingleService,
|
|
1931
|
+
approveAll: handleOnApproveAllServices,
|
|
1932
|
+
reject: handleOnRejectSingleService,
|
|
1933
|
+
rejectAll: handleOnRejectAllServices,
|
|
1934
|
+
toggleObservation: handleOnToggleObservation,
|
|
1935
|
+
hideObservation: handleOnHideObservation // sendToFacilitator={handleOnSendEvaluationToFacilitator} // No se usa?
|
|
1936
|
+
// validations
|
|
1937
|
+
,
|
|
1938
|
+
showApproveRejectAll: canShowBulkEvaluationButtons() || isAuditorAssigned() || isUserAssignedToService(),
|
|
1939
|
+
showValidationButtons: canShowSingleEvaluationButtons() && (isAuditorAssigned() || isUserAssignedToService())
|
|
1940
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
|
|
1941
|
+
tabsSections: tabsSections,
|
|
1942
|
+
status: getStatusByCurrentServiceAndRetailer(),
|
|
1943
|
+
activeTab: state.active_tab,
|
|
1944
|
+
isRetailer: isRetailer,
|
|
1945
|
+
assig: state.collaborator_assignations[state.active_tab],
|
|
1946
|
+
version: state.product.version,
|
|
1947
|
+
updatedDescriptions: state.updated_descriptions_inputs,
|
|
1948
|
+
updatedDatasheets: state.updated_datasheets_inputs,
|
|
1949
|
+
updatedImages: state.updated_images_values,
|
|
1950
|
+
images: state.services.images // selectedImages={selectedImages} prop pasada asi: FullTabsMenu -> TabsMenu Pero en TabsMenu no se espera ninguna prop setSelectedImages
|
|
1951
|
+
// setters
|
|
1952
|
+
,
|
|
1953
|
+
setActiveTab: handleOnChangeActiveTab,
|
|
1954
|
+
setImageLayout: handleOnToggleImageLayout,
|
|
1955
|
+
setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
|
|
1956
|
+
setUpdatedDatasheets: handleOnSetUpdatedDatasheets,
|
|
1957
|
+
setAssignation: handleOnSetAssignation // No se usa?
|
|
1958
|
+
,
|
|
1959
|
+
setImages: handleOnSetImages // No se usa?
|
|
1960
|
+
,
|
|
1961
|
+
setShowVersionSelector: setShowVersionSelector // setSelectedImages={setSelectedImages} prop pasada asi: FullTabsMenu -> TabsMenu Pero en TabsMenu no se espera ninguna prop setSelectedImages
|
|
1962
|
+
// actions
|
|
1963
|
+
,
|
|
1964
|
+
downloadImages: handleOnDownloadImages,
|
|
1965
|
+
askToDeleteImages: handleOnAskToDeleteImages,
|
|
1966
|
+
showSaveButton: isAuditorAssigned() || isUserAssignedToService(),
|
|
1967
|
+
onClickSave: handleOnClickSave // validations
|
|
1968
|
+
,
|
|
1969
|
+
canAssign: ![7, 8].includes(user.id_role)
|
|
1970
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1971
|
+
className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
|
|
1972
|
+
id: "services-information-container",
|
|
1973
|
+
children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
1974
|
+
children: [state.active_tab === "Descripción" && (((_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : _state$product9.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
1975
|
+
activeSection: state.active_tab,
|
|
1976
|
+
inputGroup: state.descriptions_inputs[0],
|
|
1977
|
+
updatedDescriptions: state.updated_descriptions_inputs,
|
|
1978
|
+
articleId: (_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.id_article,
|
|
1979
|
+
version: state.product.version,
|
|
1980
|
+
auditInputGroup: auditDescriptions[0],
|
|
1981
|
+
setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
|
|
1982
|
+
dinamicHeight: true,
|
|
1983
|
+
compare: compare
|
|
1984
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1985
|
+
text: "No cuentas con este servicio",
|
|
1986
|
+
headerType: "input-name-header"
|
|
1987
|
+
})), state.active_tab === "Ficha técnica" && (((_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : _state$product11.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
1988
|
+
children: (_state$datasheets_inp = state.datasheets_inputs[0]) === null || _state$datasheets_inp === void 0 ? void 0 : (_state$datasheets_inp2 = _state$datasheets_inp.data) === null || _state$datasheets_inp2 === void 0 ? void 0 : _state$datasheets_inp2.map(function (dataGroup, index) {
|
|
1989
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
1990
|
+
articleId: state.product.id_article,
|
|
1991
|
+
version: state.version,
|
|
1992
|
+
activeSection: state.active_tab,
|
|
1993
|
+
inputGroup: dataGroup,
|
|
1994
|
+
dataInputs: state.datasheets_inputs[1],
|
|
1995
|
+
auditInputs: auditDatasheets[1],
|
|
1996
|
+
updatedDatasheets: state.updated_datasheets_inputs,
|
|
1997
|
+
setUpdatedDatasheets: handleOnSetUpdatedDatasheets,
|
|
1998
|
+
compare: compare
|
|
1999
|
+
}, index + "-" + state.active_retailer.retailer);
|
|
2000
|
+
})
|
|
2001
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
2002
|
+
text: "No cuentas con este servicio",
|
|
2003
|
+
headerType: "input-name-header"
|
|
2004
|
+
})), state.active_tab === "Imágenes" && (((_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : _state$product12.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
2005
|
+
children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
|
|
2006
|
+
checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
|
|
2007
|
+
,
|
|
2008
|
+
setCheckAll: handleOnSetCheckAll // Toggler de true o false para el checkbox "Seleccionar todo"
|
|
2009
|
+
,
|
|
2010
|
+
setSelectedImages: handleOnSetSelectedImages // shotThd={shotThd} // No se usa?
|
|
2011
|
+
|
|
2012
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
|
|
2013
|
+
className: "container",
|
|
2014
|
+
style: {
|
|
2015
|
+
position: "relative"
|
|
2016
|
+
},
|
|
2017
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread5.default)((0, _objectSpread5.default)({}, getRootProps({
|
|
2018
|
+
className: "dropzone ".concat(isDragActive ? "drag-active" : "")
|
|
2019
|
+
})), {}, {
|
|
2020
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", (0, _objectSpread5.default)({}, getInputProps())), isDragActive && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
2021
|
+
className: "drag-overlay",
|
|
2022
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
2023
|
+
children: "Suelta las im\xE1genes aqu\xED"
|
|
2024
|
+
})
|
|
2025
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
|
|
2026
|
+
children: thumbs()
|
|
2027
|
+
})]
|
|
2028
|
+
})), ((_state$images_values12 = state.images_values) === null || _state$images_values12 === void 0 ? void 0 : _state$images_values12.values.length) === 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2029
|
+
style: {
|
|
2030
|
+
position: "absolute",
|
|
2031
|
+
top: "50%",
|
|
2032
|
+
left: "50%",
|
|
2033
|
+
transform: "translate(-50%, -50%)",
|
|
2034
|
+
textAlign: "center",
|
|
2035
|
+
padding: "40px",
|
|
2036
|
+
width: "80%",
|
|
2037
|
+
maxWidth: "500px",
|
|
2038
|
+
fontFamily: "Arial, sans-serif"
|
|
2039
|
+
},
|
|
2040
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
2041
|
+
style: {
|
|
2042
|
+
fontSize: "18px",
|
|
2043
|
+
color: "#666",
|
|
2044
|
+
marginBottom: "16px"
|
|
2045
|
+
},
|
|
2046
|
+
children: "Este producto no tiene im\xE1genes"
|
|
2047
|
+
}), isAuditorAssigned() || isUserAssignedToService() ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
2048
|
+
style: {
|
|
2049
|
+
fontSize: "14px",
|
|
2050
|
+
color: "#999",
|
|
2051
|
+
marginBottom: "20px"
|
|
2052
|
+
},
|
|
2053
|
+
children: ["Arrastra las im\xE1genes aqu\xED o", " ", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
2054
|
+
onClick: open,
|
|
2055
|
+
style: {
|
|
2056
|
+
color: "#007bff",
|
|
2057
|
+
cursor: "pointer",
|
|
2058
|
+
textDecoration: "underline"
|
|
2059
|
+
},
|
|
2060
|
+
children: "haz clic para abrir el explorador de archivos"
|
|
2061
|
+
})]
|
|
2062
|
+
}) : null]
|
|
2063
|
+
})]
|
|
2064
|
+
})]
|
|
2065
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
2066
|
+
text: "No cuentas con este servicio",
|
|
2067
|
+
headerType: "input-name-header"
|
|
2068
|
+
}))]
|
|
2069
|
+
})
|
|
2070
|
+
}), (isUserAssignedToService(state.active_tab) || isAuditorAssigned()) && state.product["".concat((0, _utils.getConceptByTab)(state.active_tab), "_status")] !== "NS" && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2071
|
+
className: "commentary-box",
|
|
2072
|
+
children: [!state.comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2073
|
+
className: "commentary",
|
|
2074
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
|
|
2075
|
+
label: "Caja de Comentario",
|
|
2076
|
+
inputType: "textarea",
|
|
2077
|
+
inputCols: 80,
|
|
2078
|
+
inputRows: 4,
|
|
2079
|
+
inputId: "commentary-box",
|
|
2080
|
+
index: 0
|
|
2081
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
2082
|
+
className: "buttons-box",
|
|
2083
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
2084
|
+
buttonType: "general-transparent-button",
|
|
2085
|
+
label: "Enviar comentario",
|
|
2086
|
+
onClick: handleOnSubmitComment
|
|
2087
|
+
})
|
|
2088
|
+
})]
|
|
2089
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2090
|
+
className: "feedback-box",
|
|
2091
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Commentary.Commentary, {
|
|
2092
|
+
comment: (_state$comment = state.comment) === null || _state$comment === void 0 ? void 0 : _state$comment.message,
|
|
2093
|
+
reviewed: crossComment
|
|
2094
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
2095
|
+
buttonType: "circular-button accept-button",
|
|
2096
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
2097
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
2098
|
+
while (1) {
|
|
2099
|
+
switch (_context13.prev = _context13.next) {
|
|
2100
|
+
case 0:
|
|
2101
|
+
setCrossComment(true);
|
|
2102
|
+
commentRevised();
|
|
2103
|
+
|
|
2104
|
+
case 2:
|
|
2105
|
+
case "end":
|
|
2106
|
+
return _context13.stop();
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
}, _callee13);
|
|
2110
|
+
}))
|
|
2111
|
+
})]
|
|
2112
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2113
|
+
className: "action-buttons",
|
|
2114
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
2115
|
+
buttonType: "general-pink-button",
|
|
2116
|
+
label: "Cambio de Estatus",
|
|
2117
|
+
onClick: function onClick() {
|
|
2118
|
+
return setOpenChangeStatusModal(true);
|
|
2119
|
+
},
|
|
2120
|
+
id: "button-change-status"
|
|
2121
|
+
}), [7, 8].includes(user.id_role) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
2122
|
+
buttonType: isEvaluationFinished(user.id_role, state.active_tab, statusArray) && state.missing_required_fields[state.active_tab] === 0 ? "general-green-button" : "general-button-disabled",
|
|
2123
|
+
label: "Enviar evaluación",
|
|
2124
|
+
onClick: handleOnSendEvaluationToFacilitator
|
|
2125
|
+
})]
|
|
2126
|
+
})]
|
|
2127
|
+
})]
|
|
2128
|
+
})]
|
|
2129
|
+
})]
|
|
2130
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChangeStatusModal.default, {
|
|
2131
|
+
state: state,
|
|
2132
|
+
open: openChangeStatusModal,
|
|
2133
|
+
onClose: function onClose() {
|
|
2134
|
+
setOpenChangeStatusModal(false);
|
|
2135
|
+
},
|
|
2136
|
+
reloadData: loadData,
|
|
2137
|
+
token: token
|
|
2662
2138
|
})]
|
|
2663
2139
|
});
|
|
2664
2140
|
};
|
|
2665
2141
|
|
|
2142
|
+
var RetailerProductEdition = function RetailerProductEdition(props) {
|
|
2143
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_providerProductEdition.ProviderProductEditionProvider, {
|
|
2144
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(RetailerProductEditionView, (0, _objectSpread5.default)({}, props))
|
|
2145
|
+
});
|
|
2146
|
+
};
|
|
2147
|
+
|
|
2666
2148
|
exports.RetailerProductEdition = RetailerProductEdition;
|