contentoh-components-library 21.3.67 → 21.3.69
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 +4 -0
- package/.env.production +3 -0
- package/dist/components/atoms/ButtonV2/styles.js +1 -1
- package/dist/components/atoms/Card/index.js +47 -7
- package/dist/components/atoms/Card/styles.js +3 -1
- package/dist/components/atoms/CheckBox/index.js +4 -2
- 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/StripeCardForm/StripeCardForm.stories.js +31 -0
- package/dist/components/molecules/StripeCardForm/index.js +81 -0
- package/dist/components/molecules/StripeCardForm/paymentForm.js +187 -0
- package/dist/components/molecules/StripeCardForm/styles.js +24 -0
- package/dist/components/molecules/StripeCardSelector/CardSelector.stories.js +30 -0
- package/dist/components/molecules/StripeCardSelector/index.js +103 -0
- package/dist/components/molecules/StripeCardSelector/styles.js +19 -0
- package/dist/components/molecules/StripeCardSelector/utils.js +56 -0
- package/dist/components/molecules/TabsMenu/index.js +128 -13
- package/dist/components/molecules/TagAndInput/index.js +1 -1
- package/dist/components/organisms/Chat/Chat.stories.js +21 -1
- 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 +343 -191
- package/dist/components/organisms/Chat/Footer/index.js +48 -39
- package/dist/components/organisms/Chat/index.js +48 -3
- package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
- package/dist/components/organisms/FullTabsMenu/index.js +27 -2
- package/dist/components/organisms/ImageDataTable/index.js +2 -0
- package/dist/components/organisms/Modal/styles.js +1 -1
- package/dist/components/organisms/SideModal/index.js +11 -0
- package/dist/components/organisms/SideModal/styles.js +1 -1
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +172 -127
- package/dist/components/pages/ProviderProductEdition/index.js +223 -177
- package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +40 -28
- package/dist/components/pages/RetailerProductEdition/index.js +298 -273
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/utils.js +61 -2
- package/dist/index.js +51 -12
- package/package.json +1 -1
- package/src/components/atoms/ButtonV2/styles.js +1 -1
- 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 +2 -0
- package/src/components/atoms/InputFormatter/styles.js +2 -1
- package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/src/components/molecules/GalleryElement/index.js +5 -0
- package/src/components/molecules/HeaderTop/index.js +52 -6
- package/src/components/molecules/StripeCardForm/StripeCardForm.stories.js +13 -0
- package/src/components/molecules/StripeCardForm/index.js +33 -0
- package/src/components/molecules/StripeCardForm/paymentForm.js +121 -0
- package/src/components/molecules/StripeCardForm/styles.js +72 -0
- package/src/components/molecules/StripeCardSelector/CardSelector.stories.js +12 -0
- package/src/components/molecules/StripeCardSelector/index.js +42 -0
- package/src/components/molecules/StripeCardSelector/styles.js +4 -0
- package/src/components/molecules/StripeCardSelector/utils.js +17 -0
- package/src/components/molecules/TabsMenu/index.js +126 -3
- package/src/components/molecules/TagAndInput/index.js +12 -8
- package/src/components/organisms/Chat/Chat.stories.js +21 -0
- 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 +81 -6
- package/src/components/organisms/Chat/Footer/index.js +11 -0
- package/src/components/organisms/Chat/index.js +47 -3
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/organisms/FullTabsMenu/index.js +28 -1
- package/src/components/organisms/ImageDataTable/index.js +3 -0
- package/src/components/organisms/InputGroup/index.js +4 -1
- package/src/components/organisms/Modal/styles.js +4 -1
- 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 +177 -130
- package/src/components/pages/ProviderProductEdition/index.js +160 -129
- package/src/components/pages/ProviderProductEdition/styles.js +5 -1
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +38 -26
- package/src/components/pages/RetailerProductEdition/index.js +142 -135
- package/src/components/pages/RetailerProductEdition/styles.js +4 -0
- package/src/components/pages/RetailerProductEdition/utils.js +37 -0
- package/src/index.js +3 -0
- package/dist/assets/fonts/roboto/LICENSE.txt +0 -202
|
@@ -100,6 +100,7 @@ export const ContentChat = (props) => {
|
|
|
100
100
|
}
|
|
101
101
|
if (chatType === "merchant_product") getInitialMerchantProduct();
|
|
102
102
|
else if (chatType === "order_product") getInitialOrderProduct();
|
|
103
|
+
else if (chatType === "product_status") getInitialProductStatus();
|
|
103
104
|
else getInitialTicket();
|
|
104
105
|
}
|
|
105
106
|
if (!showPopUpChat) {
|
|
@@ -126,6 +127,8 @@ export const ContentChat = (props) => {
|
|
|
126
127
|
} else if (chatType === "order_product") {
|
|
127
128
|
if (companies) getUpdateLatestOrderProduct(true);
|
|
128
129
|
else getInitialOrderProduct();
|
|
130
|
+
} else if (chatType === "product_status") {
|
|
131
|
+
getInitialProductStatus();
|
|
129
132
|
} else {
|
|
130
133
|
if (singleChat.items) getUpdateLatestTicket(true);
|
|
131
134
|
else getInitialTicket();
|
|
@@ -135,6 +138,47 @@ export const ContentChat = (props) => {
|
|
|
135
138
|
/*=======================================================================
|
|
136
139
|
PETICION GET INICIAL SEGUN EL TIPO DE CHAT
|
|
137
140
|
======================================================================= */
|
|
141
|
+
const getInitialProductStatus = async () => {
|
|
142
|
+
const paramsQuery = {
|
|
143
|
+
articleData: {
|
|
144
|
+
articleId: JSON.stringify(dataChat.id),
|
|
145
|
+
version: JSON.stringify(dataChat.version),
|
|
146
|
+
retailerId: JSON.stringify(dataChat.retailerId),
|
|
147
|
+
status: dataChat.status,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
const paramsHeaders = { Authorization: dataChat.userToken };
|
|
151
|
+
const response = await fetchGET(
|
|
152
|
+
process.env.REACT_APP_READ_MESSAGES,
|
|
153
|
+
paramsQuery,
|
|
154
|
+
paramsHeaders
|
|
155
|
+
);
|
|
156
|
+
if (!response.body) {
|
|
157
|
+
setErrorChat({
|
|
158
|
+
existError: true,
|
|
159
|
+
code: 400,
|
|
160
|
+
message: response.message,
|
|
161
|
+
errorDetail: response.errorDetail,
|
|
162
|
+
});
|
|
163
|
+
setIsLoading(false);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
// success
|
|
167
|
+
setStartUpdate((prev) => prev + 1);
|
|
168
|
+
setCurrentUser({
|
|
169
|
+
id: response.body.data.currentUserId,
|
|
170
|
+
companyId: response.body.data.currentCompanyId,
|
|
171
|
+
});
|
|
172
|
+
setLastUpdateDate(response.body.data.lastUpdateDate);
|
|
173
|
+
setAllUsers(response.body.users);
|
|
174
|
+
setSingleChat({
|
|
175
|
+
items: response.body.items,
|
|
176
|
+
enabledLoadMore: response.body.items.length === 50,
|
|
177
|
+
});
|
|
178
|
+
setErrorChat({ existError: false });
|
|
179
|
+
setIsLoading(false);
|
|
180
|
+
};
|
|
181
|
+
|
|
138
182
|
const getInitialMerchantProduct = async () => {
|
|
139
183
|
const paramsQuery = {
|
|
140
184
|
getType: "initial",
|
|
@@ -609,12 +653,14 @@ export const ContentChat = (props) => {
|
|
|
609
653
|
// enviar items a la BD
|
|
610
654
|
if (chatType === "merchant_product") {
|
|
611
655
|
errorCreate = await createItemsMerchantProduct(items);
|
|
656
|
+
} else if (chatType === "product_status") {
|
|
657
|
+
errorCreate = await createItemsProductStatus(items);
|
|
612
658
|
} else if (chatType === "order_product") {
|
|
613
659
|
errorCreate = await createItemsOrderProduct(items);
|
|
614
660
|
} else errorCreate = await createItemsTicket(items);
|
|
615
661
|
|
|
616
662
|
// actualizar chat para que aparezcan los items enviados
|
|
617
|
-
if (
|
|
663
|
+
if (["merchant_product", "product_status"].includes(chatType)) {
|
|
618
664
|
await getUpdateLatestMerchantProduct();
|
|
619
665
|
} else if (chatType === "order_product") {
|
|
620
666
|
await getUpdateLatestOrderProduct();
|
|
@@ -627,9 +673,10 @@ export const ContentChat = (props) => {
|
|
|
627
673
|
};
|
|
628
674
|
|
|
629
675
|
const createItemsMerchantProduct = async (items = []) => {
|
|
630
|
-
const { id, version } = dataChat;
|
|
676
|
+
const { id, version, orderId } = dataChat;
|
|
631
677
|
const { id: retailerId } = activeRetailer;
|
|
632
678
|
const paramsBody = { id, version, items, retailerId };
|
|
679
|
+
if (chatType === "product_status") paramsBody["orderId"] = orderId;
|
|
633
680
|
const paramsHeaders = { Authorization: dataChat.userToken };
|
|
634
681
|
const response = await fetchPOST(
|
|
635
682
|
process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT,
|
|
@@ -643,6 +690,23 @@ export const ContentChat = (props) => {
|
|
|
643
690
|
};
|
|
644
691
|
}
|
|
645
692
|
};
|
|
693
|
+
const createItemsProductStatus = async (items = []) => {
|
|
694
|
+
const { id, version, orderId, status } = dataChat;
|
|
695
|
+
const { id: retailerId } = activeRetailer;
|
|
696
|
+
const paramsBody = { id, version, items, retailerId, orderId, status };
|
|
697
|
+
const paramsHeaders = { Authorization: dataChat.userToken };
|
|
698
|
+
const response = await fetchPOST(
|
|
699
|
+
process.env.REACT_APP_CREATE_MESSAGES,
|
|
700
|
+
paramsBody,
|
|
701
|
+
paramsHeaders
|
|
702
|
+
);
|
|
703
|
+
if (!response.body) {
|
|
704
|
+
return {
|
|
705
|
+
message: response.message,
|
|
706
|
+
errorDetail: response.errorDetail,
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
};
|
|
646
710
|
|
|
647
711
|
const createItemsOrderProduct = async (items = []) => {
|
|
648
712
|
const paramsBody = {
|
|
@@ -690,7 +754,11 @@ export const ContentChat = (props) => {
|
|
|
690
754
|
SECCION DE FUNCIONES
|
|
691
755
|
======================================================================= */
|
|
692
756
|
const isSingleChat = () => {
|
|
693
|
-
if (
|
|
757
|
+
if (
|
|
758
|
+
chatType === "merchant_product" ||
|
|
759
|
+
chatType === "ticket" ||
|
|
760
|
+
chatType === "product_status"
|
|
761
|
+
) {
|
|
694
762
|
return true;
|
|
695
763
|
}
|
|
696
764
|
if (companies && Object.keys(companies).length < 2) return true;
|
|
@@ -801,7 +869,7 @@ export const ContentChat = (props) => {
|
|
|
801
869
|
// mostrar chat?
|
|
802
870
|
let items;
|
|
803
871
|
let enabledLoadMore;
|
|
804
|
-
if (["merchant_product", "ticket"].includes(chatType)) {
|
|
872
|
+
if (["merchant_product", "ticket", "product_status"].includes(chatType)) {
|
|
805
873
|
items = singleChat.items;
|
|
806
874
|
enabledLoadMore = singleChat.enabledLoadMore;
|
|
807
875
|
}
|
|
@@ -843,7 +911,9 @@ export const ContentChat = (props) => {
|
|
|
843
911
|
activeCompanyId={activeCompanyId}
|
|
844
912
|
ticketCompany={ticketCompany}
|
|
845
913
|
currentUser={
|
|
846
|
-
["merchant_product", "order_product"].includes(
|
|
914
|
+
["merchant_product", "order_product", "product_status"].includes(
|
|
915
|
+
chatType
|
|
916
|
+
)
|
|
847
917
|
? currentUser
|
|
848
918
|
: dataChat.currentUser
|
|
849
919
|
}
|
|
@@ -882,6 +952,12 @@ export const ContentChat = (props) => {
|
|
|
882
952
|
? { id: dataChat.id, version: currentArticle.version }
|
|
883
953
|
: chatType === "ticket"
|
|
884
954
|
? { id: dataChat.id }
|
|
955
|
+
: chatType === "product_status"
|
|
956
|
+
? {
|
|
957
|
+
id: dataChat.id,
|
|
958
|
+
version: dataChat.version,
|
|
959
|
+
retailerId: dataChat.retailerId,
|
|
960
|
+
}
|
|
885
961
|
: undefined
|
|
886
962
|
}
|
|
887
963
|
chatCompany={getChatCompany()}
|
|
@@ -924,7 +1000,6 @@ export const ContentChat = (props) => {
|
|
|
924
1000
|
}}
|
|
925
1001
|
/>
|
|
926
1002
|
)}
|
|
927
|
-
|
|
928
1003
|
{/* body */}
|
|
929
1004
|
{renderBodyChat()}
|
|
930
1005
|
</Container>
|
|
@@ -169,6 +169,17 @@ export const Footer = (props) => {
|
|
|
169
169
|
errorMessage = "El ID del ticket no es valido";
|
|
170
170
|
}
|
|
171
171
|
break;
|
|
172
|
+
case "product_status":
|
|
173
|
+
if (
|
|
174
|
+
isValidNaturalNumber(dataChat?.id) &&
|
|
175
|
+
isValidNaturalNumber(dataChat?.version) &&
|
|
176
|
+
isValidNaturalNumber(dataChat?.retailerId)
|
|
177
|
+
) {
|
|
178
|
+
fileKey += `productStatus/${dataChat.id}-${dataChat?.version}-${dataChat?.retailerId}/`;
|
|
179
|
+
} else {
|
|
180
|
+
errorMessage = "El ID del ticket no es valido";
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
172
183
|
|
|
173
184
|
default:
|
|
174
185
|
errorMessage =
|
|
@@ -24,7 +24,7 @@ export const Chat = (props) => {
|
|
|
24
24
|
const [showPopUpChat, setShowPopUpChat] = useState(false);
|
|
25
25
|
const [data, setData] = useState();
|
|
26
26
|
|
|
27
|
-
const { ticketCompany } = chatData || {};
|
|
27
|
+
const { ticketCompany, retailerId } = chatData || {};
|
|
28
28
|
|
|
29
29
|
useEffect(() => {
|
|
30
30
|
switch (chatType) {
|
|
@@ -37,6 +37,9 @@ export const Chat = (props) => {
|
|
|
37
37
|
case "ticket":
|
|
38
38
|
validateChatTicket();
|
|
39
39
|
break;
|
|
40
|
+
case "product_status":
|
|
41
|
+
validateProductStatus();
|
|
42
|
+
break;
|
|
40
43
|
default:
|
|
41
44
|
setData({
|
|
42
45
|
code: 404,
|
|
@@ -46,6 +49,45 @@ export const Chat = (props) => {
|
|
|
46
49
|
}
|
|
47
50
|
}, [chatType]);
|
|
48
51
|
|
|
52
|
+
const validateProductStatus = () => {
|
|
53
|
+
const {
|
|
54
|
+
userToken, // string
|
|
55
|
+
id, // number
|
|
56
|
+
version,
|
|
57
|
+
retailerId, // number
|
|
58
|
+
status,
|
|
59
|
+
orderId,
|
|
60
|
+
} = chatData;
|
|
61
|
+
|
|
62
|
+
if (!isValidGeneral(userToken, id)) return;
|
|
63
|
+
|
|
64
|
+
// validar el ID de la cadena asociada al producto en la OT
|
|
65
|
+
if (!isValidNaturalNumber(retailerId)) {
|
|
66
|
+
setDataError("La cadena relacionada al producto no es válida");
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// validar el ID de la version asociada al producto en la OT
|
|
71
|
+
if (!isValidNaturalNumber(version)) {
|
|
72
|
+
setDataError("La versión del producto no es válida");
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (orderId && !isValidNaturalNumber(orderId)) {
|
|
77
|
+
setDataError("La orden del producto no es válida");
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
setData({
|
|
82
|
+
userToken,
|
|
83
|
+
id,
|
|
84
|
+
version,
|
|
85
|
+
retailerId,
|
|
86
|
+
orderId,
|
|
87
|
+
status,
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
|
|
49
91
|
const isValidGeneral = (userToken, id) => {
|
|
50
92
|
// validar token del user
|
|
51
93
|
if (isStringEmpty(userToken)) {
|
|
@@ -69,6 +111,8 @@ export const Chat = (props) => {
|
|
|
69
111
|
retailerId, // number
|
|
70
112
|
} = chatData;
|
|
71
113
|
|
|
114
|
+
console.log(chatData, "chatData");
|
|
115
|
+
|
|
72
116
|
if (!isValidGeneral(userToken, id)) return;
|
|
73
117
|
|
|
74
118
|
// validar el ID de la OT en donde se encuentra el producto
|
|
@@ -197,7 +241,7 @@ export const Chat = (props) => {
|
|
|
197
241
|
dataChat={data}
|
|
198
242
|
showBtnClose={false}
|
|
199
243
|
ticketCompany={ticketCompany}
|
|
200
|
-
activeRetailer={props.activeRetailer}
|
|
244
|
+
activeRetailer={props.activeRetailer || { id: retailerId }}
|
|
201
245
|
/>
|
|
202
246
|
</ContainerFixed>
|
|
203
247
|
);
|
|
@@ -230,7 +274,7 @@ export const Chat = (props) => {
|
|
|
230
274
|
onClickBtnClose={() => {
|
|
231
275
|
setShowPopUpChat(false);
|
|
232
276
|
}}
|
|
233
|
-
activeRetailer={props.activeRetailer}
|
|
277
|
+
activeRetailer={props.activeRetailer || { id: retailerId }}
|
|
234
278
|
/>
|
|
235
279
|
</ContainerPopUp>
|
|
236
280
|
</Slide>
|
|
@@ -23,7 +23,7 @@ export const FullProductNameHeader = ({
|
|
|
23
23
|
useEffect(() => {
|
|
24
24
|
const rtls = headerData?.retailers || headerData?.retailersAvailable;
|
|
25
25
|
servicesData &&
|
|
26
|
-
rtls
|
|
26
|
+
rtls?.forEach((rt) => {
|
|
27
27
|
const element = [];
|
|
28
28
|
servicesData.forEach((sd) => {
|
|
29
29
|
if (sd.id_retailer === rt.id) {
|
|
@@ -19,6 +19,19 @@ export const FullTabsMenu = ({
|
|
|
19
19
|
canAssign,
|
|
20
20
|
version,
|
|
21
21
|
setShowVersionSelector,
|
|
22
|
+
|
|
23
|
+
desc,
|
|
24
|
+
setDesc,
|
|
25
|
+
fich,
|
|
26
|
+
setFich,
|
|
27
|
+
imag,
|
|
28
|
+
setImag,
|
|
29
|
+
updatedDescriptions,
|
|
30
|
+
updatedDatasheets,
|
|
31
|
+
selectedImages,
|
|
32
|
+
setUpdatedDescriptions,
|
|
33
|
+
setUpdatedDatasheets,
|
|
34
|
+
setSelectedImages
|
|
22
35
|
}) => {
|
|
23
36
|
const [imagesSection, setImagesSection] = useState(false);
|
|
24
37
|
|
|
@@ -28,6 +41,20 @@ export const FullTabsMenu = ({
|
|
|
28
41
|
tabsSections={tabsSections}
|
|
29
42
|
setImagesSection={setImagesSection}
|
|
30
43
|
setActiveTab={setActiveTab}
|
|
44
|
+
activeTab={activeTab}
|
|
45
|
+
|
|
46
|
+
desc={ desc }
|
|
47
|
+
setDesc={ setDesc }
|
|
48
|
+
fich={fich}
|
|
49
|
+
setFich={setFich}
|
|
50
|
+
imag={imag}
|
|
51
|
+
setImag={setImag}
|
|
52
|
+
updatedDescriptions={updatedDescriptions}
|
|
53
|
+
updatedDatasheets={updatedDatasheets}
|
|
54
|
+
selectedImages={selectedImages}
|
|
55
|
+
setUpdatedDescriptions={setUpdatedDescriptions}
|
|
56
|
+
setUpdatedDatasheets={setUpdatedDatasheets}
|
|
57
|
+
setSelectedImages={setSelectedImages}
|
|
31
58
|
/>
|
|
32
59
|
<StatusAsignationInfo
|
|
33
60
|
canAssign={canAssign}
|
|
@@ -47,4 +74,4 @@ export const FullTabsMenu = ({
|
|
|
47
74
|
/>
|
|
48
75
|
</Container>
|
|
49
76
|
);
|
|
50
|
-
};
|
|
77
|
+
};
|
|
@@ -3,6 +3,7 @@ import { TableHeader } from "../../molecules/TableHeader";
|
|
|
3
3
|
import { Container as Row } from "../../molecules/TableRow/styles";
|
|
4
4
|
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
5
5
|
import LabelToInput from "../../atoms/LabelToInput";
|
|
6
|
+
import { useState, useEffect } from "react";
|
|
6
7
|
|
|
7
8
|
export const ImageDataTable = ({
|
|
8
9
|
activeImage,
|
|
@@ -20,6 +21,7 @@ export const ImageDataTable = ({
|
|
|
20
21
|
setShowVersionSelector,
|
|
21
22
|
shotThd,
|
|
22
23
|
}) => {
|
|
24
|
+
|
|
23
25
|
return (
|
|
24
26
|
<Container darkMode={darkMode}>
|
|
25
27
|
<TableHeader
|
|
@@ -43,6 +45,7 @@ export const ImageDataTable = ({
|
|
|
43
45
|
}
|
|
44
46
|
/>
|
|
45
47
|
</Row>
|
|
48
|
+
|
|
46
49
|
<Row>
|
|
47
50
|
<ScreenHeader headerType={"table-row-text"} text="Tipo de empaque" />
|
|
48
51
|
<ScreenHeader
|
|
@@ -47,6 +47,7 @@ export const InputGroup = ({
|
|
|
47
47
|
text={inputGroup?.dataGroup}
|
|
48
48
|
/>
|
|
49
49
|
)}
|
|
50
|
+
|
|
50
51
|
<div className="inputs-container">
|
|
51
52
|
{inputGroup?.inputs?.map((input, index) =>
|
|
52
53
|
activeSection === "Ficha técnica" ? (
|
|
@@ -119,8 +120,10 @@ export const InputGroup = ({
|
|
|
119
120
|
: ""
|
|
120
121
|
}
|
|
121
122
|
/>
|
|
123
|
+
|
|
122
124
|
)
|
|
123
|
-
)
|
|
125
|
+
)
|
|
126
|
+
}
|
|
124
127
|
</div>
|
|
125
128
|
</Container>
|
|
126
129
|
);
|
|
@@ -31,7 +31,6 @@ export const ContainerModal = styled.div`
|
|
|
31
31
|
align-items: center;
|
|
32
32
|
justify-content: flex-start;
|
|
33
33
|
gap: 6px;
|
|
34
|
-
margin-bottom: 20px;
|
|
35
34
|
|
|
36
35
|
.label-title {
|
|
37
36
|
width: 100%;
|
|
@@ -42,6 +41,10 @@ export const ContainerModal = styled.div`
|
|
|
42
41
|
color: #262626;
|
|
43
42
|
white-space: pre-wrap;
|
|
44
43
|
}
|
|
44
|
+
|
|
45
|
+
& + * {
|
|
46
|
+
margin-top: 20px;
|
|
47
|
+
}
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
.iconModal {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SideModal } from ".";
|
|
2
|
+
import { ButtonV2 } from "../../atoms/ButtonV2";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/organisms/SideModal",
|
|
6
|
+
component: SideModal,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const Template = (args) => <SideModal {...args} />;
|
|
10
|
+
|
|
11
|
+
export const DefaultSideModal = Template.bind({});
|
|
12
|
+
DefaultSideModal.args = {
|
|
13
|
+
show: false,
|
|
14
|
+
header: [
|
|
15
|
+
<div className="title-container">
|
|
16
|
+
<h2></h2>
|
|
17
|
+
</div>,
|
|
18
|
+
<ButtonV2 label="Ir al Checkout" />,
|
|
19
|
+
<ButtonV2 label="X" />,
|
|
20
|
+
],
|
|
21
|
+
body: <></>,
|
|
22
|
+
footer: <></>,
|
|
23
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useRef } from "react";
|
|
2
|
+
import { Container } from "./styles";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { PropaneSharp } from "@mui/icons-material";
|
|
5
|
+
|
|
6
|
+
export const SideModal = ({
|
|
7
|
+
header,
|
|
8
|
+
body,
|
|
9
|
+
footer,
|
|
10
|
+
show,
|
|
11
|
+
setShow,
|
|
12
|
+
id = "side-modal",
|
|
13
|
+
}) => {
|
|
14
|
+
const modal = useRef();
|
|
15
|
+
|
|
16
|
+
const closeModal = (e) => {
|
|
17
|
+
if (!e.target.closest(`#${id}`) && show) {
|
|
18
|
+
document.removeEventListener("click", closeModal, false);
|
|
19
|
+
modal?.current?.classList?.remove("shown");
|
|
20
|
+
setShow && setShow(false);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (show && modal.current) {
|
|
26
|
+
document.addEventListener("click", closeModal, false);
|
|
27
|
+
modal?.current?.classList?.add("shown");
|
|
28
|
+
}
|
|
29
|
+
}, [show]);
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
return () => {
|
|
33
|
+
document.removeEventListener("click", closeModal, false);
|
|
34
|
+
modal?.current?.classList?.remove("shown");
|
|
35
|
+
setShow && setShow(false);
|
|
36
|
+
};
|
|
37
|
+
}, []);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
show && (
|
|
41
|
+
<Container>
|
|
42
|
+
<div id={id} ref={modal} className="modal-container">
|
|
43
|
+
<div className="modal-header">{header}</div>
|
|
44
|
+
<div className="modal-body">{body}</div>
|
|
45
|
+
<div className="modal-footer">{footer}</div>
|
|
46
|
+
</div>
|
|
47
|
+
</Container>
|
|
48
|
+
)
|
|
49
|
+
);
|
|
50
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
export const Container = styled.div`
|
|
4
|
+
width: 100vw;
|
|
5
|
+
height: 100vh;
|
|
6
|
+
position: fixed;
|
|
7
|
+
z-index: 9999999;
|
|
8
|
+
background-color: transparent;
|
|
9
|
+
top: 0;
|
|
10
|
+
left: 0;
|
|
11
|
+
|
|
12
|
+
.modal-container {
|
|
13
|
+
width: 600px;
|
|
14
|
+
height: 100%;
|
|
15
|
+
position: absolute;
|
|
16
|
+
right: -600px;
|
|
17
|
+
background-color: #fff;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
box-shadow: -0.5px 0px 5px #f0f0f0;
|
|
21
|
+
border: 1px solid #f0f0f0;
|
|
22
|
+
.modal-body {
|
|
23
|
+
flex: 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.shown {
|
|
27
|
+
right: 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`;
|