contentoh-components-library 21.5.93 → 21.5.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/utils/compare-strings.js +45 -0
- package/dist/components/atoms/GeneralButton/styles.js +1 -1
- package/dist/components/atoms/GeneralInput/index.js +245 -54
- package/dist/components/atoms/GeneralInput/styles.js +7 -3
- package/dist/components/atoms/InputFormatter/index.js +223 -68
- package/dist/components/atoms/InputFormatter/styles.js +20 -4
- package/dist/components/molecules/StatusAsignationInfo/index.js +11 -1
- package/dist/components/molecules/TabsMenu/index.js +13 -12
- package/dist/components/molecules/TagAndInput/index.js +361 -24
- package/dist/components/molecules/TagAndInput/styles.js +2 -2
- package/dist/components/organisms/ChangeStatusModal/index.js +531 -0
- package/dist/components/organisms/ChangeStatusModal/styles.js +85 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +6 -22
- package/dist/components/organisms/InputGroup/index.js +22 -18
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +150 -337
- package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +15 -15
- package/dist/components/pages/ProviderProductEdition/index.js +408 -381
- package/dist/components/pages/ProviderProductEdition/utils.js +1 -0
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +179 -196
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +59 -260
- package/dist/components/pages/RetailerProductEdition/context/reducers/product.js +50 -38
- package/dist/components/pages/RetailerProductEdition/index.js +1719 -2237
- package/dist/components/pages/RetailerProductEdition/styles.js +4 -2
- package/dist/components/pages/RetailerProductEdition/utils.js +251 -2
- package/dist/contexts/AiProductEdition.js +230 -158
- package/dist/global-files/statusDictionary.js +103 -0
- package/package.json +4 -2
- package/src/ai/utils/compare-strings.js +45 -0
- package/src/assets/images/Icons/arrow.png +0 -0
- package/src/assets/images/Icons/cancel.png +0 -0
- package/src/assets/images/Icons/ia-icon.png +0 -0
- package/src/assets/images/Icons/loading.svg +5 -0
- package/src/assets/images/Icons/reload.png +0 -0
- package/src/components/atoms/GeneralButton/styles.js +4 -0
- package/src/components/atoms/GeneralInput/index.js +237 -60
- package/src/components/atoms/GeneralInput/styles.js +81 -0
- package/src/components/atoms/InputFormatter/index.js +200 -51
- package/src/components/atoms/InputFormatter/styles.js +284 -0
- package/src/components/atoms/RetailerSelector/RetailerSelector.stories.js +10 -0
- package/src/components/atoms/RetailerSelector/index.js +3 -0
- package/src/components/atoms/RetailerSelector/styles.js +0 -0
- package/src/components/molecules/StatusAsignationInfo/index.js +9 -1
- package/src/components/molecules/TabsMenu/index.js +12 -11
- package/src/components/molecules/TagAndInput/index.js +286 -21
- package/src/components/molecules/TagAndInput/styles.js +59 -17
- package/src/components/organisms/ChangeStatusModal/index.jsx +488 -0
- package/src/components/organisms/ChangeStatusModal/styles.js +333 -0
- package/src/components/organisms/FullProductNameHeader/index.js +4 -28
- package/src/components/organisms/FullTabsMenu/index.js +1 -1
- package/src/components/organisms/InputGroup/index.js +12 -4
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +174 -202
- package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +14 -14
- package/src/components/pages/ProviderProductEdition/index.js +489 -457
- package/src/components/pages/ProviderProductEdition/utils.js +2 -2
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +201 -224
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +575 -0
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +62 -0
- package/src/components/pages/RetailerProductEdition/context/reducers/active-state.js +344 -0
- package/src/components/pages/RetailerProductEdition/context/reducers/inputs.js +155 -0
- package/src/components/pages/RetailerProductEdition/context/reducers/product.js +114 -0
- package/src/components/pages/RetailerProductEdition/context/reducers/system.js +60 -0
- package/src/components/pages/RetailerProductEdition/index.js +1545 -1718
- package/src/components/pages/RetailerProductEdition/index_old.js +1979 -0
- package/src/components/pages/RetailerProductEdition/stories/Auditor.stories.js +101 -0
- package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +115 -0
- package/src/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +174 -0
- package/src/components/pages/RetailerProductEdition/styles.js +67 -2
- package/src/components/pages/RetailerProductEdition/utils.js +240 -0
- package/src/contexts/AiProductEdition.jsx +339 -0
- package/src/global-files/statusDictionary.js +103 -0
|
@@ -77,10 +77,12 @@ var _genericModalWarning = _interopRequireDefault(require("../../../assets/image
|
|
|
77
77
|
|
|
78
78
|
var _styles = require("./styles");
|
|
79
79
|
|
|
80
|
+
var _AiProductEdition = require("../../../contexts/AiProductEdition");
|
|
81
|
+
|
|
80
82
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
81
83
|
|
|
82
84
|
var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
83
|
-
var _location$state4, _location$state5, _location$state6, _state$active_retaile3, _state$active_retaile4, _state$images_values$2, _state$images_values10, _state$images_values11, _state$active_retaile5, _state$
|
|
85
|
+
var _location$state4, _state$product2, _state$product3, _state$product4, _state$product5, _state$product6, _state$product7, _location$state5, _location$state6, _state$active_retaile3, _state$active_retaile4, _state$images_values$2, _state$images_values10, _state$images_values11, _state$active_retaile5, _state$product11, _state$active_retaile6, _state$active_retaile7, _state$active_retaile8, _state$product12, _state$product13, _state$product14, _state$datasheets_inp, _state$datasheets_inp2, _state$product15, _state$images_values12;
|
|
84
86
|
|
|
85
87
|
var tabsSections = _ref.tabsSections,
|
|
86
88
|
_ref$productSelected = _ref.productSelected,
|
|
@@ -235,24 +237,15 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
235
237
|
(0, _react.useEffect)(function () {
|
|
236
238
|
var setProductData = function setProductData() {
|
|
237
239
|
try {
|
|
238
|
-
var product =
|
|
240
|
+
var product = productSelected ? productSelected : JSON.parse(sessionStorage.getItem("productSelected"));
|
|
239
241
|
var productNormalized = (0, _utils.normalizeProduct)(product);
|
|
240
|
-
console.log({
|
|
241
|
-
productNormalized: productNormalized
|
|
242
|
-
});
|
|
243
242
|
dispatch({
|
|
244
243
|
type: "SET_PRODUCT",
|
|
245
244
|
payload: productNormalized
|
|
246
245
|
});
|
|
247
246
|
dispatch({
|
|
248
247
|
type: "SET_ACTIVE_RETAILER",
|
|
249
|
-
payload: productNormalized.
|
|
250
|
-
});
|
|
251
|
-
var firstRetailerStatus = productNormalized.statusByRetailer[productNormalized.categoryRetailerInOrder[0].id_retailer];
|
|
252
|
-
var initialTab = firstRetailerStatus.description ? "Descripción" : firstRetailerStatus.datasheet ? "Ficha técnica" : firstRetailerStatus.images ? "Imágenes" : "Imágenes";
|
|
253
|
-
dispatch({
|
|
254
|
-
type: "SET_ACTIVE_TAB",
|
|
255
|
-
payload: initialTab
|
|
248
|
+
payload: productNormalized.categoryRetailer[0]
|
|
256
249
|
});
|
|
257
250
|
} catch (error) {
|
|
258
251
|
console.log("Error setting product data: ", error);
|
|
@@ -276,7 +269,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
276
269
|
|
|
277
270
|
var fetchData = /*#__PURE__*/function () {
|
|
278
271
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
279
|
-
var _JSON$parse$0$relatio, _JSON$parse, _JSON$parse$, _percentageRes$, data, headers, _yield$Promise$all, _yield$Promise$all2, services, percentageRes, servicesDataRes, percentages, orderMap, orderedValues;
|
|
272
|
+
var _JSON$parse$0$relatio, _JSON$parse, _JSON$parse$, _percentageRes$, data, headers, _yield$Promise$all, _yield$Promise$all2, services, percentageRes, servicesDataRes, percentages, orderMap, orderedValues, updatedStatusByRetailer;
|
|
280
273
|
|
|
281
274
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
282
275
|
while (1) {
|
|
@@ -326,6 +319,21 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
326
319
|
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;
|
|
327
320
|
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;
|
|
328
321
|
return orderA - orderB;
|
|
322
|
+
}); //Cuando carguemos la información de los servicios, las actualizamos en el estado del producto
|
|
323
|
+
|
|
324
|
+
updatedStatusByRetailer = servicesDataRes.reduce(function (acc, current, idx) {
|
|
325
|
+
var id_retailer = current.id_retailer,
|
|
326
|
+
service = current.service,
|
|
327
|
+
status = current.status;
|
|
328
|
+
if (!acc[id_retailer]) acc[id_retailer] = {};
|
|
329
|
+
acc[id_retailer][service] = status;
|
|
330
|
+
return acc;
|
|
331
|
+
}, {});
|
|
332
|
+
dispatch({
|
|
333
|
+
type: "SET_PRODUCT",
|
|
334
|
+
payload: (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product), {}, {
|
|
335
|
+
statusByRetailer: updatedStatusByRetailer
|
|
336
|
+
})
|
|
329
337
|
});
|
|
330
338
|
dispatch({
|
|
331
339
|
type: "SET_SERVICES",
|
|
@@ -352,11 +360,11 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
352
360
|
return rId === id_retailer;
|
|
353
361
|
})
|
|
354
362
|
});
|
|
355
|
-
_context2.next =
|
|
363
|
+
_context2.next = 26;
|
|
356
364
|
break;
|
|
357
365
|
|
|
358
|
-
case
|
|
359
|
-
_context2.prev =
|
|
366
|
+
case 22:
|
|
367
|
+
_context2.prev = 22;
|
|
360
368
|
_context2.t0 = _context2["catch"](1);
|
|
361
369
|
console.error("Error fetching data:", _context2.t0);
|
|
362
370
|
dispatch({
|
|
@@ -364,20 +372,20 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
364
372
|
payload: _context2.t0
|
|
365
373
|
});
|
|
366
374
|
|
|
367
|
-
case
|
|
368
|
-
_context2.prev =
|
|
375
|
+
case 26:
|
|
376
|
+
_context2.prev = 26;
|
|
369
377
|
dispatch({
|
|
370
378
|
type: "SET_LOADING",
|
|
371
379
|
payload: false
|
|
372
380
|
});
|
|
373
|
-
return _context2.finish(
|
|
381
|
+
return _context2.finish(26);
|
|
374
382
|
|
|
375
|
-
case
|
|
383
|
+
case 29:
|
|
376
384
|
case "end":
|
|
377
385
|
return _context2.stop();
|
|
378
386
|
}
|
|
379
387
|
}
|
|
380
|
-
}, _callee2, null, [[1,
|
|
388
|
+
}, _callee2, null, [[1, 22, 26, 29]]);
|
|
381
389
|
}));
|
|
382
390
|
|
|
383
391
|
return function fetchData() {
|
|
@@ -386,7 +394,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
386
394
|
}();
|
|
387
395
|
|
|
388
396
|
fetchData();
|
|
389
|
-
}, [state.product, state.active_retailer, token]); // Actualizador de campos del ui para que coincidan con el retailer activo
|
|
397
|
+
}, [(_state$product2 = state.product) === null || _state$product2 === void 0 ? void 0 : _state$product2.datasheet_status, (_state$product3 = state.product) === null || _state$product3 === void 0 ? void 0 : _state$product3.description_status, (_state$product4 = state.product) === null || _state$product4 === void 0 ? void 0 : _state$product4.images_status, (_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : _state$product5.status, (_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6.percentages, (_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : _state$product7.version, state.active_retailer, token]); // Actualizador de campos del ui para que coincidan con el retailer activo
|
|
390
398
|
|
|
391
399
|
(0, _react.useEffect)(function () {
|
|
392
400
|
if (!state.active_retailer) return;
|
|
@@ -394,54 +402,52 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
394
402
|
|
|
395
403
|
var updateInputsActiveRetailer = function updateInputsActiveRetailer() {
|
|
396
404
|
if (!state.services) return;
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
if (state.services.descriptions) {
|
|
410
|
-
var descriptionsActiveRetailer = state.services.descriptions.filter(function (item) {
|
|
411
|
-
return item.id === state.active_retailer.id_retailer;
|
|
412
|
-
});
|
|
413
|
-
dispatch({
|
|
414
|
-
type: "SET_DESCRIPTIONS_INPUTS",
|
|
415
|
-
payload: descriptionsActiveRetailer
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
if (state.services.images) {
|
|
420
|
-
var filteredValues = state.services.images.values.filter(function (value) {
|
|
421
|
-
return state.services.images.inputsByRetailer.some(function (retailerInput) {
|
|
422
|
-
return retailerInput.some(function (input) {
|
|
423
|
-
return input.id_retailer === state.active_retailer.id_retailer && input.id_image === value.image_id;
|
|
424
|
-
});
|
|
405
|
+
var retailerDatasheets = state.services.datasheets[state.active_retailer.id_retailer];
|
|
406
|
+
var datasheetsActiveRetailer = (0, _objectSpread4.default)((0, _objectSpread4.default)({}, retailerDatasheets), {}, {
|
|
407
|
+
data: Object.values(retailerDatasheets.data)
|
|
408
|
+
});
|
|
409
|
+
var descriptionsActiveRetailer = state.services.descriptions.filter(function (item) {
|
|
410
|
+
return item.id === state.active_retailer.id_retailer;
|
|
411
|
+
});
|
|
412
|
+
var filteredValues = state.services.images.values.filter(function (value) {
|
|
413
|
+
return state.services.images.inputsByRetailer.some(function (retailerInput) {
|
|
414
|
+
return retailerInput.some(function (input) {
|
|
415
|
+
return input.id_retailer === state.active_retailer.id_retailer && input.id_image === value.image_id;
|
|
425
416
|
});
|
|
426
417
|
});
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
418
|
+
});
|
|
419
|
+
dispatch({
|
|
420
|
+
type: "SET_DATASHEETS_INPUTS",
|
|
421
|
+
payload: [datasheetsActiveRetailer, state.services.datasheets.inputs]
|
|
422
|
+
});
|
|
423
|
+
dispatch({
|
|
424
|
+
type: "SET_DESCRIPTIONS_INPUTS",
|
|
425
|
+
payload: descriptionsActiveRetailer
|
|
426
|
+
});
|
|
427
|
+
dispatch({
|
|
428
|
+
type: "SET_IMAGES_VALUES",
|
|
429
|
+
payload: (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.services.images), {}, {
|
|
430
|
+
values: filteredValues
|
|
431
|
+
})
|
|
432
|
+
});
|
|
434
433
|
};
|
|
435
434
|
|
|
436
435
|
updateInputsActiveRetailer();
|
|
437
436
|
}, [state.services]); // Helper functions
|
|
438
437
|
|
|
439
438
|
var canShowValidationButtons = function canShowValidationButtons() {
|
|
440
|
-
var _state$
|
|
439
|
+
var _state$product8;
|
|
440
|
+
|
|
441
|
+
if (!((_state$product8 = state.product) !== null && _state$product8 !== void 0 && _state$product8.statusByRetailer)) return false;
|
|
442
|
+
var currentService = (0, _utils.getConceptByTab)(state.active_tab); // const currentStatus = state.product[`${currentService}_status`];
|
|
443
|
+
|
|
444
|
+
var currentRetailer = state.active_retailer.id_retailer; //Información del servicio de la cadena seleccionada
|
|
445
|
+
|
|
446
|
+
var _state$services_data$ = state.services_data.find(function (service) {
|
|
447
|
+
return service.service === currentService && service.id_retailer === currentRetailer;
|
|
448
|
+
}),
|
|
449
|
+
currentStatus = _state$services_data$.status;
|
|
441
450
|
|
|
442
|
-
if (!((_state$product2 = state.product) !== null && _state$product2 !== void 0 && _state$product2.statusByRetailer)) return false;
|
|
443
|
-
var currentService = (0, _utils.getConceptByTab)(state.active_tab);
|
|
444
|
-
var currentStatus = state.product["".concat(currentService, "_status")];
|
|
445
451
|
var originTab = origin[state.active_tab];
|
|
446
452
|
var isRetailerUser = (user === null || user === void 0 ? void 0 : user.is_retailer) === 1;
|
|
447
453
|
var validStatuses = ["AA", "AP", "R", "CA", "RCA"];
|
|
@@ -455,7 +461,8 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
455
461
|
|
|
456
462
|
|
|
457
463
|
var hasNoOrder = !state.product.id_order && !state.product.orderId;
|
|
458
|
-
|
|
464
|
+
var condition = originTab === "RequestWithoutContentoh" && (["R", "CA"].includes(currentStatus) || currentStatus === "RCA" && hasNoOrder) || ["RequestWithContentoh", "Contentoh"].includes(originTab) && currentStatus === "AA";
|
|
465
|
+
return condition;
|
|
459
466
|
};
|
|
460
467
|
|
|
461
468
|
var canShowSaveButton = function canShowSaveButton(version_status) {
|
|
@@ -547,9 +554,9 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
547
554
|
};
|
|
548
555
|
|
|
549
556
|
var handleOnClickSaveImages = function handleOnClickSaveImages() {
|
|
550
|
-
var _state$
|
|
557
|
+
var _state$product9, _state$product9$servi;
|
|
551
558
|
|
|
552
|
-
if (((_state$
|
|
559
|
+
if (((_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : (_state$product9$servi = _state$product9.services) === null || _state$product9$servi === void 0 ? void 0 : _state$product9$servi.images) === 1) {
|
|
553
560
|
updateImages();
|
|
554
561
|
}
|
|
555
562
|
};
|
|
@@ -770,9 +777,10 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
770
777
|
|
|
771
778
|
var sendEvaluation = /*#__PURE__*/function () {
|
|
772
779
|
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(result) {
|
|
773
|
-
var _state$product$id_ord, _state$
|
|
780
|
+
var _state$product$id_ord, _state$product10, _state$active_retaile2;
|
|
781
|
+
|
|
782
|
+
var concept, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, _newStatuses$newStatu, _state$services_data, res, newStatuses, serviceStatus, updatedProduct, updatedServicesData;
|
|
774
783
|
|
|
775
|
-
var concept, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, res, newStatuses, serviceStatus, updatedProduct;
|
|
776
784
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
777
785
|
while (1) {
|
|
778
786
|
switch (_context3.prev = _context3.next) {
|
|
@@ -785,7 +793,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
785
793
|
articleId = state.product.id_article;
|
|
786
794
|
orderId = (_state$product$id_ord = state.product.id_order) !== null && _state$product$id_ord !== void 0 ? _state$product$id_ord : state.product.orderId;
|
|
787
795
|
sectionStatusKey = "".concat(concept, "_status");
|
|
788
|
-
evalStatus = state.product[sectionStatusKey] || ((_state$
|
|
796
|
+
evalStatus = state.product[sectionStatusKey] || ((_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.version_status);
|
|
789
797
|
data = {
|
|
790
798
|
articleId: articleId,
|
|
791
799
|
orderId: orderId,
|
|
@@ -796,7 +804,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
796
804
|
_context3.prev = 8;
|
|
797
805
|
|
|
798
806
|
if (!result) {
|
|
799
|
-
_context3.next =
|
|
807
|
+
_context3.next = 23;
|
|
800
808
|
break;
|
|
801
809
|
}
|
|
802
810
|
|
|
@@ -812,14 +820,29 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
812
820
|
case 14:
|
|
813
821
|
res = _context3.sent;
|
|
814
822
|
newStatuses = JSON.parse(res.data.body);
|
|
815
|
-
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")];
|
|
823
|
+
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")];
|
|
824
|
+
console.log({
|
|
825
|
+
product: state.product,
|
|
826
|
+
newStatuses: newStatuses,
|
|
827
|
+
serviceStatus: serviceStatus,
|
|
828
|
+
servicesData: state.services_data
|
|
829
|
+
}); // Actualizar el producto con los nuevos estados
|
|
816
830
|
|
|
817
831
|
updatedProduct = (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product), {}, {
|
|
818
|
-
statusByRetailer: (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product.statusByRetailer), {}, (0, _defineProperty2.default)({}, retailerId, (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product.statusByRetailer[retailerId]), {}, (0, _defineProperty2.default)({}, concept, serviceStatus))))
|
|
832
|
+
statusByRetailer: (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product.statusByRetailer), {}, (0, _defineProperty2.default)({}, retailerId, (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product.statusByRetailer[retailerId]), {}, (0, _defineProperty2.default)({}, concept, (_newStatuses$newStatu = newStatuses === null || newStatuses === void 0 ? void 0 : newStatuses.newStatus) !== null && _newStatuses$newStatu !== void 0 ? _newStatuses$newStatu : serviceStatus))))
|
|
819
833
|
});
|
|
820
|
-
|
|
821
|
-
|
|
834
|
+
updatedServicesData = (_state$services_data = state.services_data) === null || _state$services_data === void 0 ? void 0 : _state$services_data.map(function (service) {
|
|
835
|
+
var _newStatuses$newStatu2;
|
|
836
|
+
|
|
837
|
+
return (0, _objectSpread4.default)((0, _objectSpread4.default)({}, service), {}, {
|
|
838
|
+
status: (service === null || service === void 0 ? void 0 : service.id_retailer) === retailerId && (service === null || service === void 0 ? void 0 : service.service) === concept ? (_newStatuses$newStatu2 = newStatuses === null || newStatuses === void 0 ? void 0 : newStatuses.newStatus) !== null && _newStatuses$newStatu2 !== void 0 ? _newStatuses$newStatu2 : serviceStatus : service === null || service === void 0 ? void 0 : service.status
|
|
839
|
+
});
|
|
822
840
|
});
|
|
841
|
+
dispatch({
|
|
842
|
+
type: "SET_SERVICES_DATA",
|
|
843
|
+
payload: updatedServicesData
|
|
844
|
+
}); // console.log({ updatedProduct });
|
|
845
|
+
|
|
823
846
|
dispatch({
|
|
824
847
|
type: "SET_PRODUCT",
|
|
825
848
|
payload: updatedProduct
|
|
@@ -835,12 +858,12 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
835
858
|
}
|
|
836
859
|
});
|
|
837
860
|
|
|
838
|
-
case
|
|
839
|
-
_context3.next =
|
|
861
|
+
case 23:
|
|
862
|
+
_context3.next = 29;
|
|
840
863
|
break;
|
|
841
864
|
|
|
842
|
-
case
|
|
843
|
-
_context3.prev =
|
|
865
|
+
case 25:
|
|
866
|
+
_context3.prev = 25;
|
|
844
867
|
_context3.t0 = _context3["catch"](8);
|
|
845
868
|
console.error("Error sending evaluation:", _context3.t0);
|
|
846
869
|
dispatch({
|
|
@@ -853,20 +876,20 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
853
876
|
}
|
|
854
877
|
});
|
|
855
878
|
|
|
856
|
-
case
|
|
857
|
-
_context3.prev =
|
|
879
|
+
case 29:
|
|
880
|
+
_context3.prev = 29;
|
|
858
881
|
dispatch({
|
|
859
882
|
type: "SET_SAVING",
|
|
860
883
|
payload: false
|
|
861
884
|
});
|
|
862
|
-
return _context3.finish(
|
|
885
|
+
return _context3.finish(29);
|
|
863
886
|
|
|
864
|
-
case
|
|
887
|
+
case 32:
|
|
865
888
|
case "end":
|
|
866
889
|
return _context3.stop();
|
|
867
890
|
}
|
|
868
891
|
}
|
|
869
|
-
}, _callee3, null, [[8,
|
|
892
|
+
}, _callee3, null, [[8, 25, 29, 32]]);
|
|
870
893
|
}));
|
|
871
894
|
|
|
872
895
|
return function sendEvaluation(_x2) {
|
|
@@ -1088,7 +1111,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1088
1111
|
|
|
1089
1112
|
var handleOnEvaluateAll = /*#__PURE__*/function () {
|
|
1090
1113
|
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(result) {
|
|
1091
|
-
var _state$product$id_ord2, _state$
|
|
1114
|
+
var _state$product$id_ord2, _state$services_data2, evaluationArray, conceptArray, dataGeneral, userType, status, updatedStatusByRetailer, updatedProduct;
|
|
1092
1115
|
|
|
1093
1116
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
1094
1117
|
while (1) {
|
|
@@ -1108,7 +1131,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1108
1131
|
isAproved: result === "A"
|
|
1109
1132
|
}; // Crear todas las evaluaciones para cada servicio y retailer
|
|
1110
1133
|
|
|
1111
|
-
(_state$
|
|
1134
|
+
(_state$services_data2 = state.services_data) === null || _state$services_data2 === void 0 ? void 0 : _state$services_data2.forEach(function (ret) {
|
|
1112
1135
|
var service = ret.service,
|
|
1113
1136
|
id_retailer = ret.id_retailer;
|
|
1114
1137
|
var data = {};
|
|
@@ -1238,328 +1261,332 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1238
1261
|
};
|
|
1239
1262
|
|
|
1240
1263
|
if (state.loading || !state.services || !state.product) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {});
|
|
1241
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
},
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
payload: {
|
|
1284
|
-
show: false,
|
|
1285
|
-
title: "",
|
|
1286
|
-
message: "",
|
|
1287
|
-
image: null
|
|
1288
|
-
}
|
|
1289
|
-
});
|
|
1290
|
-
}
|
|
1291
|
-
}), showRejectModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
|
|
1292
|
-
title: rejectAll ? "Agregar mensaje para rechazar todo" : "Agregar mensaje de rechazo",
|
|
1293
|
-
show: showRejectModal,
|
|
1294
|
-
customComponent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
|
|
1295
|
-
inputType: "textarea",
|
|
1296
|
-
inputId: "modal-message-box",
|
|
1297
|
-
index: 0,
|
|
1298
|
-
color: "white"
|
|
1299
|
-
}),
|
|
1300
|
-
buttons: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
|
|
1301
|
-
type: "white",
|
|
1302
|
-
label: "Cancelar",
|
|
1303
|
-
size: 12,
|
|
1264
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AiProductEdition.AiProductEditionProvider, {
|
|
1265
|
+
isCreatorsEdition: false,
|
|
1266
|
+
state: state,
|
|
1267
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
1268
|
+
headerTop: headerTop,
|
|
1269
|
+
children: [showVersionSelector && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VersionSelector.VersionSelector, {
|
|
1270
|
+
modalId: "version-selector",
|
|
1271
|
+
articleId: state.product.id_article,
|
|
1272
|
+
setVersion: handleOnChangeProductVersion,
|
|
1273
|
+
companyName: company.company_name,
|
|
1274
|
+
currentVersion: state.product.version,
|
|
1275
|
+
setShowVersionSelector: setShowVersionSelector,
|
|
1276
|
+
jwt: token
|
|
1277
|
+
}), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImageModal.ProductImageModal, {
|
|
1278
|
+
images: state.images_values,
|
|
1279
|
+
setShowModal: setShowModal,
|
|
1280
|
+
approveRejectButtons: canShowValidationButtons(),
|
|
1281
|
+
sendToFacilitator: handleOnSendEvaluation
|
|
1282
|
+
}), state.modal.show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
|
|
1283
|
+
componentsArray: [state.modal.image && /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
1284
|
+
src: state.modal.image,
|
|
1285
|
+
alt: "modal icon"
|
|
1286
|
+
}, "1"), state.modal.title && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1287
|
+
headerType: "retailer-name-header",
|
|
1288
|
+
text: state.modal.title,
|
|
1289
|
+
color: "white"
|
|
1290
|
+
}, "2"), state.modal.message && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1291
|
+
headerType: "retailer-name-header",
|
|
1292
|
+
text: state.modal.message,
|
|
1293
|
+
color: "white"
|
|
1294
|
+
}, "3"), state.modal.buttons && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1295
|
+
style: {
|
|
1296
|
+
marginTop: "16px"
|
|
1297
|
+
},
|
|
1298
|
+
children: state.modal.buttons.map(function (button, index) {
|
|
1299
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1300
|
+
buttonType: button.buttonType,
|
|
1301
|
+
label: button.text,
|
|
1302
|
+
onClick: button.action
|
|
1303
|
+
}, index);
|
|
1304
|
+
})
|
|
1305
|
+
}, "4")].filter(Boolean),
|
|
1304
1306
|
onClick: function onClick() {
|
|
1305
|
-
|
|
1307
|
+
return dispatch({
|
|
1308
|
+
type: "SET_MODAL",
|
|
1309
|
+
payload: {
|
|
1310
|
+
show: false,
|
|
1311
|
+
title: "",
|
|
1312
|
+
message: "",
|
|
1313
|
+
image: null
|
|
1314
|
+
}
|
|
1315
|
+
});
|
|
1306
1316
|
}
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1317
|
+
}), showRejectModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
|
|
1318
|
+
title: rejectAll ? "Agregar mensaje para rechazar todo" : "Agregar mensaje de rechazo",
|
|
1319
|
+
show: showRejectModal,
|
|
1320
|
+
customComponent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
|
|
1321
|
+
inputType: "textarea",
|
|
1322
|
+
inputId: "modal-message-box",
|
|
1323
|
+
index: 0,
|
|
1324
|
+
color: "white"
|
|
1325
|
+
}),
|
|
1326
|
+
buttons: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
|
|
1327
|
+
type: "white",
|
|
1328
|
+
label: "Cancelar",
|
|
1329
|
+
size: 12,
|
|
1330
|
+
onClick: function onClick() {
|
|
1331
|
+
setShowRejectModal(false);
|
|
1332
|
+
}
|
|
1333
|
+
}, "btn-Cancelar"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
|
|
1334
|
+
type: "pink",
|
|
1335
|
+
label: "Aceptar",
|
|
1336
|
+
size: 12,
|
|
1337
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
1338
|
+
var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
|
|
1339
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
1340
|
+
while (1) {
|
|
1341
|
+
switch (_context6.prev = _context6.next) {
|
|
1342
|
+
case 0:
|
|
1343
|
+
elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
|
|
1323
1344
|
|
|
1324
|
-
|
|
1325
|
-
|
|
1345
|
+
if (!(!elements || elements.length === 0)) {
|
|
1346
|
+
_context6.next = 4;
|
|
1347
|
+
break;
|
|
1348
|
+
}
|
|
1326
1349
|
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
var body = el.innerHTML;
|
|
1330
|
-
return !body || body.replace(/<.*?\/?>/gm, "").trim() === "";
|
|
1331
|
-
});
|
|
1350
|
+
console.error("Elemento no encontrado");
|
|
1351
|
+
return _context6.abrupt("return");
|
|
1332
1352
|
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1353
|
+
case 4:
|
|
1354
|
+
isMessageEmpty = Array.from(elements).every(function (el) {
|
|
1355
|
+
var body = el.innerHTML;
|
|
1356
|
+
return !body || body.replace(/<.*?\/?>/gm, "").trim() === "";
|
|
1357
|
+
});
|
|
1337
1358
|
|
|
1338
|
-
|
|
1339
|
-
|
|
1359
|
+
if (!isMessageEmpty) {
|
|
1360
|
+
_context6.next = 10;
|
|
1361
|
+
break;
|
|
1362
|
+
}
|
|
1340
1363
|
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
alert.className = "alert-error";
|
|
1344
|
-
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 ";
|
|
1345
|
-
alert.innerHTML = "<span>El mensaje no puede estar vac\xEDo.</span>";
|
|
1346
|
-
container.appendChild(alert);
|
|
1347
|
-
}
|
|
1364
|
+
container = document.querySelector(".container-customComponent");
|
|
1365
|
+
existingAlert = container.querySelector(".alert-error");
|
|
1348
1366
|
|
|
1349
|
-
|
|
1367
|
+
if (!existingAlert) {
|
|
1368
|
+
alert = document.createElement("div");
|
|
1369
|
+
alert.className = "alert-error";
|
|
1370
|
+
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 ";
|
|
1371
|
+
alert.innerHTML = "<span>El mensaje no puede estar vac\xEDo.</span>";
|
|
1372
|
+
container.appendChild(alert);
|
|
1373
|
+
}
|
|
1350
1374
|
|
|
1351
|
-
|
|
1352
|
-
fullMessage = Array.from(elements).map(function (element) {
|
|
1353
|
-
return element.innerHTML;
|
|
1354
|
-
}).join("").replace(/<br\s*\/?>/gi, "\n");
|
|
1355
|
-
_context6.next = 13;
|
|
1356
|
-
return createComment(fullMessage);
|
|
1375
|
+
return _context6.abrupt("return");
|
|
1357
1376
|
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1377
|
+
case 10:
|
|
1378
|
+
fullMessage = Array.from(elements).map(function (element) {
|
|
1379
|
+
return element.innerHTML;
|
|
1380
|
+
}).join("").replace(/<br\s*\/?>/gi, "\n");
|
|
1381
|
+
_context6.next = 13;
|
|
1382
|
+
return createComment(fullMessage, token);
|
|
1361
1383
|
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
}, _callee6);
|
|
1368
|
-
}))
|
|
1369
|
-
}, "btn-Aceptar")]
|
|
1370
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
1371
|
-
setHeaderTop: setHeaderTop,
|
|
1372
|
-
withChat: location === null || location === void 0 ? void 0 : (_location$state5 = location.state) === null || _location$state5 === void 0 ? void 0 : _location$state5.withChat,
|
|
1373
|
-
chatType: location === null || location === void 0 ? void 0 : (_location$state6 = location.state) === null || _location$state6 === void 0 ? void 0 : _location$state6.chatType,
|
|
1374
|
-
productSelected: state.product,
|
|
1375
|
-
token: token,
|
|
1376
|
-
activeRetailer: {
|
|
1377
|
-
id: (_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer,
|
|
1378
|
-
name: (_state$active_retaile4 = state.active_retailer) === null || _state$active_retaile4 === void 0 ? void 0 : _state$active_retaile4.retailer
|
|
1379
|
-
}
|
|
1380
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1381
|
-
className: "data-container",
|
|
1382
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1383
|
-
className: "image-data-panel",
|
|
1384
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagePreviewer.ImagePreviewer, {
|
|
1385
|
-
activeImage: (_state$images_values$2 = state.images_values.values[state.current_image]) !== null && _state$images_values$2 !== void 0 ? _state$images_values$2 : {},
|
|
1386
|
-
imagesArray: state.images_values || [],
|
|
1387
|
-
setActiveImage: handleOnChangeCurrentImage,
|
|
1388
|
-
setShowModal: handleOnShowModalGalery
|
|
1389
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageDataTable.ImageDataTable, {
|
|
1390
|
-
lists: state.images_values || [],
|
|
1391
|
-
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] : {},
|
|
1392
|
-
assignationsImages: assig,
|
|
1393
|
-
retailerSelected: (_state$active_retaile5 = state.active_retailer) === null || _state$active_retaile5 === void 0 ? void 0 : _state$active_retaile5.id_retailer,
|
|
1394
|
-
imagesStatus: ((_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : _state$product5.images_status) || "-",
|
|
1395
|
-
isRetailer: isRetailer,
|
|
1396
|
-
setShowVersionSelector: setShowVersionSelector,
|
|
1397
|
-
version: state.product.version,
|
|
1398
|
-
setImages: handleOnChangeCurrentImage,
|
|
1399
|
-
onClickSave: handleOnClickSaveImages,
|
|
1400
|
-
setAssignation: handleOnChangeAssignations // No se usa?
|
|
1384
|
+
case 13:
|
|
1385
|
+
rejectAll ? handleOnEvaluateAll("R") : handleOnSendEvaluation("R");
|
|
1386
|
+
setShowRejectModal(false);
|
|
1401
1387
|
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1388
|
+
case 15:
|
|
1389
|
+
case "end":
|
|
1390
|
+
return _context6.stop();
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
}, _callee6);
|
|
1394
|
+
}))
|
|
1395
|
+
}, "btn-Aceptar")]
|
|
1396
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
1397
|
+
setHeaderTop: setHeaderTop,
|
|
1398
|
+
withChat: location === null || location === void 0 ? void 0 : (_location$state5 = location.state) === null || _location$state5 === void 0 ? void 0 : _location$state5.withChat,
|
|
1399
|
+
chatType: location === null || location === void 0 ? void 0 : (_location$state6 = location.state) === null || _location$state6 === void 0 ? void 0 : _location$state6.chatType,
|
|
1400
|
+
productSelected: state.product,
|
|
1401
|
+
token: token,
|
|
1402
|
+
activeRetailer: {
|
|
1403
|
+
id: (_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer,
|
|
1404
|
+
name: (_state$active_retaile4 = state.active_retailer) === null || _state$active_retaile4 === void 0 ? void 0 : _state$active_retaile4.retailer
|
|
1405
|
+
}
|
|
1406
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1407
|
+
className: "data-container",
|
|
1408
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1409
|
+
className: "image-data-panel",
|
|
1410
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagePreviewer.ImagePreviewer, {
|
|
1411
|
+
activeImage: (_state$images_values$2 = state.images_values.values[state.current_image]) !== null && _state$images_values$2 !== void 0 ? _state$images_values$2 : {},
|
|
1412
|
+
imagesArray: state.images_values || [],
|
|
1413
|
+
setActiveImage: handleOnChangeCurrentImage,
|
|
1414
|
+
setShowModal: handleOnShowModalGalery
|
|
1415
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageDataTable.ImageDataTable, {
|
|
1416
|
+
lists: state.images_values || [],
|
|
1417
|
+
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] : {},
|
|
1418
|
+
assignationsImages: assig,
|
|
1419
|
+
retailerSelected: (_state$active_retaile5 = state.active_retailer) === null || _state$active_retaile5 === void 0 ? void 0 : _state$active_retaile5.id_retailer,
|
|
1420
|
+
imagesStatus: ((_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : _state$product11.images_status) || "-",
|
|
1430
1421
|
isRetailer: isRetailer,
|
|
1431
|
-
|
|
1422
|
+
setShowVersionSelector: setShowVersionSelector,
|
|
1432
1423
|
version: state.product.version,
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
,
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
,
|
|
1498
|
-
|
|
1499
|
-
,
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
children:
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1424
|
+
setImages: handleOnChangeCurrentImage,
|
|
1425
|
+
onClickSave: handleOnClickSaveImages,
|
|
1426
|
+
setAssignation: handleOnChangeAssignations // No se usa?
|
|
1427
|
+
|
|
1428
|
+
})]
|
|
1429
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1430
|
+
className: "product-information",
|
|
1431
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1432
|
+
className: "product-information",
|
|
1433
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader, {
|
|
1434
|
+
headerData: state.product,
|
|
1435
|
+
percent: state.active_percentage.percentagesGeneral.required,
|
|
1436
|
+
activeRetailer: {
|
|
1437
|
+
id: (_state$active_retaile6 = state.active_retailer) === null || _state$active_retaile6 === void 0 ? void 0 : _state$active_retaile6.id_retailer,
|
|
1438
|
+
name: (_state$active_retaile7 = state.active_retailer) === null || _state$active_retaile7 === void 0 ? void 0 : _state$active_retaile7.retailer,
|
|
1439
|
+
image: (_state$active_retaile8 = state.active_retailer) === null || _state$active_retaile8 === void 0 ? void 0 : _state$active_retaile8.image
|
|
1440
|
+
},
|
|
1441
|
+
showValidationButtons: canShowValidationButtons(),
|
|
1442
|
+
showApproveRejectAll: canShowValidationButtons(),
|
|
1443
|
+
servicesData: state.services_data ? state.services_data : null,
|
|
1444
|
+
approveAll: handleOnApproveAll,
|
|
1445
|
+
rejectAll: handleOnRejectAll,
|
|
1446
|
+
approve: function approve() {
|
|
1447
|
+
return handleOnSendEvaluation("A");
|
|
1448
|
+
},
|
|
1449
|
+
reject: handleOnReject,
|
|
1450
|
+
setActiveRetailer: handleOnChangeActiveRetailer
|
|
1451
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
|
|
1452
|
+
tabsSections: tabsSections,
|
|
1453
|
+
status: getStatusByCurrentServiceAndRetailer(),
|
|
1454
|
+
activeTab: state.active_tab,
|
|
1455
|
+
user: user,
|
|
1456
|
+
isRetailer: isRetailer,
|
|
1457
|
+
assig: assig,
|
|
1458
|
+
version: state.product.version,
|
|
1459
|
+
updatedDescriptions: state.updated_descriptions_inputs,
|
|
1460
|
+
updatedDatasheets: state.updated_datasheets_inputs,
|
|
1461
|
+
updatedImages: state.updated_images_values,
|
|
1462
|
+
images: state.services.images // actions
|
|
1463
|
+
,
|
|
1464
|
+
downloadImages: handleOnDownloadImages,
|
|
1465
|
+
askToDeleteImages: handleOnAskToDeleteImages,
|
|
1466
|
+
showSaveButton: canShowSaveButton(state.product.version_status),
|
|
1467
|
+
onClickSave: handleOnClickSave // setters
|
|
1468
|
+
,
|
|
1469
|
+
setActiveTab: handleOnChangeActiveTab,
|
|
1470
|
+
setImageLayout: handleOnSetImageLayout,
|
|
1471
|
+
setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
|
|
1472
|
+
setUpdatedDatasheets: handleOnSetUpdatedDatasheets,
|
|
1473
|
+
setAssignation: handleOnSetAssignation // No se usa?
|
|
1474
|
+
,
|
|
1475
|
+
setImages: handleOnSetImages // No se usa?
|
|
1476
|
+
// setSelectedImages={handleOnSetSelectedImages} // Se pasa hasta TabsMenu, pero no se usa
|
|
1477
|
+
,
|
|
1478
|
+
setShowVersionSelector: setShowVersionSelector
|
|
1479
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1480
|
+
className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
|
|
1481
|
+
children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
1482
|
+
children: [state.active_tab === "Descripción" && (((_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : _state$product12.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
1483
|
+
activeSection: state.active_tab,
|
|
1484
|
+
inputGroup: state.descriptions_inputs[0],
|
|
1485
|
+
updatedDescriptions: state.updated_descriptions_inputs,
|
|
1486
|
+
articleId: (_state$product13 = state.product) === null || _state$product13 === void 0 ? void 0 : _state$product13.id_article,
|
|
1487
|
+
version: state.product.version,
|
|
1488
|
+
isShowbox: false,
|
|
1489
|
+
dinamicHeight: true,
|
|
1490
|
+
setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
|
|
1491
|
+
updateApprovedInputs: handleOnUpdateApprovedInputs // No se usa?
|
|
1492
|
+
|
|
1493
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1494
|
+
text: "No cuentas con este servicio",
|
|
1495
|
+
headerType: "input-name-header"
|
|
1496
|
+
})), state.active_tab === "Ficha técnica" && (((_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
1497
|
+
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) {
|
|
1498
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
1499
|
+
index: index,
|
|
1500
|
+
articleId: state.product.id_article,
|
|
1501
|
+
version: state.version,
|
|
1502
|
+
activeSection: state.active_tab,
|
|
1503
|
+
inputGroup: dataGroup,
|
|
1504
|
+
dataInputs: state.datasheets_inputs[1],
|
|
1505
|
+
activeRetailer: state.services.datasheets[state.active_retailer.id_retailer],
|
|
1506
|
+
groupData: state.services.datasheets[state.active_retailer.id_retailer].data,
|
|
1507
|
+
updatedDatasheets: state.updated_datasheets_inputs,
|
|
1508
|
+
setUpdatedDatasheets: handleOnSetUpdatedDatasheets,
|
|
1509
|
+
isShowbox: true,
|
|
1510
|
+
setUpdatedBoxData: function setUpdatedBoxData(e) {
|
|
1511
|
+
setBoxData(e);
|
|
1512
|
+
},
|
|
1513
|
+
updateApprovedInputs: handleOnUpdateApprovedInputs // No se usa?
|
|
1514
|
+
|
|
1515
|
+
}, index + "-" + state.active_retailer.retailer);
|
|
1516
|
+
})
|
|
1517
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1518
|
+
text: "No cuentas con este servicio",
|
|
1519
|
+
headerType: "input-name-header"
|
|
1520
|
+
})), state.active_tab === "Imágenes" && (((_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
1521
|
+
children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
|
|
1522
|
+
checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
|
|
1523
|
+
,
|
|
1524
|
+
setCheckAll: handleOnSetCheckAll // Toggler de true o false para el checkbox "Seleccionar todo"
|
|
1525
|
+
,
|
|
1526
|
+
setSelectedImages: handleOnSetSelectedImages
|
|
1527
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
|
|
1528
|
+
className: "container",
|
|
1518
1529
|
style: {
|
|
1519
|
-
position: "
|
|
1520
|
-
top: "50%",
|
|
1521
|
-
left: "50%",
|
|
1522
|
-
transform: "translate(-50%, -50%)",
|
|
1523
|
-
textAlign: "center",
|
|
1524
|
-
padding: "40px",
|
|
1525
|
-
width: "80%",
|
|
1526
|
-
maxWidth: "500px",
|
|
1527
|
-
fontFamily: "Arial, sans-serif"
|
|
1530
|
+
position: "relative"
|
|
1528
1531
|
},
|
|
1529
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1532
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread4.default)((0, _objectSpread4.default)({}, getRootProps({
|
|
1533
|
+
className: "dropzone ".concat(isDragActive ? "drag-active" : "")
|
|
1534
|
+
})), {}, {
|
|
1535
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", (0, _objectSpread4.default)({}, getInputProps())), isDragActive && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1536
|
+
className: "drag-overlay",
|
|
1537
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
1538
|
+
children: "Suelta las im\xE1genes aqu\xED"
|
|
1539
|
+
})
|
|
1540
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
|
|
1541
|
+
children: thumbs()
|
|
1542
|
+
})]
|
|
1543
|
+
})), ((_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", {
|
|
1537
1544
|
style: {
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1545
|
+
position: "absolute",
|
|
1546
|
+
top: "50%",
|
|
1547
|
+
left: "50%",
|
|
1548
|
+
transform: "translate(-50%, -50%)",
|
|
1549
|
+
textAlign: "center",
|
|
1550
|
+
padding: "40px",
|
|
1551
|
+
width: "80%",
|
|
1552
|
+
maxWidth: "500px",
|
|
1553
|
+
fontFamily: "Arial, sans-serif"
|
|
1541
1554
|
},
|
|
1542
|
-
children: [
|
|
1543
|
-
onClick: open,
|
|
1555
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
1544
1556
|
style: {
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1557
|
+
fontSize: "18px",
|
|
1558
|
+
color: "#666",
|
|
1559
|
+
marginBottom: "16px"
|
|
1548
1560
|
},
|
|
1549
|
-
children: "
|
|
1561
|
+
children: "Este producto no tiene im\xE1genes"
|
|
1562
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
1563
|
+
style: {
|
|
1564
|
+
fontSize: "14px",
|
|
1565
|
+
color: "#999",
|
|
1566
|
+
marginBottom: "20px"
|
|
1567
|
+
},
|
|
1568
|
+
children: ["Arrastra las im\xE1genes aqu\xED o", " ", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1569
|
+
onClick: open,
|
|
1570
|
+
style: {
|
|
1571
|
+
color: "#007bff",
|
|
1572
|
+
cursor: "pointer",
|
|
1573
|
+
textDecoration: "underline"
|
|
1574
|
+
},
|
|
1575
|
+
children: "haz clic para abrir el explorador de archivos"
|
|
1576
|
+
})]
|
|
1550
1577
|
})]
|
|
1551
1578
|
})]
|
|
1552
1579
|
})]
|
|
1553
|
-
})
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
})
|
|
1558
|
-
})
|
|
1559
|
-
})
|
|
1560
|
-
})
|
|
1580
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1581
|
+
text: "No cuentas con este servicio",
|
|
1582
|
+
headerType: "input-name-header"
|
|
1583
|
+
}))]
|
|
1584
|
+
})
|
|
1585
|
+
})]
|
|
1586
|
+
})
|
|
1587
|
+
})]
|
|
1561
1588
|
})]
|
|
1562
|
-
})
|
|
1589
|
+
})
|
|
1563
1590
|
});
|
|
1564
1591
|
};
|
|
1565
1592
|
|