imbric-theme 0.3.8 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- package/atoms/LinkItem/LinkItem.js +1 -1
- package/atoms/Modal/Modal.js +1 -1
- package/atoms/Modal/Modal.module.css +8 -0
- package/hook/useTable.js +54 -45
- package/layout/DynamicTable/DynamicTable.js +13 -3
- package/layout/DynamicTable/DynamicTable.stories.js +2 -0
- package/layout/Navbar/Navbar.js +74 -7
- package/layout/Navbar/Navbar.module.css +5 -0
- package/layout/Navbar/constants.js +35 -0
- package/molecules/ColumnTable/ColumnTable.js +44 -27
- package/molecules/ColumnTable/ColumnTable.module.css +2 -0
- package/molecules/ColumnTable/constants.js +6 -0
- package/molecules/DatePicker/DatePicker.js +8 -4
- package/molecules/DynamicSelect/DynamicSelect.js +1 -2
- package/molecules/DynamicSelect/DynamicSelect.stories.js +1 -1
- package/molecules/FooterTable/FooterTable.js +36 -9
- package/molecules/FooterTable/FooterTable.module.css +5 -5
- package/molecules/FooterTable/constants.js +9 -1
- package/molecules/RowTable/RowTable.js +81 -16
- package/molecules/RowTable/constants.js +43 -5
- package/package.json +1 -1
@@ -10,7 +10,7 @@ import Paragraph from '../Paragraph'
|
|
10
10
|
export const LinkItem = ({ children, size, color, getStyles, isHref }) => {
|
11
11
|
return (
|
12
12
|
<Link href={isHref} passHref>
|
13
|
-
<a className={getStyles('link', ['color'])}>
|
13
|
+
<a target="_blank" className={getStyles('link', ['color'])}>
|
14
14
|
<Paragraph size={size} color={color} weight="semibold" isInline>
|
15
15
|
{children}
|
16
16
|
</Paragraph>
|
package/atoms/Modal/Modal.js
CHANGED
@@ -57,11 +57,19 @@
|
|
57
57
|
max-width: 465px;
|
58
58
|
height: auto;
|
59
59
|
border-radius: var(--border-radius-sm);
|
60
|
+
/* max-height: 100%;
|
61
|
+
overflow: auto; */
|
60
62
|
}
|
61
63
|
|
62
64
|
.heading {
|
63
65
|
flex-direction: row-reverse;
|
64
66
|
}
|
67
|
+
|
68
|
+
.container {
|
69
|
+
max-height: 600px;
|
70
|
+
overflow: auto;
|
71
|
+
min-width: 100%;
|
72
|
+
}
|
65
73
|
}
|
66
74
|
|
67
75
|
@keyframes fadeInModal {
|
package/hook/useTable.js
CHANGED
@@ -1,45 +1,54 @@
|
|
1
|
-
import { useState, useEffect } from
|
2
|
-
|
3
|
-
const calculateRange = (data, rowsPerPage) => {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
}
|
20
|
-
|
21
|
-
const sliceData = (data, page, rowsPerPage) => {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
}
|
29
|
-
|
30
|
-
const
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
1
|
+
import { useState, useEffect } from 'react'
|
2
|
+
|
3
|
+
const calculateRange = (dataTotalQueryCount, data, rowsPerPage) => {
|
4
|
+
const range = []
|
5
|
+
if (!data) {
|
6
|
+
var num = Math.ceil(1)
|
7
|
+
} else {
|
8
|
+
// num = Math.ceil(data.length / rowsPerPage)
|
9
|
+
num = Math.ceil(dataTotalQueryCount / rowsPerPage)
|
10
|
+
}
|
11
|
+
|
12
|
+
// const num = Math.ceil(data.length / rowsPerPage);
|
13
|
+
|
14
|
+
// let i = 1;
|
15
|
+
for (let i = 1; i <= num; i++) {
|
16
|
+
range.push(i)
|
17
|
+
}
|
18
|
+
return range
|
19
|
+
}
|
20
|
+
|
21
|
+
// const sliceData = (data, page, rowsPerPage) => {
|
22
|
+
// if (!data) {
|
23
|
+
// return (data = [])
|
24
|
+
// } else {
|
25
|
+
// // return data.slice((page - 1) * rowsPerPage, page * rowsPerPage)
|
26
|
+
// return data
|
27
|
+
// }
|
28
|
+
// }
|
29
|
+
|
30
|
+
const sliceData = (data) => {
|
31
|
+
if (!data) {
|
32
|
+
return (data = [])
|
33
|
+
} else {
|
34
|
+
// return data.slice((page - 1) * rowsPerPage, page * rowsPerPage)
|
35
|
+
return data
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
const useTable = (dataTotalQueryCount, data, page, rowsPerPage) => {
|
40
|
+
const [tableRange, setTableRange] = useState([])
|
41
|
+
const [slice, setSlice] = useState([])
|
42
|
+
|
43
|
+
useEffect(() => {
|
44
|
+
const range = calculateRange(dataTotalQueryCount, data, rowsPerPage)
|
45
|
+
setTableRange([...range])
|
46
|
+
|
47
|
+
const slice = sliceData(data, page, rowsPerPage)
|
48
|
+
setSlice([...slice])
|
49
|
+
}, [dataTotalQueryCount, data, setTableRange, page, setSlice, rowsPerPage])
|
50
|
+
|
51
|
+
return { slice, range: tableRange }
|
52
|
+
}
|
53
|
+
|
54
|
+
export default useTable
|
@@ -16,7 +16,7 @@ import LoadingError from '../../molecules/LoadingError'
|
|
16
16
|
// import useStateDate from '../../hook/useStateDate';
|
17
17
|
|
18
18
|
|
19
|
-
export const DynamicTable = ({ getStyles, optionsData, opColumns, opAddColumns, isLayoutDate, isViewRange, isViewAddColumn, isViewDownloadDoc, handleAddColumn, handleSelectRange, handleDownloadExcel }) => {
|
19
|
+
export const DynamicTable = ({ getStyles, optionsData, opColumns, opAddColumns, isLayoutDate, isViewRange, isViewAddColumn, isViewDownloadDoc, handleAddColumn, handleSelectRange, handleDownloadExcel, labelDinamicSelect, placeholderDinamicSelect, labelSinceDateRange, labelTillDateRange }) => {
|
20
20
|
|
21
21
|
const [tableData, setTableData] = useState(optionsData);
|
22
22
|
const [columnsData, setColumnsData] = useState(opColumns);
|
@@ -94,6 +94,8 @@ export const DynamicTable = ({ getStyles, optionsData, opColumns, opAddColumns,
|
|
94
94
|
<DatePicker
|
95
95
|
isLayoutDate={isLayoutDate}
|
96
96
|
onChangeRange={handleSelectRange}
|
97
|
+
sinceDateRange={labelSinceDateRange}
|
98
|
+
tillDateRange={labelTillDateRange}
|
97
99
|
/>
|
98
100
|
</div>
|
99
101
|
) : null}
|
@@ -102,13 +104,13 @@ export const DynamicTable = ({ getStyles, optionsData, opColumns, opAddColumns,
|
|
102
104
|
|
103
105
|
{isViewAddColumn ? (
|
104
106
|
<div className={getStyles('opFunctionBox3')}>
|
105
|
-
<Label>
|
107
|
+
<Label>{labelDinamicSelect}</Label>
|
106
108
|
<DynamicSelect
|
107
109
|
isMulti
|
108
110
|
isInline
|
109
111
|
onChange={handleAddColumn}
|
110
112
|
optionsSelect={addColumsData}
|
111
|
-
placeholder=
|
113
|
+
placeholder={placeholderDinamicSelect}
|
112
114
|
/>
|
113
115
|
</div>
|
114
116
|
) : null}
|
@@ -156,6 +158,10 @@ DynamicTable.propTypes = {
|
|
156
158
|
isLayoutDate: PropTypes.string,
|
157
159
|
handleSelectRange: PropTypes.func,
|
158
160
|
handleDownloadExcel: PropTypes.func,
|
161
|
+
labelDinamicSelect: PropTypes.string,
|
162
|
+
placeholderDinamicSelect: PropTypes.string,
|
163
|
+
labelSinceDateRange: PropTypes.string,
|
164
|
+
labelTillDateRange: PropTypes.string,
|
159
165
|
}
|
160
166
|
|
161
167
|
DynamicTable.defaultProps = {
|
@@ -167,6 +173,10 @@ DynamicTable.defaultProps = {
|
|
167
173
|
isLayoutDate: 'Calendar',
|
168
174
|
handleSelectRange: () => { },
|
169
175
|
handleDownloadExcel: () => { },
|
176
|
+
labelDinamicSelect: 'Mostrar u ocultar columnas',
|
177
|
+
placeholderDinamicSelect: 'Seleccionar columnas',
|
178
|
+
labelSinceDateRange: 'Desde',
|
179
|
+
labelTillDateRange: 'Hasta',
|
170
180
|
}
|
171
181
|
|
172
182
|
export default withStyles(styles)(DynamicTable)
|
@@ -27,6 +27,8 @@ export default {
|
|
27
27
|
isViewRange: true,
|
28
28
|
isViewAddColumn: true,
|
29
29
|
isViewDownloadDoc: true,
|
30
|
+
labelDinamicSelect: 'Mostrar u ocultar columnas',
|
31
|
+
placeholderDinamicSelect: 'Seleccionar columnas',
|
30
32
|
},
|
31
33
|
argTypes: {
|
32
34
|
// types: getOptionsArgTypes(options.types),
|
package/layout/Navbar/Navbar.js
CHANGED
@@ -2,11 +2,32 @@ import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
3
3
|
import styles from './Navbar.module.css'
|
4
4
|
import withStyles from '../../hocs/withStyles'
|
5
|
+
import { useRouter } from "next/router";
|
6
|
+
import Link from 'next/link'
|
7
|
+
import DynamicSelect from '../../molecules/DynamicSelect'
|
5
8
|
|
6
9
|
import Heading from '../../atoms/Heading/Heading'
|
7
10
|
import Tabs from '../../molecules/Tabs/Tabs'
|
11
|
+
import Icon from '../../atoms/Icon'
|
12
|
+
import { options } from './constants'
|
13
|
+
|
14
|
+
export const Navbar = ({ getStyles, viewTabsNav, viewOptionsNav, children, linkLogout, defaultValueLanguage, optionsSelectLanguage, handleChangeLanguage }) => {
|
15
|
+
|
16
|
+
|
17
|
+
const router = useRouter();
|
18
|
+
|
19
|
+
const handleClick = (e, path) => {
|
20
|
+
|
21
|
+
console.log("I clicked on the About Page" + path);
|
22
|
+
|
23
|
+
router.push({
|
24
|
+
pathname: path,
|
25
|
+
})
|
26
|
+
|
27
|
+
|
28
|
+
};
|
29
|
+
|
8
30
|
|
9
|
-
export const Navbar = ({ getStyles, viewTabsNav, viewOptionsNav, children, linkLogout }) => {
|
10
31
|
return (
|
11
32
|
<>
|
12
33
|
<header className={getStyles('navbar')}>
|
@@ -52,16 +73,61 @@ export const Navbar = ({ getStyles, viewTabsNav, viewOptionsNav, children, linkL
|
|
52
73
|
/>
|
53
74
|
|
54
75
|
|
55
|
-
{/* <div className={getStyles('navbar__title', 'navbar__item')}>Taksee</div> */}
|
56
|
-
{/* <div className={getStyles('navbar__item')}>Legal</div>
|
57
|
-
<div className={getStyles('navbar__item')}>User Guide</div> */}
|
58
|
-
|
59
76
|
{viewOptionsNav ? (
|
60
|
-
<div
|
61
|
-
|
77
|
+
<div className={getStyles('navbar__actions')}>
|
78
|
+
{/* <div className={getStyles('navbar__item')}>Legal</div>
|
79
|
+
<div className={getStyles('navbar__item')}>User Guide</div> */}
|
80
|
+
|
81
|
+
{options.map((item, index) => (
|
82
|
+
<Icon
|
83
|
+
key={index}
|
84
|
+
size='lg'
|
85
|
+
name={item.icon}
|
86
|
+
color='highlight'
|
87
|
+
background='transparent'
|
88
|
+
onClick={(e) => handleClick(e, item.href)}
|
89
|
+
/>
|
90
|
+
))}
|
91
|
+
|
92
|
+
<DynamicSelect
|
93
|
+
isClearable={false}
|
94
|
+
// defaultValue={{
|
95
|
+
// label: 'ES',
|
96
|
+
// value: 'es'
|
97
|
+
// }}
|
98
|
+
defaultValue={defaultValueLanguage}
|
99
|
+
onChange={handleChangeLanguage}
|
100
|
+
optionsSelect={optionsSelectLanguage}
|
101
|
+
// optionsSelect={[
|
102
|
+
// {
|
103
|
+
// label: 'ES',
|
104
|
+
// value: 'es'
|
105
|
+
// },
|
106
|
+
// {
|
107
|
+
// label: 'EN',
|
108
|
+
// value: 'en'
|
109
|
+
// }
|
110
|
+
// ]}
|
111
|
+
/>
|
112
|
+
|
113
|
+
<Icon
|
114
|
+
size='lg'
|
115
|
+
name='logout'
|
116
|
+
color='highlight'
|
117
|
+
background='transparent'
|
118
|
+
onClick={linkLogout}
|
119
|
+
/>
|
120
|
+
|
62
121
|
</div>
|
122
|
+
|
63
123
|
) : null}
|
64
124
|
|
125
|
+
{/* {viewOptionsNav ? (
|
126
|
+
<div onClick={linkLogout} className={getStyles('navbar__item')}>
|
127
|
+
Logout
|
128
|
+
</div>
|
129
|
+
) : null} */}
|
130
|
+
|
65
131
|
|
66
132
|
</header>
|
67
133
|
|
@@ -76,6 +142,7 @@ Navbar.propTypes = {
|
|
76
142
|
viewTabsNav: PropTypes.bool,
|
77
143
|
viewOptionsNav: PropTypes.bool,
|
78
144
|
linkLogout: PropTypes.func,
|
145
|
+
handleChange: PropTypes.func,
|
79
146
|
}
|
80
147
|
|
81
148
|
Navbar.defaultProps = {
|
@@ -0,0 +1,35 @@
|
|
1
|
+
export const options = [
|
2
|
+
{
|
3
|
+
active: false,
|
4
|
+
href: '#',
|
5
|
+
icon: 'legal',
|
6
|
+
text: 'Legal',
|
7
|
+
view: true,
|
8
|
+
viewSubMenu: true,
|
9
|
+
},
|
10
|
+
{
|
11
|
+
active: false,
|
12
|
+
href: '/home',
|
13
|
+
icon: 'info',
|
14
|
+
text: 'User Guide',
|
15
|
+
view: true,
|
16
|
+
viewSubMenu: false,
|
17
|
+
},
|
18
|
+
{
|
19
|
+
active: false,
|
20
|
+
href: '/home',
|
21
|
+
icon: 'profile',
|
22
|
+
text: 'My profile',
|
23
|
+
view: true,
|
24
|
+
viewSubMenu: false,
|
25
|
+
},
|
26
|
+
// {
|
27
|
+
// active: false,
|
28
|
+
// href: '/home',
|
29
|
+
// icon: 'logout',
|
30
|
+
// text: 'Salir',
|
31
|
+
// view: true,
|
32
|
+
// viewSubMenu: false,
|
33
|
+
// },
|
34
|
+
|
35
|
+
]
|
@@ -7,16 +7,20 @@ import withStyles from '../../hocs/withStyles'
|
|
7
7
|
import Paragraph from '../../atoms/Paragraph'
|
8
8
|
import Input from '../../atoms/Input'
|
9
9
|
import Icon from '../../atoms/Icon'
|
10
|
+
import DynamicSelect from '../../molecules/DynamicSelect'
|
10
11
|
import { Horizontal, Vertical } from '../../layout/Spacer/components'
|
11
12
|
|
12
13
|
|
13
|
-
export const ColumnTable = ({ getStyles, handleSorting, columnUppercase, onChangeInput, columnsData }) => {
|
14
|
+
export const ColumnTable = ({ getStyles, handleSorting, columnUppercase, onChangeInput, onChangeSelect, columnsData, opSelect }) => {
|
14
15
|
|
15
16
|
const [sortable, setSortable] = useState(true);
|
16
17
|
const [accessor, setAccessor] = useState("");
|
17
18
|
const [sortField, setSortField] = useState("");
|
18
19
|
const [order, setOrder] = useState("asc");
|
19
20
|
|
21
|
+
// const [optionsSelect, setOptionsSelect] = useState(opSelect);
|
22
|
+
|
23
|
+
|
20
24
|
const handleSortingChange = (accessor) => {
|
21
25
|
const sortOrder =
|
22
26
|
accessor === sortField && order === "asc" ? "desc" : "asc";
|
@@ -63,24 +67,24 @@ export const ColumnTable = ({ getStyles, handleSorting, columnUppercase, onChang
|
|
63
67
|
|
64
68
|
{item.sortable ?
|
65
69
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
70
|
+
cl === "default" ?
|
71
|
+
<Icon
|
72
|
+
name="angleUpDown"
|
73
|
+
size="xs"
|
74
|
+
/>
|
75
|
+
: cl === "" ? null
|
76
|
+
|
77
|
+
: cl === "angleDown"
|
78
|
+
? <Icon
|
79
|
+
name="angleDown"
|
80
|
+
size="xs"
|
81
|
+
/>
|
82
|
+
|
83
|
+
: <Icon
|
84
|
+
name="angleUp"
|
85
|
+
size="xs"
|
86
|
+
/>
|
87
|
+
: null
|
84
88
|
}
|
85
89
|
</span>
|
86
90
|
|
@@ -89,14 +93,25 @@ export const ColumnTable = ({ getStyles, handleSorting, columnUppercase, onChang
|
|
89
93
|
|
90
94
|
{item.viewIsFilter ? (
|
91
95
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
96
|
+
item.typeFilter === 'select' ?
|
97
|
+
<DynamicSelect
|
98
|
+
isInline
|
99
|
+
onChange={onChangeSelect}
|
100
|
+
optionsSelect={opSelect}
|
101
|
+
placeholder={item.placeholder}
|
102
|
+
/>
|
103
|
+
:
|
104
|
+
<Input
|
105
|
+
isInputFilter
|
106
|
+
id={item.idInput}
|
107
|
+
type={item.typeFilter}
|
108
|
+
name={item.nameInput}
|
109
|
+
onChange={onChangeInput}
|
110
|
+
placeholder={item.placeholder}
|
111
|
+
/>
|
112
|
+
)
|
113
|
+
|
114
|
+
: null
|
100
115
|
}
|
101
116
|
|
102
117
|
</th>
|
@@ -116,6 +131,7 @@ ColumnTable.propTypes = {
|
|
116
131
|
getStyles: PropTypes.func.isRequired,
|
117
132
|
columnUppercase: PropTypes.bool,
|
118
133
|
onChangeInput: PropTypes.func,
|
134
|
+
onChangeSelect: PropTypes.func,
|
119
135
|
}
|
120
136
|
|
121
137
|
ColumnTable.defaultProps = {
|
@@ -123,6 +139,7 @@ ColumnTable.defaultProps = {
|
|
123
139
|
handleSorting: () => { },
|
124
140
|
columnUppercase: false,
|
125
141
|
onChangeInput: () => { },
|
142
|
+
onChangeSelect: () => { },
|
126
143
|
}
|
127
144
|
|
128
145
|
export default withStyles(styles)(ColumnTable)
|
@@ -33,7 +33,7 @@ import {
|
|
33
33
|
|
34
34
|
|
35
35
|
|
36
|
-
export const DatePicker = ({ getStyles, isLayoutDate, onChangeRange }) => {
|
36
|
+
export const DatePicker = ({ getStyles, isLayoutDate, onChangeRange, sinceDateRange, tillDateRange }) => {
|
37
37
|
|
38
38
|
const [isShowCalendar, setShowCalendar] = useState(false);
|
39
39
|
|
@@ -96,7 +96,7 @@ export const DatePicker = ({ getStyles, isLayoutDate, onChangeRange }) => {
|
|
96
96
|
!isShowCalendar ?
|
97
97
|
<div className={getStyles('date-picker-input')}>
|
98
98
|
<div>
|
99
|
-
<Label>
|
99
|
+
<Label>{sinceDateRange}</Label>
|
100
100
|
<Input
|
101
101
|
isInline
|
102
102
|
id="startDate"
|
@@ -108,7 +108,7 @@ export const DatePicker = ({ getStyles, isLayoutDate, onChangeRange }) => {
|
|
108
108
|
</div>
|
109
109
|
|
110
110
|
<div>
|
111
|
-
<Label>
|
111
|
+
<Label>{tillDateRange}</Label>
|
112
112
|
<Input
|
113
113
|
isInline
|
114
114
|
id="endDate"
|
@@ -224,13 +224,17 @@ export const DatePicker = ({ getStyles, isLayoutDate, onChangeRange }) => {
|
|
224
224
|
DatePicker.propTypes = {
|
225
225
|
getStyles: PropTypes.func.isRequired,
|
226
226
|
isLayoutDate: PropTypes.oneOf(options.typeLayoutDate),
|
227
|
-
onChangeRange: PropTypes.func
|
227
|
+
onChangeRange: PropTypes.func,
|
228
|
+
sinceDateRange: PropTypes.string,
|
229
|
+
tillDateRange: PropTypes.string,
|
228
230
|
}
|
229
231
|
|
230
232
|
DatePicker.defaultProps = {
|
231
233
|
getStyles: () => { },
|
232
234
|
isLayoutDate: 'Calendar',
|
233
235
|
onChangeRange: () => { },
|
236
|
+
sinceDateRange: 'Desde',
|
237
|
+
tillDateRange: 'Hasta',
|
234
238
|
}
|
235
239
|
|
236
240
|
export default withStyles(styles)(DatePicker)
|
@@ -89,7 +89,7 @@ export const DynamicSelect = ({ getStyles, optionsSelect, defaultValue, placehol
|
|
89
89
|
|
90
90
|
DynamicSelect.propTypes = {
|
91
91
|
getStyles: PropTypes.func.isRequired,
|
92
|
-
defaultValue: PropTypes.
|
92
|
+
defaultValue: PropTypes.object,
|
93
93
|
placeholder: PropTypes.string,
|
94
94
|
isMulti: PropTypes.bool,
|
95
95
|
isClearable: PropTypes.bool,
|
@@ -103,7 +103,6 @@ DynamicSelect.propTypes = {
|
|
103
103
|
|
104
104
|
DynamicSelect.defaultProps = {
|
105
105
|
getStyles: () => { },
|
106
|
-
defaultValue: '',
|
107
106
|
placeholder: 'seleccionar',
|
108
107
|
isMulti: false,
|
109
108
|
isClearable: true,
|
@@ -4,30 +4,51 @@ import PropTypes from 'prop-types'
|
|
4
4
|
import styles from './FooterTable.module.css'
|
5
5
|
import { options } from './constants'
|
6
6
|
import withStyles from '../../hocs/withStyles'
|
7
|
+
import DynamicSelect from '../../molecules/DynamicSelect'
|
7
8
|
|
8
|
-
|
9
|
+
|
10
|
+
export const FooterTable = ({ getStyles, range, setPage, setDataPage, page, slice, placeholderDinamicSelect, handleResultsForPage }) => {
|
9
11
|
useEffect(() => {
|
10
12
|
if (slice.length < 1 && page !== 1) {
|
11
13
|
setPage(page - 1);
|
12
14
|
}
|
13
15
|
}, [slice, page, setPage]);
|
14
16
|
|
17
|
+
|
15
18
|
return (
|
16
19
|
<div className={getStyles('footer-table')}>
|
17
20
|
|
18
21
|
<div className={styles.tableFooter}>
|
19
22
|
{range.map((el, index) => (
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
}
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
|
24
|
+
<>
|
25
|
+
<button
|
26
|
+
key={index}
|
27
|
+
className={`${styles.button} ${page === el ? styles.activeButton : styles.inactiveButton
|
28
|
+
}`}
|
29
|
+
onClick={() => { setPage(el); setDataPage(el) }}
|
30
|
+
|
31
|
+
onChange={item => { handleSelectRange(item); onChangeRange(item); }}
|
32
|
+
|
33
|
+
>
|
34
|
+
{el}
|
35
|
+
</button>
|
36
|
+
|
37
|
+
|
38
|
+
</>
|
39
|
+
|
28
40
|
))}
|
29
41
|
</div>
|
30
42
|
|
43
|
+
<DynamicSelect
|
44
|
+
isInline
|
45
|
+
onChange={handleResultsForPage}
|
46
|
+
optionsSelect={options.opResultsForPage}
|
47
|
+
placeholder={placeholderDinamicSelect}
|
48
|
+
isClearable={false}
|
49
|
+
defaultValue= { {value: 10, label: '10'} }
|
50
|
+
/>
|
51
|
+
|
31
52
|
</div>
|
32
53
|
|
33
54
|
|
@@ -37,11 +58,17 @@ export const FooterTable = ({ getStyles, range, setPage, page, slice }) => {
|
|
37
58
|
FooterTable.propTypes = {
|
38
59
|
// children: PropTypes.node.isRequired,
|
39
60
|
getStyles: PropTypes.func.isRequired,
|
61
|
+
setDataPage: PropTypes.func,
|
62
|
+
placeholderDinamicSelect: PropTypes.string,
|
63
|
+
handleResultsForPage: PropTypes.func
|
40
64
|
// type: PropTypes.oneOf(options.types),
|
41
65
|
}
|
42
66
|
|
43
67
|
FooterTable.defaultProps = {
|
44
68
|
getStyles: () => { },
|
69
|
+
setDataPage: () => { },
|
70
|
+
handleResultsForPage: () => { },
|
71
|
+
placeholderDinamicSelect: 'resultados por pagina'
|
45
72
|
}
|
46
73
|
|
47
74
|
export default withStyles(styles)(FooterTable)
|
@@ -4,14 +4,14 @@
|
|
4
4
|
|
5
5
|
.tableFooter {
|
6
6
|
background-color: #f1f1f1;
|
7
|
-
padding:
|
7
|
+
padding: 4px 0px;
|
8
8
|
width: 100%;
|
9
9
|
font-weight: 500;
|
10
10
|
text-align: left;
|
11
11
|
font-size: 16px;
|
12
12
|
color: #2c3e50;
|
13
|
-
border-bottom-left-radius:
|
14
|
-
border-bottom-right-radius:
|
13
|
+
border-bottom-left-radius: 5px;
|
14
|
+
border-bottom-right-radius: 0px;
|
15
15
|
display: flex;
|
16
16
|
align-items: center;
|
17
17
|
justify-content: center;
|
@@ -19,7 +19,7 @@
|
|
19
19
|
|
20
20
|
.button {
|
21
21
|
border: none;
|
22
|
-
padding:
|
22
|
+
padding: 6px 12px;
|
23
23
|
border-radius: 10px;
|
24
24
|
cursor: pointer;
|
25
25
|
margin-right: 4px;
|
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
.activeButton {
|
30
30
|
color: white;
|
31
|
-
background: #
|
31
|
+
background: #00A3FF;
|
32
32
|
}
|
33
33
|
|
34
34
|
.inactiveButton {
|
@@ -9,7 +9,17 @@ import Moment from 'react-moment'
|
|
9
9
|
import Icon from '../../atoms/Icon'
|
10
10
|
import { Horizontal, Vertical } from '../../layout/Spacer/components'
|
11
11
|
|
12
|
-
export const RowTable = ({ getStyles, slice, columnsData }) => {
|
12
|
+
export const RowTable = ({ getStyles, slice, columnsData, onClickActionEdit, onClickActionSendEmail, onClickActionDelete }) => {
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
// const handleEditStaff = (e, item) => {
|
18
|
+
// console.log(item)
|
19
|
+
// console.log(e)
|
20
|
+
// }
|
21
|
+
|
22
|
+
|
13
23
|
return (
|
14
24
|
<div className={getStyles('tbl-content')}>
|
15
25
|
<table className={getStyles('table')} cellPadding="0" cellSpacing="0" border="0">
|
@@ -22,28 +32,46 @@ export const RowTable = ({ getStyles, slice, columnsData }) => {
|
|
22
32
|
(
|
23
33
|
|
24
34
|
|
25
|
-
itemTd.subAccessor === 'action'
|
35
|
+
itemTd.subAccessor === 'action'
|
36
|
+
|
37
|
+
?
|
26
38
|
|
27
39
|
<td className={getStyles('td')} key={[itemTd.accessor]}>
|
28
40
|
|
29
41
|
<Icon
|
30
42
|
background="base"
|
31
43
|
name="settings"
|
32
|
-
onClick={
|
44
|
+
onClick={(e) => { onClickActionEdit(e, item) }}
|
45
|
+
/>
|
46
|
+
<Horizontal size="xs" />
|
47
|
+
<Icon
|
48
|
+
background="base"
|
49
|
+
name="arrowUp"
|
50
|
+
// onClick={(e) => onClickEdit(e, item)}
|
51
|
+
onClick={e => { onClickActionSendEmail(e, item) }}
|
33
52
|
/>
|
34
53
|
<Horizontal size="xs" />
|
35
54
|
<Icon
|
36
55
|
background="base"
|
37
56
|
name="trash"
|
38
|
-
onClick={
|
57
|
+
// onClick={(e) => onClickEdit(e, item)}
|
58
|
+
onClick={e => { onClickActionDelete(e, item) }}
|
39
59
|
/>
|
40
|
-
</td>
|
60
|
+
</td>
|
61
|
+
|
62
|
+
:
|
63
|
+
|
64
|
+
itemTd.subAccessor !== ''
|
65
|
+
|
66
|
+
?
|
41
67
|
|
42
|
-
|
68
|
+
<td className={getStyles('td')} key={[itemTd.accessor]}>{item[itemTd.accessor][itemTd.subAccessor]}</td>
|
43
69
|
|
44
|
-
|
70
|
+
:
|
45
71
|
|
46
|
-
itemTd.typeFilter === 'date'
|
72
|
+
itemTd.typeFilter === 'date'
|
73
|
+
|
74
|
+
?
|
47
75
|
|
48
76
|
<td className={getStyles('td')} key={[itemTd.accessor]}>
|
49
77
|
<Moment format="DD/MM/YYYY hh:mm:ss">
|
@@ -51,19 +79,52 @@ export const RowTable = ({ getStyles, slice, columnsData }) => {
|
|
51
79
|
</Moment>
|
52
80
|
</td>
|
53
81
|
|
54
|
-
:
|
82
|
+
:
|
55
83
|
|
56
|
-
|
84
|
+
itemTd.typeFilter === 'select'
|
57
85
|
|
58
|
-
|
59
|
-
|
60
|
-
|
86
|
+
?
|
87
|
+
|
88
|
+
itemTd.optionsSelect.map((itemSelect) => (
|
89
|
+
|
90
|
+
|
91
|
+
item[itemTd.accessor] === itemSelect.value ?
|
92
|
+
|
93
|
+
<td className={getStyles('td')} key={[itemTd.accessor]}>
|
94
|
+
{itemSelect.label}
|
95
|
+
</td>
|
96
|
+
|
97
|
+
:
|
98
|
+
|
99
|
+
null
|
100
|
+
))
|
61
101
|
|
62
|
-
:
|
102
|
+
:
|
103
|
+
|
104
|
+
itemTd.typeFilter === 'number'
|
105
|
+
|
106
|
+
?
|
107
|
+
|
108
|
+
itemTd.subTypeFilter
|
109
|
+
|
110
|
+
?
|
111
|
+
|
112
|
+
itemTd.characterExtra === 'km'
|
113
|
+
?
|
114
|
+
<td className={getStyles('td')} key={[itemTd.accessor]}>{(item[itemTd.accessor]/1000).toString().replace(/\./g, ',')} {itemTd.characterExtra}</td>
|
115
|
+
:
|
116
|
+
<td className={getStyles('td')} key={[itemTd.accessor]}>{item[itemTd.accessor].toFixed(2).toString().replace(/\./g, ',')} {itemTd.characterExtra}</td>
|
117
|
+
:
|
118
|
+
<td className={getStyles('td')} key={[itemTd.accessor]}>{item[itemTd.accessor]}</td>
|
63
119
|
|
64
|
-
<td className={getStyles('td')} key={[itemTd.accessor]}>{item[itemTd.accessor].toString().replace(/\./g, ',').slice(0, 5)} €</td>
|
65
120
|
:
|
66
|
-
|
121
|
+
|
122
|
+
itemTd.subTypeFilter
|
123
|
+
|
124
|
+
?
|
125
|
+
<td className={getStyles('td')} key={[itemTd.accessor]}>{item[itemTd.accessor].toString().replace(/\./g, ',').slice(0, 5)} {itemTd.characterExtra}</td>
|
126
|
+
:
|
127
|
+
<td className={getStyles('td')} key={[itemTd.accessor]}>{item[itemTd.accessor]}</td>
|
67
128
|
|
68
129
|
) : null
|
69
130
|
))}
|
@@ -79,10 +140,14 @@ export const RowTable = ({ getStyles, slice, columnsData }) => {
|
|
79
140
|
RowTable.propTypes = {
|
80
141
|
getStyles: PropTypes.func.isRequired,
|
81
142
|
type: PropTypes.oneOf(options.types),
|
143
|
+
onClickActionEdit: PropTypes.func,
|
144
|
+
onClickActionSendEmail: PropTypes.func,
|
145
|
+
onClickActionDelete: PropTypes.func
|
82
146
|
}
|
83
147
|
|
84
148
|
RowTable.defaultProps = {
|
85
149
|
getStyles: () => { },
|
150
|
+
onClickActionEdit: () => { },
|
86
151
|
}
|
87
152
|
|
88
153
|
export default withStyles(styles)(RowTable)
|
@@ -1,3 +1,9 @@
|
|
1
|
+
export const optionsSelect = [
|
2
|
+
{ value: '', label: 'Todos' },
|
3
|
+
{ value: 1, label: 'Activo' },
|
4
|
+
{ value: -1, label: 'Dado de baja' }
|
5
|
+
]
|
6
|
+
|
1
7
|
export const options = {
|
2
8
|
|
3
9
|
bookings: [
|
@@ -5,7 +11,7 @@ export const options = {
|
|
5
11
|
id: 346248956,
|
6
12
|
idUser: 146280,
|
7
13
|
idAuthorization: 817457,
|
8
|
-
status:
|
14
|
+
status: 1,
|
9
15
|
origin: {
|
10
16
|
addressField: "Cines Embajadores, Glorieta Sta. María de la Cabeza, 5, 28045 Madrid",
|
11
17
|
lat: 40.40068,
|
@@ -21,6 +27,7 @@ export const options = {
|
|
21
27
|
paymentMethod: 50,
|
22
28
|
entryChannel: 15,
|
23
29
|
idSupplierFleet: 57,
|
30
|
+
distanceMeters: 22044,
|
24
31
|
idSupplier: 57,
|
25
32
|
distanceMeters: 10501,
|
26
33
|
durationMinutes: 0,
|
@@ -69,7 +76,7 @@ export const options = {
|
|
69
76
|
id: 346248955,
|
70
77
|
idUser: 146280,
|
71
78
|
idAuthorization: 817457,
|
72
|
-
status:
|
79
|
+
status: 1,
|
73
80
|
origin: {
|
74
81
|
addressField: "Estación de Chamartín, Madrid, España",
|
75
82
|
lat: 40.47237,
|
@@ -83,6 +90,7 @@ export const options = {
|
|
83
90
|
timeBookingStartRealTimestamp: 1653559749000,
|
84
91
|
asap: true,
|
85
92
|
paymentMethod: 50,
|
93
|
+
distanceMeters: 22044,
|
86
94
|
entryChannel: 15,
|
87
95
|
idSupplierFleet: 57,
|
88
96
|
idSupplier: 57,
|
@@ -133,7 +141,7 @@ export const options = {
|
|
133
141
|
id: 346248954,
|
134
142
|
idUser: 146280,
|
135
143
|
idAuthorization: 817457,
|
136
|
-
status:
|
144
|
+
status: -1,
|
137
145
|
origin: {
|
138
146
|
addressField: "Cines Embajadores, Glorieta Sta. María de la Cabeza, 5, 28045 Madrid",
|
139
147
|
lat: 40.40068,
|
@@ -159,6 +167,7 @@ export const options = {
|
|
159
167
|
idSupplierTaxi: "11",
|
160
168
|
idSupplierService: "15826",
|
161
169
|
cancelledWithCharge: false,
|
170
|
+
distanceMeters: 22044,
|
162
171
|
priceCustomer: "23.00000",
|
163
172
|
priceSupplier: "23.00000",
|
164
173
|
phoneNumberSupplier: "676800672",
|
@@ -204,7 +213,7 @@ export const options = {
|
|
204
213
|
title: 'Fecha',
|
205
214
|
viewIsFilter: true,
|
206
215
|
typeFilter: 'date',
|
207
|
-
subTypeFilter:
|
216
|
+
subTypeFilter: true,
|
208
217
|
idInput: 'fecha',
|
209
218
|
nameInput: 'Fecha',
|
210
219
|
placeholder: 'Fecha'
|
@@ -259,7 +268,36 @@ export const options = {
|
|
259
268
|
subTypeFilter: true,
|
260
269
|
idInput: 'precio',
|
261
270
|
nameInput: 'Precio',
|
262
|
-
placeholder: 'Precio'
|
271
|
+
placeholder: 'Precio',
|
272
|
+
characterExtra: '€'
|
273
|
+
},
|
274
|
+
{
|
275
|
+
accessor: 'distanceMeters',
|
276
|
+
subAccessor: '',
|
277
|
+
activeView: true,
|
278
|
+
idInput: 'distanceMeters',
|
279
|
+
nameInput: 'distanceMeters',
|
280
|
+
placeholder: 'Distancia (km)',
|
281
|
+
sortable: true,
|
282
|
+
subTypeFilter: false,
|
283
|
+
title: 'Distancia (km)',
|
284
|
+
typeFilter: 'number',
|
285
|
+
viewIsFilter: true,
|
286
|
+
characterExtra: 'km',
|
287
|
+
},
|
288
|
+
{
|
289
|
+
accessor: 'status',
|
290
|
+
subAccessor: '',
|
291
|
+
activeView: true,
|
292
|
+
idInput: 'status',
|
293
|
+
nameInput: 'Estado',
|
294
|
+
placeholder: 'Estado',
|
295
|
+
sortable: true,
|
296
|
+
subTypeFilter: false,
|
297
|
+
title: 'Estado',
|
298
|
+
typeFilter: 'select',
|
299
|
+
optionsSelect: optionsSelect,
|
300
|
+
viewIsFilter: true,
|
263
301
|
},
|
264
302
|
{
|
265
303
|
activeView: false,
|