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