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
|
@@ -21,7 +21,8 @@ var TableHeader = function TableHeader(_ref) {
|
|
|
21
21
|
assignationsImages = _ref.assignationsImages,
|
|
22
22
|
setAssignation = _ref.setAssignation,
|
|
23
23
|
isRetailer = _ref.isRetailer,
|
|
24
|
-
onClickSave = _ref.onClickSave
|
|
24
|
+
onClickSave = _ref.onClickSave,
|
|
25
|
+
showSaveButton = _ref.showSaveButton;
|
|
25
26
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
26
27
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
27
28
|
text: (activeImage === null || activeImage === void 0 ? void 0 : activeImage.name) || "-",
|
|
@@ -32,7 +33,8 @@ var TableHeader = function TableHeader(_ref) {
|
|
|
32
33
|
assignationsImages: assignationsImages,
|
|
33
34
|
setAssignation: setAssignation,
|
|
34
35
|
isRetailer: isRetailer,
|
|
35
|
-
onClickSave: onClickSave
|
|
36
|
+
onClickSave: onClickSave,
|
|
37
|
+
showSaveButton: showSaveButton
|
|
36
38
|
})]
|
|
37
39
|
});
|
|
38
40
|
};
|
|
@@ -31,7 +31,8 @@ var ImageDataTable = function ImageDataTable(_ref) {
|
|
|
31
31
|
imagesStatus = _ref.imagesStatus,
|
|
32
32
|
setAssignation = _ref.setAssignation,
|
|
33
33
|
isRetailer = _ref.isRetailer,
|
|
34
|
-
onClickSave = _ref.onClickSave
|
|
34
|
+
onClickSave = _ref.onClickSave,
|
|
35
|
+
showSaveButton = _ref.showSaveButton;
|
|
35
36
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
36
37
|
darkMode: darkMode,
|
|
37
38
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TableHeader.TableHeader, {
|
|
@@ -40,6 +41,7 @@ var ImageDataTable = function ImageDataTable(_ref) {
|
|
|
40
41
|
assignationsImages: assignationsImages,
|
|
41
42
|
setAssignation: setAssignation,
|
|
42
43
|
isRetailer: isRetailer,
|
|
44
|
+
showSaveButton: showSaveButton,
|
|
43
45
|
onClickSave: onClickSave
|
|
44
46
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles2.Container, {
|
|
45
47
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
@@ -31,113 +31,105 @@ ProviderProductEditionDefault.args = {
|
|
|
31
31
|
"Ficha técnica": false,
|
|
32
32
|
Imágenes: false
|
|
33
33
|
},
|
|
34
|
-
token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.
|
|
34
|
+
token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI1ODg0YWUzNC01OWQ2LTQ0NTQtYjk4ZS04MjE1MThiY2MzYTciLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6IjU4ODRhZTM0LTU5ZDYtNDQ1NC1iOThlLTgyMTUxOGJjYzNhNyIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiI5MzhiMGQyMC0yOTM4LTQ2OWItOTY2Zi0wY2VkOTVkMmI4NWEiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY1NTc1MDcxMCwibmFtZSI6IkNhZGVuYSBJc21hZWwiLCJwaG9uZV9udW1iZXIiOiIrNTIzMTExMzY2MzM2IiwiZXhwIjoxNjU1NzU0MzEwLCJpYXQiOjE2NTU3NTA3MTAsImVtYWlsIjoiY2FkZW5hLmlzbWFlbEBhbGxmcmVlbWFpbC5uZXQifQ.Ujee6tuptp9LLqZq9fJN83TGjRZDfhGPMcwcr-zAZKgnGZQLzD8SkxWIabSF5DqTuj5V9pZnLHMG3iwlXM1QV54HqeF9xwL6s41EmOsaJFRLT8f_x8i599RBw_6Yfltmo-qWw2sbD-SA29etm8g5yNoJiK8Nqth9xbE8uyUqSOpwqe1MX4uE7Gbx14nEUXjdeRxnr3Nis7mad4miWxCUurl_RaoPd5JKvhwhvhnvG1RGlZTa0wOSW36Y4GjJ-MgG63akBwNCouDUlcOSe--Dy0gXpNVPgh5XRDr-mHVtz_iOarJ_mRGbY5jAlMmw1DzxcH0sD-ppFQzMMbguFxnH9g",
|
|
35
35
|
articleId: 238,
|
|
36
36
|
category: 846,
|
|
37
37
|
version: 2,
|
|
38
38
|
productSelected: {
|
|
39
|
-
|
|
40
|
-
article_status: "AP",
|
|
41
|
-
datasheet_status: "NS",
|
|
42
|
-
description_status: "NS",
|
|
43
|
-
images_status: "AP",
|
|
44
|
-
prio: "none",
|
|
45
|
-
version: 19,
|
|
39
|
+
version: 1,
|
|
46
40
|
brand: null,
|
|
41
|
+
missing: {
|
|
42
|
+
datasheet: null,
|
|
43
|
+
descriptions: null,
|
|
44
|
+
images: null
|
|
45
|
+
},
|
|
47
46
|
article: {
|
|
48
|
-
category: "
|
|
49
|
-
company_name: "
|
|
50
|
-
|
|
51
|
-
id_category: "
|
|
52
|
-
id_article:
|
|
53
|
-
name: "
|
|
54
|
-
upc: "
|
|
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"
|
|
55
54
|
},
|
|
55
|
+
asignations: [62],
|
|
56
56
|
retailers: [{
|
|
57
57
|
id: 58,
|
|
58
|
-
name: "The Home Depot Golden"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, {
|
|
63
|
-
id: 60,
|
|
64
|
-
name: "The Home Depot Resizing"
|
|
65
|
-
}, {
|
|
66
|
-
id: 61,
|
|
67
|
-
name: "Home Depot TAB"
|
|
58
|
+
name: "The Home Depot Golden",
|
|
59
|
+
country: "México",
|
|
60
|
+
id_region: 1,
|
|
61
|
+
active: 1
|
|
68
62
|
}],
|
|
69
|
-
services: {
|
|
70
|
-
datasheets: 0,
|
|
71
|
-
descriptions: 0,
|
|
72
|
-
images: 1
|
|
73
|
-
},
|
|
74
|
-
id_article: 55109,
|
|
75
63
|
retailersAvailable: [{
|
|
76
64
|
id: 58,
|
|
77
|
-
name: "The Home Depot Golden"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
65
|
+
name: "The Home Depot Golden",
|
|
66
|
+
country: "México",
|
|
67
|
+
id_region: 1,
|
|
68
|
+
active: 1
|
|
69
|
+
}],
|
|
70
|
+
upc: "85369",
|
|
71
|
+
name: "ADOQUIN ROJO 20X 40 X 6",
|
|
72
|
+
categoryName: "MATERIALES DE CONSTRUCCIÓN|BÁSICOS DE CONSTRUCCIÓN|ADOQUINES",
|
|
73
|
+
id_category: "2578",
|
|
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
|
|
87
83
|
}]
|
|
88
84
|
},
|
|
89
85
|
productToEdit: {
|
|
90
|
-
ArticleId:
|
|
91
|
-
idCategory: "
|
|
86
|
+
ArticleId: 24,
|
|
87
|
+
idCategory: "2578",
|
|
92
88
|
product: {
|
|
93
|
-
|
|
94
|
-
article_status: "AP",
|
|
95
|
-
datasheet_status: "NS",
|
|
96
|
-
description_status: "NS",
|
|
97
|
-
images_status: "AP",
|
|
98
|
-
prio: "none",
|
|
99
|
-
version: 19,
|
|
89
|
+
version: 1,
|
|
100
90
|
brand: null,
|
|
91
|
+
missing: {
|
|
92
|
+
datasheet: null,
|
|
93
|
+
descriptions: null,
|
|
94
|
+
images: null
|
|
95
|
+
},
|
|
101
96
|
article: {
|
|
102
|
-
category: "
|
|
103
|
-
company_name: "
|
|
104
|
-
|
|
105
|
-
id_category: "
|
|
106
|
-
id_article:
|
|
107
|
-
name: "
|
|
108
|
-
upc: "
|
|
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"
|
|
109
104
|
},
|
|
105
|
+
asignations: [62],
|
|
110
106
|
retailers: [{
|
|
111
107
|
id: 58,
|
|
112
|
-
name: "The Home Depot Golden"
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}, {
|
|
117
|
-
id: 60,
|
|
118
|
-
name: "The Home Depot Resizing"
|
|
119
|
-
}, {
|
|
120
|
-
id: 61,
|
|
121
|
-
name: "Home Depot TAB"
|
|
108
|
+
name: "The Home Depot Golden",
|
|
109
|
+
country: "México",
|
|
110
|
+
id_region: 1,
|
|
111
|
+
active: 1
|
|
122
112
|
}],
|
|
123
|
-
services: {
|
|
124
|
-
datasheets: 0,
|
|
125
|
-
descriptions: 0,
|
|
126
|
-
images: 1
|
|
127
|
-
},
|
|
128
|
-
id_article: 55109,
|
|
129
113
|
retailersAvailable: [{
|
|
130
114
|
id: 58,
|
|
131
|
-
name: "The Home Depot Golden"
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
|
141
133
|
}]
|
|
142
134
|
}
|
|
143
135
|
},
|
|
@@ -146,40 +138,38 @@ ProviderProductEditionDefault.args = {
|
|
|
146
138
|
articleId: 109485,
|
|
147
139
|
versionId: 3
|
|
148
140
|
},
|
|
149
|
-
state: {
|
|
150
|
-
origin: "RequestWithContentoh"
|
|
151
|
-
}
|
|
141
|
+
state: {}
|
|
152
142
|
},
|
|
153
143
|
user: {
|
|
154
|
-
id_user:
|
|
155
|
-
name: "
|
|
156
|
-
last_name: "
|
|
157
|
-
email: "
|
|
158
|
-
position: "
|
|
144
|
+
id_user: 59,
|
|
145
|
+
name: "The Home",
|
|
146
|
+
last_name: "Depot",
|
|
147
|
+
email: "cadena.ismael@allfreemail.net",
|
|
148
|
+
position: "Admin",
|
|
159
149
|
telephone: "+523111366336",
|
|
160
150
|
country: "México",
|
|
161
|
-
id_company:
|
|
162
|
-
id_cognito: "
|
|
151
|
+
id_company: 7,
|
|
152
|
+
id_cognito: "5884ae34-59d6-4454-b98e-821518bcc3a7",
|
|
163
153
|
birth_Date: null,
|
|
164
154
|
about_me: null,
|
|
165
155
|
zip_code: null,
|
|
166
156
|
address: null,
|
|
167
157
|
job: null,
|
|
168
|
-
id_stripe: "
|
|
158
|
+
id_stripe: "",
|
|
169
159
|
id_role: 0,
|
|
170
160
|
active: 1,
|
|
171
|
-
is_retailer:
|
|
161
|
+
is_retailer: 1,
|
|
172
162
|
membership: {
|
|
173
|
-
id:
|
|
174
|
-
start_date: "
|
|
175
|
-
end_date: "
|
|
176
|
-
planID:
|
|
177
|
-
plan: "
|
|
178
|
-
name: "Plan
|
|
179
|
-
user_limit: "
|
|
180
|
-
products_limit: "
|
|
163
|
+
id: 24,
|
|
164
|
+
start_date: "2021-11-23T03:35:50.000Z",
|
|
165
|
+
end_date: "2022-11-23T03:35:50.000Z",
|
|
166
|
+
planID: 9,
|
|
167
|
+
plan: "prod_KtlkzZVGq6bRTO",
|
|
168
|
+
name: "Plan Enterprise Full",
|
|
169
|
+
user_limit: "30",
|
|
170
|
+
products_limit: "10000",
|
|
181
171
|
type: "Enterprise"
|
|
182
172
|
},
|
|
183
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
173
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-59/59.png?1655750711586"
|
|
184
174
|
}
|
|
185
175
|
};
|
|
@@ -479,7 +479,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
479
479
|
services = _context2.sent;
|
|
480
480
|
//Converts the data inside the datasheets object to array
|
|
481
481
|
setServices(services);
|
|
482
|
-
getServices();
|
|
482
|
+
getServices();
|
|
483
|
+
|
|
484
|
+
if (!originProp) {
|
|
485
|
+
setActiveRetailer(product.retailers[0] || product.availableRetailers[0]);
|
|
486
|
+
} //setActiveRetailer(product?.retailers[0]);
|
|
487
|
+
|
|
483
488
|
|
|
484
489
|
setImages({
|
|
485
490
|
action: "init",
|
|
@@ -493,7 +498,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
493
498
|
});
|
|
494
499
|
setLoading(false);
|
|
495
500
|
|
|
496
|
-
case
|
|
501
|
+
case 10:
|
|
497
502
|
case "end":
|
|
498
503
|
return _context2.stop();
|
|
499
504
|
}
|
|
@@ -552,24 +557,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
552
557
|
};
|
|
553
558
|
}();
|
|
554
559
|
|
|
555
|
-
var translateConcept = function translateConcept(concept) {
|
|
556
|
-
var translation = "";
|
|
557
|
-
|
|
558
|
-
if (concept === "datasheet") {
|
|
559
|
-
translation = "Ficha técnica";
|
|
560
|
-
} else if (concept === "description") {
|
|
561
|
-
translation = "Descripción";
|
|
562
|
-
} else if (concept === "images") {
|
|
563
|
-
translation = "Imágenes";
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
return translation;
|
|
567
|
-
};
|
|
568
|
-
|
|
569
560
|
var isRevision = function isRevision() {
|
|
570
561
|
if (productEdit) {
|
|
571
562
|
var concept = getConcept(activeTab);
|
|
572
|
-
|
|
563
|
+
|
|
564
|
+
var _isRetailer = user.is_retailer === 1;
|
|
565
|
+
|
|
573
566
|
var currentService = productEdit === null || productEdit === void 0 ? void 0 : productEdit.product["".concat(concept, "_status")];
|
|
574
567
|
var orgn = origin[activeTab];
|
|
575
568
|
|
|
@@ -692,7 +685,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
692
685
|
setProduct(productTemp);
|
|
693
686
|
setActivePercentage((_retailers$ = retailers[0]) === null || _retailers$ === void 0 ? void 0 : _retailers$.percentage);
|
|
694
687
|
}, [percentages]);
|
|
695
|
-
|
|
688
|
+
|
|
689
|
+
var loadInputs = function loadInputs() {
|
|
696
690
|
if (services.length > 0) {
|
|
697
691
|
var _services$0$activeRet, _services$2, _services$3;
|
|
698
692
|
|
|
@@ -708,7 +702,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
708
702
|
setDatasheets([datagroups, inputs]);
|
|
709
703
|
setDescriptions(_descriptions);
|
|
710
704
|
}
|
|
711
|
-
}
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
(0, _react.useEffect)(function () {
|
|
708
|
+
loadInputs();
|
|
709
|
+
}, [servicesData, activeRetailer, services]);
|
|
712
710
|
|
|
713
711
|
var thumbs = function thumbs() {
|
|
714
712
|
var _images$imageType, _images$imagePackagin, _images$values;
|
|
@@ -1029,41 +1027,6 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1029
1027
|
}, _callee9, null, [[2, 10]]);
|
|
1030
1028
|
})), [dataImages, imagesUploaded]);
|
|
1031
1029
|
|
|
1032
|
-
var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {// const srv = servicesData.filter((serv) => serv.service === getConcept(tab));
|
|
1033
|
-
// const [srvActive] = srv.filter(
|
|
1034
|
-
// (serv) => serv.id_retailer === activeRetailer?.id
|
|
1035
|
-
// );
|
|
1036
|
-
// const unvalidated =
|
|
1037
|
-
// product[`${getConcept(tab)}_status`] === "QF" ||
|
|
1038
|
-
// product[`${getConcept(tab)}_status`] === "IN_PROGRESS";
|
|
1039
|
-
// switch (userId) {
|
|
1040
|
-
// case 7:
|
|
1041
|
-
// case 8:
|
|
1042
|
-
// return (
|
|
1043
|
-
// (["RA", "RF"].includes(product?.status) &&
|
|
1044
|
-
// statusArray.includes(srvActive?.status)) ||
|
|
1045
|
-
// (statusArray.includes(product.status) &&
|
|
1046
|
-
// srv.filter((serv) => statusArray.includes(serv.status)).length ===
|
|
1047
|
-
// srv.length)
|
|
1048
|
-
// );
|
|
1049
|
-
// case 4:
|
|
1050
|
-
// case 5:
|
|
1051
|
-
// return (
|
|
1052
|
-
// unvalidated &&
|
|
1053
|
-
// ["IN_PROGRESS", "QF"].includes(product.status) &&
|
|
1054
|
-
// srv.filter((serv) => statusArray.includes(serv.status)).length ===
|
|
1055
|
-
// srv.length
|
|
1056
|
-
// );
|
|
1057
|
-
// case 6:
|
|
1058
|
-
// return (
|
|
1059
|
-
// statusArray.includes(product.status) &&
|
|
1060
|
-
// servicesData.every((serv) => ["RA", "AA"].includes(serv.status))
|
|
1061
|
-
// );
|
|
1062
|
-
// default:
|
|
1063
|
-
// break;
|
|
1064
|
-
// }
|
|
1065
|
-
};
|
|
1066
|
-
|
|
1067
1030
|
var getConcept = function getConcept(tab) {
|
|
1068
1031
|
switch (tab) {
|
|
1069
1032
|
case "Descripción":
|
|
@@ -1075,24 +1038,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1075
1038
|
case "Imágenes":
|
|
1076
1039
|
return "images";
|
|
1077
1040
|
}
|
|
1078
|
-
};
|
|
1079
|
-
// let concept = getConcept(activeTab);
|
|
1080
|
-
// concept = action ? action : concept;
|
|
1081
|
-
// const [retailerStatus] = servicesData.filter(
|
|
1082
|
-
// (srv) => srv.id_retailer === activeRetailer?.id && srv.service === concept
|
|
1083
|
-
// );
|
|
1084
|
-
// return (
|
|
1085
|
-
// (retailerStatus?.status === "QF" &&
|
|
1086
|
-
// (user.id_role === 1 || user.id_role === 4 || user.id_role === 5)) ||
|
|
1087
|
-
// (retailerStatus?.status === "AF" && //sessionStorage product
|
|
1088
|
-
// (user.id_role === 1 || user.id_role === 6)) ||
|
|
1089
|
-
// (retailerStatus?.status === "RP" &&
|
|
1090
|
-
// (user.id_role === 1 || user.id_role === 6)) ||
|
|
1091
|
-
// (retailerStatus?.status === "RC" &&
|
|
1092
|
-
// (user.id_role === 1 || user.id_role === 6))
|
|
1093
|
-
// );
|
|
1094
|
-
// };
|
|
1095
|
-
|
|
1041
|
+
};
|
|
1096
1042
|
|
|
1097
1043
|
var getSectionIcon = function getSectionIcon() {
|
|
1098
1044
|
switch (activeTab) {
|
|
@@ -1111,131 +1057,6 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1111
1057
|
default:
|
|
1112
1058
|
break;
|
|
1113
1059
|
}
|
|
1114
|
-
}; // const sendToFacilitator = async (result) => {
|
|
1115
|
-
// setLoading(true);
|
|
1116
|
-
// try {
|
|
1117
|
-
// let concept = getConcept(activeTab);
|
|
1118
|
-
// let productTemp = { ...product };
|
|
1119
|
-
// let evalStatus = product[`${concept}_status`];
|
|
1120
|
-
// let data = {};
|
|
1121
|
-
// if (result) {
|
|
1122
|
-
// //updateCompaniesList(evalStatus, result, activeRetailer.id, concept);
|
|
1123
|
-
// data = {
|
|
1124
|
-
// articleId: product.id_article,
|
|
1125
|
-
// orderId: product.orderId,
|
|
1126
|
-
// concept: concept,
|
|
1127
|
-
// result: result,
|
|
1128
|
-
// evalStatus: evalStatus,
|
|
1129
|
-
// retailerId: activeRetailer.id,
|
|
1130
|
-
// };
|
|
1131
|
-
// await axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
1132
|
-
// headers: {
|
|
1133
|
-
// Authorization: token,
|
|
1134
|
-
// },
|
|
1135
|
-
// });
|
|
1136
|
-
// getServices();
|
|
1137
|
-
// } else {
|
|
1138
|
-
// const specialistDone =
|
|
1139
|
-
// evalStatus === "RF" ||
|
|
1140
|
-
// evalStatus === "RA" ||
|
|
1141
|
-
// evalStatus === "IN_PROGRESS";
|
|
1142
|
-
// if (specialistDone) {
|
|
1143
|
-
// setMessage(`${activeTab} enviada a facilitador`);
|
|
1144
|
-
// getSectionIcon();
|
|
1145
|
-
// } else if (evalStatus === "QF") {
|
|
1146
|
-
// setMessage("Evaluación enviada");
|
|
1147
|
-
// getSectionIcon();
|
|
1148
|
-
// } else if (evalStatus === "AF") {
|
|
1149
|
-
// setMessage("Evaluación enviada");
|
|
1150
|
-
// getSectionIcon();
|
|
1151
|
-
// } else if (evalStatus === "RP") {
|
|
1152
|
-
// setMessage("Evaluación enviada");
|
|
1153
|
-
// getSectionIcon();
|
|
1154
|
-
// } else if (evalStatus === "RC") {
|
|
1155
|
-
// setMessage("Evaluación enviada");
|
|
1156
|
-
// getSectionIcon();
|
|
1157
|
-
// }
|
|
1158
|
-
// let statusArr = [];
|
|
1159
|
-
// servicesData.forEach((srv) => {
|
|
1160
|
-
// srv.service === concept && statusArr.push(srv.status);
|
|
1161
|
-
// });
|
|
1162
|
-
// productTemp[`${concept}_status`] = getNewStatus(statusArr);
|
|
1163
|
-
// let newStatus = getNewStatus([
|
|
1164
|
-
// productTemp.datasheet_status,
|
|
1165
|
-
// productTemp.description_status,
|
|
1166
|
-
// productTemp.images_status,
|
|
1167
|
-
// ]);
|
|
1168
|
-
// productTemp.status = newStatus;
|
|
1169
|
-
// data = {
|
|
1170
|
-
// articleId: product.id_article,
|
|
1171
|
-
// orderId: product.orderId,
|
|
1172
|
-
// concept: concept,
|
|
1173
|
-
// evalStatus: evalStatus,
|
|
1174
|
-
// retailerId: activeRetailer.id,
|
|
1175
|
-
// };
|
|
1176
|
-
// switch (user.id_role) {
|
|
1177
|
-
// case 7:
|
|
1178
|
-
// case 8:
|
|
1179
|
-
// data.especialist = true;
|
|
1180
|
-
// break;
|
|
1181
|
-
// case 4:
|
|
1182
|
-
// case 5:
|
|
1183
|
-
// data.facilitator = true;
|
|
1184
|
-
// break;
|
|
1185
|
-
// default:
|
|
1186
|
-
// break;
|
|
1187
|
-
// }
|
|
1188
|
-
// await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
1189
|
-
// headers: {
|
|
1190
|
-
// Authorization: token,
|
|
1191
|
-
// },
|
|
1192
|
-
// });
|
|
1193
|
-
// getServices();
|
|
1194
|
-
// }
|
|
1195
|
-
// sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1196
|
-
// setProduct(productTemp);
|
|
1197
|
-
// } catch (error) {
|
|
1198
|
-
// console.log(error);
|
|
1199
|
-
// }
|
|
1200
|
-
// setLoading(false);
|
|
1201
|
-
// };
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
var userAssigned = function userAssigned(tab, rol) {
|
|
1205
|
-
var concept = "";
|
|
1206
|
-
|
|
1207
|
-
switch (tab) {
|
|
1208
|
-
case "Ficha técnica":
|
|
1209
|
-
concept = "datasheet";
|
|
1210
|
-
break;
|
|
1211
|
-
|
|
1212
|
-
case "Imágenes":
|
|
1213
|
-
concept = "images";
|
|
1214
|
-
break;
|
|
1215
|
-
|
|
1216
|
-
default:
|
|
1217
|
-
concept = "description";
|
|
1218
|
-
break;
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
var allowedRoles = [1, 4, 5, 6, 7, 8];
|
|
1222
|
-
var validUser = allowedRoles.indexOf(user === null || user === void 0 ? void 0 : user.id_role) !== -1;
|
|
1223
|
-
|
|
1224
|
-
if (!rol) {
|
|
1225
|
-
switch (user.id_role) {
|
|
1226
|
-
case 4:
|
|
1227
|
-
case 5:
|
|
1228
|
-
rol = "facilitator";
|
|
1229
|
-
break;
|
|
1230
|
-
|
|
1231
|
-
case 7:
|
|
1232
|
-
case 8:
|
|
1233
|
-
rol = "especialist";
|
|
1234
|
-
break;
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
return true;
|
|
1239
1060
|
};
|
|
1240
1061
|
|
|
1241
1062
|
var createComment = /*#__PURE__*/function () {
|
|
@@ -1290,64 +1111,6 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1290
1111
|
};
|
|
1291
1112
|
}();
|
|
1292
1113
|
|
|
1293
|
-
var getRequired = function getRequired(services) {
|
|
1294
|
-
var _services$4, _services$4$retailerM, _services$5, _services$5$inputs;
|
|
1295
|
-
|
|
1296
|
-
var objetcTemp = {};
|
|
1297
|
-
var datasheetServicesArray = Object.values(services[0]);
|
|
1298
|
-
var dsInputs = datasheetServicesArray.pop();
|
|
1299
|
-
var descriptionsServicesArray = services[1];
|
|
1300
|
-
var dsInputsRequired = [];
|
|
1301
|
-
var desInputsRequired = 0;
|
|
1302
|
-
datasheetServicesArray.forEach(function (datasheet) {
|
|
1303
|
-
var _servicesData$filter = servicesData.filter(function (srv) {
|
|
1304
|
-
return srv.id_retailer === datasheet.retailer.id && srv.service === getConcept(activeTab);
|
|
1305
|
-
}),
|
|
1306
|
-
_servicesData$filter2 = (0, _slicedToArray2.default)(_servicesData$filter, 1),
|
|
1307
|
-
requested = _servicesData$filter2[0];
|
|
1308
|
-
|
|
1309
|
-
requested && Object.values(datasheet === null || datasheet === void 0 ? void 0 : datasheet.data).forEach(function (dataGroup) {
|
|
1310
|
-
return dsInputsRequired.push.apply(dsInputsRequired, (0, _toConsumableArray2.default)(dataGroup.inputs.filter(function (input) {
|
|
1311
|
-
return dsInputs[input].required && (dsInputs[input].value === undefined || !dsInputs[input].value);
|
|
1312
|
-
})));
|
|
1313
|
-
});
|
|
1314
|
-
});
|
|
1315
|
-
objetcTemp["Ficha técnica"] = dsInputsRequired.length;
|
|
1316
|
-
descriptionsServicesArray.forEach(function (description) {
|
|
1317
|
-
var _servicesData$filter3 = servicesData.filter(function (srv) {
|
|
1318
|
-
return srv.id_retailer === description.id && srv.service === getConcept(activeTab);
|
|
1319
|
-
}),
|
|
1320
|
-
_servicesData$filter4 = (0, _slicedToArray2.default)(_servicesData$filter3, 1),
|
|
1321
|
-
requested = _servicesData$filter4[0];
|
|
1322
|
-
|
|
1323
|
-
requested && description.inputs.forEach(function (input) {
|
|
1324
|
-
return input.required && (!input.value || input.value.replace(/(<\/?p>)|(<\/?strong>)|(<br>)/gm, "") === "") && desInputsRequired++;
|
|
1325
|
-
});
|
|
1326
|
-
});
|
|
1327
|
-
objetcTemp["Descripción"] = desInputsRequired;
|
|
1328
|
-
var retailersRequested = [];
|
|
1329
|
-
(_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) {
|
|
1330
|
-
return retMan.forEach(function (rm) {
|
|
1331
|
-
return retailersRequested.push(rm);
|
|
1332
|
-
});
|
|
1333
|
-
});
|
|
1334
|
-
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) {
|
|
1335
|
-
return e.required === 1 && retailersRequested.filter(function (ret) {
|
|
1336
|
-
return ret.id_image === e.id && servicesData.filter(function (srv) {
|
|
1337
|
-
return srv.id_retailer === ret.id_retailer;
|
|
1338
|
-
}).length > 0;
|
|
1339
|
-
}).length > 0;
|
|
1340
|
-
});
|
|
1341
|
-
var requiredCounter = 0;
|
|
1342
|
-
requiredImages === null || requiredImages === void 0 ? void 0 : requiredImages.forEach(function (req) {
|
|
1343
|
-
return services[2].values.filter(function (img) {
|
|
1344
|
-
return img.image_id === req.id;
|
|
1345
|
-
}).length === 0 && requiredCounter++;
|
|
1346
|
-
});
|
|
1347
|
-
objetcTemp["Imágenes"] = requiredCounter;
|
|
1348
|
-
setRequiredNull(objetcTemp);
|
|
1349
|
-
};
|
|
1350
|
-
|
|
1351
1114
|
(0, _react.useEffect)(function () {
|
|
1352
1115
|
setComment(comments[activeTab]);
|
|
1353
1116
|
}, [activeTab]);
|
|
@@ -1552,25 +1315,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1552
1315
|
}
|
|
1553
1316
|
|
|
1554
1317
|
return product["".concat(concept, "_status")] === "IN_PROGRESS" || product["".concat(concept, "_status")] === "RF" || product["".concat(concept, "_status")] === "RA";
|
|
1555
|
-
};
|
|
1556
|
-
// const arr = servicesData?.slice();
|
|
1557
|
-
// let concept = getConcept(tab);
|
|
1558
|
-
// let retailerService = {};
|
|
1559
|
-
// [retailerService] = arr?.filter(
|
|
1560
|
-
// (service) =>
|
|
1561
|
-
// service.id_retailer === activeRetailer?.id &&
|
|
1562
|
-
// service.service === concept
|
|
1563
|
-
// );
|
|
1564
|
-
// return retailerService ? retailerService.status : "NA";
|
|
1565
|
-
// };
|
|
1566
|
-
// useEffect(() => {
|
|
1567
|
-
// let status = getRetailerStatus(servicesData, activeTab);
|
|
1568
|
-
// setRetailerStatus(status);
|
|
1569
|
-
// }, [activeTab, servicesData, activeRetailer]);
|
|
1570
|
-
// useEffect(() => {
|
|
1571
|
-
// services.length > 0 && getRequired(services);
|
|
1572
|
-
// }, [services, servicesData, activeTab]);
|
|
1573
|
-
|
|
1318
|
+
};
|
|
1574
1319
|
|
|
1575
1320
|
var confirmStatusComplete = function confirmStatusComplete() {
|
|
1576
1321
|
var datasheet_status = product.datasheet_status,
|
|
@@ -1965,7 +1710,15 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1965
1710
|
children: "Los atributos son requeridos por las plataformas de las cadenas, es muy importante completar los campos requeridos ya que pueden rechazar el producto por falta de informaci\xF3n."
|
|
1966
1711
|
})
|
|
1967
1712
|
}), inCart ? /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
1968
|
-
type: "button"
|
|
1713
|
+
type: "button",
|
|
1714
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactRouterDom.Link, {
|
|
1715
|
+
to: "/checkout",
|
|
1716
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
1717
|
+
children: "Articulo en carrito"
|
|
1718
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
1719
|
+
children: "Ir a checkout"
|
|
1720
|
+
})]
|
|
1721
|
+
})
|
|
1969
1722
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1970
1723
|
onClick: function onClick() {
|
|
1971
1724
|
setShowContentohRequestModal && setShowContentohRequestModal(true);
|