contentoh-components-library 21.5.94 → 21.5.96
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 +249 -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 -1
- package/dist/components/molecules/TagAndInput/index.js +364 -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 +395 -361
- package/dist/components/pages/ProviderProductEdition/utils.js +1 -0
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +125 -211
- 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 +1741 -2239
- package/dist/components/pages/RetailerProductEdition/styles.js +4 -2
- package/dist/components/pages/RetailerProductEdition/utils.js +251 -2
- package/dist/contexts/AiProductEdition.js +244 -160
- 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 +241 -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 -0
- package/src/components/molecules/TagAndInput/index.js +294 -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 +497 -437
- package/src/components/pages/ProviderProductEdition/utils.js +2 -2
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +136 -243
- 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 +1563 -1717
- 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 +347 -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,200 @@ 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
|
+
console.log({
|
|
344
|
+
productNormalized: productNormalized
|
|
345
|
+
});
|
|
346
|
+
dispatch({
|
|
347
|
+
type: "SET_PRODUCT",
|
|
348
|
+
payload: productNormalized
|
|
349
|
+
});
|
|
350
|
+
dispatch({
|
|
351
|
+
type: "SET_ACTIVE_RETAILER",
|
|
352
|
+
payload: productNormalized.categoryRetailerInOrder[0]
|
|
353
|
+
});
|
|
354
|
+
setShotThd([58, 59, 60, 61].includes(productNormalized.categoryRetailerInOrder[0].id_retailer)); // Configurar statusArray según el rol del usuario
|
|
510
355
|
|
|
511
|
-
|
|
512
|
-
_useState30 = (0, _slicedToArray2.default)(_useState29, 2),
|
|
513
|
-
activeRetailer = _useState30[0],
|
|
514
|
-
setActiveRetailer = _useState30[1];
|
|
356
|
+
setStatusArray((0, _utils.getStatusArrayByRole)(user.id_role)); // Cargar usuarios y asignaciones
|
|
515
357
|
|
|
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];
|
|
358
|
+
_context2.next = 10;
|
|
359
|
+
return (0, _data.fetchUsers)(token);
|
|
594
360
|
|
|
595
|
-
|
|
361
|
+
case 10:
|
|
362
|
+
users = _context2.sent;
|
|
596
363
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
364
|
+
if (users.length > 0) {
|
|
365
|
+
dispatch({
|
|
366
|
+
type: "SET_COLLABORATOR_ASSIGNATIONS",
|
|
367
|
+
payload: (0, _utils.buildCollaboratorAssignations)(productNormalized, users)
|
|
368
|
+
});
|
|
369
|
+
}
|
|
601
370
|
|
|
602
|
-
|
|
603
|
-
_useState64 = (0, _slicedToArray2.default)(_useState63, 2),
|
|
604
|
-
retailerStatus = _useState64[0],
|
|
605
|
-
setRetailerStatus = _useState64[1];
|
|
371
|
+
id_article = productNormalized.id_article;
|
|
606
372
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
373
|
+
if (!id_article) {
|
|
374
|
+
_context2.next = 16;
|
|
375
|
+
break;
|
|
376
|
+
}
|
|
611
377
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
socketType = _useState68[0],
|
|
615
|
-
setSocketType = _useState68[1];
|
|
378
|
+
_context2.next = 16;
|
|
379
|
+
return (0, _utils.getAuditVersion)(id_article, setAuditableVersion, token);
|
|
616
380
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
381
|
+
case 16:
|
|
382
|
+
if (!(id_article && productNormalized.id_order)) {
|
|
383
|
+
_context2.next = 22;
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
621
386
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
387
|
+
_context2.next = 19;
|
|
388
|
+
return _axios.default.get(process.env.REACT_APP_READ_OBSERVATION, {
|
|
389
|
+
params: {
|
|
390
|
+
articleId: id_article,
|
|
391
|
+
orderId: productNormalized.id_order
|
|
392
|
+
},
|
|
393
|
+
headers: {
|
|
394
|
+
Authorization: sessionStorage.getItem("jwt")
|
|
395
|
+
}
|
|
396
|
+
});
|
|
626
397
|
|
|
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
|
-
};
|
|
398
|
+
case 19:
|
|
399
|
+
response = _context2.sent;
|
|
400
|
+
parseData = JSON.parse(response.data.body).data[0];
|
|
401
|
+
setObservation(parseData.observations);
|
|
721
402
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
createComment(e, commentText, activeTab);
|
|
726
|
-
};
|
|
403
|
+
case 22:
|
|
404
|
+
_context2.next = 27;
|
|
405
|
+
break;
|
|
727
406
|
|
|
728
|
-
|
|
729
|
-
|
|
407
|
+
case 24:
|
|
408
|
+
_context2.prev = 24;
|
|
409
|
+
_context2.t0 = _context2["catch"](0);
|
|
410
|
+
console.log("Error setting product data: ", _context2.t0);
|
|
730
411
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
412
|
+
case 27:
|
|
413
|
+
case "end":
|
|
414
|
+
return _context2.stop();
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}, _callee2, null, [[0, 24]]);
|
|
418
|
+
}));
|
|
736
419
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
420
|
+
return function initializeProduct() {
|
|
421
|
+
return _ref3.apply(this, arguments);
|
|
422
|
+
};
|
|
423
|
+
}(); // Setter del producto y carga inicial (optimizado para evitar cascada)
|
|
741
424
|
|
|
742
|
-
_context5.next = 4;
|
|
743
|
-
return (0, _utils.getAuditVersion)(id_article, setAuditableVersion, token);
|
|
744
425
|
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
}, _callee5);
|
|
751
|
-
})), []);
|
|
426
|
+
(0, _react.useEffect)(function () {
|
|
427
|
+
initializeProduct();
|
|
428
|
+
}, []);
|
|
752
429
|
|
|
753
430
|
var loadAuditableData = /*#__PURE__*/function () {
|
|
754
|
-
var
|
|
755
|
-
var
|
|
431
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
432
|
+
var _state$product, _state$product2, _state$product3;
|
|
756
433
|
|
|
757
|
-
|
|
434
|
+
var auditServices;
|
|
435
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
758
436
|
while (1) {
|
|
759
|
-
switch (
|
|
437
|
+
switch (_context3.prev = _context3.next) {
|
|
760
438
|
case 0:
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
break;
|
|
764
|
-
}
|
|
439
|
+
_context3.next = 2;
|
|
440
|
+
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
441
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
(
|
|
772
|
-
|
|
773
|
-
setAuditImages(_auditServices[2]);
|
|
442
|
+
case 2:
|
|
443
|
+
auditServices = _context3.sent;
|
|
444
|
+
(0, _utils.getInputsData)(auditServices, {
|
|
445
|
+
id: state.active_retailer.id_retailer
|
|
446
|
+
}, setAuditDatasheets, setAuditDescriptions);
|
|
447
|
+
setAuditServices(auditServices);
|
|
448
|
+
setAuditImages(auditServices[2]);
|
|
774
449
|
|
|
775
|
-
case
|
|
450
|
+
case 6:
|
|
776
451
|
case "end":
|
|
777
|
-
return
|
|
452
|
+
return _context3.stop();
|
|
778
453
|
}
|
|
779
454
|
}
|
|
780
|
-
},
|
|
455
|
+
}, _callee3);
|
|
781
456
|
}));
|
|
782
457
|
|
|
783
458
|
return function loadAuditableData() {
|
|
784
|
-
return
|
|
459
|
+
return _ref4.apply(this, arguments);
|
|
785
460
|
};
|
|
786
461
|
}();
|
|
787
462
|
|
|
@@ -790,1225 +465,926 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
790
465
|
loadAuditableData();
|
|
791
466
|
}
|
|
792
467
|
}, [auditableVersion]);
|
|
793
|
-
(0, _react.useEffect)(function () {
|
|
794
|
-
checkAll && setSelectedImages(images.values);
|
|
795
|
-
}, [checkAll]);
|
|
796
468
|
|
|
797
469
|
var loadData = /*#__PURE__*/function () {
|
|
798
|
-
var
|
|
799
|
-
var
|
|
800
|
-
|
|
801
|
-
|
|
470
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
471
|
+
var enableLoading,
|
|
472
|
+
versionSelected,
|
|
473
|
+
_JSON$parse$0$relatio,
|
|
474
|
+
_JSON$parse,
|
|
475
|
+
_JSON$parse$,
|
|
476
|
+
_percentagesRes$,
|
|
477
|
+
_state$product4,
|
|
478
|
+
id_article,
|
|
479
|
+
version,
|
|
480
|
+
id_order,
|
|
481
|
+
_state$active_retaile,
|
|
482
|
+
category,
|
|
483
|
+
id_category,
|
|
484
|
+
id_retailer,
|
|
485
|
+
data,
|
|
486
|
+
headers,
|
|
487
|
+
_yield$Promise$all,
|
|
488
|
+
_yield$Promise$all2,
|
|
489
|
+
services,
|
|
490
|
+
percentagesRes,
|
|
491
|
+
servicesDataRes,
|
|
492
|
+
commentsResponse,
|
|
493
|
+
percentages,
|
|
494
|
+
commentsMap,
|
|
495
|
+
orderMap,
|
|
496
|
+
orderedValues,
|
|
497
|
+
retailerDatasheets,
|
|
498
|
+
datasheetsActiveRetailer,
|
|
499
|
+
descriptionsActiveRetailer,
|
|
500
|
+
filteredValues,
|
|
501
|
+
_args4 = arguments;
|
|
502
|
+
|
|
503
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
802
504
|
while (1) {
|
|
803
|
-
switch (
|
|
505
|
+
switch (_context4.prev = _context4.next) {
|
|
804
506
|
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]
|
|
507
|
+
enableLoading = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : true;
|
|
508
|
+
versionSelected = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : null;
|
|
509
|
+
_context4.prev = 2;
|
|
510
|
+
if (enableLoading) dispatch({
|
|
511
|
+
type: "SET_LOADING",
|
|
512
|
+
payload: true
|
|
854
513
|
});
|
|
855
|
-
|
|
514
|
+
_state$product4 = state.product, id_article = _state$product4.id_article, version = _state$product4.version, id_order = _state$product4.id_order;
|
|
515
|
+
_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
|
|
516
|
+
|
|
856
517
|
data = [{
|
|
857
|
-
id_article:
|
|
518
|
+
id_article: id_article,
|
|
519
|
+
version: versionSelected ? versionSelected : version,
|
|
858
520
|
relations: [{
|
|
859
|
-
id_retailer:
|
|
860
|
-
id_category:
|
|
861
|
-
}]
|
|
862
|
-
version: product.version
|
|
521
|
+
id_retailer: id_retailer,
|
|
522
|
+
id_category: id_category
|
|
523
|
+
}]
|
|
863
524
|
}];
|
|
864
525
|
headers = {
|
|
865
526
|
Authorization: token
|
|
866
527
|
};
|
|
867
|
-
|
|
528
|
+
_context4.next = 10;
|
|
529
|
+
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
530
|
data: data,
|
|
869
531
|
headers: headers
|
|
870
|
-
})
|
|
871
|
-
|
|
532
|
+
}), (0, _data.getServicesData)({
|
|
533
|
+
articleId: id_article,
|
|
534
|
+
orderId: id_order,
|
|
535
|
+
end: true,
|
|
536
|
+
token: token
|
|
537
|
+
}), // Obtener comentarios en paralelo
|
|
538
|
+
Promise.all([_axios.default.get(process.env.REACT_APP_COMMENTS_ENDPOINT, {
|
|
539
|
+
params: {
|
|
540
|
+
articleId: id_article,
|
|
541
|
+
concept: "description",
|
|
542
|
+
orderIdColab: id_order,
|
|
543
|
+
version: versionSelected !== null && versionSelected !== void 0 ? versionSelected : version
|
|
544
|
+
}
|
|
545
|
+
}), _axios.default.get(process.env.REACT_APP_COMMENTS_ENDPOINT, {
|
|
546
|
+
params: {
|
|
547
|
+
articleId: id_article,
|
|
548
|
+
concept: "datasheet",
|
|
549
|
+
orderIdColab: id_order,
|
|
550
|
+
version: versionSelected !== null && versionSelected !== void 0 ? versionSelected : version
|
|
551
|
+
}
|
|
552
|
+
}), _axios.default.get(process.env.REACT_APP_COMMENTS_ENDPOINT, {
|
|
553
|
+
params: {
|
|
554
|
+
articleId: id_article,
|
|
555
|
+
concept: "images",
|
|
556
|
+
orderIdColab: id_order,
|
|
557
|
+
version: versionSelected !== null && versionSelected !== void 0 ? versionSelected : version
|
|
558
|
+
}
|
|
559
|
+
})])]);
|
|
872
560
|
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
return _context7.stop();
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
}, _callee7, null, [[0, 29]]);
|
|
895
|
-
}));
|
|
896
|
-
|
|
897
|
-
return function loadData() {
|
|
898
|
-
return _ref9.apply(this, arguments);
|
|
899
|
-
};
|
|
900
|
-
}();
|
|
561
|
+
case 10:
|
|
562
|
+
_yield$Promise$all = _context4.sent;
|
|
563
|
+
_yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 4);
|
|
564
|
+
services = _yield$Promise$all2[0];
|
|
565
|
+
percentagesRes = _yield$Promise$all2[1];
|
|
566
|
+
servicesDataRes = _yield$Promise$all2[2];
|
|
567
|
+
commentsResponse = _yield$Promise$all2[3];
|
|
568
|
+
dispatch({
|
|
569
|
+
type: "SET_RETAILER_STATUS",
|
|
570
|
+
payload: servicesDataRes.map(function (service) {
|
|
571
|
+
return {
|
|
572
|
+
retailer_id: service === null || service === void 0 ? void 0 : service.id_retailer,
|
|
573
|
+
service: service === null || service === void 0 ? void 0 : service.service,
|
|
574
|
+
status: service === null || service === void 0 ? void 0 : service.status,
|
|
575
|
+
task_user_group_id: service === null || service === void 0 ? void 0 : service.task_user_group_id
|
|
576
|
+
};
|
|
577
|
+
})
|
|
578
|
+
}); // Extraer relaciones del response
|
|
901
579
|
|
|
902
|
-
|
|
903
|
-
setLoading(true);
|
|
904
|
-
loadData();
|
|
905
|
-
}, [activeRetailer]);
|
|
580
|
+
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
581
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
582
|
+
commentsMap = {};
|
|
583
|
+
commentsResponse.forEach(function (commentRes) {
|
|
584
|
+
var _commentRes$data;
|
|
910
585
|
|
|
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"));
|
|
586
|
+
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
587
|
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
retailerResponse = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
|
|
924
|
-
return srv.id_retailer;
|
|
588
|
+
if (commentData) {
|
|
589
|
+
var tab = (0, _utils.translateConcept)(commentData.concept);
|
|
590
|
+
commentsMap[tab] = commentData;
|
|
591
|
+
}
|
|
925
592
|
});
|
|
926
|
-
|
|
927
|
-
|
|
593
|
+
dispatch({
|
|
594
|
+
type: "SET_COMMENTS",
|
|
595
|
+
payload: commentsMap
|
|
596
|
+
}); // Ordenamiento de imágenes
|
|
597
|
+
|
|
598
|
+
orderMap = services[2].inputsByRetailer.flat().reduce(function (acc, item) {
|
|
599
|
+
acc[item.id_image] = item.order;
|
|
600
|
+
return acc;
|
|
601
|
+
}, {});
|
|
602
|
+
orderedValues = (0, _toConsumableArray2.default)(services[2].values).sort(function (a, b) {
|
|
603
|
+
var _orderMap$a$image_id, _orderMap$b$image_id;
|
|
604
|
+
|
|
605
|
+
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;
|
|
606
|
+
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;
|
|
607
|
+
return orderA - orderB;
|
|
608
|
+
}); // Procesamiento de inputs del retailer activo (evita cascada con state.services)
|
|
609
|
+
|
|
610
|
+
retailerDatasheets = services[0][id_retailer];
|
|
611
|
+
datasheetsActiveRetailer = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, retailerDatasheets), {}, {
|
|
612
|
+
data: Object.values(retailerDatasheets.data)
|
|
928
613
|
});
|
|
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
|
-
|
|
614
|
+
descriptionsActiveRetailer = services[1].filter(function (item) {
|
|
615
|
+
return item.id === id_retailer;
|
|
616
|
+
});
|
|
617
|
+
filteredValues = services[2].values.filter(function (value) {
|
|
618
|
+
return services[2].inputsByRetailer.some(function (retailerInput) {
|
|
619
|
+
return retailerInput.some(function (input) {
|
|
620
|
+
return input.id_retailer === id_retailer && input.id_image === value.image_id;
|
|
621
|
+
});
|
|
622
|
+
});
|
|
623
|
+
}); // Dispatch consolidado
|
|
624
|
+
|
|
625
|
+
dispatch({
|
|
626
|
+
type: "SET_SERVICES",
|
|
627
|
+
payload: {
|
|
628
|
+
datasheets: services[0],
|
|
629
|
+
descriptions: services[1],
|
|
630
|
+
images: (0, _objectSpread5.default)((0, _objectSpread5.default)({}, services[2]), {}, {
|
|
631
|
+
values: orderedValues
|
|
632
|
+
})
|
|
633
|
+
}
|
|
634
|
+
});
|
|
635
|
+
dispatch({
|
|
636
|
+
type: "SET_PERCENTAGES",
|
|
637
|
+
payload: percentages
|
|
638
|
+
});
|
|
639
|
+
dispatch({
|
|
640
|
+
type: "SET_ACTIVE_PERCENTAGES",
|
|
641
|
+
payload: percentages.find(function (_ref6) {
|
|
642
|
+
var rId = _ref6.id_retailer;
|
|
643
|
+
return rId === id_retailer;
|
|
644
|
+
})
|
|
645
|
+
});
|
|
646
|
+
dispatch({
|
|
647
|
+
type: "SET_SERVICES_DATA",
|
|
648
|
+
payload: servicesDataRes
|
|
649
|
+
}); // Setear inputs del retailer activo directamente (evita cascada)
|
|
650
|
+
|
|
651
|
+
dispatch({
|
|
652
|
+
type: "SET_DATASHEETS_INPUTS",
|
|
653
|
+
payload: [datasheetsActiveRetailer, services[0].inputs]
|
|
654
|
+
});
|
|
655
|
+
dispatch({
|
|
656
|
+
type: "SET_DESCRIPTIONS_INPUTS",
|
|
657
|
+
payload: descriptionsActiveRetailer
|
|
658
|
+
});
|
|
659
|
+
dispatch({
|
|
660
|
+
type: "SET_IMAGES_VALUES",
|
|
661
|
+
payload: (0, _objectSpread5.default)((0, _objectSpread5.default)({}, services[2]), {}, {
|
|
662
|
+
values: filteredValues
|
|
663
|
+
})
|
|
664
|
+
}); // Calcular campos requeridos sin valor
|
|
665
|
+
|
|
666
|
+
dispatch({
|
|
667
|
+
type: "SET_MISSING_REQUIRED_FIELDS",
|
|
668
|
+
payload: (0, _utils.calculateRequiredNull)(services, servicesDataRes, id_retailer)
|
|
669
|
+
}); // Auditable
|
|
670
|
+
|
|
671
|
+
if (auditableVersion && id_retailer) {
|
|
672
|
+
loadAuditableData();
|
|
673
|
+
}
|
|
957
674
|
|
|
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))]);
|
|
675
|
+
_context4.next = 42;
|
|
676
|
+
break;
|
|
969
677
|
|
|
970
|
-
case
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
678
|
+
case 38:
|
|
679
|
+
_context4.prev = 38;
|
|
680
|
+
_context4.t0 = _context4["catch"](2);
|
|
681
|
+
console.log("Error loading data: ", _context4.t0);
|
|
682
|
+
dispatch({
|
|
683
|
+
type: "SET_ERRORS",
|
|
684
|
+
payload: [_context4.t0.message]
|
|
685
|
+
});
|
|
975
686
|
|
|
976
|
-
|
|
687
|
+
case 42:
|
|
688
|
+
_context4.prev = 42;
|
|
689
|
+
dispatch({
|
|
690
|
+
type: "SET_LOADING",
|
|
691
|
+
payload: false
|
|
977
692
|
});
|
|
978
|
-
|
|
979
|
-
setComments(comments);
|
|
693
|
+
return _context4.finish(42);
|
|
980
694
|
|
|
981
|
-
case
|
|
695
|
+
case 45:
|
|
982
696
|
case "end":
|
|
983
|
-
return
|
|
697
|
+
return _context4.stop();
|
|
984
698
|
}
|
|
985
699
|
}
|
|
986
|
-
},
|
|
700
|
+
}, _callee4, null, [[2, 38, 42, 45]]);
|
|
987
701
|
}));
|
|
988
702
|
|
|
989
|
-
return function
|
|
990
|
-
return
|
|
703
|
+
return function loadData() {
|
|
704
|
+
return _ref5.apply(this, arguments);
|
|
991
705
|
};
|
|
992
706
|
}();
|
|
993
707
|
|
|
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]);
|
|
708
|
+
(0, _react.useEffect)(function () {
|
|
709
|
+
if (state.active_retailer) {
|
|
710
|
+
loadData();
|
|
711
|
+
}
|
|
712
|
+
}, [state.active_retailer]);
|
|
1042
713
|
|
|
1043
|
-
var
|
|
1044
|
-
|
|
714
|
+
var handleOnChangeCurrentImage = function handleOnChangeCurrentImage(index) {
|
|
715
|
+
if (typeof index === "number") {
|
|
716
|
+
dispatch({
|
|
717
|
+
type: "SET_CURRENT_IMAGE",
|
|
718
|
+
payload: index
|
|
719
|
+
});
|
|
720
|
+
} else if ((0, _typeof2.default)(index) === "object") {
|
|
721
|
+
dispatch({
|
|
722
|
+
type: "CHANGE_ATTR_VALUE",
|
|
723
|
+
payload: index
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
};
|
|
1045
727
|
|
|
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
|
-
}
|
|
728
|
+
var handleOnShowModalGallery = function handleOnShowModalGallery() {
|
|
729
|
+
dispatch({
|
|
730
|
+
type: "SET_ACTIVE_TAB",
|
|
731
|
+
payload: "Imágenes"
|
|
1086
732
|
});
|
|
733
|
+
setShowModal(true);
|
|
1087
734
|
};
|
|
1088
735
|
|
|
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
|
|
736
|
+
var handleOnChangeActiveRetailer = function handleOnChangeActiveRetailer(retailer) {
|
|
737
|
+
dispatch({
|
|
738
|
+
type: "SET_ACTIVE_RETAILER",
|
|
739
|
+
payload: retailer
|
|
1117
740
|
});
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
var thumbs = function thumbs() {
|
|
1121
|
-
var _images$imageType, _images$imagePackagin, _images$imageShotType, _images$values;
|
|
741
|
+
};
|
|
1122
742
|
|
|
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);
|
|
743
|
+
var handleOnChangeActiveTab = function handleOnChangeActiveTab(tab) {
|
|
744
|
+
dispatch({
|
|
745
|
+
type: "SET_ACTIVE_TAB",
|
|
746
|
+
payload: tab
|
|
1161
747
|
});
|
|
1162
748
|
};
|
|
1163
749
|
|
|
1164
|
-
var
|
|
1165
|
-
|
|
1166
|
-
|
|
750
|
+
var handleOnToggleImageLayout = function handleOnToggleImageLayout() {
|
|
751
|
+
setImageLayout(!imageLayout);
|
|
752
|
+
};
|
|
1167
753
|
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
case 0:
|
|
1172
|
-
dataClean = updatedDescriptions.filter(function (f) {
|
|
1173
|
-
return f.value !== "";
|
|
1174
|
-
});
|
|
754
|
+
var handleOnToggleObservation = function handleOnToggleObservation() {
|
|
755
|
+
setObservationVisible(!isObservationVisible);
|
|
756
|
+
};
|
|
1175
757
|
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
}
|
|
758
|
+
var handleOnHideObservation = function handleOnHideObservation() {
|
|
759
|
+
setObservationVisible(false);
|
|
760
|
+
};
|
|
1180
761
|
|
|
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
|
-
});
|
|
762
|
+
var isAuditorAssigned = function isAuditorAssigned() {
|
|
763
|
+
var _state$product5;
|
|
1196
764
|
|
|
1197
|
-
|
|
1198
|
-
|
|
765
|
+
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);
|
|
766
|
+
};
|
|
1199
767
|
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
break;
|
|
1203
|
-
}
|
|
768
|
+
var isUserAssignedToService = function isUserAssignedToService(tab, rol) {
|
|
769
|
+
var _state$product6;
|
|
1204
770
|
|
|
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();
|
|
1214
|
-
|
|
1215
|
-
case 21:
|
|
1216
|
-
_context11.next = 26;
|
|
1217
|
-
break;
|
|
771
|
+
var concept = (0, _utils.getConceptByTab)(state.active_tab);
|
|
772
|
+
var allowedRoles = [1, 4, 5, 6, 7, 8];
|
|
773
|
+
var validUser = allowedRoles.includes(user === null || user === void 0 ? void 0 : user.id_role); // Determinar rol por defecto si no se pasa
|
|
1218
774
|
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
775
|
+
if (!rol) {
|
|
776
|
+
if (user.id_role === 4 || user.id_role === 5) {
|
|
777
|
+
rol = "facilitator";
|
|
778
|
+
} else if (user.id_role === 7 || user.id_role === 8) {
|
|
779
|
+
rol = "especialist";
|
|
780
|
+
}
|
|
781
|
+
}
|
|
1223
782
|
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
783
|
+
var isAdmin = user.id_role === 1;
|
|
784
|
+
var idUserAssigned = (_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6["id_".concat(concept, "_").concat(rol)];
|
|
785
|
+
var isAssigned = idUserAssigned === user.id_user;
|
|
786
|
+
return isAdmin || isAssigned && validUser;
|
|
787
|
+
};
|
|
1228
788
|
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
return _context11.stop();
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
}, _callee11, null, [[7, 23, 26, 29]]);
|
|
1235
|
-
}));
|
|
789
|
+
var canShowSingleEvaluationButtons = function canShowSingleEvaluationButtons(action) {
|
|
790
|
+
var _state$services_data, _state$services_data$, _state$services_data$2;
|
|
1236
791
|
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
792
|
+
var concept = (0, _utils.getConceptByTab)(action || state.active_tab);
|
|
793
|
+
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) {
|
|
794
|
+
var _state$active_retaile2;
|
|
795
|
+
|
|
796
|
+
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;
|
|
797
|
+
})) === 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(/.*\//, "");
|
|
798
|
+
var adminFacilitatorCanEvaluate = retailerStatus === "IE" && [1, 4, 5].includes(user.id_role);
|
|
799
|
+
var adminAuditorCanEvaluate = ["AC", "RP", "RCA", "SAC"].includes(retailerStatus) && [1, 6].includes(user.id_role);
|
|
800
|
+
return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
var canShowBulkEvaluationButtons = function canShowBulkEvaluationButtons() {
|
|
804
|
+
var concepts = (0, _utils.getConceptsByRole)(user.id_role);
|
|
805
|
+
var services = state.services_data.filter(function (_ref7) {
|
|
806
|
+
var service = _ref7.service;
|
|
807
|
+
return concepts.includes(service);
|
|
808
|
+
});
|
|
809
|
+
var adminFacilitatorCanEvaluate = services.every(function (srv) {
|
|
810
|
+
var _srv$status;
|
|
811
|
+
|
|
812
|
+
return (srv === null || srv === void 0 ? void 0 : (_srv$status = srv.status) === null || _srv$status === void 0 ? void 0 : _srv$status.replace(/.*\//, "")) === "IE";
|
|
813
|
+
}) && [1, 4, 5].includes(user.id_role);
|
|
814
|
+
var adminAuditorCanEvaluate = state.services_data.every(function (srv) {
|
|
815
|
+
var _srv$status2;
|
|
816
|
+
|
|
817
|
+
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(/.*\//, ""));
|
|
818
|
+
}) && [1, 6].includes(user.id_role);
|
|
819
|
+
return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
|
|
820
|
+
};
|
|
821
|
+
|
|
822
|
+
var getStatusByCurrentServiceAndRetailer = function getStatusByCurrentServiceAndRetailer() {
|
|
823
|
+
var _statusByRetailer$fil;
|
|
824
|
+
|
|
825
|
+
var statusByRetailer = state.product.statusByRetailer;
|
|
826
|
+
if (!statusByRetailer) return "-";
|
|
827
|
+
var currentService = (0, _utils.getConceptByTab)(state.active_tab);
|
|
828
|
+
var currentRetailer = state.active_retailer.id_retailer;
|
|
829
|
+
var currentStatus = ((_statusByRetailer$fil = statusByRetailer.filter(function (item) {
|
|
830
|
+
return item.retailer_id === currentRetailer && item.service === currentService;
|
|
831
|
+
})[0]) === null || _statusByRetailer$fil === void 0 ? void 0 : _statusByRetailer$fil.status) || "-";
|
|
832
|
+
return currentStatus;
|
|
833
|
+
};
|
|
1241
834
|
|
|
1242
|
-
var
|
|
1243
|
-
var
|
|
1244
|
-
var dataClean, _product$article17, productTemp, articleId, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
|
|
835
|
+
var handleOnClickSaveImages = function handleOnClickSaveImages() {
|
|
836
|
+
var _state$product7, _state$product7$servi;
|
|
1245
837
|
|
|
1246
|
-
|
|
838
|
+
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) {
|
|
839
|
+
saveImageAttrs(token);
|
|
840
|
+
}
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
var handleOnClickSave = /*#__PURE__*/function () {
|
|
844
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
845
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
1247
846
|
while (1) {
|
|
1248
|
-
switch (
|
|
847
|
+
switch (_context5.prev = _context5.next) {
|
|
1249
848
|
case 0:
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
});
|
|
1253
|
-
|
|
1254
|
-
if (!(dataClean.length > 0)) {
|
|
1255
|
-
_context12.next = 29;
|
|
849
|
+
if (!state.saving) {
|
|
850
|
+
_context5.next = 2;
|
|
1256
851
|
break;
|
|
1257
852
|
}
|
|
1258
853
|
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
854
|
+
return _context5.abrupt("return");
|
|
855
|
+
|
|
856
|
+
case 2:
|
|
857
|
+
_context5.t0 = state.active_tab;
|
|
858
|
+
_context5.next = _context5.t0 === "Descripción" ? 5 : _context5.t0 === "Ficha técnica" ? 8 : _context5.t0 === "Imágenes" ? 11 : 14;
|
|
859
|
+
break;
|
|
860
|
+
|
|
861
|
+
case 5:
|
|
862
|
+
_context5.next = 7;
|
|
863
|
+
return saveDescriptions(token);
|
|
864
|
+
|
|
865
|
+
case 7:
|
|
866
|
+
return _context5.abrupt("break", 15);
|
|
867
|
+
|
|
868
|
+
case 8:
|
|
869
|
+
_context5.next = 10;
|
|
870
|
+
return saveDatasheets(token);
|
|
1274
871
|
|
|
1275
872
|
case 10:
|
|
1276
|
-
|
|
873
|
+
return _context5.abrupt("break", 15);
|
|
1277
874
|
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
}
|
|
875
|
+
case 11:
|
|
876
|
+
_context5.next = 13;
|
|
877
|
+
return updateImages(token);
|
|
1282
878
|
|
|
1283
|
-
|
|
1284
|
-
|
|
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();
|
|
1292
|
-
|
|
1293
|
-
case 21:
|
|
1294
|
-
_context12.next = 26;
|
|
1295
|
-
break;
|
|
879
|
+
case 13:
|
|
880
|
+
return _context5.abrupt("break", 15);
|
|
1296
881
|
|
|
1297
|
-
case
|
|
1298
|
-
|
|
1299
|
-
_context12.t0 = _context12["catch"](7);
|
|
1300
|
-
console.log(_context12.t0);
|
|
882
|
+
case 14:
|
|
883
|
+
return _context5.abrupt("break", 15);
|
|
1301
884
|
|
|
1302
|
-
case
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
return _context12.finish(26);
|
|
885
|
+
case 15:
|
|
886
|
+
_context5.next = 17;
|
|
887
|
+
return loadData(false);
|
|
1306
888
|
|
|
1307
|
-
case
|
|
889
|
+
case 17:
|
|
1308
890
|
case "end":
|
|
1309
|
-
return
|
|
891
|
+
return _context5.stop();
|
|
1310
892
|
}
|
|
1311
893
|
}
|
|
1312
|
-
},
|
|
894
|
+
}, _callee5);
|
|
1313
895
|
}));
|
|
1314
896
|
|
|
1315
|
-
return function
|
|
1316
|
-
return
|
|
897
|
+
return function handleOnClickSave() {
|
|
898
|
+
return _ref8.apply(this, arguments);
|
|
1317
899
|
};
|
|
1318
900
|
}();
|
|
1319
901
|
|
|
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
|
-
};
|
|
902
|
+
var handleOnSetUpdatedDescriptions = function handleOnSetUpdatedDescriptions(items) {
|
|
903
|
+
dispatch({
|
|
904
|
+
type: "SET_UPDATED_DESCRIPTIONS_INPUTS",
|
|
905
|
+
payload: items
|
|
1334
906
|
});
|
|
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;
|
|
907
|
+
};
|
|
1414
908
|
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
909
|
+
var handleOnSetUpdatedDatasheets = function handleOnSetUpdatedDatasheets(items) {
|
|
910
|
+
dispatch({
|
|
911
|
+
type: "SET_UPDATED_DATASHEETS_INPUTS",
|
|
912
|
+
payload: items
|
|
913
|
+
});
|
|
914
|
+
};
|
|
1421
915
|
|
|
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();
|
|
916
|
+
var handleOnAskToDeleteImages = function handleOnAskToDeleteImages() {
|
|
917
|
+
if (state.selected_images.length === 0) {
|
|
918
|
+
dispatch({
|
|
919
|
+
type: "SET_MODAL",
|
|
920
|
+
payload: {
|
|
921
|
+
show: true,
|
|
922
|
+
title: "Eliminar imágenes",
|
|
923
|
+
message: "No has seleccionado ninguna imagen para eliminar.",
|
|
924
|
+
image: _genericModalWarning.default
|
|
1466
925
|
}
|
|
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;
|
|
926
|
+
});
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
1486
929
|
|
|
1487
|
-
|
|
1488
|
-
|
|
930
|
+
dispatch({
|
|
931
|
+
type: "SET_MODAL",
|
|
932
|
+
payload: {
|
|
933
|
+
show: true,
|
|
934
|
+
title: "Eliminar imágenes",
|
|
935
|
+
message: "¿Estás seguro de que deseas eliminar las imágenes seleccionadas?",
|
|
936
|
+
image: _genericModalWarning.default,
|
|
937
|
+
buttons: [{
|
|
938
|
+
text: "Cancelar",
|
|
939
|
+
buttonType: "general-white-button",
|
|
940
|
+
action: function action() {
|
|
941
|
+
return dispatch({
|
|
942
|
+
type: "SET_MODAL",
|
|
943
|
+
payload: {
|
|
944
|
+
show: false
|
|
945
|
+
}
|
|
1489
946
|
});
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
947
|
+
}
|
|
948
|
+
}, {
|
|
949
|
+
text: "Eliminar",
|
|
950
|
+
buttonType: "general-button-default",
|
|
951
|
+
action: function action() {
|
|
952
|
+
dispatch({
|
|
953
|
+
type: "SET_MODAL",
|
|
954
|
+
payload: {
|
|
955
|
+
show: false
|
|
1495
956
|
}
|
|
1496
957
|
});
|
|
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
|
-
}
|
|
958
|
+
deleteImages(token);
|
|
959
|
+
}
|
|
960
|
+
}]
|
|
1529
961
|
}
|
|
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
962
|
});
|
|
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
963
|
};
|
|
1572
964
|
|
|
1573
|
-
var
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
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
|
-
};
|
|
1598
|
-
|
|
1599
|
-
var approveRejectAllButtons = function approveRejectAllButtons() {
|
|
1600
|
-
var concepts = [];
|
|
1601
|
-
|
|
1602
|
-
switch (user.id_role) {
|
|
1603
|
-
case 4:
|
|
1604
|
-
concepts = ["description", "datasheet"];
|
|
1605
|
-
break;
|
|
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;
|
|
965
|
+
var handleOnApproveSingleService = /*#__PURE__*/function () {
|
|
966
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
967
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
968
|
+
while (1) {
|
|
969
|
+
switch (_context6.prev = _context6.next) {
|
|
970
|
+
case 0:
|
|
971
|
+
_context6.next = 2;
|
|
972
|
+
return sendSingleEvaluation("A");
|
|
1622
973
|
|
|
1623
|
-
|
|
1624
|
-
|
|
974
|
+
case 2:
|
|
975
|
+
case "end":
|
|
976
|
+
return _context6.stop();
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
}, _callee6);
|
|
980
|
+
}));
|
|
1625
981
|
|
|
1626
|
-
|
|
1627
|
-
|
|
982
|
+
return function handleOnApproveSingleService() {
|
|
983
|
+
return _ref9.apply(this, arguments);
|
|
984
|
+
};
|
|
985
|
+
}();
|
|
1628
986
|
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
|
|
987
|
+
var handleOnRejectSingleService = function handleOnRejectSingleService() {
|
|
988
|
+
setShowRejectModal(true);
|
|
1632
989
|
};
|
|
1633
990
|
|
|
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
|
-
};
|
|
991
|
+
var sendSingleEvaluation = /*#__PURE__*/function () {
|
|
992
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(result) {
|
|
993
|
+
var _state$product$id_ord, _state$active_retaile3;
|
|
1652
994
|
|
|
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;
|
|
995
|
+
var concept, articleId, orderId, sectionStatusKey, evalStatus, retailerId, data, res, message, icon, activeTab, newStatuses, serviceStatus, articleStatus, updatedStatusByRetailer, updatedProduct, specialistDone, _objectSpread2, _state$services_data2, _JSON$parse2, newStatus, newOrderStatus, newArticleStatus, _articleStatus, _updatedProduct, updatedServicesData, sessionProduct, _objectSpread3, productInSession, updatedProductInSession;
|
|
1656
996
|
|
|
1657
|
-
return _regenerator.default.wrap(function
|
|
997
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1658
998
|
while (1) {
|
|
1659
|
-
switch (
|
|
999
|
+
switch (_context7.prev = _context7.next) {
|
|
1660
1000
|
case 0:
|
|
1661
|
-
if (!
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1001
|
+
if (!state.saving) {
|
|
1002
|
+
_context7.next = 2;
|
|
1003
|
+
break;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
return _context7.abrupt("return");
|
|
1007
|
+
|
|
1008
|
+
case 2:
|
|
1009
|
+
dispatch({
|
|
1010
|
+
type: "SET_SAVING",
|
|
1011
|
+
payload: true
|
|
1012
|
+
});
|
|
1013
|
+
concept = (0, _utils.getConceptByTab)(state.active_tab);
|
|
1014
|
+
articleId = state.product.id_article;
|
|
1015
|
+
orderId = (_state$product$id_ord = state.product.id_order) !== null && _state$product$id_ord !== void 0 ? _state$product$id_ord : state.product.orderId;
|
|
1016
|
+
sectionStatusKey = "".concat(concept, "_status");
|
|
1017
|
+
evalStatus = state.product[sectionStatusKey];
|
|
1018
|
+
retailerId = (_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer;
|
|
1668
1019
|
data = {
|
|
1669
1020
|
articleId: articleId,
|
|
1670
1021
|
orderId: orderId,
|
|
1671
1022
|
concept: concept,
|
|
1672
1023
|
evalStatus: evalStatus,
|
|
1673
|
-
retailerId:
|
|
1024
|
+
retailerId: retailerId
|
|
1674
1025
|
};
|
|
1026
|
+
activeTab = state.active_tab;
|
|
1027
|
+
_context7.prev = 11;
|
|
1675
1028
|
|
|
1676
1029
|
if (!result) {
|
|
1677
|
-
|
|
1030
|
+
_context7.next = 28;
|
|
1678
1031
|
break;
|
|
1679
1032
|
}
|
|
1680
1033
|
|
|
1681
1034
|
data.result = result;
|
|
1682
|
-
|
|
1035
|
+
data.retailerId = retailerId;
|
|
1036
|
+
_context7.next = 17;
|
|
1683
1037
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1684
1038
|
headers: {
|
|
1685
1039
|
Authorization: token
|
|
1686
1040
|
}
|
|
1687
1041
|
});
|
|
1688
1042
|
|
|
1689
|
-
case
|
|
1690
|
-
res =
|
|
1691
|
-
|
|
1692
|
-
|
|
1043
|
+
case 17:
|
|
1044
|
+
res = _context7.sent;
|
|
1045
|
+
newStatuses = JSON.parse(res.data.body);
|
|
1046
|
+
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")];
|
|
1047
|
+
articleStatus = newStatuses.newArticleStatus[articleId];
|
|
1048
|
+
console.log({
|
|
1049
|
+
newStatuses: newStatuses
|
|
1050
|
+
}); // Actualizar el producto con los nuevos estados
|
|
1051
|
+
|
|
1052
|
+
updatedStatusByRetailer = state.product.statusByRetailer.map(function (item) {
|
|
1053
|
+
return item.retailer_id === retailerId && item.service === concept ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
|
|
1054
|
+
status: serviceStatus
|
|
1055
|
+
}) : item;
|
|
1056
|
+
});
|
|
1057
|
+
updatedProduct = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1058
|
+
statusByRetailer: updatedStatusByRetailer // version_status: articleStatus,
|
|
1059
|
+
// status: articleStatus,
|
|
1060
|
+
// article_status: articleStatus
|
|
1061
|
+
|
|
1062
|
+
});
|
|
1063
|
+
dispatch({
|
|
1064
|
+
type: "SET_PRODUCT",
|
|
1065
|
+
payload: updatedProduct
|
|
1066
|
+
}); // Mostrar modal de éxito
|
|
1067
|
+
|
|
1068
|
+
dispatch({
|
|
1069
|
+
type: "SET_MODAL",
|
|
1070
|
+
payload: {
|
|
1071
|
+
show: true,
|
|
1072
|
+
title: "",
|
|
1073
|
+
message: result === "A" ? "Aprobado con éxito" : "Rechazado con éxito",
|
|
1074
|
+
image: _genericModalCheck.default
|
|
1075
|
+
}
|
|
1076
|
+
});
|
|
1077
|
+
_context7.next = 33;
|
|
1693
1078
|
break;
|
|
1694
1079
|
|
|
1695
|
-
case
|
|
1080
|
+
case 28:
|
|
1081
|
+
//Caso del botón "Enviar evaluación"
|
|
1082
|
+
//Se construye el mensaje y se actualiza el estatus
|
|
1696
1083
|
specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
|
|
1697
1084
|
|
|
1698
1085
|
if (specialistDone) {
|
|
1699
|
-
|
|
1700
|
-
|
|
1086
|
+
message = "".concat(activeTab, " enviada a facilitador");
|
|
1087
|
+
icon = activeTab === "Descripción" ? _descriptionSent.default : activeTab === "Ficha técnica" ? _attributesSent.default : _uploadingImages.default;
|
|
1701
1088
|
} else if (["IE", "AC", "RP", "RCA"].includes(evalStatus)) {
|
|
1702
|
-
|
|
1703
|
-
|
|
1089
|
+
message = "Evaluación enviada";
|
|
1090
|
+
icon = _genericModalCheck.default;
|
|
1704
1091
|
}
|
|
1705
1092
|
|
|
1706
|
-
|
|
1093
|
+
_context7.next = 32;
|
|
1707
1094
|
return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1708
1095
|
headers: {
|
|
1709
1096
|
Authorization: token
|
|
1710
1097
|
}
|
|
1711
1098
|
});
|
|
1712
1099
|
|
|
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();
|
|
1747
|
-
|
|
1748
|
-
case 31:
|
|
1749
|
-
if (_message) setMessage(_message);
|
|
1750
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1751
|
-
setProduct(productTemp);
|
|
1752
|
-
|
|
1753
|
-
case 34:
|
|
1754
|
-
_context15.next = 40;
|
|
1755
|
-
break;
|
|
1756
|
-
|
|
1757
|
-
case 36:
|
|
1758
|
-
_context15.prev = 36;
|
|
1759
|
-
_context15.t0 = _context15["catch"](1);
|
|
1760
|
-
setLoading(false);
|
|
1761
|
-
console.log(_context15.t0);
|
|
1762
|
-
|
|
1763
|
-
case 40:
|
|
1764
|
-
case "end":
|
|
1765
|
-
return _context15.stop();
|
|
1766
|
-
}
|
|
1767
|
-
}
|
|
1768
|
-
}, _callee15, null, [[1, 36]]);
|
|
1769
|
-
}));
|
|
1100
|
+
case 32:
|
|
1101
|
+
res = _context7.sent;
|
|
1770
1102
|
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1103
|
+
case 33:
|
|
1104
|
+
if (res.data.statusCode === 200) {
|
|
1105
|
+
_JSON$parse2 = JSON.parse(res.data.body), newStatus = _JSON$parse2.newStatus, newOrderStatus = _JSON$parse2.newOrderStatus, newArticleStatus = _JSON$parse2.newArticleStatus;
|
|
1106
|
+
_articleStatus = newArticleStatus[articleId];
|
|
1107
|
+
console.log({
|
|
1108
|
+
newArticleStatus: newArticleStatus
|
|
1109
|
+
}); // const retailers = state.product.categoryRetailer.map((r) => ({
|
|
1110
|
+
// id: r.id_retailer,
|
|
1111
|
+
// name: r.retailerName,
|
|
1112
|
+
// }));
|
|
1113
|
+
// const messageToChat = createMessage(
|
|
1114
|
+
// retailers,
|
|
1115
|
+
// retailerId,
|
|
1116
|
+
// evalStatus,
|
|
1117
|
+
// newStatus,
|
|
1118
|
+
// activeTab,
|
|
1119
|
+
// );
|
|
1120
|
+
// const messageData = {
|
|
1121
|
+
// paramsBody: {
|
|
1122
|
+
// id: articleId,
|
|
1123
|
+
// version: state.product.version,
|
|
1124
|
+
// items: [{ type: "status", value: messageToChat }],
|
|
1125
|
+
// retailerId: retailerId,
|
|
1126
|
+
// status: state.product.status,
|
|
1127
|
+
// },
|
|
1128
|
+
// paramsHeader: { Authorization: token },
|
|
1129
|
+
// };
|
|
1130
|
+
// await sendMessage(messageData);
|
|
1131
|
+
|
|
1132
|
+
_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) {
|
|
1133
|
+
if (item.retailer_id === retailerId && item.service === concept) {
|
|
1134
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
|
|
1135
|
+
status: newStatus
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1775
1138
|
|
|
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);
|
|
1139
|
+
return item;
|
|
1140
|
+
})), _objectSpread2)); //Actualizamos el services_data en el servicio específico del retailer actual
|
|
1780
1141
|
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1142
|
+
updatedServicesData = (_state$services_data2 = state.services_data) === null || _state$services_data2 === void 0 ? void 0 : _state$services_data2.map(function (service) {
|
|
1143
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, service), {}, {
|
|
1144
|
+
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
|
|
1145
|
+
});
|
|
1146
|
+
});
|
|
1147
|
+
sessionProduct = sessionStorage.getItem("productSelected");
|
|
1148
|
+
|
|
1149
|
+
if (sessionProduct) {
|
|
1150
|
+
productInSession = JSON.parse(sessionProduct);
|
|
1151
|
+
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) {
|
|
1152
|
+
if (item.retailer_id === retailerId && item.service === concept) {
|
|
1153
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
|
|
1154
|
+
status: newStatus
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1794
1157
|
|
|
1795
|
-
|
|
1796
|
-
|
|
1158
|
+
return item;
|
|
1159
|
+
})), _objectSpread3));
|
|
1160
|
+
sessionStorage.setItem("productSelected", JSON.stringify(updatedProductInSession));
|
|
1161
|
+
}
|
|
1797
1162
|
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1163
|
+
if (message) {
|
|
1164
|
+
dispatch({
|
|
1165
|
+
type: "SET_MODAL",
|
|
1166
|
+
payload: {
|
|
1167
|
+
show: true,
|
|
1168
|
+
title: "",
|
|
1169
|
+
message: message,
|
|
1170
|
+
image: _genericModalCheck.default
|
|
1171
|
+
}
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1801
1174
|
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1175
|
+
dispatch({
|
|
1176
|
+
type: "SET_PRODUCT",
|
|
1177
|
+
payload: _updatedProduct
|
|
1178
|
+
});
|
|
1179
|
+
dispatch({
|
|
1180
|
+
type: "SET_SERVICES_DATA",
|
|
1181
|
+
payload: updatedServicesData
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1805
1184
|
|
|
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;
|
|
1185
|
+
_context7.next = 40;
|
|
1814
1186
|
break;
|
|
1815
1187
|
|
|
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
|
|
1188
|
+
case 36:
|
|
1189
|
+
_context7.prev = 36;
|
|
1190
|
+
_context7.t0 = _context7["catch"](11);
|
|
1191
|
+
console.error("Error sending evaluation:", _context7.t0);
|
|
1192
|
+
dispatch({
|
|
1193
|
+
type: "SET_MODAL",
|
|
1194
|
+
payload: {
|
|
1195
|
+
show: true,
|
|
1196
|
+
title: "Error",
|
|
1197
|
+
message: "Hubo un error al procesar la evaluación",
|
|
1198
|
+
image: _errorModal.default
|
|
1840
1199
|
}
|
|
1841
1200
|
});
|
|
1842
1201
|
|
|
1843
|
-
case
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1202
|
+
case 40:
|
|
1203
|
+
_context7.prev = 40;
|
|
1204
|
+
dispatch({
|
|
1205
|
+
type: "SET_SAVING",
|
|
1206
|
+
payload: false
|
|
1207
|
+
});
|
|
1208
|
+
return _context7.finish(40);
|
|
1850
1209
|
|
|
1851
|
-
case
|
|
1210
|
+
case 43:
|
|
1852
1211
|
case "end":
|
|
1853
|
-
return
|
|
1212
|
+
return _context7.stop();
|
|
1854
1213
|
}
|
|
1855
1214
|
}
|
|
1856
|
-
},
|
|
1215
|
+
}, _callee7, null, [[11, 36, 40, 43]]);
|
|
1857
1216
|
}));
|
|
1858
1217
|
|
|
1859
|
-
return function
|
|
1860
|
-
return
|
|
1218
|
+
return function sendSingleEvaluation(_x2) {
|
|
1219
|
+
return _ref10.apply(this, arguments);
|
|
1861
1220
|
};
|
|
1862
1221
|
}();
|
|
1863
1222
|
|
|
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;
|
|
1223
|
+
var handleOnApproveAllServices = /*#__PURE__*/function () {
|
|
1224
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
1225
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
1226
|
+
while (1) {
|
|
1227
|
+
switch (_context8.prev = _context8.next) {
|
|
1228
|
+
case 0:
|
|
1229
|
+
_context8.next = 2;
|
|
1230
|
+
return sendBulkEvaluation("A");
|
|
1891
1231
|
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1232
|
+
case 2:
|
|
1233
|
+
case "end":
|
|
1234
|
+
return _context8.stop();
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
}, _callee8);
|
|
1238
|
+
}));
|
|
1897
1239
|
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1240
|
+
return function handleOnApproveAllServices() {
|
|
1241
|
+
return _ref11.apply(this, arguments);
|
|
1242
|
+
};
|
|
1243
|
+
}();
|
|
1901
1244
|
|
|
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
|
-
}
|
|
1245
|
+
var handleOnRejectAllServices = function handleOnRejectAllServices() {
|
|
1246
|
+
setRejectAll(true);
|
|
1247
|
+
setShowRejectModal(true);
|
|
1933
1248
|
};
|
|
1934
1249
|
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1250
|
+
var sendBulkEvaluation = /*#__PURE__*/function () {
|
|
1251
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
|
|
1252
|
+
var _state$services_data3, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, updatedServicesData;
|
|
1938
1253
|
|
|
1939
|
-
|
|
1940
|
-
var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
1941
|
-
var data;
|
|
1942
|
-
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
1254
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1943
1255
|
while (1) {
|
|
1944
|
-
switch (
|
|
1256
|
+
switch (_context9.prev = _context9.next) {
|
|
1945
1257
|
case 0:
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1258
|
+
dispatch({
|
|
1259
|
+
type: "SET_SAVING",
|
|
1260
|
+
payload: true
|
|
1261
|
+
});
|
|
1262
|
+
_context9.prev = 1;
|
|
1263
|
+
evaluationArray = [];
|
|
1264
|
+
conceptArray = (0, _utils.getConceptsByRole)(user.id_role);
|
|
1265
|
+
(_state$services_data3 = state.services_data) === null || _state$services_data3 === void 0 ? void 0 : _state$services_data3.forEach(function (ret, idx) {
|
|
1266
|
+
var retailer_service = ret.service,
|
|
1267
|
+
id_retailer = ret.id_retailer,
|
|
1268
|
+
status_retailer_service = ret.status;
|
|
1269
|
+
var lastStatusLevel = status_retailer_service.replace(/.*\//, "");
|
|
1270
|
+
|
|
1271
|
+
if (conceptArray.includes(retailer_service) && statusArray !== null && statusArray !== void 0 && statusArray.includes(lastStatusLevel)) {
|
|
1272
|
+
var data = {
|
|
1273
|
+
articleId: state.product.id_article,
|
|
1274
|
+
orderId: state.product.id_order,
|
|
1275
|
+
concept: retailer_service,
|
|
1276
|
+
result: result,
|
|
1277
|
+
evalStatus: status_retailer_service,
|
|
1278
|
+
retailerId: id_retailer
|
|
1279
|
+
};
|
|
1280
|
+
evaluationArray.push(_axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1281
|
+
headers: {
|
|
1282
|
+
Authorization: token
|
|
1283
|
+
}
|
|
1284
|
+
}));
|
|
1285
|
+
}
|
|
1286
|
+
});
|
|
1287
|
+
_context9.next = 7;
|
|
1288
|
+
return Promise.all(evaluationArray);
|
|
1289
|
+
|
|
1290
|
+
case 7:
|
|
1291
|
+
status = "".concat(result, "A"); // Actualizar el statusByRetailer para todos los retailers y conceptos
|
|
1292
|
+
|
|
1293
|
+
updatedStatusByRetailer = state.product.statusByRetailer.map(function (item) {
|
|
1294
|
+
return conceptArray.includes(item.service) ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
|
|
1295
|
+
status: status
|
|
1296
|
+
}) : item;
|
|
1297
|
+
}); // Actualizar el producto con los nuevos estados
|
|
1298
|
+
|
|
1299
|
+
updatedProduct = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1300
|
+
article_status: status,
|
|
1301
|
+
status: status,
|
|
1302
|
+
datasheet_status: state.product.datasheet_status === "NA" ? "NA" : status,
|
|
1303
|
+
description_status: state.product.description_status === "NA" ? "NA" : status,
|
|
1304
|
+
images_status: state.product.images_status === "NA" ? "NA" : status,
|
|
1305
|
+
statusByRetailer: updatedStatusByRetailer
|
|
1306
|
+
});
|
|
1307
|
+
dispatch({
|
|
1308
|
+
type: "SET_PRODUCT",
|
|
1309
|
+
payload: updatedProduct
|
|
1310
|
+
});
|
|
1311
|
+
updatedServicesData = state.services_data.map(function (service) {
|
|
1312
|
+
return conceptArray.includes(service.service) ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, service), {}, {
|
|
1313
|
+
status: status
|
|
1314
|
+
}) : service;
|
|
1315
|
+
});
|
|
1316
|
+
dispatch({
|
|
1317
|
+
type: "SET_SERVICES_DATA",
|
|
1318
|
+
payload: updatedServicesData
|
|
1319
|
+
}); // sessionStorage.setItem(
|
|
1320
|
+
// "productSelected",
|
|
1321
|
+
// JSON.stringify(updatedProduct),
|
|
1322
|
+
// );
|
|
1323
|
+
// sessionStorage.setItem(
|
|
1324
|
+
// "productEdit",
|
|
1325
|
+
// JSON.stringify({
|
|
1326
|
+
// ArticleId: updatedProduct.id_article,
|
|
1327
|
+
// idCategory: updatedProduct.id_category,
|
|
1328
|
+
// product: updatedProduct,
|
|
1329
|
+
// }),
|
|
1330
|
+
// );
|
|
1331
|
+
// Mostrar modal de éxito
|
|
1332
|
+
|
|
1333
|
+
dispatch({
|
|
1334
|
+
type: "SET_MODAL",
|
|
1335
|
+
payload: {
|
|
1336
|
+
show: true,
|
|
1337
|
+
title: "",
|
|
1338
|
+
message: result === "A" ? "Todos los servicios aprobados con éxito" : "Todos los servicios rechazados con éxito",
|
|
1339
|
+
image: _genericModalCheck.default
|
|
1953
1340
|
}
|
|
1954
1341
|
});
|
|
1342
|
+
_context9.next = 19;
|
|
1343
|
+
break;
|
|
1955
1344
|
|
|
1956
|
-
case
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1345
|
+
case 16:
|
|
1346
|
+
_context9.prev = 16;
|
|
1347
|
+
_context9.t0 = _context9["catch"](1);
|
|
1348
|
+
console.error("Error in bulk evaluation:", _context9.t0);
|
|
1960
1349
|
|
|
1961
|
-
case
|
|
1350
|
+
case 19:
|
|
1351
|
+
_context9.prev = 19;
|
|
1352
|
+
dispatch({
|
|
1353
|
+
type: "SET_SAVING",
|
|
1354
|
+
payload: false
|
|
1355
|
+
});
|
|
1356
|
+
return _context9.finish(19);
|
|
1357
|
+
|
|
1358
|
+
case 22:
|
|
1962
1359
|
case "end":
|
|
1963
|
-
return
|
|
1360
|
+
return _context9.stop();
|
|
1964
1361
|
}
|
|
1965
1362
|
}
|
|
1966
|
-
},
|
|
1363
|
+
}, _callee9, null, [[1, 16, 19, 22]]);
|
|
1967
1364
|
}));
|
|
1968
1365
|
|
|
1969
|
-
return function
|
|
1970
|
-
return
|
|
1366
|
+
return function sendBulkEvaluation(_x3) {
|
|
1367
|
+
return _ref12.apply(this, arguments);
|
|
1971
1368
|
};
|
|
1972
1369
|
}();
|
|
1973
1370
|
|
|
1974
|
-
var
|
|
1975
|
-
var
|
|
1976
|
-
var
|
|
1977
|
-
|
|
1978
|
-
var concept, productTemp, data;
|
|
1979
|
-
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
1371
|
+
var handleOnChangeAssignations = /*#__PURE__*/function () {
|
|
1372
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(assignationType, assignationId) {
|
|
1373
|
+
var concept, data, updatedProduct;
|
|
1374
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1980
1375
|
while (1) {
|
|
1981
|
-
switch (
|
|
1376
|
+
switch (_context10.prev = _context10.next) {
|
|
1982
1377
|
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;
|
|
1378
|
+
concept = (0, _utils.getConceptByTab)(state.active_tab);
|
|
2003
1379
|
data = {
|
|
2004
1380
|
articleList: [{
|
|
2005
|
-
orderId: product.
|
|
2006
|
-
articleId: product
|
|
1381
|
+
orderId: state.product.id_order,
|
|
1382
|
+
articleId: state.product.id_article
|
|
2007
1383
|
}],
|
|
2008
1384
|
concept: concept,
|
|
2009
1385
|
userId: assignationId
|
|
2010
1386
|
};
|
|
2011
|
-
|
|
1387
|
+
_context10.next = 4;
|
|
2012
1388
|
return (0, _axios.default)({
|
|
2013
1389
|
method: "post",
|
|
2014
1390
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
@@ -2018,583 +1394,420 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2018
1394
|
}
|
|
2019
1395
|
});
|
|
2020
1396
|
|
|
2021
|
-
case
|
|
2022
|
-
|
|
2023
|
-
|
|
1397
|
+
case 4:
|
|
1398
|
+
updatedProduct = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, (0, _defineProperty2.default)({}, "id_".concat(concept, "_").concat(assignationType), assignationId));
|
|
1399
|
+
dispatch({
|
|
1400
|
+
type: "SET_PRODUCT",
|
|
1401
|
+
payload: updatedProduct
|
|
1402
|
+
});
|
|
2024
1403
|
|
|
2025
|
-
case
|
|
1404
|
+
case 6:
|
|
2026
1405
|
case "end":
|
|
2027
|
-
return
|
|
1406
|
+
return _context10.stop();
|
|
2028
1407
|
}
|
|
2029
1408
|
}
|
|
2030
|
-
},
|
|
1409
|
+
}, _callee10);
|
|
2031
1410
|
}));
|
|
2032
1411
|
|
|
2033
|
-
return function
|
|
2034
|
-
return
|
|
1412
|
+
return function handleOnChangeAssignations(_x4, _x5) {
|
|
1413
|
+
return _ref13.apply(this, arguments);
|
|
2035
1414
|
};
|
|
2036
1415
|
}();
|
|
2037
1416
|
|
|
2038
|
-
var
|
|
2039
|
-
|
|
1417
|
+
var handleOnSetAssignation = function handleOnSetAssignation() {
|
|
1418
|
+
console.log("handleOnSetAssignation - pendiente de implementar");
|
|
1419
|
+
};
|
|
2040
1420
|
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
1421
|
+
var handleOnSetImages = function handleOnSetImages() {
|
|
1422
|
+
console.log("handleOnSetImages - pendiente de implementar");
|
|
1423
|
+
};
|
|
1424
|
+
|
|
1425
|
+
var handleOnSetCheckAll = function handleOnSetCheckAll(isChecked) {
|
|
1426
|
+
dispatch({
|
|
1427
|
+
type: "TOGGLE_CHECK_ALL_IMAGES",
|
|
1428
|
+
payload: isChecked
|
|
2049
1429
|
});
|
|
2050
1430
|
};
|
|
2051
1431
|
|
|
2052
|
-
var
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
1432
|
+
var handleOnSetSelectedImages = function handleOnSetSelectedImages() {
|
|
1433
|
+
/*
|
|
1434
|
+
Esta función no se utiliza actualmente.
|
|
1435
|
+
En la versión anterior se usaban dos funciones distintas para el checkbox
|
|
1436
|
+
"Seleccionar todo":
|
|
1437
|
+
- Una para cambiar el valor booleano del checkbox.
|
|
1438
|
+
- Otra para actualizar el array de imágenes seleccionadas.
|
|
1439
|
+
En la versión actual se unificó la lógica en una sola función,
|
|
1440
|
+
`handleOnSetCheckAll`, que recibe el valor `true` o `false` del checkbox
|
|
1441
|
+
"Seleccionar todo" y, a partir de este, agrega o elimina todas las imágenes
|
|
1442
|
+
del array de imágenes seleccionadas.
|
|
1443
|
+
*/
|
|
1444
|
+
console.log("setSelectedImages");
|
|
1445
|
+
};
|
|
1446
|
+
|
|
1447
|
+
var handleOnSubmitComment = /*#__PURE__*/function () {
|
|
1448
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(e) {
|
|
1449
|
+
var commentText;
|
|
1450
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
2056
1451
|
while (1) {
|
|
2057
|
-
switch (
|
|
1452
|
+
switch (_context11.prev = _context11.next) {
|
|
2058
1453
|
case 0:
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
});
|
|
2065
|
-
imgsLeft = values.filter(function (value) {
|
|
2066
|
-
return selectedImages.indexOf(value) === -1;
|
|
2067
|
-
});
|
|
1454
|
+
e.preventDefault();
|
|
1455
|
+
commentText = document.querySelector("#commentary-box .ql-container .ql-editor > p").innerHTML;
|
|
1456
|
+
_context11.prev = 2;
|
|
1457
|
+
_context11.next = 5;
|
|
1458
|
+
return createComment(commentText, token);
|
|
2068
1459
|
|
|
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
|
|
1460
|
+
case 5:
|
|
1461
|
+
dispatch({
|
|
1462
|
+
type: "SET_MODAL",
|
|
1463
|
+
payload: {
|
|
1464
|
+
show: true,
|
|
1465
|
+
title: "",
|
|
1466
|
+
message: "Comentario guardado con éxito",
|
|
1467
|
+
image: _genericModalCheck.default
|
|
2084
1468
|
}
|
|
2085
1469
|
});
|
|
2086
|
-
|
|
2087
|
-
case 10:
|
|
2088
|
-
_context19.next = 15;
|
|
1470
|
+
_context11.next = 12;
|
|
2089
1471
|
break;
|
|
2090
1472
|
|
|
2091
|
-
case
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
console.
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
1473
|
+
case 8:
|
|
1474
|
+
_context11.prev = 8;
|
|
1475
|
+
_context11.t0 = _context11["catch"](2);
|
|
1476
|
+
console.error("Error saving comment:", _context11.t0);
|
|
1477
|
+
dispatch({
|
|
1478
|
+
type: "SET_MODAL",
|
|
1479
|
+
payload: {
|
|
1480
|
+
show: true,
|
|
1481
|
+
title: "Error",
|
|
1482
|
+
message: "Hubo un error al guardar el comentario",
|
|
1483
|
+
image: _errorModal.default
|
|
1484
|
+
}
|
|
2100
1485
|
});
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
})]);
|
|
2104
|
-
setLoading(false);
|
|
2105
|
-
setMessage("");
|
|
2106
|
-
setComponentsArray([]);
|
|
2107
|
-
|
|
2108
|
-
case 20:
|
|
1486
|
+
|
|
1487
|
+
case 12:
|
|
2109
1488
|
case "end":
|
|
2110
|
-
return
|
|
1489
|
+
return _context11.stop();
|
|
2111
1490
|
}
|
|
2112
1491
|
}
|
|
2113
|
-
},
|
|
1492
|
+
}, _callee11, null, [[2, 8]]);
|
|
2114
1493
|
}));
|
|
2115
1494
|
|
|
2116
|
-
return function
|
|
2117
|
-
return
|
|
1495
|
+
return function handleOnSubmitComment(_x6) {
|
|
1496
|
+
return _ref14.apply(this, arguments);
|
|
2118
1497
|
};
|
|
2119
1498
|
}();
|
|
2120
1499
|
|
|
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
|
-
}
|
|
1500
|
+
var handleOnSendEvaluationToFacilitator = function handleOnSendEvaluationToFacilitator() {
|
|
1501
|
+
sendSingleEvaluation();
|
|
2143
1502
|
};
|
|
2144
1503
|
|
|
2145
|
-
var
|
|
2146
|
-
var
|
|
2147
|
-
var concept = getConcept(tab);
|
|
2148
|
-
var retailerService = {};
|
|
1504
|
+
var isEvaluationFinished = function isEvaluationFinished(id_rol, tab, statusArray) {
|
|
1505
|
+
var _servicesByTab$find, _servicesByTab$find$s, _product$, _srv;
|
|
2149
1506
|
|
|
2150
|
-
var
|
|
2151
|
-
|
|
1507
|
+
var servicesData = state.services_data;
|
|
1508
|
+
var activeRetailer = state.active_retailer;
|
|
1509
|
+
var product = state.product;
|
|
1510
|
+
var concept = (0, _utils.getConceptByTab)(tab);
|
|
1511
|
+
var servicesByTab = servicesData === null || servicesData === void 0 ? void 0 : servicesData.filter(function (serv) {
|
|
1512
|
+
return serv.service === concept;
|
|
2152
1513
|
});
|
|
1514
|
+
var statusBySelectedRetailerService = servicesByTab === null || servicesByTab === void 0 ? void 0 : (_servicesByTab$find = servicesByTab.find(function (serv) {
|
|
1515
|
+
return serv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id_retailer);
|
|
1516
|
+
})) === 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(/.*\//, "");
|
|
1517
|
+
var currentProducStatus = product === null || product === void 0 ? void 0 : (_product$ = product["".concat(concept, "_status")]) === null || _product$ === void 0 ? void 0 : _product$.replace(/.*\//, "");
|
|
1518
|
+
var unvalidated = ["IE", "CA"].includes(currentProducStatus);
|
|
1519
|
+
var auditorUnvalidated = !["RA", "AA", "ACA", "AP"].includes(currentProducStatus);
|
|
1520
|
+
var result;
|
|
1521
|
+
|
|
1522
|
+
switch (id_rol) {
|
|
1523
|
+
case 7:
|
|
1524
|
+
case 8:
|
|
1525
|
+
var canSendEvaluation = statusArray.includes(statusBySelectedRetailerService); // const conditionTwo = statusArray.includes(product?.status);
|
|
1526
|
+
// const conditionThree =
|
|
1527
|
+
// servicesByTab.filter((service) =>
|
|
1528
|
+
// statusArray.includes(service.status?.replace(/.*\//, "")),
|
|
1529
|
+
// ).length === servicesByTab.length;
|
|
1530
|
+
// return (canSendEvaluation && conditionTwo) || conditionThree;
|
|
2153
1531
|
|
|
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
|
-
}();
|
|
1532
|
+
return canSendEvaluation;
|
|
2264
1533
|
|
|
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
|
-
});
|
|
1534
|
+
case 4:
|
|
1535
|
+
case 5:
|
|
1536
|
+
var filteredSrv45 = servicesByTab === null || servicesByTab === void 0 ? void 0 : servicesByTab.filter(function (serv) {
|
|
1537
|
+
return statusArray.includes(serv === null || serv === void 0 ? void 0 : serv.status);
|
|
1538
|
+
});
|
|
1539
|
+
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);
|
|
1540
|
+
return condition45;
|
|
2278
1541
|
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
1542
|
+
case 6:
|
|
1543
|
+
var statusInArray = statusArray.includes(product === null || product === void 0 ? void 0 : product.status);
|
|
1544
|
+
var allSrvValid = (_srv = srv) === null || _srv === void 0 ? void 0 : _srv.every(function (serv) {
|
|
1545
|
+
return ["RA", "AA", "AP", "ACA"].includes(serv === null || serv === void 0 ? void 0 : serv.status);
|
|
1546
|
+
});
|
|
1547
|
+
var condition6 = statusInArray && allSrvValid && auditorUnvalidated;
|
|
1548
|
+
return condition6;
|
|
2283
1549
|
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
}, _callee21);
|
|
2290
|
-
}));
|
|
1550
|
+
default:
|
|
1551
|
+
console.log("Default case - returning false");
|
|
1552
|
+
return false;
|
|
1553
|
+
}
|
|
1554
|
+
};
|
|
2291
1555
|
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
1556
|
+
var handleOnChangeProductVersion = function handleOnChangeProductVersion(version) {
|
|
1557
|
+
console.log('se cambia la version');
|
|
1558
|
+
dispatch({
|
|
1559
|
+
type: "SET_PRODUCT_VERSION",
|
|
1560
|
+
payload: version
|
|
1561
|
+
});
|
|
1562
|
+
loadData(true, version);
|
|
1563
|
+
};
|
|
2296
1564
|
|
|
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
|
|
1565
|
+
var ProductEditionSkeleton = function ProductEditionSkeleton() {
|
|
1566
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
1567
|
+
headerTop: 0,
|
|
1568
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1569
|
+
px: 1.5,
|
|
1570
|
+
py: 1,
|
|
1571
|
+
pb: 0,
|
|
1572
|
+
display: "flex",
|
|
1573
|
+
alignItems: "center",
|
|
1574
|
+
justifyContent: "space-between",
|
|
1575
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1576
|
+
variant: "text",
|
|
1577
|
+
width: 300,
|
|
1578
|
+
height: 40
|
|
1579
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
1580
|
+
direction: "row",
|
|
1581
|
+
spacing: 2,
|
|
1582
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1583
|
+
variant: "circular",
|
|
1584
|
+
width: 32,
|
|
1585
|
+
height: 32
|
|
1586
|
+
})
|
|
2339
1587
|
})]
|
|
2340
1588
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2341
|
-
className: "
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
setShowRejectModal(true);
|
|
2355
|
-
},
|
|
2356
|
-
showApproveRejectAll: approveRejectAllButtons() && (auditorAssigned() || userAssigned()),
|
|
2357
|
-
showValidationButtons: approveRejectButtons() && (auditorAssigned() || userAssigned()),
|
|
2358
|
-
approveAll: function approveAll() {
|
|
2359
|
-
return validateAll("A");
|
|
1589
|
+
className: "data-container",
|
|
1590
|
+
style: {
|
|
1591
|
+
display: "flex",
|
|
1592
|
+
gap: "8px",
|
|
1593
|
+
padding: "0 12px 12px"
|
|
1594
|
+
},
|
|
1595
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1596
|
+
className: "image-data-panel",
|
|
1597
|
+
style: {
|
|
1598
|
+
flex: "0 0 320px",
|
|
1599
|
+
display: "flex",
|
|
1600
|
+
flexDirection: "column",
|
|
1601
|
+
gap: "20px"
|
|
2360
1602
|
},
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
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()
|
|
1603
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1604
|
+
variant: "rounded",
|
|
1605
|
+
width: "100%",
|
|
1606
|
+
height: 400
|
|
1607
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
1608
|
+
direction: "row",
|
|
1609
|
+
spacing: 2,
|
|
1610
|
+
justifyContent: "center",
|
|
1611
|
+
children: [1, 2, 3, 4].map(function (item) {
|
|
1612
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1613
|
+
variant: "rounded",
|
|
1614
|
+
width: 60,
|
|
1615
|
+
height: 80
|
|
1616
|
+
}, item);
|
|
1617
|
+
})
|
|
1618
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
1619
|
+
mt: 2,
|
|
1620
|
+
children: [1, 2, 3, 4].map(function (item) {
|
|
1621
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1622
|
+
display: "flex",
|
|
1623
|
+
justifyContent: "space-between",
|
|
1624
|
+
py: 1,
|
|
1625
|
+
borderBottom: "1px solid #f0f0f0",
|
|
1626
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1627
|
+
variant: "text",
|
|
1628
|
+
width: "40%"
|
|
1629
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1630
|
+
variant: "text",
|
|
1631
|
+
width: "20%"
|
|
2459
1632
|
})]
|
|
2460
|
-
})
|
|
2461
|
-
})
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
1633
|
+
}, item);
|
|
1634
|
+
})
|
|
1635
|
+
})]
|
|
1636
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1637
|
+
className: "product-information",
|
|
1638
|
+
style: {
|
|
1639
|
+
flex: 1,
|
|
1640
|
+
display: "flex",
|
|
1641
|
+
flexDirection: "column",
|
|
1642
|
+
gap: "14px"
|
|
1643
|
+
},
|
|
1644
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1645
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1646
|
+
variant: "text",
|
|
1647
|
+
width: "80%",
|
|
1648
|
+
height: 50
|
|
1649
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
1650
|
+
direction: "row",
|
|
1651
|
+
spacing: 2,
|
|
1652
|
+
alignItems: "center",
|
|
1653
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1654
|
+
variant: "rounded",
|
|
1655
|
+
width: 180,
|
|
1656
|
+
height: 24
|
|
1657
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1658
|
+
variant: "rounded",
|
|
1659
|
+
width: 300,
|
|
1660
|
+
height: 24
|
|
1661
|
+
})]
|
|
2484
1662
|
})]
|
|
2485
|
-
})
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
1663
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1664
|
+
display: "flex",
|
|
1665
|
+
gap: 4,
|
|
1666
|
+
pb: 1,
|
|
1667
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1668
|
+
variant: "text",
|
|
1669
|
+
width: 140,
|
|
1670
|
+
height: 45
|
|
1671
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1672
|
+
variant: "text",
|
|
1673
|
+
width: 140,
|
|
1674
|
+
height: 45
|
|
1675
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1676
|
+
variant: "text",
|
|
1677
|
+
width: 140,
|
|
1678
|
+
height: 45
|
|
1679
|
+
})]
|
|
1680
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
1681
|
+
display: "flex",
|
|
1682
|
+
flexDirection: "column",
|
|
1683
|
+
gap: 4,
|
|
1684
|
+
children: [1, 2, 3].map(function (item) {
|
|
1685
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1686
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1687
|
+
display: "flex",
|
|
1688
|
+
justifyContent: "space-between",
|
|
1689
|
+
alignItems: "center",
|
|
1690
|
+
mb: 1,
|
|
1691
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1692
|
+
variant: "text",
|
|
1693
|
+
width: "30%",
|
|
1694
|
+
height: 24
|
|
1695
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1696
|
+
variant: "rounded",
|
|
1697
|
+
width: 175,
|
|
1698
|
+
height: 25,
|
|
1699
|
+
sx: {
|
|
1700
|
+
borderRadius: "7.5px"
|
|
2503
1701
|
}
|
|
2504
|
-
}
|
|
2505
|
-
},
|
|
2506
|
-
|
|
1702
|
+
})]
|
|
1703
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1704
|
+
variant: "rounded",
|
|
1705
|
+
width: "100%",
|
|
1706
|
+
height: 70
|
|
1707
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
1708
|
+
display: "flex",
|
|
1709
|
+
justifyContent: "flex-end",
|
|
1710
|
+
mt: 0.5,
|
|
1711
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1712
|
+
variant: "text",
|
|
1713
|
+
width: 60
|
|
1714
|
+
})
|
|
1715
|
+
})]
|
|
1716
|
+
}, item);
|
|
1717
|
+
})
|
|
1718
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1719
|
+
mt: "auto",
|
|
1720
|
+
pt: 4,
|
|
1721
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1722
|
+
variant: "rounded",
|
|
1723
|
+
width: "100%",
|
|
1724
|
+
height: 120
|
|
1725
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
1726
|
+
display: "flex",
|
|
1727
|
+
justifyContent: "flex-end",
|
|
1728
|
+
gap: 2,
|
|
1729
|
+
mt: 2,
|
|
1730
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1731
|
+
variant: "rounded",
|
|
1732
|
+
width: 180,
|
|
1733
|
+
height: 45,
|
|
1734
|
+
sx: {
|
|
1735
|
+
borderRadius: "24px"
|
|
1736
|
+
}
|
|
1737
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
1738
|
+
variant: "rounded",
|
|
1739
|
+
width: 180,
|
|
1740
|
+
height: 45,
|
|
1741
|
+
sx: {
|
|
1742
|
+
borderRadius: "24px"
|
|
1743
|
+
}
|
|
1744
|
+
})]
|
|
2507
1745
|
})]
|
|
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
1746
|
})]
|
|
2515
1747
|
})]
|
|
2516
1748
|
})]
|
|
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
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
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) {
|
|
1749
|
+
});
|
|
1750
|
+
};
|
|
1751
|
+
|
|
1752
|
+
(0, _react.useEffect)(function () {
|
|
1753
|
+
console.log({
|
|
1754
|
+
stateProduct: state.product
|
|
1755
|
+
});
|
|
1756
|
+
}, [state.product]);
|
|
1757
|
+
if (state.loading || !state.services || !state.product) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
1758
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ProductEditionSkeleton, {})
|
|
1759
|
+
});
|
|
1760
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_AiProductEdition.AiProductEditionProvider, {
|
|
1761
|
+
isCreatorsEdition: true,
|
|
1762
|
+
user: user,
|
|
1763
|
+
token: token,
|
|
1764
|
+
state: state,
|
|
1765
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
1766
|
+
headerTop: headerTop,
|
|
1767
|
+
children: [showRejectModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
|
|
1768
|
+
title: rejectAll ? "Agregar mensaje para rechazar todo" : "Agregar mensaje de rechazo",
|
|
1769
|
+
show: showRejectModal,
|
|
1770
|
+
customComponent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
|
|
1771
|
+
inputType: "textarea",
|
|
1772
|
+
inputId: "modal-message-box",
|
|
1773
|
+
index: 0,
|
|
1774
|
+
color: "white"
|
|
1775
|
+
}),
|
|
1776
|
+
buttons: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
|
|
1777
|
+
type: "white",
|
|
1778
|
+
label: "Cancelar",
|
|
1779
|
+
size: 12,
|
|
1780
|
+
onClick: function onClick() {
|
|
1781
|
+
setShowRejectModal(false);
|
|
1782
|
+
}
|
|
1783
|
+
}, "btn-Cancelar"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
|
|
1784
|
+
type: "pink",
|
|
1785
|
+
label: "Aceptar",
|
|
1786
|
+
size: 12,
|
|
1787
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1788
|
+
var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
|
|
1789
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
2567
1790
|
while (1) {
|
|
2568
|
-
switch (
|
|
1791
|
+
switch (_context12.prev = _context12.next) {
|
|
2569
1792
|
case 0:
|
|
2570
1793
|
elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
|
|
2571
1794
|
|
|
2572
1795
|
if (!(!elements || elements.length === 0)) {
|
|
2573
|
-
|
|
1796
|
+
_context12.next = 4;
|
|
2574
1797
|
break;
|
|
2575
1798
|
}
|
|
2576
1799
|
|
|
2577
1800
|
console.error("Elemento no encontrado");
|
|
2578
|
-
return
|
|
1801
|
+
return _context12.abrupt("return");
|
|
2579
1802
|
|
|
2580
1803
|
case 4:
|
|
2581
|
-
|
|
2582
|
-
elements.forEach(function (el) {
|
|
1804
|
+
isMessageEmpty = Array.from(elements).every(function (el) {
|
|
2583
1805
|
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
|
-
}
|
|
1806
|
+
return !body || body.replace(/<.*?\/?>/gm, "").trim() === "";
|
|
2594
1807
|
});
|
|
2595
1808
|
|
|
2596
|
-
if (!
|
|
2597
|
-
|
|
1809
|
+
if (!isMessageEmpty) {
|
|
1810
|
+
_context12.next = 10;
|
|
2598
1811
|
break;
|
|
2599
1812
|
}
|
|
2600
1813
|
|
|
@@ -2602,65 +1815,354 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2602
1815
|
existingAlert = container.querySelector(".alert-error");
|
|
2603
1816
|
|
|
2604
1817
|
if (!existingAlert) {
|
|
2605
|
-
|
|
2606
|
-
|
|
1818
|
+
alert = document.createElement("div");
|
|
1819
|
+
alert.className = "alert-error";
|
|
1820
|
+
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 ";
|
|
1821
|
+
alert.innerHTML = "<span>El mensaje no puede estar vac\xEDo.</span>";
|
|
1822
|
+
container.appendChild(alert);
|
|
2607
1823
|
}
|
|
2608
1824
|
|
|
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);
|
|
1825
|
+
return _context12.abrupt("return");
|
|
1826
|
+
|
|
1827
|
+
case 10:
|
|
1828
|
+
fullMessage = Array.from(elements).map(function (element) {
|
|
1829
|
+
return element.innerHTML;
|
|
1830
|
+
}).join("").replace(/<br\s*\/?>/gi, "\n");
|
|
1831
|
+
_context12.next = 13;
|
|
1832
|
+
return createComment(fullMessage, token);
|
|
2629
1833
|
|
|
2630
|
-
case
|
|
2631
|
-
|
|
2632
|
-
setMessage("Rechazado");
|
|
1834
|
+
case 13:
|
|
1835
|
+
rejectAll ? sendBulkEvaluation("R") : sendSingleEvaluation("R");
|
|
2633
1836
|
setShowRejectModal(false);
|
|
2634
1837
|
|
|
2635
|
-
case
|
|
1838
|
+
case 15:
|
|
2636
1839
|
case "end":
|
|
2637
|
-
return
|
|
1840
|
+
return _context12.stop();
|
|
2638
1841
|
}
|
|
2639
1842
|
}
|
|
2640
|
-
},
|
|
2641
|
-
}))
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
1843
|
+
}, _callee12);
|
|
1844
|
+
}))
|
|
1845
|
+
}, "btn-Aceptar")]
|
|
1846
|
+
}), state.modal.show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
|
|
1847
|
+
componentsArray: [state.modal.image && /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
1848
|
+
src: state.modal.image,
|
|
1849
|
+
alt: "modal icon"
|
|
1850
|
+
}, "1"), state.modal.title && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1851
|
+
headerType: "retailer-name-header",
|
|
1852
|
+
text: state.modal.title,
|
|
1853
|
+
color: "white"
|
|
1854
|
+
}, "2"), state.modal.message && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1855
|
+
headerType: "retailer-name-header",
|
|
1856
|
+
text: state.modal.message,
|
|
1857
|
+
color: "white"
|
|
1858
|
+
}, "3"), state.modal.buttons && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1859
|
+
style: {
|
|
1860
|
+
marginTop: "16px"
|
|
1861
|
+
},
|
|
1862
|
+
children: state.modal.buttons.map(function (button, index) {
|
|
1863
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1864
|
+
buttonType: button.buttonType,
|
|
1865
|
+
label: button.text,
|
|
1866
|
+
onClick: button.action
|
|
1867
|
+
}, index);
|
|
1868
|
+
})
|
|
1869
|
+
}, "4")].filter(Boolean),
|
|
1870
|
+
onClick: function onClick() {
|
|
1871
|
+
return dispatch({
|
|
1872
|
+
type: "SET_MODAL",
|
|
1873
|
+
payload: {
|
|
1874
|
+
show: false,
|
|
1875
|
+
title: "",
|
|
1876
|
+
message: "",
|
|
1877
|
+
image: null
|
|
1878
|
+
}
|
|
2659
1879
|
});
|
|
2660
|
-
}
|
|
2661
|
-
}
|
|
1880
|
+
}
|
|
1881
|
+
}), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImageModal.ProductImageModal, {
|
|
1882
|
+
images: state.images_values,
|
|
1883
|
+
setShowModal: setShowModal,
|
|
1884
|
+
approveRejectButtons: canShowSingleEvaluationButtons(),
|
|
1885
|
+
sendToFacilitator: handleOnSendEvaluationToFacilitator
|
|
1886
|
+
}), showVersionSelector && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VersionSelector.VersionSelector, {
|
|
1887
|
+
modalId: "version-selector",
|
|
1888
|
+
articleId: state.product.id_article,
|
|
1889
|
+
setVersion: handleOnChangeProductVersion,
|
|
1890
|
+
companyName: state.product.company,
|
|
1891
|
+
currentVersion: state.product.version,
|
|
1892
|
+
setShowVersionSelector: setShowVersionSelector,
|
|
1893
|
+
jwt: token
|
|
1894
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
1895
|
+
setHeaderTop: setHeaderTop,
|
|
1896
|
+
auditableVersion: auditableVersion,
|
|
1897
|
+
setCompare: setCompare,
|
|
1898
|
+
isAuditor: [1, 6].includes(user.id_role),
|
|
1899
|
+
withChat: location === null || location === void 0 ? void 0 : (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.withChat,
|
|
1900
|
+
chatType: location === null || location === void 0 ? void 0 : (_location$state2 = location.state) === null || _location$state2 === void 0 ? void 0 : _location$state2.chatType,
|
|
1901
|
+
productSelected: state.product,
|
|
1902
|
+
token: token,
|
|
1903
|
+
activeRetailer: {
|
|
1904
|
+
id: (_state$active_retaile4 = state.active_retailer) === null || _state$active_retaile4 === void 0 ? void 0 : _state$active_retaile4.id_retailer,
|
|
1905
|
+
name: (_state$active_retaile5 = state.active_retailer) === null || _state$active_retaile5 === void 0 ? void 0 : _state$active_retaile5.retailer
|
|
1906
|
+
}
|
|
1907
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1908
|
+
className: "data-container",
|
|
1909
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1910
|
+
className: "image-data-panel",
|
|
1911
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagePreviewer.ImagePreviewer, {
|
|
1912
|
+
activeImage: (_state$images_values$2 = state.images_values.values[state.current_image]) !== null && _state$images_values$2 !== void 0 ? _state$images_values$2 : {},
|
|
1913
|
+
imagesArray: state.images_values || [],
|
|
1914
|
+
setActiveImage: handleOnChangeCurrentImage,
|
|
1915
|
+
setShowModal: handleOnShowModalGallery
|
|
1916
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageDataTable.ImageDataTable // states
|
|
1917
|
+
, {
|
|
1918
|
+
lists: state.images_values || [],
|
|
1919
|
+
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] : {},
|
|
1920
|
+
assignationsImages: state.collaborator_assignations["Imágenes"],
|
|
1921
|
+
imagesStatus: ((_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8.images_status) || "-",
|
|
1922
|
+
retailerSelected: (_state$active_retaile6 = state.active_retailer) === null || _state$active_retaile6 === void 0 ? void 0 : _state$active_retaile6.id_retailer,
|
|
1923
|
+
isRetailer: isRetailer,
|
|
1924
|
+
version: state.product.version,
|
|
1925
|
+
shotThd: shotThd,
|
|
1926
|
+
setShowVersionSelector: setShowVersionSelector // actions
|
|
1927
|
+
,
|
|
1928
|
+
setImages: handleOnChangeCurrentImage,
|
|
1929
|
+
setAssignation: handleOnChangeAssignations // No se usa?
|
|
1930
|
+
,
|
|
1931
|
+
onClickSave: handleOnClickSaveImages,
|
|
1932
|
+
showSaveButton: isAuditorAssigned() || isUserAssignedToService()
|
|
1933
|
+
})]
|
|
1934
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1935
|
+
className: "product-information",
|
|
1936
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader // states
|
|
1937
|
+
, {
|
|
1938
|
+
headerData: state.product,
|
|
1939
|
+
productObservation: observation,
|
|
1940
|
+
percent: state.active_percentage.percentagesGeneral.required,
|
|
1941
|
+
activeRetailer: {
|
|
1942
|
+
id: (_state$active_retaile7 = state.active_retailer) === null || _state$active_retaile7 === void 0 ? void 0 : _state$active_retaile7.id_retailer,
|
|
1943
|
+
name: (_state$active_retaile8 = state.active_retailer) === null || _state$active_retaile8 === void 0 ? void 0 : _state$active_retaile8.retailer,
|
|
1944
|
+
image: (_state$active_retaile9 = state.active_retailer) === null || _state$active_retaile9 === void 0 ? void 0 : _state$active_retaile9.image
|
|
1945
|
+
},
|
|
1946
|
+
servicesData: state.services_data ? state.services_data : null,
|
|
1947
|
+
isObservationVisible: isObservationVisible // actions
|
|
1948
|
+
,
|
|
1949
|
+
setActiveRetailer: handleOnChangeActiveRetailer,
|
|
1950
|
+
approve: handleOnApproveSingleService,
|
|
1951
|
+
approveAll: handleOnApproveAllServices,
|
|
1952
|
+
reject: handleOnRejectSingleService,
|
|
1953
|
+
rejectAll: handleOnRejectAllServices,
|
|
1954
|
+
toggleObservation: handleOnToggleObservation,
|
|
1955
|
+
hideObservation: handleOnHideObservation // sendToFacilitator={handleOnSendEvaluationToFacilitator} // No se usa?
|
|
1956
|
+
// validations
|
|
1957
|
+
,
|
|
1958
|
+
showApproveRejectAll: canShowBulkEvaluationButtons() || isAuditorAssigned() || isUserAssignedToService(),
|
|
1959
|
+
showValidationButtons: canShowSingleEvaluationButtons() && (isAuditorAssigned() || isUserAssignedToService())
|
|
1960
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
|
|
1961
|
+
tabsSections: tabsSections,
|
|
1962
|
+
status: getStatusByCurrentServiceAndRetailer(),
|
|
1963
|
+
activeTab: state.active_tab,
|
|
1964
|
+
isRetailer: isRetailer,
|
|
1965
|
+
assig: state.collaborator_assignations[state.active_tab],
|
|
1966
|
+
version: state.product.version,
|
|
1967
|
+
updatedDescriptions: state.updated_descriptions_inputs,
|
|
1968
|
+
updatedDatasheets: state.updated_datasheets_inputs,
|
|
1969
|
+
updatedImages: state.updated_images_values,
|
|
1970
|
+
images: state.services.images // selectedImages={selectedImages} prop pasada asi: FullTabsMenu -> TabsMenu Pero en TabsMenu no se espera ninguna prop setSelectedImages
|
|
1971
|
+
// setters
|
|
1972
|
+
,
|
|
1973
|
+
setActiveTab: handleOnChangeActiveTab,
|
|
1974
|
+
setImageLayout: handleOnToggleImageLayout,
|
|
1975
|
+
setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
|
|
1976
|
+
setUpdatedDatasheets: handleOnSetUpdatedDatasheets,
|
|
1977
|
+
setAssignation: handleOnSetAssignation // No se usa?
|
|
1978
|
+
,
|
|
1979
|
+
setImages: handleOnSetImages // No se usa?
|
|
1980
|
+
,
|
|
1981
|
+
setShowVersionSelector: setShowVersionSelector // setSelectedImages={setSelectedImages} prop pasada asi: FullTabsMenu -> TabsMenu Pero en TabsMenu no se espera ninguna prop setSelectedImages
|
|
1982
|
+
// actions
|
|
1983
|
+
,
|
|
1984
|
+
downloadImages: handleOnDownloadImages,
|
|
1985
|
+
askToDeleteImages: handleOnAskToDeleteImages,
|
|
1986
|
+
showSaveButton: isAuditorAssigned() || isUserAssignedToService(),
|
|
1987
|
+
onClickSave: handleOnClickSave // validations
|
|
1988
|
+
,
|
|
1989
|
+
canAssign: ![7, 8].includes(user.id_role)
|
|
1990
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1991
|
+
className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
|
|
1992
|
+
id: "services-information-container",
|
|
1993
|
+
children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
1994
|
+
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, {
|
|
1995
|
+
activeSection: state.active_tab,
|
|
1996
|
+
inputGroup: state.descriptions_inputs[0],
|
|
1997
|
+
updatedDescriptions: state.updated_descriptions_inputs,
|
|
1998
|
+
articleId: (_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.id_article,
|
|
1999
|
+
version: state.product.version,
|
|
2000
|
+
auditInputGroup: auditDescriptions[0],
|
|
2001
|
+
setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
|
|
2002
|
+
dinamicHeight: true,
|
|
2003
|
+
compare: compare
|
|
2004
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
2005
|
+
text: "No cuentas con este servicio",
|
|
2006
|
+
headerType: "input-name-header"
|
|
2007
|
+
})), 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, {
|
|
2008
|
+
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) {
|
|
2009
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
2010
|
+
articleId: state.product.id_article,
|
|
2011
|
+
version: state.version,
|
|
2012
|
+
activeSection: state.active_tab,
|
|
2013
|
+
inputGroup: dataGroup,
|
|
2014
|
+
dataInputs: state.datasheets_inputs[1],
|
|
2015
|
+
auditInputs: auditDatasheets[1],
|
|
2016
|
+
updatedDatasheets: state.updated_datasheets_inputs,
|
|
2017
|
+
setUpdatedDatasheets: handleOnSetUpdatedDatasheets,
|
|
2018
|
+
compare: compare
|
|
2019
|
+
}, index + "-" + state.active_retailer.retailer);
|
|
2020
|
+
})
|
|
2021
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
2022
|
+
text: "No cuentas con este servicio",
|
|
2023
|
+
headerType: "input-name-header"
|
|
2024
|
+
})), 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, {
|
|
2025
|
+
children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
|
|
2026
|
+
checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
|
|
2027
|
+
,
|
|
2028
|
+
setCheckAll: handleOnSetCheckAll // Toggler de true o false para el checkbox "Seleccionar todo"
|
|
2029
|
+
,
|
|
2030
|
+
setSelectedImages: handleOnSetSelectedImages // shotThd={shotThd} // No se usa?
|
|
2031
|
+
|
|
2032
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
|
|
2033
|
+
className: "container",
|
|
2034
|
+
style: {
|
|
2035
|
+
position: "relative"
|
|
2036
|
+
},
|
|
2037
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread5.default)((0, _objectSpread5.default)({}, getRootProps({
|
|
2038
|
+
className: "dropzone ".concat(isDragActive ? "drag-active" : "")
|
|
2039
|
+
})), {}, {
|
|
2040
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", (0, _objectSpread5.default)({}, getInputProps())), isDragActive && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
2041
|
+
className: "drag-overlay",
|
|
2042
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
2043
|
+
children: "Suelta las im\xE1genes aqu\xED"
|
|
2044
|
+
})
|
|
2045
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
|
|
2046
|
+
children: thumbs()
|
|
2047
|
+
})]
|
|
2048
|
+
})), ((_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", {
|
|
2049
|
+
style: {
|
|
2050
|
+
position: "absolute",
|
|
2051
|
+
top: "50%",
|
|
2052
|
+
left: "50%",
|
|
2053
|
+
transform: "translate(-50%, -50%)",
|
|
2054
|
+
textAlign: "center",
|
|
2055
|
+
padding: "40px",
|
|
2056
|
+
width: "80%",
|
|
2057
|
+
maxWidth: "500px",
|
|
2058
|
+
fontFamily: "Arial, sans-serif"
|
|
2059
|
+
},
|
|
2060
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
2061
|
+
style: {
|
|
2062
|
+
fontSize: "18px",
|
|
2063
|
+
color: "#666",
|
|
2064
|
+
marginBottom: "16px"
|
|
2065
|
+
},
|
|
2066
|
+
children: "Este producto no tiene im\xE1genes"
|
|
2067
|
+
}), isAuditorAssigned() || isUserAssignedToService() ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
2068
|
+
style: {
|
|
2069
|
+
fontSize: "14px",
|
|
2070
|
+
color: "#999",
|
|
2071
|
+
marginBottom: "20px"
|
|
2072
|
+
},
|
|
2073
|
+
children: ["Arrastra las im\xE1genes aqu\xED o", " ", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
2074
|
+
onClick: open,
|
|
2075
|
+
style: {
|
|
2076
|
+
color: "#007bff",
|
|
2077
|
+
cursor: "pointer",
|
|
2078
|
+
textDecoration: "underline"
|
|
2079
|
+
},
|
|
2080
|
+
children: "haz clic para abrir el explorador de archivos"
|
|
2081
|
+
})]
|
|
2082
|
+
}) : null]
|
|
2083
|
+
})]
|
|
2084
|
+
})]
|
|
2085
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
2086
|
+
text: "No cuentas con este servicio",
|
|
2087
|
+
headerType: "input-name-header"
|
|
2088
|
+
}))]
|
|
2089
|
+
})
|
|
2090
|
+
}), (isUserAssignedToService(state.active_tab) || isAuditorAssigned()) && state.product["".concat((0, _utils.getConceptByTab)(state.active_tab), "_status")] !== "NS" && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2091
|
+
className: "commentary-box",
|
|
2092
|
+
children: [!state.comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2093
|
+
className: "commentary",
|
|
2094
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
|
|
2095
|
+
label: "Caja de Comentario",
|
|
2096
|
+
inputType: "textarea",
|
|
2097
|
+
inputCols: 80,
|
|
2098
|
+
inputRows: 4,
|
|
2099
|
+
inputId: "commentary-box",
|
|
2100
|
+
index: 0
|
|
2101
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
2102
|
+
className: "buttons-box",
|
|
2103
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
2104
|
+
buttonType: "general-transparent-button",
|
|
2105
|
+
label: "Enviar comentario",
|
|
2106
|
+
onClick: handleOnSubmitComment
|
|
2107
|
+
})
|
|
2108
|
+
})]
|
|
2109
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2110
|
+
className: "feedback-box",
|
|
2111
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Commentary.Commentary, {
|
|
2112
|
+
comment: (_state$comment = state.comment) === null || _state$comment === void 0 ? void 0 : _state$comment.message,
|
|
2113
|
+
reviewed: crossComment
|
|
2114
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
2115
|
+
buttonType: "circular-button accept-button",
|
|
2116
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
2117
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
2118
|
+
while (1) {
|
|
2119
|
+
switch (_context13.prev = _context13.next) {
|
|
2120
|
+
case 0:
|
|
2121
|
+
setCrossComment(true);
|
|
2122
|
+
commentRevised();
|
|
2123
|
+
|
|
2124
|
+
case 2:
|
|
2125
|
+
case "end":
|
|
2126
|
+
return _context13.stop();
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
}, _callee13);
|
|
2130
|
+
}))
|
|
2131
|
+
})]
|
|
2132
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2133
|
+
className: "action-buttons",
|
|
2134
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
2135
|
+
buttonType: "general-pink-button",
|
|
2136
|
+
label: "Cambio de Estatus",
|
|
2137
|
+
onClick: function onClick() {
|
|
2138
|
+
return setOpenChangeStatusModal(true);
|
|
2139
|
+
},
|
|
2140
|
+
id: "button-change-status"
|
|
2141
|
+
}), [7, 8].includes(user.id_role) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
2142
|
+
buttonType: isEvaluationFinished(user.id_role, state.active_tab, statusArray) && state.missing_required_fields[state.active_tab] === 0 ? "general-green-button" : "general-button-disabled",
|
|
2143
|
+
label: "Enviar evaluación",
|
|
2144
|
+
onClick: handleOnSendEvaluationToFacilitator
|
|
2145
|
+
})]
|
|
2146
|
+
})]
|
|
2147
|
+
})]
|
|
2148
|
+
})]
|
|
2149
|
+
})]
|
|
2150
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChangeStatusModal.default, {
|
|
2151
|
+
state: state,
|
|
2152
|
+
open: openChangeStatusModal,
|
|
2153
|
+
onClose: function onClose() {
|
|
2154
|
+
setOpenChangeStatusModal(false);
|
|
2155
|
+
},
|
|
2156
|
+
reloadData: loadData,
|
|
2157
|
+
token: token
|
|
2662
2158
|
})]
|
|
2663
2159
|
});
|
|
2664
2160
|
};
|
|
2665
2161
|
|
|
2162
|
+
var RetailerProductEdition = function RetailerProductEdition(props) {
|
|
2163
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_providerProductEdition.ProviderProductEditionProvider, {
|
|
2164
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(RetailerProductEditionView, (0, _objectSpread5.default)({}, props))
|
|
2165
|
+
});
|
|
2166
|
+
};
|
|
2167
|
+
|
|
2666
2168
|
exports.RetailerProductEdition = RetailerProductEdition;
|