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