contentoh-components-library 21.3.30 → 21.3.31
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 +2 -3
- 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/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 +88 -66
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +73 -41
- package/dist/components/pages/RetailerProductEdition/index.js +20 -15
- 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 +13 -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/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 +88 -67
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +78 -41
- package/src/components/pages/RetailerProductEdition/index.js +19 -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
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ContainerBtnPopUpChat,
|
|
3
|
+
ContainerFixed,
|
|
4
|
+
ContainerPopUp,
|
|
5
|
+
} from "./styles";
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import { ButtonV2 } from "../../atoms/ButtonV2";
|
|
8
|
+
import { ContentChat } from "./ContentChat";
|
|
9
|
+
import { faComments as IconChat } from "@fortawesome/free-solid-svg-icons";
|
|
10
|
+
import { Slide } from "@mui/material";
|
|
11
|
+
import {
|
|
12
|
+
isStringEmpty,
|
|
13
|
+
isValidNaturalNumber,
|
|
14
|
+
} from "../../../global-files/utils";
|
|
15
|
+
|
|
16
|
+
export const Chat = (props) => {
|
|
17
|
+
const {
|
|
18
|
+
chatType, // "merchant_product" | "order_product" | "ticket"
|
|
19
|
+
chatContainerType, // ("fixed") | ("popUp")
|
|
20
|
+
chatData, // {} => aqui poner los datos requeridos segun el tipo de chat
|
|
21
|
+
classNameContainerFixed, // clases CSS del envoltoria chat fixed
|
|
22
|
+
size = 14, // tamaño del icono
|
|
23
|
+
} = props;
|
|
24
|
+
const [showPopUpChat, setShowPopUpChat] = useState(false);
|
|
25
|
+
const [data, setData] = useState();
|
|
26
|
+
|
|
27
|
+
const { ticketCompany } = chatData || {};
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
switch (chatType) {
|
|
31
|
+
case "merchant_product":
|
|
32
|
+
validateChatMerchantProduct();
|
|
33
|
+
break;
|
|
34
|
+
case "order_product":
|
|
35
|
+
validateChatOrderProduct();
|
|
36
|
+
break;
|
|
37
|
+
case "ticket":
|
|
38
|
+
validateChatTicket();
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
setData({
|
|
42
|
+
code: 404,
|
|
43
|
+
message: `El tipo de chat especificado "${chatType}" no es valido`,
|
|
44
|
+
errorDetail: "",
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}, [chatType]);
|
|
48
|
+
|
|
49
|
+
const isValidGeneral = (userToken, id) => {
|
|
50
|
+
// validar token del user
|
|
51
|
+
if (isStringEmpty(userToken)) {
|
|
52
|
+
setDataError("El token del usuario no es valido");
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
// validar ID del producto
|
|
56
|
+
if (!isValidNaturalNumber(id)) {
|
|
57
|
+
setDataError("El ID del producto no es valido");
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// validar props que se requieren para el tipo de chat "order_product"
|
|
64
|
+
const validateChatOrderProduct = () => {
|
|
65
|
+
const {
|
|
66
|
+
userToken, // string
|
|
67
|
+
id, // number
|
|
68
|
+
orderId, // number
|
|
69
|
+
retailerId, // number
|
|
70
|
+
} = chatData;
|
|
71
|
+
|
|
72
|
+
if (!isValidGeneral(userToken, id)) return;
|
|
73
|
+
|
|
74
|
+
// validar el ID de la OT en donde se encuentra el producto
|
|
75
|
+
if (!isValidNaturalNumber(orderId)) {
|
|
76
|
+
setDataError("El ID de la orden del producto no es valido");
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
// validar el ID de la cadena asociada al producto en la OT
|
|
80
|
+
if (!isValidNaturalNumber(retailerId)) {
|
|
81
|
+
setDataError("La cadena relacionada al producto no es valida");
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
setData({
|
|
85
|
+
userToken,
|
|
86
|
+
id,
|
|
87
|
+
orderId,
|
|
88
|
+
retailerId,
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// validar props que se requieren para el tipo de chat "merchants_product"
|
|
93
|
+
const validateChatMerchantProduct = () => {
|
|
94
|
+
const {
|
|
95
|
+
userToken, // string
|
|
96
|
+
id, // number
|
|
97
|
+
version, // number
|
|
98
|
+
} = chatData;
|
|
99
|
+
|
|
100
|
+
if (!isValidGeneral(userToken, id)) return;
|
|
101
|
+
|
|
102
|
+
// validar la version del producto
|
|
103
|
+
if (!isValidNaturalNumber(version)) {
|
|
104
|
+
setDataError("La version del producto no es valida");
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
setData({
|
|
108
|
+
userToken,
|
|
109
|
+
id,
|
|
110
|
+
version,
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// validar props que se requieren para el tipo de chat "ticket"
|
|
115
|
+
const validateChatTicket = () => {
|
|
116
|
+
const {
|
|
117
|
+
currentUser /* {
|
|
118
|
+
token, // string
|
|
119
|
+
id: number ,
|
|
120
|
+
companyId: number ,
|
|
121
|
+
isUserTech: boolean ,
|
|
122
|
+
} */,
|
|
123
|
+
id, // number
|
|
124
|
+
statusTicket, // (string) "IN_PROGRESS" | "PENDING" | "COMPLETED"
|
|
125
|
+
ticketOwnerUserId, // number
|
|
126
|
+
} = chatData;
|
|
127
|
+
// validar el token del usuario conectado
|
|
128
|
+
if (isStringEmpty(currentUser?.token)) {
|
|
129
|
+
setDataError("Tu identificación de usuario no fue especificado");
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
// validar si ID del usuario conectado
|
|
133
|
+
if (!isValidNaturalNumber(currentUser?.id)) {
|
|
134
|
+
setDataError("Tu ID de usuario no fue especificado");
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
// validar si ID de la compañia del usuario conectado
|
|
138
|
+
if (!isValidNaturalNumber(currentUser?.companyId)) {
|
|
139
|
+
setDataError("El ID de tu compañia no fue especificado");
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
// validar si el usuario conectado es de tecnologia o no
|
|
143
|
+
if (![false, true].includes(currentUser?.isUserTech)) {
|
|
144
|
+
setDataError("Tu tipo de usuario no fue especificado");
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
// validar ID del ticket
|
|
148
|
+
if (!isValidNaturalNumber(id)) {
|
|
149
|
+
setDataError("El ID del ticket no es valido");
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
// validar ID del usuario que creó el ticket
|
|
153
|
+
if (!isValidNaturalNumber(ticketOwnerUserId)) {
|
|
154
|
+
setDataError(
|
|
155
|
+
"El ID del usuario al que le pertenece el ticket no es valido"
|
|
156
|
+
);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
// validar el status del chat
|
|
160
|
+
if (!["IN_PROGRESS", "PENDING", "COMPLETED"].includes(statusTicket)) {
|
|
161
|
+
setDataError("El estatus del ticket no es valido");
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
let statusChat = "open";
|
|
165
|
+
if (statusTicket === "COMPLETED") statusChat = "closed";
|
|
166
|
+
|
|
167
|
+
// convertir user TECH a NORMAL si es el propietario del ticket
|
|
168
|
+
let isUserTech = currentUser.isUserTech;
|
|
169
|
+
if (isUserTech && currentUser.id == ticketOwnerUserId) {
|
|
170
|
+
isUserTech = false;
|
|
171
|
+
}
|
|
172
|
+
setData({
|
|
173
|
+
currentUser: {
|
|
174
|
+
...currentUser,
|
|
175
|
+
isUserTech,
|
|
176
|
+
},
|
|
177
|
+
id,
|
|
178
|
+
statusChat,
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const setDataError = (errorDetail) => {
|
|
183
|
+
setData({
|
|
184
|
+
code: 404,
|
|
185
|
+
message: `No se especificaron algunos datos requeridos para el tipo de chat "${chatType}"`,
|
|
186
|
+
errorDetail,
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
if (chatContainerType?.toLowerCase() === "fixed") {
|
|
191
|
+
/* chat tipo fixed */
|
|
192
|
+
return (
|
|
193
|
+
<ContainerFixed className={classNameContainerFixed}>
|
|
194
|
+
<ContentChat
|
|
195
|
+
chatType={chatType?.toLowerCase()}
|
|
196
|
+
chatContainerType="fixed"
|
|
197
|
+
dataChat={data}
|
|
198
|
+
showBtnClose={false}
|
|
199
|
+
ticketCompany={ticketCompany}
|
|
200
|
+
/>
|
|
201
|
+
</ContainerFixed>
|
|
202
|
+
);
|
|
203
|
+
} else {
|
|
204
|
+
/* chat tipo popUp */
|
|
205
|
+
return (
|
|
206
|
+
<>
|
|
207
|
+
<ContainerBtnPopUpChat>
|
|
208
|
+
<ButtonV2
|
|
209
|
+
className="container-btn-popUpChat"
|
|
210
|
+
type="whiteS2"
|
|
211
|
+
size={size}
|
|
212
|
+
borderType="circle"
|
|
213
|
+
icon={IconChat}
|
|
214
|
+
onClick={() => {
|
|
215
|
+
setShowPopUpChat(!showPopUpChat);
|
|
216
|
+
}}
|
|
217
|
+
/>
|
|
218
|
+
</ContainerBtnPopUpChat>
|
|
219
|
+
|
|
220
|
+
<Slide direction="left" in={showPopUpChat} timeout={400}>
|
|
221
|
+
<ContainerPopUp>
|
|
222
|
+
<ContentChat
|
|
223
|
+
chatType={chatType?.toLowerCase()}
|
|
224
|
+
chatContainerType="popUp"
|
|
225
|
+
dataChat={data}
|
|
226
|
+
showPopUpChat={showPopUpChat}
|
|
227
|
+
showBtnClose={true}
|
|
228
|
+
ticketCompany={ticketCompany}
|
|
229
|
+
onClickBtnClose={() => {
|
|
230
|
+
setShowPopUpChat(false);
|
|
231
|
+
}}
|
|
232
|
+
/>
|
|
233
|
+
</ContainerPopUp>
|
|
234
|
+
</Slide>
|
|
235
|
+
</>
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
// Container para chat fixed
|
|
5
|
+
export const ContainerFixed = styled.div`
|
|
6
|
+
width: auto;
|
|
7
|
+
max-width: 550px;
|
|
8
|
+
min-width: 325px;
|
|
9
|
+
height: 100%;
|
|
10
|
+
flex-grow: 2;
|
|
11
|
+
background-color: white;
|
|
12
|
+
border: 1px solid #f0f0f0;
|
|
13
|
+
z-index: 1000;
|
|
14
|
+
padding: 0px;
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
export const ContainerBtnPopUpChat = styled.div`
|
|
18
|
+
border-radius: 50%;
|
|
19
|
+
height: 34px;
|
|
20
|
+
width: 34px;
|
|
21
|
+
|
|
22
|
+
.container-btn-popUpChat {
|
|
23
|
+
height: inherit;
|
|
24
|
+
width: inherit;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
export const ContainerPopUp = styled.div`
|
|
30
|
+
position: fixed;
|
|
31
|
+
top: 20px;
|
|
32
|
+
right: 23px;
|
|
33
|
+
bottom: 20px;
|
|
34
|
+
box-shadow: 0px 2px 10px 0px #00000073;
|
|
35
|
+
z-index: 1000;
|
|
36
|
+
width: calc(100% - 50px);
|
|
37
|
+
max-width: 550px;
|
|
38
|
+
min-width: 325px;
|
|
39
|
+
border-radius: 10px;
|
|
40
|
+
background: white;
|
|
41
|
+
padding: 0px;
|
|
42
|
+
`;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Modal } from "./index";
|
|
2
|
+
import { ButtonV2 } from "../../atoms/ButtonV2";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/organisms/Modal",
|
|
6
|
+
component: Modal,
|
|
7
|
+
argTypes: {
|
|
8
|
+
icon: {
|
|
9
|
+
options: [undefined, "error", "warning", "success", "info"],
|
|
10
|
+
control: { type: "select" },
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const Template = (args) => <Modal {...args} />;
|
|
16
|
+
|
|
17
|
+
export const modalDefault = Template.bind({});
|
|
18
|
+
modalDefault.args = {
|
|
19
|
+
show: false,
|
|
20
|
+
title: "Titulo del modal",
|
|
21
|
+
icon: undefined,
|
|
22
|
+
message: `descripcion amplia sobre el componente
|
|
23
|
+
modal white para saber como se ven varias lineas
|
|
24
|
+
de codigo`,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const modalWithButtons = Template.bind({});
|
|
28
|
+
modalWithButtons.args = {
|
|
29
|
+
show: false,
|
|
30
|
+
title: "Titulo del modal",
|
|
31
|
+
icon: undefined,
|
|
32
|
+
message: `descripcion amplia sobre el componente
|
|
33
|
+
modal white para saber como se ven varias lineas
|
|
34
|
+
de codigo`,
|
|
35
|
+
buttons: [
|
|
36
|
+
<ButtonV2
|
|
37
|
+
key={"btn-Cancelar"}
|
|
38
|
+
type={"white"}
|
|
39
|
+
label={"Cancelar"}
|
|
40
|
+
size={12}
|
|
41
|
+
onClick={(event) => {
|
|
42
|
+
alert("cancelar");
|
|
43
|
+
}}
|
|
44
|
+
/>,
|
|
45
|
+
<ButtonV2
|
|
46
|
+
key={"btn-Aceptar"}
|
|
47
|
+
type={"pink"}
|
|
48
|
+
label={"Aceptar"}
|
|
49
|
+
size={12}
|
|
50
|
+
onClick={(event) => {
|
|
51
|
+
alert("aceptar");
|
|
52
|
+
}}
|
|
53
|
+
/>,
|
|
54
|
+
],
|
|
55
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { ContainerModal } from "./styles";
|
|
3
|
+
import {
|
|
4
|
+
faClose as xIcon,
|
|
5
|
+
faExclamationTriangle as warningIcon,
|
|
6
|
+
faCheck as successIcon,
|
|
7
|
+
faExclamation as infoIcon,
|
|
8
|
+
} from "@fortawesome/free-solid-svg-icons";
|
|
9
|
+
import { FontAwesomeIcon as Icon } from "@fortawesome/react-fontawesome";
|
|
10
|
+
import { Fade, Grow, Zoom, Modal as ModalMUI, Backdrop } from "@mui/material";
|
|
11
|
+
import { ButtonV2 } from "../../atoms/ButtonV2";
|
|
12
|
+
import { CustomIcon } from "../../atoms/CustomIcon";
|
|
13
|
+
|
|
14
|
+
export const Modal = (props) => {
|
|
15
|
+
const {
|
|
16
|
+
className, // clases CSS del componente raiz del modal
|
|
17
|
+
show, // boolean
|
|
18
|
+
title, // string
|
|
19
|
+
message, // string
|
|
20
|
+
icon, // "error" | "warning" | "success" | "info" | (por default no icon)
|
|
21
|
+
customComponent, // JSX
|
|
22
|
+
buttons, // array<JSX>
|
|
23
|
+
onClickModal, // (event) => {}
|
|
24
|
+
onClickBtnDefault, // (event) => {}
|
|
25
|
+
} = props;
|
|
26
|
+
const icons = {
|
|
27
|
+
error: xIcon,
|
|
28
|
+
warning: warningIcon,
|
|
29
|
+
info: infoIcon,
|
|
30
|
+
success: successIcon,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Backdrop
|
|
35
|
+
open={show}
|
|
36
|
+
className="container-backgroundModal"
|
|
37
|
+
timeout={400}
|
|
38
|
+
style={{
|
|
39
|
+
backgroundColor: "transparent",
|
|
40
|
+
zIndex: 10,
|
|
41
|
+
}}
|
|
42
|
+
onClick={(event) => onClickModal && onClickModal(event)}
|
|
43
|
+
>
|
|
44
|
+
<Fade in={show} timeout={400}>
|
|
45
|
+
<ContainerModal className={className ? className : ""}>
|
|
46
|
+
<div className="contentModal">
|
|
47
|
+
<header>
|
|
48
|
+
{/* titulo */}
|
|
49
|
+
{![null, undefined, ""].includes(title?.trim()) && (
|
|
50
|
+
<label className="label-title">{title.trim()}</label>
|
|
51
|
+
)}
|
|
52
|
+
</header>
|
|
53
|
+
|
|
54
|
+
{/* icono modal */}
|
|
55
|
+
{icons[icon?.toLowerCase()] && (
|
|
56
|
+
<CustomIcon
|
|
57
|
+
type={"white"}
|
|
58
|
+
className={"iconModal " + "iconModal-" + icon.toLowerCase()}
|
|
59
|
+
size={35}
|
|
60
|
+
borderType={"circle"}
|
|
61
|
+
icon={icons[icon.toLowerCase()]}
|
|
62
|
+
/>
|
|
63
|
+
)}
|
|
64
|
+
|
|
65
|
+
{/* label message */}
|
|
66
|
+
{![null, undefined, ""].includes(message?.trim()) && (
|
|
67
|
+
<label className="label-message"> {message.trim()} </label>
|
|
68
|
+
)}
|
|
69
|
+
|
|
70
|
+
{/* custom component */}
|
|
71
|
+
{customComponent && (
|
|
72
|
+
<div className="container-customComponent">{customComponent}</div>
|
|
73
|
+
)}
|
|
74
|
+
|
|
75
|
+
{/* container buttons */}
|
|
76
|
+
<div className="container-buttons">
|
|
77
|
+
{buttons?.length ? (
|
|
78
|
+
buttons
|
|
79
|
+
) : (
|
|
80
|
+
<ButtonV2
|
|
81
|
+
key={"btn-Aceptar"}
|
|
82
|
+
type={"white"}
|
|
83
|
+
borderType={"oval"}
|
|
84
|
+
label={"Aceptar"}
|
|
85
|
+
size={12}
|
|
86
|
+
onClick={(event) =>
|
|
87
|
+
onClickBtnDefault && onClickBtnDefault(event)
|
|
88
|
+
}
|
|
89
|
+
/>
|
|
90
|
+
)}
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
</ContainerModal>
|
|
94
|
+
</Fade>
|
|
95
|
+
</Backdrop>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { FontFamily } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
export const ContainerModal = styled.div`
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
overflow: auto;
|
|
8
|
+
display: grid;
|
|
9
|
+
place-items: center;
|
|
10
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
11
|
+
|
|
12
|
+
.contentModal {
|
|
13
|
+
width: fit-content;
|
|
14
|
+
max-width: 80%;
|
|
15
|
+
min-width: 80px;
|
|
16
|
+
height: fit-content;
|
|
17
|
+
max-height: 90%;
|
|
18
|
+
min-height: 120px;
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
align-items: center;
|
|
22
|
+
background-color: white;
|
|
23
|
+
border-radius: 10px;
|
|
24
|
+
padding: 25px 25px 20px 25px;
|
|
25
|
+
box-shadow: 0px 2px 4px 0px #00000040;
|
|
26
|
+
|
|
27
|
+
header {
|
|
28
|
+
width: 100%;
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: row;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: flex-start;
|
|
33
|
+
gap: 6px;
|
|
34
|
+
margin-bottom: 20px;
|
|
35
|
+
|
|
36
|
+
.label-title {
|
|
37
|
+
width: 100%;
|
|
38
|
+
text-align: center;
|
|
39
|
+
font-family: ${FontFamily.RobotoMedium}, sans-serif;
|
|
40
|
+
font-size: 17px;
|
|
41
|
+
line-height: 1.2;
|
|
42
|
+
color: #262626;
|
|
43
|
+
white-space: pre-wrap;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.iconModal {
|
|
48
|
+
width: 50px;
|
|
49
|
+
height: 50px;
|
|
50
|
+
font-size: 30px;
|
|
51
|
+
border-width: 4px;
|
|
52
|
+
margin-bottom: 20px;
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
|
|
55
|
+
&.iconModal-error {
|
|
56
|
+
background-color: #953737;
|
|
57
|
+
border-color: #953737;
|
|
58
|
+
color: white;
|
|
59
|
+
}
|
|
60
|
+
&.iconModal-warning {
|
|
61
|
+
font-size: 27px;
|
|
62
|
+
padding-bottom: 8px;
|
|
63
|
+
color: #af9647;
|
|
64
|
+
border-color: #af9647;
|
|
65
|
+
}
|
|
66
|
+
&.iconModal-info {
|
|
67
|
+
border-color: #9e3e26;
|
|
68
|
+
color: #9e3e26;
|
|
69
|
+
}
|
|
70
|
+
&.iconModal-success {
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.label-message {
|
|
75
|
+
width: 100%;
|
|
76
|
+
text-align: center;
|
|
77
|
+
font-family: ${FontFamily.RobotoRegular}, sans-serif;
|
|
78
|
+
font-size: 13px;
|
|
79
|
+
color: #707070;
|
|
80
|
+
white-space: pre-wrap;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.container-customComponent {
|
|
84
|
+
width: 100%;
|
|
85
|
+
max-height: 50vh;
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
margin-top: 20px;
|
|
89
|
+
padding: 0px 0px;
|
|
90
|
+
//border: 1px solid red;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.container-buttons {
|
|
94
|
+
width: 100%;
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: row;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
gap: 12px;
|
|
99
|
+
margin-top: 20px;
|
|
100
|
+
//border: 1px solid red;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
@@ -12,6 +12,7 @@ export const ProductImageModal = ({
|
|
|
12
12
|
validation,
|
|
13
13
|
setShowModal,
|
|
14
14
|
sendToFacilitator,
|
|
15
|
+
approveRejectButtons = false,
|
|
15
16
|
}) => {
|
|
16
17
|
const [activeImage, setActiveImage] = useState(0);
|
|
17
18
|
const [buttonType, setButtonType] = useState(
|
|
@@ -53,12 +54,12 @@ export const ProductImageModal = ({
|
|
|
53
54
|
<div className="modal-data-container">
|
|
54
55
|
<div className="validation-and-table-container">
|
|
55
56
|
<div className="validation-panel">
|
|
56
|
-
{
|
|
57
|
+
{approveRejectButtons && (
|
|
57
58
|
<Button
|
|
58
59
|
buttonType={`circular-button ${buttonType}`}
|
|
59
60
|
onClick={() => setShowValidationPanel(true)}
|
|
60
61
|
/>
|
|
61
|
-
}
|
|
62
|
+
)}
|
|
62
63
|
<Button
|
|
63
64
|
buttonType={"close-button"}
|
|
64
65
|
onClick={() => {
|
|
@@ -71,10 +72,12 @@ export const ProductImageModal = ({
|
|
|
71
72
|
id="validation-panel"
|
|
72
73
|
setOptionClicked={setButtonType}
|
|
73
74
|
setShowValidationPanel={setShowValidationPanel}
|
|
74
|
-
|
|
75
|
+
approve={() => sendToFacilitator && sendToFacilitator("A")}
|
|
76
|
+
reject={() => sendToFacilitator && sendToFacilitator("R")}
|
|
75
77
|
/>
|
|
76
78
|
)}
|
|
77
79
|
</div>
|
|
80
|
+
|
|
78
81
|
<ImageDataTable
|
|
79
82
|
imageData={images?.values[activeImage]?.data}
|
|
80
83
|
headerInfo={headerInfo}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RangeCalendar } from ".";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/organisms/RangeCalendar",
|
|
5
|
+
component: RangeCalendar,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = (args) => <RangeCalendar {...args} />;
|
|
9
|
+
|
|
10
|
+
export const DefaultRangeCalendar = Template.bind({});
|
|
11
|
+
DefaultRangeCalendar.args = {
|
|
12
|
+
currentDates: {
|
|
13
|
+
start: "2022-12-15T00:00:00.000Z",
|
|
14
|
+
end: "2022-12-25T00:00:00.000Z",
|
|
15
|
+
},
|
|
16
|
+
};
|