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