contentoh-components-library 21.3.5 → 21.3.7
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 +3 -0
- package/dist/assets/images/customSelect/starIcon.svg +14 -0
- package/dist/assets/images/defaultImages/Spinner.gif +0 -0
- package/dist/assets/images/defaultImages/notFound.svg +124 -0
- package/dist/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +72 -0
- package/dist/components/atoms/ButtonFileChooser/index.js +118 -0
- package/dist/components/atoms/ButtonFileChooser/styles.js +20 -0
- package/dist/components/atoms/ButtonV2/ButtonV2.stories.js +66 -0
- package/dist/components/atoms/ButtonV2/index.js +110 -0
- package/dist/components/atoms/ButtonV2/styles.js +53 -0
- package/dist/components/atoms/CustomIcon/CustomIcon.stories.js +50 -0
- package/dist/components/atoms/CustomIcon/index.js +40 -0
- package/dist/components/atoms/CustomIcon/styles.js +33 -0
- package/dist/components/atoms/IconFile/IconFile.stories.js +48 -0
- package/dist/components/atoms/IconFile/index.js +249 -0
- package/dist/components/atoms/IconFile/styles.js +23 -0
- package/dist/components/atoms/Image/Image.stories.js +73 -0
- package/dist/components/atoms/Image/index.js +76 -0
- package/dist/components/atoms/Image/styles.js +43 -0
- package/dist/components/atoms/ImageLink/ImageLink.stories.js +63 -0
- package/dist/components/atoms/ImageLink/index.js +77 -0
- package/dist/components/atoms/ImageLink/styles.js +40 -0
- package/dist/components/atoms/ImagePreview/ImagePreview.stories.js +70 -0
- package/dist/components/atoms/ImagePreview/index.js +222 -0
- package/dist/components/atoms/ImagePreview/styles.js +44 -0
- package/dist/components/atoms/InputText/InputText.stories.js +60 -0
- package/dist/components/atoms/InputText/index.js +66 -0
- package/dist/components/atoms/InputText/styles.js +32 -0
- package/dist/components/atoms/NotFound/NotFound.stories.js +36 -0
- package/dist/components/atoms/NotFound/index.js +75 -0
- package/dist/components/atoms/NotFound/styles.js +20 -0
- package/dist/components/atoms/ProgressBar/index.js +36 -6
- package/dist/components/atoms/ProgressBar/styles.js +11 -3
- package/dist/components/atoms/SelectItemV2/SelectItemV2.stories.js +45 -0
- package/dist/components/atoms/SelectItemV2/index.js +57 -0
- package/dist/components/atoms/SelectItemV2/styles.js +30 -0
- package/dist/components/atoms/Tooltip/Tooltip.stories.js +66 -0
- package/dist/components/atoms/Tooltip/index.js +72 -0
- package/dist/components/atoms/Tooltip/styles.js +20 -0
- package/dist/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +66 -0
- package/dist/components/molecules/ButtonDownloadFile/index.js +179 -0
- package/dist/components/molecules/ButtonDownloadFile/styles.js +23 -0
- package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +21 -22
- package/dist/components/molecules/CustomSelect/SelectItem.js +10 -1
- package/dist/components/molecules/Dropdown/Dropdown.stories.js +98 -0
- package/dist/components/molecules/Dropdown/index.js +150 -0
- package/dist/components/molecules/Dropdown/styles.js +26 -0
- package/dist/components/molecules/HeaderTop/index.js +10 -5
- package/dist/components/molecules/HeaderTop/styles.js +1 -1
- package/dist/components/molecules/ImageTooltip/ImageTooltip.stories.js +82 -0
- package/dist/components/molecules/ImageTooltip/index.js +85 -0
- package/dist/components/molecules/ImageTooltip/styles.js +33 -0
- package/dist/components/molecules/ProductNameHeader/index.js +5 -3
- package/dist/components/molecules/SelectV2/SelectV2.stories.js +119 -0
- package/dist/components/molecules/SelectV2/index.js +306 -0
- package/dist/components/molecules/SelectV2/styles.js +42 -0
- package/dist/components/molecules/SelectV2/test.js +95 -0
- package/dist/components/molecules/SelectV2/test.stories.js +27 -0
- package/dist/components/organisms/Chat/Chat.stories.js +215 -0
- package/dist/components/organisms/Chat/ChatLists/ChatLists.stories.js +83 -0
- package/dist/components/organisms/Chat/ChatLists/index.js +160 -0
- package/dist/components/organisms/Chat/ChatLists/styles.js +29 -0
- package/dist/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +176 -0
- package/dist/components/organisms/Chat/ContainerItems/index.js +569 -0
- package/dist/components/organisms/Chat/ContainerItems/styles.js +20 -0
- package/dist/components/organisms/Chat/ContentChat/ContentChat.stories.js +142 -0
- package/dist/components/organisms/Chat/ContentChat/index.js +1422 -0
- package/dist/components/organisms/Chat/ContentChat/styles.js +20 -0
- package/dist/components/organisms/Chat/Footer/Footer.stories.js +43 -0
- package/dist/components/organisms/Chat/Footer/index.js +984 -0
- package/dist/components/organisms/Chat/Footer/styles.js +32 -0
- package/dist/components/organisms/Chat/Header/Header.stories.js +96 -0
- package/dist/components/organisms/Chat/Header/index.js +84 -0
- package/dist/components/organisms/Chat/Header/styles.js +20 -0
- package/dist/components/organisms/Chat/index.js +327 -0
- package/dist/components/organisms/Chat/styles.js +29 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -0
- package/dist/components/organisms/Modal/Modal.stories.js +66 -0
- package/dist/components/organisms/Modal/index.js +95 -0
- package/dist/components/organisms/Modal/styles.js +20 -0
- package/dist/components/organisms/RangeCalendar/RangeCalendar.stories.js +33 -0
- package/dist/components/organisms/RangeCalendar/index.js +148 -0
- package/dist/components/organisms/RangeCalendar/styles.js +27 -0
- package/dist/components/pages/ProviderProductEdition/index.js +8 -8
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +60 -86
- package/dist/components/pages/RetailerProductEdition/index.js +13 -12
- package/dist/global-files/fonts.css +6 -0
- package/dist/global-files/handle_http.js +383 -0
- package/dist/global-files/utils.js +484 -0
- package/dist/global-files/variables.js +2 -0
- package/dist/index.js +267 -46
- package/package.json +12 -1
- package/src/assets/images/customSelect/starIcon.svg +14 -0
- package/src/assets/images/defaultImages/Spinner.gif +0 -0
- package/src/assets/images/defaultImages/notFound.svg +124 -0
- package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +47 -0
- package/src/components/atoms/ButtonFileChooser/index.js +69 -0
- package/src/components/atoms/ButtonFileChooser/styles.js +4 -0
- package/src/components/atoms/ButtonV2/ButtonV2.stories.js +53 -0
- package/src/components/atoms/ButtonV2/index.js +85 -0
- package/src/components/atoms/ButtonV2/styles.js +217 -0
- package/src/components/atoms/CustomIcon/CustomIcon.stories.js +36 -0
- package/src/components/atoms/CustomIcon/index.js +41 -0
- package/src/components/atoms/CustomIcon/styles.js +85 -0
- package/src/components/atoms/IconFile/IconFile.stories.js +35 -0
- package/src/components/atoms/IconFile/index.js +119 -0
- package/src/components/atoms/IconFile/styles.js +67 -0
- package/src/components/atoms/Image/Image.stories.js +51 -0
- package/src/components/atoms/Image/index.js +55 -0
- package/src/components/atoms/Image/styles.js +34 -0
- package/src/components/atoms/ImageLink/ImageLink.stories.js +43 -0
- package/src/components/atoms/ImageLink/index.js +57 -0
- package/src/components/atoms/ImageLink/styles.js +30 -0
- package/src/components/atoms/ImagePreview/ImagePreview.stories.js +52 -0
- package/src/components/atoms/ImagePreview/index.js +191 -0
- package/src/components/atoms/ImagePreview/styles.js +77 -0
- package/src/components/atoms/InputText/InputText.stories.js +39 -0
- package/src/components/atoms/InputText/index.js +61 -0
- package/src/components/atoms/InputText/styles.js +89 -0
- package/src/components/atoms/NotFound/NotFound.stories.js +19 -0
- package/src/components/atoms/NotFound/index.js +52 -0
- package/src/components/atoms/NotFound/styles.js +55 -0
- package/src/components/atoms/ProgressBar/index.js +40 -5
- package/src/components/atoms/ProgressBar/styles.js +24 -0
- package/src/components/atoms/SelectItemV2/SelectItemV2.stories.js +26 -0
- package/src/components/atoms/SelectItemV2/index.js +61 -0
- package/src/components/atoms/SelectItemV2/styles.js +90 -0
- package/src/components/atoms/Tooltip/Tooltip.stories.js +51 -0
- package/src/components/atoms/Tooltip/index.js +59 -0
- package/src/components/atoms/Tooltip/styles.js +42 -0
- package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +54 -0
- package/src/components/molecules/ButtonDownloadFile/index.js +111 -0
- package/src/components/molecules/ButtonDownloadFile/styles.js +66 -0
- package/src/components/molecules/CustomSelect/CustomSelect.stories.js +20 -12
- package/src/components/molecules/CustomSelect/SelectItem.js +7 -0
- package/src/components/molecules/Dropdown/Dropdown.stories.js +103 -0
- package/src/components/molecules/Dropdown/index.js +150 -0
- package/src/components/molecules/Dropdown/styles.js +75 -0
- package/src/components/molecules/HeaderTop/index.js +11 -6
- package/src/components/molecules/HeaderTop/styles.js +4 -0
- package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +68 -0
- package/src/components/molecules/ImageTooltip/index.js +63 -0
- package/src/components/molecules/ImageTooltip/styles.js +18 -0
- package/src/components/molecules/ProductNameHeader/index.js +6 -1
- package/src/components/molecules/SelectV2/SelectV2.stories.js +114 -0
- package/src/components/molecules/SelectV2/index.js +350 -0
- package/src/components/molecules/SelectV2/styles.js +105 -0
- package/src/components/molecules/SelectV2/test.js +61 -0
- package/src/components/molecules/SelectV2/test.stories.js +10 -0
- package/src/components/organisms/Chat/Chat.stories.js +199 -0
- package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +65 -0
- package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
- package/src/components/organisms/Chat/ChatLists/index.js +141 -0
- package/src/components/organisms/Chat/ChatLists/styles.js +162 -0
- package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +142 -0
- package/src/components/organisms/Chat/ContainerItems/index.js +549 -0
- package/src/components/organisms/Chat/ContainerItems/styles.js +328 -0
- package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +102 -0
- package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
- package/src/components/organisms/Chat/ContentChat/index.js +900 -0
- package/src/components/organisms/Chat/ContentChat/styles.js +41 -0
- package/src/components/organisms/Chat/Footer/Footer.stories.js +22 -0
- package/src/components/organisms/Chat/Footer/index.js +669 -0
- package/src/components/organisms/Chat/Footer/styles.js +286 -0
- package/src/components/organisms/Chat/Header/Header.stories.js +66 -0
- package/src/components/organisms/Chat/Header/index.js +94 -0
- package/src/components/organisms/Chat/Header/styles.js +49 -0
- package/src/components/organisms/Chat/index.js +294 -0
- package/src/components/organisms/Chat/styles.js +42 -0
- package/src/components/organisms/FullProductNameHeader/index.js +1 -0
- package/src/components/organisms/Modal/Modal.stories.js +55 -0
- package/src/components/organisms/Modal/index.js +97 -0
- package/src/components/organisms/Modal/styles.js +103 -0
- package/src/components/organisms/RangeCalendar/RangeCalendar.stories.js +16 -0
- package/src/components/organisms/RangeCalendar/index.js +121 -0
- package/src/components/organisms/RangeCalendar/styles.js +883 -0
- package/src/components/pages/ProviderProductEdition/index.js +9 -6
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +62 -85
- package/src/components/pages/RetailerProductEdition/index.js +12 -10
- package/src/global-files/fonts.css +6 -0
- package/src/global-files/handle_http.js +231 -0
- package/src/global-files/utils.js +309 -0
- package/src/global-files/variables.js +2 -0
- package/src/index.js +17 -0
|
@@ -42,6 +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 { number } from "prop-types";
|
|
45
46
|
|
|
46
47
|
const reducerImages = (state, action) => {
|
|
47
48
|
let { values, attrForImgs, inputsByRetailer } = state;
|
|
@@ -273,7 +274,7 @@ export const ProviderProductEdition = ({
|
|
|
273
274
|
setImages({ action: "init", init: services[2] });
|
|
274
275
|
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
275
276
|
|
|
276
|
-
getPercentage({ data: [product] }).then((res) => setPercentages(res));
|
|
277
|
+
getPercentage({ data: [product] }).then((res) => setPercentages(res[0]));
|
|
277
278
|
setLoading(false);
|
|
278
279
|
};
|
|
279
280
|
|
|
@@ -363,11 +364,13 @@ export const ProviderProductEdition = ({
|
|
|
363
364
|
useEffect(() => {
|
|
364
365
|
const productTemp = product;
|
|
365
366
|
const retailers = productTemp?.retailersAvailable || productTemp?.retailers;
|
|
366
|
-
|
|
367
|
-
retailer
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
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
|
+
}
|
|
371
374
|
|
|
372
375
|
setProduct(productTemp);
|
|
373
376
|
setActivePercentage(retailers[0]?.percentage);
|
|
@@ -12,120 +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
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.
|
|
19
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI1ODg0YWUzNC01OWQ2LTQ0NTQtYjk4ZS04MjE1MThiY2MzYTciLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6IjU4ODRhZTM0LTU5ZDYtNDQ1NC1iOThlLTgyMTUxOGJjYzNhNyIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJmMzY2YTdjYi02YjA0LTRiMzAtOTJmYy1iMzY0MmY3ZjEzNmEiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY3MTc0MzE0OSwibmFtZSI6IkNhZGVuYSBJc21hZWwiLCJwaG9uZV9udW1iZXIiOiIrNTIzMTExMzY2MzM2IiwiZXhwIjoxNjcxNzQ2NzQ5LCJpYXQiOjE2NzE3NDMxNDksImVtYWlsIjoiY2FkZW5hLmlzbWFlbEBhbGxmcmVlbWFpbC5uZXQifQ.J8kTv1sEotxoicaRclaK1r0tjVbwHPDxIzdDfxYo9J4XwBYYfS180__KYYE0Dh1AfUK_K0mrk2_78_rhTNxCQT85W7XS3ZEcxIOUekqoxaKFl8LSVN_eWz3SlsGG0yRflhJGt6d4gBVByXZbdNiyp1rkjgMln6fhwlRUnuGRbG1WKQvdAPli3qfH8mLzgoTz-6HWs1Jf2Ujheavf3ipGMNtj-OSUdQsh04Ov7jehDWdnPNn2s2DAl4eubgjdXrwIiBPCRkbuFeYZZJpzj1wy__a0nCM7bzly5uTZ2aWujgEJvf9bJb-Y4gkS8TxyJaggJ01ZsMki36aEpIt8J1tJag",
|
|
20
20
|
productSelected: {
|
|
21
|
-
|
|
22
|
-
datasheets: 1,
|
|
23
|
-
descriptions: 1,
|
|
24
|
-
images: 1,
|
|
25
|
-
},
|
|
26
|
-
orderId: 123,
|
|
27
|
-
status: "PA",
|
|
28
|
-
datasheet_status: "PA",
|
|
29
|
-
prio: "none",
|
|
21
|
+
articleStatus: "AA",
|
|
30
22
|
version: 3,
|
|
31
|
-
|
|
32
|
-
images_status: "PA",
|
|
33
|
-
statusByRetailer: {
|
|
34
|
-
4: {
|
|
35
|
-
datasheet: "PA",
|
|
36
|
-
description: "PA",
|
|
37
|
-
images: "PA",
|
|
38
|
-
},
|
|
39
|
-
5: {
|
|
40
|
-
datasheet: "PA",
|
|
41
|
-
description: "PA",
|
|
42
|
-
images: "PA",
|
|
43
|
-
},
|
|
44
|
-
6: {
|
|
45
|
-
datasheet: "PA",
|
|
46
|
-
description: "PA",
|
|
47
|
-
images: "PA",
|
|
48
|
-
},
|
|
49
|
-
},
|
|
23
|
+
missing: {},
|
|
50
24
|
article: {
|
|
51
|
-
id_article: 127,
|
|
52
|
-
id_category: "700",
|
|
53
|
-
name: "prueba prod flujo",
|
|
54
|
-
upc: "34234353324",
|
|
55
|
-
timestamp: "2022-11-23T23:12:30.000Z",
|
|
56
|
-
id_user: 28,
|
|
57
|
-
status: "NULL",
|
|
58
|
-
active: 1,
|
|
59
|
-
company_id: 1,
|
|
60
|
-
company_name: "GRUPO BRAHMA",
|
|
61
|
-
country: "México",
|
|
62
|
-
id_order: 123,
|
|
63
|
-
id_datasheet_especialist: 54,
|
|
64
|
-
id_datasheet_facilitator: 52,
|
|
65
|
-
id_description_especialist: 54,
|
|
66
|
-
id_description_facilitator: 52,
|
|
67
|
-
id_images_especialist: 55,
|
|
68
|
-
id_images_facilitator: 53,
|
|
69
|
-
id_auditor: 37,
|
|
70
|
-
id_recepcionist: null,
|
|
71
25
|
category:
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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",
|
|
76
33
|
},
|
|
34
|
+
asignations: [],
|
|
77
35
|
retailers: [
|
|
78
36
|
{
|
|
79
|
-
id:
|
|
80
|
-
name: "
|
|
37
|
+
id: 59,
|
|
38
|
+
name: "The Home Depot Platinum",
|
|
39
|
+
country: "México",
|
|
40
|
+
id_region: 1,
|
|
41
|
+
active: 1,
|
|
81
42
|
},
|
|
43
|
+
],
|
|
44
|
+
retailersAvailable: [
|
|
82
45
|
{
|
|
83
|
-
id:
|
|
84
|
-
name: "
|
|
46
|
+
id: 59,
|
|
47
|
+
name: "The Home Depot Platinum",
|
|
48
|
+
country: "México",
|
|
49
|
+
id_region: 1,
|
|
50
|
+
active: 1,
|
|
85
51
|
},
|
|
52
|
+
],
|
|
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: [
|
|
86
60
|
{
|
|
87
|
-
|
|
88
|
-
|
|
61
|
+
id_article: 221,
|
|
62
|
+
service: "datasheet",
|
|
63
|
+
quantity: 1,
|
|
64
|
+
price: 0,
|
|
65
|
+
id_user: 59,
|
|
66
|
+
datasheet_common: null,
|
|
67
|
+
discount: null,
|
|
89
68
|
},
|
|
90
69
|
],
|
|
91
|
-
country: "México",
|
|
92
|
-
upc: "34234353324",
|
|
93
70
|
},
|
|
94
71
|
location: {
|
|
95
|
-
product: { articleId:
|
|
72
|
+
product: { articleId: 221, versionId: 3 },
|
|
96
73
|
},
|
|
97
74
|
user: {
|
|
98
|
-
id_user:
|
|
99
|
-
name: "
|
|
100
|
-
last_name: "",
|
|
101
|
-
email: "
|
|
102
|
-
position: "",
|
|
103
|
-
telephone: "",
|
|
104
|
-
country: "",
|
|
105
|
-
id_company:
|
|
106
|
-
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",
|
|
107
84
|
birth_Date: null,
|
|
108
85
|
about_me: "",
|
|
109
86
|
zip_code: "",
|
|
110
87
|
address: "",
|
|
111
88
|
job: "",
|
|
112
89
|
id_stripe: "",
|
|
113
|
-
id_role:
|
|
90
|
+
id_role: 0,
|
|
114
91
|
active: 1,
|
|
115
|
-
is_retailer:
|
|
116
|
-
email_notify:
|
|
92
|
+
is_retailer: 1,
|
|
93
|
+
email_notify: 0,
|
|
117
94
|
is_user_tech: null,
|
|
118
95
|
membership: {
|
|
119
|
-
id:
|
|
120
|
-
start_date: "
|
|
121
|
-
end_date: "
|
|
122
|
-
planID:
|
|
123
|
-
plan: "
|
|
124
|
-
name: "Plan
|
|
125
|
-
user_limit: "
|
|
126
|
-
products_limit: "
|
|
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",
|
|
127
104
|
type: "PyMES",
|
|
128
105
|
},
|
|
129
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
106
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-59/59.png?1671735033010",
|
|
130
107
|
},
|
|
131
108
|
};
|
|
@@ -175,6 +175,7 @@ export const RetailerProductEdition = ({
|
|
|
175
175
|
const [percentages, setPercentages] = useState(
|
|
176
176
|
new Array(product?.retailers?.length).fill({ percentage: 0 })
|
|
177
177
|
);
|
|
178
|
+
// const [percentages, setPercentages] = useState([{ retailers: {} }]);
|
|
178
179
|
const [activePercentage, setActivePercentage] = useState(0);
|
|
179
180
|
const [activeRetailer, setActiveRetailer] = useState({});
|
|
180
181
|
const [services, setServices] = useState([]);
|
|
@@ -225,12 +226,9 @@ export const RetailerProductEdition = ({
|
|
|
225
226
|
//Converts the data inside the datasheets object to array
|
|
226
227
|
setServices(services);
|
|
227
228
|
getServices();
|
|
228
|
-
|
|
229
|
-
// setActiveRetailer(product?.retailers[0]);
|
|
230
229
|
setImages({ action: "init", init: services[2] });
|
|
231
230
|
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
232
|
-
|
|
233
|
-
getPercentage({ data: [product] }).then((res) => setPercentages(res));
|
|
231
|
+
getPercentage({ data: [product] }).then((res) => setPercentages(res[0]));
|
|
234
232
|
setLoading(false);
|
|
235
233
|
} catch (error) {
|
|
236
234
|
console.log(error);
|
|
@@ -371,12 +369,16 @@ export const RetailerProductEdition = ({
|
|
|
371
369
|
}, [userGroups]);
|
|
372
370
|
|
|
373
371
|
useEffect(() => {
|
|
374
|
-
product?.
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
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);
|
|
380
382
|
}, [percentages]);
|
|
381
383
|
|
|
382
384
|
useEffect(() => {
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
|
|
3
|
+
//============================================================
|
|
4
|
+
/**
|
|
5
|
+
* funcion que realiza un axios GET
|
|
6
|
+
*
|
|
7
|
+
* Si <body> es undefined significa que hubo error
|
|
8
|
+
|
|
9
|
+
* @returns { Promise<{
|
|
10
|
+
* body: {} | undefined ,
|
|
11
|
+
* message: string,
|
|
12
|
+
* errorDetail: string
|
|
13
|
+
* }> }
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
//============================================================
|
|
17
|
+
export const fetchGET = (
|
|
18
|
+
endpoint = "",
|
|
19
|
+
paramsQuery = {},
|
|
20
|
+
paramsHeaders = {}
|
|
21
|
+
) => {
|
|
22
|
+
return new Promise(async (response) => {
|
|
23
|
+
//console.log("======= fetchGET =========");
|
|
24
|
+
try {
|
|
25
|
+
let URL = endpoint;
|
|
26
|
+
const keysParamsQuery = Object.keys(paramsQuery);
|
|
27
|
+
// agregar cada param query a la URL
|
|
28
|
+
keysParamsQuery.forEach((key, index) => {
|
|
29
|
+
if (index == 0) {
|
|
30
|
+
URL += `?${key}=${paramsQuery[key]}`;
|
|
31
|
+
} else {
|
|
32
|
+
URL += `&${key}=${paramsQuery[key]}`;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
//console.log("URL:", URL);
|
|
36
|
+
const respHTTPjson = await axios.get(URL, { headers: paramsHeaders });
|
|
37
|
+
// verificar si existe un error en la peticion realizada
|
|
38
|
+
if (respHTTPjson.status !== 200) {
|
|
39
|
+
return response({
|
|
40
|
+
message: "No fue posible llevar a cabo la operación",
|
|
41
|
+
errorDetail: respHTTPjson.statusText,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
// obtener body backend
|
|
45
|
+
const body = JSON.parse(respHTTPjson.data.body);
|
|
46
|
+
|
|
47
|
+
// verificar si existe error desde el backend
|
|
48
|
+
if (respHTTPjson.data.statusCode !== 200) {
|
|
49
|
+
return response({
|
|
50
|
+
message: body.message ?? "",
|
|
51
|
+
errorDetail: body.errorDetail ?? "",
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
// success
|
|
55
|
+
return response({ body });
|
|
56
|
+
} catch (err) {
|
|
57
|
+
return response({
|
|
58
|
+
message: "Error al obtener los datos",
|
|
59
|
+
errorDetail: err.message,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
//============================================================
|
|
66
|
+
/**
|
|
67
|
+
* funcion que realiza un axios POST
|
|
68
|
+
*
|
|
69
|
+
* Si <body> es undefined significa que hubo error
|
|
70
|
+
|
|
71
|
+
* @returns { Promise<{
|
|
72
|
+
* body: {} | undefined ,
|
|
73
|
+
* message: string,
|
|
74
|
+
* errorDetail: string
|
|
75
|
+
* }> }
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
//============================================================
|
|
79
|
+
export const fetchPOST = (
|
|
80
|
+
endpoint = "",
|
|
81
|
+
paramsBody = {},
|
|
82
|
+
paramsHeaders = {}
|
|
83
|
+
) => {
|
|
84
|
+
return new Promise(async (response) => {
|
|
85
|
+
//console.log("======= fetchPOST =========");
|
|
86
|
+
try {
|
|
87
|
+
const respHTTPjson = await axios.post(endpoint, paramsBody, {
|
|
88
|
+
headers: paramsHeaders,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// verificar si existe un error en la peticion realizada
|
|
92
|
+
if (respHTTPjson.status !== 200) {
|
|
93
|
+
return response({
|
|
94
|
+
message: "No fue posible llevar a cabo la operación",
|
|
95
|
+
errorDetail: respHTTPjson.statusText,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
// obtener body backend
|
|
99
|
+
const body = JSON.parse(respHTTPjson.data.body);
|
|
100
|
+
|
|
101
|
+
// verificar si existe error desde el backend
|
|
102
|
+
if (respHTTPjson.data.statusCode !== 200) {
|
|
103
|
+
console.log(body);
|
|
104
|
+
return response({
|
|
105
|
+
message: body.message ?? "",
|
|
106
|
+
errorDetail: body.errorDetail ?? "",
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
// success
|
|
110
|
+
return response({ body });
|
|
111
|
+
} catch (err) {
|
|
112
|
+
return response({
|
|
113
|
+
message: "Error al guardar los datos",
|
|
114
|
+
errorDetail: err.message,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
//============================================================
|
|
121
|
+
/**
|
|
122
|
+
* funcion que realiza un axios GET
|
|
123
|
+
*
|
|
124
|
+
* Si <body> es undefined significa que hubo error
|
|
125
|
+
|
|
126
|
+
* @returns { Promise<{
|
|
127
|
+
* body: {} | undefined ,
|
|
128
|
+
* message: string,
|
|
129
|
+
* errorDetail: string
|
|
130
|
+
* }> }
|
|
131
|
+
*
|
|
132
|
+
*/
|
|
133
|
+
//============================================================
|
|
134
|
+
export const fetchPUT = (
|
|
135
|
+
endpoint = "",
|
|
136
|
+
paramsBody = {},
|
|
137
|
+
paramsHeaders = {}
|
|
138
|
+
) => {
|
|
139
|
+
return new Promise(async (response) => {
|
|
140
|
+
//console.log("======= fetchPUT =========");
|
|
141
|
+
try {
|
|
142
|
+
const respHTTPjson = await axios.put(endpoint, paramsBody, {
|
|
143
|
+
headers: paramsHeaders,
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// verificar si existe un error en la peticion realizada
|
|
147
|
+
if (respHTTPjson.status !== 200) {
|
|
148
|
+
return response({
|
|
149
|
+
message: "No fue posible llevar a cabo la operación",
|
|
150
|
+
errorDetail: respHTTPjson.statusText,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// obtener body backend
|
|
155
|
+
const body = JSON.parse(respHTTPjson.data.body);
|
|
156
|
+
|
|
157
|
+
// verificar si existe error desde el backend
|
|
158
|
+
if (respHTTPjson.data.statusCode !== 200) {
|
|
159
|
+
return response({
|
|
160
|
+
message: body.message ?? "",
|
|
161
|
+
errorDetail: body.errorDetail ?? "",
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// success
|
|
166
|
+
return response({ body });
|
|
167
|
+
} catch (err) {
|
|
168
|
+
return response({
|
|
169
|
+
message: "Error al actualizar los datos",
|
|
170
|
+
errorDetail: err.message,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
//============================================================
|
|
177
|
+
/**
|
|
178
|
+
* funcion que realiza un axios GET
|
|
179
|
+
*
|
|
180
|
+
* Si <body> es undefined significa que hubo error
|
|
181
|
+
|
|
182
|
+
* @returns { Promise<{
|
|
183
|
+
* body: {} | undefined ,
|
|
184
|
+
* message: string,
|
|
185
|
+
* errorDetail: string
|
|
186
|
+
* }> }
|
|
187
|
+
*
|
|
188
|
+
*/
|
|
189
|
+
//============================================================
|
|
190
|
+
export const fetchDELETE = (
|
|
191
|
+
endpoint = "",
|
|
192
|
+
paramsBody = {},
|
|
193
|
+
paramsHeaders = {}
|
|
194
|
+
) => {
|
|
195
|
+
return new Promise(async (response) => {
|
|
196
|
+
//console.log("======= fetchDELETE =========");
|
|
197
|
+
try {
|
|
198
|
+
const respHTTPjson = await axios.delete(endpoint, {
|
|
199
|
+
data: paramsBody,
|
|
200
|
+
headers: paramsHeaders,
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
// verificar si existe un error en la peticion realizada
|
|
204
|
+
if (respHTTPjson.status !== 200) {
|
|
205
|
+
return response({
|
|
206
|
+
message: "No fue posible llevar a cabo la operación",
|
|
207
|
+
errorDetail: respHTTPjson.statusText,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// obtener body backend
|
|
212
|
+
const body = JSON.parse(respHTTPjson.data.body);
|
|
213
|
+
|
|
214
|
+
// verificar si existe error desde el backend
|
|
215
|
+
if (respHTTPjson.data.statusCode !== 200) {
|
|
216
|
+
return response({
|
|
217
|
+
message: body.message ?? "",
|
|
218
|
+
errorDetail: body.errorDetail ?? "",
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// success
|
|
223
|
+
return response({ body });
|
|
224
|
+
} catch (err) {
|
|
225
|
+
return response({
|
|
226
|
+
message: "Error al actualizar los datos",
|
|
227
|
+
errorDetail: err.message,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
};
|