contentoh-components-library 21.0.92 → 21.0.97
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 +31 -2
- package/dist/components/atoms/AsignationOption/styles.js +1 -1
- package/dist/components/atoms/InputFormatter/index.js +1 -1
- package/dist/components/atoms/StatusTag/styles.js +1 -1
- package/dist/components/molecules/RetailerSelector/index.js +5 -2
- package/dist/components/molecules/StatusAsignationInfo/index.js +1 -1
- package/dist/components/organisms/FullProductNameHeader/index.js +29 -2
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +44 -114
- package/dist/components/pages/ProviderProductEdition/index.js +75 -44
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +44 -44
- package/dist/components/pages/RetailerProductEdition/index.js +83 -45
- package/package.json +1 -1
- package/src/components/atoms/AsignationOption/index.js +21 -0
- package/src/components/atoms/AsignationOption/styles.js +6 -0
- package/src/components/atoms/InputFormatter/index.js +1 -1
- package/src/components/atoms/StatusTag/styles.js +2 -1
- package/src/components/molecules/RetailerSelector/index.js +3 -0
- package/src/components/molecules/StatusAsignationInfo/index.js +8 -6
- package/src/components/organisms/FullProductNameHeader/index.js +19 -1
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +48 -133
- package/src/components/pages/ProviderProductEdition/index.js +50 -23
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +44 -44
- package/src/components/pages/RetailerProductEdition/index.js +60 -19
|
@@ -41,66 +41,66 @@ RetailerProductEditionDefault.args = {
|
|
|
41
41
|
descriptions: 1,
|
|
42
42
|
images: 1
|
|
43
43
|
},
|
|
44
|
-
orderId:
|
|
45
|
-
status: "
|
|
46
|
-
datasheet_status:
|
|
44
|
+
orderId: 4,
|
|
45
|
+
status: "ASSIGNED",
|
|
46
|
+
datasheet_status: null,
|
|
47
47
|
prio: "none",
|
|
48
|
-
version:
|
|
49
|
-
description_status:
|
|
50
|
-
images_status:
|
|
48
|
+
version: 3,
|
|
49
|
+
description_status: null,
|
|
50
|
+
images_status: null,
|
|
51
51
|
article: {
|
|
52
|
-
id_article:
|
|
53
|
-
id_category: "
|
|
54
|
-
name: "
|
|
55
|
-
upc: "
|
|
56
|
-
timestamp: "2022-06-
|
|
57
|
-
id_user:
|
|
52
|
+
id_article: 33249,
|
|
53
|
+
id_category: "684",
|
|
54
|
+
name: "Crema dental ",
|
|
55
|
+
upc: "232435",
|
|
56
|
+
timestamp: "2022-06-14T14:52:51.000Z",
|
|
57
|
+
id_user: 28,
|
|
58
58
|
status: "NULL",
|
|
59
59
|
active: 1,
|
|
60
60
|
company_id: 1,
|
|
61
|
-
company_name: "
|
|
61
|
+
company_name: "COMPANY DEV",
|
|
62
62
|
country: "México",
|
|
63
|
-
id_order:
|
|
64
|
-
id_datasheet_especialist:
|
|
65
|
-
id_datasheet_facilitator:
|
|
66
|
-
id_description_especialist:
|
|
67
|
-
id_description_facilitator:
|
|
68
|
-
id_images_especialist:
|
|
69
|
-
id_images_facilitator:
|
|
70
|
-
id_auditor:
|
|
63
|
+
id_order: 4,
|
|
64
|
+
id_datasheet_especialist: null,
|
|
65
|
+
id_datasheet_facilitator: null,
|
|
66
|
+
id_description_especialist: null,
|
|
67
|
+
id_description_facilitator: null,
|
|
68
|
+
id_images_especialist: null,
|
|
69
|
+
id_images_facilitator: null,
|
|
70
|
+
id_auditor: 37,
|
|
71
71
|
id_recepcionist: null,
|
|
72
|
-
category: "
|
|
73
|
-
missingAttributes:
|
|
74
|
-
missingDescriptions:
|
|
75
|
-
missingImages:
|
|
72
|
+
category: "SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
|
|
73
|
+
missingAttributes: 13,
|
|
74
|
+
missingDescriptions: 4,
|
|
75
|
+
missingImages: 3
|
|
76
76
|
},
|
|
77
77
|
retailers: [{
|
|
78
|
-
id:
|
|
79
|
-
name: "
|
|
78
|
+
id: 4,
|
|
79
|
+
name: "Walmart Super y Superama",
|
|
80
80
|
country: "México",
|
|
81
81
|
id_region: 1,
|
|
82
82
|
active: 1
|
|
83
83
|
}, {
|
|
84
|
-
id:
|
|
85
|
-
name: "
|
|
84
|
+
id: 9,
|
|
85
|
+
name: "Amazon",
|
|
86
86
|
country: "México",
|
|
87
87
|
id_region: 1,
|
|
88
88
|
active: 1
|
|
89
89
|
}, {
|
|
90
|
-
id:
|
|
91
|
-
name: "
|
|
92
|
-
country: "
|
|
93
|
-
id_region:
|
|
90
|
+
id: 1013,
|
|
91
|
+
name: "Cencosud Colombia",
|
|
92
|
+
country: "Colombia",
|
|
93
|
+
id_region: 2,
|
|
94
94
|
active: 1
|
|
95
95
|
}, {
|
|
96
|
-
id:
|
|
97
|
-
name: "
|
|
98
|
-
country: "
|
|
99
|
-
id_region:
|
|
96
|
+
id: 2005,
|
|
97
|
+
name: "ClubCo",
|
|
98
|
+
country: "Costa Rica",
|
|
99
|
+
id_region: 3,
|
|
100
100
|
active: 1
|
|
101
101
|
}],
|
|
102
102
|
country: "México",
|
|
103
|
-
upc: "
|
|
103
|
+
upc: "232435"
|
|
104
104
|
},
|
|
105
105
|
location: {
|
|
106
106
|
product: {
|
|
@@ -109,22 +109,22 @@ RetailerProductEditionDefault.args = {
|
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
111
|
user: {
|
|
112
|
-
id_user:
|
|
113
|
-
name: "
|
|
112
|
+
id_user: 54,
|
|
113
|
+
name: "ESPECIALISTA TXTS PRUEBA",
|
|
114
114
|
last_name: "",
|
|
115
|
-
email: "
|
|
115
|
+
email: "rlegorreta@contentoh.com",
|
|
116
116
|
position: null,
|
|
117
117
|
telephone: null,
|
|
118
118
|
country: null,
|
|
119
119
|
id_company: 2,
|
|
120
|
-
id_cognito: "
|
|
120
|
+
id_cognito: "ca1d24ab-e992-4c19-b4e1-2fe6f720c16b",
|
|
121
121
|
birth_Date: null,
|
|
122
122
|
about_me: null,
|
|
123
123
|
zip_code: null,
|
|
124
124
|
address: null,
|
|
125
125
|
job: null,
|
|
126
126
|
id_stripe: null,
|
|
127
|
-
id_role:
|
|
127
|
+
id_role: 7,
|
|
128
128
|
active: 1,
|
|
129
129
|
is_retailer: 0,
|
|
130
130
|
membership: {
|
|
@@ -138,6 +138,6 @@ RetailerProductEditionDefault.args = {
|
|
|
138
138
|
products_limit: "3",
|
|
139
139
|
type: "PyMES"
|
|
140
140
|
},
|
|
141
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
141
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-54/54.png?1655433250522"
|
|
142
142
|
}
|
|
143
143
|
};
|
|
@@ -102,6 +102,14 @@ var reducerImages = function reducerImages(state, action) {
|
|
|
102
102
|
values: values
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
+
case "deleteImage":
|
|
106
|
+
values = values.filter(function (value) {
|
|
107
|
+
return action.selectedImages.indexOf(value) === -1;
|
|
108
|
+
});
|
|
109
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
110
|
+
values: values
|
|
111
|
+
});
|
|
112
|
+
|
|
105
113
|
default:
|
|
106
114
|
return state;
|
|
107
115
|
}
|
|
@@ -356,6 +364,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
356
364
|
socketType = _useState66[0],
|
|
357
365
|
setSocketType = _useState66[1];
|
|
358
366
|
|
|
367
|
+
var _useState67 = (0, _react.useState)([]),
|
|
368
|
+
_useState68 = (0, _slicedToArray2.default)(_useState67, 2),
|
|
369
|
+
servicesStatus = _useState68[0],
|
|
370
|
+
setServicesStatus = _useState68[1];
|
|
371
|
+
|
|
372
|
+
var _useState69 = (0, _react.useState)(loading),
|
|
373
|
+
_useState70 = (0, _slicedToArray2.default)(_useState69, 2),
|
|
374
|
+
saving = _useState70[0],
|
|
375
|
+
setSaving = _useState70[1];
|
|
376
|
+
|
|
359
377
|
(0, _react.useEffect)(function () {
|
|
360
378
|
checkAll && setSelectedImages(images.values);
|
|
361
379
|
}, [checkAll]);
|
|
@@ -375,14 +393,14 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
375
393
|
case 2:
|
|
376
394
|
services = _context.sent;
|
|
377
395
|
//Converts the data inside the datasheets object to array
|
|
378
|
-
setServices(services);
|
|
396
|
+
setServices(services);
|
|
397
|
+
getServices(); //setActiveRetailer(product?.retailers[0]);
|
|
379
398
|
|
|
380
399
|
setImages({
|
|
381
400
|
action: "init",
|
|
382
|
-
init:
|
|
401
|
+
init: services[2]
|
|
383
402
|
});
|
|
384
403
|
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);
|
|
385
|
-
setActiveRetailer(product.retailers ? product.retailers[0] : product.retailersAvailable[0]);
|
|
386
404
|
(0, _data2.getPercentage)({
|
|
387
405
|
data: [product]
|
|
388
406
|
}).then(function (res) {
|
|
@@ -497,7 +515,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
497
515
|
// setPercentages(res)
|
|
498
516
|
// );
|
|
499
517
|
|
|
500
|
-
|
|
518
|
+
setActiveRetailer(product.retailers ? product.retailers[0] : product.retailersAvailable[0]);
|
|
501
519
|
getComments();
|
|
502
520
|
_context4.t0 = setUserGroups;
|
|
503
521
|
_context4.next = 6;
|
|
@@ -832,18 +850,19 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
832
850
|
}
|
|
833
851
|
|
|
834
852
|
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
835
|
-
_context7.next =
|
|
853
|
+
_context7.next = 31;
|
|
836
854
|
break;
|
|
837
855
|
}
|
|
838
856
|
|
|
839
|
-
|
|
857
|
+
setLoading(true);
|
|
858
|
+
_context7.prev = 11;
|
|
840
859
|
data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
|
|
841
860
|
e.uuid = (0, _uuid.v4)();
|
|
842
861
|
});
|
|
843
862
|
setDataImages(data);
|
|
844
863
|
|
|
845
864
|
if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
|
|
846
|
-
_context7.next =
|
|
865
|
+
_context7.next = 23;
|
|
847
866
|
break;
|
|
848
867
|
}
|
|
849
868
|
|
|
@@ -859,40 +878,40 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
859
878
|
};
|
|
860
879
|
promiseArray.push(myBucket.putObject(params).promise());
|
|
861
880
|
});
|
|
862
|
-
_context7.next =
|
|
881
|
+
_context7.next = 20;
|
|
863
882
|
return Promise.all(promiseArray);
|
|
864
883
|
|
|
865
|
-
case
|
|
884
|
+
case 20:
|
|
866
885
|
setImagesUploaded(true);
|
|
867
|
-
_context7.next =
|
|
886
|
+
_context7.next = 24;
|
|
868
887
|
break;
|
|
869
888
|
|
|
870
|
-
case
|
|
889
|
+
case 23:
|
|
871
890
|
setImagesUploaded(true);
|
|
872
891
|
|
|
873
|
-
case
|
|
874
|
-
_context7.next =
|
|
892
|
+
case 24:
|
|
893
|
+
_context7.next = 29;
|
|
875
894
|
break;
|
|
876
895
|
|
|
877
|
-
case
|
|
878
|
-
_context7.prev =
|
|
879
|
-
_context7.t0 = _context7["catch"](
|
|
896
|
+
case 26:
|
|
897
|
+
_context7.prev = 26;
|
|
898
|
+
_context7.t0 = _context7["catch"](11);
|
|
880
899
|
console.log(_context7.t0); // setMainLoading(false);
|
|
881
900
|
|
|
882
|
-
case
|
|
883
|
-
_context7.next =
|
|
901
|
+
case 29:
|
|
902
|
+
_context7.next = 32;
|
|
884
903
|
break;
|
|
885
904
|
|
|
886
|
-
case
|
|
905
|
+
case 31:
|
|
887
906
|
// setMainLoading(false);
|
|
888
907
|
setMessage("Completa los campos que solicita cada una de la imágenes o hay imágenes con el mismo tipo de toma.\nRecuerda hay campos obligatorios y no podras avanzar si no estan completos.");
|
|
889
908
|
|
|
890
|
-
case
|
|
909
|
+
case 32:
|
|
891
910
|
case "end":
|
|
892
911
|
return _context7.stop();
|
|
893
912
|
}
|
|
894
913
|
}
|
|
895
|
-
}, _callee7, null, [[
|
|
914
|
+
}, _callee7, null, [[11, 26]]);
|
|
896
915
|
})), [images, imagesUploaded]);
|
|
897
916
|
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
898
917
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
@@ -900,11 +919,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
900
919
|
switch (_context8.prev = _context8.next) {
|
|
901
920
|
case 0:
|
|
902
921
|
if (!imagesUploaded) {
|
|
903
|
-
_context8.next =
|
|
922
|
+
_context8.next = 13;
|
|
904
923
|
break;
|
|
905
924
|
}
|
|
906
925
|
|
|
907
|
-
setLoading(true);
|
|
908
926
|
dataImages.articleData = dataImages === null || dataImages === void 0 ? void 0 : dataImages.articleData.map(function (e) {
|
|
909
927
|
delete e.src;
|
|
910
928
|
e.imageID = e.image_id;
|
|
@@ -913,32 +931,32 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
913
931
|
if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
914
932
|
return e;
|
|
915
933
|
});
|
|
916
|
-
_context8.prev =
|
|
917
|
-
_context8.next =
|
|
934
|
+
_context8.prev = 2;
|
|
935
|
+
_context8.next = 5;
|
|
918
936
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
|
|
919
937
|
headers: {
|
|
920
938
|
Authorization: token
|
|
921
939
|
}
|
|
922
940
|
});
|
|
923
941
|
|
|
924
|
-
case
|
|
942
|
+
case 5:
|
|
925
943
|
setMessage("Imágenes guardadas con éxito");
|
|
926
944
|
sessionStorage.removeItem("imagesList");
|
|
927
945
|
loadData();
|
|
928
|
-
_context8.next =
|
|
946
|
+
_context8.next = 13;
|
|
929
947
|
break;
|
|
930
948
|
|
|
931
|
-
case
|
|
932
|
-
_context8.prev =
|
|
933
|
-
_context8.t0 = _context8["catch"](
|
|
949
|
+
case 10:
|
|
950
|
+
_context8.prev = 10;
|
|
951
|
+
_context8.t0 = _context8["catch"](2);
|
|
934
952
|
console.log(_context8.t0);
|
|
935
953
|
|
|
936
|
-
case
|
|
954
|
+
case 13:
|
|
937
955
|
case "end":
|
|
938
956
|
return _context8.stop();
|
|
939
957
|
}
|
|
940
958
|
}
|
|
941
|
-
}, _callee8, null, [[
|
|
959
|
+
}, _callee8, null, [[2, 10]]);
|
|
942
960
|
})), [dataImages, imagesUploaded]);
|
|
943
961
|
|
|
944
962
|
var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {
|
|
@@ -1234,7 +1252,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1234
1252
|
}();
|
|
1235
1253
|
|
|
1236
1254
|
var getRequired = function getRequired(services) {
|
|
1237
|
-
var _services$4, _services$4$inputs;
|
|
1255
|
+
var _services$4, _services$4$retailerM, _services$5, _services$5$inputs;
|
|
1238
1256
|
|
|
1239
1257
|
var objetcTemp = {};
|
|
1240
1258
|
var datasheetServicesArray = Object.values(services[0]);
|
|
@@ -1268,8 +1286,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1268
1286
|
});
|
|
1269
1287
|
});
|
|
1270
1288
|
objetcTemp["Descripción"] = desInputsRequired;
|
|
1271
|
-
var
|
|
1272
|
-
|
|
1289
|
+
var retailersRequested = [];
|
|
1290
|
+
(_services$4 = services[2]) === null || _services$4 === void 0 ? void 0 : (_services$4$retailerM = _services$4.retailerMandatories) === null || _services$4$retailerM === void 0 ? void 0 : _services$4$retailerM.forEach(function (retMan) {
|
|
1291
|
+
return retMan.forEach(function (rm) {
|
|
1292
|
+
return retailersRequested.push(rm);
|
|
1293
|
+
});
|
|
1294
|
+
});
|
|
1295
|
+
var requiredImages = (_services$5 = services[2]) === null || _services$5 === void 0 ? void 0 : (_services$5$inputs = _services$5.inputs) === null || _services$5$inputs === void 0 ? void 0 : _services$5$inputs.filter(function (e) {
|
|
1296
|
+
return e.required === 1 && retailersRequested.filter(function (ret) {
|
|
1297
|
+
return ret.id_image === e.id && servicesData.filter(function (srv) {
|
|
1298
|
+
return srv.id_retailer === ret.id_retailer;
|
|
1299
|
+
}).length > 0;
|
|
1300
|
+
}).length > 0;
|
|
1273
1301
|
});
|
|
1274
1302
|
var requiredCounter = 0;
|
|
1275
1303
|
requiredImages === null || requiredImages === void 0 ? void 0 : requiredImages.forEach(function (req) {
|
|
@@ -1444,7 +1472,6 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1444
1472
|
|
|
1445
1473
|
var deleteImages = function deleteImages() {
|
|
1446
1474
|
setLoading(true);
|
|
1447
|
-
var imagesTemp = images;
|
|
1448
1475
|
var values = images.values;
|
|
1449
1476
|
var imgsInBack = [];
|
|
1450
1477
|
selectedImages.forEach(function (selectedImg) {
|
|
@@ -1453,12 +1480,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1453
1480
|
var imgsLeft = values.filter(function (value) {
|
|
1454
1481
|
return selectedImages.indexOf(value) === -1;
|
|
1455
1482
|
});
|
|
1456
|
-
imagesTemp.values = imgsLeft;
|
|
1457
1483
|
|
|
1458
1484
|
if (imgsInBack.length > 0) {
|
|
1459
1485
|
var data = {
|
|
1460
1486
|
articleId: product.article.id_article,
|
|
1461
|
-
deleteImages:
|
|
1487
|
+
deleteImages: imgsInBack
|
|
1462
1488
|
};
|
|
1463
1489
|
|
|
1464
1490
|
try {
|
|
@@ -1472,8 +1498,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1472
1498
|
}
|
|
1473
1499
|
}
|
|
1474
1500
|
|
|
1475
|
-
|
|
1476
|
-
|
|
1501
|
+
setImages({
|
|
1502
|
+
action: "deleteImage",
|
|
1503
|
+
selectedImages: selectedImages
|
|
1504
|
+
});
|
|
1505
|
+
getRequired([services[0], services[1], (0, _objectSpread2.default)((0, _objectSpread2.default)({}, services[2]), {}, {
|
|
1506
|
+
values: imgsLeft
|
|
1507
|
+
})]);
|
|
1508
|
+
setTimeout(function () {
|
|
1509
|
+
setLoading(false);
|
|
1510
|
+
}, 500);
|
|
1477
1511
|
setMessage("");
|
|
1478
1512
|
setComponentsArray([]);
|
|
1479
1513
|
};
|
|
@@ -1534,7 +1568,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1534
1568
|
var _arr$filter2 = (0, _slicedToArray2.default)(_arr$filter, 1);
|
|
1535
1569
|
|
|
1536
1570
|
retailerService = _arr$filter2[0];
|
|
1537
|
-
return retailerService ? retailerService.status : "
|
|
1571
|
+
return retailerService ? retailerService.status : "NS";
|
|
1538
1572
|
};
|
|
1539
1573
|
|
|
1540
1574
|
(0, _react.useEffect)(function () {
|
|
@@ -1544,6 +1578,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1544
1578
|
(0, _react.useEffect)(function () {
|
|
1545
1579
|
services.length > 0 && getRequired(services);
|
|
1546
1580
|
}, [services, servicesData, activeTab]);
|
|
1581
|
+
(0, _react.useEffect)(function () {
|
|
1582
|
+
setSaving(loading);
|
|
1583
|
+
}, [loading]);
|
|
1547
1584
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
1548
1585
|
headerTop: headerTop,
|
|
1549
1586
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
@@ -1578,6 +1615,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1578
1615
|
headerData: product,
|
|
1579
1616
|
percent: activePercentage,
|
|
1580
1617
|
activeRetailer: activeRetailer,
|
|
1618
|
+
servicesData: servicesData,
|
|
1581
1619
|
setActiveRetailer: setActiveRetailer,
|
|
1582
1620
|
sendToFacilitator: sendToFacilitator,
|
|
1583
1621
|
approve: function approve() {
|
|
@@ -1598,19 +1636,19 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1598
1636
|
assig: assig[activeTab],
|
|
1599
1637
|
setAssignation: setAssignation,
|
|
1600
1638
|
isRetailer: isRetailer,
|
|
1601
|
-
showSaveButton:
|
|
1639
|
+
showSaveButton: userAssigned(),
|
|
1602
1640
|
onClickSave: function onClickSave() {
|
|
1603
1641
|
switch (activeTab) {
|
|
1604
1642
|
case "Descripción":
|
|
1605
|
-
(product === null || product === void 0 ? void 0 : product.description_status) !== "NS" && saveDescriptions();
|
|
1643
|
+
!saving && (product === null || product === void 0 ? void 0 : product.description_status) !== "NS" && saveDescriptions();
|
|
1606
1644
|
break;
|
|
1607
1645
|
|
|
1608
1646
|
case "Ficha técnica":
|
|
1609
|
-
(product === null || product === void 0 ? void 0 : product.datasheet_status) !== "NS" && saveDatasheets();
|
|
1647
|
+
!saving && (product === null || product === void 0 ? void 0 : product.datasheet_status) !== "NS" && saveDatasheets();
|
|
1610
1648
|
break;
|
|
1611
1649
|
|
|
1612
1650
|
case "Imágenes":
|
|
1613
|
-
(product === null || product === void 0 ? void 0 : product.images_status) !== "NS" && updateImages();
|
|
1651
|
+
!saving && (product === null || product === void 0 ? void 0 : product.images_status) !== "NS" && updateImages();
|
|
1614
1652
|
break;
|
|
1615
1653
|
|
|
1616
1654
|
default:
|
package/package.json
CHANGED
|
@@ -5,6 +5,8 @@ import removeAsigned from "../../../assets/images/asignationOptions/removeAsigne
|
|
|
5
5
|
import requesToProvider from "../../../assets/images/asignationOptions/requestToProvider.svg";
|
|
6
6
|
import requestToTeam from "../../../assets/images/asignationOptions/requestToTeam.svg";
|
|
7
7
|
import availableIcon from "../../../assets/images/asignationOptions/availableIcon.svg";
|
|
8
|
+
import { getNewStatus } from "../../../global-files/data";
|
|
9
|
+
import { StatusTag } from "../StatusTag";
|
|
8
10
|
|
|
9
11
|
export const AsignationOption = ({
|
|
10
12
|
profileImage,
|
|
@@ -15,7 +17,21 @@ export const AsignationOption = ({
|
|
|
15
17
|
onClick,
|
|
16
18
|
btnOnClick,
|
|
17
19
|
active,
|
|
20
|
+
services,
|
|
18
21
|
}) => {
|
|
22
|
+
const getStatus = () => {
|
|
23
|
+
let servCad = "";
|
|
24
|
+
services.forEach((srv) => (servCad += srv));
|
|
25
|
+
switch (servCad) {
|
|
26
|
+
case "NANANA":
|
|
27
|
+
return "NA";
|
|
28
|
+
case "RECEIVEDRECEIVEDRECEIVED":
|
|
29
|
+
return "RECEIVED";
|
|
30
|
+
default:
|
|
31
|
+
return getNewStatus(services);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
19
35
|
const iconsAsignation = {
|
|
20
36
|
assigned: (
|
|
21
37
|
<button onClick={btnOnClick}>
|
|
@@ -39,6 +55,11 @@ export const AsignationOption = ({
|
|
|
39
55
|
<p className="team-label">{team}</p>
|
|
40
56
|
</div>
|
|
41
57
|
{asignationType && iconsAsignation[asignationType]}
|
|
58
|
+
{services && (
|
|
59
|
+
<div className="status-container">
|
|
60
|
+
<StatusTag statusType={getStatus()} />
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
42
63
|
{active && <div className="green-circle"></div>}
|
|
43
64
|
</Container>
|
|
44
65
|
);
|
|
@@ -60,7 +60,7 @@ export const InputFormatter = ({
|
|
|
60
60
|
value = valueFormater(value);
|
|
61
61
|
|
|
62
62
|
let idInput = inputId;
|
|
63
|
-
let dataSave = updatedDescriptions
|
|
63
|
+
let dataSave = updatedDescriptions?.slice();
|
|
64
64
|
if (dataSave.length > 0) {
|
|
65
65
|
if (dataSave.filter((e) => e.attributeId === idInput).length > 0) {
|
|
66
66
|
dataSave.forEach((e) => {
|
|
@@ -8,6 +8,7 @@ export const RetailerSelector = ({
|
|
|
8
8
|
retailers,
|
|
9
9
|
activeRetailer,
|
|
10
10
|
setActiveRetailer,
|
|
11
|
+
showStatus,
|
|
11
12
|
}) => {
|
|
12
13
|
const [retailersPanel, setRetailersPanel] = useState(false);
|
|
13
14
|
|
|
@@ -47,6 +48,7 @@ export const RetailerSelector = ({
|
|
|
47
48
|
asignationType={null}
|
|
48
49
|
name={retailer?.name}
|
|
49
50
|
team={retailer?.team}
|
|
51
|
+
services={retailer?.services}
|
|
50
52
|
onClick={() => {
|
|
51
53
|
setActiveRetailer(retailer);
|
|
52
54
|
document.removeEventListener(
|
|
@@ -57,6 +59,7 @@ export const RetailerSelector = ({
|
|
|
57
59
|
setRetailersPanel(false);
|
|
58
60
|
}}
|
|
59
61
|
active={retailer.id === activeRetailer.id}
|
|
62
|
+
showStatus={showStatus}
|
|
60
63
|
/>
|
|
61
64
|
))}
|
|
62
65
|
</div>
|
|
@@ -49,12 +49,14 @@ export const StatusAsignationInfo = ({
|
|
|
49
49
|
)}
|
|
50
50
|
{imagesSection && (
|
|
51
51
|
<div className="images-buttons">
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
{showSaveButton && (
|
|
53
|
+
<Button
|
|
54
|
+
buttonType={"circular-button delete-button"}
|
|
55
|
+
onClick={() => {
|
|
56
|
+
askToDeleteImages && askToDeleteImages();
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
)}
|
|
58
60
|
<Button
|
|
59
61
|
buttonType={"circular-button download-button"}
|
|
60
62
|
onClick={() => {
|
|
@@ -2,6 +2,8 @@ import { Container } from "./styles";
|
|
|
2
2
|
import { ProductNameHeader } from "../../molecules/ProductNameHeader";
|
|
3
3
|
import { FeaturesBar } from "../../molecules/FeaturesBar";
|
|
4
4
|
import { AvatarAndValidation } from "../../molecules/AvatarAndValidation";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { useEffect } from "react";
|
|
5
7
|
|
|
6
8
|
export const FullProductNameHeader = ({
|
|
7
9
|
headerData,
|
|
@@ -11,7 +13,23 @@ export const FullProductNameHeader = ({
|
|
|
11
13
|
showValidationButtons,
|
|
12
14
|
approve,
|
|
13
15
|
reject,
|
|
16
|
+
servicesData,
|
|
14
17
|
}) => {
|
|
18
|
+
const [retailers, setRetailers] = useState([]);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const rtls = headerData?.retailers || headerData?.retailersAvailable;
|
|
21
|
+
servicesData &&
|
|
22
|
+
rtls.forEach((rt) => {
|
|
23
|
+
const element = [];
|
|
24
|
+
servicesData.forEach((sd) => {
|
|
25
|
+
if (sd.id_retailer === rt.id) {
|
|
26
|
+
element.push(sd.status ? sd.status : "RECEIVED");
|
|
27
|
+
} else element.push("NA");
|
|
28
|
+
rt["services"] = element;
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
setRetailers(rtls);
|
|
32
|
+
}, [servicesData]);
|
|
15
33
|
return (
|
|
16
34
|
<Container>
|
|
17
35
|
<ProductNameHeader
|
|
@@ -41,7 +59,7 @@ export const FullProductNameHeader = ({
|
|
|
41
59
|
]}
|
|
42
60
|
/>
|
|
43
61
|
<AvatarAndValidation
|
|
44
|
-
retailers={
|
|
62
|
+
retailers={retailers}
|
|
45
63
|
avatarData={headerData?.avatarData}
|
|
46
64
|
validation={headerData?.validation}
|
|
47
65
|
activeRetailer={activeRetailer}
|