ordering-ui-admin-external 1.43.64 → 1.43.66
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/_bundles/{ordering-ui-admin.59d6b5f2801dce338f86.js → ordering-ui-admin.d1d5d69bc1de8f732c90.js} +2 -2
- package/_modules/components/Messages/MessagesListing/index.js +1 -1
- package/_modules/components/Orders/AdminsSelector/index.js +40 -1
- package/_modules/components/Orders/AllInOne/DriversManager/index.js +1 -1
- package/_modules/components/Orders/AllInOne/index.js +4 -2
- package/_modules/components/Orders/BusinessesSelector/index.js +40 -1
- package/_modules/components/Orders/CountryFilter/index.js +36 -2
- package/_modules/components/Orders/CurrencyFilter/index.js +44 -5
- package/_modules/components/Orders/DeliveriesManager/index.js +5 -3
- package/_modules/components/Orders/DriverMapMarkerAndInfo/index.js +5 -2
- package/_modules/components/Orders/DriverMultiSelector/index.js +1 -0
- package/_modules/components/Orders/DriversGroupTypeSelector/index.js +44 -5
- package/_modules/components/Orders/DriversList/index.js +57 -3
- package/_modules/components/Orders/DriversList/styles.js +6 -5
- package/_modules/components/Orders/InterActOrderMarker/index.js +5 -2
- package/_modules/components/Orders/OrdersContentHeader/index.js +2 -0
- package/_modules/components/Orders/OrdersDashboardList/index.js +2 -1
- package/_modules/components/Orders/OrdersFilterGroup/index.js +2 -2
- package/_modules/components/Orders/OrdersHeaderFilterGroup/index.js +9 -22
- package/_modules/components/Orders/OrdersHeaderFilterGroup/styles.js +1 -1
- package/_modules/components/Orders/OrdersManager/index.js +6 -3
- package/_modules/components/Orders/PaymethodTypeSelector/index.js +40 -1
- package/_modules/components/Shared/CitySelector/index.js +35 -1
- package/_modules/contexts/FilterValuesContext/index.js +2 -2
- package/_modules/styles/MultiSelect/index.js +4 -2
- package/package.json +2 -2
- package/src/components/Messages/MessagesListing/index.js +1 -1
- package/src/components/Orders/AdminsSelector/index.js +37 -0
- package/src/components/Orders/AllInOne/DriversManager/index.js +1 -1
- package/src/components/Orders/AllInOne/index.js +4 -2
- package/src/components/Orders/BusinessesSelector/index.js +37 -0
- package/src/components/Orders/CountryFilter/index.js +37 -0
- package/src/components/Orders/CurrencyFilter/index.js +37 -0
- package/src/components/Orders/DeliveriesManager/index.js +4 -2
- package/src/components/Orders/DriverMapMarkerAndInfo/index.js +8 -2
- package/src/components/Orders/DriverMultiSelector/index.js +1 -0
- package/src/components/Orders/DriversGroupTypeSelector/index.js +37 -0
- package/src/components/Orders/DriversList/index.js +56 -3
- package/src/components/Orders/DriversList/styles.js +12 -1
- package/src/components/Orders/InterActOrderMarker/index.js +10 -2
- package/src/components/Orders/OrdersContentHeader/index.js +2 -0
- package/src/components/Orders/OrdersDashboardList/index.js +2 -1
- package/src/components/Orders/OrdersFilterGroup/index.js +2 -8
- package/src/components/Orders/OrdersHeaderFilterGroup/index.js +9 -20
- package/src/components/Orders/OrdersHeaderFilterGroup/styles.js +1 -1
- package/src/components/Orders/OrdersManager/index.js +6 -3
- package/src/components/Orders/PaymethodTypeSelector/index.js +37 -0
- package/src/components/Shared/CitySelector/index.js +37 -0
- package/src/contexts/FilterValuesContext/index.js +2 -2
- package/src/styles/MultiSelect/index.js +3 -1
- package/template/pages/AllInOne/index.js +4 -0
- package/template/pages/DeliveriesManager/index.js +4 -0
- package/template/pages/DriversList/index.js +1 -1
- package/template/pages/OrdersList/index.js +6 -0
- /package/_bundles/{ordering-ui-admin.59d6b5f2801dce338f86.js.LICENSE.txt → ordering-ui-admin.d1d5d69bc1de8f732c90.js.LICENSE.txt} +0 -0
|
@@ -12,6 +12,29 @@ export const CurrencyFilter = (props) => {
|
|
|
12
12
|
|
|
13
13
|
const [, t] = useLanguage()
|
|
14
14
|
const [searchValue, setSearchValue] = useState('')
|
|
15
|
+
const [pagination, setPagination] = useState({
|
|
16
|
+
currentPage: 1,
|
|
17
|
+
pageSize: 5,
|
|
18
|
+
totalItems: null,
|
|
19
|
+
totalPages: null
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const handleChangePage = (page) => {
|
|
23
|
+
setPagination({
|
|
24
|
+
...pagination,
|
|
25
|
+
currentPage: page
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const handleChangePageSize = (pageSize) => {
|
|
30
|
+
const expectedPage = Math.ceil(((pagination?.currentPage - 1) * pagination?.pageSize + 1) / pageSize)
|
|
31
|
+
setPagination({
|
|
32
|
+
...pagination,
|
|
33
|
+
currentPage: expectedPage,
|
|
34
|
+
pageSize,
|
|
35
|
+
totalPages: Math.ceil(currencyList?.length / pageSize)
|
|
36
|
+
})
|
|
37
|
+
}
|
|
15
38
|
|
|
16
39
|
const placeholder = (
|
|
17
40
|
<PlaceholderTitle>
|
|
@@ -40,6 +63,16 @@ export const CurrencyFilter = (props) => {
|
|
|
40
63
|
setCountryTypes(_countryList)
|
|
41
64
|
}, [currencyList, searchValue])
|
|
42
65
|
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (currencyList?.length) {
|
|
68
|
+
setPagination({
|
|
69
|
+
...pagination,
|
|
70
|
+
totalItems: currencyList?.length,
|
|
71
|
+
totalPages: Math.ceil(currencyList?.length / 10)
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
}, [currencyList])
|
|
75
|
+
|
|
43
76
|
return (
|
|
44
77
|
<MultiSelect
|
|
45
78
|
placeholder={placeholder}
|
|
@@ -52,6 +85,10 @@ export const CurrencyFilter = (props) => {
|
|
|
52
85
|
searchBarIsNotLazyLoad
|
|
53
86
|
searchValue={searchValue}
|
|
54
87
|
handleChangeSearch={(val) => setSearchValue(val)}
|
|
88
|
+
isHidePagecontrol
|
|
89
|
+
pagination={pagination}
|
|
90
|
+
handleChangePage={handleChangePage}
|
|
91
|
+
handleChangePageSize={handleChangePageSize}
|
|
55
92
|
/>
|
|
56
93
|
)
|
|
57
94
|
}
|
|
@@ -33,7 +33,8 @@ const DeliveriesManagerUI = (props) => {
|
|
|
33
33
|
timeStatus,
|
|
34
34
|
setTimeStatus,
|
|
35
35
|
isUseQuery,
|
|
36
|
-
adminsList
|
|
36
|
+
adminsList,
|
|
37
|
+
assignableDriverGroupList
|
|
37
38
|
} = props
|
|
38
39
|
|
|
39
40
|
const [, t] = useLanguage()
|
|
@@ -95,6 +96,7 @@ const DeliveriesManagerUI = (props) => {
|
|
|
95
96
|
setTimeStatus={setTimeStatus}
|
|
96
97
|
setSlaSettingTime={setSlaSettingTime}
|
|
97
98
|
adminsList={adminsList}
|
|
99
|
+
assignableDriverGroupList={assignableDriverGroupList}
|
|
98
100
|
/>
|
|
99
101
|
<OrdersContent>
|
|
100
102
|
<WrapItemView>
|
|
@@ -147,7 +149,7 @@ export const DeliveriesManager = (props) => {
|
|
|
147
149
|
...props,
|
|
148
150
|
isOnlyDelivery: true,
|
|
149
151
|
UIComponent: DeliveriesManagerUI,
|
|
150
|
-
driversPropsToFetch: ['id', 'name', 'lastname', 'location', 'enabled', 'available', 'busy', 'driver_groups', 'assigned_orders_count', 'last_order_assigned_at', 'last_location_at', 'cellphone', 'photo', 'qualification']
|
|
152
|
+
driversPropsToFetch: ['id', 'name', 'lastname', 'location', 'enabled', 'available', 'busy', 'driver_groups.name', 'driver_groups.id', 'assigned_orders_count', 'last_order_assigned_at', 'last_location_at', 'cellphone', 'photo', 'qualification']
|
|
151
153
|
}
|
|
152
154
|
return <OrdersManageController {...OrdersListControlProps} />
|
|
153
155
|
}
|
|
@@ -9,7 +9,13 @@ import {
|
|
|
9
9
|
TextContainer,
|
|
10
10
|
Text
|
|
11
11
|
} from './styles'
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
const DriverMapMarkerPropsAreEqual = (prevProps, nextProps) => {
|
|
14
|
+
return JSON.stringify(prevProps.driver) === JSON.stringify(nextProps.driver) &&
|
|
15
|
+
prevProps.timeStatus === nextProps.timeStatus
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const DriverMapMarkerAndInfo = React.memo((props) => {
|
|
13
19
|
const {
|
|
14
20
|
driver,
|
|
15
21
|
timeStatus
|
|
@@ -84,4 +90,4 @@ export const DriverMapMarkerAndInfo = (props) => {
|
|
|
84
90
|
</WrapperMapMarker>
|
|
85
91
|
</>
|
|
86
92
|
)
|
|
87
|
-
}
|
|
93
|
+
}, DriverMapMarkerPropsAreEqual)
|
|
@@ -15,6 +15,12 @@ export const DriversGroupTypeSelector = (props) => {
|
|
|
15
15
|
const [{ dictionary }] = useLanguage()
|
|
16
16
|
|
|
17
17
|
const [searchValue, setSearchValue] = useState('')
|
|
18
|
+
const [pagination, setPagination] = useState({
|
|
19
|
+
currentPage: 1,
|
|
20
|
+
pageSize: 5,
|
|
21
|
+
totalItems: null,
|
|
22
|
+
totalPages: null
|
|
23
|
+
})
|
|
18
24
|
|
|
19
25
|
const placeholder = (
|
|
20
26
|
<PlaceholderTitle>
|
|
@@ -24,6 +30,23 @@ export const DriversGroupTypeSelector = (props) => {
|
|
|
24
30
|
const [groupTypes, setGroupTypes] = useState([])
|
|
25
31
|
const groupTypesLoading = [{ value: 'default', content: <Option>{dictionary?.GROUP_LOADING ?? 'Group loading'}...</Option> }]
|
|
26
32
|
|
|
33
|
+
const handleChangePage = (page) => {
|
|
34
|
+
setPagination({
|
|
35
|
+
...pagination,
|
|
36
|
+
currentPage: page
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const handleChangePageSize = (pageSize) => {
|
|
41
|
+
const expectedPage = Math.ceil(((pagination?.currentPage - 1) * pagination?.pageSize + 1) / pageSize)
|
|
42
|
+
setPagination({
|
|
43
|
+
...pagination,
|
|
44
|
+
currentPage: expectedPage,
|
|
45
|
+
pageSize,
|
|
46
|
+
totalPages: Math.ceil(groupTypes?.length / pageSize)
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
27
50
|
useEffect(() => {
|
|
28
51
|
const _groupList = []
|
|
29
52
|
if (!driverGroupList.loading) {
|
|
@@ -45,6 +68,16 @@ export const DriversGroupTypeSelector = (props) => {
|
|
|
45
68
|
setGroupTypes(_groupList)
|
|
46
69
|
}, [driverGroupList, searchValue])
|
|
47
70
|
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (groupTypes?.length) {
|
|
73
|
+
setPagination({
|
|
74
|
+
...pagination,
|
|
75
|
+
totalItems: groupTypes?.length,
|
|
76
|
+
totalPages: Math.ceil(groupTypes?.length / 10)
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
}, [groupTypes])
|
|
80
|
+
|
|
48
81
|
return (
|
|
49
82
|
<>
|
|
50
83
|
{!driverGroupList.loading ? (
|
|
@@ -58,6 +91,10 @@ export const DriversGroupTypeSelector = (props) => {
|
|
|
58
91
|
searchBarIsNotLazyLoad
|
|
59
92
|
searchValue={searchValue}
|
|
60
93
|
handleChangeSearch={(val) => setSearchValue(val)}
|
|
94
|
+
isHidePagecontrol
|
|
95
|
+
pagination={pagination}
|
|
96
|
+
handleChangePage={handleChangePage}
|
|
97
|
+
handleChangePageSize={handleChangePageSize}
|
|
61
98
|
/>
|
|
62
99
|
) : (
|
|
63
100
|
<MultiSelect
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
2
|
import Skeleton from 'react-loading-skeleton'
|
|
3
3
|
import { getStarWidth } from '../../../utils'
|
|
4
4
|
import { useWindowSize } from '../../../hooks/useWindowSize'
|
|
@@ -7,8 +7,10 @@ import {
|
|
|
7
7
|
DriverCard,
|
|
8
8
|
WrapperImage,
|
|
9
9
|
DriverInfo,
|
|
10
|
+
PaginationWrapper
|
|
10
11
|
} from './styles'
|
|
11
12
|
import { Driver } from './Driver'
|
|
13
|
+
import { Pagination } from '../../Shared'
|
|
12
14
|
|
|
13
15
|
export const DriversList = (props) => {
|
|
14
16
|
const {
|
|
@@ -24,7 +26,13 @@ export const DriversList = (props) => {
|
|
|
24
26
|
} = props
|
|
25
27
|
|
|
26
28
|
const { width } = useWindowSize()
|
|
27
|
-
|
|
29
|
+
const [pagination, setPagination] = useState({
|
|
30
|
+
currentPage: 1,
|
|
31
|
+
pageSize: 10,
|
|
32
|
+
totalItems: null,
|
|
33
|
+
totalPages: null
|
|
34
|
+
})
|
|
35
|
+
const drivers = driversIsOnline ? onlineDrivers : offlineDrivers
|
|
28
36
|
const handleClickDriver = (e, driver) => {
|
|
29
37
|
const isInvalid = e.target.closest('.driver-orders')
|
|
30
38
|
if (isInvalid) return
|
|
@@ -40,6 +48,40 @@ export const DriversList = (props) => {
|
|
|
40
48
|
handleOpenDriverOrders(driver)
|
|
41
49
|
}
|
|
42
50
|
|
|
51
|
+
const filterFunction = (_, index) => {
|
|
52
|
+
const validation = pagination?.currentPage === 1
|
|
53
|
+
? index < (pagination.pageSize * pagination.currentPage)
|
|
54
|
+
: (index >= (pagination.pageSize * (pagination.currentPage - 1))) && (index < (pagination.pageSize * pagination.currentPage))
|
|
55
|
+
return validation
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const handleChangePage = (page) => {
|
|
59
|
+
setPagination({
|
|
60
|
+
...pagination,
|
|
61
|
+
currentPage: page
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const handleChangePageSize = (pageSize) => {
|
|
66
|
+
const expectedPage = Math.ceil(((pagination?.currentPage - 1) * pagination?.pageSize + 1) / pageSize)
|
|
67
|
+
setPagination({
|
|
68
|
+
...pagination,
|
|
69
|
+
currentPage: expectedPage,
|
|
70
|
+
pageSize,
|
|
71
|
+
totalPages: Math.ceil(drivers?.length / pageSize)
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (drivers?.length) {
|
|
77
|
+
setPagination({
|
|
78
|
+
...pagination,
|
|
79
|
+
totalItems: drivers?.length,
|
|
80
|
+
totalPages: Math.ceil(drivers?.length / 10)
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
}, [drivers])
|
|
84
|
+
|
|
43
85
|
return (
|
|
44
86
|
<DriversListContainer showCompressedInfo={showCompressedInfo}>
|
|
45
87
|
{loading ? (
|
|
@@ -64,7 +106,7 @@ export const DriversList = (props) => {
|
|
|
64
106
|
</>
|
|
65
107
|
) : (
|
|
66
108
|
<>
|
|
67
|
-
{(
|
|
109
|
+
{drivers.filter(filterFunction).map(driver => (
|
|
68
110
|
<Driver
|
|
69
111
|
key={driver?.id}
|
|
70
112
|
driver={driver}
|
|
@@ -78,6 +120,17 @@ export const DriversList = (props) => {
|
|
|
78
120
|
))}
|
|
79
121
|
</>
|
|
80
122
|
)}
|
|
123
|
+
{drivers?.length > 0 && (
|
|
124
|
+
<PaginationWrapper>
|
|
125
|
+
<Pagination
|
|
126
|
+
currentPage={pagination?.currentPage}
|
|
127
|
+
totalPages={pagination?.totalPages}
|
|
128
|
+
handleChangePage={handleChangePage}
|
|
129
|
+
handleChangePageSize={handleChangePageSize}
|
|
130
|
+
defaultPageSize={pagination?.pageSize}
|
|
131
|
+
/>
|
|
132
|
+
</PaginationWrapper>
|
|
133
|
+
)}
|
|
81
134
|
</DriversListContainer>
|
|
82
135
|
)
|
|
83
136
|
}
|
|
@@ -3,6 +3,7 @@ import styled, { css } from 'styled-components'
|
|
|
3
3
|
|
|
4
4
|
export const DriversListContainer = styled.div`
|
|
5
5
|
padding: 15px 0px;
|
|
6
|
+
position: relative;
|
|
6
7
|
@media (min-width: 992px) {
|
|
7
8
|
${({ showCompressedInfo }) => showCompressedInfo && css`
|
|
8
9
|
padding: 0px 0px;
|
|
@@ -25,7 +26,7 @@ export const DriverCard = styled.div`
|
|
|
25
26
|
&:hover {
|
|
26
27
|
background-color: ${props => props.theme.colors.lightPrimary};
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
|
|
29
30
|
${({ active }) => active && css`
|
|
30
31
|
background-color: ${props => props.theme.colors.lightPrimary};
|
|
31
32
|
border: 1px solid ${props => props.theme.colors.primary};
|
|
@@ -172,3 +173,13 @@ export const Timestatus = styled.div`
|
|
|
172
173
|
background-color: #E63757;
|
|
173
174
|
`}
|
|
174
175
|
`
|
|
176
|
+
|
|
177
|
+
export const PaginationWrapper = styled.div`
|
|
178
|
+
position: sticky;
|
|
179
|
+
bottom: 0px;
|
|
180
|
+
background: #fff;
|
|
181
|
+
justify-content: center;
|
|
182
|
+
> div {
|
|
183
|
+
padding: 10px 5px 0px 5px;
|
|
184
|
+
}
|
|
185
|
+
`
|
|
@@ -10,7 +10,15 @@ import {
|
|
|
10
10
|
MapMarkerImg
|
|
11
11
|
} from './styles'
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const InterActOrderMarkerPropsAreEqual = (prevProps, nextProps) => {
|
|
14
|
+
return prevProps.image === nextProps.image &&
|
|
15
|
+
JSON.stringify(prevProps.customer) === JSON.stringify(nextProps.customer) &&
|
|
16
|
+
JSON.stringify(prevProps.business) === JSON.stringify(nextProps.business) &&
|
|
17
|
+
prevProps.timeStatus === nextProps.timeStatus &&
|
|
18
|
+
JSON.stringify(prevProps.driver) === JSON.stringify(nextProps.driver)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const InterActOrderMarker = React.memo((props) => {
|
|
14
22
|
const {
|
|
15
23
|
image,
|
|
16
24
|
customer,
|
|
@@ -165,4 +173,4 @@ export const InterActOrderMarker = (props) => {
|
|
|
165
173
|
</WrapperMapMarker>
|
|
166
174
|
</>
|
|
167
175
|
)
|
|
168
|
-
}
|
|
176
|
+
}, InterActOrderMarkerPropsAreEqual)
|
|
@@ -31,6 +31,7 @@ export const OrdersContentHeader = (props) => {
|
|
|
31
31
|
handleChangeSearch,
|
|
32
32
|
searchValue,
|
|
33
33
|
driverGroupList,
|
|
34
|
+
assignableDriverGroupList,
|
|
34
35
|
driversList,
|
|
35
36
|
citiesList,
|
|
36
37
|
paymethodsList,
|
|
@@ -98,6 +99,7 @@ export const OrdersContentHeader = (props) => {
|
|
|
98
99
|
<OrdersHeaderFilterGroup
|
|
99
100
|
isSelectedOrders={isSelectedOrders}
|
|
100
101
|
driverGroupList={driverGroupList}
|
|
102
|
+
assignableDriverGroupList={assignableDriverGroupList}
|
|
101
103
|
driversList={driversList}
|
|
102
104
|
searchValue={searchValue}
|
|
103
105
|
handleChangeFilterValues={handleChangeFilterValues}
|
|
@@ -35,7 +35,8 @@ export const OrdersDashboardList = (props) => {
|
|
|
35
35
|
isSearchByCustomerPhone: isShowSearchFilters,
|
|
36
36
|
isSearchByDriverName: isShowSearchFilters,
|
|
37
37
|
isSearchByBusinessName: true,
|
|
38
|
-
driverId: props.driverId
|
|
38
|
+
driverId: props.driverId,
|
|
39
|
+
getDriversByControls: true
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
return (
|
|
@@ -234,8 +234,8 @@ const OrdersFilterGroupUI = (props) => {
|
|
|
234
234
|
<WrapperRow>
|
|
235
235
|
<DriversGroupTypeSelector
|
|
236
236
|
driverGroupList={driverGroupList}
|
|
237
|
-
handleChangeGroup={
|
|
238
|
-
filterValues={filterValues.
|
|
237
|
+
handleChangeGroup={handleChangeGroupUnassigned}
|
|
238
|
+
filterValues={filterValues.groupTypesUnassigned}
|
|
239
239
|
title={t('DRIVER_GROUP_ASSIGNED', 'Driver group (assigned)')}
|
|
240
240
|
/>
|
|
241
241
|
<BusinessesSelector
|
|
@@ -243,12 +243,6 @@ const OrdersFilterGroupUI = (props) => {
|
|
|
243
243
|
businessesList={businessesList}
|
|
244
244
|
handleChangeBusinesses={handleChangeBusinesses}
|
|
245
245
|
/>
|
|
246
|
-
{/* <DriversGroupTypeSelector
|
|
247
|
-
driverGroupList={driverGroupList}
|
|
248
|
-
handleChangeGroup={handleChangeGroupUnassigned}
|
|
249
|
-
filterValues={filterValues.groupTypesUnassigned}
|
|
250
|
-
title={t('DRIVER_GROUP_NOT_ASSIGNED', 'Driver group (general)')}
|
|
251
|
-
/> */}
|
|
252
246
|
</WrapperRow>
|
|
253
247
|
{/* <WrapperRow>
|
|
254
248
|
<BusinessesSelector
|
|
@@ -12,15 +12,13 @@ import { SearchBar } from '../../Shared'
|
|
|
12
12
|
const OrdersHeaderFilterGroupUI = (props) => {
|
|
13
13
|
const {
|
|
14
14
|
filterValues,
|
|
15
|
-
searchValue,
|
|
16
|
-
driverGroupList,
|
|
17
15
|
driversList,
|
|
18
16
|
handleChangeDriver,
|
|
19
17
|
handleChangeFilterValues,
|
|
20
18
|
handleChangeExternalId,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
handleChangeGroup,
|
|
20
|
+
isSelectedOrders,
|
|
21
|
+
assignableDriverGroupList
|
|
24
22
|
} = props
|
|
25
23
|
|
|
26
24
|
const [{ dictionary }] = useLanguage()
|
|
@@ -76,21 +74,12 @@ const OrdersHeaderFilterGroupUI = (props) => {
|
|
|
76
74
|
handleChangeDriver={handleChangeDriver}
|
|
77
75
|
/>
|
|
78
76
|
)}
|
|
79
|
-
{!loading && configFilter.includes('
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
// />
|
|
86
|
-
<SearchBar
|
|
87
|
-
customClass='external_id'
|
|
88
|
-
isCustomLayout
|
|
89
|
-
hideSearchIcon
|
|
90
|
-
lazyLoad
|
|
91
|
-
onSearch={handleChangeSearch}
|
|
92
|
-
search={searchValue || ''}
|
|
93
|
-
placeholder={dictionary?.SEARCH_BY_STORE_NAME || 'Store name'}
|
|
77
|
+
{!loading && configFilter.includes('driver_group') && (
|
|
78
|
+
<DriversGroupTypeSelector
|
|
79
|
+
driverGroupList={assignableDriverGroupList}
|
|
80
|
+
handleChangeGroup={handleChangeGroup}
|
|
81
|
+
filterValues={filterValues.driverGroupBusinessIds}
|
|
82
|
+
title={dictionary?.DRIVER_GROUP_ASSIGNABLE ?? 'Driver group (assignable)'}
|
|
94
83
|
/>
|
|
95
84
|
)}
|
|
96
85
|
</WrapperRow>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
2
|
import { useLocation } from 'react-router-dom'
|
|
3
|
-
import { useConfig, useLanguage, useSession
|
|
3
|
+
import { OrdersManage as OrdersManageController, useConfig, useLanguage, useSession } from 'ordering-components-admin-external'
|
|
4
4
|
import { OrderStatusFilterBar } from '../OrderStatusFilterBar'
|
|
5
5
|
import { OrdersContentHeader } from '../OrdersContentHeader'
|
|
6
6
|
import { OrderDetails } from '../OrderDetails'
|
|
@@ -19,7 +19,6 @@ import { OrdersDashboard } from '../OrdersDashboard'
|
|
|
19
19
|
import { OrderStatusSubFilter } from '../OrderStatusSubFilter'
|
|
20
20
|
import { OrderNotification } from '../OrderNotification'
|
|
21
21
|
import { WizardOrders } from '../WizardOrders'
|
|
22
|
-
import { OrdersHeaderFilterGroup } from '../OrdersHeaderFilterGroup'
|
|
23
22
|
|
|
24
23
|
const OrdersManagerUI = (props) => {
|
|
25
24
|
const {
|
|
@@ -27,6 +26,7 @@ const OrdersManagerUI = (props) => {
|
|
|
27
26
|
isSelectedOrders,
|
|
28
27
|
searchValue,
|
|
29
28
|
driverGroupList,
|
|
29
|
+
assignableDriverGroupList,
|
|
30
30
|
driversList,
|
|
31
31
|
paymethodsList,
|
|
32
32
|
businessesList,
|
|
@@ -52,7 +52,8 @@ const OrdersManagerUI = (props) => {
|
|
|
52
52
|
setAllowColumns,
|
|
53
53
|
timeStatus,
|
|
54
54
|
setTimeStatus,
|
|
55
|
-
isUseQuery
|
|
55
|
+
isUseQuery,
|
|
56
|
+
disableDriverLocationsSockets
|
|
56
57
|
} = props
|
|
57
58
|
|
|
58
59
|
const [, t] = useLanguage()
|
|
@@ -179,6 +180,7 @@ const OrdersManagerUI = (props) => {
|
|
|
179
180
|
isSelectedOrders={isSelectedOrders}
|
|
180
181
|
title={t('ORDERS_LIST', 'Orders list')}
|
|
181
182
|
searchValue={searchValue}
|
|
183
|
+
assignableDriverGroupList={assignableDriverGroupList}
|
|
182
184
|
driverGroupList={driverGroupList}
|
|
183
185
|
driversList={driversList}
|
|
184
186
|
citiesList={citiesList}
|
|
@@ -196,6 +198,7 @@ const OrdersManagerUI = (props) => {
|
|
|
196
198
|
setTimeStatus={setTimeStatus}
|
|
197
199
|
setSlaSettingTime={setSlaSettingTime}
|
|
198
200
|
isLateralBar={isLateralBar}
|
|
201
|
+
disableDriverLocationsSockets={disableDriverLocationsSockets}
|
|
199
202
|
/>
|
|
200
203
|
<OrderStatusFilterBar
|
|
201
204
|
isUseQuery={isUseQuery}
|
|
@@ -16,6 +16,29 @@ export const PaymethodTypeSelector = (props) => {
|
|
|
16
16
|
const [searchValue, setSearchValue] = useState('')
|
|
17
17
|
const placeholder = <PlaceholderTitle>{t('SELECT_PAYMETHOD', 'Select paymethod')}</PlaceholderTitle>
|
|
18
18
|
const paymthodsLoading = [{ value: 'default', content: <Option>{t('PAYMETHODS_LOADING', 'Paymethods loading')}...</Option> }]
|
|
19
|
+
const [pagination, setPagination] = useState({
|
|
20
|
+
currentPage: 1,
|
|
21
|
+
pageSize: 5,
|
|
22
|
+
totalItems: null,
|
|
23
|
+
totalPages: null
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const handleChangePage = (page) => {
|
|
27
|
+
setPagination({
|
|
28
|
+
...pagination,
|
|
29
|
+
currentPage: page
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const handleChangePageSize = (pageSize) => {
|
|
34
|
+
const expectedPage = Math.ceil(((pagination?.currentPage - 1) * pagination?.pageSize + 1) / pageSize)
|
|
35
|
+
setPagination({
|
|
36
|
+
...pagination,
|
|
37
|
+
currentPage: expectedPage,
|
|
38
|
+
pageSize,
|
|
39
|
+
totalPages: Math.ceil(paymethodsTypes?.length / pageSize)
|
|
40
|
+
})
|
|
41
|
+
}
|
|
19
42
|
|
|
20
43
|
useEffect(() => {
|
|
21
44
|
const _paymthodsOptionList = []
|
|
@@ -39,6 +62,16 @@ export const PaymethodTypeSelector = (props) => {
|
|
|
39
62
|
setPaymethodsTypes(_paymthodsOptionList)
|
|
40
63
|
}, [paymethodsList, searchValue])
|
|
41
64
|
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (paymethodsTypes?.length) {
|
|
67
|
+
setPagination({
|
|
68
|
+
...pagination,
|
|
69
|
+
totalItems: paymethodsTypes?.length,
|
|
70
|
+
totalPages: Math.ceil(paymethodsTypes?.length / 10)
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
}, [paymethodsTypes])
|
|
74
|
+
|
|
42
75
|
return (
|
|
43
76
|
<>
|
|
44
77
|
{!paymethodsList.loading ? (
|
|
@@ -53,6 +86,10 @@ export const PaymethodTypeSelector = (props) => {
|
|
|
53
86
|
searchBarIsNotLazyLoad
|
|
54
87
|
searchValue={searchValue}
|
|
55
88
|
handleChangeSearch={(val) => setSearchValue(val)}
|
|
89
|
+
isHidePagecontrol
|
|
90
|
+
pagination={pagination}
|
|
91
|
+
handleChangePage={handleChangePage}
|
|
92
|
+
handleChangePageSize={handleChangePageSize}
|
|
56
93
|
/>
|
|
57
94
|
) : (
|
|
58
95
|
<MultiSelect
|
|
@@ -25,6 +25,29 @@ const CitySelectorUI = (props) => {
|
|
|
25
25
|
const [cityOptions, setCityOptions] = useState([])
|
|
26
26
|
const [searchValue, setSearchValue] = useState('')
|
|
27
27
|
const placeholder = <PlaceholderTitle isDefault={isDefault}>{t('SELECT_CITY', 'Select City')}</PlaceholderTitle>
|
|
28
|
+
const [pagination, setPagination] = useState({
|
|
29
|
+
currentPage: 1,
|
|
30
|
+
pageSize: 5,
|
|
31
|
+
totalItems: null,
|
|
32
|
+
totalPages: null
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const handleChangePage = (page) => {
|
|
36
|
+
setPagination({
|
|
37
|
+
...pagination,
|
|
38
|
+
currentPage: page
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const handleChangePageSize = (pageSize) => {
|
|
43
|
+
const expectedPage = Math.ceil(((pagination?.currentPage - 1) * pagination?.pageSize + 1) / pageSize)
|
|
44
|
+
setPagination({
|
|
45
|
+
...pagination,
|
|
46
|
+
currentPage: expectedPage,
|
|
47
|
+
pageSize,
|
|
48
|
+
totalPages: Math.ceil(cityOptions?.length / pageSize)
|
|
49
|
+
})
|
|
50
|
+
}
|
|
28
51
|
|
|
29
52
|
useEffect(() => {
|
|
30
53
|
if (citiesList?.loading) return
|
|
@@ -47,6 +70,16 @@ const CitySelectorUI = (props) => {
|
|
|
47
70
|
}
|
|
48
71
|
}, [cityOptions, isAddMode])
|
|
49
72
|
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (cityOptions?.length) {
|
|
75
|
+
setPagination({
|
|
76
|
+
...pagination,
|
|
77
|
+
totalItems: cityOptions?.length,
|
|
78
|
+
totalPages: Math.ceil(cityOptions?.length / 10)
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
}, [cityOptions])
|
|
82
|
+
|
|
50
83
|
return (
|
|
51
84
|
<>
|
|
52
85
|
{citiesList?.loading ? (
|
|
@@ -75,6 +108,10 @@ const CitySelectorUI = (props) => {
|
|
|
75
108
|
searchBarIsNotLazyLoad
|
|
76
109
|
searchValue={searchValue}
|
|
77
110
|
handleChangeSearch={(val) => setSearchValue(val)}
|
|
111
|
+
isHidePagecontrol
|
|
112
|
+
pagination={pagination}
|
|
113
|
+
handleChangePage={handleChangePage}
|
|
114
|
+
handleChangePageSize={handleChangePageSize}
|
|
78
115
|
/>
|
|
79
116
|
)}
|
|
80
117
|
</>
|
|
@@ -35,9 +35,9 @@ export const FilterValuesProvider = ({ children }) => {
|
|
|
35
35
|
customerEmail: null,
|
|
36
36
|
customerCellphone: null,
|
|
37
37
|
customerLastname: null,
|
|
38
|
-
administratorIds: [],
|
|
39
38
|
coupon: null,
|
|
40
|
-
offerId: null
|
|
39
|
+
offerId: null,
|
|
40
|
+
administratorIds: []
|
|
41
41
|
})
|
|
42
42
|
|
|
43
43
|
const handleFilterValues = (filterValues) => {
|
|
@@ -45,7 +45,8 @@ export const MultiSelect = (props) => {
|
|
|
45
45
|
handleChangePageSize,
|
|
46
46
|
useLazyPagination,
|
|
47
47
|
isLoading,
|
|
48
|
-
optionsPosition
|
|
48
|
+
optionsPosition,
|
|
49
|
+
isHidePagecontrol
|
|
49
50
|
} = props
|
|
50
51
|
|
|
51
52
|
const [open, setOpen] = useState(false)
|
|
@@ -242,6 +243,7 @@ export const MultiSelect = (props) => {
|
|
|
242
243
|
handleChangePage={handlerChangePage}
|
|
243
244
|
handleChangePageSize={handleChangePageSize}
|
|
244
245
|
defaultPageSize={pagination?.pageSize}
|
|
246
|
+
isHidePagecontrol={isHidePagecontrol}
|
|
245
247
|
/>
|
|
246
248
|
</PaginationWrapper>
|
|
247
249
|
)}
|
|
@@ -3,12 +3,16 @@ import { HelmetTags } from '../../components/HelmetTags'
|
|
|
3
3
|
import { AllInOne as AllInOneController } from '../../../src/components/Orders'
|
|
4
4
|
import { addQueryToUrl, removeQueryToUrl } from '../../../src/utils'
|
|
5
5
|
import settings from '../../config.json'
|
|
6
|
+
import { useFilterValues } from '../../../src/contexts/FilterValuesContext'
|
|
6
7
|
|
|
7
8
|
export const AllInOne = (props) => {
|
|
9
|
+
const [filterValues] = useFilterValues()
|
|
10
|
+
|
|
8
11
|
const ordersListProps = {
|
|
9
12
|
...props,
|
|
10
13
|
isUseQuery: true,
|
|
11
14
|
useBatchSockets: settings?.use_batch_sockets,
|
|
15
|
+
defaultFilterValues: filterValues,
|
|
12
16
|
onOrderRedirect: (orderId) => {
|
|
13
17
|
if (!orderId) {
|
|
14
18
|
return removeQueryToUrl(['id', 'section', 'tab'])
|
|
@@ -3,14 +3,18 @@ import { HelmetTags } from '../../components/HelmetTags'
|
|
|
3
3
|
import { DeliveriesManager as DeliveriesManagerController } from '../../../src/components/Orders'
|
|
4
4
|
import { addQueryToUrl, removeQueryToUrl } from '../../../src/utils'
|
|
5
5
|
import settings from '../../config.json'
|
|
6
|
+
import { useFilterValues } from '../../../src/contexts/FilterValuesContext'
|
|
6
7
|
|
|
7
8
|
export const DeliveriesManager = (props) => {
|
|
9
|
+
const [filterValues] = useFilterValues()
|
|
10
|
+
|
|
8
11
|
const deliveriesManagerProps = {
|
|
9
12
|
...props,
|
|
10
13
|
isUseQuery: true,
|
|
11
14
|
franchiseId: settings?.franchiseId,
|
|
12
15
|
useBatchSockets: settings?.use_batch_sockets,
|
|
13
16
|
useFranchiseImages: settings?.use_franchise_images,
|
|
17
|
+
defaultFilterValues: filterValues,
|
|
14
18
|
onOrderRedirect: (orderId) => {
|
|
15
19
|
if (!orderId) {
|
|
16
20
|
return removeQueryToUrl(['id'])
|