contentoh-components-library 21.0.94 → 21.0.98
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 +21 -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 +41 -100
- package/dist/components/pages/ProviderProductEdition/index.js +74 -43
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +44 -32
- package/dist/components/pages/RetailerProductEdition/index.js +82 -44
- package/dist/global-files/data.js +2 -0
- package/package.json +1 -1
- package/src/components/atoms/AsignationOption/index.js +15 -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 +45 -117
- package/src/components/pages/ProviderProductEdition/index.js +49 -22
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +46 -32
- package/src/components/pages/RetailerProductEdition/index.js +59 -18
- package/src/global-files/data.js +2 -0
|
@@ -21,134 +21,62 @@ ProviderProductEditionDefault.args = {
|
|
|
21
21
|
category: 846,
|
|
22
22
|
version: 2,
|
|
23
23
|
productSelected: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
company_name: "BROOKLITE MEXICO S DE RL DE CV",
|
|
35
|
-
company_id: 409,
|
|
36
|
-
id_category: "2520",
|
|
37
|
-
id_article: 1,
|
|
38
|
-
name: "SOPORTE PLANCHA-BURRO EN PUERTA",
|
|
39
|
-
upc: "339",
|
|
40
|
-
},
|
|
41
|
-
asignations: [62],
|
|
42
|
-
retailers: [
|
|
43
|
-
{
|
|
44
|
-
id: 61,
|
|
45
|
-
name: "Home Depot TAB",
|
|
46
|
-
country: "México",
|
|
47
|
-
id_region: 1,
|
|
48
|
-
active: 1,
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
percentage: 0,
|
|
24
|
+
id_article: 35319,
|
|
25
|
+
id_category: "2146",
|
|
26
|
+
name: "FOCO LED A19 (60W) LUZ AMARILLA",
|
|
27
|
+
upc: "120873",
|
|
28
|
+
timestamp: "2022-06-14T15:31:50.000Z",
|
|
29
|
+
status: "NULL",
|
|
30
|
+
categoryName: "ILUMINACIÓN|FOCOS|LEDS",
|
|
31
|
+
asignations: [],
|
|
32
|
+
version: 2,
|
|
33
|
+
version_status: "AA",
|
|
52
34
|
retailersAvailable: [
|
|
53
35
|
{
|
|
54
|
-
id:
|
|
55
|
-
name: "Home Depot
|
|
36
|
+
id: 58,
|
|
37
|
+
name: "The Home Depot Golden",
|
|
56
38
|
country: "México",
|
|
57
39
|
id_region: 1,
|
|
58
40
|
active: 1,
|
|
59
41
|
},
|
|
60
42
|
],
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
id_article: 1,
|
|
67
|
-
services: [
|
|
68
|
-
{
|
|
69
|
-
id_article: 1,
|
|
70
|
-
service: "datasheet",
|
|
71
|
-
quantity: 1,
|
|
72
|
-
price: 0,
|
|
73
|
-
id_user: 59,
|
|
74
|
-
datasheet_common: null,
|
|
75
|
-
discount: null,
|
|
76
|
-
},
|
|
77
|
-
],
|
|
43
|
+
missing: {
|
|
44
|
+
datasheet: 33,
|
|
45
|
+
description: 0,
|
|
46
|
+
image: 23,
|
|
47
|
+
},
|
|
78
48
|
},
|
|
79
49
|
productToEdit: {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
product:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
{
|
|
108
|
-
id: 4,
|
|
109
|
-
name: "Walmart Super y Superama",
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
id: 9,
|
|
113
|
-
name: "Amazon",
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
id: 1013,
|
|
117
|
-
name: "Cencosud Colombia",
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
id: 2005,
|
|
121
|
-
name: "ClubCo",
|
|
50
|
+
idCategory: "2146",
|
|
51
|
+
ArticleId: 35319,
|
|
52
|
+
product: [
|
|
53
|
+
{
|
|
54
|
+
id_article: 35319,
|
|
55
|
+
id_category: "2146",
|
|
56
|
+
name: "FOCO LED A19 (60W) LUZ AMARILLA",
|
|
57
|
+
upc: "120873",
|
|
58
|
+
timestamp: "2022-06-14T15:31:50.000Z",
|
|
59
|
+
status: "NULL",
|
|
60
|
+
categoryName: "ILUMINACIÓN|FOCOS|LEDS",
|
|
61
|
+
asignations: [],
|
|
62
|
+
version: 2,
|
|
63
|
+
version_status: "AA",
|
|
64
|
+
retailersAvailable: [
|
|
65
|
+
{
|
|
66
|
+
id: 58,
|
|
67
|
+
name: "The Home Depot Golden",
|
|
68
|
+
country: "México",
|
|
69
|
+
id_region: 1,
|
|
70
|
+
active: 1,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
missing: {
|
|
74
|
+
datasheet: 33,
|
|
75
|
+
description: 0,
|
|
76
|
+
image: 23,
|
|
122
77
|
},
|
|
123
|
-
],
|
|
124
|
-
services: {
|
|
125
|
-
datasheets: 1,
|
|
126
|
-
descriptions: 1,
|
|
127
|
-
images: 1,
|
|
128
78
|
},
|
|
129
|
-
|
|
130
|
-
{
|
|
131
|
-
id: 4,
|
|
132
|
-
name: "Walmart Super y Superama",
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
id: 9,
|
|
136
|
-
name: "Amazon",
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
id: 1013,
|
|
140
|
-
name: "Cencosud Colombia",
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
id: 2005,
|
|
144
|
-
name: "ClubCo",
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
id_article: 33249,
|
|
148
|
-
categoryName:
|
|
149
|
-
"SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
|
|
150
|
-
version_status: "RECEPTION",
|
|
151
|
-
},
|
|
79
|
+
],
|
|
152
80
|
},
|
|
153
81
|
location: {
|
|
154
82
|
product: { articleId: 109485, versionId: 3 },
|
|
@@ -48,6 +48,11 @@ const reducerImages = (state, action) => {
|
|
|
48
48
|
case "changeAttrValue":
|
|
49
49
|
attrForImgs[action.retailer][action.index].value = action.value;
|
|
50
50
|
return { ...state, attrForImgs, values };
|
|
51
|
+
case "deleteImage":
|
|
52
|
+
values = values.filter(
|
|
53
|
+
(value) => action.selectedImages.indexOf(value) === -1
|
|
54
|
+
);
|
|
55
|
+
return { ...state, values };
|
|
51
56
|
default:
|
|
52
57
|
return state;
|
|
53
58
|
}
|
|
@@ -195,6 +200,7 @@ export const ProviderProductEdition = ({
|
|
|
195
200
|
});
|
|
196
201
|
const [modalViewTextArea, setModalViewTextArea] = useState(false);
|
|
197
202
|
const [socketType, setSocketType] = useState(null);
|
|
203
|
+
const [saving, setSaving] = useState(loading);
|
|
198
204
|
|
|
199
205
|
useEffect(() => {
|
|
200
206
|
checkAll && setSelectedImages(images.values);
|
|
@@ -213,7 +219,7 @@ export const ProviderProductEdition = ({
|
|
|
213
219
|
//setActiveRetailer(product?.retailers[0]);
|
|
214
220
|
setImages({
|
|
215
221
|
action: "init",
|
|
216
|
-
init:
|
|
222
|
+
init: services[2],
|
|
217
223
|
});
|
|
218
224
|
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
219
225
|
|
|
@@ -500,6 +506,7 @@ export const ProviderProductEdition = ({
|
|
|
500
506
|
});
|
|
501
507
|
}
|
|
502
508
|
if (valid && duplicated?.length === 0) {
|
|
509
|
+
setLoading(true);
|
|
503
510
|
try {
|
|
504
511
|
data?.articleData?.forEach((e) => {
|
|
505
512
|
e.uuid = uuidv4();
|
|
@@ -541,7 +548,6 @@ export const ProviderProductEdition = ({
|
|
|
541
548
|
|
|
542
549
|
useEffect(async () => {
|
|
543
550
|
if (imagesUploaded) {
|
|
544
|
-
setLoading(true);
|
|
545
551
|
dataImages.articleData = dataImages?.articleData.map((e) => {
|
|
546
552
|
delete e.src;
|
|
547
553
|
e.imageID = e.image_id;
|
|
@@ -858,7 +864,21 @@ export const ProviderProductEdition = ({
|
|
|
858
864
|
});
|
|
859
865
|
|
|
860
866
|
objetcTemp["Descripción"] = desInputsRequired;
|
|
861
|
-
const
|
|
867
|
+
const retailersRequested = [];
|
|
868
|
+
services[2]?.retailerMandatories?.forEach((retMan) =>
|
|
869
|
+
retMan.forEach((rm) => retailersRequested.push(rm))
|
|
870
|
+
);
|
|
871
|
+
const requiredImages = services[2]?.inputs?.filter(
|
|
872
|
+
(e) =>
|
|
873
|
+
e.required === 1 &&
|
|
874
|
+
retailersRequested.filter(
|
|
875
|
+
(ret) =>
|
|
876
|
+
ret.id_image === e.id &&
|
|
877
|
+
servicesData.filter((srv) => srv.id_retailer === ret.id_retailer)
|
|
878
|
+
.length > 0
|
|
879
|
+
).length > 0
|
|
880
|
+
);
|
|
881
|
+
|
|
862
882
|
let requiredCounter = 0;
|
|
863
883
|
requiredImages?.forEach(
|
|
864
884
|
(req) =>
|
|
@@ -955,7 +975,6 @@ export const ProviderProductEdition = ({
|
|
|
955
975
|
|
|
956
976
|
const deleteImages = () => {
|
|
957
977
|
setLoading(true);
|
|
958
|
-
const imagesTemp = images;
|
|
959
978
|
const { values } = images;
|
|
960
979
|
const imgsInBack = [];
|
|
961
980
|
|
|
@@ -967,12 +986,10 @@ export const ProviderProductEdition = ({
|
|
|
967
986
|
(value) => selectedImages.indexOf(value) === -1
|
|
968
987
|
);
|
|
969
988
|
|
|
970
|
-
imagesTemp.values = imgsLeft;
|
|
971
|
-
|
|
972
989
|
if (imgsInBack.length > 0) {
|
|
973
990
|
const data = {
|
|
974
|
-
articleId: product
|
|
975
|
-
deleteImages:
|
|
991
|
+
articleId: product?.id_article || product?.article?.id_article,
|
|
992
|
+
deleteImages: imgsInBack,
|
|
976
993
|
};
|
|
977
994
|
try {
|
|
978
995
|
axios.put(
|
|
@@ -986,8 +1003,16 @@ export const ProviderProductEdition = ({
|
|
|
986
1003
|
console.log(err);
|
|
987
1004
|
}
|
|
988
1005
|
}
|
|
989
|
-
|
|
990
|
-
|
|
1006
|
+
|
|
1007
|
+
setImages({
|
|
1008
|
+
action: "deleteImage",
|
|
1009
|
+
selectedImages,
|
|
1010
|
+
});
|
|
1011
|
+
|
|
1012
|
+
setTimeout(() => {
|
|
1013
|
+
setLoading(false);
|
|
1014
|
+
}, 500);
|
|
1015
|
+
|
|
991
1016
|
setMessage("");
|
|
992
1017
|
setComponentsArray([]);
|
|
993
1018
|
};
|
|
@@ -1166,6 +1191,10 @@ export const ProviderProductEdition = ({
|
|
|
1166
1191
|
return true;
|
|
1167
1192
|
};
|
|
1168
1193
|
|
|
1194
|
+
useEffect(() => {
|
|
1195
|
+
setSaving(loading);
|
|
1196
|
+
}, [loading]);
|
|
1197
|
+
|
|
1169
1198
|
return (
|
|
1170
1199
|
<Container headerTop={headerTop}>
|
|
1171
1200
|
<HeaderTop setHeaderTop={setHeaderTop} />
|
|
@@ -1278,13 +1307,13 @@ export const ProviderProductEdition = ({
|
|
|
1278
1307
|
onClickSave={() => {
|
|
1279
1308
|
switch (activeTab) {
|
|
1280
1309
|
case "Descripción":
|
|
1281
|
-
saveDescriptions();
|
|
1310
|
+
!saving && saveDescriptions();
|
|
1282
1311
|
break;
|
|
1283
1312
|
case "Ficha técnica":
|
|
1284
|
-
saveDatasheets();
|
|
1313
|
+
!saving && saveDatasheets();
|
|
1285
1314
|
break;
|
|
1286
1315
|
case "Imágenes":
|
|
1287
|
-
updateImages();
|
|
1316
|
+
!saving && updateImages();
|
|
1288
1317
|
break;
|
|
1289
1318
|
default:
|
|
1290
1319
|
break;
|
|
@@ -1301,15 +1330,13 @@ export const ProviderProductEdition = ({
|
|
|
1301
1330
|
<Loading />
|
|
1302
1331
|
) : (
|
|
1303
1332
|
<>
|
|
1304
|
-
{!imageLayout &&
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
/>
|
|
1312
|
-
)}
|
|
1333
|
+
{!imageLayout && activeTab === "Imágenes" && (
|
|
1334
|
+
<GalleryHeader
|
|
1335
|
+
setSelectedImages={setSelectedImages}
|
|
1336
|
+
checkAll={checkAll}
|
|
1337
|
+
setCheckAll={setCheckAll}
|
|
1338
|
+
/>
|
|
1339
|
+
)}
|
|
1313
1340
|
{activeTab === "Ficha técnica" &&
|
|
1314
1341
|
(product?.datasheet_status !== "NS" ? (
|
|
1315
1342
|
datasheets[0]?.data?.map((dataGroup, index) => (
|
|
@@ -26,43 +26,43 @@ RetailerProductEditionDefault.args = {
|
|
|
26
26
|
descriptions: 1,
|
|
27
27
|
images: 1,
|
|
28
28
|
},
|
|
29
|
-
orderId:
|
|
30
|
-
status: "
|
|
31
|
-
datasheet_status:
|
|
29
|
+
orderId: 4,
|
|
30
|
+
status: "ASSIGNED",
|
|
31
|
+
datasheet_status: null,
|
|
32
32
|
prio: "none",
|
|
33
|
-
version:
|
|
34
|
-
description_status:
|
|
35
|
-
images_status:
|
|
33
|
+
version: 3,
|
|
34
|
+
description_status: null,
|
|
35
|
+
images_status: null,
|
|
36
36
|
article: {
|
|
37
|
-
id_article:
|
|
38
|
-
id_category: "
|
|
39
|
-
name: "
|
|
40
|
-
upc: "
|
|
41
|
-
timestamp: "2022-06-
|
|
37
|
+
id_article: 33249,
|
|
38
|
+
id_category: "684",
|
|
39
|
+
name: "Crema dental ",
|
|
40
|
+
upc: "232435",
|
|
41
|
+
timestamp: "2022-06-14T14:52:51.000Z",
|
|
42
42
|
id_user: 28,
|
|
43
43
|
status: "NULL",
|
|
44
44
|
active: 1,
|
|
45
45
|
company_id: 1,
|
|
46
46
|
company_name: "COMPANY DEV",
|
|
47
47
|
country: "México",
|
|
48
|
-
id_order:
|
|
49
|
-
id_datasheet_especialist:
|
|
50
|
-
id_datasheet_facilitator:
|
|
51
|
-
id_description_especialist:
|
|
52
|
-
id_description_facilitator:
|
|
53
|
-
id_images_especialist:
|
|
54
|
-
id_images_facilitator:
|
|
55
|
-
id_auditor:
|
|
48
|
+
id_order: 4,
|
|
49
|
+
id_datasheet_especialist: null,
|
|
50
|
+
id_datasheet_facilitator: null,
|
|
51
|
+
id_description_especialist: null,
|
|
52
|
+
id_description_facilitator: null,
|
|
53
|
+
id_images_especialist: null,
|
|
54
|
+
id_images_facilitator: null,
|
|
55
|
+
id_auditor: 37,
|
|
56
56
|
id_recepcionist: null,
|
|
57
|
-
category: "
|
|
58
|
-
missingAttributes:
|
|
59
|
-
missingDescriptions:
|
|
60
|
-
missingImages:
|
|
57
|
+
category: "SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
|
|
58
|
+
missingAttributes: 13,
|
|
59
|
+
missingDescriptions: 4,
|
|
60
|
+
missingImages: 3,
|
|
61
61
|
},
|
|
62
62
|
retailers: [
|
|
63
63
|
{
|
|
64
|
-
id:
|
|
65
|
-
name: "
|
|
64
|
+
id: 4,
|
|
65
|
+
name: "Walmart Super y Superama",
|
|
66
66
|
country: "México",
|
|
67
67
|
id_region: 1,
|
|
68
68
|
active: 1,
|
|
@@ -74,30 +74,44 @@ RetailerProductEditionDefault.args = {
|
|
|
74
74
|
id_region: 1,
|
|
75
75
|
active: 1,
|
|
76
76
|
},
|
|
77
|
+
{
|
|
78
|
+
id: 1013,
|
|
79
|
+
name: "Cencosud Colombia",
|
|
80
|
+
country: "Colombia",
|
|
81
|
+
id_region: 2,
|
|
82
|
+
active: 1,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 2005,
|
|
86
|
+
name: "ClubCo",
|
|
87
|
+
country: "Costa Rica",
|
|
88
|
+
id_region: 3,
|
|
89
|
+
active: 1,
|
|
90
|
+
},
|
|
77
91
|
],
|
|
78
92
|
country: "México",
|
|
79
|
-
upc: "
|
|
93
|
+
upc: "232435",
|
|
80
94
|
},
|
|
81
95
|
location: {
|
|
82
96
|
product: { articleId: 109485, versionId: 3 },
|
|
83
97
|
},
|
|
84
98
|
user: {
|
|
85
|
-
id_user:
|
|
86
|
-
name: "
|
|
99
|
+
id_user: 54,
|
|
100
|
+
name: "ESPECIALISTA TXTS PRUEBA",
|
|
87
101
|
last_name: "",
|
|
88
|
-
email: "
|
|
102
|
+
email: "rlegorreta@contentoh.com",
|
|
89
103
|
position: null,
|
|
90
104
|
telephone: null,
|
|
91
105
|
country: null,
|
|
92
106
|
id_company: 2,
|
|
93
|
-
id_cognito: "
|
|
107
|
+
id_cognito: "ca1d24ab-e992-4c19-b4e1-2fe6f720c16b",
|
|
94
108
|
birth_Date: null,
|
|
95
109
|
about_me: null,
|
|
96
110
|
zip_code: null,
|
|
97
111
|
address: null,
|
|
98
112
|
job: null,
|
|
99
113
|
id_stripe: null,
|
|
100
|
-
id_role:
|
|
114
|
+
id_role: 7,
|
|
101
115
|
active: 1,
|
|
102
116
|
is_retailer: 0,
|
|
103
117
|
membership: {
|
|
@@ -111,6 +125,6 @@ RetailerProductEditionDefault.args = {
|
|
|
111
125
|
products_limit: "3",
|
|
112
126
|
type: "PyMES",
|
|
113
127
|
},
|
|
114
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
128
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-54/54.png?1655433250522",
|
|
115
129
|
},
|
|
116
130
|
};
|
|
@@ -45,6 +45,11 @@ const reducerImages = (state, action) => {
|
|
|
45
45
|
case "changeAttrValue":
|
|
46
46
|
attrForImgs[action.retailer][action.index].value = action.value;
|
|
47
47
|
return { ...state, attrForImgs, values };
|
|
48
|
+
case "deleteImage":
|
|
49
|
+
values = values.filter(
|
|
50
|
+
(value) => action.selectedImages.indexOf(value) === -1
|
|
51
|
+
);
|
|
52
|
+
return { ...state, values };
|
|
48
53
|
default:
|
|
49
54
|
return state;
|
|
50
55
|
}
|
|
@@ -153,6 +158,8 @@ export const RetailerProductEdition = ({
|
|
|
153
158
|
const [retailerStatus, setRetailerStatus] = useState("-");
|
|
154
159
|
const [statusArray, setStatusArray] = useState([]);
|
|
155
160
|
const [socketType, setSocketType] = useState(null);
|
|
161
|
+
const [servicesStatus, setServicesStatus] = useState([]);
|
|
162
|
+
const [saving, setSaving] = useState(loading);
|
|
156
163
|
|
|
157
164
|
useEffect(() => {
|
|
158
165
|
checkAll && setSelectedImages(images.values);
|
|
@@ -166,18 +173,15 @@ export const RetailerProductEdition = ({
|
|
|
166
173
|
);
|
|
167
174
|
//Converts the data inside the datasheets object to array
|
|
168
175
|
setServices(services);
|
|
176
|
+
getServices();
|
|
169
177
|
|
|
170
178
|
//setActiveRetailer(product?.retailers[0]);
|
|
171
179
|
setImages({
|
|
172
180
|
action: "init",
|
|
173
|
-
init:
|
|
181
|
+
init: services[2],
|
|
174
182
|
});
|
|
175
183
|
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
176
184
|
|
|
177
|
-
setActiveRetailer(
|
|
178
|
-
product.retailers ? product.retailers[0] : product.retailersAvailable[0]
|
|
179
|
-
);
|
|
180
|
-
|
|
181
185
|
getPercentage({ data: [product] }).then((res) => setPercentages(res));
|
|
182
186
|
setLoading(false);
|
|
183
187
|
};
|
|
@@ -234,7 +238,9 @@ export const RetailerProductEdition = ({
|
|
|
234
238
|
// getPercentage({ data: [product] }).then((res) =>
|
|
235
239
|
// setPercentages(res)
|
|
236
240
|
// );
|
|
237
|
-
|
|
241
|
+
setActiveRetailer(
|
|
242
|
+
product.retailers ? product.retailers[0] : product.retailersAvailable[0]
|
|
243
|
+
);
|
|
238
244
|
getComments();
|
|
239
245
|
setUserGroups(await fetchUsers(token));
|
|
240
246
|
let arr = [];
|
|
@@ -483,6 +489,7 @@ export const RetailerProductEdition = ({
|
|
|
483
489
|
});
|
|
484
490
|
}
|
|
485
491
|
if (valid && duplicated?.length === 0) {
|
|
492
|
+
setLoading(true);
|
|
486
493
|
try {
|
|
487
494
|
data?.articleData?.forEach((e) => {
|
|
488
495
|
e.uuid = uuidv4();
|
|
@@ -524,7 +531,6 @@ export const RetailerProductEdition = ({
|
|
|
524
531
|
|
|
525
532
|
useEffect(async () => {
|
|
526
533
|
if (imagesUploaded) {
|
|
527
|
-
setLoading(true);
|
|
528
534
|
dataImages.articleData = dataImages?.articleData.map((e) => {
|
|
529
535
|
delete e.src;
|
|
530
536
|
e.imageID = e.image_id;
|
|
@@ -836,7 +842,22 @@ export const RetailerProductEdition = ({
|
|
|
836
842
|
});
|
|
837
843
|
|
|
838
844
|
objetcTemp["Descripción"] = desInputsRequired;
|
|
839
|
-
|
|
845
|
+
|
|
846
|
+
const retailersRequested = [];
|
|
847
|
+
services[2]?.retailerMandatories?.forEach((retMan) =>
|
|
848
|
+
retMan.forEach((rm) => retailersRequested.push(rm))
|
|
849
|
+
);
|
|
850
|
+
const requiredImages = services[2]?.inputs?.filter(
|
|
851
|
+
(e) =>
|
|
852
|
+
e.required === 1 &&
|
|
853
|
+
retailersRequested.filter(
|
|
854
|
+
(ret) =>
|
|
855
|
+
ret.id_image === e.id &&
|
|
856
|
+
servicesData.filter((srv) => srv.id_retailer === ret.id_retailer)
|
|
857
|
+
.length > 0
|
|
858
|
+
).length > 0
|
|
859
|
+
);
|
|
860
|
+
|
|
840
861
|
let requiredCounter = 0;
|
|
841
862
|
requiredImages?.forEach(
|
|
842
863
|
(req) =>
|
|
@@ -985,7 +1006,6 @@ export const RetailerProductEdition = ({
|
|
|
985
1006
|
|
|
986
1007
|
const deleteImages = () => {
|
|
987
1008
|
setLoading(true);
|
|
988
|
-
const imagesTemp = images;
|
|
989
1009
|
const { values } = images;
|
|
990
1010
|
const imgsInBack = [];
|
|
991
1011
|
|
|
@@ -997,12 +1017,10 @@ export const RetailerProductEdition = ({
|
|
|
997
1017
|
(value) => selectedImages.indexOf(value) === -1
|
|
998
1018
|
);
|
|
999
1019
|
|
|
1000
|
-
imagesTemp.values = imgsLeft;
|
|
1001
|
-
|
|
1002
1020
|
if (imgsInBack.length > 0) {
|
|
1003
1021
|
const data = {
|
|
1004
1022
|
articleId: product.article.id_article,
|
|
1005
|
-
deleteImages:
|
|
1023
|
+
deleteImages: imgsInBack,
|
|
1006
1024
|
};
|
|
1007
1025
|
try {
|
|
1008
1026
|
axios.put(
|
|
@@ -1016,8 +1034,22 @@ export const RetailerProductEdition = ({
|
|
|
1016
1034
|
console.log(err);
|
|
1017
1035
|
}
|
|
1018
1036
|
}
|
|
1019
|
-
|
|
1020
|
-
|
|
1037
|
+
|
|
1038
|
+
setImages({
|
|
1039
|
+
action: "deleteImage",
|
|
1040
|
+
selectedImages,
|
|
1041
|
+
});
|
|
1042
|
+
|
|
1043
|
+
getRequired([
|
|
1044
|
+
services[0],
|
|
1045
|
+
services[1],
|
|
1046
|
+
{ ...services[2], values: imgsLeft },
|
|
1047
|
+
]);
|
|
1048
|
+
|
|
1049
|
+
setTimeout(() => {
|
|
1050
|
+
setLoading(false);
|
|
1051
|
+
}, 500);
|
|
1052
|
+
|
|
1021
1053
|
setMessage("");
|
|
1022
1054
|
setComponentsArray([]);
|
|
1023
1055
|
};
|
|
@@ -1093,6 +1125,10 @@ export const RetailerProductEdition = ({
|
|
|
1093
1125
|
services.length > 0 && getRequired(services);
|
|
1094
1126
|
}, [services, servicesData, activeTab]);
|
|
1095
1127
|
|
|
1128
|
+
useEffect(() => {
|
|
1129
|
+
setSaving(loading);
|
|
1130
|
+
}, [loading]);
|
|
1131
|
+
|
|
1096
1132
|
return (
|
|
1097
1133
|
<Container headerTop={headerTop}>
|
|
1098
1134
|
<HeaderTop setHeaderTop={setHeaderTop} />
|
|
@@ -1123,6 +1159,7 @@ export const RetailerProductEdition = ({
|
|
|
1123
1159
|
headerData={product}
|
|
1124
1160
|
percent={activePercentage}
|
|
1125
1161
|
activeRetailer={activeRetailer}
|
|
1162
|
+
servicesData={servicesData}
|
|
1126
1163
|
setActiveRetailer={setActiveRetailer}
|
|
1127
1164
|
sendToFacilitator={sendToFacilitator}
|
|
1128
1165
|
approve={() => {
|
|
@@ -1146,17 +1183,21 @@ export const RetailerProductEdition = ({
|
|
|
1146
1183
|
assig={assig[activeTab]}
|
|
1147
1184
|
setAssignation={setAssignation}
|
|
1148
1185
|
isRetailer={isRetailer}
|
|
1149
|
-
showSaveButton={
|
|
1186
|
+
showSaveButton={userAssigned()}
|
|
1150
1187
|
onClickSave={() => {
|
|
1151
1188
|
switch (activeTab) {
|
|
1152
1189
|
case "Descripción":
|
|
1153
|
-
|
|
1190
|
+
!saving &&
|
|
1191
|
+
product?.description_status !== "NS" &&
|
|
1192
|
+
saveDescriptions();
|
|
1154
1193
|
break;
|
|
1155
1194
|
case "Ficha técnica":
|
|
1156
|
-
|
|
1195
|
+
!saving &&
|
|
1196
|
+
product?.datasheet_status !== "NS" &&
|
|
1197
|
+
saveDatasheets();
|
|
1157
1198
|
break;
|
|
1158
1199
|
case "Imágenes":
|
|
1159
|
-
product?.images_status !== "NS" && updateImages();
|
|
1200
|
+
!saving && product?.images_status !== "NS" && updateImages();
|
|
1160
1201
|
break;
|
|
1161
1202
|
|
|
1162
1203
|
default:
|
package/src/global-files/data.js
CHANGED
|
@@ -194,5 +194,7 @@ export const getNewStatus = (statusArray) => {
|
|
|
194
194
|
if (lookupString.includes("AA")) return "AA";
|
|
195
195
|
if (lookupString.includes("AP")) return "AP";
|
|
196
196
|
if (lookupString.includes("AC")) return "AC";
|
|
197
|
+
if (lookupString.includes("RECEIVED")) return "RECEIVED";
|
|
198
|
+
if (lookupString.includes("NA")) return "NA";
|
|
197
199
|
return new Error("Status not found");
|
|
198
200
|
};
|