contentoh-components-library 21.1.12 → 21.1.13
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/molecules/TableHeader/index.js +4 -2
- package/dist/components/organisms/ImageDataTable/index.js +3 -1
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +94 -104
- package/dist/components/pages/ProviderProductEdition/index.js +28 -275
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +49 -43
- package/dist/components/pages/RetailerProductEdition/index.js +99 -160
- package/package.json +1 -1
- package/src/components/molecules/TableHeader/index.js +2 -0
- package/src/components/organisms/ImageDataTable/index.js +2 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +93 -106
- package/src/components/pages/ProviderProductEdition/index.js +13 -297
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +50 -43
- package/src/components/pages/RetailerProductEdition/index.js +99 -181
|
@@ -16,170 +16,157 @@ ProviderProductEditionDefault.args = {
|
|
|
16
16
|
Imágenes: false,
|
|
17
17
|
},
|
|
18
18
|
token:
|
|
19
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.
|
|
19
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI1ODg0YWUzNC01OWQ2LTQ0NTQtYjk4ZS04MjE1MThiY2MzYTciLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6IjU4ODRhZTM0LTU5ZDYtNDQ1NC1iOThlLTgyMTUxOGJjYzNhNyIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiI5MzhiMGQyMC0yOTM4LTQ2OWItOTY2Zi0wY2VkOTVkMmI4NWEiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY1NTc1MDcxMCwibmFtZSI6IkNhZGVuYSBJc21hZWwiLCJwaG9uZV9udW1iZXIiOiIrNTIzMTExMzY2MzM2IiwiZXhwIjoxNjU1NzU0MzEwLCJpYXQiOjE2NTU3NTA3MTAsImVtYWlsIjoiY2FkZW5hLmlzbWFlbEBhbGxmcmVlbWFpbC5uZXQifQ.Ujee6tuptp9LLqZq9fJN83TGjRZDfhGPMcwcr-zAZKgnGZQLzD8SkxWIabSF5DqTuj5V9pZnLHMG3iwlXM1QV54HqeF9xwL6s41EmOsaJFRLT8f_x8i599RBw_6Yfltmo-qWw2sbD-SA29etm8g5yNoJiK8Nqth9xbE8uyUqSOpwqe1MX4uE7Gbx14nEUXjdeRxnr3Nis7mad4miWxCUurl_RaoPd5JKvhwhvhnvG1RGlZTa0wOSW36Y4GjJ-MgG63akBwNCouDUlcOSe--Dy0gXpNVPgh5XRDr-mHVtz_iOarJ_mRGbY5jAlMmw1DzxcH0sD-ppFQzMMbguFxnH9g",
|
|
20
20
|
articleId: 238,
|
|
21
21
|
category: 846,
|
|
22
22
|
version: 2,
|
|
23
23
|
productSelected: {
|
|
24
|
-
|
|
25
|
-
article_status: "AP",
|
|
26
|
-
datasheet_status: "NS",
|
|
27
|
-
description_status: "NS",
|
|
28
|
-
images_status: "AP",
|
|
29
|
-
prio: "none",
|
|
30
|
-
version: 19,
|
|
24
|
+
version: 1,
|
|
31
25
|
brand: null,
|
|
26
|
+
missing: {
|
|
27
|
+
datasheet: null,
|
|
28
|
+
descriptions: null,
|
|
29
|
+
images: null,
|
|
30
|
+
},
|
|
32
31
|
article: {
|
|
33
|
-
category: "
|
|
34
|
-
company_name: "
|
|
35
|
-
|
|
36
|
-
id_category: "
|
|
37
|
-
id_article:
|
|
38
|
-
name: "
|
|
39
|
-
upc: "
|
|
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",
|
|
40
39
|
},
|
|
40
|
+
asignations: [62],
|
|
41
41
|
retailers: [
|
|
42
42
|
{
|
|
43
43
|
id: 58,
|
|
44
44
|
name: "The Home Depot Golden",
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
name: "The Home Depot Platinum",
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
id: 60,
|
|
52
|
-
name: "The Home Depot Resizing",
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id: 61,
|
|
56
|
-
name: "Home Depot TAB",
|
|
45
|
+
country: "México",
|
|
46
|
+
id_region: 1,
|
|
47
|
+
active: 1,
|
|
57
48
|
},
|
|
58
49
|
],
|
|
59
|
-
services: {
|
|
60
|
-
datasheets: 0,
|
|
61
|
-
descriptions: 0,
|
|
62
|
-
images: 1,
|
|
63
|
-
},
|
|
64
|
-
id_article: 55109,
|
|
65
50
|
retailersAvailable: [
|
|
66
51
|
{
|
|
67
52
|
id: 58,
|
|
68
53
|
name: "The Home Depot Golden",
|
|
54
|
+
country: "México",
|
|
55
|
+
id_region: 1,
|
|
56
|
+
active: 1,
|
|
69
57
|
},
|
|
58
|
+
],
|
|
59
|
+
upc: "85369",
|
|
60
|
+
name: "ADOQUIN ROJO 20X 40 X 6",
|
|
61
|
+
categoryName:
|
|
62
|
+
"MATERIALES DE CONSTRUCCIÓN|BÁSICOS DE CONSTRUCCIÓN|ADOQUINES",
|
|
63
|
+
id_category: "2578",
|
|
64
|
+
id_article: 24,
|
|
65
|
+
services: [
|
|
70
66
|
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
{
|
|
79
|
-
id: 61,
|
|
80
|
-
name: "Home Depot TAB",
|
|
67
|
+
id_article: 24,
|
|
68
|
+
service: "datasheet",
|
|
69
|
+
quantity: 1,
|
|
70
|
+
price: 0,
|
|
71
|
+
id_user: 59,
|
|
72
|
+
datasheet_common: null,
|
|
73
|
+
discount: null,
|
|
81
74
|
},
|
|
82
75
|
],
|
|
83
76
|
},
|
|
84
77
|
productToEdit: {
|
|
85
|
-
ArticleId:
|
|
86
|
-
idCategory: "
|
|
78
|
+
ArticleId: 24,
|
|
79
|
+
idCategory: "2578",
|
|
87
80
|
product: {
|
|
88
|
-
|
|
89
|
-
article_status: "AP",
|
|
90
|
-
datasheet_status: "NS",
|
|
91
|
-
description_status: "NS",
|
|
92
|
-
images_status: "AP",
|
|
93
|
-
prio: "none",
|
|
94
|
-
version: 19,
|
|
81
|
+
version: 1,
|
|
95
82
|
brand: null,
|
|
83
|
+
missing: {
|
|
84
|
+
datasheet: null,
|
|
85
|
+
descriptions: null,
|
|
86
|
+
images: null,
|
|
87
|
+
},
|
|
96
88
|
article: {
|
|
97
|
-
category:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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",
|
|
104
97
|
},
|
|
98
|
+
asignations: [62],
|
|
105
99
|
retailers: [
|
|
106
100
|
{
|
|
107
101
|
id: 58,
|
|
108
102
|
name: "The Home Depot Golden",
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
name: "The Home Depot Platinum",
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
id: 60,
|
|
116
|
-
name: "The Home Depot Resizing",
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
id: 61,
|
|
120
|
-
name: "Home Depot TAB",
|
|
103
|
+
country: "México",
|
|
104
|
+
id_region: 1,
|
|
105
|
+
active: 1,
|
|
121
106
|
},
|
|
122
107
|
],
|
|
123
|
-
services: {
|
|
124
|
-
datasheets: 0,
|
|
125
|
-
descriptions: 0,
|
|
126
|
-
images: 1,
|
|
127
|
-
},
|
|
128
|
-
id_article: 55109,
|
|
129
108
|
retailersAvailable: [
|
|
130
109
|
{
|
|
131
110
|
id: 58,
|
|
132
111
|
name: "The Home Depot Golden",
|
|
112
|
+
country: "México",
|
|
113
|
+
id_region: 1,
|
|
114
|
+
active: 1,
|
|
133
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: [
|
|
134
124
|
{
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
{
|
|
143
|
-
id: 61,
|
|
144
|
-
name: "Home Depot TAB",
|
|
125
|
+
id_article: 24,
|
|
126
|
+
service: "datasheet",
|
|
127
|
+
quantity: 1,
|
|
128
|
+
price: 0,
|
|
129
|
+
id_user: 59,
|
|
130
|
+
datasheet_common: null,
|
|
131
|
+
discount: null,
|
|
145
132
|
},
|
|
146
133
|
],
|
|
147
134
|
},
|
|
148
135
|
},
|
|
149
136
|
location: {
|
|
150
137
|
product: { articleId: 109485, versionId: 3 },
|
|
151
|
-
state: {
|
|
138
|
+
state: {},
|
|
152
139
|
},
|
|
153
140
|
user: {
|
|
154
|
-
id_user:
|
|
155
|
-
name: "
|
|
156
|
-
last_name: "
|
|
157
|
-
email: "
|
|
158
|
-
position: "
|
|
141
|
+
id_user: 59,
|
|
142
|
+
name: "The Home",
|
|
143
|
+
last_name: "Depot",
|
|
144
|
+
email: "cadena.ismael@allfreemail.net",
|
|
145
|
+
position: "Admin",
|
|
159
146
|
telephone: "+523111366336",
|
|
160
147
|
country: "México",
|
|
161
|
-
id_company:
|
|
162
|
-
id_cognito: "
|
|
148
|
+
id_company: 7,
|
|
149
|
+
id_cognito: "5884ae34-59d6-4454-b98e-821518bcc3a7",
|
|
163
150
|
birth_Date: null,
|
|
164
151
|
about_me: null,
|
|
165
152
|
zip_code: null,
|
|
166
153
|
address: null,
|
|
167
154
|
job: null,
|
|
168
|
-
id_stripe: "
|
|
155
|
+
id_stripe: "",
|
|
169
156
|
id_role: 0,
|
|
170
157
|
active: 1,
|
|
171
|
-
is_retailer:
|
|
158
|
+
is_retailer: 1,
|
|
172
159
|
membership: {
|
|
173
|
-
id:
|
|
174
|
-
start_date: "
|
|
175
|
-
end_date: "
|
|
176
|
-
planID:
|
|
177
|
-
plan: "
|
|
178
|
-
name: "Plan
|
|
179
|
-
user_limit: "
|
|
180
|
-
products_limit: "
|
|
160
|
+
id: 24,
|
|
161
|
+
start_date: "2021-11-23T03:35:50.000Z",
|
|
162
|
+
end_date: "2022-11-23T03:35:50.000Z",
|
|
163
|
+
planID: 9,
|
|
164
|
+
plan: "prod_KtlkzZVGq6bRTO",
|
|
165
|
+
name: "Plan Enterprise Full",
|
|
166
|
+
user_limit: "30",
|
|
167
|
+
products_limit: "10000",
|
|
181
168
|
type: "Enterprise",
|
|
182
169
|
},
|
|
183
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
170
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-59/59.png?1655750711586",
|
|
184
171
|
},
|
|
185
172
|
};
|
|
@@ -217,6 +217,10 @@ export const ProviderProductEdition = ({
|
|
|
217
217
|
setServices(services);
|
|
218
218
|
getServices();
|
|
219
219
|
|
|
220
|
+
if (!originProp) {
|
|
221
|
+
setActiveRetailer(product.retailers[0] || product.availableRetailers[0]);
|
|
222
|
+
}
|
|
223
|
+
|
|
220
224
|
//setActiveRetailer(product?.retailers[0]);
|
|
221
225
|
setImages({
|
|
222
226
|
action: "init",
|
|
@@ -249,22 +253,10 @@ export const ProviderProductEdition = ({
|
|
|
249
253
|
}
|
|
250
254
|
};
|
|
251
255
|
|
|
252
|
-
const translateConcept = (concept) => {
|
|
253
|
-
let translation = "";
|
|
254
|
-
if (concept === "datasheet") {
|
|
255
|
-
translation = "Ficha técnica";
|
|
256
|
-
} else if (concept === "description") {
|
|
257
|
-
translation = "Descripción";
|
|
258
|
-
} else if (concept === "images") {
|
|
259
|
-
translation = "Imágenes";
|
|
260
|
-
}
|
|
261
|
-
return translation;
|
|
262
|
-
};
|
|
263
|
-
|
|
264
256
|
const isRevision = () => {
|
|
265
257
|
if (productEdit) {
|
|
266
258
|
const concept = getConcept(activeTab);
|
|
267
|
-
const isRetailer = user.is_retailer;
|
|
259
|
+
const isRetailer = user.is_retailer === 1;
|
|
268
260
|
const currentService = productEdit?.product[`${concept}_status`];
|
|
269
261
|
const orgn = origin[activeTab];
|
|
270
262
|
const revision = [
|
|
@@ -347,7 +339,7 @@ export const ProviderProductEdition = ({
|
|
|
347
339
|
setActivePercentage(retailers[0]?.percentage);
|
|
348
340
|
}, [percentages]);
|
|
349
341
|
|
|
350
|
-
|
|
342
|
+
const loadInputs = () => {
|
|
351
343
|
if (services.length > 0) {
|
|
352
344
|
if (services[0][activeRetailer.id]?.data)
|
|
353
345
|
services[0][activeRetailer.id].data = Object.values(
|
|
@@ -363,7 +355,11 @@ export const ProviderProductEdition = ({
|
|
|
363
355
|
setDatasheets([datagroups, inputs]);
|
|
364
356
|
setDescriptions(descriptions);
|
|
365
357
|
}
|
|
366
|
-
}
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
useEffect(() => {
|
|
361
|
+
loadInputs();
|
|
362
|
+
}, [servicesData, activeRetailer, services]);
|
|
367
363
|
|
|
368
364
|
const thumbs = () => {
|
|
369
365
|
const imageInputs = socketType?.slice();
|
|
@@ -574,42 +570,6 @@ export const ProviderProductEdition = ({
|
|
|
574
570
|
}
|
|
575
571
|
}, [dataImages, imagesUploaded]);
|
|
576
572
|
|
|
577
|
-
const evaluationFinished = (userId, tab, statusArray) => {
|
|
578
|
-
// const srv = servicesData.filter((serv) => serv.service === getConcept(tab));
|
|
579
|
-
// const [srvActive] = srv.filter(
|
|
580
|
-
// (serv) => serv.id_retailer === activeRetailer?.id
|
|
581
|
-
// );
|
|
582
|
-
// const unvalidated =
|
|
583
|
-
// product[`${getConcept(tab)}_status`] === "QF" ||
|
|
584
|
-
// product[`${getConcept(tab)}_status`] === "IN_PROGRESS";
|
|
585
|
-
// switch (userId) {
|
|
586
|
-
// case 7:
|
|
587
|
-
// case 8:
|
|
588
|
-
// return (
|
|
589
|
-
// (["RA", "RF"].includes(product?.status) &&
|
|
590
|
-
// statusArray.includes(srvActive?.status)) ||
|
|
591
|
-
// (statusArray.includes(product.status) &&
|
|
592
|
-
// srv.filter((serv) => statusArray.includes(serv.status)).length ===
|
|
593
|
-
// srv.length)
|
|
594
|
-
// );
|
|
595
|
-
// case 4:
|
|
596
|
-
// case 5:
|
|
597
|
-
// return (
|
|
598
|
-
// unvalidated &&
|
|
599
|
-
// ["IN_PROGRESS", "QF"].includes(product.status) &&
|
|
600
|
-
// srv.filter((serv) => statusArray.includes(serv.status)).length ===
|
|
601
|
-
// srv.length
|
|
602
|
-
// );
|
|
603
|
-
// case 6:
|
|
604
|
-
// return (
|
|
605
|
-
// statusArray.includes(product.status) &&
|
|
606
|
-
// servicesData.every((serv) => ["RA", "AA"].includes(serv.status))
|
|
607
|
-
// );
|
|
608
|
-
// default:
|
|
609
|
-
// break;
|
|
610
|
-
// }
|
|
611
|
-
};
|
|
612
|
-
|
|
613
573
|
const getConcept = (tab) => {
|
|
614
574
|
switch (tab) {
|
|
615
575
|
case "Descripción":
|
|
@@ -621,26 +581,6 @@ export const ProviderProductEdition = ({
|
|
|
621
581
|
}
|
|
622
582
|
};
|
|
623
583
|
|
|
624
|
-
// const approveRejectButtons = (action) => {
|
|
625
|
-
// let concept = getConcept(activeTab);
|
|
626
|
-
// concept = action ? action : concept;
|
|
627
|
-
|
|
628
|
-
// const [retailerStatus] = servicesData.filter(
|
|
629
|
-
// (srv) => srv.id_retailer === activeRetailer?.id && srv.service === concept
|
|
630
|
-
// );
|
|
631
|
-
|
|
632
|
-
// return (
|
|
633
|
-
// (retailerStatus?.status === "QF" &&
|
|
634
|
-
// (user.id_role === 1 || user.id_role === 4 || user.id_role === 5)) ||
|
|
635
|
-
// (retailerStatus?.status === "AF" && //sessionStorage product
|
|
636
|
-
// (user.id_role === 1 || user.id_role === 6)) ||
|
|
637
|
-
// (retailerStatus?.status === "RP" &&
|
|
638
|
-
// (user.id_role === 1 || user.id_role === 6)) ||
|
|
639
|
-
// (retailerStatus?.status === "RC" &&
|
|
640
|
-
// (user.id_role === 1 || user.id_role === 6))
|
|
641
|
-
// );
|
|
642
|
-
// };
|
|
643
|
-
|
|
644
584
|
const getSectionIcon = () => {
|
|
645
585
|
switch (activeTab) {
|
|
646
586
|
case "Ficha técnica":
|
|
@@ -657,138 +597,6 @@ export const ProviderProductEdition = ({
|
|
|
657
597
|
}
|
|
658
598
|
};
|
|
659
599
|
|
|
660
|
-
// const sendToFacilitator = async (result) => {
|
|
661
|
-
// setLoading(true);
|
|
662
|
-
// try {
|
|
663
|
-
// let concept = getConcept(activeTab);
|
|
664
|
-
|
|
665
|
-
// let productTemp = { ...product };
|
|
666
|
-
// let evalStatus = product[`${concept}_status`];
|
|
667
|
-
|
|
668
|
-
// let data = {};
|
|
669
|
-
// if (result) {
|
|
670
|
-
// //updateCompaniesList(evalStatus, result, activeRetailer.id, concept);
|
|
671
|
-
// data = {
|
|
672
|
-
// articleId: product.id_article,
|
|
673
|
-
// orderId: product.orderId,
|
|
674
|
-
// concept: concept,
|
|
675
|
-
// result: result,
|
|
676
|
-
// evalStatus: evalStatus,
|
|
677
|
-
// retailerId: activeRetailer.id,
|
|
678
|
-
// };
|
|
679
|
-
|
|
680
|
-
// await axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
681
|
-
// headers: {
|
|
682
|
-
// Authorization: token,
|
|
683
|
-
// },
|
|
684
|
-
// });
|
|
685
|
-
// getServices();
|
|
686
|
-
// } else {
|
|
687
|
-
// const specialistDone =
|
|
688
|
-
// evalStatus === "RF" ||
|
|
689
|
-
// evalStatus === "RA" ||
|
|
690
|
-
// evalStatus === "IN_PROGRESS";
|
|
691
|
-
|
|
692
|
-
// if (specialistDone) {
|
|
693
|
-
// setMessage(`${activeTab} enviada a facilitador`);
|
|
694
|
-
// getSectionIcon();
|
|
695
|
-
// } else if (evalStatus === "QF") {
|
|
696
|
-
// setMessage("Evaluación enviada");
|
|
697
|
-
// getSectionIcon();
|
|
698
|
-
// } else if (evalStatus === "AF") {
|
|
699
|
-
// setMessage("Evaluación enviada");
|
|
700
|
-
// getSectionIcon();
|
|
701
|
-
// } else if (evalStatus === "RP") {
|
|
702
|
-
// setMessage("Evaluación enviada");
|
|
703
|
-
// getSectionIcon();
|
|
704
|
-
// } else if (evalStatus === "RC") {
|
|
705
|
-
// setMessage("Evaluación enviada");
|
|
706
|
-
// getSectionIcon();
|
|
707
|
-
// }
|
|
708
|
-
// let statusArr = [];
|
|
709
|
-
// servicesData.forEach((srv) => {
|
|
710
|
-
// srv.service === concept && statusArr.push(srv.status);
|
|
711
|
-
// });
|
|
712
|
-
|
|
713
|
-
// productTemp[`${concept}_status`] = getNewStatus(statusArr);
|
|
714
|
-
|
|
715
|
-
// let newStatus = getNewStatus([
|
|
716
|
-
// productTemp.datasheet_status,
|
|
717
|
-
// productTemp.description_status,
|
|
718
|
-
// productTemp.images_status,
|
|
719
|
-
// ]);
|
|
720
|
-
|
|
721
|
-
// productTemp.status = newStatus;
|
|
722
|
-
|
|
723
|
-
// data = {
|
|
724
|
-
// articleId: product.id_article,
|
|
725
|
-
// orderId: product.orderId,
|
|
726
|
-
// concept: concept,
|
|
727
|
-
// evalStatus: evalStatus,
|
|
728
|
-
// retailerId: activeRetailer.id,
|
|
729
|
-
// };
|
|
730
|
-
|
|
731
|
-
// switch (user.id_role) {
|
|
732
|
-
// case 7:
|
|
733
|
-
// case 8:
|
|
734
|
-
// data.especialist = true;
|
|
735
|
-
// break;
|
|
736
|
-
// case 4:
|
|
737
|
-
// case 5:
|
|
738
|
-
// data.facilitator = true;
|
|
739
|
-
// break;
|
|
740
|
-
// default:
|
|
741
|
-
// break;
|
|
742
|
-
// }
|
|
743
|
-
// await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
744
|
-
// headers: {
|
|
745
|
-
// Authorization: token,
|
|
746
|
-
// },
|
|
747
|
-
// });
|
|
748
|
-
// getServices();
|
|
749
|
-
// }
|
|
750
|
-
// sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
751
|
-
// setProduct(productTemp);
|
|
752
|
-
// } catch (error) {
|
|
753
|
-
// console.log(error);
|
|
754
|
-
// }
|
|
755
|
-
// setLoading(false);
|
|
756
|
-
// };
|
|
757
|
-
|
|
758
|
-
const userAssigned = (tab, rol) => {
|
|
759
|
-
let concept = "";
|
|
760
|
-
switch (tab) {
|
|
761
|
-
case "Ficha técnica":
|
|
762
|
-
concept = "datasheet";
|
|
763
|
-
break;
|
|
764
|
-
case "Imágenes":
|
|
765
|
-
concept = "images";
|
|
766
|
-
break;
|
|
767
|
-
|
|
768
|
-
default:
|
|
769
|
-
concept = "description";
|
|
770
|
-
break;
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
const allowedRoles = [1, 4, 5, 6, 7, 8];
|
|
774
|
-
const validUser = allowedRoles.indexOf(user?.id_role) !== -1;
|
|
775
|
-
|
|
776
|
-
if (!rol) {
|
|
777
|
-
switch (user.id_role) {
|
|
778
|
-
case 4:
|
|
779
|
-
case 5:
|
|
780
|
-
rol = "facilitator";
|
|
781
|
-
break;
|
|
782
|
-
case 7:
|
|
783
|
-
case 8:
|
|
784
|
-
rol = "especialist";
|
|
785
|
-
break;
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
return true;
|
|
790
|
-
};
|
|
791
|
-
|
|
792
600
|
const createComment = async (e, body, tab) => {
|
|
793
601
|
let concept = "";
|
|
794
602
|
switch (activeTab) {
|
|
@@ -817,77 +625,6 @@ export const ProviderProductEdition = ({
|
|
|
817
625
|
});
|
|
818
626
|
};
|
|
819
627
|
|
|
820
|
-
const getRequired = (services) => {
|
|
821
|
-
const objetcTemp = {};
|
|
822
|
-
const datasheetServicesArray = Object.values(services[0]);
|
|
823
|
-
const dsInputs = datasheetServicesArray.pop();
|
|
824
|
-
const descriptionsServicesArray = services[1];
|
|
825
|
-
|
|
826
|
-
let dsInputsRequired = [];
|
|
827
|
-
let desInputsRequired = 0;
|
|
828
|
-
datasheetServicesArray.forEach((datasheet) => {
|
|
829
|
-
const [requested] = servicesData.filter(
|
|
830
|
-
(srv) =>
|
|
831
|
-
srv.id_retailer === datasheet.retailer.id &&
|
|
832
|
-
srv.service === getConcept(activeTab)
|
|
833
|
-
);
|
|
834
|
-
requested &&
|
|
835
|
-
Object.values(datasheet?.data).forEach((dataGroup) =>
|
|
836
|
-
dsInputsRequired.push(
|
|
837
|
-
...dataGroup.inputs.filter(
|
|
838
|
-
(input) =>
|
|
839
|
-
dsInputs[input].required &&
|
|
840
|
-
(dsInputs[input].value === undefined || !dsInputs[input].value)
|
|
841
|
-
)
|
|
842
|
-
)
|
|
843
|
-
);
|
|
844
|
-
});
|
|
845
|
-
|
|
846
|
-
objetcTemp["Ficha técnica"] = dsInputsRequired.length;
|
|
847
|
-
|
|
848
|
-
descriptionsServicesArray.forEach((description) => {
|
|
849
|
-
const [requested] = servicesData.filter(
|
|
850
|
-
(srv) =>
|
|
851
|
-
srv.id_retailer === description.id &&
|
|
852
|
-
srv.service === getConcept(activeTab)
|
|
853
|
-
);
|
|
854
|
-
requested &&
|
|
855
|
-
description.inputs.forEach(
|
|
856
|
-
(input) =>
|
|
857
|
-
input.required &&
|
|
858
|
-
(!input.value ||
|
|
859
|
-
input.value.replace(/(<\/?p>)|(<\/?strong>)|(<br>)/gm, "") ===
|
|
860
|
-
"") &&
|
|
861
|
-
desInputsRequired++
|
|
862
|
-
);
|
|
863
|
-
});
|
|
864
|
-
|
|
865
|
-
objetcTemp["Descripción"] = desInputsRequired;
|
|
866
|
-
const retailersRequested = [];
|
|
867
|
-
services[2]?.retailerMandatories?.forEach((retMan) =>
|
|
868
|
-
retMan.forEach((rm) => retailersRequested.push(rm))
|
|
869
|
-
);
|
|
870
|
-
const requiredImages = services[2]?.inputs?.filter(
|
|
871
|
-
(e) =>
|
|
872
|
-
e.required === 1 &&
|
|
873
|
-
retailersRequested.filter(
|
|
874
|
-
(ret) =>
|
|
875
|
-
ret.id_image === e.id &&
|
|
876
|
-
servicesData.filter((srv) => srv.id_retailer === ret.id_retailer)
|
|
877
|
-
.length > 0
|
|
878
|
-
).length > 0
|
|
879
|
-
);
|
|
880
|
-
|
|
881
|
-
let requiredCounter = 0;
|
|
882
|
-
requiredImages?.forEach(
|
|
883
|
-
(req) =>
|
|
884
|
-
services[2].values.filter((img) => img.image_id === req.id).length ===
|
|
885
|
-
0 && requiredCounter++
|
|
886
|
-
);
|
|
887
|
-
objetcTemp["Imágenes"] = requiredCounter;
|
|
888
|
-
setRequiredNull(objetcTemp);
|
|
889
|
-
};
|
|
890
|
-
|
|
891
628
|
useEffect(() => {
|
|
892
629
|
setComment(comments[activeTab]);
|
|
893
630
|
}, [activeTab]);
|
|
@@ -1061,27 +798,6 @@ export const ProviderProductEdition = ({
|
|
|
1061
798
|
);
|
|
1062
799
|
};
|
|
1063
800
|
|
|
1064
|
-
// const getRetailerStatus = (servicesData, tab) => {
|
|
1065
|
-
// const arr = servicesData?.slice();
|
|
1066
|
-
// let concept = getConcept(tab);
|
|
1067
|
-
|
|
1068
|
-
// let retailerService = {};
|
|
1069
|
-
// [retailerService] = arr?.filter(
|
|
1070
|
-
// (service) =>
|
|
1071
|
-
// service.id_retailer === activeRetailer?.id &&
|
|
1072
|
-
// service.service === concept
|
|
1073
|
-
// );
|
|
1074
|
-
// return retailerService ? retailerService.status : "NA";
|
|
1075
|
-
// };
|
|
1076
|
-
|
|
1077
|
-
// useEffect(() => {
|
|
1078
|
-
// let status = getRetailerStatus(servicesData, activeTab);
|
|
1079
|
-
// setRetailerStatus(status);
|
|
1080
|
-
// }, [activeTab, servicesData, activeRetailer]);
|
|
1081
|
-
|
|
1082
|
-
// useEffect(() => {
|
|
1083
|
-
// services.length > 0 && getRequired(services);
|
|
1084
|
-
// }, [services, servicesData, activeTab]);
|
|
1085
801
|
const confirmStatusComplete = () => {
|
|
1086
802
|
const { datasheet_status, description_status, images_status } = product;
|
|
1087
803
|
const completionStates =
|
|
@@ -1462,10 +1178,10 @@ export const ProviderProductEdition = ({
|
|
|
1462
1178
|
</div>
|
|
1463
1179
|
{inCart ? (
|
|
1464
1180
|
<button type="button">
|
|
1465
|
-
|
|
1181
|
+
<Link to="/checkout">
|
|
1466
1182
|
<p>Articulo en carrito</p>
|
|
1467
1183
|
<p>Ir a checkout</p>
|
|
1468
|
-
</Link>
|
|
1184
|
+
</Link>
|
|
1469
1185
|
</button>
|
|
1470
1186
|
) : (
|
|
1471
1187
|
<Button
|