contentoh-components-library 21.3.39 → 21.3.41
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/ButtonV2/styles.js +1 -1
- package/dist/components/atoms/Status/styles.js +1 -1
- package/dist/components/atoms/VerticalSideMenuMainPage/index.js +18 -23
- package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +4 -4
- package/dist/components/organisms/GlobalModal/styles.js +1 -1
- package/dist/components/organisms/TableResizable/index.js +6 -10
- package/dist/components/pages/Dashboard/Dashboard.stories.js +31 -50
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +138 -52
- package/dist/components/pages/ProviderProductEdition/index.js +191 -202
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +82 -118
- package/dist/components/pages/RetailerProductEdition/index.js +1 -1
- package/package.json +1 -1
- package/src/components/atoms/ButtonV2/styles.js +1 -1
- package/src/components/atoms/Status/styles.js +4 -0
- package/src/components/atoms/VerticalSideMenuMainPage/index.js +18 -22
- package/src/components/atoms/VerticalSideMenuMainPage/styles.js +3 -4
- package/src/components/organisms/GlobalModal/styles.js +10 -0
- package/src/components/organisms/TableResizable/index.js +0 -2
- package/src/components/pages/Dashboard/Dashboard.stories.js +31 -55
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +157 -58
- package/src/components/pages/ProviderProductEdition/index.js +119 -121
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +87 -127
- package/src/components/pages/RetailerProductEdition/index.js +1 -1
|
@@ -16,20 +16,58 @@ ProviderProductEditionDefault.args = {
|
|
|
16
16
|
Imágenes: false,
|
|
17
17
|
},
|
|
18
18
|
token:
|
|
19
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.
|
|
19
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI1ODg0YWUzNC01OWQ2LTQ0NTQtYjk4ZS04MjE1MThiY2MzYTciLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6IjU4ODRhZTM0LTU5ZDYtNDQ1NC1iOThlLTgyMTUxOGJjYzNhNyIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJkMmY0ZTZmNC1jYmM4LTQ5NTItODMyYi0yYTNlNzBlOTM0ZjAiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY4MjAyNDQ4OCwibmFtZSI6IkNhZGVuYSBJc21hZWwiLCJwaG9uZV9udW1iZXIiOiIrNTIzMTExMzY2MzM2IiwiZXhwIjoxNjgyMDI4MDg4LCJpYXQiOjE2ODIwMjQ0ODgsImVtYWlsIjoiY2FkZW5hLmlzbWFlbEBhbGxmcmVlbWFpbC5uZXQifQ.eTJuJXGjCEOcOzJreoJQ3GA_3a7-7IR5sojvBwyEp360Z_Nd7LNDAA605jkRTx2c39zk9o3hkgzEZsK6RYwFrB-jOqlFA7E3dvkCaDC0fh6V1tAY3nKWvFE13VHMj08WAPmQOtr2glpzv0vcCNilOmbw8-D7E7zb2K6R63YdVyC1mSVPvlqJaecBVmiWu5OoHDRFjfdkx-tnxQacm3YeuqYPHho4hy18xU4NG4SmeqXQmuBD8lGMZuZ5Kkr9tkjgEQzjaY5wUik6MWDc43xG5pMhXsuluUnwxPWo3V4tc7MKsml6T6solr31JlL5qsVc4trqWMkLG2bbtUzRRxUUXg",
|
|
20
20
|
articleId: 238,
|
|
21
21
|
category: 846,
|
|
22
22
|
version: 2,
|
|
23
23
|
productSelected: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
orderId: 15160,
|
|
25
|
+
article_status: "RAC",
|
|
26
|
+
datasheet_status: "AAC",
|
|
27
|
+
description_status: "RAC",
|
|
28
|
+
images_status: "AAC",
|
|
29
|
+
prio: "none",
|
|
30
|
+
version: 7,
|
|
31
|
+
brand: null,
|
|
32
|
+
article: {
|
|
33
|
+
category: "Puertas y Ventanas|Molduras|Molduras Madera Blanda",
|
|
34
|
+
company_name: "Demo",
|
|
35
|
+
id_company: 924,
|
|
36
|
+
country: "México",
|
|
37
|
+
id_category: "2366",
|
|
38
|
+
id_article: 39290,
|
|
39
|
+
name: "MOLDURA MARCO MODER 11X4X244 CM",
|
|
40
|
+
upc: "100030",
|
|
41
|
+
},
|
|
42
|
+
retailers: [
|
|
43
|
+
{
|
|
44
|
+
id: 58,
|
|
45
|
+
name: "The Home Depot Golden",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 68,
|
|
49
|
+
name: "The Home Depot Merchants",
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
services: {
|
|
53
|
+
datasheets: 1,
|
|
54
|
+
descriptions: 1,
|
|
55
|
+
images: 1,
|
|
56
|
+
},
|
|
57
|
+
statusByRetailer: {
|
|
58
|
+
58: {
|
|
59
|
+
datasheet: "AAC",
|
|
60
|
+
description: "RAC",
|
|
61
|
+
images: "AAC",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
retailersWithService: ["58"],
|
|
65
|
+
id_article: 39290,
|
|
32
66
|
retailersAvailable: [
|
|
67
|
+
{
|
|
68
|
+
id: 58,
|
|
69
|
+
name: "The Home Depot Golden",
|
|
70
|
+
},
|
|
33
71
|
{
|
|
34
72
|
id: 68,
|
|
35
73
|
name: "The Home Depot Merchants",
|
|
@@ -37,26 +75,62 @@ ProviderProductEditionDefault.args = {
|
|
|
37
75
|
],
|
|
38
76
|
},
|
|
39
77
|
productToEdit: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
product:
|
|
43
|
-
|
|
44
|
-
|
|
78
|
+
ArticleId: 39290,
|
|
79
|
+
idCategory: "2366",
|
|
80
|
+
product: {
|
|
81
|
+
orderId: 15160,
|
|
82
|
+
article_status: "RAC",
|
|
83
|
+
datasheet_status: "AAC",
|
|
84
|
+
description_status: "RAC",
|
|
85
|
+
images_status: "AAC",
|
|
86
|
+
prio: "none",
|
|
87
|
+
version: 7,
|
|
88
|
+
brand: null,
|
|
89
|
+
article: {
|
|
90
|
+
category: "Puertas y Ventanas|Molduras|Molduras Madera Blanda",
|
|
45
91
|
company_name: "Demo",
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
retailersAvailable: [
|
|
53
|
-
{
|
|
54
|
-
id: 68,
|
|
55
|
-
name: "The Home Depot Merchants",
|
|
56
|
-
},
|
|
57
|
-
],
|
|
92
|
+
id_company: 924,
|
|
93
|
+
country: "México",
|
|
94
|
+
id_category: "2366",
|
|
95
|
+
id_article: 39290,
|
|
96
|
+
name: "MOLDURA MARCO MODER 11X4X244 CM",
|
|
97
|
+
upc: "100030",
|
|
58
98
|
},
|
|
59
|
-
|
|
99
|
+
retailers: [
|
|
100
|
+
{
|
|
101
|
+
id: 58,
|
|
102
|
+
name: "The Home Depot Golden",
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 68,
|
|
106
|
+
name: "The Home Depot Merchants",
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
services: {
|
|
110
|
+
datasheets: 1,
|
|
111
|
+
descriptions: 1,
|
|
112
|
+
images: 1,
|
|
113
|
+
},
|
|
114
|
+
statusByRetailer: {
|
|
115
|
+
58: {
|
|
116
|
+
datasheet: "AAC",
|
|
117
|
+
description: "RAC",
|
|
118
|
+
images: "AAC",
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
retailersWithService: ["58"],
|
|
122
|
+
id_article: 39290,
|
|
123
|
+
retailersAvailable: [
|
|
124
|
+
{
|
|
125
|
+
id: 58,
|
|
126
|
+
name: "The Home Depot Golden",
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: 68,
|
|
130
|
+
name: "The Home Depot Merchants",
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
},
|
|
60
134
|
},
|
|
61
135
|
location: {
|
|
62
136
|
pathname: "/EditProducts",
|
|
@@ -68,38 +142,58 @@ ProviderProductEditionDefault.args = {
|
|
|
68
142
|
key: "24vwut",
|
|
69
143
|
},
|
|
70
144
|
user: {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
is_retailer: 1,
|
|
89
|
-
email_notify: 0,
|
|
90
|
-
is_user_tech: null,
|
|
91
|
-
membership: {
|
|
92
|
-
id: 47,
|
|
93
|
-
start_date: "2022-05-25T14:31:12.000Z",
|
|
94
|
-
end_date: "2023-05-25T14:31:12.000Z",
|
|
95
|
-
planID: 5,
|
|
96
|
-
plan: "prod_Ktl6B5Ou2gqTB2",
|
|
97
|
-
name: "Plan Pro",
|
|
98
|
-
user_limit: "5",
|
|
99
|
-
products_limit: "500",
|
|
100
|
-
type: "PyMES",
|
|
145
|
+
orderId: 15160,
|
|
146
|
+
article_status: "RAC",
|
|
147
|
+
datasheet_status: "AAC",
|
|
148
|
+
description_status: "RAC",
|
|
149
|
+
images_status: "AAC",
|
|
150
|
+
prio: "none",
|
|
151
|
+
version: 7,
|
|
152
|
+
brand: null,
|
|
153
|
+
article: {
|
|
154
|
+
category: "Puertas y Ventanas|Molduras|Molduras Madera Blanda",
|
|
155
|
+
company_name: "Demo",
|
|
156
|
+
id_company: 924,
|
|
157
|
+
country: "México",
|
|
158
|
+
id_category: "2366",
|
|
159
|
+
id_article: 39290,
|
|
160
|
+
name: "MOLDURA MARCO MODER 11X4X244 CM",
|
|
161
|
+
upc: "100030",
|
|
101
162
|
},
|
|
102
|
-
|
|
163
|
+
retailers: [
|
|
164
|
+
{
|
|
165
|
+
id: 58,
|
|
166
|
+
name: "The Home Depot Golden",
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: 68,
|
|
170
|
+
name: "The Home Depot Merchants",
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
services: {
|
|
174
|
+
datasheets: 1,
|
|
175
|
+
descriptions: 1,
|
|
176
|
+
images: 1,
|
|
177
|
+
},
|
|
178
|
+
statusByRetailer: {
|
|
179
|
+
58: {
|
|
180
|
+
datasheet: "AAC",
|
|
181
|
+
description: "RAC",
|
|
182
|
+
images: "AAC",
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
retailersWithService: ["58"],
|
|
186
|
+
id_article: 39290,
|
|
187
|
+
retailersAvailable: [
|
|
188
|
+
{
|
|
189
|
+
id: 58,
|
|
190
|
+
name: "The Home Depot Golden",
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
id: 68,
|
|
194
|
+
name: "The Home Depot Merchants",
|
|
195
|
+
},
|
|
196
|
+
],
|
|
103
197
|
},
|
|
104
198
|
company: {
|
|
105
199
|
id_company: 817,
|
|
@@ -144,6 +238,11 @@ ProviderProductEditionDefault.args = {
|
|
|
144
238
|
name: "The Home Depot Merchants",
|
|
145
239
|
country: "México",
|
|
146
240
|
},
|
|
241
|
+
{
|
|
242
|
+
id: 58,
|
|
243
|
+
name: "The Home Depot Golden",
|
|
244
|
+
country: "México",
|
|
245
|
+
},
|
|
147
246
|
],
|
|
148
247
|
},
|
|
149
248
|
showSurvey: (v) => v && alert("se muestra"),
|
|
@@ -42,7 +42,6 @@ import Slide1_4 from "../../../assets/images/sliderToolTip/slide4.svg";
|
|
|
42
42
|
import Slide1_5 from "../../../assets/images/sliderToolTip/slide5.svg";
|
|
43
43
|
import { VersionSelector } from "../../organisms/VersionSelector";
|
|
44
44
|
import { useCloseModal } from "../../../global-files/customHooks";
|
|
45
|
-
import { number } from "prop-types";
|
|
46
45
|
|
|
47
46
|
const reducerImages = (state, action) => {
|
|
48
47
|
let { values, attrForImgs, inputsByRetailer } = state;
|
|
@@ -205,7 +204,6 @@ export const ProviderProductEdition = ({
|
|
|
205
204
|
? JSON.parse(sessionStorage.getItem("productEdit"))
|
|
206
205
|
: productToEdit
|
|
207
206
|
);
|
|
208
|
-
const [icon, setIcon] = useState(null);
|
|
209
207
|
const [version, setVersion] = useState(product?.version);
|
|
210
208
|
const [comments] = useState({});
|
|
211
209
|
const [comment, setComment] = useState("");
|
|
@@ -226,9 +224,6 @@ export const ProviderProductEdition = ({
|
|
|
226
224
|
Imágenes: originProp,
|
|
227
225
|
});
|
|
228
226
|
const [inCart, setInCart] = useState(false);
|
|
229
|
-
const [modalSent, setModalSent] = useState(false);
|
|
230
|
-
const [modalViewError, setModalViewError] = useState(false);
|
|
231
|
-
const [showGenericModal, setShowGenericModal] = useState(false);
|
|
232
227
|
const [dataGenericModal, setDataGenericModal] = useState({
|
|
233
228
|
message: "¿Estás seguro de continuar?",
|
|
234
229
|
detail: ` ${
|
|
@@ -238,7 +233,7 @@ export const ProviderProductEdition = ({
|
|
|
238
233
|
}`,
|
|
239
234
|
button1: {
|
|
240
235
|
name: "Cerrar",
|
|
241
|
-
action: () =>
|
|
236
|
+
action: () => setGlobalModal(),
|
|
242
237
|
},
|
|
243
238
|
button2: {
|
|
244
239
|
name: "Continuar",
|
|
@@ -246,7 +241,6 @@ export const ProviderProductEdition = ({
|
|
|
246
241
|
},
|
|
247
242
|
img: face,
|
|
248
243
|
});
|
|
249
|
-
const [modalViewTextArea, setModalViewTextArea] = useState(false);
|
|
250
244
|
const [socketType, setSocketType] = useState(null);
|
|
251
245
|
const [saving, setSaving] = useState(loading);
|
|
252
246
|
const [retailerStatus, setRetailerStatus] = useState(
|
|
@@ -254,6 +248,109 @@ export const ProviderProductEdition = ({
|
|
|
254
248
|
);
|
|
255
249
|
const [showVersionSelector, setShowVersionSelector] =
|
|
256
250
|
useCloseModal("version-selector");
|
|
251
|
+
const [globalModal, setGlobalModal] = useState();
|
|
252
|
+
|
|
253
|
+
const showGlobalModal = useCallback(
|
|
254
|
+
(type) => {
|
|
255
|
+
const formatter = new Intl.ListFormat("es", { type: "conjunction" });
|
|
256
|
+
switch (type) {
|
|
257
|
+
case "error":
|
|
258
|
+
setGlobalModal({
|
|
259
|
+
message: `${activeTab} rechazada`,
|
|
260
|
+
detail: "Agrega tu comentarios para enviar el rechazo",
|
|
261
|
+
img: errorModal,
|
|
262
|
+
textArea: true,
|
|
263
|
+
button1: {
|
|
264
|
+
name: "Enviar",
|
|
265
|
+
action: (e) => {
|
|
266
|
+
const textArea = document.querySelector("#area");
|
|
267
|
+
if (textArea.value) {
|
|
268
|
+
textArea.style.border = "none";
|
|
269
|
+
createComment(e, textArea.value);
|
|
270
|
+
showGlobalModal("commentsSent");
|
|
271
|
+
validatedAll ? validateAll("R") : sendEvaluation("R");
|
|
272
|
+
} else {
|
|
273
|
+
textArea.style.border = "2px solid red";
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
break;
|
|
279
|
+
case "generic":
|
|
280
|
+
setGlobalModal(dataGenericModal);
|
|
281
|
+
break;
|
|
282
|
+
case "commentsSent":
|
|
283
|
+
setGlobalModal({
|
|
284
|
+
message: "Gracias, tus comentarios fueron entregados.",
|
|
285
|
+
detail: "Trabajaremos en conjunto para resolverlo.",
|
|
286
|
+
button1: {
|
|
287
|
+
name: "Cerrar",
|
|
288
|
+
action: () => setGlobalModal(),
|
|
289
|
+
},
|
|
290
|
+
img: face,
|
|
291
|
+
textArea: false,
|
|
292
|
+
});
|
|
293
|
+
break;
|
|
294
|
+
case "RAC":
|
|
295
|
+
const servicesRejected = [];
|
|
296
|
+
const translateServices = {
|
|
297
|
+
datasheet: '"ficha técnica"',
|
|
298
|
+
description: '"descripción"',
|
|
299
|
+
images: '"imágenes"',
|
|
300
|
+
};
|
|
301
|
+
Object.keys(translateServices).forEach((service) => {
|
|
302
|
+
if (product[`${service}_status`] === "RAC") {
|
|
303
|
+
servicesRejected.push(translateServices[service]);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
const plural = ["Los servicios", "cumplen"];
|
|
307
|
+
const singular = ["El servicio", "cumple"];
|
|
308
|
+
const grammar = servicesRejected.length > 1 ? plural : singular;
|
|
309
|
+
const formatted = formatter.format(servicesRejected);
|
|
310
|
+
const text1 = `${grammar[0]} de ${formatted} no ${grammar[1]} con lo que la cadena necesita.`;
|
|
311
|
+
const text2 = `¡Solicita el servicio de Content-oh! para completarlo!`;
|
|
312
|
+
setGlobalModal({
|
|
313
|
+
message:
|
|
314
|
+
"Tu producto no cumple con los requerimientos de la cadena",
|
|
315
|
+
customComponent: (
|
|
316
|
+
<>
|
|
317
|
+
<p className="generic-text">
|
|
318
|
+
{text1}
|
|
319
|
+
<br />
|
|
320
|
+
<br />
|
|
321
|
+
{text2}
|
|
322
|
+
</p>
|
|
323
|
+
</>
|
|
324
|
+
),
|
|
325
|
+
button1: {
|
|
326
|
+
name: "Continuar",
|
|
327
|
+
action: () => setGlobalModal(),
|
|
328
|
+
},
|
|
329
|
+
button2: {
|
|
330
|
+
name: "Solicitar a Content-oh!",
|
|
331
|
+
action: () => setGlobalModal(),
|
|
332
|
+
},
|
|
333
|
+
img: face,
|
|
334
|
+
});
|
|
335
|
+
break;
|
|
336
|
+
case "AAC":
|
|
337
|
+
setGlobalModal({
|
|
338
|
+
message: "Felicidades",
|
|
339
|
+
detail: "Tu producto cumple con los requerimientos de la cadena.",
|
|
340
|
+
button1: {
|
|
341
|
+
name: "Continuar",
|
|
342
|
+
action: () => setGlobalModal(),
|
|
343
|
+
},
|
|
344
|
+
img: face,
|
|
345
|
+
});
|
|
346
|
+
break;
|
|
347
|
+
default:
|
|
348
|
+
setGlobalModal();
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
[activeTab, dataGenericModal]
|
|
353
|
+
);
|
|
257
354
|
|
|
258
355
|
useEffect(() => {
|
|
259
356
|
checkAll && setSelectedImages(images.values);
|
|
@@ -352,6 +449,8 @@ export const ProviderProductEdition = ({
|
|
|
352
449
|
getCart();
|
|
353
450
|
fetchUsers(token).then((res) => setUserGroups(res));
|
|
354
451
|
setImages({ action: "orderImages", retailerId: activeRetailer.id });
|
|
452
|
+
if (["RAC", "AAC"].includes(product.article_status))
|
|
453
|
+
showGlobalModal(product.article_status);
|
|
355
454
|
}, [product, version]);
|
|
356
455
|
|
|
357
456
|
useEffect(() => {
|
|
@@ -618,22 +717,6 @@ export const ProviderProductEdition = ({
|
|
|
618
717
|
}
|
|
619
718
|
};
|
|
620
719
|
|
|
621
|
-
const getSectionIcon = () => {
|
|
622
|
-
switch (activeTab) {
|
|
623
|
-
case "Ficha técnica":
|
|
624
|
-
setIcon(attributesSent);
|
|
625
|
-
break;
|
|
626
|
-
case "Descripción":
|
|
627
|
-
setIcon(descriptionSent);
|
|
628
|
-
break;
|
|
629
|
-
case "Imágenes0,,":
|
|
630
|
-
setIcon(imagesSent);
|
|
631
|
-
break;
|
|
632
|
-
default:
|
|
633
|
-
break;
|
|
634
|
-
}
|
|
635
|
-
};
|
|
636
|
-
|
|
637
720
|
const createComment = async (e, body, tab) => {
|
|
638
721
|
let concept = "";
|
|
639
722
|
switch (activeTab) {
|
|
@@ -716,21 +799,6 @@ export const ProviderProductEdition = ({
|
|
|
716
799
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
717
800
|
};
|
|
718
801
|
|
|
719
|
-
const evaluationComplete = (tab) => {
|
|
720
|
-
const concept = getConcept(tab);
|
|
721
|
-
let serv = servicesData.filter((item) => item.service === concept);
|
|
722
|
-
if (
|
|
723
|
-
["RequestWithContentoh", "RequestWithoutContentoh"].includes(origin[tab])
|
|
724
|
-
) {
|
|
725
|
-
serv = serv.filter((f) => f.id_retailer === activeRetailer.id);
|
|
726
|
-
}
|
|
727
|
-
const statusArray =
|
|
728
|
-
user.is_retailer === 1 ? ["ACA", "RCA"] : ["AP", "RP", "ACA"];
|
|
729
|
-
return (
|
|
730
|
-
serv.length > 0 && serv.every((item) => statusArray.includes(item.status))
|
|
731
|
-
);
|
|
732
|
-
};
|
|
733
|
-
|
|
734
802
|
const downloadImages = () => {
|
|
735
803
|
selectedImages.length > 0
|
|
736
804
|
? selectedImages.forEach((e) => {
|
|
@@ -824,21 +892,6 @@ export const ProviderProductEdition = ({
|
|
|
824
892
|
}
|
|
825
893
|
};
|
|
826
894
|
|
|
827
|
-
const confirmStatusComplete = () => {
|
|
828
|
-
const { datasheet_status, description_status, images_status } = product;
|
|
829
|
-
const completionStates =
|
|
830
|
-
user.is_retailer === 1
|
|
831
|
-
? ["ACA", "Evaluated", "NS"]
|
|
832
|
-
: ["AP", "Evaluated", "NS"];
|
|
833
|
-
const dsEvaluated = completionStates.includes(datasheet_status);
|
|
834
|
-
const descsEvaluated = completionStates.includes(description_status);
|
|
835
|
-
const imgsEvaluated = completionStates.includes(images_status);
|
|
836
|
-
|
|
837
|
-
const AllEvaluated = dsEvaluated && descsEvaluated && imgsEvaluated;
|
|
838
|
-
|
|
839
|
-
return AllEvaluated;
|
|
840
|
-
};
|
|
841
|
-
|
|
842
895
|
const sendEvaluation = async (result) => {
|
|
843
896
|
setLoading(true);
|
|
844
897
|
const concept = getConcept(activeTab);
|
|
@@ -1004,7 +1057,7 @@ export const ProviderProductEdition = ({
|
|
|
1004
1057
|
prod.product.services_status = `["${statusComplete}","${statusComplete}","${statusComplete}"]`;
|
|
1005
1058
|
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
1006
1059
|
setProduct(prod);
|
|
1007
|
-
|
|
1060
|
+
showGlobalModal("generic");
|
|
1008
1061
|
await loadData();
|
|
1009
1062
|
};
|
|
1010
1063
|
|
|
@@ -1075,7 +1128,7 @@ export const ProviderProductEdition = ({
|
|
|
1075
1128
|
action: () => evaluationToRetailer("A"),
|
|
1076
1129
|
},
|
|
1077
1130
|
}));
|
|
1078
|
-
|
|
1131
|
+
showGlobalModal("generic");
|
|
1079
1132
|
} else if (user.is_retailer) {
|
|
1080
1133
|
if (product.id_order || product.orderId) {
|
|
1081
1134
|
sendEvaluation("A");
|
|
@@ -1087,7 +1140,7 @@ export const ProviderProductEdition = ({
|
|
|
1087
1140
|
action: () => evaluationToRetailer("A"),
|
|
1088
1141
|
},
|
|
1089
1142
|
}));
|
|
1090
|
-
|
|
1143
|
+
showGlobalModal("generic");
|
|
1091
1144
|
}
|
|
1092
1145
|
} else {
|
|
1093
1146
|
sendEvaluation("A");
|
|
@@ -1102,7 +1155,7 @@ export const ProviderProductEdition = ({
|
|
|
1102
1155
|
} else if (user.is_retailer) {
|
|
1103
1156
|
if (product.id_order || product.orderId) {
|
|
1104
1157
|
setValidatedAll(true);
|
|
1105
|
-
|
|
1158
|
+
showGlobalModal("error");
|
|
1106
1159
|
} else {
|
|
1107
1160
|
setDataGenericModal((prev) => ({
|
|
1108
1161
|
...prev,
|
|
@@ -1111,11 +1164,11 @@ export const ProviderProductEdition = ({
|
|
|
1111
1164
|
action: () => evaluationToRetailer("R"),
|
|
1112
1165
|
},
|
|
1113
1166
|
}));
|
|
1114
|
-
|
|
1167
|
+
showGlobalModal("generic");
|
|
1115
1168
|
}
|
|
1116
1169
|
} else {
|
|
1117
1170
|
setValidatedAll(true);
|
|
1118
|
-
|
|
1171
|
+
showGlobalModal("error");
|
|
1119
1172
|
}
|
|
1120
1173
|
}
|
|
1121
1174
|
};
|
|
@@ -1174,7 +1227,7 @@ export const ProviderProductEdition = ({
|
|
|
1174
1227
|
action: () => evaluationToRetailer("A"),
|
|
1175
1228
|
},
|
|
1176
1229
|
}));
|
|
1177
|
-
|
|
1230
|
+
showGlobalModal("generic");
|
|
1178
1231
|
} else if (user.is_retailer) {
|
|
1179
1232
|
if (product.id_order || product.orderId) {
|
|
1180
1233
|
validateAll("A");
|
|
@@ -1186,7 +1239,7 @@ export const ProviderProductEdition = ({
|
|
|
1186
1239
|
action: () => evaluationToRetailer("A"),
|
|
1187
1240
|
},
|
|
1188
1241
|
}));
|
|
1189
|
-
|
|
1242
|
+
showGlobalModal("generic");
|
|
1190
1243
|
}
|
|
1191
1244
|
} else {
|
|
1192
1245
|
validateAll("A");
|
|
@@ -1202,7 +1255,7 @@ export const ProviderProductEdition = ({
|
|
|
1202
1255
|
} else if (user.is_retailer) {
|
|
1203
1256
|
if (product.id_order || product.orderId) {
|
|
1204
1257
|
setValidatedAll(true);
|
|
1205
|
-
|
|
1258
|
+
showGlobalModal("error");
|
|
1206
1259
|
} else {
|
|
1207
1260
|
setDataGenericModal((prev) => ({
|
|
1208
1261
|
...prev,
|
|
@@ -1211,11 +1264,11 @@ export const ProviderProductEdition = ({
|
|
|
1211
1264
|
action: () => evaluationToRetailer("R"),
|
|
1212
1265
|
},
|
|
1213
1266
|
}));
|
|
1214
|
-
|
|
1267
|
+
showGlobalModal("generic");
|
|
1215
1268
|
}
|
|
1216
1269
|
} else {
|
|
1217
1270
|
setValidatedAll(true);
|
|
1218
|
-
|
|
1271
|
+
showGlobalModal("error");
|
|
1219
1272
|
}
|
|
1220
1273
|
}}
|
|
1221
1274
|
approve={() => sendToEvaluation("A")}
|
|
@@ -1442,63 +1495,8 @@ export const ProviderProductEdition = ({
|
|
|
1442
1495
|
onClick={() => setMessage("")}
|
|
1443
1496
|
/>
|
|
1444
1497
|
)}
|
|
1445
|
-
{
|
|
1446
|
-
<GlobalModal
|
|
1447
|
-
close={() => setModalSent(false)}
|
|
1448
|
-
message={message}
|
|
1449
|
-
detail={""}
|
|
1450
|
-
bold={!evaluationComplete(activeTab) && "Aprueba / Rechaza"}
|
|
1451
|
-
widthImg={!evaluationComplete(activeTab) ? "160px" : "354px"}
|
|
1452
|
-
heightImg={!evaluationComplete(activeTab) ? "84px" : "354px"}
|
|
1453
|
-
img={getSectionIcon()}
|
|
1454
|
-
/>
|
|
1455
|
-
)}
|
|
1456
|
-
{modalViewError && (
|
|
1457
|
-
<GlobalModal
|
|
1458
|
-
close={() => setModalViewError(false)}
|
|
1459
|
-
message={`${activeTab} rechazada`}
|
|
1460
|
-
detail={"Agrega tu comentarios para enviar el rechazo"}
|
|
1461
|
-
button1={{
|
|
1462
|
-
name: "Enviar",
|
|
1463
|
-
action: (e) => {
|
|
1464
|
-
const textArea = document.querySelector("#area");
|
|
1465
|
-
if (textArea.value) {
|
|
1466
|
-
textArea.style.border = "none";
|
|
1467
|
-
createComment(e, textArea.value);
|
|
1468
|
-
setModalViewError(false);
|
|
1469
|
-
setModalViewTextArea(true);
|
|
1470
|
-
validatedAll ? validateAll("R") : sendEvaluation("R");
|
|
1471
|
-
} else {
|
|
1472
|
-
textArea.style.border = "2px solid red";
|
|
1473
|
-
}
|
|
1474
|
-
},
|
|
1475
|
-
}}
|
|
1476
|
-
img={errorModal}
|
|
1477
|
-
textArea={true}
|
|
1478
|
-
/>
|
|
1479
|
-
)}
|
|
1480
|
-
{showGenericModal && (
|
|
1481
|
-
<GlobalModal
|
|
1482
|
-
close={() => setShowGenericModal(false)}
|
|
1483
|
-
message={dataGenericModal.message}
|
|
1484
|
-
detail={dataGenericModal.detail}
|
|
1485
|
-
button1={dataGenericModal.button1}
|
|
1486
|
-
button2={dataGenericModal.button2}
|
|
1487
|
-
img={dataGenericModal.img}
|
|
1488
|
-
/>
|
|
1489
|
-
)}
|
|
1490
|
-
{modalViewTextArea && (
|
|
1491
|
-
<GlobalModal
|
|
1492
|
-
close={() => setModalViewTextArea(false)}
|
|
1493
|
-
message={`Gracias, tus comentarios fueron entregados.`}
|
|
1494
|
-
detail={"Trabajaremos en conjunto para resolverlo."}
|
|
1495
|
-
button1={{
|
|
1496
|
-
name: "Cerrar",
|
|
1497
|
-
action: () => setModalViewTextArea(false),
|
|
1498
|
-
}}
|
|
1499
|
-
img={face}
|
|
1500
|
-
textArea={false}
|
|
1501
|
-
/>
|
|
1498
|
+
{globalModal && (
|
|
1499
|
+
<GlobalModal close={() => setGlobalModal()} {...globalModal} />
|
|
1502
1500
|
)}
|
|
1503
1501
|
{showVersionSelector && (
|
|
1504
1502
|
<VersionSelector
|