contentoh-components-library 21.4.17 → 21.4.18
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 +5 -1
- package/.env.production +3 -1
- package/dist/assets/fonts/roboto/LICENSE.txt +202 -0
- package/dist/components/atoms/Avatar/index.js +3 -2
- package/dist/components/atoms/Card/index.js +46 -5
- package/dist/components/atoms/Card/styles.js +3 -1
- package/dist/components/atoms/CheckBox/index.js +7 -2
- package/dist/components/atoms/CheckBox/styles.js +1 -1
- package/dist/components/atoms/InputFormatter/styles.js +1 -1
- package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/dist/components/molecules/HeaderTop/index.js +68 -11
- package/dist/components/molecules/TagAndInput/index.js +1 -1
- package/dist/components/organisms/Chat/Chat.stories.js +27 -8
- package/dist/components/organisms/Chat/ContainerItems/index.js +19 -3
- package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
- package/dist/components/organisms/Chat/ContentChat/index.js +350 -197
- package/dist/components/organisms/Chat/Footer/index.js +48 -39
- package/dist/components/organisms/Chat/index.js +49 -4
- package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
- package/dist/components/organisms/Modal/styles.js +1 -1
- package/dist/components/organisms/PanelLayout/PanelLayout.stories.js +1 -1
- package/dist/components/organisms/PanelLayout/index.js +4 -4
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +88 -120
- package/dist/components/pages/ProviderProductEdition/index.js +216 -200
- package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +56 -52
- package/dist/components/pages/RetailerProductEdition/index.js +318 -300
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/utils.js +61 -2
- package/dist/index.js +247 -52
- package/package.json +4 -1
- package/src/components/atoms/Avatar/index.js +8 -2
- package/src/components/atoms/Card/index.js +35 -2
- package/src/components/atoms/Card/styles.js +41 -5
- package/src/components/atoms/CheckBox/index.js +4 -1
- package/src/components/atoms/CheckBox/styles.js +2 -0
- package/src/components/atoms/ImageCarousel/ImgeSlider.stories.js +76 -0
- package/src/components/atoms/ImageCarousel/index.js +103 -0
- package/src/components/atoms/ImageCarousel/styles.js +79 -0
- package/src/components/atoms/InputFormatter/styles.js +2 -1
- package/src/components/atoms/PercentTag/PercentTag.stories.js +7 -0
- package/src/components/atoms/PercentTag/index.js +9 -0
- package/src/components/atoms/PercentTag/styles.js +69 -0
- package/src/components/atoms/RatingStars/RatingStars.stories.js +10 -0
- package/src/components/atoms/RatingStars/index.js +31 -0
- package/src/components/atoms/RatingStars/styles.js +28 -0
- package/src/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +36 -0
- package/src/components/atoms/RetailerCatalog/index.js +49 -0
- package/src/components/atoms/RetailerCatalog/styles.js +30 -0
- package/src/components/atoms/RetailerOption/RetailerOption.stories.js +15 -0
- package/src/components/atoms/RetailerOption/index.js +53 -0
- package/src/components/atoms/RetailerOption/styles.js +41 -0
- package/src/components/atoms/RetailersList/RetailersList.stories.js +33 -0
- package/src/components/atoms/RetailersList/index.js +20 -0
- package/src/components/atoms/RetailersList/styles.js +19 -0
- package/src/components/atoms/UserCatalog/UserCatalog.stories.js +67 -0
- package/src/components/atoms/UserCatalog/index.js +100 -0
- package/src/components/atoms/UserCatalog/styles.js +24 -0
- package/src/components/atoms/UserOption/UserOption.stories.js +25 -0
- package/src/components/atoms/UserOption/index.js +95 -0
- package/src/components/atoms/UserOption/styles.js +61 -0
- package/src/components/atoms/UserSelector/UserSelector.stories.js +25 -0
- package/src/components/atoms/UserSelector/index.js +86 -0
- package/src/components/atoms/UserSelector/styles.js +55 -0
- package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/src/components/molecules/GridItem/GridItem.stories.js +126 -0
- package/src/components/molecules/GridItem/index.js +105 -0
- package/src/components/molecules/GridItem/styles.js +104 -0
- package/src/components/molecules/HeaderItem/ColumnItem.js +9 -0
- package/src/components/molecules/HeaderItem/HeaderItem.stories.js +24 -0
- package/src/components/molecules/HeaderItem/index.js +26 -0
- package/src/components/molecules/HeaderItem/styles.js +27 -0
- package/src/components/molecules/HeaderTop/index.js +52 -6
- package/src/components/molecules/RowItem/ColumnItem.js +9 -0
- package/src/components/molecules/RowItem/RowItem.stories.js +5660 -0
- package/src/components/molecules/RowItem/index.js +45 -0
- package/src/components/molecules/RowItem/styles.js +40 -0
- package/src/components/molecules/StripeCardForm/StripeCardForm.stories.js +13 -0
- package/src/components/molecules/StripeCardForm/index.js +42 -0
- package/src/components/molecules/StripeCardForm/paymentForm.js +124 -0
- package/src/components/molecules/StripeCardForm/styles.js +73 -0
- package/src/components/molecules/StripeCardSelector/CardSelector.stories.js +12 -0
- package/src/components/molecules/StripeCardSelector/index.js +44 -0
- package/src/components/molecules/StripeCardSelector/styles.js +4 -0
- package/src/components/molecules/StripeCardSelector/utils.js +17 -0
- package/src/components/molecules/TagAndInput/index.js +10 -8
- package/src/components/organisms/Chat/Chat.stories.js +27 -7
- package/src/components/organisms/Chat/ContainerItems/index.js +18 -2
- package/src/components/organisms/Chat/ContainerItems/styles.js +10 -2
- package/src/components/organisms/Chat/ContentChat/index.js +88 -12
- package/src/components/organisms/Chat/Footer/index.js +11 -0
- package/src/components/organisms/Chat/index.js +46 -4
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/organisms/GridProducts/GridProducts.stories.js +5485 -0
- package/src/components/organisms/GridProducts/index.js +50 -0
- package/src/components/organisms/GridProducts/styles.js +14 -0
- package/src/components/organisms/GridProducts/utils.js +111 -0
- package/src/components/organisms/Modal/styles.js +4 -1
- package/src/components/organisms/OrderDetail/utils/Table/utils.js +6 -16
- package/src/components/organisms/PanelLayout/PanelLayout.stories.js +63 -0
- package/src/components/organisms/PanelLayout/index.js +11 -0
- package/src/components/organisms/PanelLayout/styles.js +33 -0
- package/src/components/organisms/SideModal/SideModal.stories.js +23 -0
- package/src/components/organisms/SideModal/index.js +50 -0
- package/src/components/organisms/SideModal/styles.js +30 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +95 -127
- package/src/components/pages/ProviderProductEdition/index.js +135 -129
- package/src/components/pages/ProviderProductEdition/styles.js +5 -1
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +55 -52
- package/src/components/pages/RetailerProductEdition/index.js +124 -136
- package/src/components/pages/RetailerProductEdition/styles.js +4 -0
- package/src/components/pages/RetailerProductEdition/utils.js +37 -0
- package/src/index.js +16 -0
|
@@ -107,6 +107,10 @@ export const Container = styled.div`
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
+
#modal-message-box {
|
|
111
|
+
width: 400px;
|
|
112
|
+
height: 100px;
|
|
113
|
+
}
|
|
110
114
|
.container {
|
|
111
115
|
width: 100%;
|
|
112
116
|
height: 100%;
|
|
@@ -115,4 +119,4 @@ export const Container = styled.div`
|
|
|
115
119
|
width: 100%;
|
|
116
120
|
}
|
|
117
121
|
}
|
|
118
|
-
`;
|
|
122
|
+
`;
|
|
@@ -16,83 +16,86 @@ RetailerProductEditionDefault.args = {
|
|
|
16
16
|
Imágenes: false,
|
|
17
17
|
},
|
|
18
18
|
token:
|
|
19
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.
|
|
19
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI5YTIxMzEyOC02NDgyLTRjMTYtYTRiNi02ZTY0ZjIyNWIxYmQiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6IjlhMjEzMTI4LTY0ODItNGMxNi1hNGI2LTZlNjRmMjI1YjFiZCIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiI5OGE0NzYxMy04ZGIyLTRlZjUtYjA0Mi01ZDU3MWRkZjIwMWIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY4Mzg3NTIyNiwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY4Mzg3ODgyNiwiaWF0IjoxNjgzODc1MjI2LCJlbWFpbCI6ImlzbWFlbDk3bG9wZXpAZ21haWwuY29tIn0.EtgmT_THMx-Zy_zB5yZK4gz6TXNTVVJEKFt5X0JK2UkGVrp_q_92YCEuejS4n976fyTez0jkwOee6IkVHLV71uZWRBDFt-3Yw4ZxfsZYPNJWhoHXGNxhMU8MCkSntfu597esBTk-VsUpstT5R7L-WJfN8viE7R-qVo-42RlPTG0TFrWA9q0oTcqjv8vbxLpOBUjiEpjmqRhg4blJZwgkGNta6MOlw1vfmisOVbo9wMvqwnCZ9xx9KMKoH9U4uNObK_JomjbvPmTmkcUXsE-wGSD7XcoSwtuhBngLC7-jiu1u8MvL_ff5Z0Qp70sSpLdUglcSS8d1Xf7j_fcZuJ5jKA",
|
|
20
20
|
productSelected: {
|
|
21
|
-
orderId: 15160,
|
|
22
|
-
status: "SAC",
|
|
23
|
-
datasheet_status: "SAC",
|
|
24
|
-
prio: "none",
|
|
25
|
-
version: 7,
|
|
26
|
-
description_status: "SAC",
|
|
27
|
-
images_status: "SAC",
|
|
28
|
-
brand: null,
|
|
29
|
-
retailerOrder: 1,
|
|
30
|
-
missing: {
|
|
31
|
-
datasheet: null,
|
|
32
|
-
descriptions: null,
|
|
33
|
-
images: null,
|
|
34
|
-
},
|
|
35
21
|
services: {
|
|
36
22
|
datasheets: 1,
|
|
37
23
|
descriptions: 1,
|
|
38
24
|
images: 1,
|
|
39
25
|
},
|
|
26
|
+
orderId: 15275,
|
|
27
|
+
status: "AC",
|
|
28
|
+
datasheet_status: "AC",
|
|
29
|
+
prio: "none",
|
|
30
|
+
version: 3,
|
|
31
|
+
description_status: "AC",
|
|
32
|
+
images_status: "AC",
|
|
33
|
+
statusByRetailer: {
|
|
34
|
+
34: {
|
|
35
|
+
datasheet: "AC",
|
|
36
|
+
description: "AC",
|
|
37
|
+
images: "AC",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
40
|
article: {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
id_article: 39485,
|
|
42
|
+
id_category: "11",
|
|
43
|
+
name: "Mix de nueces",
|
|
44
|
+
upc: "7543453453",
|
|
45
|
+
timestamp: "2023-07-14T21:02:54.000Z",
|
|
46
|
+
id_user: 28,
|
|
47
|
+
status: "NULL",
|
|
48
|
+
active: 1,
|
|
49
|
+
company_id: 1,
|
|
50
|
+
company_name: "GRUPO BRAHMA",
|
|
43
51
|
country: "México",
|
|
44
|
-
|
|
45
|
-
id_datasheet_especialist:
|
|
46
|
-
id_datasheet_facilitator:
|
|
47
|
-
id_description_especialist:
|
|
48
|
-
id_description_facilitator:
|
|
49
|
-
id_images_especialist:
|
|
50
|
-
id_images_facilitator:
|
|
51
|
-
id_order: 15160,
|
|
52
|
-
id_article: 39290,
|
|
52
|
+
id_order: 15275,
|
|
53
|
+
id_datasheet_especialist: 54,
|
|
54
|
+
id_datasheet_facilitator: 52,
|
|
55
|
+
id_description_especialist: 54,
|
|
56
|
+
id_description_facilitator: 52,
|
|
57
|
+
id_images_especialist: 55,
|
|
58
|
+
id_images_facilitator: 53,
|
|
53
59
|
id_auditor: 37,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
id_recepcionist: null,
|
|
61
|
+
category: "Abarrotes|Abarrotes Secos|Frutos Secos",
|
|
62
|
+
missingAttributes: 0,
|
|
63
|
+
missingDescriptions: 0,
|
|
64
|
+
missingImages: 0,
|
|
57
65
|
},
|
|
58
66
|
retailers: [
|
|
59
67
|
{
|
|
60
|
-
id:
|
|
61
|
-
name: "
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
id: 68,
|
|
65
|
-
name: "The Home Depot Merchants",
|
|
68
|
+
id: 34,
|
|
69
|
+
name: "San Pablo",
|
|
66
70
|
},
|
|
67
71
|
],
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
datasheet: "SAC",
|
|
71
|
-
description: "SAC",
|
|
72
|
-
images: "SAC",
|
|
73
|
-
},
|
|
74
|
-
},
|
|
72
|
+
country: "México",
|
|
73
|
+
upc: "7543453453",
|
|
75
74
|
},
|
|
76
75
|
location: {
|
|
77
|
-
product: { articleId:
|
|
76
|
+
product: { articleId: 354, versionId: 3 },
|
|
77
|
+
state: {
|
|
78
|
+
withChat: true,
|
|
79
|
+
chatType: "product_status",
|
|
80
|
+
},
|
|
78
81
|
},
|
|
79
82
|
user: {
|
|
80
|
-
id_user:
|
|
81
|
-
name: "
|
|
82
|
-
last_name: "",
|
|
83
|
-
email: "
|
|
84
|
-
position: "",
|
|
83
|
+
id_user: 37,
|
|
84
|
+
name: "José",
|
|
85
|
+
last_name: "Castañeda",
|
|
86
|
+
email: "ismael97lopez@gmail.com",
|
|
87
|
+
position: "Auditor",
|
|
85
88
|
telephone: "",
|
|
86
|
-
country: "",
|
|
89
|
+
country: "México",
|
|
87
90
|
id_company: 2,
|
|
88
|
-
id_cognito: "
|
|
91
|
+
id_cognito: "9a213128-6482-4c16-a4b6-6e64f225b1bd",
|
|
89
92
|
birth_Date: null,
|
|
90
93
|
about_me: "",
|
|
91
94
|
zip_code: "",
|
|
92
95
|
address: "",
|
|
93
96
|
job: "",
|
|
94
97
|
id_stripe: "",
|
|
95
|
-
id_role:
|
|
98
|
+
id_role: 6,
|
|
96
99
|
active: 1,
|
|
97
100
|
is_retailer: 0,
|
|
98
101
|
email_notify: 1,
|
|
@@ -108,6 +111,6 @@ RetailerProductEditionDefault.args = {
|
|
|
108
111
|
products_limit: "3",
|
|
109
112
|
type: "PyMES",
|
|
110
113
|
},
|
|
111
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
114
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-37/37.png?1691175586149",
|
|
112
115
|
},
|
|
113
116
|
};
|
|
@@ -24,15 +24,20 @@ import descriptionSent from "../../../assets/images/modalsSVGs/descriptionSent.s
|
|
|
24
24
|
import imagesSent from "../../../assets/images/modalsSVGs/uploadingImages.svg";
|
|
25
25
|
import { TagAndInput } from "../../molecules/TagAndInput/index";
|
|
26
26
|
import { Button } from "../../atoms/GeneralButton";
|
|
27
|
-
import { Commentary } from "../../atoms/Commentary";
|
|
28
27
|
import { GenericModal } from "../../atoms/GenericModal";
|
|
29
28
|
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
30
29
|
import { Loading } from "../../atoms/Loading";
|
|
31
30
|
import succes from "../../../assets/images/genericModal/genericModalCheck.svg";
|
|
32
|
-
import errorModal from "../../../assets/images/genericModal/errorModal.svg";
|
|
33
31
|
import { VersionSelector } from "../../organisms/VersionSelector";
|
|
34
32
|
import { useCloseModal } from "../../../global-files/customHooks";
|
|
35
|
-
import {
|
|
33
|
+
import {
|
|
34
|
+
getAuditVersion,
|
|
35
|
+
getInputsData,
|
|
36
|
+
createMessage,
|
|
37
|
+
sendMessage,
|
|
38
|
+
} from "./utils";
|
|
39
|
+
import { Modal } from "../../organisms/Modal";
|
|
40
|
+
import { ButtonV2 } from "../../atoms/ButtonV2";
|
|
36
41
|
|
|
37
42
|
const reducerImages = (state, action) => {
|
|
38
43
|
let { values, attrForImgs, inputsByRetailer } = state;
|
|
@@ -132,6 +137,7 @@ export const RetailerProductEdition = ({
|
|
|
132
137
|
const [datasheets, setDatasheets] = useState([]);
|
|
133
138
|
const [images, setImages] = useReducer(reducerImages, {});
|
|
134
139
|
const [showModal, setShowModal] = useState(false);
|
|
140
|
+
const [showRejectModal, setShowRejectModal] = useState(false);
|
|
135
141
|
const { getRootProps, getInputProps } = useDropzone({
|
|
136
142
|
accept: "image/*",
|
|
137
143
|
noKeyboard: true,
|
|
@@ -218,6 +224,11 @@ export const RetailerProductEdition = ({
|
|
|
218
224
|
const [auditDescriptions, setAuditDescriptions] = useState([]);
|
|
219
225
|
const [auditImages, setAuditImages] = useState([]);
|
|
220
226
|
const [compare, setCompare] = useState(false);
|
|
227
|
+
const [valRejAll, setValRejAll] = useState(false);
|
|
228
|
+
|
|
229
|
+
const [desc, setDesc] = useState([]);
|
|
230
|
+
const [fich, setFich] = useState([]);
|
|
231
|
+
const [imag, setImag] = useState([]);
|
|
221
232
|
|
|
222
233
|
useEffect(async () => {
|
|
223
234
|
const { id_article } = product?.article || {};
|
|
@@ -502,6 +513,7 @@ export const RetailerProductEdition = ({
|
|
|
502
513
|
JSON.stringify(productTemp)
|
|
503
514
|
);
|
|
504
515
|
|
|
516
|
+
setUpdatedDescriptions([]);
|
|
505
517
|
setMessage("Descripciones guardadas con éxito");
|
|
506
518
|
await loadData();
|
|
507
519
|
}
|
|
@@ -542,7 +554,7 @@ export const RetailerProductEdition = ({
|
|
|
542
554
|
"productSelected",
|
|
543
555
|
JSON.stringify(productTemp)
|
|
544
556
|
);
|
|
545
|
-
|
|
557
|
+
setUpdatedDatasheets([]);
|
|
546
558
|
setMessage("Fichas técnicas guardadas");
|
|
547
559
|
await loadData();
|
|
548
560
|
}
|
|
@@ -560,6 +572,7 @@ export const RetailerProductEdition = ({
|
|
|
560
572
|
active: images?.values?.some((value) => value?.image_id === e?.id),
|
|
561
573
|
}));
|
|
562
574
|
setSocketType(imageInputs);
|
|
575
|
+
console.log(images);
|
|
563
576
|
}, [images]);
|
|
564
577
|
|
|
565
578
|
const updateImages = useCallback(async () => {
|
|
@@ -673,6 +686,7 @@ export const RetailerProductEdition = ({
|
|
|
673
686
|
"productSelected",
|
|
674
687
|
JSON.stringify(productTemp)
|
|
675
688
|
);
|
|
689
|
+
setImages({});
|
|
676
690
|
setMessage("Imágenes guardadas con éxito");
|
|
677
691
|
sessionStorage.removeItem("imagesList");
|
|
678
692
|
await loadData();
|
|
@@ -855,6 +869,25 @@ export const RetailerProductEdition = ({
|
|
|
855
869
|
const { newStatus, newOrderStatus, newArticleStatus } = JSON.parse(
|
|
856
870
|
res.data.body
|
|
857
871
|
);
|
|
872
|
+
const messageToChat = createMessage(
|
|
873
|
+
product.retailers,
|
|
874
|
+
activeRetailer.id,
|
|
875
|
+
evalStatus,
|
|
876
|
+
newStatus,
|
|
877
|
+
activeTab
|
|
878
|
+
);
|
|
879
|
+
|
|
880
|
+
const data = {
|
|
881
|
+
paramsBody: {
|
|
882
|
+
id: product.article.id_article,
|
|
883
|
+
version: version,
|
|
884
|
+
items: [{ type: "status", value: messageToChat }],
|
|
885
|
+
retailerId: activeRetailer.id,
|
|
886
|
+
status: product.status,
|
|
887
|
+
},
|
|
888
|
+
paramsHeader: { Authorization: token },
|
|
889
|
+
};
|
|
890
|
+
await sendMessage(data);
|
|
858
891
|
if (newOrderStatus) productTemp.status = newArticleStatus[articleId];
|
|
859
892
|
productTemp[`${concept}_status`] = newStatus;
|
|
860
893
|
await loadData();
|
|
@@ -897,35 +930,19 @@ export const RetailerProductEdition = ({
|
|
|
897
930
|
return product?.article[`id_auditor`] === user.id_user;
|
|
898
931
|
};
|
|
899
932
|
|
|
900
|
-
const createComment = async (
|
|
901
|
-
let concept = "";
|
|
902
|
-
switch (activeTab) {
|
|
903
|
-
case "Ficha técnica":
|
|
904
|
-
concept = "datasheet";
|
|
905
|
-
break;
|
|
906
|
-
case "Imágenes":
|
|
907
|
-
concept = "images";
|
|
908
|
-
break;
|
|
909
|
-
|
|
910
|
-
default:
|
|
911
|
-
concept = "description";
|
|
912
|
-
break;
|
|
913
|
-
}
|
|
933
|
+
const createComment = async (messages = [], retailerId) => {
|
|
914
934
|
const data = {
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
await axios.post(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
|
|
922
|
-
headers: {
|
|
923
|
-
Authorization: token,
|
|
935
|
+
paramsBody: {
|
|
936
|
+
id: product.article.id_article,
|
|
937
|
+
version: version,
|
|
938
|
+
items: messages,
|
|
939
|
+
retailerId: retailerId,
|
|
940
|
+
status: product.status,
|
|
924
941
|
},
|
|
925
|
-
|
|
926
|
-
|
|
942
|
+
paramsHeader: { Authorization: token },
|
|
943
|
+
};
|
|
927
944
|
setMessage("");
|
|
928
|
-
|
|
945
|
+
return sendMessage(data);
|
|
929
946
|
};
|
|
930
947
|
|
|
931
948
|
const getRequired = (services) => {
|
|
@@ -1177,6 +1194,7 @@ export const RetailerProductEdition = ({
|
|
|
1177
1194
|
};
|
|
1178
1195
|
|
|
1179
1196
|
useEffect(() => {
|
|
1197
|
+
console.log(servicesData, "servicesData");
|
|
1180
1198
|
let status = getRetailerStatus(servicesData, activeTab);
|
|
1181
1199
|
setRetailerStatus(status);
|
|
1182
1200
|
}, [activeTab, servicesData, activeRetailer]);
|
|
@@ -1207,6 +1225,8 @@ export const RetailerProductEdition = ({
|
|
|
1207
1225
|
break;
|
|
1208
1226
|
}
|
|
1209
1227
|
|
|
1228
|
+
const messages = [];
|
|
1229
|
+
|
|
1210
1230
|
servicesData?.forEach((ret) => {
|
|
1211
1231
|
if (conceptArray.includes(ret.service)) {
|
|
1212
1232
|
let data = {
|
|
@@ -1217,6 +1237,21 @@ export const RetailerProductEdition = ({
|
|
|
1217
1237
|
evalStatus: ret.status,
|
|
1218
1238
|
retailerId: ret.id_retailer,
|
|
1219
1239
|
};
|
|
1240
|
+
if (product[`${ret.service}_status`] !== "NS") {
|
|
1241
|
+
const message = createMessage(
|
|
1242
|
+
product.retailers,
|
|
1243
|
+
ret.id_retailer,
|
|
1244
|
+
product[`${ret.service}_status`],
|
|
1245
|
+
`${result}A`,
|
|
1246
|
+
ret.service
|
|
1247
|
+
);
|
|
1248
|
+
messages.push(
|
|
1249
|
+
createComment(
|
|
1250
|
+
[{ type: "status", value: message }],
|
|
1251
|
+
ret.id_retailer
|
|
1252
|
+
)
|
|
1253
|
+
);
|
|
1254
|
+
}
|
|
1220
1255
|
evaluationArray.push(
|
|
1221
1256
|
axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
1222
1257
|
headers: {
|
|
@@ -1226,19 +1261,19 @@ export const RetailerProductEdition = ({
|
|
|
1226
1261
|
);
|
|
1227
1262
|
}
|
|
1228
1263
|
});
|
|
1229
|
-
|
|
1230
1264
|
await Promise.all(evaluationArray);
|
|
1231
1265
|
|
|
1232
1266
|
const productTemp = product;
|
|
1233
1267
|
productTemp.status = `${result}A`;
|
|
1234
1268
|
productTemp.datasheet_status =
|
|
1235
|
-
productTemp.datasheet_status === "
|
|
1269
|
+
productTemp.datasheet_status === "NS" ? "NS" : `${result}A`;
|
|
1236
1270
|
productTemp.description_status =
|
|
1237
|
-
productTemp.description_status === "
|
|
1271
|
+
productTemp.description_status === "NS" ? "NS" : `${result}A`;
|
|
1238
1272
|
productTemp.images_status =
|
|
1239
|
-
productTemp.images_status === "
|
|
1273
|
+
productTemp.images_status === "NS" ? "NS" : `${result}A`;
|
|
1240
1274
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1241
1275
|
setProduct(productTemp);
|
|
1276
|
+
const messagesResponse = await Promise.all(messages);
|
|
1242
1277
|
|
|
1243
1278
|
await loadData();
|
|
1244
1279
|
} catch (error) {
|
|
@@ -1254,8 +1289,10 @@ export const RetailerProductEdition = ({
|
|
|
1254
1289
|
setCompare={setCompare}
|
|
1255
1290
|
isAuditor={[1, 6].includes(user.id_role)}
|
|
1256
1291
|
withChat={location?.state?.withChat}
|
|
1257
|
-
|
|
1292
|
+
chatType={location?.state?.chatType}
|
|
1293
|
+
productSelected={product}
|
|
1258
1294
|
token={token}
|
|
1295
|
+
activeRetailer={activeRetailer}
|
|
1259
1296
|
/>
|
|
1260
1297
|
<div className="data-container">
|
|
1261
1298
|
<div className="image-data-panel">
|
|
@@ -1295,36 +1332,7 @@ export const RetailerProductEdition = ({
|
|
|
1295
1332
|
sendToFacilitator("A");
|
|
1296
1333
|
}}
|
|
1297
1334
|
reject={() => {
|
|
1298
|
-
|
|
1299
|
-
setMessage("Rechazado");
|
|
1300
|
-
setComponentsArray([
|
|
1301
|
-
<img src={errorModal} />,
|
|
1302
|
-
<ScreenHeader
|
|
1303
|
-
text={"Agrega tu comentarios para enviar el rechazo"}
|
|
1304
|
-
headerType={"input-name-header"}
|
|
1305
|
-
color={"white"}
|
|
1306
|
-
/>,
|
|
1307
|
-
<TagAndInput
|
|
1308
|
-
label={"Caja de Comentario"}
|
|
1309
|
-
inputType={"textarea"}
|
|
1310
|
-
inputId={"modal-commentary-box"}
|
|
1311
|
-
index={0}
|
|
1312
|
-
color={"white"}
|
|
1313
|
-
/>,
|
|
1314
|
-
<Button
|
|
1315
|
-
buttonType={"general-default-button"}
|
|
1316
|
-
label={"Enviar comentario"}
|
|
1317
|
-
onClick={(e) =>
|
|
1318
|
-
createComment(
|
|
1319
|
-
e,
|
|
1320
|
-
document.querySelector(
|
|
1321
|
-
"#modal-commentary-box .ql-container .ql-editor > p"
|
|
1322
|
-
).innerHTML,
|
|
1323
|
-
activeTab
|
|
1324
|
-
)
|
|
1325
|
-
}
|
|
1326
|
-
/>,
|
|
1327
|
-
]);
|
|
1335
|
+
setShowRejectModal(true);
|
|
1328
1336
|
}}
|
|
1329
1337
|
showApproveRejectAll={
|
|
1330
1338
|
approveRejectAllButtons() && (auditorAssigned() || userAssigned())
|
|
@@ -1334,36 +1342,8 @@ export const RetailerProductEdition = ({
|
|
|
1334
1342
|
}
|
|
1335
1343
|
approveAll={() => validateAll("A")}
|
|
1336
1344
|
rejectAll={() => {
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
setComponentsArray([
|
|
1340
|
-
<img src={errorModal} />,
|
|
1341
|
-
<ScreenHeader
|
|
1342
|
-
text={"Agrega tu comentarios para enviar el rechazo"}
|
|
1343
|
-
headerType={"input-name-header"}
|
|
1344
|
-
color={"white"}
|
|
1345
|
-
/>,
|
|
1346
|
-
<TagAndInput
|
|
1347
|
-
label={"Caja de Comentario"}
|
|
1348
|
-
inputType={"textarea"}
|
|
1349
|
-
inputId={"modal-commentary-box"}
|
|
1350
|
-
index={0}
|
|
1351
|
-
color={"white"}
|
|
1352
|
-
/>,
|
|
1353
|
-
<Button
|
|
1354
|
-
buttonType={"general-default-button"}
|
|
1355
|
-
label={"Enviar comentario"}
|
|
1356
|
-
onClick={(e) =>
|
|
1357
|
-
createComment(
|
|
1358
|
-
e,
|
|
1359
|
-
document.querySelector(
|
|
1360
|
-
"#modal-commentary-box .ql-container .ql-editor > p"
|
|
1361
|
-
).innerHTML,
|
|
1362
|
-
activeTab
|
|
1363
|
-
)
|
|
1364
|
-
}
|
|
1365
|
-
/>,
|
|
1366
|
-
]);
|
|
1345
|
+
setShowRejectModal(true);
|
|
1346
|
+
setValRejAll(true);
|
|
1367
1347
|
}}
|
|
1368
1348
|
/>
|
|
1369
1349
|
<FullTabsMenu
|
|
@@ -1379,6 +1359,12 @@ export const RetailerProductEdition = ({
|
|
|
1379
1359
|
isRetailer={isRetailer}
|
|
1380
1360
|
showSaveButton={auditorAssigned() || userAssigned()}
|
|
1381
1361
|
version={version}
|
|
1362
|
+
desc={desc}
|
|
1363
|
+
setDesc={setDesc}
|
|
1364
|
+
fich={fich}
|
|
1365
|
+
setFich={setFich}
|
|
1366
|
+
imag={imag}
|
|
1367
|
+
setImag={setImag}
|
|
1382
1368
|
updatedDescriptions={updatedDescriptions}
|
|
1383
1369
|
setUpdatedDescriptions={setUpdatedDescriptions}
|
|
1384
1370
|
updatedDatasheets={updatedDatasheets}
|
|
@@ -1493,47 +1479,6 @@ export const RetailerProductEdition = ({
|
|
|
1493
1479
|
{(userAssigned(activeTab) || auditorAssigned()) &&
|
|
1494
1480
|
product[`${getConcept(activeTab)}_status`] !== "NS" && (
|
|
1495
1481
|
<div className="commentary-box">
|
|
1496
|
-
{!comment ? (
|
|
1497
|
-
<div className="commentary">
|
|
1498
|
-
<TagAndInput
|
|
1499
|
-
label={"Caja de Comentario"}
|
|
1500
|
-
inputType={"textarea"}
|
|
1501
|
-
inputCols={80}
|
|
1502
|
-
inputRows={4}
|
|
1503
|
-
inputId={"commentary-box"}
|
|
1504
|
-
index={0}
|
|
1505
|
-
/>
|
|
1506
|
-
<div className="buttons-box">
|
|
1507
|
-
<Button
|
|
1508
|
-
buttonType={"general-transparent-button"}
|
|
1509
|
-
label={"Enviar comentario"}
|
|
1510
|
-
onClick={(e) =>
|
|
1511
|
-
createComment(
|
|
1512
|
-
e,
|
|
1513
|
-
document.querySelector(
|
|
1514
|
-
"#commentary-box .ql-container .ql-editor > p"
|
|
1515
|
-
).innerHTML,
|
|
1516
|
-
activeTab
|
|
1517
|
-
)
|
|
1518
|
-
}
|
|
1519
|
-
/>
|
|
1520
|
-
</div>
|
|
1521
|
-
</div>
|
|
1522
|
-
) : (
|
|
1523
|
-
<div className="feedback-box">
|
|
1524
|
-
<Commentary
|
|
1525
|
-
comment={comment?.message?.replace(/<.*?\/?>/gm, "")}
|
|
1526
|
-
reviewed={crossComment}
|
|
1527
|
-
/>
|
|
1528
|
-
<Button
|
|
1529
|
-
buttonType={"circular-button accept-button"}
|
|
1530
|
-
onClick={async () => {
|
|
1531
|
-
setCrossComment(true);
|
|
1532
|
-
commentRevised();
|
|
1533
|
-
}}
|
|
1534
|
-
/>
|
|
1535
|
-
</div>
|
|
1536
|
-
)}
|
|
1537
1482
|
{[7, 8].includes(user.id_role) && (
|
|
1538
1483
|
<Button
|
|
1539
1484
|
buttonType={
|
|
@@ -1591,6 +1536,49 @@ export const RetailerProductEdition = ({
|
|
|
1591
1536
|
jwt={token}
|
|
1592
1537
|
/>
|
|
1593
1538
|
)}
|
|
1539
|
+
{showRejectModal && (
|
|
1540
|
+
<Modal
|
|
1541
|
+
title={`Agregar mensaje de rechazo para ${activeTab?.toLowerCase()}`}
|
|
1542
|
+
show={showRejectModal}
|
|
1543
|
+
customComponent={
|
|
1544
|
+
<TagAndInput
|
|
1545
|
+
inputType={"textarea"}
|
|
1546
|
+
inputId={"modal-message-box"}
|
|
1547
|
+
index={0}
|
|
1548
|
+
color={"white"}
|
|
1549
|
+
/>
|
|
1550
|
+
}
|
|
1551
|
+
buttons={[
|
|
1552
|
+
<ButtonV2
|
|
1553
|
+
key={"btn-Cancelar"}
|
|
1554
|
+
type={"white"}
|
|
1555
|
+
label={"Cancelar"}
|
|
1556
|
+
size={12}
|
|
1557
|
+
onClick={() => {
|
|
1558
|
+
setShowRejectModal(false);
|
|
1559
|
+
}}
|
|
1560
|
+
/>,
|
|
1561
|
+
<ButtonV2
|
|
1562
|
+
key={"btn-Aceptar"}
|
|
1563
|
+
type={"pink"}
|
|
1564
|
+
label={"Aceptar"}
|
|
1565
|
+
size={12}
|
|
1566
|
+
onClick={async () => {
|
|
1567
|
+
const body = document.querySelector(
|
|
1568
|
+
"#modal-message-box .ql-container .ql-editor > p"
|
|
1569
|
+
).innerHTML;
|
|
1570
|
+
const messages = [
|
|
1571
|
+
{ type: "message", value: body?.replace(/<.*?\/?>/gm, "") },
|
|
1572
|
+
];
|
|
1573
|
+
await createComment(messages, activeRetailer.id);
|
|
1574
|
+
valRejAll ? validateAll("R") : sendToFacilitator("R");
|
|
1575
|
+
setMessage("Rechazado");
|
|
1576
|
+
setShowRejectModal(false);
|
|
1577
|
+
}}
|
|
1578
|
+
/>,
|
|
1579
|
+
]}
|
|
1580
|
+
/>
|
|
1581
|
+
)}
|
|
1594
1582
|
</Container>
|
|
1595
1583
|
);
|
|
1596
1584
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
+
import { fetchPOST } from "../../../global-files/handle_http";
|
|
2
3
|
|
|
3
4
|
export const getAuditVersion = async (articleId, setState, token) => {
|
|
4
5
|
const auditResponse = await axios.get(
|
|
@@ -32,3 +33,39 @@ export const getInputsData = (
|
|
|
32
33
|
setDescriptionState(descriptions);
|
|
33
34
|
}
|
|
34
35
|
};
|
|
36
|
+
|
|
37
|
+
export const translateService = (tab) => {
|
|
38
|
+
switch (tab) {
|
|
39
|
+
case "description":
|
|
40
|
+
case "Descripción":
|
|
41
|
+
return "Descripciones";
|
|
42
|
+
case "datasheet":
|
|
43
|
+
case "Ficha técnica":
|
|
44
|
+
return "Fichas técnicas";
|
|
45
|
+
case "images":
|
|
46
|
+
case "Imágenes":
|
|
47
|
+
return "Imágenes";
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const createMessage = (
|
|
52
|
+
retailers,
|
|
53
|
+
idRetailer,
|
|
54
|
+
oldStatus,
|
|
55
|
+
newStatus,
|
|
56
|
+
service
|
|
57
|
+
) => {
|
|
58
|
+
const [retailer] = retailers?.filter((ret) => ret.id === idRetailer) || [];
|
|
59
|
+
return `${translateService(service)} de ${
|
|
60
|
+
retailer.name
|
|
61
|
+
} |${oldStatus}| a |${newStatus}`;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const sendMessage = async (data) => {
|
|
65
|
+
const { paramsBody, paramsHeader } = data;
|
|
66
|
+
return fetchPOST(
|
|
67
|
+
process.env.REACT_APP_CREATE_MESSAGES,
|
|
68
|
+
paramsBody,
|
|
69
|
+
paramsHeader
|
|
70
|
+
);
|
|
71
|
+
};
|
package/src/index.js
CHANGED
|
@@ -33,6 +33,13 @@ export * from "./components/atoms/ImagePreview/index";
|
|
|
33
33
|
export * from "./components/atoms/InputText/index";
|
|
34
34
|
export * from "./components/atoms/NotFound/index";
|
|
35
35
|
export * from "./components/atoms/Tooltip/index";
|
|
36
|
+
export * from "./components/atoms/UserOption/index";
|
|
37
|
+
export * from "./components/atoms/UserCatalog/index";
|
|
38
|
+
export * from "./components/atoms/UserSelector/index";
|
|
39
|
+
export * from "./components/atoms/ImageCarousel/index";
|
|
40
|
+
export * from "./components/atoms/RetailersList/index";
|
|
41
|
+
export * from "./components/atoms/RetailerOption/index";
|
|
42
|
+
export * from "./components/atoms/RetailerCatalog/index";
|
|
36
43
|
|
|
37
44
|
//molecules
|
|
38
45
|
export * from "./components/molecules/AvatarAndValidation/index";
|
|
@@ -63,6 +70,12 @@ export * from "./components/molecules/ButtonDownloadFile/index";
|
|
|
63
70
|
export * from "./components/molecules/ImageTooltip/index";
|
|
64
71
|
export * from "./components/molecules/SelectV2/index";
|
|
65
72
|
export * from "./components/molecules/Dropdown/index";
|
|
73
|
+
export * from "./components/molecules/StripeCardForm/index";
|
|
74
|
+
export * from "./components/molecules/StripeCardSelector/index";
|
|
75
|
+
export * from "./components/molecules/GridItem/index";
|
|
76
|
+
export * from "./components/molecules/HeaderItem/index";
|
|
77
|
+
export * from "./components/molecules/RowItem/index";
|
|
78
|
+
export * from "./components/molecules/RetailerSelector/index";
|
|
66
79
|
|
|
67
80
|
//organisms
|
|
68
81
|
export * from "./components/organisms/ChangePassword/index";
|
|
@@ -79,6 +92,9 @@ export * from "./components/organisms/Modal/index";
|
|
|
79
92
|
export * from "./components/organisms/OrderDetail/index";
|
|
80
93
|
export * from "./components/organisms/RangeCalendar";
|
|
81
94
|
export * from "./components/organisms/TableResizable";
|
|
95
|
+
export * from "./components/organisms/SideModal/index";
|
|
96
|
+
export * from "./components/organisms/GridProducts/index";
|
|
97
|
+
export * from "./components/organisms/PanelLayout";
|
|
82
98
|
|
|
83
99
|
//pages
|
|
84
100
|
export * from "./components/pages/ChangePasswordLogin";
|