contentoh-components-library 21.1.68 → 21.1.71

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.
Files changed (44) hide show
  1. package/dist/components/atoms/AsignationOption/index.js +2 -2
  2. package/dist/components/atoms/ProductPercentCard/Percent.stories.js +1 -1
  3. package/dist/components/atoms/ProductPercentCard/styles.js +1 -1
  4. package/dist/components/atoms/Status/Status.stories.js +31 -0
  5. package/dist/components/atoms/Status/index.js +23 -0
  6. package/dist/components/atoms/Status/styles.js +20 -0
  7. package/dist/components/molecules/AssignedWork/AssignedWork.stories.js +1 -1
  8. package/dist/components/molecules/AssignedWork/styles.js +1 -1
  9. package/dist/components/molecules/ProductNameHeader/index.js +2 -2
  10. package/dist/components/molecules/StatusAsignationInfo/index.js +3 -3
  11. package/dist/components/organisms/FullProductNameHeader/index.js +1 -1
  12. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +2 -6
  13. package/dist/components/pages/ProviderProductEdition/index.js +433 -433
  14. package/dist/components/pages/RetailerProductEdition/index.js +217 -200
  15. package/dist/global-files/customHooks.js +7 -7
  16. package/dist/global-files/data.js +8 -8
  17. package/dist/index.js +1 -1
  18. package/package.json +1 -1
  19. package/src/components/atoms/AsignationOption/index.js +2 -2
  20. package/src/components/atoms/ProductPercentCard/Percent.stories.js +11 -12
  21. package/src/components/atoms/ProductPercentCard/styles.js +9 -9
  22. package/src/components/atoms/Status/Status.stories.js +14 -0
  23. package/src/components/atoms/Status/index.js +9 -0
  24. package/src/components/atoms/{StatusTag → Status}/styles.js +7 -10
  25. package/src/components/molecules/AssignedWork/AssignedWork.stories.js +8 -8
  26. package/src/components/molecules/AssignedWork/styles.js +9 -10
  27. package/src/components/molecules/ProductNameHeader/index.js +2 -2
  28. package/src/components/molecules/StatusAsignationInfo/index.js +1 -1
  29. package/src/components/organisms/FullProductNameHeader/index.js +2 -2
  30. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +2 -3
  31. package/src/components/pages/ProviderProductEdition/index.js +233 -250
  32. package/src/components/pages/RetailerProductEdition/index.js +149 -173
  33. package/src/global-files/customHooks.js +12 -11
  34. package/src/global-files/data.js +8 -8
  35. package/src/index.js +1 -1
  36. package/dist/components/atoms/ProgressBar/styles.js +0 -22
  37. package/dist/components/atoms/StatusTag/StatusTag.stories.js +0 -48
  38. package/dist/components/atoms/StatusTag/index.js +0 -58
  39. package/dist/components/atoms/StatusTag/styles.js +0 -20
  40. package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +0 -37
  41. package/dist/components/pages/RegistrationLoginFirstStep/index.js +0 -269
  42. package/dist/components/pages/RegistrationLoginFirstStep/styles.js +0 -20
  43. package/src/components/atoms/ProgressBar/styles.js +0 -69
  44. package/src/components/atoms/StatusTag/index.js +0 -37
@@ -39,7 +39,7 @@ var _GalleryElement = require("../../molecules/GalleryElement");
39
39
 
40
40
  var _fileSaver = require("file-saver");
41
41
 
42
- var _data2 = require("../../../global-files/data");
42
+ var _data = require("../../../global-files/data");
43
43
 
44
44
  var _GalleryHeader = require("../../molecules/GalleryHeader");
45
45
 
@@ -348,103 +348,87 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
348
348
  setIcon = _useState40[1];
349
349
 
350
350
  var _useState41 = (0, _react.useState)(product === null || product === void 0 ? void 0 : product.version),
351
- _useState42 = (0, _slicedToArray2.default)(_useState41, 2),
352
- version = _useState42[0],
353
- setVersion = _useState42[1];
351
+ _useState42 = (0, _slicedToArray2.default)(_useState41, 1),
352
+ version = _useState42[0];
354
353
 
355
354
  var _useState43 = (0, _react.useState)({}),
356
- _useState44 = (0, _slicedToArray2.default)(_useState43, 2),
357
- comments = _useState44[0],
358
- setComments = _useState44[1];
355
+ _useState44 = (0, _slicedToArray2.default)(_useState43, 1),
356
+ comments = _useState44[0];
359
357
 
360
358
  var _useState45 = (0, _react.useState)(""),
361
359
  _useState46 = (0, _slicedToArray2.default)(_useState45, 2),
362
360
  comment = _useState46[0],
363
361
  setComment = _useState46[1];
364
362
 
365
- var _useState47 = (0, _react.useState)({
366
- "Ficha técnica": 0,
367
- Descripción: 0,
368
- Imágenes: 0
369
- }),
363
+ var _useState47 = (0, _react.useState)(false),
370
364
  _useState48 = (0, _slicedToArray2.default)(_useState47, 2),
371
- requiredNull = _useState48[0],
372
- setRequiredNull = _useState48[1];
365
+ crossComment = _useState48[0],
366
+ setCrossComment = _useState48[1];
373
367
 
374
- var _useState49 = (0, _react.useState)(false),
368
+ var _useState49 = (0, _react.useState)([]),
375
369
  _useState50 = (0, _slicedToArray2.default)(_useState49, 2),
376
- crossComment = _useState50[0],
377
- setCrossComment = _useState50[1];
370
+ userGroups = _useState50[0],
371
+ setUserGroups = _useState50[1];
378
372
 
379
- var _useState51 = (0, _react.useState)([]),
373
+ var _useState51 = (0, _react.useState)({}),
380
374
  _useState52 = (0, _slicedToArray2.default)(_useState51, 2),
381
- userGroups = _useState52[0],
382
- setUserGroups = _useState52[1];
375
+ assig = _useState52[0],
376
+ setAssig = _useState52[1];
383
377
 
384
- var _useState53 = (0, _react.useState)({}),
378
+ var _useState53 = (0, _react.useState)([]),
385
379
  _useState54 = (0, _slicedToArray2.default)(_useState53, 2),
386
- assig = _useState54[0],
387
- setAssig = _useState54[1];
380
+ selectedImages = _useState54[0],
381
+ setSelectedImages = _useState54[1];
388
382
 
389
383
  var _useState55 = (0, _react.useState)([]),
390
384
  _useState56 = (0, _slicedToArray2.default)(_useState55, 2),
391
- selectedImages = _useState56[0],
392
- setSelectedImages = _useState56[1];
385
+ componentsArray = _useState56[0],
386
+ setComponentsArray = _useState56[1];
393
387
 
394
- var _useState57 = (0, _react.useState)([]),
388
+ var _useState57 = (0, _react.useState)(false),
395
389
  _useState58 = (0, _slicedToArray2.default)(_useState57, 2),
396
- componentsArray = _useState58[0],
397
- setComponentsArray = _useState58[1];
398
-
399
- var _useState59 = (0, _react.useState)(false),
400
- _useState60 = (0, _slicedToArray2.default)(_useState59, 2),
401
- checkAll = _useState60[0],
402
- setCheckAll = _useState60[1];
390
+ checkAll = _useState58[0],
391
+ setCheckAll = _useState58[1];
403
392
 
404
393
  var isRetailer = user === null || user === void 0 ? void 0 : user.is_retailer;
405
394
 
406
- var _useState61 = (0, _react.useState)(true),
407
- _useState62 = (0, _slicedToArray2.default)(_useState61, 2),
408
- loading = _useState62[0],
409
- setLoading = _useState62[1];
410
-
411
- var _useState63 = (0, _react.useState)([]),
412
- _useState64 = (0, _slicedToArray2.default)(_useState63, 2),
413
- statusArray = _useState64[0],
414
- setStatusArray = _useState64[1];
395
+ var _useState59 = (0, _react.useState)(true),
396
+ _useState60 = (0, _slicedToArray2.default)(_useState59, 2),
397
+ loading = _useState60[0],
398
+ setLoading = _useState60[1];
415
399
 
416
400
  var originProp = location === null || location === void 0 ? void 0 : (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.origin;
417
401
 
418
- var _useState65 = (0, _react.useState)({
402
+ var _useState61 = (0, _react.useState)({
419
403
  "Ficha técnica": originProp,
420
404
  Descripción: originProp,
421
405
  Imágenes: originProp
422
406
  }),
407
+ _useState62 = (0, _slicedToArray2.default)(_useState61, 2),
408
+ origin = _useState62[0],
409
+ setOrigin = _useState62[1];
410
+
411
+ var _useState63 = (0, _react.useState)(false),
412
+ _useState64 = (0, _slicedToArray2.default)(_useState63, 2),
413
+ inCart = _useState64[0],
414
+ setInCart = _useState64[1];
415
+
416
+ var _useState65 = (0, _react.useState)(false),
423
417
  _useState66 = (0, _slicedToArray2.default)(_useState65, 2),
424
- origin = _useState66[0],
425
- setOrigin = _useState66[1];
418
+ modalSent = _useState66[0],
419
+ setModalSent = _useState66[1];
426
420
 
427
421
  var _useState67 = (0, _react.useState)(false),
428
422
  _useState68 = (0, _slicedToArray2.default)(_useState67, 2),
429
- inCart = _useState68[0],
430
- setInCart = _useState68[1];
423
+ modalViewError = _useState68[0],
424
+ setModalViewError = _useState68[1];
431
425
 
432
426
  var _useState69 = (0, _react.useState)(false),
433
427
  _useState70 = (0, _slicedToArray2.default)(_useState69, 2),
434
- modalSent = _useState70[0],
435
- setModalSent = _useState70[1];
436
-
437
- var _useState71 = (0, _react.useState)(false),
438
- _useState72 = (0, _slicedToArray2.default)(_useState71, 2),
439
- modalViewError = _useState72[0],
440
- setModalViewError = _useState72[1];
441
-
442
- var _useState73 = (0, _react.useState)(false),
443
- _useState74 = (0, _slicedToArray2.default)(_useState73, 2),
444
- showGenericModal = _useState74[0],
445
- setShowGenericModal = _useState74[1];
428
+ showGenericModal = _useState70[0],
429
+ setShowGenericModal = _useState70[1];
446
430
 
447
- var _useState75 = (0, _react.useState)({
431
+ var _useState71 = (0, _react.useState)({
448
432
  message: "¿Estás seguro de continuar?",
449
433
  detail: " ".concat(user.is_retailer ? "Asegurate de haber revisado las tres secciones" : "Envíar el producto a la cadena"),
450
434
  button1: {
@@ -461,29 +445,34 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
461
445
  },
462
446
  img: _defaultProfileImage.default
463
447
  }),
448
+ _useState72 = (0, _slicedToArray2.default)(_useState71, 2),
449
+ dataGenericModal = _useState72[0],
450
+ setDataGenericModal = _useState72[1];
451
+
452
+ var _useState73 = (0, _react.useState)(false),
453
+ _useState74 = (0, _slicedToArray2.default)(_useState73, 2),
454
+ modalViewTextArea = _useState74[0],
455
+ setModalViewTextArea = _useState74[1];
456
+
457
+ var _useState75 = (0, _react.useState)(null),
464
458
  _useState76 = (0, _slicedToArray2.default)(_useState75, 2),
465
- dataGenericModal = _useState76[0],
466
- setDataGenericModal = _useState76[1];
459
+ socketType = _useState76[0],
460
+ setSocketType = _useState76[1];
467
461
 
468
- var _useState77 = (0, _react.useState)(false),
462
+ var _useState77 = (0, _react.useState)(loading),
469
463
  _useState78 = (0, _slicedToArray2.default)(_useState77, 2),
470
- modalViewTextArea = _useState78[0],
471
- setModalViewTextArea = _useState78[1];
464
+ saving = _useState78[0],
465
+ setSaving = _useState78[1];
472
466
 
473
- var _useState79 = (0, _react.useState)(null),
467
+ var _useState79 = (0, _react.useState)(product.statusByRetailer),
474
468
  _useState80 = (0, _slicedToArray2.default)(_useState79, 2),
475
- socketType = _useState80[0],
476
- setSocketType = _useState80[1];
469
+ retailerStatus = _useState80[0],
470
+ setRetailerStatus = _useState80[1];
477
471
 
478
- var _useState81 = (0, _react.useState)(loading),
472
+ var _useState81 = (0, _react.useState)(false),
479
473
  _useState82 = (0, _slicedToArray2.default)(_useState81, 2),
480
- saving = _useState82[0],
481
- setSaving = _useState82[1];
482
-
483
- var _useState83 = (0, _react.useState)(false),
484
- _useState84 = (0, _slicedToArray2.default)(_useState83, 2),
485
- showCreateVersion = _useState84[0],
486
- setShowCreateVersion = _useState84[1];
474
+ showCreateVersion = _useState82[0],
475
+ setShowCreateVersion = _useState82[1];
487
476
 
488
477
  var _closeModals = (0, _customHooks.closeModals)("version-selector"),
489
478
  _closeModals2 = (0, _slicedToArray2.default)(_closeModals, 2),
@@ -504,7 +493,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
504
493
  switch (_context2.prev = _context2.next) {
505
494
  case 0:
506
495
  _context2.next = 2;
507
- 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);
496
+ 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)), version);
508
497
 
509
498
  case 2:
510
499
  services = _context2.sent;
@@ -514,7 +503,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
514
503
 
515
504
  if (!originProp) {
516
505
  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]);
517
- } //setActiveRetailer(product?.retailers[0]);
506
+ } // setActiveRetailer(product?.retailers[0]);
518
507
 
519
508
 
520
509
  setImages({
@@ -522,7 +511,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
522
511
  init: services[2]
523
512
  });
524
513
  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);
525
- (0, _data2.getPercentage)({
514
+ (0, _data.getPercentage)({
526
515
  data: [product]
527
516
  }).then(function (res) {
528
517
  return setPercentages(res);
@@ -546,7 +535,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
546
535
  var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
547
536
  var _product$article4;
548
537
 
549
- var productInOrder, idArticle, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse, retailers, active;
538
+ var productInOrder, idArticle, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse, retailerResponse, retailers, active;
550
539
 
551
540
  return _regenerator.default.wrap(function _callee3$(_context3) {
552
541
  while (1) {
@@ -556,7 +545,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
556
545
  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);
557
546
 
558
547
  if (!(isRevision() || productInOrder)) {
559
- _context3.next = 11;
548
+ _context3.next = 12;
560
549
  break;
561
550
  }
562
551
 
@@ -566,16 +555,17 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
566
555
  case 5:
567
556
  servicesResponse = _context3.sent;
568
557
  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;
558
+ retailerResponse = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
559
+ return srv.id_retailer;
560
+ });
569
561
  retailers = product.retailers || product.retailersAvailable;
570
- active = retailers === null || retailers === void 0 ? void 0 : retailers.filter(function (retailer) {
571
- return parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
572
- return srv.id_retailer;
573
- }).includes(retailer.id);
574
- })[0];
562
+ active = retailers === null || retailers === void 0 ? void 0 : retailers.find(function (retailer) {
563
+ return retailerResponse.includes(retailer.id);
564
+ });
575
565
  !activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
576
566
  setServicesData(parsedResponse);
577
567
 
578
- case 11:
568
+ case 12:
579
569
  case "end":
580
570
  return _context3.stop();
581
571
  }
@@ -603,7 +593,10 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
603
593
  if (_revision && currentService === "AP") return true;
604
594
  } else {
605
595
  var _product = productEdit.product;
606
- 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;
596
+ var isRequestWithoutContentoh = orgn === "RequestWithoutContentoh" && (["R", "CA"].includes(currentService) || currentService === "RCA" && (!_product.id_order || !_product.orderId));
597
+ var isRequestWithContentoh = orgn === "RequestWithContentoh" && currentService === "AA";
598
+ var isContentoh = orgn === "Contentoh" && currentService === "AA";
599
+ if (isContentoh || isRequestWithoutContentoh || isRequestWithContentoh) return true;
607
600
  }
608
601
  }
609
602
 
@@ -646,54 +639,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
646
639
  };
647
640
  }();
648
641
 
649
- (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
650
- var arr;
651
- return _regenerator.default.wrap(function _callee5$(_context5) {
652
- while (1) {
653
- switch (_context5.prev = _context5.next) {
654
- case 0:
655
- setLoading(true);
656
- sessionStorage.setItem("user", JSON.stringify(user));
657
- loadData();
658
- getCart();
659
- _context5.t0 = setUserGroups;
660
- _context5.next = 7;
661
- return (0, _data2.fetchUsers)(token);
662
-
663
- case 7:
664
- _context5.t1 = _context5.sent;
665
- (0, _context5.t0)(_context5.t1);
666
- arr = [];
667
- _context5.t2 = user.id_role;
668
- _context5.next = _context5.t2 === 7 ? 13 : _context5.t2 === 8 ? 13 : _context5.t2 === 4 ? 15 : _context5.t2 === 5 ? 15 : _context5.t2 === 6 ? 17 : 19;
669
- break;
670
-
671
- case 13:
672
- arr = ["IN_PROGRESS", "RF", "RA"];
673
- return _context5.abrupt("break", 21);
674
-
675
- case 15:
676
- arr = ["RF", "AF", "AA", "AP", "AC"];
677
- return _context5.abrupt("break", 21);
678
-
679
- case 17:
680
- arr = ["RP", "RC", "AF"];
681
- return _context5.abrupt("break", 21);
682
-
683
- case 19:
684
- arr = [];
685
- return _context5.abrupt("break", 21);
686
-
687
- case 21:
688
- setStatusArray(arr);
689
-
690
- case 22:
691
- case "end":
692
- return _context5.stop();
693
- }
694
- }
695
- }, _callee5);
696
- })), [product, version]);
642
+ (0, _react.useEffect)(function () {
643
+ sessionStorage.setItem("user", JSON.stringify(user));
644
+ loadData();
645
+ getCart();
646
+ (0, _data.fetchUsers)(token).then(function (res) {
647
+ return setUserGroups(res);
648
+ });
649
+ }, [product]);
697
650
 
698
651
  var loadAssignations = function loadAssignations(currentProduct) {
699
652
  setAssig(product === null || product === void 0 ? void 0 : product.asignations);
@@ -708,11 +661,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
708
661
  var productTemp = product;
709
662
  var retailers = (productTemp === null || productTemp === void 0 ? void 0 : productTemp.retailersAvailable) || (productTemp === null || productTemp === void 0 ? void 0 : productTemp.retailers);
710
663
  retailers === null || retailers === void 0 ? void 0 : retailers.forEach(function (retailer) {
711
- var _percentages$filter$;
664
+ var _percentages$find;
712
665
 
713
- retailer["percentage"] = percentages === null || percentages === void 0 ? void 0 : (_percentages$filter$ = percentages.filter(function (percent) {
666
+ retailer["percentage"] = percentages === null || percentages === void 0 ? void 0 : (_percentages$find = percentages.find(function (percent) {
714
667
  return (retailer === null || retailer === void 0 ? void 0 : retailer.id) === (percent === null || percent === void 0 ? void 0 : percent.id_retailer);
715
- })[0]) === null || _percentages$filter$ === void 0 ? void 0 : _percentages$filter$.percentage;
668
+ })) === null || _percentages$find === void 0 ? void 0 : _percentages$find.percentage;
716
669
  });
717
670
  setProduct(productTemp);
718
671
  setActivePercentage((_retailers$ = retailers[0]) === null || _retailers$ === void 0 ? void 0 : _retailers$.percentage);
@@ -791,11 +744,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
791
744
  }, [images]);
792
745
 
793
746
  var saveDescriptions = /*#__PURE__*/function () {
794
- var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
795
- var dataObject;
796
- return _regenerator.default.wrap(function _callee6$(_context6) {
747
+ var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
748
+ var dataObject, _res;
749
+
750
+ return _regenerator.default.wrap(function _callee5$(_context5) {
797
751
  while (1) {
798
- switch (_context6.prev = _context6.next) {
752
+ switch (_context5.prev = _context5.next) {
799
753
  case 0:
800
754
  setLoading(true);
801
755
  dataObject = {
@@ -803,8 +757,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
803
757
  articleData: updatedDescriptions
804
758
  };
805
759
  if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
806
- _context6.prev = 3;
807
- _context6.next = 6;
760
+ _context5.prev = 3;
761
+ _context5.next = 6;
808
762
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
809
763
  headers: {
810
764
  Authorization: token
@@ -812,35 +766,45 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
812
766
  });
813
767
 
814
768
  case 6:
769
+ _res = _context5.sent;
770
+
771
+ if (!(_res.data.statusCode === 200)) {
772
+ _context5.next = 11;
773
+ break;
774
+ }
775
+
815
776
  setMessage("Descripciones guardadas con éxito");
816
- loadData();
817
- _context6.next = 13;
818
- break;
777
+ _context5.next = 11;
778
+ return loadData();
819
779
 
820
- case 10:
821
- _context6.prev = 10;
822
- _context6.t0 = _context6["catch"](3);
823
- console.log(_context6.t0);
780
+ case 11:
781
+ _context5.next = 16;
782
+ break;
824
783
 
825
784
  case 13:
785
+ _context5.prev = 13;
786
+ _context5.t0 = _context5["catch"](3);
787
+ console.log(_context5.t0);
788
+
789
+ case 16:
826
790
  case "end":
827
- return _context6.stop();
791
+ return _context5.stop();
828
792
  }
829
793
  }
830
- }, _callee6, null, [[3, 10]]);
794
+ }, _callee5, null, [[3, 13]]);
831
795
  }));
832
796
 
833
797
  return function saveDescriptions() {
834
- return _ref7.apply(this, arguments);
798
+ return _ref6.apply(this, arguments);
835
799
  };
836
800
  }();
837
801
 
838
802
  var saveDatasheets = /*#__PURE__*/function () {
839
- var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
803
+ var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
840
804
  var dataObject;
841
- return _regenerator.default.wrap(function _callee7$(_context7) {
805
+ return _regenerator.default.wrap(function _callee6$(_context6) {
842
806
  while (1) {
843
- switch (_context7.prev = _context7.next) {
807
+ switch (_context6.prev = _context6.next) {
844
808
  case 0:
845
809
  setLoading(true);
846
810
  dataObject = {
@@ -848,8 +812,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
848
812
  articleData: updatedDatasheets
849
813
  };
850
814
  if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
851
- _context7.prev = 3;
852
- _context7.next = 6;
815
+ _context6.prev = 3;
816
+ _context6.next = 6;
853
817
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
854
818
  headers: {
855
819
  Authorization: token
@@ -857,37 +821,45 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
857
821
  });
858
822
 
859
823
  case 6:
824
+ if (!(res.data.statusCode === 200)) {
825
+ _context6.next = 10;
826
+ break;
827
+ }
828
+
860
829
  setMessage("Fichas técnicas guardadas");
861
- loadData();
862
- _context7.next = 13;
863
- break;
830
+ _context6.next = 10;
831
+ return loadData();
864
832
 
865
833
  case 10:
866
- _context7.prev = 10;
867
- _context7.t0 = _context7["catch"](3);
868
- console.log(_context7.t0);
834
+ _context6.next = 15;
835
+ break;
869
836
 
870
- case 13:
837
+ case 12:
838
+ _context6.prev = 12;
839
+ _context6.t0 = _context6["catch"](3);
840
+ console.log(_context6.t0);
841
+
842
+ case 15:
871
843
  case "end":
872
- return _context7.stop();
844
+ return _context6.stop();
873
845
  }
874
846
  }
875
- }, _callee7, null, [[3, 10]]);
847
+ }, _callee6, null, [[3, 12]]);
876
848
  }));
877
849
 
878
850
  return function saveDatasheets() {
879
- return _ref8.apply(this, arguments);
851
+ return _ref7.apply(this, arguments);
880
852
  };
881
853
  }();
882
854
 
883
- var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
855
+ var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
884
856
  var _images$values2, _data$articleData, _data$articleData2, _data$updateImages;
885
857
 
886
858
  var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
887
859
 
888
- return _regenerator.default.wrap(function _callee8$(_context8) {
860
+ return _regenerator.default.wrap(function _callee7$(_context7) {
889
861
  while (1) {
890
- switch (_context8.prev = _context8.next) {
862
+ switch (_context7.prev = _context7.next) {
891
863
  case 0:
892
864
  imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
893
865
  imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
@@ -936,19 +908,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
936
908
  }
937
909
 
938
910
  if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
939
- _context8.next = 31;
911
+ _context7.next = 31;
940
912
  break;
941
913
  }
942
914
 
943
915
  setLoading(true);
944
- _context8.prev = 11;
916
+ _context7.prev = 11;
945
917
  data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
946
918
  e.uuid = (0, _uuid.v4)();
947
919
  });
948
920
  setDataImages(data);
949
921
 
950
922
  if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
951
- _context8.next = 23;
923
+ _context7.next = 23;
952
924
  break;
953
925
  }
954
926
 
@@ -964,28 +936,28 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
964
936
  };
965
937
  promiseArray.push(myBucket.putObject(params).promise());
966
938
  });
967
- _context8.next = 20;
939
+ _context7.next = 20;
968
940
  return Promise.all(promiseArray);
969
941
 
970
942
  case 20:
971
943
  setImagesUploaded(true);
972
- _context8.next = 24;
944
+ _context7.next = 24;
973
945
  break;
974
946
 
975
947
  case 23:
976
948
  setImagesUploaded(true);
977
949
 
978
950
  case 24:
979
- _context8.next = 29;
951
+ _context7.next = 29;
980
952
  break;
981
953
 
982
954
  case 26:
983
- _context8.prev = 26;
984
- _context8.t0 = _context8["catch"](11);
985
- console.log(_context8.t0); // setMainLoading(false);
955
+ _context7.prev = 26;
956
+ _context7.t0 = _context7["catch"](11);
957
+ console.log(_context7.t0); // setMainLoading(false);
986
958
 
987
959
  case 29:
988
- _context8.next = 32;
960
+ _context7.next = 32;
989
961
  break;
990
962
 
991
963
  case 31:
@@ -994,18 +966,20 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
994
966
 
995
967
  case 32:
996
968
  case "end":
997
- return _context8.stop();
969
+ return _context7.stop();
998
970
  }
999
971
  }
1000
- }, _callee8, null, [[11, 26]]);
972
+ }, _callee7, null, [[11, 26]]);
1001
973
  })), [images, imagesUploaded]);
1002
- (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
1003
- return _regenerator.default.wrap(function _callee9$(_context9) {
974
+ (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
975
+ var _res2;
976
+
977
+ return _regenerator.default.wrap(function _callee8$(_context8) {
1004
978
  while (1) {
1005
- switch (_context9.prev = _context9.next) {
979
+ switch (_context8.prev = _context8.next) {
1006
980
  case 0:
1007
981
  if (!imagesUploaded) {
1008
- _context9.next = 13;
982
+ _context8.next = 16;
1009
983
  break;
1010
984
  }
1011
985
 
@@ -1017,8 +991,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1017
991
  if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
1018
992
  return e;
1019
993
  });
1020
- _context9.prev = 2;
1021
- _context9.next = 5;
994
+ _context8.prev = 2;
995
+ _context8.next = 5;
1022
996
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
1023
997
  headers: {
1024
998
  Authorization: token
@@ -1026,23 +1000,33 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1026
1000
  });
1027
1001
 
1028
1002
  case 5:
1003
+ _res2 = _context8.sent;
1004
+
1005
+ if (!(_res2.data.statusCode === 200)) {
1006
+ _context8.next = 11;
1007
+ break;
1008
+ }
1009
+
1029
1010
  setMessage("Imágenes guardadas con éxito");
1030
1011
  sessionStorage.removeItem("imagesList");
1031
- loadData();
1032
- _context9.next = 13;
1033
- break;
1012
+ _context8.next = 11;
1013
+ return loadData();
1034
1014
 
1035
- case 10:
1036
- _context9.prev = 10;
1037
- _context9.t0 = _context9["catch"](2);
1038
- console.log(_context9.t0);
1015
+ case 11:
1016
+ _context8.next = 16;
1017
+ break;
1039
1018
 
1040
1019
  case 13:
1020
+ _context8.prev = 13;
1021
+ _context8.t0 = _context8["catch"](2);
1022
+ console.log(_context8.t0);
1023
+
1024
+ case 16:
1041
1025
  case "end":
1042
- return _context9.stop();
1026
+ return _context8.stop();
1043
1027
  }
1044
1028
  }
1045
- }, _callee9, null, [[2, 10]]);
1029
+ }, _callee8, null, [[2, 13]]);
1046
1030
  })), [dataImages, imagesUploaded]);
1047
1031
 
1048
1032
  var getConcept = function getConcept(tab) {
@@ -1078,28 +1062,28 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1078
1062
  };
1079
1063
 
1080
1064
  var createComment = /*#__PURE__*/function () {
1081
- var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(e, body, tab) {
1065
+ var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(e, body, tab) {
1082
1066
  var concept, data;
1083
- return _regenerator.default.wrap(function _callee10$(_context10) {
1067
+ return _regenerator.default.wrap(function _callee9$(_context9) {
1084
1068
  while (1) {
1085
- switch (_context10.prev = _context10.next) {
1069
+ switch (_context9.prev = _context9.next) {
1086
1070
  case 0:
1087
1071
  concept = "";
1088
- _context10.t0 = activeTab;
1089
- _context10.next = _context10.t0 === "Ficha técnica" ? 4 : _context10.t0 === "Imágenes" ? 6 : 8;
1072
+ _context9.t0 = activeTab;
1073
+ _context9.next = _context9.t0 === "Ficha técnica" ? 4 : _context9.t0 === "Imágenes" ? 6 : 8;
1090
1074
  break;
1091
1075
 
1092
1076
  case 4:
1093
1077
  concept = "datasheet";
1094
- return _context10.abrupt("break", 10);
1078
+ return _context9.abrupt("break", 10);
1095
1079
 
1096
1080
  case 6:
1097
1081
  concept = "images";
1098
- return _context10.abrupt("break", 10);
1082
+ return _context9.abrupt("break", 10);
1099
1083
 
1100
1084
  case 8:
1101
1085
  concept = "description";
1102
- return _context10.abrupt("break", 10);
1086
+ return _context9.abrupt("break", 10);
1103
1087
 
1104
1088
  case 10:
1105
1089
  data = {
@@ -1109,7 +1093,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1109
1093
  concept: concept,
1110
1094
  version: version
1111
1095
  };
1112
- _context10.next = 13;
1096
+ _context9.next = 13;
1113
1097
  return _axios.default.post("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
1114
1098
  headers: {
1115
1099
  Authorization: token
@@ -1118,14 +1102,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1118
1102
 
1119
1103
  case 13:
1120
1104
  case "end":
1121
- return _context10.stop();
1105
+ return _context9.stop();
1122
1106
  }
1123
1107
  }
1124
- }, _callee10);
1108
+ }, _callee9);
1125
1109
  }));
1126
1110
 
1127
1111
  return function createComment(_x2, _x3, _x4) {
1128
- return _ref11.apply(this, arguments);
1112
+ return _ref10.apply(this, arguments);
1129
1113
  };
1130
1114
  }();
1131
1115
 
@@ -1134,16 +1118,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1134
1118
  }, [activeTab]);
1135
1119
 
1136
1120
  var commentRevised = /*#__PURE__*/function () {
1137
- var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
1121
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
1138
1122
  var data;
1139
- return _regenerator.default.wrap(function _callee11$(_context11) {
1123
+ return _regenerator.default.wrap(function _callee10$(_context10) {
1140
1124
  while (1) {
1141
- switch (_context11.prev = _context11.next) {
1125
+ switch (_context10.prev = _context10.next) {
1142
1126
  case 0:
1143
1127
  data = {
1144
1128
  commentId: comment.id
1145
1129
  };
1146
- _context11.next = 3;
1130
+ _context10.next = 3;
1147
1131
  return _axios.default.put("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
1148
1132
  headers: {
1149
1133
  Authorization: token
@@ -1155,52 +1139,54 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1155
1139
 
1156
1140
  case 4:
1157
1141
  case "end":
1158
- return _context11.stop();
1142
+ return _context10.stop();
1159
1143
  }
1160
1144
  }
1161
- }, _callee11);
1145
+ }, _callee10);
1162
1146
  }));
1163
1147
 
1164
1148
  return function commentRevised() {
1165
- return _ref12.apply(this, arguments);
1149
+ return _ref11.apply(this, arguments);
1166
1150
  };
1167
1151
  }();
1168
1152
 
1169
1153
  var setAssignation = /*#__PURE__*/function () {
1170
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(assignationType, assignationId) {
1154
+ var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(assignationType, assignationId) {
1171
1155
  var concept, productTemp, data;
1172
- return _regenerator.default.wrap(function _callee12$(_context12) {
1156
+ return _regenerator.default.wrap(function _callee11$(_context11) {
1173
1157
  while (1) {
1174
- switch (_context12.prev = _context12.next) {
1158
+ switch (_context11.prev = _context11.next) {
1175
1159
  case 0:
1176
1160
  concept = "";
1177
- _context12.t0 = activeTab;
1178
- _context12.next = _context12.t0 === "Ficha técnica" ? 4 : _context12.t0 === "Imágenes" ? 6 : 8;
1161
+ _context11.t0 = activeTab;
1162
+ _context11.next = _context11.t0 === "Ficha técnica" ? 4 : _context11.t0 === "Imágenes" ? 6 : 8;
1179
1163
  break;
1180
1164
 
1181
1165
  case 4:
1182
1166
  concept = "datasheet";
1183
- return _context12.abrupt("break", 10);
1167
+ return _context11.abrupt("break", 10);
1184
1168
 
1185
1169
  case 6:
1186
1170
  concept = "images";
1187
- return _context12.abrupt("break", 10);
1171
+ return _context11.abrupt("break", 10);
1188
1172
 
1189
1173
  case 8:
1190
1174
  concept = "description";
1191
- return _context12.abrupt("break", 10);
1175
+ return _context11.abrupt("break", 10);
1192
1176
 
1193
1177
  case 10:
1194
1178
  productTemp = product;
1195
1179
  productTemp.article["id_".concat(concept, "_").concat(assignationType)] = assignationId;
1196
- data = (0, _defineProperty2.default)({
1180
+ data = {
1197
1181
  articleList: [{
1198
1182
  orderId: product.orderId,
1199
1183
  articleId: product === null || product === void 0 ? void 0 : product.id_article
1200
1184
  }],
1201
- concept: concept
1202
- }, "".concat(assignationType, "Id"), assignationId);
1203
- (0, _axios.default)({
1185
+ concept: concept,
1186
+ userId: assignationId
1187
+ };
1188
+ _context11.next = 15;
1189
+ return (0, _axios.default)({
1204
1190
  method: "post",
1205
1191
  url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
1206
1192
  data: data,
@@ -1208,19 +1194,21 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1208
1194
  Authorization: token
1209
1195
  }
1210
1196
  });
1197
+
1198
+ case 15:
1211
1199
  loadAssignations(productTemp);
1212
1200
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1213
1201
 
1214
- case 16:
1202
+ case 17:
1215
1203
  case "end":
1216
- return _context12.stop();
1204
+ return _context11.stop();
1217
1205
  }
1218
1206
  }
1219
- }, _callee12);
1207
+ }, _callee11);
1220
1208
  }));
1221
1209
 
1222
1210
  return function setAssignation(_x5, _x6) {
1223
- return _ref13.apply(this, arguments);
1211
+ return _ref12.apply(this, arguments);
1224
1212
  };
1225
1213
  }();
1226
1214
 
@@ -1236,7 +1224,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1236
1224
  });
1237
1225
  }
1238
1226
 
1239
- var statusArray = user.is_retailer === 1 ? ["AC", "RC"] : ["AP", "RP", "AC"];
1227
+ var statusArray = user.is_retailer === 1 ? ["ACA", "RCA"] : ["AP", "RP", "ACA"];
1240
1228
  return serv.length > 0 && serv.every(function (item) {
1241
1229
  return statusArray.includes(item.status);
1242
1230
  });
@@ -1325,7 +1313,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1325
1313
  var datasheet_status = product.datasheet_status,
1326
1314
  description_status = product.description_status,
1327
1315
  images_status = product.images_status;
1328
- var completionStates = user.is_retailer === 1 ? ["AC", "Evaluated", "NS"] : ["AP", "Evaluated", "NS"];
1316
+ var completionStates = user.is_retailer === 1 ? ["ACA", "Evaluated", "NS"] : ["AP", "Evaluated", "NS"];
1329
1317
  var dsEvaluated = completionStates.includes(datasheet_status);
1330
1318
  var descsEvaluated = completionStates.includes(description_status);
1331
1319
  var imgsEvaluated = completionStates.includes(images_status);
@@ -1334,144 +1322,169 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1334
1322
  };
1335
1323
 
1336
1324
  var sendEvaluation = /*#__PURE__*/function () {
1337
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
1338
- var data, retailerId, _product$id_order2, _product$id_order3, productTemp, concept;
1325
+ var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(result) {
1326
+ var _productTemp$id_order;
1339
1327
 
1340
- return _regenerator.default.wrap(function _callee13$(_context13) {
1328
+ var concept, productTemp, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, res, newStatuses, orderStatus, serviceStatus, newProductEdit, _JSON$parse, newArticleStatus, newServiceStatus, newStatus, retailerStatusCopy, status;
1329
+
1330
+ return _regenerator.default.wrap(function _callee12$(_context12) {
1341
1331
  while (1) {
1342
- switch (_context13.prev = _context13.next) {
1332
+ switch (_context12.prev = _context12.next) {
1343
1333
  case 0:
1344
1334
  setLoading(true);
1345
- data = {};
1335
+ concept = getConcept(activeTab);
1336
+ productTemp = product;
1337
+ articleId = productTemp.id_article;
1338
+ orderId = (_productTemp$id_order = productTemp.id_order) !== null && _productTemp$id_order !== void 0 ? _productTemp$id_order : productTemp.orderId;
1339
+ sectionStatusKey = "".concat(getConcept(activeTab), "_status");
1340
+ evalStatus = product[sectionStatusKey] || (product === null || product === void 0 ? void 0 : product.version_status);
1341
+ data = {
1342
+ articleId: articleId,
1343
+ orderId: orderId,
1344
+ concept: concept,
1345
+ evalStatus: evalStatus
1346
+ };
1346
1347
  retailerId = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id;
1348
+ _context12.prev = 9;
1347
1349
 
1348
1350
  if (!result) {
1349
- _context13.next = 9;
1351
+ _context12.next = 25;
1350
1352
  break;
1351
1353
  }
1352
1354
 
1353
- data = {
1354
- articleId: product.id_article,
1355
- orderId: (_product$id_order2 = product.id_order) !== null && _product$id_order2 !== void 0 ? _product$id_order2 : product.orderId,
1356
- concept: getConcept(activeTab),
1357
- result: result,
1358
- retailerId: retailerId
1359
- };
1360
- _context13.next = 7;
1355
+ data.result = result;
1356
+ data.retailerId = retailerId;
1357
+ _context12.next = 15;
1361
1358
  return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1362
1359
  headers: {
1363
1360
  Authorization: token
1364
1361
  }
1365
1362
  });
1366
1363
 
1367
- case 7:
1368
- _context13.next = 19;
1364
+ case 15:
1365
+ res = _context12.sent;
1366
+ newStatuses = JSON.parse(res.data.body);
1367
+ orderStatus = newStatuses.newOrderStatus;
1368
+ serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(getConcept(activeTab), "Status")];
1369
+ newProductEdit = productEdit;
1370
+ newProductEdit.product[sectionStatusKey] = serviceStatus;
1371
+ setProductEdit(newProductEdit);
1372
+ showSurvey && showSurvey(!user.is_retailer && orderStatus[orderId] === "AP");
1373
+ _context12.next = 28;
1369
1374
  break;
1370
1375
 
1371
- case 9:
1372
- productTemp = product;
1373
- concept = getConcept(activeTab);
1374
- productTemp["".concat(concept, "_status")] = "Evaluated";
1375
- data = {
1376
- articleId: product.id_article,
1377
- orderId: (_product$id_order3 = product.id_order) !== null && _product$id_order3 !== void 0 ? _product$id_order3 : product.orderId,
1378
- concept: concept
1379
- };
1380
-
1381
- _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
1376
+ case 25:
1377
+ _context12.next = 27;
1378
+ return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
1382
1379
  headers: {
1383
1380
  Authorization: token
1384
1381
  }
1385
1382
  });
1386
1383
 
1387
- setProduct(productTemp);
1388
- sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1389
- setProductEdit({
1390
- ArticleId: productTemp.id_article,
1391
- idCategory: productTemp.article.id_category,
1392
- product: productTemp
1393
- });
1394
- sessionStorage.setItem("productEdit", JSON.stringify({
1395
- ArticleId: productTemp.id_article,
1396
- idCategory: productTemp.article.id_category,
1397
- product: productTemp
1398
- }));
1399
- setOrigin(function (prev) {
1400
- return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, concept, "Evaluated"));
1401
- });
1384
+ case 27:
1385
+ res = _context12.sent;
1386
+
1387
+ case 28:
1388
+ if (res.data.statusCode === 200) {
1389
+ _JSON$parse = JSON.parse(res.data.body), newArticleStatus = _JSON$parse.newArticleStatus, newServiceStatus = _JSON$parse.newServiceStatus, newStatus = _JSON$parse.newStatus;
1390
+ if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
1391
+ retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
1392
+ retailerStatusCopy[activeRetailer.id][concept] = newStatus;
1393
+ setRetailerStatus(retailerStatusCopy);
1394
+ productTemp.statusByRetailer = retailerStatusCopy;
1395
+
1396
+ if (newServiceStatus) {
1397
+ status = newServiceStatus[articleId]["".concat(concept, "Status")];
1398
+ productTemp["".concat(concept, "_status")] = status;
1399
+ }
1400
+
1401
+ setProduct(productTemp);
1402
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1403
+ setOrigin(function (prev) {
1404
+ return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, concept, status));
1405
+ });
1406
+ }
1407
+
1408
+ _context12.next = 34;
1409
+ break;
1410
+
1411
+ case 31:
1412
+ _context12.prev = 31;
1413
+ _context12.t0 = _context12["catch"](9);
1414
+ console.log(_context12.t0);
1402
1415
 
1403
- case 19:
1416
+ case 34:
1404
1417
  loadData();
1405
- showSurvey && showSurvey(confirmStatusComplete());
1406
1418
 
1407
- case 21:
1419
+ case 35:
1408
1420
  case "end":
1409
- return _context13.stop();
1421
+ return _context12.stop();
1410
1422
  }
1411
1423
  }
1412
- }, _callee13);
1424
+ }, _callee12, null, [[9, 31]]);
1413
1425
  }));
1414
1426
 
1415
1427
  return function sendEvaluation(_x7) {
1416
- return _ref14.apply(this, arguments);
1428
+ return _ref13.apply(this, arguments);
1417
1429
  };
1418
1430
  }();
1419
1431
 
1420
1432
  var validateAll = /*#__PURE__*/function () {
1421
- var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(result) {
1422
- var evaluationArray, sendAll, conceptArray, productTemp;
1423
- return _regenerator.default.wrap(function _callee14$(_context14) {
1433
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
1434
+ var _product$id_order2, evaluationArray, sendAll, conceptArray, dataGeneral, productTemp, retailerStatusCopy;
1435
+
1436
+ return _regenerator.default.wrap(function _callee13$(_context13) {
1424
1437
  while (1) {
1425
- switch (_context14.prev = _context14.next) {
1438
+ switch (_context13.prev = _context13.next) {
1426
1439
  case 0:
1427
- _context14.prev = 0;
1440
+ _context13.prev = 0;
1428
1441
  setLoading(true);
1429
1442
  evaluationArray = [];
1430
1443
  sendAll = [];
1431
1444
  conceptArray = ["description", "datasheet", "images"];
1445
+ dataGeneral = {
1446
+ articleId: product.id_article,
1447
+ orderId: (_product$id_order2 = product.id_order) !== null && _product$id_order2 !== void 0 ? _product$id_order2 : product.orderId,
1448
+ result: result
1449
+ };
1432
1450
  servicesData === null || servicesData === void 0 ? void 0 : servicesData.forEach(function (ret) {
1433
- var _product$id_order4;
1434
-
1435
- var data = {
1436
- articleId: product.id_article,
1437
- orderId: (_product$id_order4 = product.id_order) !== null && _product$id_order4 !== void 0 ? _product$id_order4 : product.orderId,
1438
- concept: ret.service,
1439
- result: result,
1440
- retailerId: ret.id_retailer
1441
- };
1451
+ var service = ret.service,
1452
+ id_retailer = ret.id_retailer;
1453
+ var data = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, dataGeneral), {}, {
1454
+ concept: service,
1455
+ retailerId: id_retailer,
1456
+ evalStatus: retailerStatus[id_retailer][service]
1457
+ });
1442
1458
  evaluationArray.push(_axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1443
1459
  headers: {
1444
1460
  Authorization: token
1445
1461
  }
1446
1462
  }));
1447
- });
1448
- _context14.next = 8;
1449
- return Promise.all(evaluationArray);
1450
-
1451
- case 8:
1452
- conceptArray === null || conceptArray === void 0 ? void 0 : conceptArray.forEach(function (concept) {
1453
- var _product$id_order5;
1454
-
1455
- var data = {
1456
- articleId: product.id_article,
1457
- orderId: (_product$id_order5 = product.id_order) !== null && _product$id_order5 !== void 0 ? _product$id_order5 : product.orderId,
1458
- concept: concept
1459
- };
1460
1463
  sendAll.push(_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
1461
1464
  headers: {
1462
1465
  Authorization: token
1463
1466
  }
1464
1467
  }));
1465
1468
  });
1466
- _context14.next = 11;
1467
- return Promise.all(sendAll);
1469
+ _context13.next = 9;
1470
+ return Promise.all([].concat(evaluationArray, sendAll));
1468
1471
 
1469
- case 11:
1472
+ case 9:
1470
1473
  productTemp = product;
1471
- productTemp.article_status = "".concat(result, "C");
1472
- productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : "".concat(result, "C");
1473
- productTemp.description_status = productTemp.description_status === "NA" ? "NA" : "".concat(result, "C");
1474
- productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result, "C");
1474
+ productTemp.article_status = "".concat(result, "CA");
1475
+ productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : "".concat(result, "CA");
1476
+ productTemp.description_status = productTemp.description_status === "NA" ? "NA" : "".concat(result, "CA");
1477
+ productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result, "CA");
1478
+ retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
1479
+ Object.keys(retailerStatusCopy).forEach(function (key) {
1480
+ conceptArray.forEach(function (concept) {
1481
+ if (retailerStatusCopy[key][concept]) {
1482
+ retailerStatusCopy[key][concept] = "".concat(result, "CA");
1483
+ }
1484
+ });
1485
+ });
1486
+ setRetailerStatus(retailerStatusCopy);
1487
+ productTemp.statusByRetailer = retailerStatusCopy;
1475
1488
  setProduct(productTemp);
1476
1489
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1477
1490
  setProductEdit({
@@ -1484,34 +1497,37 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1484
1497
  idCategory: productTemp.article.id_category,
1485
1498
  product: productTemp
1486
1499
  }));
1487
- loadData();
1488
- _context14.next = 26;
1489
- break;
1500
+ _context13.next = 24;
1501
+ return loadData();
1490
1502
 
1491
- case 23:
1492
- _context14.prev = 23;
1493
- _context14.t0 = _context14["catch"](0);
1494
- console.log(_context14.t0);
1503
+ case 24:
1504
+ _context13.next = 29;
1505
+ break;
1495
1506
 
1496
1507
  case 26:
1508
+ _context13.prev = 26;
1509
+ _context13.t0 = _context13["catch"](0);
1510
+ console.log(_context13.t0);
1511
+
1512
+ case 29:
1497
1513
  case "end":
1498
- return _context14.stop();
1514
+ return _context13.stop();
1499
1515
  }
1500
1516
  }
1501
- }, _callee14, null, [[0, 23]]);
1517
+ }, _callee13, null, [[0, 26]]);
1502
1518
  }));
1503
1519
 
1504
1520
  return function validateAll(_x8) {
1505
- return _ref15.apply(this, arguments);
1521
+ return _ref14.apply(this, arguments);
1506
1522
  };
1507
1523
  }();
1508
1524
 
1509
1525
  var evaluationToRetailer = /*#__PURE__*/function () {
1510
- var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
1526
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(result) {
1511
1527
  var data, prod, statusComplete;
1512
- return _regenerator.default.wrap(function _callee15$(_context15) {
1528
+ return _regenerator.default.wrap(function _callee14$(_context14) {
1513
1529
  while (1) {
1514
- switch (_context15.prev = _context15.next) {
1530
+ switch (_context14.prev = _context14.next) {
1515
1531
  case 0:
1516
1532
  data = {
1517
1533
  articleId: product.id_article,
@@ -1519,7 +1535,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1519
1535
  versionId: product.version,
1520
1536
  status: result
1521
1537
  };
1522
- _context15.next = 3;
1538
+ _context14.next = 3;
1523
1539
  return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
1524
1540
  headers: {
1525
1541
  Authorization: token
@@ -1528,7 +1544,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1528
1544
 
1529
1545
  case 3:
1530
1546
  prod = productEdit;
1531
- statusComplete = user.is_retailer ? "".concat(result, "C") : "".concat(result, "P");
1547
+ statusComplete = user.is_retailer ? "".concat(result, "CA") : "".concat(result, "P");
1532
1548
  prod.product.datasheet_status = statusComplete;
1533
1549
  prod.product.description_status = statusComplete;
1534
1550
  prod.product.images_status = statusComplete;
@@ -1537,33 +1553,33 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1537
1553
  sessionStorage.setItem("productEdit", JSON.stringify(prod));
1538
1554
  setProduct(prod);
1539
1555
  setShowGenericModal && setShowGenericModal(false);
1540
- loadData();
1556
+ _context14.next = 15;
1557
+ return loadData();
1541
1558
 
1542
- case 14:
1559
+ case 15:
1543
1560
  case "end":
1544
- return _context15.stop();
1561
+ return _context14.stop();
1545
1562
  }
1546
1563
  }
1547
- }, _callee15);
1564
+ }, _callee14);
1548
1565
  }));
1549
1566
 
1550
1567
  return function evaluationToRetailer(_x9) {
1551
- return _ref16.apply(this, arguments);
1568
+ return _ref15.apply(this, arguments);
1552
1569
  };
1553
1570
  }();
1554
1571
 
1555
1572
  var getSectionStatus = function getSectionStatus() {
1556
1573
  var concept = getConcept(activeTab);
1557
- return ["AA", "AP", "RECEIVED", "IN_PROGRESS", "RC"].includes(productEdit.product["".concat(concept, "_status")]);
1574
+ return ["AA", "AP", "R", "CA", "RCA"].includes(productEdit.product["".concat(concept, "_status")]);
1558
1575
  };
1559
1576
 
1560
1577
  var enableActions = function enableActions(versionStatus) {
1561
1578
  try {
1562
- var userIsRetailer = user.is_retailer;
1563
- if (userIsRetailer) return false;
1579
+ if (user.is_retailer) return false;
1564
1580
 
1565
1581
  if (versionStatus) {
1566
- return ["AP", "AC", "RC", null].includes(versionStatus);
1582
+ return ["AP", "ACA", "RCA", null].includes(versionStatus);
1567
1583
  }
1568
1584
 
1569
1585
  return true;
@@ -1644,53 +1660,49 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1644
1660
  });
1645
1661
  });
1646
1662
  setShowGenericModal(true);
1647
- } else {
1648
- if (user.is_retailer) {
1649
- if (product.id_order || product.orderId) {
1650
- validateAll("A");
1651
- } else {
1652
- setDataGenericModal(function (prev) {
1653
- return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
1654
- button2: {
1655
- name: "Continuar",
1656
- action: function action() {
1657
- return evaluationToRetailer("A");
1658
- }
1663
+ } else if (user.is_retailer) {
1664
+ if (product.id_order || product.orderId) {
1665
+ validateAll("A");
1666
+ } else {
1667
+ setDataGenericModal(function (prev) {
1668
+ return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
1669
+ button2: {
1670
+ name: "Continuar",
1671
+ action: function action() {
1672
+ return evaluationToRetailer("A");
1659
1673
  }
1660
- });
1674
+ }
1661
1675
  });
1662
- setShowGenericModal(true);
1663
- }
1664
- } else {
1665
- validateAll("A");
1676
+ });
1677
+ setShowGenericModal(true);
1666
1678
  }
1679
+ } else {
1680
+ validateAll("A");
1667
1681
  }
1668
1682
  },
1669
1683
  rejectAll: function rejectAll() {
1670
1684
  if (originProp === "RequestWithoutContentoh" && !user.is_retailer && (!product.id_order || !product.orderId)) {
1671
1685
  return;
1672
- } else {
1673
- if (user.is_retailer) {
1674
- if (product.id_order || product.orderId) {
1675
- validateAll("R");
1676
- setModalViewError(true);
1677
- } else {
1678
- setDataGenericModal(function (prev) {
1679
- return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
1680
- button2: {
1681
- name: "Continuar",
1682
- action: function action() {
1683
- return evaluationToRetailer("R");
1684
- }
1685
- }
1686
- });
1687
- });
1688
- setShowGenericModal(true);
1689
- }
1690
- } else {
1686
+ } else if (user.is_retailer) {
1687
+ if (product.id_order || product.orderId) {
1691
1688
  validateAll("R");
1692
1689
  setModalViewError(true);
1690
+ } else {
1691
+ setDataGenericModal(function (prev) {
1692
+ return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
1693
+ button2: {
1694
+ name: "Continuar",
1695
+ action: function action() {
1696
+ return evaluationToRetailer("R");
1697
+ }
1698
+ }
1699
+ });
1700
+ });
1701
+ setShowGenericModal(true);
1693
1702
  }
1703
+ } else {
1704
+ validateAll("R");
1705
+ setModalViewError(true);
1694
1706
  }
1695
1707
  },
1696
1708
  approve: function approve() {
@@ -1706,58 +1718,54 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1706
1718
  });
1707
1719
  });
1708
1720
  setShowGenericModal(true);
1709
- } else {
1710
- if (user.is_retailer) {
1711
- if (product.id_order || product.orderId) {
1712
- sendEvaluation("A");
1713
- } else {
1714
- setDataGenericModal(function (prev) {
1715
- return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
1716
- button2: {
1717
- name: "Continuar",
1718
- action: function action() {
1719
- return evaluationToRetailer("A");
1720
- }
1721
+ } else if (user.is_retailer) {
1722
+ if (product.id_order || product.orderId) {
1723
+ sendEvaluation("A");
1724
+ } else {
1725
+ setDataGenericModal(function (prev) {
1726
+ return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
1727
+ button2: {
1728
+ name: "Continuar",
1729
+ action: function action() {
1730
+ return evaluationToRetailer("A");
1721
1731
  }
1722
- });
1732
+ }
1723
1733
  });
1724
- setShowGenericModal(true);
1725
- }
1726
- } else {
1727
- sendEvaluation("A");
1734
+ });
1735
+ setShowGenericModal(true);
1728
1736
  }
1737
+ } else {
1738
+ sendEvaluation("A");
1729
1739
  }
1730
1740
  },
1731
1741
  reject: function reject() {
1732
1742
  if (origin[activeTab] === "RequestWithoutContentoh" && !user.is_retailer && (!product.id_order || !product.orderId)) {
1733
1743
  return;
1734
- } else {
1735
- if (user.is_retailer) {
1736
- if (product.id_order || product.orderId) {
1737
- sendEvaluation("R");
1738
- setModalViewError(true);
1739
- } else {
1740
- setDataGenericModal(function (prev) {
1741
- return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
1742
- button2: {
1743
- name: "Continuar",
1744
- action: function action() {
1745
- return evaluationToRetailer("R");
1746
- }
1747
- }
1748
- });
1749
- });
1750
- setShowGenericModal(true);
1751
- }
1752
- } else {
1744
+ } else if (user.is_retailer) {
1745
+ if (product.id_order || product.orderId) {
1753
1746
  sendEvaluation("R");
1754
1747
  setModalViewError(true);
1748
+ } else {
1749
+ setDataGenericModal(function (prev) {
1750
+ return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
1751
+ button2: {
1752
+ name: "Continuar",
1753
+ action: function action() {
1754
+ return evaluationToRetailer("R");
1755
+ }
1756
+ }
1757
+ });
1758
+ });
1759
+ setShowGenericModal(true);
1755
1760
  }
1761
+ } else {
1762
+ sendEvaluation("R");
1763
+ setModalViewError(true);
1756
1764
  }
1757
1765
  }
1758
1766
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
1759
1767
  tabsSections: tabsSections,
1760
- status: product["".concat(getConcept(activeTab), "_status")] || (product === null || product === void 0 ? void 0 : product.version_status),
1768
+ status: activeRetailer.id && retailerStatus ? retailerStatus[activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id][getConcept(activeTab)] || "NS" : "-",
1761
1769
  activeTab: activeTab,
1762
1770
  setActiveTab: setActiveTab,
1763
1771
  setImageLayout: setImageLayout,
@@ -1833,9 +1841,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1833
1841
  headerType: "input-name-header"
1834
1842
  }))]
1835
1843
  })
1836
- }), isRevision() && getSectionStatus() ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1844
+ }), isRevision() && getSectionStatus() ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1837
1845
  className: "commentary-box",
1838
- children: [!comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1846
+ children: !comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1839
1847
  className: "commentary",
1840
1848
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
1841
1849
  label: "Caja de Comentario",
@@ -1861,32 +1869,24 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1861
1869
  reviewed: crossComment
1862
1870
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1863
1871
  buttonType: "circular-button accept-button",
1864
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
1865
- return _regenerator.default.wrap(function _callee16$(_context16) {
1872
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
1873
+ return _regenerator.default.wrap(function _callee15$(_context15) {
1866
1874
  while (1) {
1867
- switch (_context16.prev = _context16.next) {
1875
+ switch (_context15.prev = _context15.next) {
1868
1876
  case 0:
1869
1877
  setCrossComment(true);
1870
1878
  commentRevised();
1871
1879
 
1872
1880
  case 2:
1873
1881
  case "end":
1874
- return _context16.stop();
1882
+ return _context15.stop();
1875
1883
  }
1876
1884
  }
1877
- }, _callee16);
1885
+ }, _callee15);
1878
1886
  }))
1879
1887
  })]
1880
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1881
- buttonType: evaluationComplete(activeTab) && (productEdit.product.id_order || productEdit.product.orderId) ? "general-green-button" : "general-button-disabled",
1882
- label: "Enviar evaluación",
1883
- onClick: function onClick() {
1884
- //setModalSent(true);
1885
- sendEvaluation();
1886
- setMessage("\xA1Evaluaci\xF3n de ".concat(activeTab, " completada!"));
1887
- }
1888
- })]
1889
- }) : revision ? null : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1888
+ })
1889
+ }) : !revision && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1890
1890
  className: "required-inputs-message",
1891
1891
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1892
1892
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {