contentoh-components-library 21.4.137 → 21.4.138
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.
|
@@ -355,61 +355,105 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
355
355
|
noClick: true,
|
|
356
356
|
onDrop: function onDrop(acceptedFiles) {
|
|
357
357
|
var newImages = [];
|
|
358
|
+
var createThumbnail = true;
|
|
358
359
|
acceptedFiles.map(function (file) {
|
|
359
360
|
var reader = new FileReader();
|
|
360
361
|
reader.fileName = file.name;
|
|
361
362
|
|
|
362
363
|
reader.onload = /*#__PURE__*/function () {
|
|
363
|
-
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
364
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(e) {
|
|
364
365
|
var ext, img;
|
|
365
|
-
return _regenerator.default.wrap(function
|
|
366
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
366
367
|
while (1) {
|
|
367
|
-
switch (
|
|
368
|
+
switch (_context4.prev = _context4.next) {
|
|
368
369
|
case 0:
|
|
369
370
|
ext = e.srcElement.fileName.split(".");
|
|
370
371
|
img = new Image();
|
|
371
372
|
|
|
372
373
|
if (!(ext[ext.length - 1] == "mp4")) {
|
|
373
|
-
|
|
374
|
+
_context4.next = 9;
|
|
374
375
|
break;
|
|
375
376
|
}
|
|
376
377
|
|
|
377
|
-
|
|
378
|
+
_context4.next = 5;
|
|
378
379
|
return (0, _generateThumnail.default)(e.target.result, 2);
|
|
379
380
|
|
|
380
381
|
case 5:
|
|
381
|
-
img.src =
|
|
382
|
-
|
|
383
|
-
|
|
382
|
+
img.src = _context4.sent;
|
|
383
|
+
obtenerDuracionVideoBase64(e.target.result).then( /*#__PURE__*/function () {
|
|
384
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(duracion) {
|
|
385
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
386
|
+
while (1) {
|
|
387
|
+
switch (_context3.prev = _context3.next) {
|
|
388
|
+
case 0:
|
|
389
|
+
if (!(duracion > 15 && duracion < 300)) {
|
|
390
|
+
_context3.next = 6;
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
384
393
|
|
|
385
|
-
|
|
386
|
-
|
|
394
|
+
_context3.next = 3;
|
|
395
|
+
return (0, _generateThumnail.default)(e.target.result, 2);
|
|
396
|
+
|
|
397
|
+
case 3:
|
|
398
|
+
img.src = _context3.sent;
|
|
399
|
+
_context3.next = 8;
|
|
400
|
+
break;
|
|
401
|
+
|
|
402
|
+
case 6:
|
|
403
|
+
createThumbnail = false;
|
|
404
|
+
setModalAlert({
|
|
405
|
+
show: true,
|
|
406
|
+
title: "Hay un error al subir el video",
|
|
407
|
+
message: "Los videos deben durar entre 15 segundos y 5 minutos"
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
case 8:
|
|
411
|
+
case "end":
|
|
412
|
+
return _context3.stop();
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}, _callee3);
|
|
416
|
+
}));
|
|
417
|
+
|
|
418
|
+
return function (_x4) {
|
|
419
|
+
return _ref5.apply(this, arguments);
|
|
420
|
+
};
|
|
421
|
+
}()).catch(function (error) {
|
|
422
|
+
console.error('Error al obtener la duración del video:', error);
|
|
423
|
+
});
|
|
424
|
+
_context4.next = 10;
|
|
425
|
+
break;
|
|
387
426
|
|
|
388
427
|
case 9:
|
|
389
|
-
|
|
390
|
-
var width = img.width;
|
|
391
|
-
var height = img.height;
|
|
392
|
-
var newImg = {
|
|
393
|
-
action: "addImg",
|
|
394
|
-
img: {
|
|
395
|
-
src: img.src,
|
|
396
|
-
//e.target.result,
|
|
397
|
-
name: e.target.fileName,
|
|
398
|
-
ext: ext[ext.length - 1],
|
|
399
|
-
width: width,
|
|
400
|
-
height: height,
|
|
401
|
-
video_src: ext[ext.length - 1] == "mp4" ? e.target.result : ""
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
setImages(newImg);
|
|
405
|
-
}, 500);
|
|
428
|
+
img.src = e.target.result;
|
|
406
429
|
|
|
407
430
|
case 10:
|
|
431
|
+
if (createThumbnail) {
|
|
432
|
+
generasetTimeout(function () {
|
|
433
|
+
var width = img.width;
|
|
434
|
+
var height = img.height;
|
|
435
|
+
var newImg = {
|
|
436
|
+
action: "addImg",
|
|
437
|
+
img: {
|
|
438
|
+
src: img.src,
|
|
439
|
+
//e.target.result,
|
|
440
|
+
name: e.target.fileName,
|
|
441
|
+
ext: ext[ext.length - 1],
|
|
442
|
+
width: width,
|
|
443
|
+
height: height,
|
|
444
|
+
video_src: ext[ext.length - 1] == "mp4" ? e.target.result : ""
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
setImages(newImg);
|
|
448
|
+
}, 500);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
case 11:
|
|
408
452
|
case "end":
|
|
409
|
-
return
|
|
453
|
+
return _context4.stop();
|
|
410
454
|
}
|
|
411
455
|
}
|
|
412
|
-
},
|
|
456
|
+
}, _callee4);
|
|
413
457
|
}));
|
|
414
458
|
|
|
415
459
|
return function (_x3) {
|
|
@@ -620,25 +664,35 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
620
664
|
valRejAll = _useState86[0],
|
|
621
665
|
setValRejAll = _useState86[1];
|
|
622
666
|
|
|
623
|
-
var _useState87 = (0, _react.useState)(
|
|
667
|
+
var _useState87 = (0, _react.useState)({
|
|
668
|
+
show: false,
|
|
669
|
+
title: "",
|
|
670
|
+
message: "",
|
|
671
|
+
errorInputMessage: false
|
|
672
|
+
}),
|
|
624
673
|
_useState88 = (0, _slicedToArray2.default)(_useState87, 2),
|
|
625
|
-
|
|
626
|
-
|
|
674
|
+
modalAlert = _useState88[0],
|
|
675
|
+
setModalAlert = _useState88[1];
|
|
627
676
|
|
|
628
677
|
var _useState89 = (0, _react.useState)([]),
|
|
629
678
|
_useState90 = (0, _slicedToArray2.default)(_useState89, 2),
|
|
630
|
-
|
|
631
|
-
|
|
679
|
+
desc = _useState90[0],
|
|
680
|
+
setDesc = _useState90[1];
|
|
632
681
|
|
|
633
682
|
var _useState91 = (0, _react.useState)([]),
|
|
634
683
|
_useState92 = (0, _slicedToArray2.default)(_useState91, 2),
|
|
635
|
-
|
|
636
|
-
|
|
684
|
+
fich = _useState92[0],
|
|
685
|
+
setFich = _useState92[1];
|
|
637
686
|
|
|
638
|
-
var _useState93 = (0, _react.useState)(
|
|
687
|
+
var _useState93 = (0, _react.useState)([]),
|
|
639
688
|
_useState94 = (0, _slicedToArray2.default)(_useState93, 2),
|
|
640
|
-
|
|
641
|
-
|
|
689
|
+
imag = _useState94[0],
|
|
690
|
+
setImag = _useState94[1];
|
|
691
|
+
|
|
692
|
+
var _useState95 = (0, _react.useState)(false),
|
|
693
|
+
_useState96 = (0, _slicedToArray2.default)(_useState95, 2),
|
|
694
|
+
isObservationVisible = _useState96[0],
|
|
695
|
+
setObservationVisible = _useState96[1];
|
|
642
696
|
|
|
643
697
|
var toggleObservation = function toggleObservation() {
|
|
644
698
|
setObservationVisible(!isObservationVisible);
|
|
@@ -663,63 +717,63 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
663
717
|
setObservationVisible(false);
|
|
664
718
|
};
|
|
665
719
|
|
|
666
|
-
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
667
|
-
var
|
|
720
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
721
|
+
var _ref7, id_article;
|
|
668
722
|
|
|
669
|
-
return _regenerator.default.wrap(function
|
|
723
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
670
724
|
while (1) {
|
|
671
|
-
switch (
|
|
725
|
+
switch (_context5.prev = _context5.next) {
|
|
672
726
|
case 0:
|
|
673
|
-
|
|
727
|
+
_ref7 = (product === null || product === void 0 ? void 0 : product.article) || {}, id_article = _ref7.id_article;
|
|
674
728
|
|
|
675
729
|
if (!id_article) {
|
|
676
|
-
|
|
730
|
+
_context5.next = 4;
|
|
677
731
|
break;
|
|
678
732
|
}
|
|
679
733
|
|
|
680
|
-
|
|
734
|
+
_context5.next = 4;
|
|
681
735
|
return (0, _utils.getAuditVersion)(id_article, setAuditableVersion, token);
|
|
682
736
|
|
|
683
737
|
case 4:
|
|
684
738
|
case "end":
|
|
685
|
-
return
|
|
739
|
+
return _context5.stop();
|
|
686
740
|
}
|
|
687
741
|
}
|
|
688
|
-
},
|
|
742
|
+
}, _callee5);
|
|
689
743
|
})), []);
|
|
690
744
|
|
|
691
745
|
var loadAuditableData = /*#__PURE__*/function () {
|
|
692
|
-
var
|
|
746
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
693
747
|
var _product$article, _product$article2, _product$article3, _auditServices;
|
|
694
748
|
|
|
695
|
-
return _regenerator.default.wrap(function
|
|
749
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
696
750
|
while (1) {
|
|
697
|
-
switch (
|
|
751
|
+
switch (_context6.prev = _context6.next) {
|
|
698
752
|
case 0:
|
|
699
753
|
if (!auditableVersion) {
|
|
700
|
-
|
|
754
|
+
_context6.next = 7;
|
|
701
755
|
break;
|
|
702
756
|
}
|
|
703
757
|
|
|
704
|
-
|
|
758
|
+
_context6.next = 3;
|
|
705
759
|
return (0, _data2.getRetailerServices)(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.category, parseInt(product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_category), auditableVersion.version, token);
|
|
706
760
|
|
|
707
761
|
case 3:
|
|
708
|
-
_auditServices =
|
|
762
|
+
_auditServices = _context6.sent;
|
|
709
763
|
(0, _utils.getInputsData)(_auditServices, activeRetailer, setAuditDatasheets, setAuditDescriptions);
|
|
710
764
|
setAuditServices(_auditServices);
|
|
711
765
|
setAuditImages(_auditServices[2]);
|
|
712
766
|
|
|
713
767
|
case 7:
|
|
714
768
|
case "end":
|
|
715
|
-
return
|
|
769
|
+
return _context6.stop();
|
|
716
770
|
}
|
|
717
771
|
}
|
|
718
|
-
},
|
|
772
|
+
}, _callee6);
|
|
719
773
|
}));
|
|
720
774
|
|
|
721
775
|
return function loadAuditableData() {
|
|
722
|
-
return
|
|
776
|
+
return _ref8.apply(this, arguments);
|
|
723
777
|
};
|
|
724
778
|
}();
|
|
725
779
|
|
|
@@ -733,19 +787,19 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
733
787
|
}, [checkAll]);
|
|
734
788
|
|
|
735
789
|
var loadData = /*#__PURE__*/function () {
|
|
736
|
-
var
|
|
790
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
737
791
|
var _product$article4, _product$article5, _product$article6, _services$, _services$$values, _product$retailersAva, _services, data, headers;
|
|
738
792
|
|
|
739
|
-
return _regenerator.default.wrap(function
|
|
793
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
740
794
|
while (1) {
|
|
741
|
-
switch (
|
|
795
|
+
switch (_context7.prev = _context7.next) {
|
|
742
796
|
case 0:
|
|
743
|
-
|
|
744
|
-
|
|
797
|
+
_context7.prev = 0;
|
|
798
|
+
_context7.next = 3;
|
|
745
799
|
return (0, _data2.getRetailerServices)(product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article, product === null || product === void 0 ? void 0 : (_product$article5 = product.article) === null || _product$article5 === void 0 ? void 0 : _product$article5.category, parseInt(product === null || product === void 0 ? void 0 : (_product$article6 = product.article) === null || _product$article6 === void 0 ? void 0 : _product$article6.id_category), version, token);
|
|
746
800
|
|
|
747
801
|
case 3:
|
|
748
|
-
_services =
|
|
802
|
+
_services = _context7.sent;
|
|
749
803
|
|
|
750
804
|
if (auditableVersion) {
|
|
751
805
|
loadAuditableData();
|
|
@@ -763,8 +817,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
763
817
|
id_article: product.article.id_article,
|
|
764
818
|
id_category: product.article.id_category,
|
|
765
819
|
version: product.version,
|
|
766
|
-
id_retailer_array: ((_product$retailersAva = product.retailersAvailable) !== null && _product$retailersAva !== void 0 ? _product$retailersAva : product.retailers).map(function (
|
|
767
|
-
var id =
|
|
820
|
+
id_retailer_array: ((_product$retailersAva = product.retailersAvailable) !== null && _product$retailersAva !== void 0 ? _product$retailersAva : product.retailers).map(function (_ref10) {
|
|
821
|
+
var id = _ref10.id;
|
|
768
822
|
return id;
|
|
769
823
|
})
|
|
770
824
|
}];
|
|
@@ -778,41 +832,41 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
778
832
|
setPercentages(res[0]);
|
|
779
833
|
});
|
|
780
834
|
setLoading(false);
|
|
781
|
-
|
|
835
|
+
_context7.next = 18;
|
|
782
836
|
break;
|
|
783
837
|
|
|
784
838
|
case 15:
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
console.log(
|
|
839
|
+
_context7.prev = 15;
|
|
840
|
+
_context7.t0 = _context7["catch"](0);
|
|
841
|
+
console.log(_context7.t0);
|
|
788
842
|
|
|
789
843
|
case 18:
|
|
790
844
|
case "end":
|
|
791
|
-
return
|
|
845
|
+
return _context7.stop();
|
|
792
846
|
}
|
|
793
847
|
}
|
|
794
|
-
},
|
|
848
|
+
}, _callee7, null, [[0, 15]]);
|
|
795
849
|
}));
|
|
796
850
|
|
|
797
851
|
return function loadData() {
|
|
798
|
-
return
|
|
852
|
+
return _ref9.apply(this, arguments);
|
|
799
853
|
};
|
|
800
854
|
}();
|
|
801
855
|
|
|
802
856
|
var getServices = /*#__PURE__*/function () {
|
|
803
|
-
var
|
|
857
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
804
858
|
var _product$article7, _product$article8, _servicesResponse$dat;
|
|
805
859
|
|
|
806
860
|
var servicesResponse, parsedResponse, retailers, retailerResponse, active;
|
|
807
|
-
return _regenerator.default.wrap(function
|
|
861
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
808
862
|
while (1) {
|
|
809
|
-
switch (
|
|
863
|
+
switch (_context8.prev = _context8.next) {
|
|
810
864
|
case 0:
|
|
811
|
-
|
|
865
|
+
_context8.next = 2;
|
|
812
866
|
return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article7 = product.article) === null || _product$article7 === void 0 ? void 0 : _product$article7.id_article, "&orderId=").concat((product === null || product === void 0 ? void 0 : (_product$article8 = product.article) === null || _product$article8 === void 0 ? void 0 : _product$article8.id_order) || product.orderId, "&end=true"));
|
|
813
867
|
|
|
814
868
|
case 2:
|
|
815
|
-
servicesResponse =
|
|
869
|
+
servicesResponse = _context8.sent;
|
|
816
870
|
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;
|
|
817
871
|
retailers = product.retailers || product.retailersAvailable;
|
|
818
872
|
retailerResponse = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
|
|
@@ -826,14 +880,14 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
826
880
|
|
|
827
881
|
case 9:
|
|
828
882
|
case "end":
|
|
829
|
-
return
|
|
883
|
+
return _context8.stop();
|
|
830
884
|
}
|
|
831
885
|
}
|
|
832
|
-
},
|
|
886
|
+
}, _callee8);
|
|
833
887
|
}));
|
|
834
888
|
|
|
835
889
|
return function getServices() {
|
|
836
|
-
return
|
|
890
|
+
return _ref11.apply(this, arguments);
|
|
837
891
|
};
|
|
838
892
|
}();
|
|
839
893
|
|
|
@@ -847,23 +901,23 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
847
901
|
};
|
|
848
902
|
|
|
849
903
|
var getComments = /*#__PURE__*/function () {
|
|
850
|
-
var
|
|
904
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
851
905
|
var _product$article9, _product$article10, _product$article11;
|
|
852
906
|
|
|
853
907
|
var tab,
|
|
854
908
|
commentsResponse,
|
|
855
909
|
comments,
|
|
856
|
-
|
|
857
|
-
return _regenerator.default.wrap(function
|
|
910
|
+
_args9 = arguments;
|
|
911
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
858
912
|
while (1) {
|
|
859
|
-
switch (
|
|
913
|
+
switch (_context9.prev = _context9.next) {
|
|
860
914
|
case 0:
|
|
861
|
-
tab =
|
|
862
|
-
|
|
915
|
+
tab = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : "Descripción";
|
|
916
|
+
_context9.next = 3;
|
|
863
917
|
return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article, "&concept=description&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article, "&concept=datasheet&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article11 = product.article) === null || _product$article11 === void 0 ? void 0 : _product$article11.id_article, "&concept=images&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version))]);
|
|
864
918
|
|
|
865
919
|
case 3:
|
|
866
|
-
commentsResponse =
|
|
920
|
+
commentsResponse = _context9.sent;
|
|
867
921
|
comments = {};
|
|
868
922
|
commentsResponse.forEach(function (comment) {
|
|
869
923
|
var _comment$data, _JSON$parse, _JSON$parse$data$, _comment$data2, _comment$data3;
|
|
@@ -875,63 +929,63 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
875
929
|
|
|
876
930
|
case 8:
|
|
877
931
|
case "end":
|
|
878
|
-
return
|
|
932
|
+
return _context9.stop();
|
|
879
933
|
}
|
|
880
934
|
}
|
|
881
|
-
},
|
|
935
|
+
}, _callee9);
|
|
882
936
|
}));
|
|
883
937
|
|
|
884
938
|
return function getComments() {
|
|
885
|
-
return
|
|
939
|
+
return _ref12.apply(this, arguments);
|
|
886
940
|
};
|
|
887
941
|
}();
|
|
888
942
|
|
|
889
|
-
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
943
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
890
944
|
var arr;
|
|
891
|
-
return _regenerator.default.wrap(function
|
|
945
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
892
946
|
while (1) {
|
|
893
|
-
switch (
|
|
947
|
+
switch (_context10.prev = _context10.next) {
|
|
894
948
|
case 0:
|
|
895
949
|
setLoading(true);
|
|
896
950
|
loadData();
|
|
897
951
|
getComments();
|
|
898
|
-
|
|
899
|
-
|
|
952
|
+
_context10.t0 = setUserGroups;
|
|
953
|
+
_context10.next = 6;
|
|
900
954
|
return (0, _data2.fetchUsers)(token);
|
|
901
955
|
|
|
902
956
|
case 6:
|
|
903
|
-
|
|
904
|
-
(0,
|
|
957
|
+
_context10.t1 = _context10.sent;
|
|
958
|
+
(0, _context10.t0)(_context10.t1);
|
|
905
959
|
arr = [];
|
|
906
|
-
|
|
907
|
-
|
|
960
|
+
_context10.t2 = user.id_role;
|
|
961
|
+
_context10.next = _context10.t2 === 7 ? 12 : _context10.t2 === 8 ? 12 : _context10.t2 === 4 ? 14 : _context10.t2 === 5 ? 14 : _context10.t2 === 6 ? 16 : 18;
|
|
908
962
|
break;
|
|
909
963
|
|
|
910
964
|
case 12:
|
|
911
965
|
arr = ["PA", "AS", "CA", "RC", "RA", "RP", "RCA"];
|
|
912
|
-
return
|
|
966
|
+
return _context10.abrupt("break", 20);
|
|
913
967
|
|
|
914
968
|
case 14:
|
|
915
969
|
arr = ["RC", "AC", "AA", "AP", "ACA"];
|
|
916
|
-
return
|
|
970
|
+
return _context10.abrupt("break", 20);
|
|
917
971
|
|
|
918
972
|
case 16:
|
|
919
973
|
arr = ["RP", "RCA", "AC", "RA"];
|
|
920
|
-
return
|
|
974
|
+
return _context10.abrupt("break", 20);
|
|
921
975
|
|
|
922
976
|
case 18:
|
|
923
977
|
arr = [];
|
|
924
|
-
return
|
|
978
|
+
return _context10.abrupt("break", 20);
|
|
925
979
|
|
|
926
980
|
case 20:
|
|
927
981
|
setStatusArray(arr);
|
|
928
982
|
|
|
929
983
|
case 21:
|
|
930
984
|
case "end":
|
|
931
|
-
return
|
|
985
|
+
return _context10.stop();
|
|
932
986
|
}
|
|
933
987
|
}
|
|
934
|
-
},
|
|
988
|
+
}, _callee10);
|
|
935
989
|
})), [product, version]);
|
|
936
990
|
|
|
937
991
|
var loadAssignations = function loadAssignations(currentProduct) {
|
|
@@ -1053,19 +1107,19 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1053
1107
|
};
|
|
1054
1108
|
|
|
1055
1109
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
1056
|
-
var
|
|
1110
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1057
1111
|
var dataClean, _product$article12, productTemp, articleId, dataObject, res, _JSON$parse2, newStatus, newArticleStatus;
|
|
1058
1112
|
|
|
1059
|
-
return _regenerator.default.wrap(function
|
|
1113
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1060
1114
|
while (1) {
|
|
1061
|
-
switch (
|
|
1115
|
+
switch (_context11.prev = _context11.next) {
|
|
1062
1116
|
case 0:
|
|
1063
1117
|
dataClean = updatedDescriptions.filter(function (f) {
|
|
1064
1118
|
return f.value !== "";
|
|
1065
1119
|
});
|
|
1066
1120
|
|
|
1067
1121
|
if (!(dataClean.length > 0)) {
|
|
1068
|
-
|
|
1122
|
+
_context11.next = 26;
|
|
1069
1123
|
break;
|
|
1070
1124
|
}
|
|
1071
1125
|
|
|
@@ -1077,8 +1131,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1077
1131
|
articleData: dataClean
|
|
1078
1132
|
};
|
|
1079
1133
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1080
|
-
|
|
1081
|
-
|
|
1134
|
+
_context11.prev = 7;
|
|
1135
|
+
_context11.next = 10;
|
|
1082
1136
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
1083
1137
|
headers: {
|
|
1084
1138
|
Authorization: token
|
|
@@ -1086,10 +1140,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1086
1140
|
});
|
|
1087
1141
|
|
|
1088
1142
|
case 10:
|
|
1089
|
-
res =
|
|
1143
|
+
res = _context11.sent;
|
|
1090
1144
|
|
|
1091
1145
|
if (!(res.data.statusCode === 200)) {
|
|
1092
|
-
|
|
1146
|
+
_context11.next = 21;
|
|
1093
1147
|
break;
|
|
1094
1148
|
}
|
|
1095
1149
|
|
|
@@ -1100,45 +1154,45 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1100
1154
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1101
1155
|
setUpdatedDescriptions([]);
|
|
1102
1156
|
setMessage("Descripciones guardadas con éxito");
|
|
1103
|
-
|
|
1157
|
+
_context11.next = 21;
|
|
1104
1158
|
return loadData();
|
|
1105
1159
|
|
|
1106
1160
|
case 21:
|
|
1107
|
-
|
|
1161
|
+
_context11.next = 26;
|
|
1108
1162
|
break;
|
|
1109
1163
|
|
|
1110
1164
|
case 23:
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
console.log(
|
|
1165
|
+
_context11.prev = 23;
|
|
1166
|
+
_context11.t0 = _context11["catch"](7);
|
|
1167
|
+
console.log(_context11.t0);
|
|
1114
1168
|
|
|
1115
1169
|
case 26:
|
|
1116
1170
|
case "end":
|
|
1117
|
-
return
|
|
1171
|
+
return _context11.stop();
|
|
1118
1172
|
}
|
|
1119
1173
|
}
|
|
1120
|
-
},
|
|
1174
|
+
}, _callee11, null, [[7, 23]]);
|
|
1121
1175
|
}));
|
|
1122
1176
|
|
|
1123
1177
|
return function saveDescriptions() {
|
|
1124
|
-
return
|
|
1178
|
+
return _ref14.apply(this, arguments);
|
|
1125
1179
|
};
|
|
1126
1180
|
}();
|
|
1127
1181
|
|
|
1128
1182
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
1129
|
-
var
|
|
1183
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1130
1184
|
var dataClean, _product$article13, productTemp, articleId, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
|
|
1131
1185
|
|
|
1132
|
-
return _regenerator.default.wrap(function
|
|
1186
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1133
1187
|
while (1) {
|
|
1134
|
-
switch (
|
|
1188
|
+
switch (_context12.prev = _context12.next) {
|
|
1135
1189
|
case 0:
|
|
1136
1190
|
dataClean = updatedDatasheets.filter(function (f) {
|
|
1137
1191
|
return f.value !== "";
|
|
1138
1192
|
});
|
|
1139
1193
|
|
|
1140
1194
|
if (!(dataClean.length > 0)) {
|
|
1141
|
-
|
|
1195
|
+
_context12.next = 26;
|
|
1142
1196
|
break;
|
|
1143
1197
|
}
|
|
1144
1198
|
|
|
@@ -1150,8 +1204,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1150
1204
|
articleData: dataClean
|
|
1151
1205
|
};
|
|
1152
1206
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1153
|
-
|
|
1154
|
-
|
|
1207
|
+
_context12.prev = 7;
|
|
1208
|
+
_context12.next = 10;
|
|
1155
1209
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
1156
1210
|
headers: {
|
|
1157
1211
|
Authorization: token
|
|
@@ -1159,10 +1213,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1159
1213
|
});
|
|
1160
1214
|
|
|
1161
1215
|
case 10:
|
|
1162
|
-
res =
|
|
1216
|
+
res = _context12.sent;
|
|
1163
1217
|
|
|
1164
1218
|
if (!(res.data.statusCode === 200)) {
|
|
1165
|
-
|
|
1219
|
+
_context12.next = 21;
|
|
1166
1220
|
break;
|
|
1167
1221
|
}
|
|
1168
1222
|
|
|
@@ -1173,28 +1227,28 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1173
1227
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1174
1228
|
setUpdatedDatasheets([]);
|
|
1175
1229
|
setMessage("Fichas técnicas guardadas");
|
|
1176
|
-
|
|
1230
|
+
_context12.next = 21;
|
|
1177
1231
|
return loadData();
|
|
1178
1232
|
|
|
1179
1233
|
case 21:
|
|
1180
|
-
|
|
1234
|
+
_context12.next = 26;
|
|
1181
1235
|
break;
|
|
1182
1236
|
|
|
1183
1237
|
case 23:
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
console.log(
|
|
1238
|
+
_context12.prev = 23;
|
|
1239
|
+
_context12.t0 = _context12["catch"](7);
|
|
1240
|
+
console.log(_context12.t0);
|
|
1187
1241
|
|
|
1188
1242
|
case 26:
|
|
1189
1243
|
case "end":
|
|
1190
|
-
return
|
|
1244
|
+
return _context12.stop();
|
|
1191
1245
|
}
|
|
1192
1246
|
}
|
|
1193
|
-
},
|
|
1247
|
+
}, _callee12, null, [[7, 23]]);
|
|
1194
1248
|
}));
|
|
1195
1249
|
|
|
1196
1250
|
return function saveDatasheets() {
|
|
1197
|
-
return
|
|
1251
|
+
return _ref15.apply(this, arguments);
|
|
1198
1252
|
};
|
|
1199
1253
|
}();
|
|
1200
1254
|
|
|
@@ -1215,14 +1269,14 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1215
1269
|
});
|
|
1216
1270
|
setSocketType(imageInputs);
|
|
1217
1271
|
}, [images]);
|
|
1218
|
-
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1272
|
+
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
1219
1273
|
var _images$values3, _images$attrForImgs, _product$article14, _data$articleData, _data$articleData2, _data$updateImages;
|
|
1220
1274
|
|
|
1221
1275
|
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
1222
1276
|
|
|
1223
|
-
return _regenerator.default.wrap(function
|
|
1277
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1224
1278
|
while (1) {
|
|
1225
|
-
switch (
|
|
1279
|
+
switch (_context13.prev = _context13.next) {
|
|
1226
1280
|
case 0:
|
|
1227
1281
|
imagesList = images === null || images === void 0 ? void 0 : (_images$values3 = images.values) === null || _images$values3 === void 0 ? void 0 : _images$values3.slice();
|
|
1228
1282
|
imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
|
|
@@ -1270,19 +1324,19 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1270
1324
|
}
|
|
1271
1325
|
|
|
1272
1326
|
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
1273
|
-
|
|
1327
|
+
_context13.next = 30;
|
|
1274
1328
|
break;
|
|
1275
1329
|
}
|
|
1276
1330
|
|
|
1277
1331
|
setLoading(true);
|
|
1278
|
-
|
|
1332
|
+
_context13.prev = 10;
|
|
1279
1333
|
data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
|
|
1280
1334
|
e.uuid = (0, _uuid.v4)();
|
|
1281
1335
|
});
|
|
1282
1336
|
setDataImages(data);
|
|
1283
1337
|
|
|
1284
1338
|
if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
|
|
1285
|
-
|
|
1339
|
+
_context13.next = 22;
|
|
1286
1340
|
break;
|
|
1287
1341
|
}
|
|
1288
1342
|
|
|
@@ -1306,28 +1360,28 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1306
1360
|
};
|
|
1307
1361
|
promiseArray.push(myBucket.putObject(params).promise());
|
|
1308
1362
|
});
|
|
1309
|
-
|
|
1363
|
+
_context13.next = 19;
|
|
1310
1364
|
return Promise.all(promiseArray);
|
|
1311
1365
|
|
|
1312
1366
|
case 19:
|
|
1313
1367
|
setImagesUploaded(true);
|
|
1314
|
-
|
|
1368
|
+
_context13.next = 23;
|
|
1315
1369
|
break;
|
|
1316
1370
|
|
|
1317
1371
|
case 22:
|
|
1318
1372
|
setImagesUploaded(true);
|
|
1319
1373
|
|
|
1320
1374
|
case 23:
|
|
1321
|
-
|
|
1375
|
+
_context13.next = 28;
|
|
1322
1376
|
break;
|
|
1323
1377
|
|
|
1324
1378
|
case 25:
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
console.log(
|
|
1379
|
+
_context13.prev = 25;
|
|
1380
|
+
_context13.t0 = _context13["catch"](10);
|
|
1381
|
+
console.log(_context13.t0); // setMainLoading(false);
|
|
1328
1382
|
|
|
1329
1383
|
case 28:
|
|
1330
|
-
|
|
1384
|
+
_context13.next = 31;
|
|
1331
1385
|
break;
|
|
1332
1386
|
|
|
1333
1387
|
case 30:
|
|
@@ -1336,20 +1390,20 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1336
1390
|
|
|
1337
1391
|
case 31:
|
|
1338
1392
|
case "end":
|
|
1339
|
-
return
|
|
1393
|
+
return _context13.stop();
|
|
1340
1394
|
}
|
|
1341
1395
|
}
|
|
1342
|
-
},
|
|
1396
|
+
}, _callee13, null, [[10, 25]]);
|
|
1343
1397
|
})), [images, imagesUploaded]);
|
|
1344
|
-
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1398
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
1345
1399
|
var res, _product$article15, productTemp, _JSON$parse4, newStatus, newArticleStatus;
|
|
1346
1400
|
|
|
1347
|
-
return _regenerator.default.wrap(function
|
|
1401
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
1348
1402
|
while (1) {
|
|
1349
|
-
switch (
|
|
1403
|
+
switch (_context14.prev = _context14.next) {
|
|
1350
1404
|
case 0:
|
|
1351
1405
|
if (!imagesUploaded) {
|
|
1352
|
-
|
|
1406
|
+
_context14.next = 23;
|
|
1353
1407
|
break;
|
|
1354
1408
|
}
|
|
1355
1409
|
|
|
@@ -1361,8 +1415,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1361
1415
|
if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1362
1416
|
return e;
|
|
1363
1417
|
});
|
|
1364
|
-
|
|
1365
|
-
|
|
1418
|
+
_context14.prev = 2;
|
|
1419
|
+
_context14.next = 5;
|
|
1366
1420
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
|
|
1367
1421
|
headers: {
|
|
1368
1422
|
Authorization: token
|
|
@@ -1370,10 +1424,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1370
1424
|
});
|
|
1371
1425
|
|
|
1372
1426
|
case 5:
|
|
1373
|
-
res =
|
|
1427
|
+
res = _context14.sent;
|
|
1374
1428
|
|
|
1375
1429
|
if (!(res.data.statusCode === 200)) {
|
|
1376
|
-
|
|
1430
|
+
_context14.next = 18;
|
|
1377
1431
|
break;
|
|
1378
1432
|
}
|
|
1379
1433
|
|
|
@@ -1386,24 +1440,24 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1386
1440
|
setImages({});
|
|
1387
1441
|
setMessage("Imágenes guardadas con éxito");
|
|
1388
1442
|
sessionStorage.removeItem("imagesList");
|
|
1389
|
-
|
|
1443
|
+
_context14.next = 18;
|
|
1390
1444
|
return loadData();
|
|
1391
1445
|
|
|
1392
1446
|
case 18:
|
|
1393
|
-
|
|
1447
|
+
_context14.next = 23;
|
|
1394
1448
|
break;
|
|
1395
1449
|
|
|
1396
1450
|
case 20:
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
console.log(
|
|
1451
|
+
_context14.prev = 20;
|
|
1452
|
+
_context14.t0 = _context14["catch"](2);
|
|
1453
|
+
console.log(_context14.t0);
|
|
1400
1454
|
|
|
1401
1455
|
case 23:
|
|
1402
1456
|
case "end":
|
|
1403
|
-
return
|
|
1457
|
+
return _context14.stop();
|
|
1404
1458
|
}
|
|
1405
1459
|
}
|
|
1406
|
-
},
|
|
1460
|
+
}, _callee14, null, [[2, 20]]);
|
|
1407
1461
|
})), [dataImages, imagesUploaded]);
|
|
1408
1462
|
|
|
1409
1463
|
var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {
|
|
@@ -1489,8 +1543,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1489
1543
|
break;
|
|
1490
1544
|
}
|
|
1491
1545
|
|
|
1492
|
-
var services = servicesData.filter(function (
|
|
1493
|
-
var service =
|
|
1546
|
+
var services = servicesData.filter(function (_ref18) {
|
|
1547
|
+
var service = _ref18.service;
|
|
1494
1548
|
return concepts.includes(service);
|
|
1495
1549
|
});
|
|
1496
1550
|
var adminFacilitatorCanEvaluate = services.every(function (srv) {
|
|
@@ -1527,15 +1581,15 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1527
1581
|
};
|
|
1528
1582
|
|
|
1529
1583
|
var sendToFacilitator = /*#__PURE__*/function () {
|
|
1530
|
-
var
|
|
1584
|
+
var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
|
|
1531
1585
|
var concept, productTemp, evalStatus, articleId, orderId, data, res, _message, specialistDone, _JSON$parse5, newStatus, newOrderStatus, newArticleStatus, messageToChat, _data;
|
|
1532
1586
|
|
|
1533
|
-
return _regenerator.default.wrap(function
|
|
1587
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
1534
1588
|
while (1) {
|
|
1535
|
-
switch (
|
|
1589
|
+
switch (_context15.prev = _context15.next) {
|
|
1536
1590
|
case 0:
|
|
1537
1591
|
setLoading(true);
|
|
1538
|
-
|
|
1592
|
+
_context15.prev = 1;
|
|
1539
1593
|
concept = getConcept(activeTab);
|
|
1540
1594
|
productTemp = (0, _objectSpread2.default)({}, product);
|
|
1541
1595
|
evalStatus = retailerStatus;
|
|
@@ -1550,12 +1604,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1550
1604
|
};
|
|
1551
1605
|
|
|
1552
1606
|
if (!result) {
|
|
1553
|
-
|
|
1607
|
+
_context15.next = 16;
|
|
1554
1608
|
break;
|
|
1555
1609
|
}
|
|
1556
1610
|
|
|
1557
1611
|
data.result = result;
|
|
1558
|
-
|
|
1612
|
+
_context15.next = 12;
|
|
1559
1613
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1560
1614
|
headers: {
|
|
1561
1615
|
Authorization: token
|
|
@@ -1563,9 +1617,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1563
1617
|
});
|
|
1564
1618
|
|
|
1565
1619
|
case 12:
|
|
1566
|
-
res =
|
|
1620
|
+
res = _context15.sent;
|
|
1567
1621
|
getServices();
|
|
1568
|
-
|
|
1622
|
+
_context15.next = 21;
|
|
1569
1623
|
break;
|
|
1570
1624
|
|
|
1571
1625
|
case 16:
|
|
@@ -1579,7 +1633,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1579
1633
|
getSectionIcon();
|
|
1580
1634
|
}
|
|
1581
1635
|
|
|
1582
|
-
|
|
1636
|
+
_context15.next = 20;
|
|
1583
1637
|
return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1584
1638
|
headers: {
|
|
1585
1639
|
Authorization: token
|
|
@@ -1587,11 +1641,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1587
1641
|
});
|
|
1588
1642
|
|
|
1589
1643
|
case 20:
|
|
1590
|
-
res =
|
|
1644
|
+
res = _context15.sent;
|
|
1591
1645
|
|
|
1592
1646
|
case 21:
|
|
1593
1647
|
if (!(res.data.statusCode === 200)) {
|
|
1594
|
-
|
|
1648
|
+
_context15.next = 34;
|
|
1595
1649
|
break;
|
|
1596
1650
|
}
|
|
1597
1651
|
|
|
@@ -1612,13 +1666,13 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1612
1666
|
Authorization: token
|
|
1613
1667
|
}
|
|
1614
1668
|
};
|
|
1615
|
-
|
|
1669
|
+
_context15.next = 27;
|
|
1616
1670
|
return (0, _utils.sendMessage)(_data);
|
|
1617
1671
|
|
|
1618
1672
|
case 27:
|
|
1619
1673
|
if (newOrderStatus) productTemp.status = newArticleStatus[articleId];
|
|
1620
1674
|
productTemp["".concat(concept, "_status")] = newStatus;
|
|
1621
|
-
|
|
1675
|
+
_context15.next = 31;
|
|
1622
1676
|
return loadData();
|
|
1623
1677
|
|
|
1624
1678
|
case 31:
|
|
@@ -1627,27 +1681,27 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1627
1681
|
setProduct(productTemp);
|
|
1628
1682
|
|
|
1629
1683
|
case 34:
|
|
1630
|
-
|
|
1684
|
+
_context15.next = 39;
|
|
1631
1685
|
break;
|
|
1632
1686
|
|
|
1633
1687
|
case 36:
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
console.log(
|
|
1688
|
+
_context15.prev = 36;
|
|
1689
|
+
_context15.t0 = _context15["catch"](1);
|
|
1690
|
+
console.log(_context15.t0);
|
|
1637
1691
|
|
|
1638
1692
|
case 39:
|
|
1639
1693
|
setLoading(false);
|
|
1640
1694
|
|
|
1641
1695
|
case 40:
|
|
1642
1696
|
case "end":
|
|
1643
|
-
return
|
|
1697
|
+
return _context15.stop();
|
|
1644
1698
|
}
|
|
1645
1699
|
}
|
|
1646
|
-
},
|
|
1700
|
+
}, _callee15, null, [[1, 36]]);
|
|
1647
1701
|
}));
|
|
1648
1702
|
|
|
1649
|
-
return function sendToFacilitator(
|
|
1650
|
-
return
|
|
1703
|
+
return function sendToFacilitator(_x5) {
|
|
1704
|
+
return _ref19.apply(this, arguments);
|
|
1651
1705
|
};
|
|
1652
1706
|
}();
|
|
1653
1707
|
|
|
@@ -1678,17 +1732,17 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1678
1732
|
};
|
|
1679
1733
|
|
|
1680
1734
|
var createComment = /*#__PURE__*/function () {
|
|
1681
|
-
var
|
|
1735
|
+
var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
1682
1736
|
var messages,
|
|
1683
1737
|
retailerId,
|
|
1684
1738
|
data,
|
|
1685
|
-
|
|
1686
|
-
return _regenerator.default.wrap(function
|
|
1739
|
+
_args16 = arguments;
|
|
1740
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
1687
1741
|
while (1) {
|
|
1688
|
-
switch (
|
|
1742
|
+
switch (_context16.prev = _context16.next) {
|
|
1689
1743
|
case 0:
|
|
1690
|
-
messages =
|
|
1691
|
-
retailerId =
|
|
1744
|
+
messages = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : [];
|
|
1745
|
+
retailerId = _args16.length > 1 ? _args16[1] : undefined;
|
|
1692
1746
|
data = {
|
|
1693
1747
|
paramsBody: {
|
|
1694
1748
|
id: product.article.id_article,
|
|
@@ -1702,18 +1756,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1702
1756
|
}
|
|
1703
1757
|
};
|
|
1704
1758
|
setMessage("");
|
|
1705
|
-
return
|
|
1759
|
+
return _context16.abrupt("return", (0, _utils.sendMessage)(data));
|
|
1706
1760
|
|
|
1707
1761
|
case 5:
|
|
1708
1762
|
case "end":
|
|
1709
|
-
return
|
|
1763
|
+
return _context16.stop();
|
|
1710
1764
|
}
|
|
1711
1765
|
}
|
|
1712
|
-
},
|
|
1766
|
+
}, _callee16);
|
|
1713
1767
|
}));
|
|
1714
1768
|
|
|
1715
1769
|
return function createComment() {
|
|
1716
|
-
return
|
|
1770
|
+
return _ref20.apply(this, arguments);
|
|
1717
1771
|
};
|
|
1718
1772
|
}();
|
|
1719
1773
|
|
|
@@ -1791,16 +1845,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1791
1845
|
}, [activeTab]);
|
|
1792
1846
|
|
|
1793
1847
|
var commentRevised = /*#__PURE__*/function () {
|
|
1794
|
-
var
|
|
1848
|
+
var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
1795
1849
|
var data;
|
|
1796
|
-
return _regenerator.default.wrap(function
|
|
1850
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
1797
1851
|
while (1) {
|
|
1798
|
-
switch (
|
|
1852
|
+
switch (_context17.prev = _context17.next) {
|
|
1799
1853
|
case 0:
|
|
1800
1854
|
data = {
|
|
1801
1855
|
commentId: comment.id
|
|
1802
1856
|
};
|
|
1803
|
-
|
|
1857
|
+
_context17.next = 3;
|
|
1804
1858
|
return _axios.default.put("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1805
1859
|
headers: {
|
|
1806
1860
|
Authorization: sessionStorage.getItem("jwt")
|
|
@@ -1809,47 +1863,47 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1809
1863
|
|
|
1810
1864
|
case 3:
|
|
1811
1865
|
setCrossComment(false);
|
|
1812
|
-
|
|
1866
|
+
_context17.next = 6;
|
|
1813
1867
|
return getComments();
|
|
1814
1868
|
|
|
1815
1869
|
case 6:
|
|
1816
1870
|
case "end":
|
|
1817
|
-
return
|
|
1871
|
+
return _context17.stop();
|
|
1818
1872
|
}
|
|
1819
1873
|
}
|
|
1820
|
-
},
|
|
1874
|
+
}, _callee17);
|
|
1821
1875
|
}));
|
|
1822
1876
|
|
|
1823
1877
|
return function commentRevised() {
|
|
1824
|
-
return
|
|
1878
|
+
return _ref21.apply(this, arguments);
|
|
1825
1879
|
};
|
|
1826
1880
|
}();
|
|
1827
1881
|
|
|
1828
1882
|
var setAssignation = /*#__PURE__*/function () {
|
|
1829
|
-
var
|
|
1883
|
+
var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(assignationType, assignationId) {
|
|
1830
1884
|
var _product$article16;
|
|
1831
1885
|
|
|
1832
1886
|
var concept, productTemp, data;
|
|
1833
|
-
return _regenerator.default.wrap(function
|
|
1887
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
1834
1888
|
while (1) {
|
|
1835
|
-
switch (
|
|
1889
|
+
switch (_context18.prev = _context18.next) {
|
|
1836
1890
|
case 0:
|
|
1837
1891
|
concept = "";
|
|
1838
|
-
|
|
1839
|
-
|
|
1892
|
+
_context18.t0 = activeTab;
|
|
1893
|
+
_context18.next = _context18.t0 === "Ficha técnica" ? 4 : _context18.t0 === "Imágenes" ? 6 : 8;
|
|
1840
1894
|
break;
|
|
1841
1895
|
|
|
1842
1896
|
case 4:
|
|
1843
1897
|
concept = "datasheet";
|
|
1844
|
-
return
|
|
1898
|
+
return _context18.abrupt("break", 10);
|
|
1845
1899
|
|
|
1846
1900
|
case 6:
|
|
1847
1901
|
concept = "images";
|
|
1848
|
-
return
|
|
1902
|
+
return _context18.abrupt("break", 10);
|
|
1849
1903
|
|
|
1850
1904
|
case 8:
|
|
1851
1905
|
concept = "description";
|
|
1852
|
-
return
|
|
1906
|
+
return _context18.abrupt("break", 10);
|
|
1853
1907
|
|
|
1854
1908
|
case 10:
|
|
1855
1909
|
productTemp = product;
|
|
@@ -1862,7 +1916,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1862
1916
|
concept: concept,
|
|
1863
1917
|
userId: assignationId
|
|
1864
1918
|
};
|
|
1865
|
-
|
|
1919
|
+
_context18.next = 15;
|
|
1866
1920
|
return (0, _axios.default)({
|
|
1867
1921
|
method: "post",
|
|
1868
1922
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
@@ -1878,14 +1932,14 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1878
1932
|
|
|
1879
1933
|
case 17:
|
|
1880
1934
|
case "end":
|
|
1881
|
-
return
|
|
1935
|
+
return _context18.stop();
|
|
1882
1936
|
}
|
|
1883
1937
|
}
|
|
1884
|
-
},
|
|
1938
|
+
}, _callee18);
|
|
1885
1939
|
}));
|
|
1886
1940
|
|
|
1887
|
-
return function setAssignation(
|
|
1888
|
-
return
|
|
1941
|
+
return function setAssignation(_x6, _x7) {
|
|
1942
|
+
return _ref22.apply(this, arguments);
|
|
1889
1943
|
};
|
|
1890
1944
|
}();
|
|
1891
1945
|
|
|
@@ -1998,31 +2052,31 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1998
2052
|
}, [loading]);
|
|
1999
2053
|
|
|
2000
2054
|
var validateAll = /*#__PURE__*/function () {
|
|
2001
|
-
var
|
|
2055
|
+
var _ref23 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(result) {
|
|
2002
2056
|
var evaluationArray, conceptArray, messages, productTemp, messagesResponse;
|
|
2003
|
-
return _regenerator.default.wrap(function
|
|
2057
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
2004
2058
|
while (1) {
|
|
2005
|
-
switch (
|
|
2059
|
+
switch (_context19.prev = _context19.next) {
|
|
2006
2060
|
case 0:
|
|
2007
|
-
|
|
2061
|
+
_context19.prev = 0;
|
|
2008
2062
|
setLoading(true);
|
|
2009
2063
|
evaluationArray = [];
|
|
2010
2064
|
conceptArray = [];
|
|
2011
|
-
|
|
2012
|
-
|
|
2065
|
+
_context19.t0 = user.id_role;
|
|
2066
|
+
_context19.next = _context19.t0 === 4 ? 7 : _context19.t0 === 5 ? 9 : 11;
|
|
2013
2067
|
break;
|
|
2014
2068
|
|
|
2015
2069
|
case 7:
|
|
2016
2070
|
conceptArray = ["description", "datasheet"];
|
|
2017
|
-
return
|
|
2071
|
+
return _context19.abrupt("break", 13);
|
|
2018
2072
|
|
|
2019
2073
|
case 9:
|
|
2020
2074
|
conceptArray = ["images"];
|
|
2021
|
-
return
|
|
2075
|
+
return _context19.abrupt("break", 13);
|
|
2022
2076
|
|
|
2023
2077
|
case 11:
|
|
2024
2078
|
conceptArray = ["description", "datasheet", "images"];
|
|
2025
|
-
return
|
|
2079
|
+
return _context19.abrupt("break", 13);
|
|
2026
2080
|
|
|
2027
2081
|
case 13:
|
|
2028
2082
|
messages = [];
|
|
@@ -2045,7 +2099,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2045
2099
|
}));
|
|
2046
2100
|
}
|
|
2047
2101
|
});
|
|
2048
|
-
|
|
2102
|
+
_context19.next = 17;
|
|
2049
2103
|
return Promise.all(evaluationArray);
|
|
2050
2104
|
|
|
2051
2105
|
case 17:
|
|
@@ -2056,44 +2110,44 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2056
2110
|
productTemp.images_status = productTemp.images_status === "NS" ? "NS" : "".concat(result, "A");
|
|
2057
2111
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
2058
2112
|
setProduct(productTemp);
|
|
2059
|
-
|
|
2113
|
+
_context19.next = 26;
|
|
2060
2114
|
return Promise.all(messages);
|
|
2061
2115
|
|
|
2062
2116
|
case 26:
|
|
2063
|
-
messagesResponse =
|
|
2064
|
-
|
|
2117
|
+
messagesResponse = _context19.sent;
|
|
2118
|
+
_context19.next = 29;
|
|
2065
2119
|
return loadData();
|
|
2066
2120
|
|
|
2067
2121
|
case 29:
|
|
2068
|
-
|
|
2122
|
+
_context19.next = 34;
|
|
2069
2123
|
break;
|
|
2070
2124
|
|
|
2071
2125
|
case 31:
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
console.log(
|
|
2126
|
+
_context19.prev = 31;
|
|
2127
|
+
_context19.t1 = _context19["catch"](0);
|
|
2128
|
+
console.log(_context19.t1);
|
|
2075
2129
|
|
|
2076
2130
|
case 34:
|
|
2077
2131
|
case "end":
|
|
2078
|
-
return
|
|
2132
|
+
return _context19.stop();
|
|
2079
2133
|
}
|
|
2080
2134
|
}
|
|
2081
|
-
},
|
|
2135
|
+
}, _callee19, null, [[0, 31]]);
|
|
2082
2136
|
}));
|
|
2083
2137
|
|
|
2084
|
-
return function validateAll(
|
|
2085
|
-
return
|
|
2138
|
+
return function validateAll(_x8) {
|
|
2139
|
+
return _ref23.apply(this, arguments);
|
|
2086
2140
|
};
|
|
2087
2141
|
}();
|
|
2088
2142
|
|
|
2089
2143
|
var getObservation = /*#__PURE__*/function () {
|
|
2090
|
-
var
|
|
2144
|
+
var _ref24 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
2091
2145
|
var response, parseData;
|
|
2092
|
-
return _regenerator.default.wrap(function
|
|
2146
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
2093
2147
|
while (1) {
|
|
2094
|
-
switch (
|
|
2148
|
+
switch (_context20.prev = _context20.next) {
|
|
2095
2149
|
case 0:
|
|
2096
|
-
|
|
2150
|
+
_context20.next = 2;
|
|
2097
2151
|
return _axios.default.get("".concat(process.env.REACT_APP_READ_OBSERVATION, "?articleId=").concat(product.article.id_article, "&orderId=").concat(product === null || product === void 0 ? void 0 : product.orderId), {
|
|
2098
2152
|
headers: {
|
|
2099
2153
|
Authorization: sessionStorage.getItem("jwt")
|
|
@@ -2101,20 +2155,20 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2101
2155
|
});
|
|
2102
2156
|
|
|
2103
2157
|
case 2:
|
|
2104
|
-
response =
|
|
2158
|
+
response = _context20.sent;
|
|
2105
2159
|
parseData = JSON.parse(response.data.body).data[0];
|
|
2106
2160
|
setObservation(parseData.observations);
|
|
2107
2161
|
|
|
2108
2162
|
case 5:
|
|
2109
2163
|
case "end":
|
|
2110
|
-
return
|
|
2164
|
+
return _context20.stop();
|
|
2111
2165
|
}
|
|
2112
2166
|
}
|
|
2113
|
-
},
|
|
2167
|
+
}, _callee20);
|
|
2114
2168
|
}));
|
|
2115
2169
|
|
|
2116
2170
|
return function getObservation() {
|
|
2117
|
-
return
|
|
2171
|
+
return _ref24.apply(this, arguments);
|
|
2118
2172
|
};
|
|
2119
2173
|
}();
|
|
2120
2174
|
|
|
@@ -2344,18 +2398,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2344
2398
|
type: "pink",
|
|
2345
2399
|
label: "Aceptar",
|
|
2346
2400
|
size: 12,
|
|
2347
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2401
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
2348
2402
|
var body, messages;
|
|
2349
|
-
return _regenerator.default.wrap(function
|
|
2403
|
+
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
2350
2404
|
while (1) {
|
|
2351
|
-
switch (
|
|
2405
|
+
switch (_context21.prev = _context21.next) {
|
|
2352
2406
|
case 0:
|
|
2353
2407
|
body = document.querySelector("#modal-message-box .ql-container .ql-editor > p").innerHTML;
|
|
2354
2408
|
messages = [{
|
|
2355
2409
|
type: "message",
|
|
2356
2410
|
value: body === null || body === void 0 ? void 0 : body.replace(/<.*?\/?>/gm, "")
|
|
2357
2411
|
}];
|
|
2358
|
-
|
|
2412
|
+
_context21.next = 4;
|
|
2359
2413
|
return createComment(messages, activeRetailer.id);
|
|
2360
2414
|
|
|
2361
2415
|
case 4:
|
|
@@ -2365,12 +2419,26 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2365
2419
|
|
|
2366
2420
|
case 7:
|
|
2367
2421
|
case "end":
|
|
2368
|
-
return
|
|
2422
|
+
return _context21.stop();
|
|
2369
2423
|
}
|
|
2370
2424
|
}
|
|
2371
|
-
},
|
|
2425
|
+
}, _callee21);
|
|
2372
2426
|
}))
|
|
2373
2427
|
}, "btn-Aceptar")]
|
|
2428
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
|
|
2429
|
+
className: "container-modalAlert",
|
|
2430
|
+
show: modalAlert.show,
|
|
2431
|
+
title: modalAlert.title,
|
|
2432
|
+
message: modalAlert.message,
|
|
2433
|
+
icon: "info",
|
|
2434
|
+
onClickBtnDefault: function onClickBtnDefault(event) {
|
|
2435
|
+
setModalAlert(function (prev) {
|
|
2436
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, prev), {}, {
|
|
2437
|
+
show: false,
|
|
2438
|
+
errorInputMessage: false
|
|
2439
|
+
});
|
|
2440
|
+
});
|
|
2441
|
+
}
|
|
2374
2442
|
})]
|
|
2375
2443
|
});
|
|
2376
2444
|
};
|