contentoh-components-library 21.3.30 → 21.3.32
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/.env.production +5 -2
- package/dist/assets/images/generalButton/closeIcon.svg +2 -2
- package/dist/components/atoms/ProgressBar/index.js +36 -6
- package/dist/components/atoms/ProgressBar/styles.js +11 -3
- package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +21 -22
- package/dist/components/molecules/CustomSelect/SelectItem.js +10 -1
- package/dist/components/molecules/GalleryElement/index.js +1 -1
- package/dist/components/molecules/HeaderTop/index.js +15 -1
- package/dist/components/molecules/HeaderTop/styles.js +1 -1
- package/dist/components/molecules/ProductNameHeader/index.js +6 -4
- package/dist/components/molecules/StatusAsignationInfo/index.js +1 -1
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -0
- package/dist/components/organisms/ProductImageModal/index.js +10 -3
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +214 -30
- package/dist/components/pages/ProviderProductEdition/index.js +86 -65
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +88 -52
- package/dist/components/pages/RetailerProductEdition/index.js +27 -18
- package/dist/components/pages/RetailerProductEdition/utils.js +1 -1
- package/dist/global-files/data.js +18 -23
- package/dist/global-files/fonts.css +6 -0
- package/dist/global-files/variables.js +2 -0
- package/dist/index.js +267 -46
- package/package.json +14 -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/assets/images/generalButton/closeIcon.svg +2 -2
- package/src/assets/sounds/newMessage.mp3 +0 -0
- package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +47 -0
- package/src/components/atoms/ButtonFileChooser/index.js +68 -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 +178 -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 +109 -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/GalleryElement/index.js +1 -1
- package/src/components/molecules/HeaderTop/index.js +17 -0
- package/src/components/molecules/HeaderTop/styles.js +5 -2
- 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 +7 -2
- package/src/components/molecules/SelectV2/SelectV2.stories.js +115 -0
- package/src/components/molecules/SelectV2/index.js +357 -0
- package/src/components/molecules/SelectV2/styles.js +105 -0
- package/src/components/molecules/SelectV2/test.js +60 -0
- package/src/components/molecules/SelectV2/test.stories.js +10 -0
- package/src/components/molecules/StatusAsignationInfo/index.js +11 -9
- package/src/components/organisms/Chat/Chat.stories.js +149 -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 +522 -0
- package/src/components/organisms/Chat/ContainerItems/styles.js +348 -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 +922 -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 +661 -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 +93 -0
- package/src/components/organisms/Chat/Header/styles.js +49 -0
- package/src/components/organisms/Chat/index.js +238 -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/ProductImageModal/index.js +6 -3
- 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/ProviderProductEdition.stories.js +239 -32
- package/src/components/pages/ProviderProductEdition/index.js +87 -67
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +93 -52
- package/src/components/pages/RetailerProductEdition/index.js +23 -21
- package/src/components/pages/RetailerProductEdition/utils.js +2 -1
- package/src/global-files/data.js +18 -23
- package/src/global-files/fonts.css +6 -0
- package/src/global-files/handle_http.js +225 -0
- package/src/global-files/handle_userTech.js +7 -0
- package/src/global-files/utils.js +330 -0
- package/src/global-files/variables.js +2 -0
- package/src/index.js +17 -0
- package/src/assets/fonts/roboto/LICENSE.txt +0 -202
|
@@ -12,101 +12,142 @@ 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.eyJzdWIiOiJhNmM0ZDNkNi0yNGE0LTQxZDQtYWQwZi1kMDg3NDM4YWI1YjYiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6ImE2YzRkM2Q2LTI0YTQtNDFkNC1hZDBmLWQwODc0MzhhYjViNiIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJhY2FmNjhiOC00MmU1LTQ1NzAtYThiMC04YWY4NmY3MGU5YTEiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY3ODQ5NDYzNiwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY3ODQ5ODIzNiwiaWF0IjoxNjc4NDk0NjM2LCJlbWFpbCI6ImV0Y0Bjb250ZW50b2guY29tIn0.WoO3h0tAsF_Z4f_6BLIOXaL__TzHUxZyQlDAULQ2cT1HkUs0EmTZXRzRZ4oce7rV5osco9gCWfhc03rQ-C12jmU-Yt7jq3vuuoHUz4JqkLpelZPS8jHSsCAUWu_ekOIgDzvNegiyKk2R4qnd7IRPzWOAx1houg-KKT7kxCxjkTyJJGtzb7pYDLSJSV871nS8MeXGf5VZG5rQ3Smfl8ANqypLUEQQ6gSOr30Ztt1lZaHRmhF8WKo_GWwY3jNScmX_o9QGOSvKVl8hTqz4gA9xbiNJ3zpoh_5PzY-N4Sl8pE3gt_9Zw_o5ItLNHpnXuav_0NENvhXDu7p7VTLEpG8DTA",
|
|
20
20
|
productSelected: {
|
|
21
21
|
services: {
|
|
22
22
|
datasheets: 1,
|
|
23
23
|
descriptions: 1,
|
|
24
24
|
images: 1,
|
|
25
25
|
},
|
|
26
|
-
orderId:
|
|
27
|
-
status: "
|
|
28
|
-
datasheet_status: "
|
|
26
|
+
orderId: 14606,
|
|
27
|
+
status: "AS",
|
|
28
|
+
datasheet_status: "CA",
|
|
29
29
|
prio: "none",
|
|
30
|
-
version:
|
|
31
|
-
description_status: "
|
|
32
|
-
images_status: "
|
|
30
|
+
version: 3,
|
|
31
|
+
description_status: "CA",
|
|
32
|
+
images_status: "AS",
|
|
33
33
|
statusByRetailer: {
|
|
34
|
-
|
|
35
|
-
datasheet: "
|
|
36
|
-
description: "
|
|
37
|
-
images: "
|
|
34
|
+
4: {
|
|
35
|
+
datasheet: "AC",
|
|
36
|
+
description: "CA",
|
|
37
|
+
images: "AS",
|
|
38
|
+
},
|
|
39
|
+
5: {
|
|
40
|
+
datasheet: "CA",
|
|
41
|
+
description: "CA",
|
|
42
|
+
images: "AS",
|
|
43
|
+
},
|
|
44
|
+
6: {
|
|
45
|
+
description: "CA",
|
|
46
|
+
images: "AS",
|
|
47
|
+
datasheet: "CA",
|
|
48
|
+
},
|
|
49
|
+
12: {
|
|
50
|
+
datasheet: "CA",
|
|
51
|
+
description: "CA",
|
|
52
|
+
images: "AS",
|
|
53
|
+
},
|
|
54
|
+
17: {
|
|
55
|
+
datasheet: "CA",
|
|
56
|
+
description: "AC",
|
|
57
|
+
images: "AS",
|
|
38
58
|
},
|
|
39
59
|
},
|
|
40
60
|
article: {
|
|
41
|
-
id_article:
|
|
42
|
-
id_category: "
|
|
43
|
-
name: "
|
|
44
|
-
upc: "
|
|
45
|
-
timestamp: "
|
|
61
|
+
id_article: 37317,
|
|
62
|
+
id_category: "157",
|
|
63
|
+
name: "Detergente lavatrastres líquido Axion Complete tricloro 1.1 l",
|
|
64
|
+
upc: "7509546078915",
|
|
65
|
+
timestamp: "2023-03-10T20:19:15.000Z",
|
|
46
66
|
id_user: 28,
|
|
47
67
|
status: "NULL",
|
|
48
68
|
active: 1,
|
|
49
|
-
company_id:
|
|
50
|
-
|
|
69
|
+
company_id: 1005,
|
|
70
|
+
SKU: null,
|
|
71
|
+
Descripcion: null,
|
|
72
|
+
Proveedor: null,
|
|
73
|
+
id_proveedor: 0,
|
|
74
|
+
company_name: "CRS Transformaciones",
|
|
51
75
|
country: "México",
|
|
52
|
-
id_order:
|
|
53
|
-
id_datasheet_especialist:
|
|
54
|
-
id_datasheet_facilitator:
|
|
55
|
-
id_description_especialist:
|
|
56
|
-
id_description_facilitator:
|
|
57
|
-
id_images_especialist:
|
|
58
|
-
id_images_facilitator:
|
|
59
|
-
id_auditor:
|
|
76
|
+
id_order: 14606,
|
|
77
|
+
id_datasheet_especialist: 54,
|
|
78
|
+
id_datasheet_facilitator: 52,
|
|
79
|
+
id_description_especialist: 54,
|
|
80
|
+
id_description_facilitator: 52,
|
|
81
|
+
id_images_especialist: 55,
|
|
82
|
+
id_images_facilitator: 53,
|
|
83
|
+
id_auditor: 37,
|
|
60
84
|
id_recepcionist: null,
|
|
61
|
-
category:
|
|
85
|
+
category:
|
|
86
|
+
"Consumibles|Productos de Limpieza y Lavandería|Jabones y Lavatrastes",
|
|
62
87
|
missingAttributes: 0,
|
|
63
88
|
missingDescriptions: 0,
|
|
64
89
|
missingImages: 0,
|
|
65
90
|
},
|
|
66
91
|
retailers: [
|
|
67
92
|
{
|
|
68
|
-
id:
|
|
69
|
-
name: "
|
|
93
|
+
id: 4,
|
|
94
|
+
name: "Walmart Super y Superama",
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 5,
|
|
98
|
+
name: "Chedraui",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: 6,
|
|
102
|
+
name: "HEB",
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 12,
|
|
106
|
+
name: "La Comer",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: 17,
|
|
110
|
+
name: "Genérico",
|
|
70
111
|
},
|
|
71
112
|
],
|
|
72
113
|
country: "México",
|
|
73
|
-
upc: "
|
|
114
|
+
upc: "7509546078915",
|
|
74
115
|
},
|
|
75
116
|
location: {
|
|
76
|
-
product: { articleId:
|
|
117
|
+
product: { articleId: 354, versionId: 3 },
|
|
77
118
|
},
|
|
78
119
|
user: {
|
|
79
|
-
id_user:
|
|
80
|
-
name: "
|
|
81
|
-
last_name: "
|
|
82
|
-
email: "
|
|
83
|
-
position: "
|
|
120
|
+
id_user: 51,
|
|
121
|
+
name: "ADMIN PRUEBA",
|
|
122
|
+
last_name: "",
|
|
123
|
+
email: "etc@contentoh.com",
|
|
124
|
+
position: "",
|
|
84
125
|
telephone: "",
|
|
85
|
-
country: "
|
|
126
|
+
country: "",
|
|
86
127
|
id_company: 2,
|
|
87
|
-
id_cognito: "
|
|
128
|
+
id_cognito: "a6c4d3d6-24a4-41d4-ad0f-d087438ab5b6",
|
|
88
129
|
birth_Date: null,
|
|
89
130
|
about_me: "",
|
|
90
131
|
zip_code: "",
|
|
91
132
|
address: "",
|
|
92
133
|
job: "",
|
|
93
134
|
id_stripe: "",
|
|
94
|
-
id_role:
|
|
135
|
+
id_role: 1,
|
|
95
136
|
active: 1,
|
|
96
137
|
is_retailer: 0,
|
|
97
138
|
email_notify: 1,
|
|
98
|
-
is_user_tech:
|
|
139
|
+
is_user_tech: null,
|
|
99
140
|
membership: {
|
|
100
|
-
id:
|
|
101
|
-
start_date: "
|
|
102
|
-
end_date: "
|
|
103
|
-
planID:
|
|
104
|
-
plan: "
|
|
105
|
-
name: "Plan
|
|
106
|
-
user_limit: "
|
|
107
|
-
products_limit: "
|
|
108
|
-
type: "
|
|
141
|
+
id: 750,
|
|
142
|
+
start_date: "2022-01-07T21:32:54.000Z",
|
|
143
|
+
end_date: "2023-01-07T21:32:54.000Z",
|
|
144
|
+
planID: 6,
|
|
145
|
+
plan: "prod_KvGd6YSTJyR3AP",
|
|
146
|
+
name: "Plan Small",
|
|
147
|
+
user_limit: "10",
|
|
148
|
+
products_limit: "1000",
|
|
149
|
+
type: "Enterprise",
|
|
109
150
|
},
|
|
110
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
151
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-51/51.png?1678494637588",
|
|
111
152
|
},
|
|
112
153
|
};
|
|
@@ -122,6 +122,7 @@ export const RetailerProductEdition = ({
|
|
|
122
122
|
productSelected = {},
|
|
123
123
|
user = {},
|
|
124
124
|
token,
|
|
125
|
+
location,
|
|
125
126
|
}) => {
|
|
126
127
|
const [activeTab, setActiveTab] = useState("Descripción");
|
|
127
128
|
const [activeImage, setActiveImage] = useState();
|
|
@@ -176,6 +177,7 @@ export const RetailerProductEdition = ({
|
|
|
176
177
|
const [percentages, setPercentages] = useState(
|
|
177
178
|
new Array(product?.retailers?.length).fill({ percentage: 0 })
|
|
178
179
|
);
|
|
180
|
+
// const [percentages, setPercentages] = useState([{ retailers: {} }]);
|
|
179
181
|
const [activePercentage, setActivePercentage] = useState(0);
|
|
180
182
|
const [activeRetailer, setActiveRetailer] = useState({});
|
|
181
183
|
const [services, setServices] = useState([]);
|
|
@@ -243,7 +245,9 @@ export const RetailerProductEdition = ({
|
|
|
243
245
|
};
|
|
244
246
|
|
|
245
247
|
useEffect(() => {
|
|
246
|
-
|
|
248
|
+
if (auditableVersion) {
|
|
249
|
+
loadAuditableData();
|
|
250
|
+
}
|
|
247
251
|
}, [auditableVersion]);
|
|
248
252
|
|
|
249
253
|
useEffect(() => {
|
|
@@ -264,12 +268,9 @@ export const RetailerProductEdition = ({
|
|
|
264
268
|
//Converts the data inside the datasheets object to array
|
|
265
269
|
setServices(services);
|
|
266
270
|
getServices();
|
|
267
|
-
|
|
268
|
-
// setActiveRetailer(product?.retailers[0]);
|
|
269
271
|
setImages({ action: "init", init: services[2] });
|
|
270
272
|
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
271
|
-
|
|
272
|
-
getPercentage({ data: [product] }).then((res) => setPercentages(res));
|
|
273
|
+
getPercentage({ data: [product] }).then((res) => setPercentages(res[0]));
|
|
273
274
|
setLoading(false);
|
|
274
275
|
} catch (error) {
|
|
275
276
|
console.log(error);
|
|
@@ -410,25 +411,23 @@ export const RetailerProductEdition = ({
|
|
|
410
411
|
}, [userGroups]);
|
|
411
412
|
|
|
412
413
|
useEffect(() => {
|
|
413
|
-
product?.
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
414
|
+
const retailers = product?.retailersAvailable || product?.retailers;
|
|
415
|
+
if (
|
|
416
|
+
Object.keys(percentages[product.article.id_article] ?? {})?.length > 0
|
|
417
|
+
) {
|
|
418
|
+
retailers?.forEach((retailer, index) => {
|
|
419
|
+
retailer["percentage"] = Number(
|
|
420
|
+
percentages[product.article.id_article][retailer.id]
|
|
421
|
+
?.percentageRequired
|
|
422
|
+
);
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
setActivePercentage(retailers[0]?.percentage);
|
|
421
426
|
}, [percentages]);
|
|
422
427
|
|
|
423
428
|
useEffect(() => {
|
|
424
429
|
getInputsData(services, activeRetailer, setDatasheets, setDescriptions);
|
|
425
|
-
auditableVersion &&
|
|
426
|
-
getInputsData(
|
|
427
|
-
auditServices,
|
|
428
|
-
activeRetailer,
|
|
429
|
-
setAuditDatasheets,
|
|
430
|
-
setAuditDescriptions
|
|
431
|
-
);
|
|
430
|
+
auditableVersion && loadAuditableData();
|
|
432
431
|
setActivePercentage(Math.round(activeRetailer?.percentage, 0));
|
|
433
432
|
activeRetailer?.id &&
|
|
434
433
|
setImages({ action: "orderImages", retailerId: activeRetailer.id });
|
|
@@ -1271,6 +1270,9 @@ export const RetailerProductEdition = ({
|
|
|
1271
1270
|
auditableVersion={auditableVersion}
|
|
1272
1271
|
setCompare={setCompare}
|
|
1273
1272
|
isAuditor={[1, 6].includes(user.id_role)}
|
|
1273
|
+
withChat={location?.state?.withChat}
|
|
1274
|
+
productSelected={productSelected}
|
|
1275
|
+
token={token}
|
|
1274
1276
|
/>
|
|
1275
1277
|
<div className="data-container">
|
|
1276
1278
|
<div className="image-data-panel">
|
|
@@ -1564,7 +1566,7 @@ export const RetailerProductEdition = ({
|
|
|
1564
1566
|
images={images}
|
|
1565
1567
|
setShowModal={setShowModal}
|
|
1566
1568
|
sendToFacilitator={sendToFacilitator}
|
|
1567
|
-
approveRejectButtons={approveRejectButtons}
|
|
1569
|
+
approveRejectButtons={approveRejectButtons()}
|
|
1568
1570
|
/>
|
|
1569
1571
|
)}
|
|
1570
1572
|
{message.length > 0 && (
|
|
@@ -5,8 +5,9 @@ export const getAuditVersion = async (articleId, setState, token) => {
|
|
|
5
5
|
`${process.env.REACT_APP_GET_AUDIT}?articleId=${articleId}`,
|
|
6
6
|
{ headers: { Authorization: token } }
|
|
7
7
|
);
|
|
8
|
+
|
|
8
9
|
if (auditResponse.status === 200) {
|
|
9
|
-
setState(JSON.parse(auditResponse.data.body).data);
|
|
10
|
+
setState(JSON.parse(auditResponse.data.body).data || "{}");
|
|
10
11
|
}
|
|
11
12
|
};
|
|
12
13
|
|
package/src/global-files/data.js
CHANGED
|
@@ -86,32 +86,27 @@ export const getImage = (imageGeneral, width = 250, height = 250) => {
|
|
|
86
86
|
export const getPercentage = async (params = {}) => {
|
|
87
87
|
const func = async () => {
|
|
88
88
|
const dataToSend = [];
|
|
89
|
+
const arrayRetailers = [];
|
|
89
90
|
let retailers =
|
|
90
91
|
params.data[0].retailers || params.data[0].retailersAvailable;
|
|
91
|
-
params.data.forEach((product) => {
|
|
92
|
+
params.data.forEach((product, i) => {
|
|
93
|
+
dataToSend.push(
|
|
94
|
+
product.article
|
|
95
|
+
? {
|
|
96
|
+
id_article: product.article.id_article,
|
|
97
|
+
id_category: product.article.id_category,
|
|
98
|
+
version: product.version,
|
|
99
|
+
}
|
|
100
|
+
: {
|
|
101
|
+
id_article: product.id_article,
|
|
102
|
+
id_category: product.id_category,
|
|
103
|
+
version: product.version,
|
|
104
|
+
}
|
|
105
|
+
);
|
|
92
106
|
retailers.forEach((retailer) => {
|
|
93
|
-
|
|
94
|
-
product.article
|
|
95
|
-
? {
|
|
96
|
-
id_article: product.article.id_article,
|
|
97
|
-
id_category: product.article.id_category,
|
|
98
|
-
id_retailer: retailer.id,
|
|
99
|
-
version: product.version,
|
|
100
|
-
upc: product.article.upc,
|
|
101
|
-
name: product.article.name,
|
|
102
|
-
retailerName: retailer.name,
|
|
103
|
-
}
|
|
104
|
-
: {
|
|
105
|
-
id_article: product.id_article,
|
|
106
|
-
id_category: product.id_category,
|
|
107
|
-
id_retailer: retailer.id,
|
|
108
|
-
version: product.version,
|
|
109
|
-
upc: product.upc,
|
|
110
|
-
name: product.name,
|
|
111
|
-
retailerName: retailer.name,
|
|
112
|
-
}
|
|
113
|
-
);
|
|
107
|
+
arrayRetailers.push(retailer.id);
|
|
114
108
|
});
|
|
109
|
+
dataToSend[i].id_retailer_array = arrayRetailers;
|
|
115
110
|
});
|
|
116
111
|
|
|
117
112
|
return await axios
|
|
@@ -125,7 +120,7 @@ export const getPercentage = async (params = {}) => {
|
|
|
125
120
|
}
|
|
126
121
|
)
|
|
127
122
|
.then((response) => {
|
|
128
|
-
return response.data;
|
|
123
|
+
return [response.data];
|
|
129
124
|
})
|
|
130
125
|
.catch((err) => console.log(err, "Errror"));
|
|
131
126
|
};
|
|
@@ -0,0 +1,225 @@
|
|
|
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
|
+
try {
|
|
24
|
+
let URL = endpoint;
|
|
25
|
+
const keysParamsQuery = Object.keys(paramsQuery);
|
|
26
|
+
// agregar cada param query a la URL
|
|
27
|
+
keysParamsQuery.forEach((key, index) => {
|
|
28
|
+
if (index == 0) {
|
|
29
|
+
URL += `?${key}=${paramsQuery[key]}`;
|
|
30
|
+
} else {
|
|
31
|
+
URL += `&${key}=${paramsQuery[key]}`;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const respHTTPjson = await axios.get(URL, { headers: paramsHeaders });
|
|
35
|
+
// verificar si existe un error en la peticion realizada
|
|
36
|
+
if (respHTTPjson.status !== 200) {
|
|
37
|
+
return response({
|
|
38
|
+
message: "No fue posible llevar a cabo la operación",
|
|
39
|
+
errorDetail: respHTTPjson.statusText,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
// obtener body backend
|
|
43
|
+
const body = JSON.parse(respHTTPjson.data.body);
|
|
44
|
+
|
|
45
|
+
// verificar si existe error desde el backend
|
|
46
|
+
if (respHTTPjson.data.statusCode !== 200) {
|
|
47
|
+
return response({
|
|
48
|
+
message: body.message ?? "",
|
|
49
|
+
errorDetail: body.errorDetail ?? "",
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// success
|
|
53
|
+
return response({ body });
|
|
54
|
+
} catch (err) {
|
|
55
|
+
return response({
|
|
56
|
+
message: "Error al obtener los datos",
|
|
57
|
+
errorDetail: err.message,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
//============================================================
|
|
64
|
+
/**
|
|
65
|
+
* funcion que realiza un axios POST
|
|
66
|
+
*
|
|
67
|
+
* Si <body> es undefined significa que hubo error
|
|
68
|
+
|
|
69
|
+
* @returns { Promise<{
|
|
70
|
+
* body: {} | undefined ,
|
|
71
|
+
* message: string,
|
|
72
|
+
* errorDetail: string
|
|
73
|
+
* }> }
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
//============================================================
|
|
77
|
+
export const fetchPOST = (
|
|
78
|
+
endpoint = "",
|
|
79
|
+
paramsBody = {},
|
|
80
|
+
paramsHeaders = {}
|
|
81
|
+
) => {
|
|
82
|
+
return new Promise(async (response) => {
|
|
83
|
+
try {
|
|
84
|
+
const respHTTPjson = await axios.post(endpoint, paramsBody, {
|
|
85
|
+
headers: paramsHeaders,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// verificar si existe un error en la peticion realizada
|
|
89
|
+
if (respHTTPjson.status !== 200) {
|
|
90
|
+
return response({
|
|
91
|
+
message: "No fue posible llevar a cabo la operación",
|
|
92
|
+
errorDetail: respHTTPjson.statusText,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
// obtener body backend
|
|
96
|
+
const body = JSON.parse(respHTTPjson.data.body);
|
|
97
|
+
|
|
98
|
+
// verificar si existe error desde el backend
|
|
99
|
+
if (respHTTPjson.data.statusCode !== 200) {
|
|
100
|
+
return response({
|
|
101
|
+
message: body.message ?? "",
|
|
102
|
+
errorDetail: body.errorDetail ?? "",
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
// success
|
|
106
|
+
return response({ body });
|
|
107
|
+
} catch (err) {
|
|
108
|
+
return response({
|
|
109
|
+
message: "Error al guardar los datos",
|
|
110
|
+
errorDetail: err.message,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
//============================================================
|
|
117
|
+
/**
|
|
118
|
+
* funcion que realiza un axios GET
|
|
119
|
+
*
|
|
120
|
+
* Si <body> es undefined significa que hubo error
|
|
121
|
+
|
|
122
|
+
* @returns { Promise<{
|
|
123
|
+
* body: {} | undefined ,
|
|
124
|
+
* message: string,
|
|
125
|
+
* errorDetail: string
|
|
126
|
+
* }> }
|
|
127
|
+
*
|
|
128
|
+
*/
|
|
129
|
+
//============================================================
|
|
130
|
+
export const fetchPUT = (
|
|
131
|
+
endpoint = "",
|
|
132
|
+
paramsBody = {},
|
|
133
|
+
paramsHeaders = {}
|
|
134
|
+
) => {
|
|
135
|
+
return new Promise(async (response) => {
|
|
136
|
+
try {
|
|
137
|
+
const respHTTPjson = await axios.put(endpoint, paramsBody, {
|
|
138
|
+
headers: paramsHeaders,
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// verificar si existe un error en la peticion realizada
|
|
142
|
+
if (respHTTPjson.status !== 200) {
|
|
143
|
+
return response({
|
|
144
|
+
message: "No fue posible llevar a cabo la operación",
|
|
145
|
+
errorDetail: respHTTPjson.statusText,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// obtener body backend
|
|
150
|
+
const body = JSON.parse(respHTTPjson.data.body);
|
|
151
|
+
|
|
152
|
+
// verificar si existe error desde el backend
|
|
153
|
+
if (respHTTPjson.data.statusCode !== 200) {
|
|
154
|
+
return response({
|
|
155
|
+
message: body.message ?? "",
|
|
156
|
+
errorDetail: body.errorDetail ?? "",
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// success
|
|
161
|
+
return response({ body });
|
|
162
|
+
} catch (err) {
|
|
163
|
+
return response({
|
|
164
|
+
message: "Error al actualizar los datos",
|
|
165
|
+
errorDetail: err.message,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
//============================================================
|
|
172
|
+
/**
|
|
173
|
+
* funcion que realiza un axios GET
|
|
174
|
+
*
|
|
175
|
+
* Si <body> es undefined significa que hubo error
|
|
176
|
+
|
|
177
|
+
* @returns { Promise<{
|
|
178
|
+
* body: {} | undefined ,
|
|
179
|
+
* message: string,
|
|
180
|
+
* errorDetail: string
|
|
181
|
+
* }> }
|
|
182
|
+
*
|
|
183
|
+
*/
|
|
184
|
+
//============================================================
|
|
185
|
+
export const fetchDELETE = (
|
|
186
|
+
endpoint = "",
|
|
187
|
+
paramsBody = {},
|
|
188
|
+
paramsHeaders = {}
|
|
189
|
+
) => {
|
|
190
|
+
return new Promise(async (response) => {
|
|
191
|
+
try {
|
|
192
|
+
const respHTTPjson = await axios.delete(endpoint, {
|
|
193
|
+
data: paramsBody,
|
|
194
|
+
headers: paramsHeaders,
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
// verificar si existe un error en la peticion realizada
|
|
198
|
+
if (respHTTPjson.status !== 200) {
|
|
199
|
+
return response({
|
|
200
|
+
message: "No fue posible llevar a cabo la operación",
|
|
201
|
+
errorDetail: respHTTPjson.statusText,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// obtener body backend
|
|
206
|
+
const body = JSON.parse(respHTTPjson.data.body);
|
|
207
|
+
|
|
208
|
+
// verificar si existe error desde el backend
|
|
209
|
+
if (respHTTPjson.data.statusCode !== 200) {
|
|
210
|
+
return response({
|
|
211
|
+
message: body.message ?? "",
|
|
212
|
+
errorDetail: body.errorDetail ?? "",
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// success
|
|
217
|
+
return response({ body });
|
|
218
|
+
} catch (err) {
|
|
219
|
+
return response({
|
|
220
|
+
message: "Error al actualizar los datos",
|
|
221
|
+
errorDetail: err.message,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
};
|