contentoh-components-library 21.6.41 → 21.6.43
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.
|
@@ -162,81 +162,81 @@ function regenerateVideoThumbnails(_x) {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
function _regenerateVideoThumbnails() {
|
|
165
|
-
_regenerateVideoThumbnails = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
166
|
-
return _regenerator.default.wrap(function
|
|
165
|
+
_regenerateVideoThumbnails = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(values) {
|
|
166
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
167
167
|
while (1) {
|
|
168
|
-
switch (
|
|
168
|
+
switch (_context19.prev = _context19.next) {
|
|
169
169
|
case 0:
|
|
170
170
|
if (Array.isArray(values)) {
|
|
171
|
-
|
|
171
|
+
_context19.next = 2;
|
|
172
172
|
break;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
return
|
|
175
|
+
return _context19.abrupt("return", values);
|
|
176
176
|
|
|
177
177
|
case 2:
|
|
178
|
-
return
|
|
179
|
-
var
|
|
178
|
+
return _context19.abrupt("return", Promise.all(values.map( /*#__PURE__*/function () {
|
|
179
|
+
var _ref23 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(value) {
|
|
180
180
|
var base64, videoSrc, thumbnail;
|
|
181
|
-
return _regenerator.default.wrap(function
|
|
181
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
182
182
|
while (1) {
|
|
183
|
-
switch (
|
|
183
|
+
switch (_context18.prev = _context18.next) {
|
|
184
184
|
case 0:
|
|
185
185
|
if (!((value === null || value === void 0 ? void 0 : value.ext) !== "mp4" || !(value !== null && value !== void 0 && value.srcDB))) {
|
|
186
|
-
|
|
186
|
+
_context18.next = 2;
|
|
187
187
|
break;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
return
|
|
190
|
+
return _context18.abrupt("return", value);
|
|
191
191
|
|
|
192
192
|
case 2:
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
_context18.prev = 2;
|
|
194
|
+
_context18.next = 5;
|
|
195
195
|
return convertirVideoABase64("https://" + process.env.REACT_APP_IMAGES_BUCKET + ".s3.amazonaws.com/" + value.srcDB);
|
|
196
196
|
|
|
197
197
|
case 5:
|
|
198
|
-
base64 =
|
|
198
|
+
base64 = _context18.sent;
|
|
199
199
|
videoSrc = "data:video/mp4;base64," + base64.split(",")[1];
|
|
200
|
-
|
|
200
|
+
_context18.next = 9;
|
|
201
201
|
return (0, _generateThumnail.default)(videoSrc, 2);
|
|
202
202
|
|
|
203
203
|
case 9:
|
|
204
|
-
thumbnail =
|
|
205
|
-
return
|
|
204
|
+
thumbnail = _context18.sent;
|
|
205
|
+
return _context18.abrupt("return", (0, _objectSpread5.default)((0, _objectSpread5.default)({}, value), {}, {
|
|
206
206
|
src: thumbnail
|
|
207
207
|
}));
|
|
208
208
|
|
|
209
209
|
case 13:
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
console.error("Error al generar thumbnail del video:",
|
|
213
|
-
return
|
|
210
|
+
_context18.prev = 13;
|
|
211
|
+
_context18.t0 = _context18["catch"](2);
|
|
212
|
+
console.error("Error al generar thumbnail del video:", _context18.t0);
|
|
213
|
+
return _context18.abrupt("return", value);
|
|
214
214
|
|
|
215
215
|
case 17:
|
|
216
216
|
case "end":
|
|
217
|
-
return
|
|
217
|
+
return _context18.stop();
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
},
|
|
220
|
+
}, _callee18, null, [[2, 13]]);
|
|
221
221
|
}));
|
|
222
222
|
|
|
223
223
|
return function (_x10) {
|
|
224
|
-
return
|
|
224
|
+
return _ref23.apply(this, arguments);
|
|
225
225
|
};
|
|
226
226
|
}())));
|
|
227
227
|
|
|
228
228
|
case 3:
|
|
229
229
|
case "end":
|
|
230
|
-
return
|
|
230
|
+
return _context19.stop();
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
},
|
|
233
|
+
}, _callee19);
|
|
234
234
|
}));
|
|
235
235
|
return _regenerateVideoThumbnails.apply(this, arguments);
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
239
|
-
var _state$product10, _family$variants, _state$product11, _state$errors, _family$variants2, _state$product15, _state$product16, _state$product17, _state$
|
|
239
|
+
var _state$product10, _family$variants, _state$product11, _state$errors, _family$variants2, _state$product15, _state$product16, _state$product17, _state$active_retaile6, _location$state, _location$state2, _state$active_retaile7, _state$active_retaile8, _state$images_values$2, _state$images_values10, _state$images_values11, _state$product18, _state$active_retaile9, _family$variants3, _family$variants4, _state$active_percent, _state$active_percent2, _state$active_percent3, _state$active_retaile10, _state$active_retaile11, _state$active_retaile12, _state$product24, _state$services2, _state$services2$data, _state$product25, _state$product26, _state$datasheets_inp, _state$datasheets_inp2, _state$product27, _state$images_values12, _state$comment;
|
|
240
240
|
|
|
241
241
|
var tabsSections = _ref.tabsSections,
|
|
242
242
|
_ref$productSelected = _ref.productSelected,
|
|
@@ -740,6 +740,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
740
740
|
versionSelected,
|
|
741
741
|
_services$,
|
|
742
742
|
_retailerDatasheets$d,
|
|
743
|
+
_state$active_retaile2,
|
|
743
744
|
_state$product4,
|
|
744
745
|
id_article,
|
|
745
746
|
version,
|
|
@@ -767,6 +768,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
767
768
|
retailerDatasheets,
|
|
768
769
|
datasheetsActiveRetailer,
|
|
769
770
|
descriptionsActiveRetailer,
|
|
771
|
+
activeRetailerId,
|
|
770
772
|
filteredValues,
|
|
771
773
|
orderedValuesWithThumbs,
|
|
772
774
|
filteredValuesWithThumbs,
|
|
@@ -911,23 +913,33 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
911
913
|
descriptionsActiveRetailer = services[1].filter(function (item) {
|
|
912
914
|
return item.id === id_retailer;
|
|
913
915
|
});
|
|
916
|
+
/**
|
|
917
|
+
* El id del retailer activo viene con dos nombres según de dónde salga:
|
|
918
|
+
* `categoryRetailerInOrder` lo trae como `id_retailer`, mientras que los
|
|
919
|
+
* retailers de `read-data-images` lo traen como `id`. Si se compara solo
|
|
920
|
+
* contra uno, al cambiar de cadena el otro queda `undefined`, la
|
|
921
|
+
* comparación es siempre falsa y `filteredValues` sale vacío — la imagen
|
|
922
|
+
* existe, el backend la devuelve, y aun así no se pinta ninguna.
|
|
923
|
+
*/
|
|
924
|
+
|
|
925
|
+
activeRetailerId = id_retailer !== null && id_retailer !== void 0 ? id_retailer : (_state$active_retaile2 = state.active_retailer) === null || _state$active_retaile2 === void 0 ? void 0 : _state$active_retaile2.id;
|
|
914
926
|
filteredValues = services[2].values.filter(function (value) {
|
|
915
927
|
return services[2].inputsByRetailer.some(function (retailerInput) {
|
|
916
928
|
return retailerInput.some(function (input) {
|
|
917
|
-
return input.id_retailer ===
|
|
929
|
+
return Number(input.id_retailer) === Number(activeRetailerId) && Number(input.id_image) === Number(value.image_id);
|
|
918
930
|
});
|
|
919
931
|
});
|
|
920
932
|
}); // Regenerar thumbnails de videos guardados para que se muestren.
|
|
921
933
|
|
|
922
|
-
_context4.next =
|
|
934
|
+
_context4.next = 35;
|
|
923
935
|
return regenerateVideoThumbnails(orderedValues);
|
|
924
936
|
|
|
925
|
-
case
|
|
937
|
+
case 35:
|
|
926
938
|
orderedValuesWithThumbs = _context4.sent;
|
|
927
|
-
_context4.next =
|
|
939
|
+
_context4.next = 38;
|
|
928
940
|
return regenerateVideoThumbnails(filteredValues);
|
|
929
941
|
|
|
930
|
-
case
|
|
942
|
+
case 38:
|
|
931
943
|
filteredValuesWithThumbs = _context4.sent;
|
|
932
944
|
// Dispatch consolidado
|
|
933
945
|
dispatch({
|
|
@@ -980,11 +992,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
980
992
|
loadAuditableData();
|
|
981
993
|
}
|
|
982
994
|
|
|
983
|
-
_context4.next =
|
|
995
|
+
_context4.next = 54;
|
|
984
996
|
break;
|
|
985
997
|
|
|
986
|
-
case
|
|
987
|
-
_context4.prev =
|
|
998
|
+
case 50:
|
|
999
|
+
_context4.prev = 50;
|
|
988
1000
|
_context4.t0 = _context4["catch"](2);
|
|
989
1001
|
console.log("Error loading data: ", _context4.t0);
|
|
990
1002
|
dispatch({
|
|
@@ -992,20 +1004,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
992
1004
|
payload: [_context4.t0.message]
|
|
993
1005
|
});
|
|
994
1006
|
|
|
995
|
-
case
|
|
996
|
-
_context4.prev =
|
|
1007
|
+
case 54:
|
|
1008
|
+
_context4.prev = 54;
|
|
997
1009
|
dispatch({
|
|
998
1010
|
type: "SET_LOADING",
|
|
999
1011
|
payload: false
|
|
1000
1012
|
});
|
|
1001
|
-
return _context4.finish(
|
|
1013
|
+
return _context4.finish(54);
|
|
1002
1014
|
|
|
1003
|
-
case
|
|
1015
|
+
case 57:
|
|
1004
1016
|
case "end":
|
|
1005
1017
|
return _context4.stop();
|
|
1006
1018
|
}
|
|
1007
1019
|
}
|
|
1008
|
-
}, _callee4, null, [[2,
|
|
1020
|
+
}, _callee4, null, [[2, 50, 54, 57]]);
|
|
1009
1021
|
}));
|
|
1010
1022
|
|
|
1011
1023
|
return function loadData() {
|
|
@@ -1108,9 +1120,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1108
1120
|
|
|
1109
1121
|
var concept = (0, _utils.getConceptByTab)(action || state.active_tab);
|
|
1110
1122
|
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) {
|
|
1111
|
-
var _state$
|
|
1123
|
+
var _state$active_retaile3;
|
|
1112
1124
|
|
|
1113
|
-
return srv.id_retailer === ((_state$
|
|
1125
|
+
return srv.id_retailer === ((_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer) && srv.service === concept;
|
|
1114
1126
|
})) === 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(/.*\//, ""); // Se SUMA la vía por asignación a la que ya había por rol; no la
|
|
1115
1127
|
// reemplaza. Así los coordinadores y el administrador conservan su acceso
|
|
1116
1128
|
// tal cual, y el especialista que además es auditor alcanza la segunda fase.
|
|
@@ -1155,28 +1167,38 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1155
1167
|
return currentStatus;
|
|
1156
1168
|
};
|
|
1157
1169
|
|
|
1158
|
-
var handleOnClickSaveImages = function
|
|
1159
|
-
var
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1170
|
+
var handleOnClickSaveImages = /*#__PURE__*/function () {
|
|
1171
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
1172
|
+
var _state$product7, _state$product7$servi;
|
|
1173
|
+
|
|
1174
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
1175
|
+
while (1) {
|
|
1176
|
+
switch (_context5.prev = _context5.next) {
|
|
1177
|
+
case 0:
|
|
1178
|
+
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)) {
|
|
1179
|
+
_context5.next = 5;
|
|
1180
|
+
break;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
_context5.next = 3;
|
|
1184
|
+
return updateImages(token);
|
|
1185
|
+
|
|
1186
|
+
case 3:
|
|
1187
|
+
_context5.next = 5;
|
|
1188
|
+
return loadData(false);
|
|
1189
|
+
|
|
1190
|
+
case 5:
|
|
1191
|
+
case "end":
|
|
1192
|
+
return _context5.stop();
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
}, _callee5);
|
|
1196
|
+
}));
|
|
1197
|
+
|
|
1198
|
+
return function handleOnClickSaveImages() {
|
|
1199
|
+
return _ref9.apply(this, arguments);
|
|
1200
|
+
};
|
|
1201
|
+
}();
|
|
1180
1202
|
/*
|
|
1181
1203
|
Trae la familia: los hijos del producto, o sus hermanos si el abierto es
|
|
1182
1204
|
una de ellas. Se pide al abrir la sección y no al montar la pantalla: la
|
|
@@ -1185,29 +1207,29 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1185
1207
|
|
|
1186
1208
|
|
|
1187
1209
|
var loadFamily = /*#__PURE__*/function () {
|
|
1188
|
-
var
|
|
1210
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
1189
1211
|
var forzar,
|
|
1190
1212
|
_state$product8,
|
|
1191
1213
|
res,
|
|
1192
1214
|
data,
|
|
1193
|
-
|
|
1215
|
+
_args6 = arguments;
|
|
1194
1216
|
|
|
1195
|
-
return _regenerator.default.wrap(function
|
|
1217
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
1196
1218
|
while (1) {
|
|
1197
|
-
switch (
|
|
1219
|
+
switch (_context6.prev = _context6.next) {
|
|
1198
1220
|
case 0:
|
|
1199
|
-
forzar =
|
|
1221
|
+
forzar = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : false;
|
|
1200
1222
|
|
|
1201
1223
|
if (!(family && !forzar)) {
|
|
1202
|
-
|
|
1224
|
+
_context6.next = 3;
|
|
1203
1225
|
break;
|
|
1204
1226
|
}
|
|
1205
1227
|
|
|
1206
|
-
return
|
|
1228
|
+
return _context6.abrupt("return", family);
|
|
1207
1229
|
|
|
1208
1230
|
case 3:
|
|
1209
|
-
|
|
1210
|
-
|
|
1231
|
+
_context6.prev = 3;
|
|
1232
|
+
_context6.next = 6;
|
|
1211
1233
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/family"), {
|
|
1212
1234
|
articleId: (_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8.id_article
|
|
1213
1235
|
}, {
|
|
@@ -1217,32 +1239,32 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1217
1239
|
});
|
|
1218
1240
|
|
|
1219
1241
|
case 6:
|
|
1220
|
-
res =
|
|
1242
|
+
res = _context6.sent;
|
|
1221
1243
|
data = (0, _api.readPayload)(res);
|
|
1222
1244
|
setFamily(data);
|
|
1223
|
-
return
|
|
1245
|
+
return _context6.abrupt("return", data);
|
|
1224
1246
|
|
|
1225
1247
|
case 12:
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
console.error("loadFamily: ",
|
|
1248
|
+
_context6.prev = 12;
|
|
1249
|
+
_context6.t0 = _context6["catch"](3);
|
|
1250
|
+
console.error("loadFamily: ", _context6.t0);
|
|
1229
1251
|
setFamily({
|
|
1230
1252
|
variants: [],
|
|
1231
1253
|
parent: null,
|
|
1232
1254
|
error: true
|
|
1233
1255
|
});
|
|
1234
|
-
return
|
|
1256
|
+
return _context6.abrupt("return", null);
|
|
1235
1257
|
|
|
1236
1258
|
case 17:
|
|
1237
1259
|
case "end":
|
|
1238
|
-
return
|
|
1260
|
+
return _context6.stop();
|
|
1239
1261
|
}
|
|
1240
1262
|
}
|
|
1241
|
-
},
|
|
1263
|
+
}, _callee6, null, [[3, 12]]);
|
|
1242
1264
|
}));
|
|
1243
1265
|
|
|
1244
1266
|
return function loadFamily() {
|
|
1245
|
-
return
|
|
1267
|
+
return _ref10.apply(this, arguments);
|
|
1246
1268
|
};
|
|
1247
1269
|
}();
|
|
1248
1270
|
/*
|
|
@@ -1350,17 +1372,17 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1350
1372
|
};
|
|
1351
1373
|
|
|
1352
1374
|
var openFamilyMember = /*#__PURE__*/function () {
|
|
1353
|
-
var
|
|
1354
|
-
var _readPayload, res,
|
|
1375
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(articleId) {
|
|
1376
|
+
var _readPayload, res, _ref12, data, encontrado;
|
|
1355
1377
|
|
|
1356
|
-
return _regenerator.default.wrap(function
|
|
1378
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1357
1379
|
while (1) {
|
|
1358
|
-
switch (
|
|
1380
|
+
switch (_context7.prev = _context7.next) {
|
|
1359
1381
|
case 0:
|
|
1360
1382
|
setLoadingVariant(articleId);
|
|
1361
1383
|
setAvisoFamilia(null);
|
|
1362
|
-
|
|
1363
|
-
|
|
1384
|
+
_context7.prev = 2;
|
|
1385
|
+
_context7.next = 5;
|
|
1364
1386
|
return _axios.default.get("".concat(process.env.REACT_APP_ORDERED_SERVICES_ENDPOINT), {
|
|
1365
1387
|
params: {
|
|
1366
1388
|
filterByIdArticle: articleId,
|
|
@@ -1372,11 +1394,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1372
1394
|
});
|
|
1373
1395
|
|
|
1374
1396
|
case 5:
|
|
1375
|
-
res =
|
|
1397
|
+
res = _context7.sent;
|
|
1376
1398
|
// read-order-services responde { total, data: [...] }. La vista trae una
|
|
1377
1399
|
// fila por orden, así que puede haber varias del mismo artículo; llegan
|
|
1378
1400
|
// ordenadas por order_id DESC y la primera es la orden más reciente.
|
|
1379
|
-
|
|
1401
|
+
_ref12 = (_readPayload = (0, _api.readPayload)(res)) !== null && _readPayload !== void 0 ? _readPayload : {}, data = _ref12.data;
|
|
1380
1402
|
encontrado = (data !== null && data !== void 0 ? data : []).find(function (item) {
|
|
1381
1403
|
var _item$article;
|
|
1382
1404
|
|
|
@@ -1384,12 +1406,12 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1384
1406
|
});
|
|
1385
1407
|
|
|
1386
1408
|
if (encontrado) {
|
|
1387
|
-
|
|
1409
|
+
_context7.next = 11;
|
|
1388
1410
|
break;
|
|
1389
1411
|
}
|
|
1390
1412
|
|
|
1391
1413
|
setAvisoFamilia("Ese producto no está en ninguna orden de trabajo, así que no se puede abrir desde aquí.");
|
|
1392
|
-
return
|
|
1414
|
+
return _context7.abrupt("return");
|
|
1393
1415
|
|
|
1394
1416
|
case 11:
|
|
1395
1417
|
sessionStorage.setItem("productSelected", JSON.stringify(encontrado));
|
|
@@ -1400,30 +1422,30 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1400
1422
|
product: [encontrado]
|
|
1401
1423
|
}));
|
|
1402
1424
|
window.location.assign("/EditProducts");
|
|
1403
|
-
|
|
1425
|
+
_context7.next = 21;
|
|
1404
1426
|
break;
|
|
1405
1427
|
|
|
1406
1428
|
case 17:
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
console.error("openFamilyMember: ",
|
|
1429
|
+
_context7.prev = 17;
|
|
1430
|
+
_context7.t0 = _context7["catch"](2);
|
|
1431
|
+
console.error("openFamilyMember: ", _context7.t0);
|
|
1410
1432
|
setAvisoFamilia("No se pudo abrir ese producto. Intenta de nuevo.");
|
|
1411
1433
|
|
|
1412
1434
|
case 21:
|
|
1413
|
-
|
|
1435
|
+
_context7.prev = 21;
|
|
1414
1436
|
setLoadingVariant(null);
|
|
1415
|
-
return
|
|
1437
|
+
return _context7.finish(21);
|
|
1416
1438
|
|
|
1417
1439
|
case 24:
|
|
1418
1440
|
case "end":
|
|
1419
|
-
return
|
|
1441
|
+
return _context7.stop();
|
|
1420
1442
|
}
|
|
1421
1443
|
}
|
|
1422
|
-
},
|
|
1444
|
+
}, _callee7, null, [[2, 17, 21, 24]]);
|
|
1423
1445
|
}));
|
|
1424
1446
|
|
|
1425
1447
|
return function openFamilyMember(_x3) {
|
|
1426
|
-
return
|
|
1448
|
+
return _ref11.apply(this, arguments);
|
|
1427
1449
|
};
|
|
1428
1450
|
}();
|
|
1429
1451
|
/*
|
|
@@ -1512,31 +1534,31 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1512
1534
|
|
|
1513
1535
|
|
|
1514
1536
|
var handleOnRestoreInheritance = /*#__PURE__*/function () {
|
|
1515
|
-
var
|
|
1537
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(attributeId) {
|
|
1516
1538
|
var _state$product14;
|
|
1517
1539
|
|
|
1518
1540
|
var kind,
|
|
1519
1541
|
esDescripcion,
|
|
1520
1542
|
res,
|
|
1521
1543
|
data,
|
|
1522
|
-
|
|
1523
|
-
return _regenerator.default.wrap(function
|
|
1544
|
+
_args8 = arguments;
|
|
1545
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
1524
1546
|
while (1) {
|
|
1525
|
-
switch (
|
|
1547
|
+
switch (_context8.prev = _context8.next) {
|
|
1526
1548
|
case 0:
|
|
1527
|
-
kind =
|
|
1549
|
+
kind = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : "attribute";
|
|
1528
1550
|
|
|
1529
1551
|
if (!(!attributeId || !((_state$product14 = state.product) !== null && _state$product14 !== void 0 && _state$product14.id_article))) {
|
|
1530
|
-
|
|
1552
|
+
_context8.next = 3;
|
|
1531
1553
|
break;
|
|
1532
1554
|
}
|
|
1533
1555
|
|
|
1534
|
-
return
|
|
1556
|
+
return _context8.abrupt("return");
|
|
1535
1557
|
|
|
1536
1558
|
case 3:
|
|
1537
1559
|
esDescripcion = kind === "description";
|
|
1538
|
-
|
|
1539
|
-
|
|
1560
|
+
_context8.prev = 4;
|
|
1561
|
+
_context8.next = 7;
|
|
1540
1562
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), (0, _objectSpread5.default)({
|
|
1541
1563
|
articleId: state.product.id_article
|
|
1542
1564
|
}, esDescripcion ? {
|
|
@@ -1550,11 +1572,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1550
1572
|
});
|
|
1551
1573
|
|
|
1552
1574
|
case 7:
|
|
1553
|
-
res =
|
|
1575
|
+
res = _context8.sent;
|
|
1554
1576
|
data = (0, _api.readPayload)(res);
|
|
1555
1577
|
|
|
1556
1578
|
if (!esDescripcion) {
|
|
1557
|
-
|
|
1579
|
+
_context8.next = 12;
|
|
1558
1580
|
break;
|
|
1559
1581
|
}
|
|
1560
1582
|
|
|
@@ -1568,7 +1590,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1568
1590
|
};
|
|
1569
1591
|
})
|
|
1570
1592
|
});
|
|
1571
|
-
return
|
|
1593
|
+
return _context8.abrupt("return");
|
|
1572
1594
|
|
|
1573
1595
|
case 12:
|
|
1574
1596
|
dispatch({
|
|
@@ -1581,24 +1603,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1581
1603
|
};
|
|
1582
1604
|
})
|
|
1583
1605
|
});
|
|
1584
|
-
|
|
1606
|
+
_context8.next = 18;
|
|
1585
1607
|
break;
|
|
1586
1608
|
|
|
1587
1609
|
case 15:
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
console.error("restoreInheritance: ",
|
|
1610
|
+
_context8.prev = 15;
|
|
1611
|
+
_context8.t0 = _context8["catch"](4);
|
|
1612
|
+
console.error("restoreInheritance: ", _context8.t0);
|
|
1591
1613
|
|
|
1592
1614
|
case 18:
|
|
1593
1615
|
case "end":
|
|
1594
|
-
return
|
|
1616
|
+
return _context8.stop();
|
|
1595
1617
|
}
|
|
1596
1618
|
}
|
|
1597
|
-
},
|
|
1619
|
+
}, _callee8, null, [[4, 15]]);
|
|
1598
1620
|
}));
|
|
1599
1621
|
|
|
1600
1622
|
return function handleOnRestoreInheritance(_x4) {
|
|
1601
|
-
return
|
|
1623
|
+
return _ref13.apply(this, arguments);
|
|
1602
1624
|
};
|
|
1603
1625
|
}();
|
|
1604
1626
|
/*
|
|
@@ -1608,9 +1630,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1608
1630
|
|
|
1609
1631
|
|
|
1610
1632
|
var cambiosDeFichaTecnica = function cambiosDeFichaTecnica() {
|
|
1611
|
-
var _state$
|
|
1633
|
+
var _state$active_retaile4, _state$services$datas, _state$services, _state$services$datas2, _state$updated_datash;
|
|
1612
1634
|
|
|
1613
|
-
var retailerId = (_state$
|
|
1635
|
+
var retailerId = (_state$active_retaile4 = state.active_retailer) === null || _state$active_retaile4 === void 0 ? void 0 : _state$active_retaile4.id_retailer;
|
|
1614
1636
|
var inputs = (_state$services$datas = (_state$services = state.services) === null || _state$services === void 0 ? void 0 : (_state$services$datas2 = _state$services.datasheets) === null || _state$services$datas2 === void 0 ? void 0 : _state$services$datas2.inputs) !== null && _state$services$datas !== void 0 ? _state$services$datas : {};
|
|
1615
1637
|
return ((_state$updated_datash = state.updated_datasheets_inputs) !== null && _state$updated_datash !== void 0 ? _state$updated_datash : []).map(function (item) {
|
|
1616
1638
|
var _input$name;
|
|
@@ -1625,45 +1647,45 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1625
1647
|
};
|
|
1626
1648
|
|
|
1627
1649
|
var handleOnClickSave = /*#__PURE__*/function () {
|
|
1628
|
-
var
|
|
1650
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
1629
1651
|
var _familia$variants, cambios, familia, hijos;
|
|
1630
1652
|
|
|
1631
|
-
return _regenerator.default.wrap(function
|
|
1653
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1632
1654
|
while (1) {
|
|
1633
|
-
switch (
|
|
1655
|
+
switch (_context9.prev = _context9.next) {
|
|
1634
1656
|
case 0:
|
|
1635
1657
|
if (!(state.saving || preparandoPropagacion)) {
|
|
1636
|
-
|
|
1658
|
+
_context9.next = 2;
|
|
1637
1659
|
break;
|
|
1638
1660
|
}
|
|
1639
1661
|
|
|
1640
|
-
return
|
|
1662
|
+
return _context9.abrupt("return");
|
|
1641
1663
|
|
|
1642
1664
|
case 2:
|
|
1643
|
-
|
|
1644
|
-
|
|
1665
|
+
_context9.t0 = state.active_tab;
|
|
1666
|
+
_context9.next = _context9.t0 === "Descripción" ? 5 : _context9.t0 === "Ficha técnica" ? 8 : _context9.t0 === "Imágenes" ? 32 : 35;
|
|
1645
1667
|
break;
|
|
1646
1668
|
|
|
1647
1669
|
case 5:
|
|
1648
|
-
|
|
1670
|
+
_context9.next = 7;
|
|
1649
1671
|
return saveDescriptions(token);
|
|
1650
1672
|
|
|
1651
1673
|
case 7:
|
|
1652
|
-
return
|
|
1674
|
+
return _context9.abrupt("break", 36);
|
|
1653
1675
|
|
|
1654
1676
|
case 8:
|
|
1655
1677
|
cambios = cambiosDeFichaTecnica();
|
|
1656
1678
|
|
|
1657
1679
|
if (!(cambios.length === 0)) {
|
|
1658
|
-
|
|
1680
|
+
_context9.next = 13;
|
|
1659
1681
|
break;
|
|
1660
1682
|
}
|
|
1661
1683
|
|
|
1662
|
-
|
|
1684
|
+
_context9.next = 12;
|
|
1663
1685
|
return saveDatasheets(token);
|
|
1664
1686
|
|
|
1665
1687
|
case 12:
|
|
1666
|
-
return
|
|
1688
|
+
return _context9.abrupt("break", 36);
|
|
1667
1689
|
|
|
1668
1690
|
case 13:
|
|
1669
1691
|
/*
|
|
@@ -1682,21 +1704,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1682
1704
|
*/
|
|
1683
1705
|
setPreparandoPropagacion(true);
|
|
1684
1706
|
familia = null;
|
|
1685
|
-
|
|
1686
|
-
|
|
1707
|
+
_context9.prev = 15;
|
|
1708
|
+
_context9.next = 18;
|
|
1687
1709
|
return loadFamily(true);
|
|
1688
1710
|
|
|
1689
1711
|
case 18:
|
|
1690
|
-
familia =
|
|
1712
|
+
familia = _context9.sent;
|
|
1691
1713
|
|
|
1692
1714
|
case 19:
|
|
1693
|
-
|
|
1715
|
+
_context9.prev = 19;
|
|
1694
1716
|
setPreparandoPropagacion(false);
|
|
1695
|
-
return
|
|
1717
|
+
return _context9.finish(19);
|
|
1696
1718
|
|
|
1697
1719
|
case 22:
|
|
1698
1720
|
if (!(!familia || familia.error)) {
|
|
1699
|
-
|
|
1721
|
+
_context9.next = 25;
|
|
1700
1722
|
break;
|
|
1701
1723
|
}
|
|
1702
1724
|
|
|
@@ -1733,7 +1755,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1733
1755
|
}]
|
|
1734
1756
|
}
|
|
1735
1757
|
});
|
|
1736
|
-
return
|
|
1758
|
+
return _context9.abrupt("return");
|
|
1737
1759
|
|
|
1738
1760
|
case 25:
|
|
1739
1761
|
hijos = ((_familia$variants = familia.variants) !== null && _familia$variants !== void 0 ? _familia$variants : []).filter(function (v) {
|
|
@@ -1741,46 +1763,46 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1741
1763
|
});
|
|
1742
1764
|
|
|
1743
1765
|
if (!(hijos.length > 0)) {
|
|
1744
|
-
|
|
1766
|
+
_context9.next = 29;
|
|
1745
1767
|
break;
|
|
1746
1768
|
}
|
|
1747
1769
|
|
|
1748
1770
|
setPendingPropagation({
|
|
1749
1771
|
cambios: cambios
|
|
1750
1772
|
});
|
|
1751
|
-
return
|
|
1773
|
+
return _context9.abrupt("return");
|
|
1752
1774
|
|
|
1753
1775
|
case 29:
|
|
1754
|
-
|
|
1776
|
+
_context9.next = 31;
|
|
1755
1777
|
return saveDatasheets(token);
|
|
1756
1778
|
|
|
1757
1779
|
case 31:
|
|
1758
|
-
return
|
|
1780
|
+
return _context9.abrupt("break", 36);
|
|
1759
1781
|
|
|
1760
1782
|
case 32:
|
|
1761
|
-
|
|
1783
|
+
_context9.next = 34;
|
|
1762
1784
|
return updateImages(token);
|
|
1763
1785
|
|
|
1764
1786
|
case 34:
|
|
1765
|
-
return
|
|
1787
|
+
return _context9.abrupt("break", 36);
|
|
1766
1788
|
|
|
1767
1789
|
case 35:
|
|
1768
|
-
return
|
|
1790
|
+
return _context9.abrupt("break", 36);
|
|
1769
1791
|
|
|
1770
1792
|
case 36:
|
|
1771
|
-
|
|
1793
|
+
_context9.next = 38;
|
|
1772
1794
|
return loadData(false);
|
|
1773
1795
|
|
|
1774
1796
|
case 38:
|
|
1775
1797
|
case "end":
|
|
1776
|
-
return
|
|
1798
|
+
return _context9.stop();
|
|
1777
1799
|
}
|
|
1778
1800
|
}
|
|
1779
|
-
},
|
|
1801
|
+
}, _callee9, null, [[15,, 19, 22]]);
|
|
1780
1802
|
}));
|
|
1781
1803
|
|
|
1782
1804
|
return function handleOnClickSave() {
|
|
1783
|
-
return
|
|
1805
|
+
return _ref14.apply(this, arguments);
|
|
1784
1806
|
};
|
|
1785
1807
|
}();
|
|
1786
1808
|
|
|
@@ -1848,24 +1870,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1848
1870
|
};
|
|
1849
1871
|
|
|
1850
1872
|
var handleOnApproveSingleService = /*#__PURE__*/function () {
|
|
1851
|
-
var
|
|
1852
|
-
return _regenerator.default.wrap(function
|
|
1873
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
1874
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1853
1875
|
while (1) {
|
|
1854
|
-
switch (
|
|
1876
|
+
switch (_context10.prev = _context10.next) {
|
|
1855
1877
|
case 0:
|
|
1856
|
-
|
|
1878
|
+
_context10.next = 2;
|
|
1857
1879
|
return sendSingleEvaluation("A");
|
|
1858
1880
|
|
|
1859
1881
|
case 2:
|
|
1860
1882
|
case "end":
|
|
1861
|
-
return
|
|
1883
|
+
return _context10.stop();
|
|
1862
1884
|
}
|
|
1863
1885
|
}
|
|
1864
|
-
},
|
|
1886
|
+
}, _callee10);
|
|
1865
1887
|
}));
|
|
1866
1888
|
|
|
1867
1889
|
return function handleOnApproveSingleService() {
|
|
1868
|
-
return
|
|
1890
|
+
return _ref15.apply(this, arguments);
|
|
1869
1891
|
};
|
|
1870
1892
|
}();
|
|
1871
1893
|
|
|
@@ -1874,21 +1896,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1874
1896
|
};
|
|
1875
1897
|
|
|
1876
1898
|
var sendSingleEvaluation = /*#__PURE__*/function () {
|
|
1877
|
-
var
|
|
1878
|
-
var _state$product$id_ord, _state$
|
|
1899
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(result) {
|
|
1900
|
+
var _state$product$id_ord, _state$active_retaile5;
|
|
1879
1901
|
|
|
1880
1902
|
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, updatedStatusByRetailerForSend, _updatedProduct, updatedServicesData, sessionProduct, _objectSpread3, productInSession, updatedProductInSession;
|
|
1881
1903
|
|
|
1882
|
-
return _regenerator.default.wrap(function
|
|
1904
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1883
1905
|
while (1) {
|
|
1884
|
-
switch (
|
|
1906
|
+
switch (_context11.prev = _context11.next) {
|
|
1885
1907
|
case 0:
|
|
1886
1908
|
if (!state.saving) {
|
|
1887
|
-
|
|
1909
|
+
_context11.next = 2;
|
|
1888
1910
|
break;
|
|
1889
1911
|
}
|
|
1890
1912
|
|
|
1891
|
-
return
|
|
1913
|
+
return _context11.abrupt("return");
|
|
1892
1914
|
|
|
1893
1915
|
case 2:
|
|
1894
1916
|
dispatch({
|
|
@@ -1900,7 +1922,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1900
1922
|
orderId = (_state$product$id_ord = state.product.id_order) !== null && _state$product$id_ord !== void 0 ? _state$product$id_ord : state.product.orderId;
|
|
1901
1923
|
sectionStatusKey = "".concat(concept, "_status");
|
|
1902
1924
|
evalStatus = state.product[sectionStatusKey];
|
|
1903
|
-
retailerId = (_state$
|
|
1925
|
+
retailerId = (_state$active_retaile5 = state.active_retailer) === null || _state$active_retaile5 === void 0 ? void 0 : _state$active_retaile5.id_retailer;
|
|
1904
1926
|
data = {
|
|
1905
1927
|
articleId: articleId,
|
|
1906
1928
|
orderId: orderId,
|
|
@@ -1909,16 +1931,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1909
1931
|
retailerId: retailerId
|
|
1910
1932
|
};
|
|
1911
1933
|
activeTab = state.active_tab;
|
|
1912
|
-
|
|
1934
|
+
_context11.prev = 11;
|
|
1913
1935
|
|
|
1914
1936
|
if (!result) {
|
|
1915
|
-
|
|
1937
|
+
_context11.next = 28;
|
|
1916
1938
|
break;
|
|
1917
1939
|
}
|
|
1918
1940
|
|
|
1919
1941
|
data.result = result;
|
|
1920
1942
|
data.retailerId = retailerId;
|
|
1921
|
-
|
|
1943
|
+
_context11.next = 17;
|
|
1922
1944
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1923
1945
|
headers: {
|
|
1924
1946
|
Authorization: token
|
|
@@ -1926,7 +1948,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1926
1948
|
});
|
|
1927
1949
|
|
|
1928
1950
|
case 17:
|
|
1929
|
-
res =
|
|
1951
|
+
res = _context11.sent;
|
|
1930
1952
|
newStatuses = JSON.parse(res.data.body);
|
|
1931
1953
|
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")];
|
|
1932
1954
|
articleStatus = newStatuses.newArticleStatus[articleId];
|
|
@@ -1957,7 +1979,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1957
1979
|
image: _genericModalCheck.default
|
|
1958
1980
|
}
|
|
1959
1981
|
});
|
|
1960
|
-
|
|
1982
|
+
_context11.next = 33;
|
|
1961
1983
|
break;
|
|
1962
1984
|
|
|
1963
1985
|
case 28:
|
|
@@ -1973,7 +1995,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1973
1995
|
icon = _genericModalCheck.default;
|
|
1974
1996
|
}
|
|
1975
1997
|
|
|
1976
|
-
|
|
1998
|
+
_context11.next = 32;
|
|
1977
1999
|
return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1978
2000
|
headers: {
|
|
1979
2001
|
Authorization: token
|
|
@@ -1981,7 +2003,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1981
2003
|
});
|
|
1982
2004
|
|
|
1983
2005
|
case 32:
|
|
1984
|
-
res =
|
|
2006
|
+
res = _context11.sent;
|
|
1985
2007
|
|
|
1986
2008
|
case 33:
|
|
1987
2009
|
if (res.data.statusCode === 200) {
|
|
@@ -2066,13 +2088,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2066
2088
|
});
|
|
2067
2089
|
}
|
|
2068
2090
|
|
|
2069
|
-
|
|
2091
|
+
_context11.next = 40;
|
|
2070
2092
|
break;
|
|
2071
2093
|
|
|
2072
2094
|
case 36:
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
console.error("Error sending evaluation:",
|
|
2095
|
+
_context11.prev = 36;
|
|
2096
|
+
_context11.t0 = _context11["catch"](11);
|
|
2097
|
+
console.error("Error sending evaluation:", _context11.t0);
|
|
2076
2098
|
dispatch({
|
|
2077
2099
|
type: "SET_MODAL",
|
|
2078
2100
|
payload: {
|
|
@@ -2084,45 +2106,45 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2084
2106
|
});
|
|
2085
2107
|
|
|
2086
2108
|
case 40:
|
|
2087
|
-
|
|
2109
|
+
_context11.prev = 40;
|
|
2088
2110
|
dispatch({
|
|
2089
2111
|
type: "SET_SAVING",
|
|
2090
2112
|
payload: false
|
|
2091
2113
|
});
|
|
2092
|
-
return
|
|
2114
|
+
return _context11.finish(40);
|
|
2093
2115
|
|
|
2094
2116
|
case 43:
|
|
2095
2117
|
case "end":
|
|
2096
|
-
return
|
|
2118
|
+
return _context11.stop();
|
|
2097
2119
|
}
|
|
2098
2120
|
}
|
|
2099
|
-
},
|
|
2121
|
+
}, _callee11, null, [[11, 36, 40, 43]]);
|
|
2100
2122
|
}));
|
|
2101
2123
|
|
|
2102
2124
|
return function sendSingleEvaluation(_x5) {
|
|
2103
|
-
return
|
|
2125
|
+
return _ref16.apply(this, arguments);
|
|
2104
2126
|
};
|
|
2105
2127
|
}();
|
|
2106
2128
|
|
|
2107
2129
|
var handleOnApproveAllServices = /*#__PURE__*/function () {
|
|
2108
|
-
var
|
|
2109
|
-
return _regenerator.default.wrap(function
|
|
2130
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
2131
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
2110
2132
|
while (1) {
|
|
2111
|
-
switch (
|
|
2133
|
+
switch (_context12.prev = _context12.next) {
|
|
2112
2134
|
case 0:
|
|
2113
|
-
|
|
2135
|
+
_context12.next = 2;
|
|
2114
2136
|
return sendBulkEvaluation("A");
|
|
2115
2137
|
|
|
2116
2138
|
case 2:
|
|
2117
2139
|
case "end":
|
|
2118
|
-
return
|
|
2140
|
+
return _context12.stop();
|
|
2119
2141
|
}
|
|
2120
2142
|
}
|
|
2121
|
-
},
|
|
2143
|
+
}, _callee12);
|
|
2122
2144
|
}));
|
|
2123
2145
|
|
|
2124
2146
|
return function handleOnApproveAllServices() {
|
|
2125
|
-
return
|
|
2147
|
+
return _ref17.apply(this, arguments);
|
|
2126
2148
|
};
|
|
2127
2149
|
}();
|
|
2128
2150
|
|
|
@@ -2132,18 +2154,18 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2132
2154
|
};
|
|
2133
2155
|
|
|
2134
2156
|
var sendBulkEvaluation = /*#__PURE__*/function () {
|
|
2135
|
-
var
|
|
2157
|
+
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
|
|
2136
2158
|
var _state$services_data3, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, updatedServicesData;
|
|
2137
2159
|
|
|
2138
|
-
return _regenerator.default.wrap(function
|
|
2160
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
2139
2161
|
while (1) {
|
|
2140
|
-
switch (
|
|
2162
|
+
switch (_context13.prev = _context13.next) {
|
|
2141
2163
|
case 0:
|
|
2142
2164
|
dispatch({
|
|
2143
2165
|
type: "SET_SAVING",
|
|
2144
2166
|
payload: true
|
|
2145
2167
|
});
|
|
2146
|
-
|
|
2168
|
+
_context13.prev = 1;
|
|
2147
2169
|
evaluationArray = [];
|
|
2148
2170
|
conceptArray = (0, _utils.getConceptsByRole)(user.id_role);
|
|
2149
2171
|
(_state$services_data3 = state.services_data) === null || _state$services_data3 === void 0 ? void 0 : _state$services_data3.forEach(function (ret, idx) {
|
|
@@ -2168,7 +2190,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2168
2190
|
}));
|
|
2169
2191
|
}
|
|
2170
2192
|
});
|
|
2171
|
-
|
|
2193
|
+
_context13.next = 7;
|
|
2172
2194
|
return Promise.all(evaluationArray);
|
|
2173
2195
|
|
|
2174
2196
|
case 7:
|
|
@@ -2223,41 +2245,41 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2223
2245
|
image: _genericModalCheck.default
|
|
2224
2246
|
}
|
|
2225
2247
|
});
|
|
2226
|
-
|
|
2248
|
+
_context13.next = 19;
|
|
2227
2249
|
break;
|
|
2228
2250
|
|
|
2229
2251
|
case 16:
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
console.error("Error in bulk evaluation:",
|
|
2252
|
+
_context13.prev = 16;
|
|
2253
|
+
_context13.t0 = _context13["catch"](1);
|
|
2254
|
+
console.error("Error in bulk evaluation:", _context13.t0);
|
|
2233
2255
|
|
|
2234
2256
|
case 19:
|
|
2235
|
-
|
|
2257
|
+
_context13.prev = 19;
|
|
2236
2258
|
dispatch({
|
|
2237
2259
|
type: "SET_SAVING",
|
|
2238
2260
|
payload: false
|
|
2239
2261
|
});
|
|
2240
|
-
return
|
|
2262
|
+
return _context13.finish(19);
|
|
2241
2263
|
|
|
2242
2264
|
case 22:
|
|
2243
2265
|
case "end":
|
|
2244
|
-
return
|
|
2266
|
+
return _context13.stop();
|
|
2245
2267
|
}
|
|
2246
2268
|
}
|
|
2247
|
-
},
|
|
2269
|
+
}, _callee13, null, [[1, 16, 19, 22]]);
|
|
2248
2270
|
}));
|
|
2249
2271
|
|
|
2250
2272
|
return function sendBulkEvaluation(_x6) {
|
|
2251
|
-
return
|
|
2273
|
+
return _ref18.apply(this, arguments);
|
|
2252
2274
|
};
|
|
2253
2275
|
}();
|
|
2254
2276
|
|
|
2255
2277
|
var handleOnChangeAssignations = /*#__PURE__*/function () {
|
|
2256
|
-
var
|
|
2278
|
+
var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(assignationType, assignationId) {
|
|
2257
2279
|
var concept, data, updatedProduct;
|
|
2258
|
-
return _regenerator.default.wrap(function
|
|
2280
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
2259
2281
|
while (1) {
|
|
2260
|
-
switch (
|
|
2282
|
+
switch (_context14.prev = _context14.next) {
|
|
2261
2283
|
case 0:
|
|
2262
2284
|
concept = (0, _utils.getConceptByTab)(state.active_tab);
|
|
2263
2285
|
data = {
|
|
@@ -2268,7 +2290,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2268
2290
|
concept: concept,
|
|
2269
2291
|
userId: assignationId
|
|
2270
2292
|
};
|
|
2271
|
-
|
|
2293
|
+
_context14.next = 4;
|
|
2272
2294
|
return (0, _axios.default)({
|
|
2273
2295
|
method: "post",
|
|
2274
2296
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
@@ -2287,14 +2309,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2287
2309
|
|
|
2288
2310
|
case 6:
|
|
2289
2311
|
case "end":
|
|
2290
|
-
return
|
|
2312
|
+
return _context14.stop();
|
|
2291
2313
|
}
|
|
2292
2314
|
}
|
|
2293
|
-
},
|
|
2315
|
+
}, _callee14);
|
|
2294
2316
|
}));
|
|
2295
2317
|
|
|
2296
2318
|
return function handleOnChangeAssignations(_x7, _x8) {
|
|
2297
|
-
return
|
|
2319
|
+
return _ref19.apply(this, arguments);
|
|
2298
2320
|
};
|
|
2299
2321
|
}();
|
|
2300
2322
|
|
|
@@ -2329,16 +2351,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2329
2351
|
};
|
|
2330
2352
|
|
|
2331
2353
|
var handleOnSubmitComment = /*#__PURE__*/function () {
|
|
2332
|
-
var
|
|
2354
|
+
var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(e) {
|
|
2333
2355
|
var commentText;
|
|
2334
|
-
return _regenerator.default.wrap(function
|
|
2356
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
2335
2357
|
while (1) {
|
|
2336
|
-
switch (
|
|
2358
|
+
switch (_context15.prev = _context15.next) {
|
|
2337
2359
|
case 0:
|
|
2338
2360
|
e.preventDefault();
|
|
2339
2361
|
commentText = document.querySelector("#commentary-box .ql-container .ql-editor > p").innerHTML;
|
|
2340
|
-
|
|
2341
|
-
|
|
2362
|
+
_context15.prev = 2;
|
|
2363
|
+
_context15.next = 5;
|
|
2342
2364
|
return createComment(commentText, token);
|
|
2343
2365
|
|
|
2344
2366
|
case 5:
|
|
@@ -2351,13 +2373,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2351
2373
|
image: _genericModalCheck.default
|
|
2352
2374
|
}
|
|
2353
2375
|
});
|
|
2354
|
-
|
|
2376
|
+
_context15.next = 12;
|
|
2355
2377
|
break;
|
|
2356
2378
|
|
|
2357
2379
|
case 8:
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
console.error("Error saving comment:",
|
|
2380
|
+
_context15.prev = 8;
|
|
2381
|
+
_context15.t0 = _context15["catch"](2);
|
|
2382
|
+
console.error("Error saving comment:", _context15.t0);
|
|
2361
2383
|
dispatch({
|
|
2362
2384
|
type: "SET_MODAL",
|
|
2363
2385
|
payload: {
|
|
@@ -2370,14 +2392,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2370
2392
|
|
|
2371
2393
|
case 12:
|
|
2372
2394
|
case "end":
|
|
2373
|
-
return
|
|
2395
|
+
return _context15.stop();
|
|
2374
2396
|
}
|
|
2375
2397
|
}
|
|
2376
|
-
},
|
|
2398
|
+
}, _callee15, null, [[2, 8]]);
|
|
2377
2399
|
}));
|
|
2378
2400
|
|
|
2379
2401
|
return function handleOnSubmitComment(_x9) {
|
|
2380
|
-
return
|
|
2402
|
+
return _ref20.apply(this, arguments);
|
|
2381
2403
|
};
|
|
2382
2404
|
}();
|
|
2383
2405
|
|
|
@@ -2715,7 +2737,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2715
2737
|
articleId: (_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.id_article,
|
|
2716
2738
|
articleName: (_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.name,
|
|
2717
2739
|
articleUpc: (_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.upc,
|
|
2718
|
-
activeRetailerId: (_state$
|
|
2740
|
+
activeRetailerId: (_state$active_retaile6 = state.active_retailer) === null || _state$active_retaile6 === void 0 ? void 0 : _state$active_retaile6.id_retailer,
|
|
2719
2741
|
token: token,
|
|
2720
2742
|
onClose: function onClose() {
|
|
2721
2743
|
return setShowLinkVariants(false);
|
|
@@ -2747,21 +2769,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2747
2769
|
type: "pink",
|
|
2748
2770
|
label: "Aceptar",
|
|
2749
2771
|
size: 12,
|
|
2750
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2772
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
2751
2773
|
var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
|
|
2752
|
-
return _regenerator.default.wrap(function
|
|
2774
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
2753
2775
|
while (1) {
|
|
2754
|
-
switch (
|
|
2776
|
+
switch (_context16.prev = _context16.next) {
|
|
2755
2777
|
case 0:
|
|
2756
2778
|
elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
|
|
2757
2779
|
|
|
2758
2780
|
if (!(!elements || elements.length === 0)) {
|
|
2759
|
-
|
|
2781
|
+
_context16.next = 4;
|
|
2760
2782
|
break;
|
|
2761
2783
|
}
|
|
2762
2784
|
|
|
2763
2785
|
console.error("Elemento no encontrado");
|
|
2764
|
-
return
|
|
2786
|
+
return _context16.abrupt("return");
|
|
2765
2787
|
|
|
2766
2788
|
case 4:
|
|
2767
2789
|
isMessageEmpty = Array.from(elements).every(function (el) {
|
|
@@ -2770,7 +2792,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2770
2792
|
});
|
|
2771
2793
|
|
|
2772
2794
|
if (!isMessageEmpty) {
|
|
2773
|
-
|
|
2795
|
+
_context16.next = 10;
|
|
2774
2796
|
break;
|
|
2775
2797
|
}
|
|
2776
2798
|
|
|
@@ -2785,13 +2807,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2785
2807
|
container.appendChild(alert);
|
|
2786
2808
|
}
|
|
2787
2809
|
|
|
2788
|
-
return
|
|
2810
|
+
return _context16.abrupt("return");
|
|
2789
2811
|
|
|
2790
2812
|
case 10:
|
|
2791
2813
|
fullMessage = Array.from(elements).map(function (element) {
|
|
2792
2814
|
return element.innerHTML;
|
|
2793
2815
|
}).join("").replace(/<br\s*\/?>/gi, "\n");
|
|
2794
|
-
|
|
2816
|
+
_context16.next = 13;
|
|
2795
2817
|
return createComment(fullMessage, token);
|
|
2796
2818
|
|
|
2797
2819
|
case 13:
|
|
@@ -2800,10 +2822,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2800
2822
|
|
|
2801
2823
|
case 15:
|
|
2802
2824
|
case "end":
|
|
2803
|
-
return
|
|
2825
|
+
return _context16.stop();
|
|
2804
2826
|
}
|
|
2805
2827
|
}
|
|
2806
|
-
},
|
|
2828
|
+
}, _callee16);
|
|
2807
2829
|
}))
|
|
2808
2830
|
}, "btn-Aceptar")]
|
|
2809
2831
|
}), state.modal.show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
|
|
@@ -2864,8 +2886,8 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2864
2886
|
productSelected: state.product,
|
|
2865
2887
|
token: token,
|
|
2866
2888
|
activeRetailer: {
|
|
2867
|
-
id: (_state$
|
|
2868
|
-
name: (_state$
|
|
2889
|
+
id: (_state$active_retaile7 = state.active_retailer) === null || _state$active_retaile7 === void 0 ? void 0 : _state$active_retaile7.id_retailer,
|
|
2890
|
+
name: (_state$active_retaile8 = state.active_retailer) === null || _state$active_retaile8 === void 0 ? void 0 : _state$active_retaile8.retailer
|
|
2869
2891
|
}
|
|
2870
2892
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2871
2893
|
className: "data-container",
|
|
@@ -2882,7 +2904,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2882
2904
|
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] : {},
|
|
2883
2905
|
assignationsImages: state.collaborator_assignations["Imágenes"],
|
|
2884
2906
|
imagesStatus: ((_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.images_status) || "-",
|
|
2885
|
-
retailerSelected: (_state$
|
|
2907
|
+
retailerSelected: (_state$active_retaile9 = state.active_retailer) === null || _state$active_retaile9 === void 0 ? void 0 : _state$active_retaile9.id_retailer,
|
|
2886
2908
|
isRetailer: isRetailer,
|
|
2887
2909
|
version: state.product.version,
|
|
2888
2910
|
shotThd: shotThd,
|
|
@@ -3034,9 +3056,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3034
3056
|
productObservation: observation,
|
|
3035
3057
|
percent: (_state$active_percent = (_state$active_percent2 = state.active_percentage) === null || _state$active_percent2 === void 0 ? void 0 : (_state$active_percent3 = _state$active_percent2.percentagesGeneral) === null || _state$active_percent3 === void 0 ? void 0 : _state$active_percent3.required) !== null && _state$active_percent !== void 0 ? _state$active_percent : 0,
|
|
3036
3058
|
activeRetailer: {
|
|
3037
|
-
id: (_state$
|
|
3038
|
-
name: (_state$
|
|
3039
|
-
image: (_state$
|
|
3059
|
+
id: (_state$active_retaile10 = state.active_retailer) === null || _state$active_retaile10 === void 0 ? void 0 : _state$active_retaile10.id_retailer,
|
|
3060
|
+
name: (_state$active_retaile11 = state.active_retailer) === null || _state$active_retaile11 === void 0 ? void 0 : _state$active_retaile11.retailer,
|
|
3061
|
+
image: (_state$active_retaile12 = state.active_retailer) === null || _state$active_retaile12 === void 0 ? void 0 : _state$active_retaile12.image
|
|
3040
3062
|
},
|
|
3041
3063
|
servicesData: state.services_data ? state.services_data : null,
|
|
3042
3064
|
isObservationVisible: isObservationVisible // actions
|
|
@@ -3217,20 +3239,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3217
3239
|
reviewed: crossComment
|
|
3218
3240
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
3219
3241
|
buttonType: "circular-button accept-button",
|
|
3220
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
3221
|
-
return _regenerator.default.wrap(function
|
|
3242
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
3243
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
3222
3244
|
while (1) {
|
|
3223
|
-
switch (
|
|
3245
|
+
switch (_context17.prev = _context17.next) {
|
|
3224
3246
|
case 0:
|
|
3225
3247
|
setCrossComment(true);
|
|
3226
3248
|
commentRevised();
|
|
3227
3249
|
|
|
3228
3250
|
case 2:
|
|
3229
3251
|
case "end":
|
|
3230
|
-
return
|
|
3252
|
+
return _context17.stop();
|
|
3231
3253
|
}
|
|
3232
3254
|
}
|
|
3233
|
-
},
|
|
3255
|
+
}, _callee17);
|
|
3234
3256
|
}))
|
|
3235
3257
|
})]
|
|
3236
3258
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
package/package.json
CHANGED
|
@@ -579,12 +579,22 @@ const RetailerProductEditionView = ({
|
|
|
579
579
|
(item) => item.id === id_retailer,
|
|
580
580
|
);
|
|
581
581
|
|
|
582
|
+
/**
|
|
583
|
+
* El id del retailer activo viene con dos nombres según de dónde salga:
|
|
584
|
+
* `categoryRetailerInOrder` lo trae como `id_retailer`, mientras que los
|
|
585
|
+
* retailers de `read-data-images` lo traen como `id`. Si se compara solo
|
|
586
|
+
* contra uno, al cambiar de cadena el otro queda `undefined`, la
|
|
587
|
+
* comparación es siempre falsa y `filteredValues` sale vacío — la imagen
|
|
588
|
+
* existe, el backend la devuelve, y aun así no se pinta ninguna.
|
|
589
|
+
*/
|
|
590
|
+
const activeRetailerId = id_retailer ?? state.active_retailer?.id;
|
|
591
|
+
|
|
582
592
|
const filteredValues = services[2].values.filter((value) => {
|
|
583
593
|
return services[2].inputsByRetailer.some((retailerInput) =>
|
|
584
594
|
retailerInput.some(
|
|
585
595
|
(input) =>
|
|
586
|
-
input.id_retailer ===
|
|
587
|
-
input.id_image === value.image_id,
|
|
596
|
+
Number(input.id_retailer) === Number(activeRetailerId) &&
|
|
597
|
+
Number(input.id_image) === Number(value.image_id),
|
|
588
598
|
),
|
|
589
599
|
);
|
|
590
600
|
});
|
|
@@ -802,7 +812,7 @@ const RetailerProductEditionView = ({
|
|
|
802
812
|
return currentStatus;
|
|
803
813
|
};
|
|
804
814
|
|
|
805
|
-
const handleOnClickSaveImages = () => {
|
|
815
|
+
const handleOnClickSaveImages = async () => {
|
|
806
816
|
if (state.product?.services?.images === 1) {
|
|
807
817
|
/**
|
|
808
818
|
* `updateImages` y NO `saveImageAttrs`.
|
|
@@ -819,7 +829,13 @@ const RetailerProductEditionView = ({
|
|
|
819
829
|
* botón de guardar del menú de pestañas (`handleOnClickSave`), así que
|
|
820
830
|
* ambos caminos quedan consistentes.
|
|
821
831
|
*/
|
|
822
|
-
updateImages(token);
|
|
832
|
+
await updateImages(token);
|
|
833
|
+
// Recargar para que la pantalla refleje lo que quedó guardado, igual que
|
|
834
|
+
// `handleOnClickSave`. Sin esto el estado local se queda con la imagen sin
|
|
835
|
+
// su `id` de base de datos: la vista no muestra lo persistido y, al volver
|
|
836
|
+
// a guardar, el front la manda otra vez como nueva y el backend la omite
|
|
837
|
+
// por duplicada — así que el `src` nunca se actualizaba.
|
|
838
|
+
await loadData(false);
|
|
823
839
|
}
|
|
824
840
|
};
|
|
825
841
|
|