contentoh-components-library 21.1.63 → 21.1.64
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/.env.development +1 -0
- package/.env.production +1 -0
- package/dist/components/atoms/GeneralButton/index.js +3 -1
- package/dist/components/atoms/GeneralButton/styles.js +2 -2
- package/dist/components/atoms/InputFormatter/index.js +3 -3
- package/dist/components/atoms/ProductPercentCard/Percent.stories.js +1 -1
- package/dist/components/atoms/ProductPercentCard/styles.js +1 -1
- package/dist/components/atoms/Select/VersionSelect.js +37 -0
- package/dist/components/atoms/Select/index.js +4 -3
- package/dist/components/atoms/Select/style.js +10 -4
- package/dist/components/atoms/SliderToolTip/styles.js +2 -2
- package/dist/components/molecules/AssignedWork/AssignedWork.stories.js +1 -1
- package/dist/components/molecules/AssignedWork/styles.js +1 -1
- package/dist/components/molecules/StatusAsignationInfo/index.js +9 -1
- package/dist/components/molecules/VersionItem/VersionItem.stories.js +28 -0
- package/dist/components/molecules/VersionItem/index.js +64 -0
- package/dist/components/molecules/VersionItem/styles.js +20 -0
- package/dist/components/organisms/CreateVersion/CreateVersion.stories.js +31 -0
- package/dist/components/organisms/CreateVersion/RenderChilds.js +157 -0
- package/dist/components/organisms/CreateVersion/index.js +170 -0
- package/dist/components/organisms/CreateVersion/styles.js +28 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -1
- package/dist/components/organisms/FullTabsMenu/index.js +6 -2
- package/dist/components/organisms/VersionSelector/VersionSelector.stories.js +32 -0
- package/dist/components/organisms/VersionSelector/index.js +129 -0
- package/dist/components/organisms/VersionSelector/styles.js +20 -0
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +102 -112
- package/dist/components/pages/ProviderProductEdition/index.js +449 -431
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +53 -72
- package/dist/components/pages/RetailerProductEdition/index.js +245 -231
- package/dist/global-files/customHooks.js +35 -0
- package/dist/global-files/data.js +8 -8
- package/package.json +2 -2
- package/src/assets/images/versionSelector/acceptIcon.svg +3 -0
- package/src/assets/images/versionSelector/addVersion.svg +5 -0
- package/src/assets/images/versionSelector/closeVersionSelector.svg +4 -0
- package/src/assets/images/versionSelector/createVersion.svg +3 -0
- package/src/assets/images/versionSelector/nullIcon.svg +3 -0
- package/src/assets/images/versionSelector/versionSelected.svg +3 -0
- package/src/components/atoms/GeneralButton/index.js +2 -0
- package/src/components/atoms/GeneralButton/styles.js +18 -0
- package/src/components/atoms/InputFormatter/index.js +6 -3
- package/src/components/atoms/ProductPercentCard/Percent.stories.js +12 -11
- package/src/components/atoms/ProductPercentCard/styles.js +9 -9
- package/src/components/atoms/ProgressBar/styles.js +69 -0
- package/src/components/atoms/Select/VersionSelect.js +25 -0
- package/src/components/atoms/Select/index.js +1 -1
- package/src/components/atoms/Select/style.js +19 -0
- package/src/components/atoms/SliderToolTip/styles.js +18 -14
- package/src/components/molecules/AssignedWork/AssignedWork.stories.js +8 -8
- package/src/components/molecules/AssignedWork/styles.js +10 -9
- package/src/components/molecules/StatusAsignationInfo/index.js +10 -1
- package/src/components/molecules/VersionItem/VersionItem.stories.js +14 -0
- package/src/components/molecules/VersionItem/index.js +47 -0
- package/src/components/molecules/VersionItem/styles.js +32 -0
- package/src/components/organisms/CreateVersion/CreateVersion.stories.js +14 -0
- package/src/components/organisms/CreateVersion/RenderChilds.js +137 -0
- package/src/components/organisms/CreateVersion/index.js +88 -0
- package/src/components/organisms/CreateVersion/styles.js +79 -0
- package/src/components/organisms/FullProductNameHeader/index.js +2 -2
- package/src/components/organisms/FullTabsMenu/index.js +5 -1
- package/src/components/organisms/VersionSelector/VersionSelector.stories.js +15 -0
- package/src/components/organisms/VersionSelector/index.js +75 -0
- package/src/components/organisms/VersionSelector/styles.js +28 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +116 -134
- package/src/components/pages/ProviderProductEdition/index.js +267 -234
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +53 -74
- package/src/components/pages/RetailerProductEdition/index.js +201 -151
- package/src/global-files/customHooks.js +26 -0
- package/src/global-files/data.js +8 -8
- package/src/global-files/global-styles.css +1 -0
|
@@ -39,7 +39,7 @@ var _GalleryElement = require("../../molecules/GalleryElement");
|
|
|
39
39
|
|
|
40
40
|
var _fileSaver = require("file-saver");
|
|
41
41
|
|
|
42
|
-
var
|
|
42
|
+
var _data2 = require("../../../global-files/data");
|
|
43
43
|
|
|
44
44
|
var _GalleryHeader = require("../../molecules/GalleryHeader");
|
|
45
45
|
|
|
@@ -95,6 +95,10 @@ var _slide4 = _interopRequireDefault(require("../../../assets/images/sliderToolT
|
|
|
95
95
|
|
|
96
96
|
var _slide5 = _interopRequireDefault(require("../../../assets/images/sliderToolTip/slide5.svg"));
|
|
97
97
|
|
|
98
|
+
var _VersionSelector = require("../../organisms/VersionSelector");
|
|
99
|
+
|
|
100
|
+
var _customHooks = require("../../../global-files/customHooks");
|
|
101
|
+
|
|
98
102
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
99
103
|
|
|
100
104
|
var reducerImages = function reducerImages(state, action) {
|
|
@@ -167,7 +171,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
167
171
|
_ref$revision = _ref.revision,
|
|
168
172
|
revision = _ref$revision === void 0 ? false : _ref$revision,
|
|
169
173
|
setShowContentohRequestModal = _ref.setShowContentohRequestModal,
|
|
170
|
-
showSurvey = _ref.showSurvey
|
|
174
|
+
showSurvey = _ref.showSurvey,
|
|
175
|
+
company = _ref.company;
|
|
171
176
|
|
|
172
177
|
var _useState = (0, _react.useState)("Descripción"),
|
|
173
178
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -341,87 +346,103 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
341
346
|
setIcon = _useState40[1];
|
|
342
347
|
|
|
343
348
|
var _useState41 = (0, _react.useState)(product === null || product === void 0 ? void 0 : product.version),
|
|
344
|
-
_useState42 = (0, _slicedToArray2.default)(_useState41,
|
|
345
|
-
version = _useState42[0]
|
|
349
|
+
_useState42 = (0, _slicedToArray2.default)(_useState41, 2),
|
|
350
|
+
version = _useState42[0],
|
|
351
|
+
setVersion = _useState42[1];
|
|
346
352
|
|
|
347
353
|
var _useState43 = (0, _react.useState)({}),
|
|
348
|
-
_useState44 = (0, _slicedToArray2.default)(_useState43,
|
|
349
|
-
comments = _useState44[0]
|
|
354
|
+
_useState44 = (0, _slicedToArray2.default)(_useState43, 2),
|
|
355
|
+
comments = _useState44[0],
|
|
356
|
+
setComments = _useState44[1];
|
|
350
357
|
|
|
351
358
|
var _useState45 = (0, _react.useState)(""),
|
|
352
359
|
_useState46 = (0, _slicedToArray2.default)(_useState45, 2),
|
|
353
360
|
comment = _useState46[0],
|
|
354
361
|
setComment = _useState46[1];
|
|
355
362
|
|
|
356
|
-
var _useState47 = (0, _react.useState)(
|
|
363
|
+
var _useState47 = (0, _react.useState)({
|
|
364
|
+
"Ficha técnica": 0,
|
|
365
|
+
Descripción: 0,
|
|
366
|
+
Imágenes: 0
|
|
367
|
+
}),
|
|
357
368
|
_useState48 = (0, _slicedToArray2.default)(_useState47, 2),
|
|
358
|
-
|
|
359
|
-
|
|
369
|
+
requiredNull = _useState48[0],
|
|
370
|
+
setRequiredNull = _useState48[1];
|
|
360
371
|
|
|
361
|
-
var _useState49 = (0, _react.useState)(
|
|
372
|
+
var _useState49 = (0, _react.useState)(false),
|
|
362
373
|
_useState50 = (0, _slicedToArray2.default)(_useState49, 2),
|
|
363
|
-
|
|
364
|
-
|
|
374
|
+
crossComment = _useState50[0],
|
|
375
|
+
setCrossComment = _useState50[1];
|
|
365
376
|
|
|
366
|
-
var _useState51 = (0, _react.useState)(
|
|
377
|
+
var _useState51 = (0, _react.useState)([]),
|
|
367
378
|
_useState52 = (0, _slicedToArray2.default)(_useState51, 2),
|
|
368
|
-
|
|
369
|
-
|
|
379
|
+
userGroups = _useState52[0],
|
|
380
|
+
setUserGroups = _useState52[1];
|
|
370
381
|
|
|
371
|
-
var _useState53 = (0, _react.useState)(
|
|
382
|
+
var _useState53 = (0, _react.useState)({}),
|
|
372
383
|
_useState54 = (0, _slicedToArray2.default)(_useState53, 2),
|
|
373
|
-
|
|
374
|
-
|
|
384
|
+
assig = _useState54[0],
|
|
385
|
+
setAssig = _useState54[1];
|
|
375
386
|
|
|
376
387
|
var _useState55 = (0, _react.useState)([]),
|
|
377
388
|
_useState56 = (0, _slicedToArray2.default)(_useState55, 2),
|
|
378
|
-
|
|
379
|
-
|
|
389
|
+
selectedImages = _useState56[0],
|
|
390
|
+
setSelectedImages = _useState56[1];
|
|
380
391
|
|
|
381
|
-
var _useState57 = (0, _react.useState)(
|
|
392
|
+
var _useState57 = (0, _react.useState)([]),
|
|
382
393
|
_useState58 = (0, _slicedToArray2.default)(_useState57, 2),
|
|
383
|
-
|
|
384
|
-
|
|
394
|
+
componentsArray = _useState58[0],
|
|
395
|
+
setComponentsArray = _useState58[1];
|
|
396
|
+
|
|
397
|
+
var _useState59 = (0, _react.useState)(false),
|
|
398
|
+
_useState60 = (0, _slicedToArray2.default)(_useState59, 2),
|
|
399
|
+
checkAll = _useState60[0],
|
|
400
|
+
setCheckAll = _useState60[1];
|
|
385
401
|
|
|
386
402
|
var isRetailer = user === null || user === void 0 ? void 0 : user.is_retailer;
|
|
387
403
|
|
|
388
|
-
var
|
|
389
|
-
|
|
390
|
-
loading =
|
|
391
|
-
setLoading =
|
|
404
|
+
var _useState61 = (0, _react.useState)(true),
|
|
405
|
+
_useState62 = (0, _slicedToArray2.default)(_useState61, 2),
|
|
406
|
+
loading = _useState62[0],
|
|
407
|
+
setLoading = _useState62[1];
|
|
408
|
+
|
|
409
|
+
var _useState63 = (0, _react.useState)([]),
|
|
410
|
+
_useState64 = (0, _slicedToArray2.default)(_useState63, 2),
|
|
411
|
+
statusArray = _useState64[0],
|
|
412
|
+
setStatusArray = _useState64[1];
|
|
392
413
|
|
|
393
414
|
var originProp = location === null || location === void 0 ? void 0 : (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.origin;
|
|
394
415
|
|
|
395
|
-
var
|
|
416
|
+
var _useState65 = (0, _react.useState)({
|
|
396
417
|
"Ficha técnica": originProp,
|
|
397
418
|
Descripción: originProp,
|
|
398
419
|
Imágenes: originProp
|
|
399
420
|
}),
|
|
400
|
-
_useState62 = (0, _slicedToArray2.default)(_useState61, 2),
|
|
401
|
-
origin = _useState62[0],
|
|
402
|
-
setOrigin = _useState62[1];
|
|
403
|
-
|
|
404
|
-
var _useState63 = (0, _react.useState)(false),
|
|
405
|
-
_useState64 = (0, _slicedToArray2.default)(_useState63, 2),
|
|
406
|
-
inCart = _useState64[0],
|
|
407
|
-
setInCart = _useState64[1];
|
|
408
|
-
|
|
409
|
-
var _useState65 = (0, _react.useState)(false),
|
|
410
421
|
_useState66 = (0, _slicedToArray2.default)(_useState65, 2),
|
|
411
|
-
|
|
412
|
-
|
|
422
|
+
origin = _useState66[0],
|
|
423
|
+
setOrigin = _useState66[1];
|
|
413
424
|
|
|
414
425
|
var _useState67 = (0, _react.useState)(false),
|
|
415
426
|
_useState68 = (0, _slicedToArray2.default)(_useState67, 2),
|
|
416
|
-
|
|
417
|
-
|
|
427
|
+
inCart = _useState68[0],
|
|
428
|
+
setInCart = _useState68[1];
|
|
418
429
|
|
|
419
430
|
var _useState69 = (0, _react.useState)(false),
|
|
420
431
|
_useState70 = (0, _slicedToArray2.default)(_useState69, 2),
|
|
421
|
-
|
|
422
|
-
|
|
432
|
+
modalSent = _useState70[0],
|
|
433
|
+
setModalSent = _useState70[1];
|
|
423
434
|
|
|
424
|
-
var _useState71 = (0, _react.useState)(
|
|
435
|
+
var _useState71 = (0, _react.useState)(false),
|
|
436
|
+
_useState72 = (0, _slicedToArray2.default)(_useState71, 2),
|
|
437
|
+
modalViewError = _useState72[0],
|
|
438
|
+
setModalViewError = _useState72[1];
|
|
439
|
+
|
|
440
|
+
var _useState73 = (0, _react.useState)(false),
|
|
441
|
+
_useState74 = (0, _slicedToArray2.default)(_useState73, 2),
|
|
442
|
+
showGenericModal = _useState74[0],
|
|
443
|
+
setShowGenericModal = _useState74[1];
|
|
444
|
+
|
|
445
|
+
var _useState75 = (0, _react.useState)({
|
|
425
446
|
message: "¿Estás seguro de continuar?",
|
|
426
447
|
detail: " ".concat(user.is_retailer ? "Asegurate de haber revisado las tres secciones" : "Envíar el producto a la cadena"),
|
|
427
448
|
button1: {
|
|
@@ -438,29 +459,29 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
438
459
|
},
|
|
439
460
|
img: _defaultProfileImage.default
|
|
440
461
|
}),
|
|
441
|
-
_useState72 = (0, _slicedToArray2.default)(_useState71, 2),
|
|
442
|
-
dataGenericModal = _useState72[0],
|
|
443
|
-
setDataGenericModal = _useState72[1];
|
|
444
|
-
|
|
445
|
-
var _useState73 = (0, _react.useState)(false),
|
|
446
|
-
_useState74 = (0, _slicedToArray2.default)(_useState73, 2),
|
|
447
|
-
modalViewTextArea = _useState74[0],
|
|
448
|
-
setModalViewTextArea = _useState74[1];
|
|
449
|
-
|
|
450
|
-
var _useState75 = (0, _react.useState)(null),
|
|
451
462
|
_useState76 = (0, _slicedToArray2.default)(_useState75, 2),
|
|
452
|
-
|
|
453
|
-
|
|
463
|
+
dataGenericModal = _useState76[0],
|
|
464
|
+
setDataGenericModal = _useState76[1];
|
|
454
465
|
|
|
455
|
-
var _useState77 = (0, _react.useState)(
|
|
466
|
+
var _useState77 = (0, _react.useState)(false),
|
|
456
467
|
_useState78 = (0, _slicedToArray2.default)(_useState77, 2),
|
|
457
|
-
|
|
458
|
-
|
|
468
|
+
modalViewTextArea = _useState78[0],
|
|
469
|
+
setModalViewTextArea = _useState78[1];
|
|
459
470
|
|
|
460
|
-
var _useState79 = (0, _react.useState)(
|
|
471
|
+
var _useState79 = (0, _react.useState)(null),
|
|
461
472
|
_useState80 = (0, _slicedToArray2.default)(_useState79, 2),
|
|
462
|
-
|
|
463
|
-
|
|
473
|
+
socketType = _useState80[0],
|
|
474
|
+
setSocketType = _useState80[1];
|
|
475
|
+
|
|
476
|
+
var _useState81 = (0, _react.useState)(loading),
|
|
477
|
+
_useState82 = (0, _slicedToArray2.default)(_useState81, 2),
|
|
478
|
+
saving = _useState82[0],
|
|
479
|
+
setSaving = _useState82[1];
|
|
480
|
+
|
|
481
|
+
var _closeModals = (0, _customHooks.closeModals)("version-selector"),
|
|
482
|
+
_closeModals2 = (0, _slicedToArray2.default)(_closeModals, 2),
|
|
483
|
+
showVersionSelector = _closeModals2[0],
|
|
484
|
+
setShowVersionSelector = _closeModals2[1];
|
|
464
485
|
|
|
465
486
|
(0, _react.useEffect)(function () {
|
|
466
487
|
checkAll && setSelectedImages(images.values);
|
|
@@ -476,7 +497,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
476
497
|
switch (_context2.prev = _context2.next) {
|
|
477
498
|
case 0:
|
|
478
499
|
_context2.next = 2;
|
|
479
|
-
return (0,
|
|
500
|
+
return (0, _data2.getRetailerServices)((product === null || product === void 0 ? void 0 : product.id_article) || (product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article), (product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.company_name) || (product === null || product === void 0 ? void 0 : product.categoryName), parseInt((product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_category) || (product === null || product === void 0 ? void 0 : product.id_category)), version);
|
|
480
501
|
|
|
481
502
|
case 2:
|
|
482
503
|
services = _context2.sent;
|
|
@@ -486,7 +507,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
486
507
|
|
|
487
508
|
if (!originProp) {
|
|
488
509
|
setActiveRetailer(product !== null && product !== void 0 && product.retailers ? product === null || product === void 0 ? void 0 : product.retailers[0] : product === null || product === void 0 ? void 0 : product.retailersAvailable[0]);
|
|
489
|
-
} //
|
|
510
|
+
} //setActiveRetailer(product?.retailers[0]);
|
|
490
511
|
|
|
491
512
|
|
|
492
513
|
setImages({
|
|
@@ -494,7 +515,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
494
515
|
init: services[2]
|
|
495
516
|
});
|
|
496
517
|
if (((_services$ = services[2]) === null || _services$ === void 0 ? void 0 : (_services$$values = _services$.values) === null || _services$$values === void 0 ? void 0 : _services$$values.length) > 0) setActiveImage(0);
|
|
497
|
-
(0,
|
|
518
|
+
(0, _data2.getPercentage)({
|
|
498
519
|
data: [product]
|
|
499
520
|
}).then(function (res) {
|
|
500
521
|
return setPercentages(res);
|
|
@@ -518,7 +539,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
518
539
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
519
540
|
var _product$article4;
|
|
520
541
|
|
|
521
|
-
var productInOrder, idArticle, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse,
|
|
542
|
+
var productInOrder, idArticle, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse, retailers, active;
|
|
522
543
|
|
|
523
544
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
524
545
|
while (1) {
|
|
@@ -528,7 +549,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
528
549
|
idArticle = (product === null || product === void 0 ? void 0 : product.id_article) || (product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article);
|
|
529
550
|
|
|
530
551
|
if (!(isRevision() || productInOrder)) {
|
|
531
|
-
_context3.next =
|
|
552
|
+
_context3.next = 11;
|
|
532
553
|
break;
|
|
533
554
|
}
|
|
534
555
|
|
|
@@ -538,17 +559,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
538
559
|
case 5:
|
|
539
560
|
servicesResponse = _context3.sent;
|
|
540
561
|
parsedResponse = JSON.parse(servicesResponse === null || servicesResponse === void 0 ? void 0 : (_servicesResponse$dat = servicesResponse.data) === null || _servicesResponse$dat === void 0 ? void 0 : _servicesResponse$dat.body).data;
|
|
541
|
-
retailerResponse = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
|
|
542
|
-
return srv.id_retailer;
|
|
543
|
-
});
|
|
544
562
|
retailers = product.retailers || product.retailersAvailable;
|
|
545
|
-
active = retailers === null || retailers === void 0 ? void 0 : retailers.
|
|
546
|
-
return
|
|
547
|
-
|
|
563
|
+
active = retailers === null || retailers === void 0 ? void 0 : retailers.filter(function (retailer) {
|
|
564
|
+
return parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
|
|
565
|
+
return srv.id_retailer;
|
|
566
|
+
}).includes(retailer.id);
|
|
567
|
+
})[0];
|
|
548
568
|
!activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
|
|
549
569
|
setServicesData(parsedResponse);
|
|
550
570
|
|
|
551
|
-
case
|
|
571
|
+
case 11:
|
|
552
572
|
case "end":
|
|
553
573
|
return _context3.stop();
|
|
554
574
|
}
|
|
@@ -576,10 +596,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
576
596
|
if (_revision && currentService === "AP") return true;
|
|
577
597
|
} else {
|
|
578
598
|
var _product = productEdit.product;
|
|
579
|
-
|
|
580
|
-
var isRequestWithContentoh = orgn === "RequestWithContentoh" && currentService === "AA";
|
|
581
|
-
var isContentoh = orgn === "Contentoh" && currentService === "AA";
|
|
582
|
-
if (isContentoh || isRequestWithoutContentoh || isRequestWithContentoh) return true;
|
|
599
|
+
if (orgn === "Contentoh" || ["RECEIVED", "IN_PROGRESS"].includes(currentService) && orgn === "RequestWithoutContentoh" || currentService === "AA" && orgn === "RequestWithContentoh" || currentService === "RC" && orgn === "RequestWithoutContentoh" && (!_product.id_order || !_product.orderId)) return true;
|
|
583
600
|
}
|
|
584
601
|
}
|
|
585
602
|
|
|
@@ -622,14 +639,54 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
622
639
|
};
|
|
623
640
|
}();
|
|
624
641
|
|
|
625
|
-
(0, _react.useEffect)(function () {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
642
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
643
|
+
var arr;
|
|
644
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
645
|
+
while (1) {
|
|
646
|
+
switch (_context5.prev = _context5.next) {
|
|
647
|
+
case 0:
|
|
648
|
+
setLoading(true);
|
|
649
|
+
sessionStorage.setItem("user", JSON.stringify(user));
|
|
650
|
+
loadData();
|
|
651
|
+
getCart();
|
|
652
|
+
_context5.t0 = setUserGroups;
|
|
653
|
+
_context5.next = 7;
|
|
654
|
+
return (0, _data2.fetchUsers)(token);
|
|
655
|
+
|
|
656
|
+
case 7:
|
|
657
|
+
_context5.t1 = _context5.sent;
|
|
658
|
+
(0, _context5.t0)(_context5.t1);
|
|
659
|
+
arr = [];
|
|
660
|
+
_context5.t2 = user.id_role;
|
|
661
|
+
_context5.next = _context5.t2 === 7 ? 13 : _context5.t2 === 8 ? 13 : _context5.t2 === 4 ? 15 : _context5.t2 === 5 ? 15 : _context5.t2 === 6 ? 17 : 19;
|
|
662
|
+
break;
|
|
663
|
+
|
|
664
|
+
case 13:
|
|
665
|
+
arr = ["IN_PROGRESS", "RF", "RA"];
|
|
666
|
+
return _context5.abrupt("break", 21);
|
|
667
|
+
|
|
668
|
+
case 15:
|
|
669
|
+
arr = ["RF", "AF", "AA", "AP", "AC"];
|
|
670
|
+
return _context5.abrupt("break", 21);
|
|
671
|
+
|
|
672
|
+
case 17:
|
|
673
|
+
arr = ["RP", "RC", "AF"];
|
|
674
|
+
return _context5.abrupt("break", 21);
|
|
675
|
+
|
|
676
|
+
case 19:
|
|
677
|
+
arr = [];
|
|
678
|
+
return _context5.abrupt("break", 21);
|
|
679
|
+
|
|
680
|
+
case 21:
|
|
681
|
+
setStatusArray(arr);
|
|
682
|
+
|
|
683
|
+
case 22:
|
|
684
|
+
case "end":
|
|
685
|
+
return _context5.stop();
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}, _callee5);
|
|
689
|
+
})), [product, version]);
|
|
633
690
|
|
|
634
691
|
var loadAssignations = function loadAssignations(currentProduct) {
|
|
635
692
|
setAssig(product === null || product === void 0 ? void 0 : product.asignations);
|
|
@@ -644,11 +701,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
644
701
|
var productTemp = product;
|
|
645
702
|
var retailers = (productTemp === null || productTemp === void 0 ? void 0 : productTemp.retailersAvailable) || (productTemp === null || productTemp === void 0 ? void 0 : productTemp.retailers);
|
|
646
703
|
retailers === null || retailers === void 0 ? void 0 : retailers.forEach(function (retailer) {
|
|
647
|
-
var _percentages$
|
|
704
|
+
var _percentages$filter$;
|
|
648
705
|
|
|
649
|
-
retailer["percentage"] = percentages === null || percentages === void 0 ? void 0 : (_percentages$
|
|
706
|
+
retailer["percentage"] = percentages === null || percentages === void 0 ? void 0 : (_percentages$filter$ = percentages.filter(function (percent) {
|
|
650
707
|
return (retailer === null || retailer === void 0 ? void 0 : retailer.id) === (percent === null || percent === void 0 ? void 0 : percent.id_retailer);
|
|
651
|
-
})) === null || _percentages$
|
|
708
|
+
})[0]) === null || _percentages$filter$ === void 0 ? void 0 : _percentages$filter$.percentage;
|
|
652
709
|
});
|
|
653
710
|
setProduct(productTemp);
|
|
654
711
|
setActivePercentage((_retailers$ = retailers[0]) === null || _retailers$ === void 0 ? void 0 : _retailers$.percentage);
|
|
@@ -727,12 +784,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
727
784
|
}, [images]);
|
|
728
785
|
|
|
729
786
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
730
|
-
var
|
|
731
|
-
var dataObject
|
|
732
|
-
|
|
733
|
-
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
787
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
788
|
+
var dataObject;
|
|
789
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
734
790
|
while (1) {
|
|
735
|
-
switch (
|
|
791
|
+
switch (_context6.prev = _context6.next) {
|
|
736
792
|
case 0:
|
|
737
793
|
setLoading(true);
|
|
738
794
|
dataObject = {
|
|
@@ -740,8 +796,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
740
796
|
articleData: updatedDescriptions
|
|
741
797
|
};
|
|
742
798
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
743
|
-
|
|
744
|
-
|
|
799
|
+
_context6.prev = 3;
|
|
800
|
+
_context6.next = 6;
|
|
745
801
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
746
802
|
headers: {
|
|
747
803
|
Authorization: token
|
|
@@ -749,45 +805,35 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
749
805
|
});
|
|
750
806
|
|
|
751
807
|
case 6:
|
|
752
|
-
_res = _context5.sent;
|
|
753
|
-
|
|
754
|
-
if (!(_res.data.statusCode === 200)) {
|
|
755
|
-
_context5.next = 11;
|
|
756
|
-
break;
|
|
757
|
-
}
|
|
758
|
-
|
|
759
808
|
setMessage("Descripciones guardadas con éxito");
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
case 11:
|
|
764
|
-
_context5.next = 16;
|
|
809
|
+
loadData();
|
|
810
|
+
_context6.next = 13;
|
|
765
811
|
break;
|
|
766
812
|
|
|
767
|
-
case
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
console.log(
|
|
813
|
+
case 10:
|
|
814
|
+
_context6.prev = 10;
|
|
815
|
+
_context6.t0 = _context6["catch"](3);
|
|
816
|
+
console.log(_context6.t0);
|
|
771
817
|
|
|
772
|
-
case
|
|
818
|
+
case 13:
|
|
773
819
|
case "end":
|
|
774
|
-
return
|
|
820
|
+
return _context6.stop();
|
|
775
821
|
}
|
|
776
822
|
}
|
|
777
|
-
},
|
|
823
|
+
}, _callee6, null, [[3, 10]]);
|
|
778
824
|
}));
|
|
779
825
|
|
|
780
826
|
return function saveDescriptions() {
|
|
781
|
-
return
|
|
827
|
+
return _ref7.apply(this, arguments);
|
|
782
828
|
};
|
|
783
829
|
}();
|
|
784
830
|
|
|
785
831
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
786
|
-
var
|
|
832
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
787
833
|
var dataObject;
|
|
788
|
-
return _regenerator.default.wrap(function
|
|
834
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
789
835
|
while (1) {
|
|
790
|
-
switch (
|
|
836
|
+
switch (_context7.prev = _context7.next) {
|
|
791
837
|
case 0:
|
|
792
838
|
setLoading(true);
|
|
793
839
|
dataObject = {
|
|
@@ -795,8 +841,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
795
841
|
articleData: updatedDatasheets
|
|
796
842
|
};
|
|
797
843
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
798
|
-
|
|
799
|
-
|
|
844
|
+
_context7.prev = 3;
|
|
845
|
+
_context7.next = 6;
|
|
800
846
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
801
847
|
headers: {
|
|
802
848
|
Authorization: token
|
|
@@ -804,45 +850,37 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
804
850
|
});
|
|
805
851
|
|
|
806
852
|
case 6:
|
|
807
|
-
if (!(res.data.statusCode === 200)) {
|
|
808
|
-
_context6.next = 10;
|
|
809
|
-
break;
|
|
810
|
-
}
|
|
811
|
-
|
|
812
853
|
setMessage("Fichas técnicas guardadas");
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
case 10:
|
|
817
|
-
_context6.next = 15;
|
|
854
|
+
loadData();
|
|
855
|
+
_context7.next = 13;
|
|
818
856
|
break;
|
|
819
857
|
|
|
820
|
-
case
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
console.log(
|
|
858
|
+
case 10:
|
|
859
|
+
_context7.prev = 10;
|
|
860
|
+
_context7.t0 = _context7["catch"](3);
|
|
861
|
+
console.log(_context7.t0);
|
|
824
862
|
|
|
825
|
-
case
|
|
863
|
+
case 13:
|
|
826
864
|
case "end":
|
|
827
|
-
return
|
|
865
|
+
return _context7.stop();
|
|
828
866
|
}
|
|
829
867
|
}
|
|
830
|
-
},
|
|
868
|
+
}, _callee7, null, [[3, 10]]);
|
|
831
869
|
}));
|
|
832
870
|
|
|
833
871
|
return function saveDatasheets() {
|
|
834
|
-
return
|
|
872
|
+
return _ref8.apply(this, arguments);
|
|
835
873
|
};
|
|
836
874
|
}();
|
|
837
875
|
|
|
838
|
-
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
876
|
+
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
839
877
|
var _images$values2, _data$articleData, _data$articleData2, _data$updateImages;
|
|
840
878
|
|
|
841
879
|
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
842
880
|
|
|
843
|
-
return _regenerator.default.wrap(function
|
|
881
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
844
882
|
while (1) {
|
|
845
|
-
switch (
|
|
883
|
+
switch (_context8.prev = _context8.next) {
|
|
846
884
|
case 0:
|
|
847
885
|
imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
|
|
848
886
|
imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
|
|
@@ -891,19 +929,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
891
929
|
}
|
|
892
930
|
|
|
893
931
|
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
894
|
-
|
|
932
|
+
_context8.next = 31;
|
|
895
933
|
break;
|
|
896
934
|
}
|
|
897
935
|
|
|
898
936
|
setLoading(true);
|
|
899
|
-
|
|
937
|
+
_context8.prev = 11;
|
|
900
938
|
data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
|
|
901
939
|
e.uuid = (0, _uuid.v4)();
|
|
902
940
|
});
|
|
903
941
|
setDataImages(data);
|
|
904
942
|
|
|
905
943
|
if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
|
|
906
|
-
|
|
944
|
+
_context8.next = 23;
|
|
907
945
|
break;
|
|
908
946
|
}
|
|
909
947
|
|
|
@@ -919,28 +957,28 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
919
957
|
};
|
|
920
958
|
promiseArray.push(myBucket.putObject(params).promise());
|
|
921
959
|
});
|
|
922
|
-
|
|
960
|
+
_context8.next = 20;
|
|
923
961
|
return Promise.all(promiseArray);
|
|
924
962
|
|
|
925
963
|
case 20:
|
|
926
964
|
setImagesUploaded(true);
|
|
927
|
-
|
|
965
|
+
_context8.next = 24;
|
|
928
966
|
break;
|
|
929
967
|
|
|
930
968
|
case 23:
|
|
931
969
|
setImagesUploaded(true);
|
|
932
970
|
|
|
933
971
|
case 24:
|
|
934
|
-
|
|
972
|
+
_context8.next = 29;
|
|
935
973
|
break;
|
|
936
974
|
|
|
937
975
|
case 26:
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
console.log(
|
|
976
|
+
_context8.prev = 26;
|
|
977
|
+
_context8.t0 = _context8["catch"](11);
|
|
978
|
+
console.log(_context8.t0); // setMainLoading(false);
|
|
941
979
|
|
|
942
980
|
case 29:
|
|
943
|
-
|
|
981
|
+
_context8.next = 32;
|
|
944
982
|
break;
|
|
945
983
|
|
|
946
984
|
case 31:
|
|
@@ -949,20 +987,18 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
949
987
|
|
|
950
988
|
case 32:
|
|
951
989
|
case "end":
|
|
952
|
-
return
|
|
990
|
+
return _context8.stop();
|
|
953
991
|
}
|
|
954
992
|
}
|
|
955
|
-
},
|
|
993
|
+
}, _callee8, null, [[11, 26]]);
|
|
956
994
|
})), [images, imagesUploaded]);
|
|
957
|
-
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
995
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
996
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
961
997
|
while (1) {
|
|
962
|
-
switch (
|
|
998
|
+
switch (_context9.prev = _context9.next) {
|
|
963
999
|
case 0:
|
|
964
1000
|
if (!imagesUploaded) {
|
|
965
|
-
|
|
1001
|
+
_context9.next = 13;
|
|
966
1002
|
break;
|
|
967
1003
|
}
|
|
968
1004
|
|
|
@@ -974,8 +1010,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
974
1010
|
if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
975
1011
|
return e;
|
|
976
1012
|
});
|
|
977
|
-
|
|
978
|
-
|
|
1013
|
+
_context9.prev = 2;
|
|
1014
|
+
_context9.next = 5;
|
|
979
1015
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
|
|
980
1016
|
headers: {
|
|
981
1017
|
Authorization: token
|
|
@@ -983,33 +1019,23 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
983
1019
|
});
|
|
984
1020
|
|
|
985
1021
|
case 5:
|
|
986
|
-
_res2 = _context8.sent;
|
|
987
|
-
|
|
988
|
-
if (!(_res2.data.statusCode === 200)) {
|
|
989
|
-
_context8.next = 11;
|
|
990
|
-
break;
|
|
991
|
-
}
|
|
992
|
-
|
|
993
1022
|
setMessage("Imágenes guardadas con éxito");
|
|
994
1023
|
sessionStorage.removeItem("imagesList");
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
case 11:
|
|
999
|
-
_context8.next = 16;
|
|
1024
|
+
loadData();
|
|
1025
|
+
_context9.next = 13;
|
|
1000
1026
|
break;
|
|
1001
1027
|
|
|
1002
|
-
case
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
console.log(
|
|
1028
|
+
case 10:
|
|
1029
|
+
_context9.prev = 10;
|
|
1030
|
+
_context9.t0 = _context9["catch"](2);
|
|
1031
|
+
console.log(_context9.t0);
|
|
1006
1032
|
|
|
1007
|
-
case
|
|
1033
|
+
case 13:
|
|
1008
1034
|
case "end":
|
|
1009
|
-
return
|
|
1035
|
+
return _context9.stop();
|
|
1010
1036
|
}
|
|
1011
1037
|
}
|
|
1012
|
-
},
|
|
1038
|
+
}, _callee9, null, [[2, 10]]);
|
|
1013
1039
|
})), [dataImages, imagesUploaded]);
|
|
1014
1040
|
|
|
1015
1041
|
var getConcept = function getConcept(tab) {
|
|
@@ -1045,28 +1071,28 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1045
1071
|
};
|
|
1046
1072
|
|
|
1047
1073
|
var createComment = /*#__PURE__*/function () {
|
|
1048
|
-
var
|
|
1074
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(e, body, tab) {
|
|
1049
1075
|
var concept, data;
|
|
1050
|
-
return _regenerator.default.wrap(function
|
|
1076
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1051
1077
|
while (1) {
|
|
1052
|
-
switch (
|
|
1078
|
+
switch (_context10.prev = _context10.next) {
|
|
1053
1079
|
case 0:
|
|
1054
1080
|
concept = "";
|
|
1055
|
-
|
|
1056
|
-
|
|
1081
|
+
_context10.t0 = activeTab;
|
|
1082
|
+
_context10.next = _context10.t0 === "Ficha técnica" ? 4 : _context10.t0 === "Imágenes" ? 6 : 8;
|
|
1057
1083
|
break;
|
|
1058
1084
|
|
|
1059
1085
|
case 4:
|
|
1060
1086
|
concept = "datasheet";
|
|
1061
|
-
return
|
|
1087
|
+
return _context10.abrupt("break", 10);
|
|
1062
1088
|
|
|
1063
1089
|
case 6:
|
|
1064
1090
|
concept = "images";
|
|
1065
|
-
return
|
|
1091
|
+
return _context10.abrupt("break", 10);
|
|
1066
1092
|
|
|
1067
1093
|
case 8:
|
|
1068
1094
|
concept = "description";
|
|
1069
|
-
return
|
|
1095
|
+
return _context10.abrupt("break", 10);
|
|
1070
1096
|
|
|
1071
1097
|
case 10:
|
|
1072
1098
|
data = {
|
|
@@ -1076,7 +1102,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1076
1102
|
concept: concept,
|
|
1077
1103
|
version: version
|
|
1078
1104
|
};
|
|
1079
|
-
|
|
1105
|
+
_context10.next = 13;
|
|
1080
1106
|
return _axios.default.post("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1081
1107
|
headers: {
|
|
1082
1108
|
Authorization: token
|
|
@@ -1085,14 +1111,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1085
1111
|
|
|
1086
1112
|
case 13:
|
|
1087
1113
|
case "end":
|
|
1088
|
-
return
|
|
1114
|
+
return _context10.stop();
|
|
1089
1115
|
}
|
|
1090
1116
|
}
|
|
1091
|
-
},
|
|
1117
|
+
}, _callee10);
|
|
1092
1118
|
}));
|
|
1093
1119
|
|
|
1094
1120
|
return function createComment(_x2, _x3, _x4) {
|
|
1095
|
-
return
|
|
1121
|
+
return _ref11.apply(this, arguments);
|
|
1096
1122
|
};
|
|
1097
1123
|
}();
|
|
1098
1124
|
|
|
@@ -1101,16 +1127,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1101
1127
|
}, [activeTab]);
|
|
1102
1128
|
|
|
1103
1129
|
var commentRevised = /*#__PURE__*/function () {
|
|
1104
|
-
var
|
|
1130
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1105
1131
|
var data;
|
|
1106
|
-
return _regenerator.default.wrap(function
|
|
1132
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1107
1133
|
while (1) {
|
|
1108
|
-
switch (
|
|
1134
|
+
switch (_context11.prev = _context11.next) {
|
|
1109
1135
|
case 0:
|
|
1110
1136
|
data = {
|
|
1111
1137
|
commentId: comment.id
|
|
1112
1138
|
};
|
|
1113
|
-
|
|
1139
|
+
_context11.next = 3;
|
|
1114
1140
|
return _axios.default.put("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1115
1141
|
headers: {
|
|
1116
1142
|
Authorization: token
|
|
@@ -1122,54 +1148,52 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1122
1148
|
|
|
1123
1149
|
case 4:
|
|
1124
1150
|
case "end":
|
|
1125
|
-
return
|
|
1151
|
+
return _context11.stop();
|
|
1126
1152
|
}
|
|
1127
1153
|
}
|
|
1128
|
-
},
|
|
1154
|
+
}, _callee11);
|
|
1129
1155
|
}));
|
|
1130
1156
|
|
|
1131
1157
|
return function commentRevised() {
|
|
1132
|
-
return
|
|
1158
|
+
return _ref12.apply(this, arguments);
|
|
1133
1159
|
};
|
|
1134
1160
|
}();
|
|
1135
1161
|
|
|
1136
1162
|
var setAssignation = /*#__PURE__*/function () {
|
|
1137
|
-
var
|
|
1163
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(assignationType, assignationId) {
|
|
1138
1164
|
var concept, productTemp, data;
|
|
1139
|
-
return _regenerator.default.wrap(function
|
|
1165
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1140
1166
|
while (1) {
|
|
1141
|
-
switch (
|
|
1167
|
+
switch (_context12.prev = _context12.next) {
|
|
1142
1168
|
case 0:
|
|
1143
1169
|
concept = "";
|
|
1144
|
-
|
|
1145
|
-
|
|
1170
|
+
_context12.t0 = activeTab;
|
|
1171
|
+
_context12.next = _context12.t0 === "Ficha técnica" ? 4 : _context12.t0 === "Imágenes" ? 6 : 8;
|
|
1146
1172
|
break;
|
|
1147
1173
|
|
|
1148
1174
|
case 4:
|
|
1149
1175
|
concept = "datasheet";
|
|
1150
|
-
return
|
|
1176
|
+
return _context12.abrupt("break", 10);
|
|
1151
1177
|
|
|
1152
1178
|
case 6:
|
|
1153
1179
|
concept = "images";
|
|
1154
|
-
return
|
|
1180
|
+
return _context12.abrupt("break", 10);
|
|
1155
1181
|
|
|
1156
1182
|
case 8:
|
|
1157
1183
|
concept = "description";
|
|
1158
|
-
return
|
|
1184
|
+
return _context12.abrupt("break", 10);
|
|
1159
1185
|
|
|
1160
1186
|
case 10:
|
|
1161
1187
|
productTemp = product;
|
|
1162
1188
|
productTemp.article["id_".concat(concept, "_").concat(assignationType)] = assignationId;
|
|
1163
|
-
data = {
|
|
1189
|
+
data = (0, _defineProperty2.default)({
|
|
1164
1190
|
articleList: [{
|
|
1165
1191
|
orderId: product.orderId,
|
|
1166
1192
|
articleId: product === null || product === void 0 ? void 0 : product.id_article
|
|
1167
1193
|
}],
|
|
1168
|
-
concept: concept
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
_context11.next = 15;
|
|
1172
|
-
return (0, _axios.default)({
|
|
1194
|
+
concept: concept
|
|
1195
|
+
}, "".concat(assignationType, "Id"), assignationId);
|
|
1196
|
+
(0, _axios.default)({
|
|
1173
1197
|
method: "post",
|
|
1174
1198
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
1175
1199
|
data: data,
|
|
@@ -1177,21 +1201,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1177
1201
|
Authorization: token
|
|
1178
1202
|
}
|
|
1179
1203
|
});
|
|
1180
|
-
|
|
1181
|
-
case 15:
|
|
1182
1204
|
loadAssignations(productTemp);
|
|
1183
1205
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1184
1206
|
|
|
1185
|
-
case
|
|
1207
|
+
case 16:
|
|
1186
1208
|
case "end":
|
|
1187
|
-
return
|
|
1209
|
+
return _context12.stop();
|
|
1188
1210
|
}
|
|
1189
1211
|
}
|
|
1190
|
-
},
|
|
1212
|
+
}, _callee12);
|
|
1191
1213
|
}));
|
|
1192
1214
|
|
|
1193
1215
|
return function setAssignation(_x5, _x6) {
|
|
1194
|
-
return
|
|
1216
|
+
return _ref13.apply(this, arguments);
|
|
1195
1217
|
};
|
|
1196
1218
|
}();
|
|
1197
1219
|
|
|
@@ -1207,7 +1229,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1207
1229
|
});
|
|
1208
1230
|
}
|
|
1209
1231
|
|
|
1210
|
-
var statusArray = user.is_retailer === 1 ? ["
|
|
1232
|
+
var statusArray = user.is_retailer === 1 ? ["AC", "RC"] : ["AP", "RP", "AC"];
|
|
1211
1233
|
return serv.length > 0 && serv.every(function (item) {
|
|
1212
1234
|
return statusArray.includes(item.status);
|
|
1213
1235
|
});
|
|
@@ -1296,7 +1318,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1296
1318
|
var datasheet_status = product.datasheet_status,
|
|
1297
1319
|
description_status = product.description_status,
|
|
1298
1320
|
images_status = product.images_status;
|
|
1299
|
-
var completionStates = user.is_retailer === 1 ? ["
|
|
1321
|
+
var completionStates = user.is_retailer === 1 ? ["AC", "Evaluated", "NS"] : ["AP", "Evaluated", "NS"];
|
|
1300
1322
|
var dsEvaluated = completionStates.includes(datasheet_status);
|
|
1301
1323
|
var descsEvaluated = completionStates.includes(description_status);
|
|
1302
1324
|
var imgsEvaluated = completionStates.includes(images_status);
|
|
@@ -1305,169 +1327,144 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1305
1327
|
};
|
|
1306
1328
|
|
|
1307
1329
|
var sendEvaluation = /*#__PURE__*/function () {
|
|
1308
|
-
var
|
|
1309
|
-
var
|
|
1310
|
-
|
|
1311
|
-
var concept, productTemp, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, res, newStatuses, orderStatus, serviceStatus, newProductEdit, _JSON$parse, newArticleStatus, newServiceStatus, newStatus, retailerStatusCopy, status;
|
|
1330
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
|
|
1331
|
+
var data, retailerId, _product$id_order2, _product$id_order3, productTemp, concept;
|
|
1312
1332
|
|
|
1313
|
-
return _regenerator.default.wrap(function
|
|
1333
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1314
1334
|
while (1) {
|
|
1315
|
-
switch (
|
|
1335
|
+
switch (_context13.prev = _context13.next) {
|
|
1316
1336
|
case 0:
|
|
1317
1337
|
setLoading(true);
|
|
1318
|
-
|
|
1319
|
-
productTemp = product;
|
|
1320
|
-
articleId = productTemp.id_article;
|
|
1321
|
-
orderId = (_productTemp$id_order = productTemp.id_order) !== null && _productTemp$id_order !== void 0 ? _productTemp$id_order : productTemp.orderId;
|
|
1322
|
-
sectionStatusKey = "".concat(getConcept(activeTab), "_status");
|
|
1323
|
-
evalStatus = product[sectionStatusKey] || (product === null || product === void 0 ? void 0 : product.version_status);
|
|
1324
|
-
data = {
|
|
1325
|
-
articleId: articleId,
|
|
1326
|
-
orderId: orderId,
|
|
1327
|
-
concept: concept,
|
|
1328
|
-
evalStatus: evalStatus
|
|
1329
|
-
};
|
|
1338
|
+
data = {};
|
|
1330
1339
|
retailerId = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id;
|
|
1331
|
-
_context12.prev = 9;
|
|
1332
1340
|
|
|
1333
1341
|
if (!result) {
|
|
1334
|
-
|
|
1342
|
+
_context13.next = 9;
|
|
1335
1343
|
break;
|
|
1336
1344
|
}
|
|
1337
1345
|
|
|
1338
|
-
data
|
|
1339
|
-
|
|
1340
|
-
|
|
1346
|
+
data = {
|
|
1347
|
+
articleId: product.id_article,
|
|
1348
|
+
orderId: (_product$id_order2 = product.id_order) !== null && _product$id_order2 !== void 0 ? _product$id_order2 : product.orderId,
|
|
1349
|
+
concept: getConcept(activeTab),
|
|
1350
|
+
result: result,
|
|
1351
|
+
retailerId: retailerId
|
|
1352
|
+
};
|
|
1353
|
+
_context13.next = 7;
|
|
1341
1354
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1342
1355
|
headers: {
|
|
1343
1356
|
Authorization: token
|
|
1344
1357
|
}
|
|
1345
1358
|
});
|
|
1346
1359
|
|
|
1347
|
-
case
|
|
1348
|
-
|
|
1349
|
-
newStatuses = JSON.parse(res.data.body);
|
|
1350
|
-
orderStatus = newStatuses.newOrderStatus;
|
|
1351
|
-
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(getConcept(activeTab), "Status")];
|
|
1352
|
-
newProductEdit = productEdit;
|
|
1353
|
-
newProductEdit.product[sectionStatusKey] = serviceStatus;
|
|
1354
|
-
setProductEdit(newProductEdit);
|
|
1355
|
-
showSurvey && showSurvey(!user.is_retailer && orderStatus[orderId] === "AP");
|
|
1356
|
-
_context12.next = 28;
|
|
1360
|
+
case 7:
|
|
1361
|
+
_context13.next = 19;
|
|
1357
1362
|
break;
|
|
1358
1363
|
|
|
1359
|
-
case
|
|
1360
|
-
|
|
1361
|
-
|
|
1364
|
+
case 9:
|
|
1365
|
+
productTemp = product;
|
|
1366
|
+
concept = getConcept(activeTab);
|
|
1367
|
+
productTemp["".concat(concept, "_status")] = "Evaluated";
|
|
1368
|
+
data = {
|
|
1369
|
+
articleId: product.id_article,
|
|
1370
|
+
orderId: (_product$id_order3 = product.id_order) !== null && _product$id_order3 !== void 0 ? _product$id_order3 : product.orderId,
|
|
1371
|
+
concept: concept
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1362
1375
|
headers: {
|
|
1363
1376
|
Authorization: token
|
|
1364
1377
|
}
|
|
1365
1378
|
});
|
|
1366
1379
|
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
productTemp
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
setProduct(productTemp);
|
|
1385
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1386
|
-
setOrigin(function (prev) {
|
|
1387
|
-
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, concept, status));
|
|
1388
|
-
});
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
_context12.next = 34;
|
|
1392
|
-
break;
|
|
1393
|
-
|
|
1394
|
-
case 31:
|
|
1395
|
-
_context12.prev = 31;
|
|
1396
|
-
_context12.t0 = _context12["catch"](9);
|
|
1397
|
-
console.log(_context12.t0);
|
|
1380
|
+
setProduct(productTemp);
|
|
1381
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1382
|
+
setProductEdit({
|
|
1383
|
+
ArticleId: productTemp.id_article,
|
|
1384
|
+
idCategory: productTemp.article.id_category,
|
|
1385
|
+
product: productTemp
|
|
1386
|
+
});
|
|
1387
|
+
sessionStorage.setItem("productEdit", JSON.stringify({
|
|
1388
|
+
ArticleId: productTemp.id_article,
|
|
1389
|
+
idCategory: productTemp.article.id_category,
|
|
1390
|
+
product: productTemp
|
|
1391
|
+
}));
|
|
1392
|
+
setOrigin(function (prev) {
|
|
1393
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, concept, "Evaluated"));
|
|
1394
|
+
});
|
|
1398
1395
|
|
|
1399
|
-
case
|
|
1396
|
+
case 19:
|
|
1400
1397
|
loadData();
|
|
1398
|
+
showSurvey && showSurvey(confirmStatusComplete());
|
|
1401
1399
|
|
|
1402
|
-
case
|
|
1400
|
+
case 21:
|
|
1403
1401
|
case "end":
|
|
1404
|
-
return
|
|
1402
|
+
return _context13.stop();
|
|
1405
1403
|
}
|
|
1406
1404
|
}
|
|
1407
|
-
},
|
|
1405
|
+
}, _callee13);
|
|
1408
1406
|
}));
|
|
1409
1407
|
|
|
1410
1408
|
return function sendEvaluation(_x7) {
|
|
1411
|
-
return
|
|
1409
|
+
return _ref14.apply(this, arguments);
|
|
1412
1410
|
};
|
|
1413
1411
|
}();
|
|
1414
1412
|
|
|
1415
1413
|
var validateAll = /*#__PURE__*/function () {
|
|
1416
|
-
var
|
|
1417
|
-
var
|
|
1418
|
-
|
|
1419
|
-
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1414
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(result) {
|
|
1415
|
+
var evaluationArray, sendAll, conceptArray, productTemp;
|
|
1416
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
1420
1417
|
while (1) {
|
|
1421
|
-
switch (
|
|
1418
|
+
switch (_context14.prev = _context14.next) {
|
|
1422
1419
|
case 0:
|
|
1423
|
-
|
|
1420
|
+
_context14.prev = 0;
|
|
1424
1421
|
setLoading(true);
|
|
1425
1422
|
evaluationArray = [];
|
|
1426
1423
|
sendAll = [];
|
|
1427
1424
|
conceptArray = ["description", "datasheet", "images"];
|
|
1428
|
-
dataGeneral = {
|
|
1429
|
-
articleId: product.id_article,
|
|
1430
|
-
orderId: (_product$id_order2 = product.id_order) !== null && _product$id_order2 !== void 0 ? _product$id_order2 : product.orderId,
|
|
1431
|
-
result: result
|
|
1432
|
-
};
|
|
1433
1425
|
servicesData === null || servicesData === void 0 ? void 0 : servicesData.forEach(function (ret) {
|
|
1434
|
-
var
|
|
1435
|
-
|
|
1436
|
-
var data =
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1426
|
+
var _product$id_order4;
|
|
1427
|
+
|
|
1428
|
+
var data = {
|
|
1429
|
+
articleId: product.id_article,
|
|
1430
|
+
orderId: (_product$id_order4 = product.id_order) !== null && _product$id_order4 !== void 0 ? _product$id_order4 : product.orderId,
|
|
1431
|
+
concept: ret.service,
|
|
1432
|
+
result: result,
|
|
1433
|
+
retailerId: ret.id_retailer
|
|
1434
|
+
};
|
|
1441
1435
|
evaluationArray.push(_axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1442
1436
|
headers: {
|
|
1443
1437
|
Authorization: token
|
|
1444
1438
|
}
|
|
1445
1439
|
}));
|
|
1440
|
+
});
|
|
1441
|
+
_context14.next = 8;
|
|
1442
|
+
return Promise.all(evaluationArray);
|
|
1443
|
+
|
|
1444
|
+
case 8:
|
|
1445
|
+
conceptArray === null || conceptArray === void 0 ? void 0 : conceptArray.forEach(function (concept) {
|
|
1446
|
+
var _product$id_order5;
|
|
1447
|
+
|
|
1448
|
+
var data = {
|
|
1449
|
+
articleId: product.id_article,
|
|
1450
|
+
orderId: (_product$id_order5 = product.id_order) !== null && _product$id_order5 !== void 0 ? _product$id_order5 : product.orderId,
|
|
1451
|
+
concept: concept
|
|
1452
|
+
};
|
|
1446
1453
|
sendAll.push(_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1447
1454
|
headers: {
|
|
1448
1455
|
Authorization: token
|
|
1449
1456
|
}
|
|
1450
1457
|
}));
|
|
1451
1458
|
});
|
|
1452
|
-
|
|
1453
|
-
return Promise.all(
|
|
1459
|
+
_context14.next = 11;
|
|
1460
|
+
return Promise.all(sendAll);
|
|
1454
1461
|
|
|
1455
|
-
case
|
|
1462
|
+
case 11:
|
|
1456
1463
|
productTemp = product;
|
|
1457
|
-
productTemp.article_status = "".concat(result, "
|
|
1458
|
-
productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : "".concat(result, "
|
|
1459
|
-
productTemp.description_status = productTemp.description_status === "NA" ? "NA" : "".concat(result, "
|
|
1460
|
-
productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result, "
|
|
1461
|
-
retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
|
|
1462
|
-
Object.keys(retailerStatusCopy).forEach(function (key) {
|
|
1463
|
-
conceptArray.forEach(function (concept) {
|
|
1464
|
-
if (retailerStatusCopy[key][concept]) {
|
|
1465
|
-
retailerStatusCopy[key][concept] = "".concat(result, "CA");
|
|
1466
|
-
}
|
|
1467
|
-
});
|
|
1468
|
-
});
|
|
1469
|
-
setRetailerStatus(retailerStatusCopy);
|
|
1470
|
-
productTemp.statusByRetailer = retailerStatusCopy;
|
|
1464
|
+
productTemp.article_status = "".concat(result, "C");
|
|
1465
|
+
productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : "".concat(result, "C");
|
|
1466
|
+
productTemp.description_status = productTemp.description_status === "NA" ? "NA" : "".concat(result, "C");
|
|
1467
|
+
productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result, "C");
|
|
1471
1468
|
setProduct(productTemp);
|
|
1472
1469
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1473
1470
|
setProductEdit({
|
|
@@ -1480,37 +1477,34 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1480
1477
|
idCategory: productTemp.article.id_category,
|
|
1481
1478
|
product: productTemp
|
|
1482
1479
|
}));
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
case 24:
|
|
1487
|
-
_context13.next = 29;
|
|
1480
|
+
loadData();
|
|
1481
|
+
_context14.next = 26;
|
|
1488
1482
|
break;
|
|
1489
1483
|
|
|
1490
|
-
case
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
console.log(
|
|
1484
|
+
case 23:
|
|
1485
|
+
_context14.prev = 23;
|
|
1486
|
+
_context14.t0 = _context14["catch"](0);
|
|
1487
|
+
console.log(_context14.t0);
|
|
1494
1488
|
|
|
1495
|
-
case
|
|
1489
|
+
case 26:
|
|
1496
1490
|
case "end":
|
|
1497
|
-
return
|
|
1491
|
+
return _context14.stop();
|
|
1498
1492
|
}
|
|
1499
1493
|
}
|
|
1500
|
-
},
|
|
1494
|
+
}, _callee14, null, [[0, 23]]);
|
|
1501
1495
|
}));
|
|
1502
1496
|
|
|
1503
1497
|
return function validateAll(_x8) {
|
|
1504
|
-
return
|
|
1498
|
+
return _ref15.apply(this, arguments);
|
|
1505
1499
|
};
|
|
1506
1500
|
}();
|
|
1507
1501
|
|
|
1508
1502
|
var evaluationToRetailer = /*#__PURE__*/function () {
|
|
1509
|
-
var
|
|
1503
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
|
|
1510
1504
|
var data, prod, statusComplete;
|
|
1511
|
-
return _regenerator.default.wrap(function
|
|
1505
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
1512
1506
|
while (1) {
|
|
1513
|
-
switch (
|
|
1507
|
+
switch (_context15.prev = _context15.next) {
|
|
1514
1508
|
case 0:
|
|
1515
1509
|
data = {
|
|
1516
1510
|
articleId: product.id_article,
|
|
@@ -1518,7 +1512,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1518
1512
|
versionId: product.version,
|
|
1519
1513
|
status: result
|
|
1520
1514
|
};
|
|
1521
|
-
|
|
1515
|
+
_context15.next = 3;
|
|
1522
1516
|
return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
|
|
1523
1517
|
headers: {
|
|
1524
1518
|
Authorization: token
|
|
@@ -1527,7 +1521,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1527
1521
|
|
|
1528
1522
|
case 3:
|
|
1529
1523
|
prod = productEdit;
|
|
1530
|
-
statusComplete = user.is_retailer ? "".concat(result, "
|
|
1524
|
+
statusComplete = user.is_retailer ? "".concat(result, "C") : "".concat(result, "P");
|
|
1531
1525
|
prod.product.datasheet_status = statusComplete;
|
|
1532
1526
|
prod.product.description_status = statusComplete;
|
|
1533
1527
|
prod.product.images_status = statusComplete;
|
|
@@ -1536,33 +1530,33 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1536
1530
|
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
1537
1531
|
setProduct(prod);
|
|
1538
1532
|
setShowGenericModal && setShowGenericModal(false);
|
|
1539
|
-
|
|
1540
|
-
return loadData();
|
|
1533
|
+
loadData();
|
|
1541
1534
|
|
|
1542
|
-
case
|
|
1535
|
+
case 14:
|
|
1543
1536
|
case "end":
|
|
1544
|
-
return
|
|
1537
|
+
return _context15.stop();
|
|
1545
1538
|
}
|
|
1546
1539
|
}
|
|
1547
|
-
},
|
|
1540
|
+
}, _callee15);
|
|
1548
1541
|
}));
|
|
1549
1542
|
|
|
1550
1543
|
return function evaluationToRetailer(_x9) {
|
|
1551
|
-
return
|
|
1544
|
+
return _ref16.apply(this, arguments);
|
|
1552
1545
|
};
|
|
1553
1546
|
}();
|
|
1554
1547
|
|
|
1555
1548
|
var getSectionStatus = function getSectionStatus() {
|
|
1556
1549
|
var concept = getConcept(activeTab);
|
|
1557
|
-
return ["AA", "AP", "
|
|
1550
|
+
return ["AA", "AP", "RECEIVED", "IN_PROGRESS", "RC"].includes(productEdit.product["".concat(concept, "_status")]);
|
|
1558
1551
|
};
|
|
1559
1552
|
|
|
1560
1553
|
var enableActions = function enableActions(versionStatus) {
|
|
1561
1554
|
try {
|
|
1562
|
-
|
|
1555
|
+
var userIsRetailer = user.is_retailer;
|
|
1556
|
+
if (userIsRetailer) return false;
|
|
1563
1557
|
|
|
1564
1558
|
if (versionStatus) {
|
|
1565
|
-
return ["AP", "
|
|
1559
|
+
return ["AP", "AC", "RC", null].includes(versionStatus);
|
|
1566
1560
|
}
|
|
1567
1561
|
|
|
1568
1562
|
return true;
|
|
@@ -1643,49 +1637,53 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1643
1637
|
});
|
|
1644
1638
|
});
|
|
1645
1639
|
setShowGenericModal(true);
|
|
1646
|
-
} else
|
|
1647
|
-
if (
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1640
|
+
} else {
|
|
1641
|
+
if (user.is_retailer) {
|
|
1642
|
+
if (product.id_order || product.orderId) {
|
|
1643
|
+
validateAll("A");
|
|
1644
|
+
} else {
|
|
1645
|
+
setDataGenericModal(function (prev) {
|
|
1646
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
1647
|
+
button2: {
|
|
1648
|
+
name: "Continuar",
|
|
1649
|
+
action: function action() {
|
|
1650
|
+
return evaluationToRetailer("A");
|
|
1651
|
+
}
|
|
1656
1652
|
}
|
|
1657
|
-
}
|
|
1653
|
+
});
|
|
1658
1654
|
});
|
|
1659
|
-
|
|
1660
|
-
|
|
1655
|
+
setShowGenericModal(true);
|
|
1656
|
+
}
|
|
1657
|
+
} else {
|
|
1658
|
+
validateAll("A");
|
|
1661
1659
|
}
|
|
1662
|
-
} else {
|
|
1663
|
-
validateAll("A");
|
|
1664
1660
|
}
|
|
1665
1661
|
},
|
|
1666
1662
|
rejectAll: function rejectAll() {
|
|
1667
1663
|
if (originProp === "RequestWithoutContentoh" && !user.is_retailer && (!product.id_order || !product.orderId)) {
|
|
1668
1664
|
return;
|
|
1669
|
-
} else
|
|
1670
|
-
if (
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1665
|
+
} else {
|
|
1666
|
+
if (user.is_retailer) {
|
|
1667
|
+
if (product.id_order || product.orderId) {
|
|
1668
|
+
validateAll("R");
|
|
1669
|
+
setModalViewError(true);
|
|
1670
|
+
} else {
|
|
1671
|
+
setDataGenericModal(function (prev) {
|
|
1672
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
1673
|
+
button2: {
|
|
1674
|
+
name: "Continuar",
|
|
1675
|
+
action: function action() {
|
|
1676
|
+
return evaluationToRetailer("R");
|
|
1677
|
+
}
|
|
1680
1678
|
}
|
|
1681
|
-
}
|
|
1679
|
+
});
|
|
1682
1680
|
});
|
|
1683
|
-
|
|
1684
|
-
|
|
1681
|
+
setShowGenericModal(true);
|
|
1682
|
+
}
|
|
1683
|
+
} else {
|
|
1684
|
+
validateAll("R");
|
|
1685
|
+
setModalViewError(true);
|
|
1685
1686
|
}
|
|
1686
|
-
} else {
|
|
1687
|
-
validateAll("R");
|
|
1688
|
-
setModalViewError(true);
|
|
1689
1687
|
}
|
|
1690
1688
|
},
|
|
1691
1689
|
approve: function approve() {
|
|
@@ -1701,54 +1699,58 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1701
1699
|
});
|
|
1702
1700
|
});
|
|
1703
1701
|
setShowGenericModal(true);
|
|
1704
|
-
} else
|
|
1705
|
-
if (
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1702
|
+
} else {
|
|
1703
|
+
if (user.is_retailer) {
|
|
1704
|
+
if (product.id_order || product.orderId) {
|
|
1705
|
+
sendEvaluation("A");
|
|
1706
|
+
} else {
|
|
1707
|
+
setDataGenericModal(function (prev) {
|
|
1708
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
1709
|
+
button2: {
|
|
1710
|
+
name: "Continuar",
|
|
1711
|
+
action: function action() {
|
|
1712
|
+
return evaluationToRetailer("A");
|
|
1713
|
+
}
|
|
1714
1714
|
}
|
|
1715
|
-
}
|
|
1715
|
+
});
|
|
1716
1716
|
});
|
|
1717
|
-
|
|
1718
|
-
|
|
1717
|
+
setShowGenericModal(true);
|
|
1718
|
+
}
|
|
1719
|
+
} else {
|
|
1720
|
+
sendEvaluation("A");
|
|
1719
1721
|
}
|
|
1720
|
-
} else {
|
|
1721
|
-
sendEvaluation("A");
|
|
1722
1722
|
}
|
|
1723
1723
|
},
|
|
1724
1724
|
reject: function reject() {
|
|
1725
1725
|
if (origin[activeTab] === "RequestWithoutContentoh" && !user.is_retailer && (!product.id_order || !product.orderId)) {
|
|
1726
1726
|
return;
|
|
1727
|
-
} else
|
|
1728
|
-
if (
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1727
|
+
} else {
|
|
1728
|
+
if (user.is_retailer) {
|
|
1729
|
+
if (product.id_order || product.orderId) {
|
|
1730
|
+
sendEvaluation("R");
|
|
1731
|
+
setModalViewError(true);
|
|
1732
|
+
} else {
|
|
1733
|
+
setDataGenericModal(function (prev) {
|
|
1734
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
1735
|
+
button2: {
|
|
1736
|
+
name: "Continuar",
|
|
1737
|
+
action: function action() {
|
|
1738
|
+
return evaluationToRetailer("R");
|
|
1739
|
+
}
|
|
1738
1740
|
}
|
|
1739
|
-
}
|
|
1741
|
+
});
|
|
1740
1742
|
});
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
+
setShowGenericModal(true);
|
|
1744
|
+
}
|
|
1745
|
+
} else {
|
|
1746
|
+
sendEvaluation("R");
|
|
1747
|
+
setModalViewError(true);
|
|
1743
1748
|
}
|
|
1744
|
-
} else {
|
|
1745
|
-
sendEvaluation("R");
|
|
1746
|
-
setModalViewError(true);
|
|
1747
1749
|
}
|
|
1748
1750
|
}
|
|
1749
1751
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
|
|
1750
1752
|
tabsSections: tabsSections,
|
|
1751
|
-
status:
|
|
1753
|
+
status: product["".concat(getConcept(activeTab), "_status")] || (product === null || product === void 0 ? void 0 : product.version_status),
|
|
1752
1754
|
activeTab: activeTab,
|
|
1753
1755
|
setActiveTab: setActiveTab,
|
|
1754
1756
|
setImageLayout: setImageLayout,
|
|
@@ -1758,6 +1760,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1758
1760
|
setAssignation: setAssignation,
|
|
1759
1761
|
isRetailer: isRetailer,
|
|
1760
1762
|
showSaveButton: enableActions(product.version_status),
|
|
1763
|
+
version: version,
|
|
1764
|
+
setShowVersionSelector: setShowVersionSelector,
|
|
1761
1765
|
onClickSave: function onClickSave() {
|
|
1762
1766
|
switch (activeTab) {
|
|
1763
1767
|
case "Descripción":
|
|
@@ -1822,9 +1826,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1822
1826
|
headerType: "input-name-header"
|
|
1823
1827
|
}))]
|
|
1824
1828
|
})
|
|
1825
|
-
}), isRevision() && getSectionStatus() ? /*#__PURE__*/(0, _jsxRuntime.
|
|
1829
|
+
}), isRevision() && getSectionStatus() ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1826
1830
|
className: "commentary-box",
|
|
1827
|
-
children: !comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1831
|
+
children: [!comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1828
1832
|
className: "commentary",
|
|
1829
1833
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
|
|
1830
1834
|
label: "Caja de Comentario",
|
|
@@ -1850,24 +1854,32 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1850
1854
|
reviewed: crossComment
|
|
1851
1855
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1852
1856
|
buttonType: "circular-button accept-button",
|
|
1853
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1854
|
-
return _regenerator.default.wrap(function
|
|
1857
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
1858
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
1855
1859
|
while (1) {
|
|
1856
|
-
switch (
|
|
1860
|
+
switch (_context16.prev = _context16.next) {
|
|
1857
1861
|
case 0:
|
|
1858
1862
|
setCrossComment(true);
|
|
1859
1863
|
commentRevised();
|
|
1860
1864
|
|
|
1861
1865
|
case 2:
|
|
1862
1866
|
case "end":
|
|
1863
|
-
return
|
|
1867
|
+
return _context16.stop();
|
|
1864
1868
|
}
|
|
1865
1869
|
}
|
|
1866
|
-
},
|
|
1870
|
+
}, _callee16);
|
|
1867
1871
|
}))
|
|
1868
1872
|
})]
|
|
1869
|
-
})
|
|
1870
|
-
|
|
1873
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1874
|
+
buttonType: evaluationComplete(activeTab) && (productEdit.product.id_order || productEdit.product.orderId) ? "general-green-button" : "general-button-disabled",
|
|
1875
|
+
label: "Enviar evaluación",
|
|
1876
|
+
onClick: function onClick() {
|
|
1877
|
+
//setModalSent(true);
|
|
1878
|
+
sendEvaluation();
|
|
1879
|
+
setMessage("\xA1Evaluaci\xF3n de ".concat(activeTab, " completada!"));
|
|
1880
|
+
}
|
|
1881
|
+
})]
|
|
1882
|
+
}) : revision ? null : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1871
1883
|
className: "required-inputs-message",
|
|
1872
1884
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1873
1885
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
@@ -1964,6 +1976,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1964
1976
|
},
|
|
1965
1977
|
img: _defaultProfileImage.default,
|
|
1966
1978
|
textArea: false
|
|
1979
|
+
}), showVersionSelector && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VersionSelector.VersionSelector, {
|
|
1980
|
+
modalId: "version-selector",
|
|
1981
|
+
articleId: product.id_article,
|
|
1982
|
+
setVersion: setVersion,
|
|
1983
|
+
companyName: company.company_name,
|
|
1984
|
+
currentVersion: version
|
|
1967
1985
|
})]
|
|
1968
1986
|
});
|
|
1969
1987
|
};
|