contentoh-components-library 21.1.19 → 21.1.22
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/pages/ProviderProductEdition/ProviderProductEdition.stories.js +83 -108
- package/dist/components/pages/ProviderProductEdition/index.js +47 -67
- package/dist/components/pages/RetailerProductEdition/index.js +16 -11
- package/package.json +1 -1
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +84 -121
- package/src/components/pages/ProviderProductEdition/index.js +35 -45
- package/src/components/pages/RetailerProductEdition/index.js +17 -9
|
@@ -31,108 +31,83 @@ ProviderProductEditionDefault.args = {
|
|
|
31
31
|
"Ficha técnica": false,
|
|
32
32
|
Imágenes: false
|
|
33
33
|
},
|
|
34
|
-
token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.
|
|
34
|
+
token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiI3ZTU5YmI1Yy1mNjI1LTQ1NzMtYjMzYS00ZWM4YzFmMzMyNTIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY1NjAwMTY4OCwibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NTYwMDUyODgsImlhdCI6MTY1NjAwMTY4OCwiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.ZUKMejBG8qCT2bv-zrqyFx6xyeKK85Ry-kRlQv3U2KrDasW6ea8zbNDJMJAGMu_7dDrk9mRUj0Mp-jW32T1IBOweWxivRKSYfWQzjMdJdOUcckCagVXp8zQ4W-DZJINI25iq1AEfl9--6WaTRybEdTLjKXgzzOmLCGk5QbUI2uSeT_3w7fZiHPlCDCFFTSgXaNKUqxnsyZ2llos97KKIhH7tmn7DBw8mTPTUFyxED6EzBc7mkCYrM1o0velAZF0bOYhiuNnA-TF0L8eqPIZ3_13WDzGjRk3_eOBM37z8AqlMtBCJYIyQFGf-uCIbpSG0yJzYTswrExCkLamlKDhwtQ",
|
|
35
35
|
articleId: 238,
|
|
36
36
|
category: 846,
|
|
37
37
|
version: 2,
|
|
38
38
|
productSelected: {
|
|
39
|
+
id_article: 55081,
|
|
40
|
+
id_category: "157",
|
|
41
|
+
name: "Lavatrastes Axion toque de crema",
|
|
42
|
+
upc: "750954665375",
|
|
43
|
+
timestamp: "2022-06-17T18:43:45.000Z",
|
|
44
|
+
status: "NULL",
|
|
45
|
+
categoryName: "CONSUMIBLES|PRODUCTOS DE LIMPIEZA Y LAVANDERÍA|JABONES Y LAVATRASTES",
|
|
46
|
+
asignations: [],
|
|
39
47
|
version: 1,
|
|
40
|
-
|
|
41
|
-
missing: {
|
|
42
|
-
datasheet: null,
|
|
43
|
-
descriptions: null,
|
|
44
|
-
images: null
|
|
45
|
-
},
|
|
46
|
-
article: {
|
|
47
|
-
category: "MATERIALES DE CONSTRUCCIÓN|BÁSICOS DE CONSTRUCCIÓN|ADOQUINES",
|
|
48
|
-
company_name: "TABICEL DEL CENTRO",
|
|
49
|
-
company_id: 529,
|
|
50
|
-
id_category: "2578",
|
|
51
|
-
id_article: 24,
|
|
52
|
-
name: "ADOQUIN ROJO 20X 40 X 6",
|
|
53
|
-
upc: "85369"
|
|
54
|
-
},
|
|
55
|
-
asignations: [62],
|
|
56
|
-
retailers: [{
|
|
57
|
-
id: 58,
|
|
58
|
-
name: "The Home Depot Golden",
|
|
59
|
-
country: "México",
|
|
60
|
-
id_region: 1,
|
|
61
|
-
active: 1
|
|
62
|
-
}],
|
|
48
|
+
version_status: null,
|
|
63
49
|
retailersAvailable: [{
|
|
64
|
-
id:
|
|
65
|
-
name: "
|
|
50
|
+
id: 4,
|
|
51
|
+
name: "Walmart Super y Superama",
|
|
66
52
|
country: "México",
|
|
67
53
|
id_region: 1,
|
|
68
54
|
active: 1
|
|
69
55
|
}],
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
id_article: 24,
|
|
75
|
-
services: [{
|
|
76
|
-
id_article: 24,
|
|
77
|
-
service: "datasheet",
|
|
78
|
-
quantity: 1,
|
|
79
|
-
price: 0,
|
|
80
|
-
id_user: 59,
|
|
81
|
-
datasheet_common: null,
|
|
82
|
-
discount: null
|
|
83
|
-
}]
|
|
84
|
-
},
|
|
85
|
-
productToEdit: {
|
|
86
|
-
ArticleId: 24,
|
|
87
|
-
idCategory: "2578",
|
|
88
|
-
product: {
|
|
89
|
-
version: 1,
|
|
90
|
-
brand: null,
|
|
91
|
-
missing: {
|
|
92
|
-
datasheet: null,
|
|
93
|
-
descriptions: null,
|
|
94
|
-
images: null
|
|
95
|
-
},
|
|
96
|
-
article: {
|
|
97
|
-
category: "MATERIALES DE CONSTRUCCIÓN|BÁSICOS DE CONSTRUCCIÓN|ADOQUINES",
|
|
98
|
-
company_name: "TABICEL DEL CENTRO",
|
|
99
|
-
company_id: 529,
|
|
100
|
-
id_category: "2578",
|
|
101
|
-
id_article: 24,
|
|
102
|
-
name: "ADOQUIN ROJO 20X 40 X 6",
|
|
103
|
-
upc: "85369"
|
|
104
|
-
},
|
|
105
|
-
asignations: [62],
|
|
106
|
-
retailers: [{
|
|
107
|
-
id: 58,
|
|
108
|
-
name: "The Home Depot Golden",
|
|
109
|
-
country: "México",
|
|
110
|
-
id_region: 1,
|
|
111
|
-
active: 1
|
|
112
|
-
}],
|
|
113
|
-
retailersAvailable: [{
|
|
114
|
-
id: 58,
|
|
115
|
-
name: "The Home Depot Golden",
|
|
116
|
-
country: "México",
|
|
117
|
-
id_region: 1,
|
|
118
|
-
active: 1
|
|
119
|
-
}],
|
|
120
|
-
upc: "85369",
|
|
121
|
-
name: "ADOQUIN ROJO 20X 40 X 6",
|
|
122
|
-
categoryName: "MATERIALES DE CONSTRUCCIÓN|BÁSICOS DE CONSTRUCCIÓN|ADOQUINES",
|
|
123
|
-
id_category: "2578",
|
|
124
|
-
id_article: 24,
|
|
125
|
-
services: [{
|
|
126
|
-
id_article: 24,
|
|
127
|
-
service: "datasheet",
|
|
128
|
-
quantity: 1,
|
|
129
|
-
price: 0,
|
|
130
|
-
id_user: 59,
|
|
131
|
-
datasheet_common: null,
|
|
132
|
-
discount: null
|
|
133
|
-
}]
|
|
56
|
+
missing: {
|
|
57
|
+
datasheet: 10,
|
|
58
|
+
description: 6,
|
|
59
|
+
image: 32
|
|
134
60
|
}
|
|
135
61
|
},
|
|
62
|
+
// productToEdit: {
|
|
63
|
+
// idCategory: "2976",
|
|
64
|
+
// ArticleId: 55070,
|
|
65
|
+
// product: [
|
|
66
|
+
// {
|
|
67
|
+
// id_article: 55070,
|
|
68
|
+
// id_category: "2976",
|
|
69
|
+
// name: "TOALLERO CORTO ACCESS NEGRO ÉBANO",
|
|
70
|
+
// upc: "161788",
|
|
71
|
+
// timestamp: "2022-06-17T17:31:14.000Z",
|
|
72
|
+
// status: "NULL",
|
|
73
|
+
// categoryName: "BAÑOS|ACCESORIOS PARA BAÑO|TOALLEROS",
|
|
74
|
+
// asignations: [],
|
|
75
|
+
// version: 1,
|
|
76
|
+
// version_status: null,
|
|
77
|
+
// retailersAvailable: [
|
|
78
|
+
// {
|
|
79
|
+
// id: 58,
|
|
80
|
+
// name: "The Home Depot Golden",
|
|
81
|
+
// country: "México",
|
|
82
|
+
// id_region: 1,
|
|
83
|
+
// active: 1,
|
|
84
|
+
// },
|
|
85
|
+
// {
|
|
86
|
+
// id: 59,
|
|
87
|
+
// name: "The Home Depot Platinum",
|
|
88
|
+
// country: "México",
|
|
89
|
+
// id_region: 1,
|
|
90
|
+
// active: 1,
|
|
91
|
+
// },
|
|
92
|
+
// {
|
|
93
|
+
// id: 60,
|
|
94
|
+
// name: "The Home Depot Resizing",
|
|
95
|
+
// country: "México",
|
|
96
|
+
// id_region: 1,
|
|
97
|
+
// active: 1,
|
|
98
|
+
// },
|
|
99
|
+
// {
|
|
100
|
+
// id: 61,
|
|
101
|
+
// name: "Home Depot TAB",
|
|
102
|
+
// country: "México",
|
|
103
|
+
// id_region: 1,
|
|
104
|
+
// active: 1,
|
|
105
|
+
// },
|
|
106
|
+
// ],
|
|
107
|
+
// missing: {},
|
|
108
|
+
// },
|
|
109
|
+
// ],
|
|
110
|
+
// },
|
|
136
111
|
location: {
|
|
137
112
|
product: {
|
|
138
113
|
articleId: 109485,
|
|
@@ -141,35 +116,35 @@ ProviderProductEditionDefault.args = {
|
|
|
141
116
|
state: {}
|
|
142
117
|
},
|
|
143
118
|
user: {
|
|
144
|
-
id_user:
|
|
145
|
-
name: "
|
|
146
|
-
last_name: "
|
|
147
|
-
email: "
|
|
148
|
-
position: "Admin",
|
|
119
|
+
id_user: 28,
|
|
120
|
+
name: "Proveedor",
|
|
121
|
+
last_name: "Colgate",
|
|
122
|
+
email: "ilopez@contentoh.com",
|
|
123
|
+
position: "Prueba Admin",
|
|
149
124
|
telephone: "+523111366336",
|
|
150
125
|
country: "México",
|
|
151
|
-
id_company:
|
|
152
|
-
id_cognito: "
|
|
126
|
+
id_company: 1,
|
|
127
|
+
id_cognito: "f5927f8e-cbf7-4922-9e09-e69ec0b2731a",
|
|
153
128
|
birth_Date: null,
|
|
154
129
|
about_me: null,
|
|
155
130
|
zip_code: null,
|
|
156
131
|
address: null,
|
|
157
132
|
job: null,
|
|
158
|
-
id_stripe: "",
|
|
133
|
+
id_stripe: "cus_KuEt6R6vwmN09f",
|
|
159
134
|
id_role: 0,
|
|
160
135
|
active: 1,
|
|
161
|
-
is_retailer:
|
|
136
|
+
is_retailer: 0,
|
|
162
137
|
membership: {
|
|
163
|
-
id:
|
|
164
|
-
start_date: "
|
|
165
|
-
end_date: "
|
|
166
|
-
planID:
|
|
167
|
-
plan: "
|
|
168
|
-
name: "Plan
|
|
169
|
-
user_limit: "
|
|
170
|
-
products_limit: "
|
|
138
|
+
id: 38,
|
|
139
|
+
start_date: "2022-01-18T17:25:35.000Z",
|
|
140
|
+
end_date: "2023-01-18T17:25:35.000Z",
|
|
141
|
+
planID: 8,
|
|
142
|
+
plan: "prod_KtlhECVSFG2iro",
|
|
143
|
+
name: "Plan Pro",
|
|
144
|
+
user_limit: "20",
|
|
145
|
+
products_limit: "5000",
|
|
171
146
|
type: "Enterprise"
|
|
172
147
|
},
|
|
173
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
148
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-28/28.png?1656001689809"
|
|
174
149
|
}
|
|
175
150
|
};
|
|
@@ -482,7 +482,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
482
482
|
getServices();
|
|
483
483
|
|
|
484
484
|
if (!originProp) {
|
|
485
|
-
setActiveRetailer(product.retailers[0] || product.retailersAvailable[0]);
|
|
485
|
+
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]);
|
|
486
486
|
} //setActiveRetailer(product?.retailers[0]);
|
|
487
487
|
|
|
488
488
|
|
|
@@ -760,49 +760,42 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
760
760
|
|
|
761
761
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
762
762
|
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
763
|
-
var
|
|
763
|
+
var dataObject;
|
|
764
764
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
765
765
|
while (1) {
|
|
766
766
|
switch (_context6.prev = _context6.next) {
|
|
767
767
|
case 0:
|
|
768
768
|
setLoading(true);
|
|
769
|
-
productTemp = product;
|
|
770
769
|
dataObject = {
|
|
771
770
|
articleId: product === null || product === void 0 ? void 0 : product.id_article,
|
|
772
771
|
articleData: updatedDescriptions
|
|
773
772
|
};
|
|
774
773
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
775
|
-
_context6.prev =
|
|
776
|
-
_context6.next =
|
|
774
|
+
_context6.prev = 3;
|
|
775
|
+
_context6.next = 6;
|
|
777
776
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
778
777
|
headers: {
|
|
779
778
|
Authorization: token
|
|
780
779
|
}
|
|
781
780
|
});
|
|
782
781
|
|
|
783
|
-
case
|
|
784
|
-
if (productTemp.status === "ASSIGNED") {
|
|
785
|
-
productTemp.status = "IN_PROGRESS";
|
|
786
|
-
setProduct(productTemp);
|
|
787
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
788
|
-
}
|
|
789
|
-
|
|
782
|
+
case 6:
|
|
790
783
|
setMessage("Descripciones guardadas con éxito");
|
|
791
784
|
loadData();
|
|
792
|
-
_context6.next =
|
|
785
|
+
_context6.next = 13;
|
|
793
786
|
break;
|
|
794
787
|
|
|
795
|
-
case
|
|
796
|
-
_context6.prev =
|
|
797
|
-
_context6.t0 = _context6["catch"](
|
|
788
|
+
case 10:
|
|
789
|
+
_context6.prev = 10;
|
|
790
|
+
_context6.t0 = _context6["catch"](3);
|
|
798
791
|
console.log(_context6.t0);
|
|
799
792
|
|
|
800
|
-
case
|
|
793
|
+
case 13:
|
|
801
794
|
case "end":
|
|
802
795
|
return _context6.stop();
|
|
803
796
|
}
|
|
804
797
|
}
|
|
805
|
-
}, _callee6, null, [[
|
|
798
|
+
}, _callee6, null, [[3, 10]]);
|
|
806
799
|
}));
|
|
807
800
|
|
|
808
801
|
return function saveDescriptions() {
|
|
@@ -833,28 +826,21 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
833
826
|
|
|
834
827
|
case 6:
|
|
835
828
|
setMessage("Fichas técnicas guardadas");
|
|
836
|
-
|
|
837
|
-
if (productTemp.status === "ASSIGNED") {
|
|
838
|
-
productTemp.status = "IN_PROGRESS";
|
|
839
|
-
setProduct(productTemp);
|
|
840
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
841
|
-
}
|
|
842
|
-
|
|
843
829
|
loadData();
|
|
844
|
-
_context7.next =
|
|
830
|
+
_context7.next = 13;
|
|
845
831
|
break;
|
|
846
832
|
|
|
847
|
-
case
|
|
848
|
-
_context7.prev =
|
|
833
|
+
case 10:
|
|
834
|
+
_context7.prev = 10;
|
|
849
835
|
_context7.t0 = _context7["catch"](3);
|
|
850
836
|
console.log(_context7.t0);
|
|
851
837
|
|
|
852
|
-
case
|
|
838
|
+
case 13:
|
|
853
839
|
case "end":
|
|
854
840
|
return _context7.stop();
|
|
855
841
|
}
|
|
856
842
|
}
|
|
857
|
-
}, _callee7, null, [[3,
|
|
843
|
+
}, _callee7, null, [[3, 10]]);
|
|
858
844
|
}));
|
|
859
845
|
|
|
860
846
|
return function saveDatasheets() {
|
|
@@ -1225,9 +1211,15 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1225
1211
|
};
|
|
1226
1212
|
|
|
1227
1213
|
var downloadImages = function downloadImages() {
|
|
1228
|
-
|
|
1214
|
+
var _images$values3;
|
|
1215
|
+
|
|
1216
|
+
selectedImages.length > 0 ? selectedImages.forEach(function (e) {
|
|
1217
|
+
if (e.id) {
|
|
1218
|
+
(0, _fileSaver.saveAs)("https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(e.srcDB), "".concat(product.upc || product.article.upc, "_").concat(e.name, ".").concat(e.ext));
|
|
1219
|
+
}
|
|
1220
|
+
}) : images === null || images === void 0 ? void 0 : (_images$values3 = images.values) === null || _images$values3 === void 0 ? void 0 : _images$values3.forEach(function (e) {
|
|
1229
1221
|
if (e.id) {
|
|
1230
|
-
(0, _fileSaver.saveAs)("https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(e.srcDB), "".concat(product.article.upc, "_").concat(e.name, ".").concat(e.ext));
|
|
1222
|
+
(0, _fileSaver.saveAs)("https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(e.srcDB), "".concat(product.upc || product.article.upc, "_").concat(e.name, ".").concat(e.ext));
|
|
1231
1223
|
}
|
|
1232
1224
|
});
|
|
1233
1225
|
};
|
|
@@ -1297,26 +1289,6 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1297
1289
|
}
|
|
1298
1290
|
};
|
|
1299
1291
|
|
|
1300
|
-
var specialistValid = function specialistValid(tab) {
|
|
1301
|
-
var concept = "";
|
|
1302
|
-
|
|
1303
|
-
switch (tab) {
|
|
1304
|
-
case "Ficha técnica":
|
|
1305
|
-
concept = "datasheet";
|
|
1306
|
-
break;
|
|
1307
|
-
|
|
1308
|
-
case "Imágenes":
|
|
1309
|
-
concept = "images";
|
|
1310
|
-
break;
|
|
1311
|
-
|
|
1312
|
-
case "Descripción":
|
|
1313
|
-
concept = "description";
|
|
1314
|
-
break;
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
return product["".concat(concept, "_status")] === "IN_PROGRESS" || product["".concat(concept, "_status")] === "RF" || product["".concat(concept, "_status")] === "RA";
|
|
1318
|
-
};
|
|
1319
|
-
|
|
1320
1292
|
var confirmStatusComplete = function confirmStatusComplete() {
|
|
1321
1293
|
var datasheet_status = product.datasheet_status,
|
|
1322
1294
|
description_status = product.description_status,
|
|
@@ -1331,7 +1303,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1331
1303
|
|
|
1332
1304
|
var sendEvaluation = /*#__PURE__*/function () {
|
|
1333
1305
|
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
|
|
1334
|
-
var data, retailerId, _product$id_order2, _product$id_order3,
|
|
1306
|
+
var data, retailerId, _product$id_order2, _product$id_order3, productTemp, concept;
|
|
1335
1307
|
|
|
1336
1308
|
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1337
1309
|
while (1) {
|
|
@@ -1365,9 +1337,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1365
1337
|
break;
|
|
1366
1338
|
|
|
1367
1339
|
case 9:
|
|
1368
|
-
|
|
1340
|
+
productTemp = product;
|
|
1369
1341
|
concept = getConcept(activeTab);
|
|
1370
|
-
|
|
1342
|
+
productTemp["".concat(concept, "_status")] = "Evaluated";
|
|
1371
1343
|
data = {
|
|
1372
1344
|
articleId: product.id_article,
|
|
1373
1345
|
orderId: (_product$id_order3 = product.id_order) !== null && _product$id_order3 !== void 0 ? _product$id_order3 : product.orderId,
|
|
@@ -1381,16 +1353,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1381
1353
|
}
|
|
1382
1354
|
});
|
|
1383
1355
|
|
|
1384
|
-
setProduct(
|
|
1356
|
+
setProduct(productTemp);
|
|
1385
1357
|
setProductEdit({
|
|
1386
|
-
ArticleId:
|
|
1387
|
-
idCategory:
|
|
1388
|
-
product:
|
|
1358
|
+
ArticleId: productTemp.id_article,
|
|
1359
|
+
idCategory: productTemp.article.id_category,
|
|
1360
|
+
product: productTemp
|
|
1389
1361
|
});
|
|
1390
1362
|
sessionStorage.setItem("productEdit", JSON.stringify({
|
|
1391
|
-
ArticleId:
|
|
1392
|
-
idCategory:
|
|
1393
|
-
product:
|
|
1363
|
+
ArticleId: productTemp.id_article,
|
|
1364
|
+
idCategory: productTemp.article.id_category,
|
|
1365
|
+
product: productTemp
|
|
1394
1366
|
}));
|
|
1395
1367
|
setOrigin(function (prev) {
|
|
1396
1368
|
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, concept, "Evaluated"));
|
|
@@ -1465,11 +1437,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1465
1437
|
};
|
|
1466
1438
|
|
|
1467
1439
|
var enableActions = function enableActions(versionStatus) {
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1440
|
+
try {
|
|
1441
|
+
var userIsRetailer = user.is_retailer;
|
|
1442
|
+
if (userIsRetailer) return false;
|
|
1443
|
+
|
|
1444
|
+
if (versionStatus) {
|
|
1445
|
+
return ["AP", "AC", "RC", null].includes(versionStatus);
|
|
1446
|
+
}
|
|
1471
1447
|
|
|
1472
|
-
|
|
1448
|
+
return true;
|
|
1449
|
+
} catch (err) {
|
|
1450
|
+
console.log(err, "Unable de check if user is retailer");
|
|
1451
|
+
return false;
|
|
1452
|
+
}
|
|
1473
1453
|
};
|
|
1474
1454
|
|
|
1475
1455
|
(0, _react.useEffect)(function () {
|
|
@@ -1585,7 +1565,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1585
1565
|
assig: assig,
|
|
1586
1566
|
setAssignation: setAssignation,
|
|
1587
1567
|
isRetailer: isRetailer,
|
|
1588
|
-
showSaveButton:
|
|
1568
|
+
showSaveButton: enableActions(product.version_status),
|
|
1589
1569
|
onClickSave: function onClickSave() {
|
|
1590
1570
|
switch (activeTab) {
|
|
1591
1571
|
case "Descripción":
|
|
@@ -753,17 +753,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
753
753
|
articleId: product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article,
|
|
754
754
|
articleData: updatedDatasheets
|
|
755
755
|
};
|
|
756
|
-
console.log(updatedDatasheets, "updatedDatasheets");
|
|
757
756
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
758
|
-
_context6.prev =
|
|
759
|
-
_context6.next =
|
|
757
|
+
_context6.prev = 4;
|
|
758
|
+
_context6.next = 7;
|
|
760
759
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
761
760
|
headers: {
|
|
762
761
|
Authorization: token
|
|
763
762
|
}
|
|
764
763
|
});
|
|
765
764
|
|
|
766
|
-
case
|
|
765
|
+
case 7:
|
|
767
766
|
setMessage("Fichas técnicas guardadas");
|
|
768
767
|
|
|
769
768
|
if (productTemp.status === "ASSIGNED") {
|
|
@@ -773,20 +772,20 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
773
772
|
}
|
|
774
773
|
|
|
775
774
|
loadData();
|
|
776
|
-
_context6.next =
|
|
775
|
+
_context6.next = 15;
|
|
777
776
|
break;
|
|
778
777
|
|
|
779
|
-
case
|
|
780
|
-
_context6.prev =
|
|
781
|
-
_context6.t0 = _context6["catch"](
|
|
778
|
+
case 12:
|
|
779
|
+
_context6.prev = 12;
|
|
780
|
+
_context6.t0 = _context6["catch"](4);
|
|
782
781
|
console.log(_context6.t0);
|
|
783
782
|
|
|
784
|
-
case
|
|
783
|
+
case 15:
|
|
785
784
|
case "end":
|
|
786
785
|
return _context6.stop();
|
|
787
786
|
}
|
|
788
787
|
}
|
|
789
|
-
}, _callee6, null, [[
|
|
788
|
+
}, _callee6, null, [[4, 12]]);
|
|
790
789
|
}));
|
|
791
790
|
|
|
792
791
|
return function saveDatasheets() {
|
|
@@ -1441,7 +1440,13 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1441
1440
|
}();
|
|
1442
1441
|
|
|
1443
1442
|
var downloadImages = function downloadImages() {
|
|
1444
|
-
|
|
1443
|
+
var _images$values3;
|
|
1444
|
+
|
|
1445
|
+
selectedImages.length > 0 ? selectedImages.forEach(function (e) {
|
|
1446
|
+
if (e.id) {
|
|
1447
|
+
(0, _fileSaver.saveAs)("https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(e.srcDB), "".concat(product.article.upc, "_").concat(e.name, ".").concat(e.ext));
|
|
1448
|
+
}
|
|
1449
|
+
}) : images === null || images === void 0 ? void 0 : (_images$values3 = images.values) === null || _images$values3 === void 0 ? void 0 : _images$values3.forEach(function (e) {
|
|
1445
1450
|
if (e.id) {
|
|
1446
1451
|
(0, _fileSaver.saveAs)("https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(e.srcDB), "".concat(product.article.upc, "_").concat(e.name, ".").concat(e.ext));
|
|
1447
1452
|
}
|
package/package.json
CHANGED
|
@@ -16,157 +16,120 @@ ProviderProductEditionDefault.args = {
|
|
|
16
16
|
Imágenes: false,
|
|
17
17
|
},
|
|
18
18
|
token:
|
|
19
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.
|
|
19
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiI3ZTU5YmI1Yy1mNjI1LTQ1NzMtYjMzYS00ZWM4YzFmMzMyNTIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY1NjAwMTY4OCwibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NTYwMDUyODgsImlhdCI6MTY1NjAwMTY4OCwiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.ZUKMejBG8qCT2bv-zrqyFx6xyeKK85Ry-kRlQv3U2KrDasW6ea8zbNDJMJAGMu_7dDrk9mRUj0Mp-jW32T1IBOweWxivRKSYfWQzjMdJdOUcckCagVXp8zQ4W-DZJINI25iq1AEfl9--6WaTRybEdTLjKXgzzOmLCGk5QbUI2uSeT_3w7fZiHPlCDCFFTSgXaNKUqxnsyZ2llos97KKIhH7tmn7DBw8mTPTUFyxED6EzBc7mkCYrM1o0velAZF0bOYhiuNnA-TF0L8eqPIZ3_13WDzGjRk3_eOBM37z8AqlMtBCJYIyQFGf-uCIbpSG0yJzYTswrExCkLamlKDhwtQ",
|
|
20
20
|
articleId: 238,
|
|
21
21
|
category: 846,
|
|
22
22
|
version: 2,
|
|
23
23
|
productSelected: {
|
|
24
|
+
id_article: 55081,
|
|
25
|
+
id_category: "157",
|
|
26
|
+
name: "Lavatrastes Axion toque de crema",
|
|
27
|
+
upc: "750954665375",
|
|
28
|
+
timestamp: "2022-06-17T18:43:45.000Z",
|
|
29
|
+
status: "NULL",
|
|
30
|
+
categoryName:
|
|
31
|
+
"CONSUMIBLES|PRODUCTOS DE LIMPIEZA Y LAVANDERÍA|JABONES Y LAVATRASTES",
|
|
32
|
+
asignations: [],
|
|
24
33
|
version: 1,
|
|
25
|
-
|
|
26
|
-
missing: {
|
|
27
|
-
datasheet: null,
|
|
28
|
-
descriptions: null,
|
|
29
|
-
images: null,
|
|
30
|
-
},
|
|
31
|
-
article: {
|
|
32
|
-
category: "MATERIALES DE CONSTRUCCIÓN|BÁSICOS DE CONSTRUCCIÓN|ADOQUINES",
|
|
33
|
-
company_name: "TABICEL DEL CENTRO",
|
|
34
|
-
company_id: 529,
|
|
35
|
-
id_category: "2578",
|
|
36
|
-
id_article: 24,
|
|
37
|
-
name: "ADOQUIN ROJO 20X 40 X 6",
|
|
38
|
-
upc: "85369",
|
|
39
|
-
},
|
|
40
|
-
asignations: [62],
|
|
41
|
-
retailers: [
|
|
42
|
-
{
|
|
43
|
-
id: 58,
|
|
44
|
-
name: "The Home Depot Golden",
|
|
45
|
-
country: "México",
|
|
46
|
-
id_region: 1,
|
|
47
|
-
active: 1,
|
|
48
|
-
},
|
|
49
|
-
],
|
|
34
|
+
version_status: null,
|
|
50
35
|
retailersAvailable: [
|
|
51
36
|
{
|
|
52
|
-
id:
|
|
53
|
-
name: "
|
|
37
|
+
id: 4,
|
|
38
|
+
name: "Walmart Super y Superama",
|
|
54
39
|
country: "México",
|
|
55
40
|
id_region: 1,
|
|
56
41
|
active: 1,
|
|
57
42
|
},
|
|
58
43
|
],
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
id_category: "2578",
|
|
64
|
-
id_article: 24,
|
|
65
|
-
services: [
|
|
66
|
-
{
|
|
67
|
-
id_article: 24,
|
|
68
|
-
service: "datasheet",
|
|
69
|
-
quantity: 1,
|
|
70
|
-
price: 0,
|
|
71
|
-
id_user: 59,
|
|
72
|
-
datasheet_common: null,
|
|
73
|
-
discount: null,
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
},
|
|
77
|
-
productToEdit: {
|
|
78
|
-
ArticleId: 24,
|
|
79
|
-
idCategory: "2578",
|
|
80
|
-
product: {
|
|
81
|
-
version: 1,
|
|
82
|
-
brand: null,
|
|
83
|
-
missing: {
|
|
84
|
-
datasheet: null,
|
|
85
|
-
descriptions: null,
|
|
86
|
-
images: null,
|
|
87
|
-
},
|
|
88
|
-
article: {
|
|
89
|
-
category:
|
|
90
|
-
"MATERIALES DE CONSTRUCCIÓN|BÁSICOS DE CONSTRUCCIÓN|ADOQUINES",
|
|
91
|
-
company_name: "TABICEL DEL CENTRO",
|
|
92
|
-
company_id: 529,
|
|
93
|
-
id_category: "2578",
|
|
94
|
-
id_article: 24,
|
|
95
|
-
name: "ADOQUIN ROJO 20X 40 X 6",
|
|
96
|
-
upc: "85369",
|
|
97
|
-
},
|
|
98
|
-
asignations: [62],
|
|
99
|
-
retailers: [
|
|
100
|
-
{
|
|
101
|
-
id: 58,
|
|
102
|
-
name: "The Home Depot Golden",
|
|
103
|
-
country: "México",
|
|
104
|
-
id_region: 1,
|
|
105
|
-
active: 1,
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
retailersAvailable: [
|
|
109
|
-
{
|
|
110
|
-
id: 58,
|
|
111
|
-
name: "The Home Depot Golden",
|
|
112
|
-
country: "México",
|
|
113
|
-
id_region: 1,
|
|
114
|
-
active: 1,
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
upc: "85369",
|
|
118
|
-
name: "ADOQUIN ROJO 20X 40 X 6",
|
|
119
|
-
categoryName:
|
|
120
|
-
"MATERIALES DE CONSTRUCCIÓN|BÁSICOS DE CONSTRUCCIÓN|ADOQUINES",
|
|
121
|
-
id_category: "2578",
|
|
122
|
-
id_article: 24,
|
|
123
|
-
services: [
|
|
124
|
-
{
|
|
125
|
-
id_article: 24,
|
|
126
|
-
service: "datasheet",
|
|
127
|
-
quantity: 1,
|
|
128
|
-
price: 0,
|
|
129
|
-
id_user: 59,
|
|
130
|
-
datasheet_common: null,
|
|
131
|
-
discount: null,
|
|
132
|
-
},
|
|
133
|
-
],
|
|
44
|
+
missing: {
|
|
45
|
+
datasheet: 10,
|
|
46
|
+
description: 6,
|
|
47
|
+
image: 32,
|
|
134
48
|
},
|
|
135
49
|
},
|
|
50
|
+
// productToEdit: {
|
|
51
|
+
// idCategory: "2976",
|
|
52
|
+
// ArticleId: 55070,
|
|
53
|
+
// product: [
|
|
54
|
+
// {
|
|
55
|
+
// id_article: 55070,
|
|
56
|
+
// id_category: "2976",
|
|
57
|
+
// name: "TOALLERO CORTO ACCESS NEGRO ÉBANO",
|
|
58
|
+
// upc: "161788",
|
|
59
|
+
// timestamp: "2022-06-17T17:31:14.000Z",
|
|
60
|
+
// status: "NULL",
|
|
61
|
+
// categoryName: "BAÑOS|ACCESORIOS PARA BAÑO|TOALLEROS",
|
|
62
|
+
// asignations: [],
|
|
63
|
+
// version: 1,
|
|
64
|
+
// version_status: null,
|
|
65
|
+
// retailersAvailable: [
|
|
66
|
+
// {
|
|
67
|
+
// id: 58,
|
|
68
|
+
// name: "The Home Depot Golden",
|
|
69
|
+
// country: "México",
|
|
70
|
+
// id_region: 1,
|
|
71
|
+
// active: 1,
|
|
72
|
+
// },
|
|
73
|
+
// {
|
|
74
|
+
// id: 59,
|
|
75
|
+
// name: "The Home Depot Platinum",
|
|
76
|
+
// country: "México",
|
|
77
|
+
// id_region: 1,
|
|
78
|
+
// active: 1,
|
|
79
|
+
// },
|
|
80
|
+
// {
|
|
81
|
+
// id: 60,
|
|
82
|
+
// name: "The Home Depot Resizing",
|
|
83
|
+
// country: "México",
|
|
84
|
+
// id_region: 1,
|
|
85
|
+
// active: 1,
|
|
86
|
+
// },
|
|
87
|
+
// {
|
|
88
|
+
// id: 61,
|
|
89
|
+
// name: "Home Depot TAB",
|
|
90
|
+
// country: "México",
|
|
91
|
+
// id_region: 1,
|
|
92
|
+
// active: 1,
|
|
93
|
+
// },
|
|
94
|
+
// ],
|
|
95
|
+
// missing: {},
|
|
96
|
+
// },
|
|
97
|
+
// ],
|
|
98
|
+
// },
|
|
136
99
|
location: {
|
|
137
100
|
product: { articleId: 109485, versionId: 3 },
|
|
138
101
|
state: {},
|
|
139
102
|
},
|
|
140
103
|
user: {
|
|
141
|
-
id_user:
|
|
142
|
-
name: "
|
|
143
|
-
last_name: "
|
|
144
|
-
email: "
|
|
145
|
-
position: "Admin",
|
|
104
|
+
id_user: 28,
|
|
105
|
+
name: "Proveedor",
|
|
106
|
+
last_name: "Colgate",
|
|
107
|
+
email: "ilopez@contentoh.com",
|
|
108
|
+
position: "Prueba Admin",
|
|
146
109
|
telephone: "+523111366336",
|
|
147
110
|
country: "México",
|
|
148
|
-
id_company:
|
|
149
|
-
id_cognito: "
|
|
111
|
+
id_company: 1,
|
|
112
|
+
id_cognito: "f5927f8e-cbf7-4922-9e09-e69ec0b2731a",
|
|
150
113
|
birth_Date: null,
|
|
151
114
|
about_me: null,
|
|
152
115
|
zip_code: null,
|
|
153
116
|
address: null,
|
|
154
117
|
job: null,
|
|
155
|
-
id_stripe: "",
|
|
118
|
+
id_stripe: "cus_KuEt6R6vwmN09f",
|
|
156
119
|
id_role: 0,
|
|
157
120
|
active: 1,
|
|
158
|
-
is_retailer:
|
|
121
|
+
is_retailer: 0,
|
|
159
122
|
membership: {
|
|
160
|
-
id:
|
|
161
|
-
start_date: "
|
|
162
|
-
end_date: "
|
|
163
|
-
planID:
|
|
164
|
-
plan: "
|
|
165
|
-
name: "Plan
|
|
166
|
-
user_limit: "
|
|
167
|
-
products_limit: "
|
|
123
|
+
id: 38,
|
|
124
|
+
start_date: "2022-01-18T17:25:35.000Z",
|
|
125
|
+
end_date: "2023-01-18T17:25:35.000Z",
|
|
126
|
+
planID: 8,
|
|
127
|
+
plan: "prod_KtlhECVSFG2iro",
|
|
128
|
+
name: "Plan Pro",
|
|
129
|
+
user_limit: "20",
|
|
130
|
+
products_limit: "5000",
|
|
168
131
|
type: "Enterprise",
|
|
169
132
|
},
|
|
170
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
133
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-28/28.png?1656001689809",
|
|
171
134
|
},
|
|
172
135
|
};
|
|
@@ -218,7 +218,11 @@ export const ProviderProductEdition = ({
|
|
|
218
218
|
getServices();
|
|
219
219
|
|
|
220
220
|
if (!originProp) {
|
|
221
|
-
setActiveRetailer(
|
|
221
|
+
setActiveRetailer(
|
|
222
|
+
product?.retailers
|
|
223
|
+
? product?.retailers[0]
|
|
224
|
+
: product?.retailersAvailable[0]
|
|
225
|
+
);
|
|
222
226
|
}
|
|
223
227
|
|
|
224
228
|
//setActiveRetailer(product?.retailers[0]);
|
|
@@ -402,7 +406,6 @@ export const ProviderProductEdition = ({
|
|
|
402
406
|
|
|
403
407
|
const saveDescriptions = async () => {
|
|
404
408
|
setLoading(true);
|
|
405
|
-
const productTemp = product;
|
|
406
409
|
const dataObject = {
|
|
407
410
|
articleId: product?.id_article,
|
|
408
411
|
articleData: updatedDescriptions,
|
|
@@ -418,12 +421,6 @@ export const ProviderProductEdition = ({
|
|
|
418
421
|
},
|
|
419
422
|
}
|
|
420
423
|
);
|
|
421
|
-
if (productTemp.status === "ASSIGNED") {
|
|
422
|
-
productTemp.status = "IN_PROGRESS";
|
|
423
|
-
setProduct(productTemp);
|
|
424
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
425
|
-
}
|
|
426
|
-
|
|
427
424
|
setMessage("Descripciones guardadas con éxito");
|
|
428
425
|
loadData();
|
|
429
426
|
} catch (error) {
|
|
@@ -449,11 +446,6 @@ export const ProviderProductEdition = ({
|
|
|
449
446
|
}
|
|
450
447
|
);
|
|
451
448
|
setMessage("Fichas técnicas guardadas");
|
|
452
|
-
if (productTemp.status === "ASSIGNED") {
|
|
453
|
-
productTemp.status = "IN_PROGRESS";
|
|
454
|
-
setProduct(productTemp);
|
|
455
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
456
|
-
}
|
|
457
449
|
loadData();
|
|
458
450
|
} catch (error) {
|
|
459
451
|
console.log(error);
|
|
@@ -695,14 +687,23 @@ export const ProviderProductEdition = ({
|
|
|
695
687
|
};
|
|
696
688
|
|
|
697
689
|
const downloadImages = () => {
|
|
698
|
-
selectedImages.
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
690
|
+
selectedImages.length > 0
|
|
691
|
+
? selectedImages.forEach((e) => {
|
|
692
|
+
if (e.id) {
|
|
693
|
+
saveAs(
|
|
694
|
+
`https://${process.env.REACT_APP_IMAGES_BUCKET}.s3.amazonaws.com/${e.srcDB}`,
|
|
695
|
+
`${product.upc || product.article.upc}_${e.name}.${e.ext}`
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
})
|
|
699
|
+
: images?.values?.forEach((e) => {
|
|
700
|
+
if (e.id) {
|
|
701
|
+
saveAs(
|
|
702
|
+
`https://${process.env.REACT_APP_IMAGES_BUCKET}.s3.amazonaws.com/${e.srcDB}`,
|
|
703
|
+
`${product.upc || product.article.upc}_${e.name}.${e.ext}`
|
|
704
|
+
);
|
|
705
|
+
}
|
|
706
|
+
});
|
|
706
707
|
};
|
|
707
708
|
|
|
708
709
|
const deleteImages = () => {
|
|
@@ -778,26 +779,6 @@ export const ProviderProductEdition = ({
|
|
|
778
779
|
}
|
|
779
780
|
};
|
|
780
781
|
|
|
781
|
-
const specialistValid = (tab) => {
|
|
782
|
-
let concept = "";
|
|
783
|
-
switch (tab) {
|
|
784
|
-
case "Ficha técnica":
|
|
785
|
-
concept = "datasheet";
|
|
786
|
-
break;
|
|
787
|
-
case "Imágenes":
|
|
788
|
-
concept = "images";
|
|
789
|
-
break;
|
|
790
|
-
case "Descripción":
|
|
791
|
-
concept = "description";
|
|
792
|
-
break;
|
|
793
|
-
}
|
|
794
|
-
return (
|
|
795
|
-
product[`${concept}_status`] === "IN_PROGRESS" ||
|
|
796
|
-
product[`${concept}_status`] === "RF" ||
|
|
797
|
-
product[`${concept}_status`] === "RA"
|
|
798
|
-
);
|
|
799
|
-
};
|
|
800
|
-
|
|
801
782
|
const confirmStatusComplete = () => {
|
|
802
783
|
const { datasheet_status, description_status, images_status } = product;
|
|
803
784
|
const completionStates =
|
|
@@ -900,10 +881,19 @@ export const ProviderProductEdition = ({
|
|
|
900
881
|
};
|
|
901
882
|
|
|
902
883
|
const enableActions = (versionStatus) => {
|
|
903
|
-
|
|
904
|
-
|
|
884
|
+
try {
|
|
885
|
+
const userIsRetailer = user.is_retailer;
|
|
886
|
+
|
|
887
|
+
if (userIsRetailer) return false;
|
|
888
|
+
|
|
889
|
+
if (versionStatus) {
|
|
890
|
+
return ["AP", "AC", "RC", null].includes(versionStatus);
|
|
891
|
+
}
|
|
892
|
+
return true;
|
|
893
|
+
} catch (err) {
|
|
894
|
+
console.log(err, "Unable de check if user is retailer");
|
|
895
|
+
return false;
|
|
905
896
|
}
|
|
906
|
-
return true;
|
|
907
897
|
};
|
|
908
898
|
|
|
909
899
|
useEffect(() => {
|
|
@@ -1019,7 +1009,7 @@ export const ProviderProductEdition = ({
|
|
|
1019
1009
|
assig={assig}
|
|
1020
1010
|
setAssignation={setAssignation}
|
|
1021
1011
|
isRetailer={isRetailer}
|
|
1022
|
-
showSaveButton={
|
|
1012
|
+
showSaveButton={enableActions(product.version_status)}
|
|
1023
1013
|
onClickSave={() => {
|
|
1024
1014
|
switch (activeTab) {
|
|
1025
1015
|
case "Descripción":
|
|
@@ -424,7 +424,6 @@ export const RetailerProductEdition = ({
|
|
|
424
424
|
articleId: product?.article?.id_article,
|
|
425
425
|
articleData: updatedDatasheets,
|
|
426
426
|
};
|
|
427
|
-
console.log(updatedDatasheets, "updatedDatasheets");
|
|
428
427
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
429
428
|
try {
|
|
430
429
|
await axios.put(
|
|
@@ -956,14 +955,23 @@ export const RetailerProductEdition = ({
|
|
|
956
955
|
};
|
|
957
956
|
|
|
958
957
|
const downloadImages = () => {
|
|
959
|
-
selectedImages.
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
958
|
+
selectedImages.length > 0
|
|
959
|
+
? selectedImages.forEach((e) => {
|
|
960
|
+
if (e.id) {
|
|
961
|
+
saveAs(
|
|
962
|
+
`https://${process.env.REACT_APP_IMAGES_BUCKET}.s3.amazonaws.com/${e.srcDB}`,
|
|
963
|
+
`${product.article.upc}_${e.name}.${e.ext}`
|
|
964
|
+
);
|
|
965
|
+
}
|
|
966
|
+
})
|
|
967
|
+
: images?.values?.forEach((e) => {
|
|
968
|
+
if (e.id) {
|
|
969
|
+
saveAs(
|
|
970
|
+
`https://${process.env.REACT_APP_IMAGES_BUCKET}.s3.amazonaws.com/${e.srcDB}`,
|
|
971
|
+
`${product.article.upc}_${e.name}.${e.ext}`
|
|
972
|
+
);
|
|
973
|
+
}
|
|
974
|
+
});
|
|
967
975
|
};
|
|
968
976
|
|
|
969
977
|
const deleteImages = () => {
|