contentoh-components-library 21.3.4 → 21.3.6
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/.env.development +2 -2
- package/.env.production +25 -25
- package/dist/assets/fonts/{roboto → Roboto}/LICENSE.txt +0 -0
- package/dist/assets/fonts/{roboto → Roboto}/Roboto-Black.ttf +0 -0
- package/dist/assets/fonts/{roboto → Roboto}/Roboto-BlackItalic.ttf +0 -0
- package/dist/assets/fonts/{roboto → Roboto}/Roboto-Bold.ttf +0 -0
- package/dist/assets/fonts/{roboto → Roboto}/Roboto-BoldItalic.ttf +0 -0
- package/dist/assets/fonts/{roboto → Roboto}/Roboto-Italic.ttf +0 -0
- package/dist/assets/fonts/{roboto → Roboto}/Roboto-Light.ttf +0 -0
- package/dist/assets/fonts/{roboto → Roboto}/Roboto-LightItalic.ttf +0 -0
- package/dist/assets/fonts/{roboto → Roboto}/Roboto-Medium.ttf +0 -0
- package/dist/assets/fonts/{roboto → Roboto}/Roboto-MediumItalic.ttf +0 -0
- package/dist/assets/fonts/{roboto → Roboto}/Roboto-Regular.ttf +0 -0
- package/dist/assets/fonts/{roboto → Roboto}/Roboto-Thin.ttf +0 -0
- package/dist/assets/fonts/{roboto → Roboto}/Roboto-ThinItalic.ttf +0 -0
- package/dist/components/atoms/GeneralButton/index.js +6 -2
- package/dist/components/atoms/ProgressBar/index.js +36 -6
- package/dist/components/atoms/ProgressBar/styles.js +11 -3
- package/dist/components/atoms/Select/VersionSelect.js +2 -1
- package/dist/components/molecules/ProductNameHeader/index.js +5 -3
- package/dist/components/organisms/CreateVersion/RenderChilds.js +11 -11
- package/dist/components/organisms/CreateVersion/index.js +30 -89
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -0
- package/dist/components/organisms/OrderDetail/OrderDetail.stories.js +1 -1
- package/dist/components/organisms/OrderDetail/index.js +20 -11
- package/dist/components/organisms/OrderDetail/styles.js +1 -1
- package/dist/components/organisms/OrderDetail/utils/Table/styles.js +1 -1
- package/dist/components/organisms/OrderDetail/utils/Table/utils.js +45 -15
- package/dist/components/organisms/VersionSelector/index.js +28 -2
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +69 -147
- package/dist/components/pages/ProviderProductEdition/index.js +27 -47
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +66 -82
- package/dist/components/pages/RetailerProductEdition/index.js +18 -36
- package/package.json +4 -4
- package/src/assets/fonts/{roboto → Roboto}/LICENSE.txt +0 -0
- package/src/assets/fonts/{roboto → Roboto}/Roboto-Black.ttf +0 -0
- package/src/assets/fonts/{roboto → Roboto}/Roboto-BlackItalic.ttf +0 -0
- package/src/assets/fonts/{roboto → Roboto}/Roboto-Bold.ttf +0 -0
- package/src/assets/fonts/{roboto → Roboto}/Roboto-BoldItalic.ttf +0 -0
- package/src/assets/fonts/{roboto → Roboto}/Roboto-Italic.ttf +0 -0
- package/src/assets/fonts/{roboto → Roboto}/Roboto-Light.ttf +0 -0
- package/src/assets/fonts/{roboto → Roboto}/Roboto-LightItalic.ttf +0 -0
- package/src/assets/fonts/{roboto → Roboto}/Roboto-Medium.ttf +0 -0
- package/src/assets/fonts/{roboto → Roboto}/Roboto-MediumItalic.ttf +0 -0
- package/src/assets/fonts/{roboto → Roboto}/Roboto-Regular.ttf +0 -0
- package/src/assets/fonts/{roboto → Roboto}/Roboto-Thin.ttf +0 -0
- package/src/assets/fonts/{roboto → Roboto}/Roboto-ThinItalic.ttf +0 -0
- package/src/components/atoms/GeneralButton/index.js +4 -1
- package/src/components/atoms/ProgressBar/index.js +38 -5
- package/src/components/atoms/ProgressBar/styles.js +23 -0
- package/src/components/atoms/Select/VersionSelect.js +4 -2
- package/src/components/molecules/ProductNameHeader/index.js +6 -1
- package/src/components/organisms/CreateVersion/RenderChilds.js +28 -34
- package/src/components/organisms/CreateVersion/index.js +16 -36
- package/src/components/organisms/FullProductNameHeader/index.js +1 -0
- package/src/components/organisms/OrderDetail/OrderDetail.stories.js +1 -1
- package/src/components/organisms/OrderDetail/index.js +19 -12
- package/src/components/organisms/OrderDetail/styles.js +1 -0
- package/src/components/organisms/OrderDetail/utils/Table/styles.js +26 -0
- package/src/components/organisms/OrderDetail/utils/Table/utils.js +30 -15
- package/src/components/organisms/VersionSelector/index.js +18 -3
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +75 -166
- package/src/components/pages/ProviderProductEdition/index.js +12 -28
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +71 -82
- package/src/components/pages/RetailerProductEdition/index.js +14 -24
- package/src/global-files/customHooks.js +2 -2
|
@@ -42,7 +42,7 @@ 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 {
|
|
45
|
+
import { number } from "prop-types";
|
|
46
46
|
|
|
47
47
|
const reducerImages = (state, action) => {
|
|
48
48
|
let { values, attrForImgs, inputsByRetailer } = state;
|
|
@@ -114,8 +114,8 @@ const S3_BUCKET = process.env.REACT_APP_IMAGES_BUCKET;
|
|
|
114
114
|
const REGION = "us-east-1";
|
|
115
115
|
|
|
116
116
|
AWS.config.update({
|
|
117
|
-
accessKeyId: process.env.
|
|
118
|
-
secretAccessKey: process.env.
|
|
117
|
+
accessKeyId: process.env.REACT_APP_KUTS3,
|
|
118
|
+
secretAccessKey: process.env.REACT_APP_AKUTS3,
|
|
119
119
|
});
|
|
120
120
|
|
|
121
121
|
const myBucket = new AWS.S3({
|
|
@@ -252,7 +252,6 @@ export const ProviderProductEdition = ({
|
|
|
252
252
|
const [retailerStatus, setRetailerStatus] = useState(
|
|
253
253
|
product.statusByRetailer
|
|
254
254
|
);
|
|
255
|
-
const [showCreateVersion, setShowCreateVersion] = useState(false);
|
|
256
255
|
const [showVersionSelector, setShowVersionSelector] =
|
|
257
256
|
useCloseModal("version-selector");
|
|
258
257
|
|
|
@@ -272,19 +271,10 @@ export const ProviderProductEdition = ({
|
|
|
272
271
|
setServices(services);
|
|
273
272
|
await getServices();
|
|
274
273
|
|
|
275
|
-
// if (!originProp) {
|
|
276
|
-
// setActiveRetailer(
|
|
277
|
-
// product?.retailers
|
|
278
|
-
// ? product?.retailers[0]
|
|
279
|
-
// : product?.retailersAvailable[0]
|
|
280
|
-
// );
|
|
281
|
-
// }
|
|
282
|
-
|
|
283
|
-
// setActiveRetailer(product?.retailers[0]);
|
|
284
274
|
setImages({ action: "init", init: services[2] });
|
|
285
275
|
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
286
276
|
|
|
287
|
-
getPercentage({ data: [product] }).then((res) => setPercentages(res));
|
|
277
|
+
getPercentage({ data: [product] }).then((res) => setPercentages(res[0]));
|
|
288
278
|
setLoading(false);
|
|
289
279
|
};
|
|
290
280
|
|
|
@@ -374,11 +364,13 @@ export const ProviderProductEdition = ({
|
|
|
374
364
|
useEffect(() => {
|
|
375
365
|
const productTemp = product;
|
|
376
366
|
const retailers = productTemp?.retailersAvailable || productTemp?.retailers;
|
|
377
|
-
|
|
378
|
-
retailer
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
367
|
+
if (Object.keys(percentages?.retailers ?? {})?.length > 0) {
|
|
368
|
+
retailers?.forEach((retailer) => {
|
|
369
|
+
retailer["percentage"] = Number(
|
|
370
|
+
percentages?.retailers[retailer.id].percentageRequired
|
|
371
|
+
);
|
|
372
|
+
});
|
|
373
|
+
}
|
|
382
374
|
|
|
383
375
|
setProduct(productTemp);
|
|
384
376
|
setActivePercentage(retailers[0]?.percentage);
|
|
@@ -481,7 +473,7 @@ export const ProviderProductEdition = ({
|
|
|
481
473
|
};
|
|
482
474
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
483
475
|
try {
|
|
484
|
-
await axios.put(
|
|
476
|
+
const res = await axios.put(
|
|
485
477
|
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?datasheet=true&version=${version}`,
|
|
486
478
|
dataObject,
|
|
487
479
|
{
|
|
@@ -1497,18 +1489,10 @@ export const ProviderProductEdition = ({
|
|
|
1497
1489
|
setVersion={setVersion}
|
|
1498
1490
|
companyName={company.company_name}
|
|
1499
1491
|
currentVersion={version}
|
|
1500
|
-
setShowCreateVersion={setShowCreateVersion}
|
|
1501
1492
|
setShowVersionSelector={setShowVersionSelector}
|
|
1502
1493
|
jwt={token}
|
|
1503
1494
|
/>
|
|
1504
1495
|
)}
|
|
1505
|
-
{showCreateVersion && (
|
|
1506
|
-
<CreateVersion
|
|
1507
|
-
idArticle={product.id_article}
|
|
1508
|
-
version={version}
|
|
1509
|
-
setShowCreateVersion={setShowCreateVersion}
|
|
1510
|
-
/>
|
|
1511
|
-
)}
|
|
1512
1496
|
</Container>
|
|
1513
1497
|
);
|
|
1514
1498
|
};
|
|
@@ -12,108 +12,97 @@ export const RetailerProductEditionDefault = Template.bind({});
|
|
|
12
12
|
RetailerProductEditionDefault.args = {
|
|
13
13
|
tabsSections: {
|
|
14
14
|
Descripción: true,
|
|
15
|
-
"Ficha técnica":
|
|
16
|
-
Imágenes:
|
|
15
|
+
"Ficha técnica": true,
|
|
16
|
+
Imágenes: true,
|
|
17
17
|
},
|
|
18
18
|
token:
|
|
19
|
-
"
|
|
19
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI1ODg0YWUzNC01OWQ2LTQ0NTQtYjk4ZS04MjE1MThiY2MzYTciLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6IjU4ODRhZTM0LTU5ZDYtNDQ1NC1iOThlLTgyMTUxOGJjYzNhNyIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJmMzY2YTdjYi02YjA0LTRiMzAtOTJmYy1iMzY0MmY3ZjEzNmEiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY3MTc0MzE0OSwibmFtZSI6IkNhZGVuYSBJc21hZWwiLCJwaG9uZV9udW1iZXIiOiIrNTIzMTExMzY2MzM2IiwiZXhwIjoxNjcxNzQ2NzQ5LCJpYXQiOjE2NzE3NDMxNDksImVtYWlsIjoiY2FkZW5hLmlzbWFlbEBhbGxmcmVlbWFpbC5uZXQifQ.J8kTv1sEotxoicaRclaK1r0tjVbwHPDxIzdDfxYo9J4XwBYYfS180__KYYE0Dh1AfUK_K0mrk2_78_rhTNxCQT85W7XS3ZEcxIOUekqoxaKFl8LSVN_eWz3SlsGG0yRflhJGt6d4gBVByXZbdNiyp1rkjgMln6fhwlRUnuGRbG1WKQvdAPli3qfH8mLzgoTz-6HWs1Jf2Ujheavf3ipGMNtj-OSUdQsh04Ov7jehDWdnPNn2s2DAl4eubgjdXrwIiBPCRkbuFeYZZJpzj1wy__a0nCM7bzly5uTZ2aWujgEJvf9bJb-Y4gkS8TxyJaggJ01ZsMki36aEpIt8J1tJag",
|
|
20
20
|
productSelected: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
images: 1,
|
|
25
|
-
},
|
|
26
|
-
orderId: 3321,
|
|
27
|
-
status: "PA",
|
|
28
|
-
datasheet_status: "AC",
|
|
29
|
-
prio: "none",
|
|
30
|
-
version: 2,
|
|
31
|
-
description_status: "AC",
|
|
32
|
-
images_status: "PA",
|
|
33
|
-
statusByRetailer: {
|
|
34
|
-
58: {
|
|
35
|
-
datasheet: "AC",
|
|
36
|
-
description: "AC",
|
|
37
|
-
images: "PA",
|
|
38
|
-
},
|
|
39
|
-
},
|
|
21
|
+
articleStatus: "AA",
|
|
22
|
+
version: 3,
|
|
23
|
+
missing: {},
|
|
40
24
|
article: {
|
|
41
|
-
id_article: 85655,
|
|
42
|
-
id_category: "2052",
|
|
43
|
-
name: "EXTENSION P/ EXTERIOR 3X10 AWG 10M ROJO",
|
|
44
|
-
upc: "165679",
|
|
45
|
-
timestamp: "2022-11-01T15:46:51.000Z",
|
|
46
|
-
id_user: 1436,
|
|
47
|
-
status: null,
|
|
48
|
-
active: 1,
|
|
49
|
-
company_id: 409,
|
|
50
|
-
SKU: null,
|
|
51
|
-
Descripcion: null,
|
|
52
|
-
Proveedor: null,
|
|
53
|
-
id_proveedor: 0,
|
|
54
|
-
company_name: "HIGHLINE-WARREN LLC",
|
|
55
|
-
country: null,
|
|
56
|
-
id_order: 3321,
|
|
57
|
-
id_datasheet_especialist: 1248,
|
|
58
|
-
id_datasheet_facilitator: null,
|
|
59
|
-
id_description_especialist: 1248,
|
|
60
|
-
id_description_facilitator: null,
|
|
61
|
-
id_images_especialist: null,
|
|
62
|
-
id_images_facilitator: null,
|
|
63
|
-
id_auditor: null,
|
|
64
|
-
id_recepcionist: null,
|
|
65
25
|
category:
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
26
|
+
"Ventilación y Calefacción|Ventiladores de Techo|Ventiladores de Techo",
|
|
27
|
+
company_name: "GRUPO BRAHMA",
|
|
28
|
+
company_id: 1,
|
|
29
|
+
id_category: "2416",
|
|
30
|
+
id_article: 221,
|
|
31
|
+
name: 'DEMO VENTILADOR DE TECHO TRIBECA 52"',
|
|
32
|
+
upc: "147259",
|
|
70
33
|
},
|
|
34
|
+
asignations: [],
|
|
71
35
|
retailers: [
|
|
72
36
|
{
|
|
73
|
-
id:
|
|
74
|
-
name: "The Home Depot
|
|
37
|
+
id: 59,
|
|
38
|
+
name: "The Home Depot Platinum",
|
|
39
|
+
country: "México",
|
|
40
|
+
id_region: 1,
|
|
41
|
+
active: 1,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
retailersAvailable: [
|
|
45
|
+
{
|
|
46
|
+
id: 59,
|
|
47
|
+
name: "The Home Depot Platinum",
|
|
75
48
|
country: "México",
|
|
76
49
|
id_region: 1,
|
|
77
50
|
active: 1,
|
|
78
51
|
},
|
|
79
52
|
],
|
|
80
|
-
|
|
81
|
-
|
|
53
|
+
upc: "147259",
|
|
54
|
+
name: 'DEMO VENTILADOR DE TECHO TRIBECA 52"',
|
|
55
|
+
categoryName:
|
|
56
|
+
"Ventilación y Calefacción|Ventiladores de Techo|Ventiladores de Techo",
|
|
57
|
+
id_category: "2416",
|
|
58
|
+
id_article: 221,
|
|
59
|
+
services: [
|
|
60
|
+
{
|
|
61
|
+
id_article: 221,
|
|
62
|
+
service: "datasheet",
|
|
63
|
+
quantity: 1,
|
|
64
|
+
price: 0,
|
|
65
|
+
id_user: 59,
|
|
66
|
+
datasheet_common: null,
|
|
67
|
+
discount: null,
|
|
68
|
+
},
|
|
69
|
+
],
|
|
82
70
|
},
|
|
83
71
|
location: {
|
|
84
|
-
product: { articleId:
|
|
72
|
+
product: { articleId: 221, versionId: 3 },
|
|
85
73
|
},
|
|
86
74
|
user: {
|
|
87
|
-
id_user:
|
|
88
|
-
name: "
|
|
89
|
-
last_name: "
|
|
90
|
-
email: "
|
|
91
|
-
position: "
|
|
92
|
-
telephone:
|
|
93
|
-
country:
|
|
94
|
-
id_company:
|
|
95
|
-
id_cognito: "
|
|
75
|
+
id_user: 59,
|
|
76
|
+
name: "The Home",
|
|
77
|
+
last_name: "Depot",
|
|
78
|
+
email: "cadena.ismael@allfreemail.net",
|
|
79
|
+
position: "Admin",
|
|
80
|
+
telephone: "+523111366336",
|
|
81
|
+
country: "México",
|
|
82
|
+
id_company: 817,
|
|
83
|
+
id_cognito: "5884ae34-59d6-4454-b98e-821518bcc3a7",
|
|
96
84
|
birth_Date: null,
|
|
97
|
-
about_me:
|
|
98
|
-
zip_code:
|
|
99
|
-
address:
|
|
100
|
-
job:
|
|
101
|
-
id_stripe:
|
|
102
|
-
id_role:
|
|
85
|
+
about_me: "",
|
|
86
|
+
zip_code: "",
|
|
87
|
+
address: "",
|
|
88
|
+
job: "",
|
|
89
|
+
id_stripe: "",
|
|
90
|
+
id_role: 0,
|
|
103
91
|
active: 1,
|
|
104
|
-
is_retailer:
|
|
105
|
-
email_notify:
|
|
92
|
+
is_retailer: 1,
|
|
93
|
+
email_notify: 0,
|
|
94
|
+
is_user_tech: null,
|
|
106
95
|
membership: {
|
|
107
|
-
id:
|
|
108
|
-
start_date: "2022-
|
|
109
|
-
end_date: "2023-
|
|
110
|
-
planID:
|
|
111
|
-
plan: "
|
|
112
|
-
name: "Plan
|
|
113
|
-
user_limit: "
|
|
114
|
-
products_limit: "
|
|
115
|
-
type: "
|
|
96
|
+
id: 47,
|
|
97
|
+
start_date: "2022-05-25T14:31:12.000Z",
|
|
98
|
+
end_date: "2023-05-25T14:31:12.000Z",
|
|
99
|
+
planID: 5,
|
|
100
|
+
plan: "prod_Ktl6B5Ou2gqTB2",
|
|
101
|
+
name: "Plan Pro",
|
|
102
|
+
user_limit: "5",
|
|
103
|
+
products_limit: "500",
|
|
104
|
+
type: "PyMES",
|
|
116
105
|
},
|
|
117
|
-
src: "https://content-management-profile
|
|
106
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-59/59.png?1671735033010",
|
|
118
107
|
},
|
|
119
108
|
};
|
|
@@ -32,7 +32,6 @@ import succes from "../../../assets/images/genericModal/genericModalCheck.svg";
|
|
|
32
32
|
import errorModal from "../../../assets/images/genericModal/errorModal.svg";
|
|
33
33
|
import { VersionSelector } from "../../organisms/VersionSelector";
|
|
34
34
|
import { useCloseModal } from "../../../global-files/customHooks";
|
|
35
|
-
import { CreateVersion } from "../../organisms/CreateVersion";
|
|
36
35
|
|
|
37
36
|
const reducerImages = (state, action) => {
|
|
38
37
|
let { values, attrForImgs, inputsByRetailer } = state;
|
|
@@ -108,8 +107,8 @@ const S3_BUCKET = process.env.REACT_APP_IMAGES_BUCKET;
|
|
|
108
107
|
const REGION = "us-east-1";
|
|
109
108
|
|
|
110
109
|
AWS.config.update({
|
|
111
|
-
accessKeyId: process.env.
|
|
112
|
-
secretAccessKey: process.env.
|
|
110
|
+
accessKeyId: process.env.REACT_APP_KUTS3,
|
|
111
|
+
secretAccessKey: process.env.REACT_APP_AKUTS3,
|
|
113
112
|
});
|
|
114
113
|
|
|
115
114
|
const myBucket = new AWS.S3({
|
|
@@ -176,6 +175,7 @@ export const RetailerProductEdition = ({
|
|
|
176
175
|
const [percentages, setPercentages] = useState(
|
|
177
176
|
new Array(product?.retailers?.length).fill({ percentage: 0 })
|
|
178
177
|
);
|
|
178
|
+
// const [percentages, setPercentages] = useState([{ retailers: {} }]);
|
|
179
179
|
const [activePercentage, setActivePercentage] = useState(0);
|
|
180
180
|
const [activeRetailer, setActiveRetailer] = useState({});
|
|
181
181
|
const [services, setServices] = useState([]);
|
|
@@ -206,10 +206,7 @@ export const RetailerProductEdition = ({
|
|
|
206
206
|
const [retailerStatus, setRetailerStatus] = useState("-");
|
|
207
207
|
const [statusArray, setStatusArray] = useState([]);
|
|
208
208
|
const [socketType, setSocketType] = useState(null);
|
|
209
|
-
const [servicesStatus, setServicesStatus] = useState([]);
|
|
210
209
|
const [saving, setSaving] = useState(loading);
|
|
211
|
-
const isAuditor = user.id_role === 6;
|
|
212
|
-
const [showCreateVersion, setShowCreateVersion] = useState(false);
|
|
213
210
|
const [showVersionSelector, setShowVersionSelector] =
|
|
214
211
|
useCloseModal("version-selector");
|
|
215
212
|
const shotThd = [58, 59, 60, 61].includes(activeRetailer.id);
|
|
@@ -229,12 +226,9 @@ export const RetailerProductEdition = ({
|
|
|
229
226
|
//Converts the data inside the datasheets object to array
|
|
230
227
|
setServices(services);
|
|
231
228
|
getServices();
|
|
232
|
-
|
|
233
|
-
// setActiveRetailer(product?.retailers[0]);
|
|
234
229
|
setImages({ action: "init", init: services[2] });
|
|
235
230
|
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
236
|
-
|
|
237
|
-
getPercentage({ data: [product] }).then((res) => setPercentages(res));
|
|
231
|
+
getPercentage({ data: [product] }).then((res) => setPercentages(res[0]));
|
|
238
232
|
setLoading(false);
|
|
239
233
|
} catch (error) {
|
|
240
234
|
console.log(error);
|
|
@@ -375,12 +369,16 @@ export const RetailerProductEdition = ({
|
|
|
375
369
|
}, [userGroups]);
|
|
376
370
|
|
|
377
371
|
useEffect(() => {
|
|
378
|
-
product?.
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
372
|
+
const retailers = product?.retailersAvailable || product?.retailers;
|
|
373
|
+
if (Object.keys(percentages?.retailers ?? {})?.length > 0) {
|
|
374
|
+
retailers?.forEach((retailer) => {
|
|
375
|
+
retailer["percentage"] = Number(
|
|
376
|
+
percentages?.retailers[retailer.id].percentageRequired
|
|
377
|
+
);
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
setActivePercentage(retailers[0]?.percentage);
|
|
384
382
|
}, [percentages]);
|
|
385
383
|
|
|
386
384
|
useEffect(() => {
|
|
@@ -1549,18 +1547,10 @@ export const RetailerProductEdition = ({
|
|
|
1549
1547
|
setVersion={setVersion}
|
|
1550
1548
|
companyName={product.article.company_name}
|
|
1551
1549
|
currentVersion={version}
|
|
1552
|
-
setShowCreateVersion={setShowCreateVersion}
|
|
1553
1550
|
setShowVersionSelector={setShowVersionSelector}
|
|
1554
1551
|
jwt={token}
|
|
1555
1552
|
/>
|
|
1556
1553
|
)}
|
|
1557
|
-
{showCreateVersion && (
|
|
1558
|
-
<CreateVersion
|
|
1559
|
-
idArticle={product.article.id_article}
|
|
1560
|
-
version={version}
|
|
1561
|
-
setShowCreateVersion={setShowCreateVersion}
|
|
1562
|
-
/>
|
|
1563
|
-
)}
|
|
1564
1554
|
</Container>
|
|
1565
1555
|
);
|
|
1566
1556
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import { useEffect } from "react";
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
3
2
|
|
|
4
3
|
export const useCloseModal = (id) => {
|
|
5
4
|
const [showModal, setShowModal] = useState(false);
|
|
@@ -11,6 +10,7 @@ export const useCloseModal = (id) => {
|
|
|
11
10
|
setShowModal(false);
|
|
12
11
|
}
|
|
13
12
|
};
|
|
13
|
+
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
if (showModal) {
|
|
16
16
|
document.addEventListener("click", closeModal, false);
|