contentoh-components-library 21.2.90 → 21.2.92

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.
Files changed (195) hide show
  1. package/.env.development +3 -0
  2. package/.storybook/main.js +5 -8
  3. package/.storybook/preview.js +1 -1
  4. package/dist/_utils/helper.js +40 -0
  5. package/dist/assets/fonts/Roboto/LICENSE.txt +202 -0
  6. package/dist/assets/fonts/Roboto/Roboto-Black.ttf +0 -0
  7. package/dist/assets/fonts/Roboto/Roboto-BlackItalic.ttf +0 -0
  8. package/dist/assets/fonts/Roboto/Roboto-Bold.ttf +0 -0
  9. package/dist/assets/fonts/Roboto/Roboto-BoldItalic.ttf +0 -0
  10. package/dist/assets/fonts/Roboto/Roboto-Italic.ttf +0 -0
  11. package/dist/assets/fonts/Roboto/Roboto-Light.ttf +0 -0
  12. package/dist/assets/fonts/Roboto/Roboto-LightItalic.ttf +0 -0
  13. package/dist/assets/fonts/Roboto/Roboto-Medium.ttf +0 -0
  14. package/dist/assets/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
  15. package/dist/assets/fonts/Roboto/Roboto-Regular.ttf +0 -0
  16. package/dist/assets/fonts/Roboto/Roboto-Thin.ttf +0 -0
  17. package/dist/assets/fonts/Roboto/Roboto-ThinItalic.ttf +0 -0
  18. package/dist/assets/images/defaultImages/Spinner.gif +0 -0
  19. package/dist/assets/images/defaultImages/notFound.svg +124 -0
  20. package/dist/components/atoms/Button/index.js +22 -0
  21. package/dist/components/atoms/Button/styles.js +56 -0
  22. package/dist/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +72 -0
  23. package/dist/components/atoms/ButtonFileChooser/index.js +118 -0
  24. package/dist/components/atoms/ButtonFileChooser/styles.js +20 -0
  25. package/dist/components/atoms/ButtonV2/ButtonV2.stories.js +66 -0
  26. package/dist/components/atoms/ButtonV2/index.js +111 -0
  27. package/dist/components/atoms/ButtonV2/styles.js +53 -0
  28. package/dist/components/atoms/CustomIcon/CustomIcon.stories.js +50 -0
  29. package/dist/components/atoms/CustomIcon/index.js +40 -0
  30. package/dist/components/atoms/CustomIcon/styles.js +33 -0
  31. package/dist/components/atoms/IconFile/IconFile.stories.js +48 -0
  32. package/dist/components/atoms/IconFile/index.js +249 -0
  33. package/dist/components/atoms/IconFile/styles.js +23 -0
  34. package/dist/components/atoms/Image/Image.stories.js +63 -0
  35. package/dist/components/atoms/Image/index.js +74 -0
  36. package/dist/components/atoms/Image/styles.js +40 -0
  37. package/dist/components/atoms/ImageLink/ImageLink.stories.js +63 -0
  38. package/dist/components/atoms/ImageLink/index.js +77 -0
  39. package/dist/components/atoms/ImageLink/styles.js +40 -0
  40. package/dist/components/atoms/ImagePreview/ImagePreview.stories.js +70 -0
  41. package/dist/components/atoms/ImagePreview/index.js +222 -0
  42. package/dist/components/atoms/ImagePreview/styles.js +44 -0
  43. package/dist/components/atoms/InputText/InputText.stories.js +60 -0
  44. package/dist/components/atoms/InputText/index.js +66 -0
  45. package/dist/components/atoms/InputText/styles.js +32 -0
  46. package/dist/components/atoms/NotFound/NotFound.stories.js +36 -0
  47. package/dist/components/atoms/NotFound/index.js +75 -0
  48. package/dist/components/atoms/NotFound/styles.js +20 -0
  49. package/dist/components/atoms/ProgressBar/styles.js +1 -1
  50. package/dist/components/atoms/Tooltip/Tooltip.stories.js +35 -5
  51. package/dist/components/atoms/Tooltip/index.js +41 -24
  52. package/dist/components/atoms/Tooltip/styles.js +3 -1
  53. package/dist/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +66 -0
  54. package/dist/components/molecules/ButtonDownloadFile/index.js +179 -0
  55. package/dist/components/molecules/ButtonDownloadFile/styles.js +23 -0
  56. package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +21 -22
  57. package/dist/components/molecules/CustomSelect/SelectItem.js +10 -1
  58. package/dist/components/molecules/HeaderTop/index.js +10 -5
  59. package/dist/components/molecules/HeaderTop/styles.js +1 -1
  60. package/dist/components/molecules/ImageTooltip/ImageTooltip.stories.js +72 -0
  61. package/dist/components/molecules/ImageTooltip/index.js +84 -0
  62. package/dist/components/molecules/ImageTooltip/styles.js +33 -0
  63. package/dist/components/organisms/Chat/Chat.stories.js +215 -0
  64. package/dist/components/organisms/Chat/ChatLists/ChatLists.stories.js +83 -0
  65. package/dist/components/organisms/Chat/ChatLists/index.js +160 -0
  66. package/dist/components/organisms/Chat/ChatLists/styles.js +29 -0
  67. package/dist/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +176 -0
  68. package/dist/components/organisms/Chat/ContainerItems/index.js +569 -0
  69. package/dist/components/organisms/Chat/ContainerItems/styles.js +20 -0
  70. package/dist/components/organisms/Chat/ContentChat/ContentChat.stories.js +142 -0
  71. package/dist/components/organisms/Chat/ContentChat/index.js +1422 -0
  72. package/dist/components/organisms/Chat/ContentChat/styles.js +20 -0
  73. package/dist/components/organisms/Chat/Footer/Footer.stories.js +43 -0
  74. package/dist/components/organisms/Chat/Footer/index.js +984 -0
  75. package/dist/components/organisms/Chat/Footer/styles.js +32 -0
  76. package/dist/components/organisms/Chat/Header/Header.stories.js +96 -0
  77. package/dist/components/organisms/Chat/Header/index.js +84 -0
  78. package/dist/components/organisms/Chat/Header/styles.js +20 -0
  79. package/dist/components/organisms/Chat/index.js +327 -0
  80. package/dist/components/organisms/Chat/styles.js +29 -0
  81. package/dist/components/organisms/Modal/Modal.stories.js +66 -0
  82. package/dist/components/organisms/Modal/index.js +95 -0
  83. package/dist/components/organisms/Modal/styles.js +20 -0
  84. package/dist/components/organisms/OrderDetail/OrderDetail.stories.js +189 -0
  85. package/dist/components/organisms/OrderDetail/index.js +249 -0
  86. package/dist/components/organisms/OrderDetail/styles.js +40 -0
  87. package/dist/components/organisms/OrderDetail/utils/ImageGroup/index.js +55 -0
  88. package/dist/components/organisms/OrderDetail/utils/ImageGroup/styles.js +39 -0
  89. package/dist/components/organisms/OrderDetail/utils/Table/index.js +207 -0
  90. package/dist/components/organisms/OrderDetail/utils/Table/styles.js +38 -0
  91. package/dist/components/organisms/OrderDetail/utils/Table/utils.js +32 -0
  92. package/dist/global-files/fonts.css +24 -0
  93. package/dist/global-files/handle_http.js +383 -0
  94. package/dist/global-files/utils.js +472 -0
  95. package/dist/global-files/variables.js +4 -1
  96. package/dist/index.js +227 -45
  97. package/package.json +14 -1
  98. package/src/_utils/helper.js +36 -0
  99. package/src/assets/fonts/Roboto/LICENSE.txt +202 -0
  100. package/src/assets/fonts/Roboto/Roboto-Black.ttf +0 -0
  101. package/src/assets/fonts/Roboto/Roboto-BlackItalic.ttf +0 -0
  102. package/src/assets/fonts/Roboto/Roboto-Bold.ttf +0 -0
  103. package/src/assets/fonts/Roboto/Roboto-BoldItalic.ttf +0 -0
  104. package/src/assets/fonts/Roboto/Roboto-Italic.ttf +0 -0
  105. package/src/assets/fonts/Roboto/Roboto-Light.ttf +0 -0
  106. package/src/assets/fonts/Roboto/Roboto-LightItalic.ttf +0 -0
  107. package/src/assets/fonts/Roboto/Roboto-Medium.ttf +0 -0
  108. package/src/assets/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
  109. package/src/assets/fonts/Roboto/Roboto-Regular.ttf +0 -0
  110. package/src/assets/fonts/Roboto/Roboto-Thin.ttf +0 -0
  111. package/src/assets/fonts/Roboto/Roboto-ThinItalic.ttf +0 -0
  112. package/src/assets/images/customSelect/starIcon.svg +14 -0
  113. package/src/assets/images/defaultImages/Spinner.gif +0 -0
  114. package/src/assets/images/defaultImages/notFound.svg +124 -0
  115. package/src/components/atoms/Button/index.js +16 -0
  116. package/src/components/atoms/Button/styles.js +37 -0
  117. package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +47 -0
  118. package/src/components/atoms/ButtonFileChooser/index.js +69 -0
  119. package/src/components/atoms/ButtonFileChooser/styles.js +4 -0
  120. package/src/components/atoms/ButtonV2/ButtonV2.stories.js +50 -0
  121. package/src/components/atoms/ButtonV2/index.js +74 -0
  122. package/src/components/atoms/ButtonV2/styles.js +187 -0
  123. package/src/components/atoms/CustomIcon/CustomIcon.stories.js +36 -0
  124. package/src/components/atoms/CustomIcon/index.js +41 -0
  125. package/src/components/atoms/CustomIcon/styles.js +85 -0
  126. package/src/components/atoms/IconFile/IconFile.stories.js +35 -0
  127. package/src/components/atoms/IconFile/index.js +119 -0
  128. package/src/components/atoms/IconFile/styles.js +67 -0
  129. package/src/components/atoms/Image/Image.stories.js +43 -0
  130. package/src/components/atoms/Image/index.js +54 -0
  131. package/src/components/atoms/Image/styles.js +25 -0
  132. package/src/components/atoms/ImageLink/ImageLink.stories.js +43 -0
  133. package/src/components/atoms/ImageLink/index.js +57 -0
  134. package/src/components/atoms/ImageLink/styles.js +30 -0
  135. package/src/components/atoms/ImagePreview/ImagePreview.stories.js +52 -0
  136. package/src/components/atoms/ImagePreview/index.js +191 -0
  137. package/src/components/atoms/ImagePreview/styles.js +77 -0
  138. package/src/components/atoms/InputText/InputText.stories.js +39 -0
  139. package/src/components/atoms/InputText/index.js +61 -0
  140. package/src/components/atoms/InputText/styles.js +89 -0
  141. package/src/components/atoms/NotFound/NotFound.stories.js +19 -0
  142. package/src/components/atoms/NotFound/index.js +52 -0
  143. package/src/components/atoms/NotFound/styles.js +55 -0
  144. package/src/components/atoms/ProgressBar/styles.js +4 -3
  145. package/src/components/atoms/Tooltip/Tooltip.stories.js +51 -0
  146. package/src/components/atoms/Tooltip/index.js +59 -0
  147. package/src/components/atoms/Tooltip/styles.js +42 -0
  148. package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +54 -0
  149. package/src/components/molecules/ButtonDownloadFile/index.js +111 -0
  150. package/src/components/molecules/ButtonDownloadFile/styles.js +66 -0
  151. package/src/components/molecules/CustomSelect/CustomSelect.stories.js +20 -12
  152. package/src/components/molecules/CustomSelect/SelectItem.js +7 -0
  153. package/src/components/molecules/HeaderTop/index.js +11 -6
  154. package/src/components/molecules/HeaderTop/styles.js +4 -0
  155. package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +46 -0
  156. package/src/components/molecules/ImageTooltip/index.js +62 -0
  157. package/src/components/molecules/ImageTooltip/styles.js +18 -0
  158. package/src/components/organisms/Chat/Chat.stories.js +199 -0
  159. package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +65 -0
  160. package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
  161. package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
  162. package/src/components/organisms/Chat/ChatLists/index.js +141 -0
  163. package/src/components/organisms/Chat/ChatLists/styles.js +162 -0
  164. package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +142 -0
  165. package/src/components/organisms/Chat/ContainerItems/index.js +549 -0
  166. package/src/components/organisms/Chat/ContainerItems/styles.js +328 -0
  167. package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +102 -0
  168. package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
  169. package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
  170. package/src/components/organisms/Chat/ContentChat/index.js +900 -0
  171. package/src/components/organisms/Chat/ContentChat/styles.js +41 -0
  172. package/src/components/organisms/Chat/Footer/Footer.stories.js +22 -0
  173. package/src/components/organisms/Chat/Footer/index.js +669 -0
  174. package/src/components/organisms/Chat/Footer/styles.js +286 -0
  175. package/src/components/organisms/Chat/Header/Header.stories.js +66 -0
  176. package/src/components/organisms/Chat/Header/index.js +94 -0
  177. package/src/components/organisms/Chat/Header/styles.js +49 -0
  178. package/src/components/organisms/Chat/index.js +294 -0
  179. package/src/components/organisms/Chat/styles.js +42 -0
  180. package/src/components/organisms/Modal/Modal.stories.js +55 -0
  181. package/src/components/organisms/Modal/index.js +97 -0
  182. package/src/components/organisms/Modal/styles.js +103 -0
  183. package/src/components/organisms/OrderDetail/OrderDetail.stories.js +72 -0
  184. package/src/components/organisms/OrderDetail/index.js +189 -0
  185. package/src/components/organisms/OrderDetail/styles.js +120 -0
  186. package/src/components/organisms/OrderDetail/utils/ImageGroup/index.js +34 -0
  187. package/src/components/organisms/OrderDetail/utils/ImageGroup/styles.js +46 -0
  188. package/src/components/organisms/OrderDetail/utils/Table/index.js +132 -0
  189. package/src/components/organisms/OrderDetail/utils/Table/styles.js +49 -0
  190. package/src/components/organisms/OrderDetail/utils/Table/utils.js +27 -0
  191. package/src/global-files/fonts.css +24 -0
  192. package/src/global-files/handle_http.js +231 -0
  193. package/src/global-files/utils.js +300 -0
  194. package/src/global-files/variables.js +3 -0
  195. package/src/index.js +14 -0
@@ -0,0 +1,189 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import { Status } from "../../atoms/Status/index";
3
+ import { ProgressBar } from "../../atoms/ProgressBar/index";
4
+ import moment from "moment";
5
+ import "moment/locale/es";
6
+ import {
7
+ MainContainer,
8
+ Header,
9
+ Details,
10
+ Detail,
11
+ SpaceBetween,
12
+ Card,
13
+ } from "./styles";
14
+ import Button from "../../atoms/Button";
15
+ import Table from "./utils/Table";
16
+
17
+ moment.locale("es");
18
+
19
+ export default function OrderDetail(props) {
20
+ const { order } = props;
21
+ const [showPaymentButton, setShowPaymentButton] = useState(
22
+ order.payment !== "pagado"
23
+ );
24
+ const [orderData, setOrderData] = useState({});
25
+ const [dataGeneral, setDataGeneral] = useState({
26
+ approved: "-",
27
+ rejected: "-",
28
+ in_progress: "-",
29
+ totalArticles: "-",
30
+ percentage: "0.0",
31
+ datasheet: "-",
32
+ description: "-",
33
+ images: "-",
34
+ });
35
+
36
+ const updBilling = (articleId, newBillingStatus) => {
37
+ props.updateBilling &&
38
+ props.updateBilling({
39
+ body: { orderId: order.id_order, articleId, newBillingStatus },
40
+ });
41
+ const items = document.querySelectorAll(`[id^="Fact."]`);
42
+ let generalBilling = true;
43
+ items.forEach((item) => {
44
+ if (!item.checked) {
45
+ generalBilling = false;
46
+ return;
47
+ }
48
+ });
49
+ props.updateGeneralBilling(order.id_order, generalBilling);
50
+ };
51
+
52
+ useEffect(() => {
53
+ props.getOrderDetail &&
54
+ props
55
+ .getOrderDetail({ query: { orderId: order.id_order } })
56
+ .then((res) => {
57
+ const { data, countArticles, totalArticles } = res;
58
+ const obj = {};
59
+ const orderKeys = [
60
+ "UPC",
61
+ "Nombre",
62
+ "Cadena",
63
+ "Servicios",
64
+ "Estatus",
65
+ "Fact.",
66
+ "extends",
67
+ ];
68
+ Object.keys(data).forEach((key) => {
69
+ obj[key] = {};
70
+ orderKeys.forEach((header) => {
71
+ obj[key][header] = data[key][header];
72
+ });
73
+ obj[key]["Fact."].onChange = updBilling;
74
+ });
75
+ setOrderData(obj);
76
+ setDataGeneral({ ...countArticles, totalArticles });
77
+ });
78
+ // eslint-disable-next-line react-hooks/exhaustive-deps
79
+ }, [order.id_order]);
80
+
81
+ return (
82
+ <MainContainer id={props.id}>
83
+ <Header>
84
+ <SpaceBetween>
85
+ <h2 className="headerTitle">Orden de trabajo {order.id_order}</h2>
86
+ <div className="buttons">
87
+ {showPaymentButton && (
88
+ <Button
89
+ type="primary"
90
+ onClick={() => {
91
+ props.updatePaymentStatus(order.id_order, "pagado");
92
+ setShowPaymentButton(false);
93
+ }}
94
+ >
95
+ Pagar
96
+ </Button>
97
+ )}
98
+ <Button
99
+ type="image"
100
+ onClick={() => {
101
+ props.setShowOrderDetail(false);
102
+ }}
103
+ >
104
+ &#x2715;
105
+ </Button>
106
+ </div>
107
+ </SpaceBetween>
108
+ </Header>
109
+ <Details>
110
+ <div>
111
+ <Detail>
112
+ <p className="title">Entrega estimada</p>
113
+ <p className="date">
114
+ {order.deliver_date
115
+ ? moment(order.deliver_date).format("dddd DD [de] MMMM YYYY")
116
+ : "Sin fecha asignada"}
117
+ </p>
118
+ </Detail>
119
+ <Detail>
120
+ <p className="title">Tipo de entrega</p>
121
+ <p>{order.type}</p>
122
+ </Detail>
123
+ <Detail>
124
+ <p className="title">Estatus de la orden</p>
125
+ <SpaceBetween>
126
+ <Status statusType={order.status} />
127
+ <ProgressBar
128
+ percent={dataGeneral.percentage}
129
+ progressBarType={order.status}
130
+ />
131
+ </SpaceBetween>
132
+ </Detail>
133
+ </div>
134
+ <div>
135
+ <Card>
136
+ <span className="title">APROBADOS</span>
137
+ <p>
138
+ {dataGeneral.approved} / {dataGeneral.totalArticles}
139
+ </p>
140
+ </Card>
141
+ <Card>
142
+ <span className="title">RECHAZADOS</span>
143
+ <p>
144
+ {dataGeneral.rejected} / {dataGeneral.totalArticles}
145
+ </p>
146
+ </Card>
147
+ <Card>
148
+ <span className="title">EN PROCESO</span>
149
+ <p>
150
+ {dataGeneral.in_progress} / {dataGeneral.totalArticles}
151
+ </p>
152
+ </Card>
153
+ </div>
154
+ </Details>
155
+ <div className="body">
156
+ <Table
157
+ headers={[
158
+ { width: 140, name: "UPC" },
159
+ { width: 210, name: "Nombre" },
160
+ { width: 100, name: "Cadena", type: "groupImages" },
161
+ { width: 130, name: "Servicios", type: "services" },
162
+ { width: 70, name: "Estatus", type: "status" },
163
+ { width: 65, name: "Fact.", type: "checkout" },
164
+ ]}
165
+ data={orderData}
166
+ />
167
+ </div>
168
+ <div className="footer">
169
+ <h2 className="headerTitle">Totales</h2>
170
+ <Card>
171
+ <span className="title">PRODUCTOS</span>
172
+ <p>{dataGeneral.totalArticles}</p>
173
+ </Card>
174
+ <Card>
175
+ <span className="title">FICHAS TÉCNICAS</span>
176
+ <p>{dataGeneral.datasheet}</p>
177
+ </Card>
178
+ <Card>
179
+ <span className="title">DESCRIPCIONES</span>
180
+ <p>{dataGeneral.description}</p>
181
+ </Card>
182
+ <Card>
183
+ <span className="title">IMÁGENES</span>
184
+ <p>{dataGeneral.images}</p>
185
+ </Card>
186
+ </div>
187
+ </MainContainer>
188
+ );
189
+ }
@@ -0,0 +1,120 @@
1
+ import styled from "styled-components";
2
+ import { FontFamily } from "../../../global-files/variables";
3
+
4
+ export const MainContainer = styled.div`
5
+ position: fixed;
6
+ right: 0;
7
+ width: 785px;
8
+ height: 100vh;
9
+ z-index: 5;
10
+ background: #ffffff;
11
+ box-sizing: border-box;
12
+ font-family: ${FontFamily.Roboto};
13
+ & > * {
14
+ padding: 0 30px;
15
+ }
16
+ .headerTitle {
17
+ font-weight: bold;
18
+ font-size: 25px;
19
+ }
20
+
21
+ display: grid;
22
+ grid-template-columns: 1fr;
23
+ grid-template-rows: 101px 120px 1fr 115px;
24
+ grid-column-gap: 0px;
25
+ grid-row-gap: 0px;
26
+
27
+ .body {
28
+ overflow-y: auto;
29
+ }
30
+ .footer {
31
+ width: 100%;
32
+ display: flex;
33
+ align-items: center;
34
+ height: 115px;
35
+ border-top: 1px solid #e6e6e6;
36
+ position: sticky;
37
+ bottom: 0;
38
+ padding: 20px;
39
+ box-sizing: border-box;
40
+ > h2 {
41
+ margin-right: 20px;
42
+ }
43
+ > div {
44
+ margin-right: 10px;
45
+ }
46
+ }
47
+ `;
48
+
49
+ export const Header = styled.div`
50
+ width: 100%;
51
+ border-bottom: 0.3px solid #e6e6e6;
52
+ box-sizing: border-box;
53
+ .buttons {
54
+ > button {
55
+ margin-left: 10px;
56
+ }
57
+ }
58
+ `;
59
+
60
+ export const Details = styled.div`
61
+ display: flex;
62
+ margin-top: 15px;
63
+ justify-content: space-between;
64
+ > div {
65
+ width: 48%;
66
+ }
67
+ & > div:last-child {
68
+ width: 50%;
69
+ display: flex;
70
+ justify-content: space-around;
71
+ align-items: center;
72
+ }
73
+ `;
74
+
75
+ export const Detail = styled.div`
76
+ display: flex;
77
+ justify-content: space-between;
78
+ font-family: Roboto;
79
+ font-size: 12px;
80
+ margin-bottom: 15px;
81
+ color: #262626;
82
+ .title {
83
+ color: #707070;
84
+ display: flex;
85
+ align-items: center;
86
+ }
87
+ & > * {
88
+ width: 50% !important;
89
+ }
90
+ .date::first-letter {
91
+ text-transform: capitalize;
92
+ }
93
+ `;
94
+
95
+ export const SpaceBetween = styled.div`
96
+ display: flex;
97
+ justify-content: space-between;
98
+ align-items: center;
99
+ width: 100%;
100
+ height: 100%;
101
+ `;
102
+
103
+ export const Card = styled.div`
104
+ display: flex;
105
+ flex-direction: column;
106
+ align-items: center;
107
+ justify-content: space-around;
108
+ border-radius: 10px;
109
+ font-family: Roboto;
110
+ font-size: 15px;
111
+ background: #f7f7fc;
112
+ height: 60px;
113
+ min-width: 100px;
114
+ padding: 10px 0;
115
+ box-sizing: border-box;
116
+ .title {
117
+ color: #808080;
118
+ font-size: 10px;
119
+ }
120
+ `;
@@ -0,0 +1,34 @@
1
+ import React, { useState } from "react";
2
+ import ReactImageFallback from "react-image-fallback";
3
+ import { MainContainer, Image, NameHover, CounterExtra } from "./styles";
4
+ import DefaultImage from "../../../../../assets/images/defaultImages/defaultProfileImage.svg";
5
+
6
+ export default function Table({ images }) {
7
+ const [indexHover, setIndexHover] = useState();
8
+
9
+ return (
10
+ <MainContainer>
11
+ {images.map((image, i) => (
12
+ <Image
13
+ onMouseEnter={() => setIndexHover(i)}
14
+ onMouseLeave={() => setIndexHover()}
15
+ key={image.id}
16
+ index={i}
17
+ >
18
+ {image.id !== -1 ? (
19
+ <ReactImageFallback
20
+ src={image.src}
21
+ fallbackImage={DefaultImage}
22
+ className="img"
23
+ />
24
+ ) : (
25
+ <CounterExtra>{image.src}</CounterExtra>
26
+ )}
27
+ {indexHover === i && image.name && (
28
+ <NameHover index={i}>{image.name}</NameHover>
29
+ )}
30
+ </Image>
31
+ ))}
32
+ </MainContainer>
33
+ );
34
+ }
@@ -0,0 +1,46 @@
1
+ import styled from "styled-components";
2
+
3
+ export const MainContainer = styled.div`
4
+ display: flex;
5
+ position: relative;
6
+ width: 100%;
7
+ height: 100%;
8
+ `;
9
+
10
+ export const Image = styled.div`
11
+ position: absolute;
12
+ z-index: ${({ index }) => 5 - index};
13
+ left: ${({ index }) => `${11 * index}px`};
14
+ .img {
15
+ width: 18px;
16
+ height: 18px;
17
+ object-fit: fill;
18
+ border-radius: 100%;
19
+ }
20
+ `;
21
+
22
+ export const NameHover = styled.div`
23
+ white-space: nowrap;
24
+ z-index: 20;
25
+ position: absolute;
26
+ left: ${({ index }) => 9}px;
27
+ top: -7px;
28
+ font-family: Roboto;
29
+ font-size: 10px;
30
+ background: #ffffff;
31
+ border-radius: 3px;
32
+ box-shadow: 0px 2px 4px #00000029;
33
+ padding: 2px 5px;
34
+ `;
35
+
36
+ export const CounterExtra = styled.div`
37
+ background: #8a6caaaa;
38
+ color: #ffffff;
39
+ border-radius: 50%;
40
+ width: 18px;
41
+ height: 18px;
42
+ display: flex;
43
+ justify-content: center;
44
+ align-items: center;
45
+ margin-left: 5px;
46
+ `;
@@ -0,0 +1,132 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import { Status } from "../../../../atoms/Status";
3
+ import { CheckBox } from "../../../../atoms/CheckBox";
4
+ import ImageGroup from "../ImageGroup";
5
+ import { getRetailerPicture } from "../../../../../_utils/helper";
6
+ import { Header, Column, Rows } from "./styles";
7
+ import { servicesCodeIcon } from "./utils";
8
+
9
+ export default function Table(props) {
10
+ const [headers, setHeaders] = useState([]);
11
+ const [values, setValues] = useState([]);
12
+ const [config, setConfig] = useState({ wides: [], types: [], extends: [] });
13
+ const [showExtends, setShowExtends] = useState(-1);
14
+
15
+ useEffect(() => {
16
+ const tempConfig = { wides: [], types: [], extends: [] };
17
+ const headersName = [];
18
+ const values = [];
19
+ props.headers.forEach(({ width, name, type }) => {
20
+ tempConfig.wides.push(width);
21
+ tempConfig.types.push(type);
22
+ headersName.push(name);
23
+ });
24
+ Object.entries(props.data).forEach(([key, columns]) => {
25
+ const copy = columns.extends
26
+ ? Object.entries(columns.extends).map(([keyExt, columnsExt]) => ({
27
+ key: keyExt,
28
+ columns: columnsExt,
29
+ }))
30
+ : undefined;
31
+ tempConfig.extends.push(copy);
32
+ values.push({ key, columns });
33
+ });
34
+ setValues(values);
35
+ setHeaders(headersName);
36
+ setConfig(tempConfig);
37
+ }, [props.data, props.headers]);
38
+
39
+ const getTypeColumn = (index, key, value, id, isDetail) => {
40
+ switch (config.types[index]) {
41
+ case "groupImages":
42
+ let images = [];
43
+ if (value.length > 4) {
44
+ const remaining = value.length - 3;
45
+ value.forEach((e, i) => {
46
+ if (i >= 3) return;
47
+ images.push({ ...e, src: getRetailerPicture(e.id) });
48
+ });
49
+ images.push({
50
+ id: -1,
51
+ src: `+${remaining}`,
52
+ name: `+${remaining} Cadenas`,
53
+ });
54
+ } else {
55
+ images = value.map((e) => ({ ...e, src: getRetailerPicture(e.id) }));
56
+ }
57
+ return <ImageGroup images={images} />;
58
+ case "services":
59
+ return (
60
+ <div className="flex">{value.map((e) => servicesCodeIcon[e])}</div>
61
+ );
62
+ case "status":
63
+ return (
64
+ <div className="center">{value && <Status statusType={value} />}</div>
65
+ );
66
+ case "checkout":
67
+ return (
68
+ !isDetail && (
69
+ <div className="center CheckBoxTable">
70
+ <CheckBox
71
+ id={`${key}-${id}`}
72
+ onChange={(e) => {
73
+ e.stopPropagation();
74
+ value && value.onChange(id, e.target.checked);
75
+ }}
76
+ defaultChecked={value.value}
77
+ />
78
+ </div>
79
+ )
80
+ );
81
+ default:
82
+ return value;
83
+ }
84
+ };
85
+
86
+ return (
87
+ <>
88
+ <Header>
89
+ {headers.map((headers, i) => (
90
+ <Column key={`header-${i}`} width={config.wides[i]} isHeader>
91
+ {headers}
92
+ </Column>
93
+ ))}
94
+ </Header>
95
+ {values.map((v, index) => (
96
+ <>
97
+ <Rows
98
+ key={`row-${v.key}`}
99
+ index={index}
100
+ onClick={() => setShowExtends(showExtends === index ? -1 : index)}
101
+ >
102
+ {Object.entries(v.columns).map(
103
+ ([key, c], i) =>
104
+ key !== "extends" && (
105
+ <Column key={`${v.key}-${i}`} width={config.wides[i]}>
106
+ {getTypeColumn(i, key, c, v.key)}
107
+ </Column>
108
+ )
109
+ )}
110
+ </Rows>
111
+ {showExtends === index &&
112
+ config.extends[index] &&
113
+ Object.values(config.extends[index]).map((v, idx) => (
114
+ <Rows key={`extends-${v.key}`} index={idx}>
115
+ {Object.entries(v.columns).map(
116
+ ([key, c], i) =>
117
+ key !== "extends" && (
118
+ <Column
119
+ key={`extends-${v.key}-${i}`}
120
+ width={config.wides[i]}
121
+ >
122
+ {getTypeColumn(i, key, c, v.key, true)}
123
+ </Column>
124
+ )
125
+ )}
126
+ </Rows>
127
+ ))}
128
+ </>
129
+ ))}
130
+ </>
131
+ );
132
+ }
@@ -0,0 +1,49 @@
1
+ import styled from "styled-components";
2
+
3
+ export const Header = styled.div`
4
+ display: flex;
5
+ height: 35px;
6
+ width: 100%;
7
+ border-radius: 5px 5px 0px 0px;
8
+ background: #f0f0f0;
9
+ position: sticky;
10
+ top: 0;
11
+ z-index: 10;
12
+ `;
13
+
14
+ export const Column = styled.div`
15
+ display: flex;
16
+ align-items: center;
17
+ height: 35px;
18
+ width: ${({ width }) => `${width}px`};
19
+ padding: 10px 15px;
20
+ font-family: Roboto;
21
+ font-size: 12px;
22
+ color: ${({ isHeader }) => (isHeader ? "#262626" : "#707070")};
23
+ font-weight: ${({ isHeader }) => (isHeader ? "600" : "500")};
24
+ white-space: nowrap;
25
+ text-overflow: ellipsis;
26
+ .flex {
27
+ display: flex;
28
+ }
29
+ .material-icons.small {
30
+ font-size: 18px;
31
+ color: #b3b3b3;
32
+ }
33
+ .center {
34
+ margin: auto;
35
+ }
36
+ &:nth-child(2) {
37
+ overflow: hidden;
38
+ }
39
+ `;
40
+
41
+ export const Rows = styled.div`
42
+ display: flex;
43
+ background: ${({ index }) => (index % 2 === 0 ? "#FFFFFF" : "#FAFAFA")};
44
+ overflow-y: auto;
45
+ &:hover {
46
+ cursor: pointer;
47
+ background: #d4d1d7;
48
+ }
49
+ `;
@@ -0,0 +1,27 @@
1
+ export const servicesCodeIcon = {
2
+ datasheet: (
3
+ <span key="datasheet" className="material-icons small">
4
+ &#xf8ee;
5
+ </span>
6
+ ),
7
+ description: (
8
+ <span key="description" className="material-icons small">
9
+ &#xe873;
10
+ </span>
11
+ ),
12
+ image: (
13
+ <span key="image" className="material-icons small">
14
+ &#xe3f4;
15
+ </span>
16
+ ),
17
+ translate: (
18
+ <span key="translate" className="material-icons small">
19
+ &#xe8e2;
20
+ </span>
21
+ ),
22
+ build: (
23
+ <span key="build" className="material-icons small">
24
+ &#xe1bd;
25
+ </span>
26
+ ),
27
+ };
@@ -43,3 +43,27 @@
43
43
  src: url("../assets/fonts/raleway/Raleway-Black.ttf");
44
44
  font-weight: 900;
45
45
  }
46
+
47
+ @font-face {
48
+ font-family: "RobotoMedium";
49
+ src: url("../assets/fonts/Roboto/Roboto-Medium.ttf");
50
+ font-weight: 500;
51
+ }
52
+
53
+ @font-face {
54
+ font-family: "RobotoRegular";
55
+ src: url("../assets/fonts/Roboto/Roboto-Regular.ttf");
56
+ font-weight: 400;
57
+ }
58
+
59
+ @font-face {
60
+ font-family: "Roboto";
61
+ src: url("../assets/fonts/Roboto/Roboto-Regular.ttf");
62
+ font-weight: 400;
63
+ }
64
+
65
+ .prueba {
66
+ color: #9e3e26;
67
+ color: #b42983;
68
+ color: #e7e7e7;
69
+ }