ordering-ui-admin-external 1.7.1 → 1.7.3
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.4e91d784f3b95343e365.js → ordering-ui-admin.499cd3aed4f9480d7496.js} +2 -2
- package/_bundles/{ordering-ui-admin.4e91d784f3b95343e365.js.LICENSE.txt → ordering-ui-admin.499cd3aed4f9480d7496.js.LICENSE.txt} +0 -0
- package/_modules/components/BusinessIntelligence/AnalyticsBusinessFilter/index.js +7 -18
- package/_modules/components/BusinessIntelligence/AnalyticsBusinessFilter/styles.js +5 -1
- package/_modules/components/BusinessIntelligence/AnalyticsCalendar/index.js +1 -0
- package/_modules/components/BusinessIntelligence/AnalyticsDriverOrders/index.js +9 -4
- package/_modules/components/BusinessIntelligence/AnalyticsDriverOrders/styles.js +3 -1
- package/_modules/components/BusinessIntelligence/AnalyticsDriversFilter/styles.js +6 -2
- package/_modules/components/BusinessIntelligence/AnalyticsFilterTimeZone/styles.js +9 -3
- package/_modules/components/BusinessIntelligence/AnalyticsOrdersAcceptSpend/styles.js +3 -1
- package/_modules/components/BusinessIntelligence/AnalyticsOrdersOrSales/index.js +5 -3
- package/_modules/components/BusinessIntelligence/AnalyticsOrdersOrSales/styles.js +3 -1
- package/_modules/components/BusinessIntelligence/AnalyticsOrdersStatus/styles.js +3 -1
- package/_modules/components/BusinessIntelligence/BusinessAnalytics/index.js +27 -3
- package/_modules/components/BusinessIntelligence/BusinessAnalytics/styles.js +6 -4
- package/_modules/components/BusinessIntelligence/CountryFilter/index.js +134 -0
- package/_modules/components/BusinessIntelligence/CountryFilter/styles.js +30 -0
- package/_modules/components/BusinessIntelligence/DriverAnalytics/index.js +27 -3
- package/_modules/components/BusinessIntelligence/DriverAnalytics/styles.js +3 -3
- package/_modules/components/BusinessIntelligence/InvoiceGeneral/styles.js +5 -1
- package/_modules/components/BusinessIntelligence/ReportsAppIdFilter/styles.js +3 -1
- package/_modules/components/BusinessIntelligence/ReportsBrandFilter/index.js +7 -18
- package/_modules/components/BusinessIntelligence/ReportsBrandFilter/styles.js +5 -1
- package/_modules/components/BusinessIntelligence/ReportsBusinessDistance/index.js +25 -4
- package/_modules/components/BusinessIntelligence/ReportsBusinessSpend/index.js +22 -1
- package/_modules/components/BusinessIntelligence/ReportsDriverDistance/index.js +29 -8
- package/_modules/components/BusinessIntelligence/ReportsDriverFilter/styles.js +3 -1
- package/_modules/components/BusinessIntelligence/ReportsDriverGroupFilter/styles.js +3 -1
- package/_modules/components/BusinessIntelligence/ReportsDriverOrder/index.js +22 -1
- package/_modules/components/BusinessIntelligence/ReportsDriverOrderTime/index.js +22 -1
- package/_modules/components/BusinessIntelligence/ReportsDriverSpend/index.js +22 -1
- package/_modules/components/BusinessIntelligence/ReportsGeneralSales/index.js +22 -1
- package/_modules/components/BusinessIntelligence/ReportsHeatMap/index.js +37 -16
- package/_modules/components/BusinessIntelligence/ReportsOrderDistance/index.js +25 -4
- package/_modules/components/BusinessIntelligence/ReportsOrderStatus/index.js +29 -8
- package/_modules/components/BusinessIntelligence/ReportsOrderTypeFilter/styles.js +3 -1
- package/_modules/components/BusinessIntelligence/ReportsOrders/index.js +26 -5
- package/_modules/components/BusinessIntelligence/ReportsOrders/styles.js +3 -1
- package/_modules/components/BusinessIntelligence/ReportsSaleAndCategory/index.js +22 -1
- package/_modules/components/BusinessIntelligence/ReportsSales/index.js +22 -1
- package/_modules/components/BusinessIntelligence/ReportsSales/styles.js +3 -1
- package/_modules/components/BusinessIntelligence/SettingItemUI/styles.js +6 -2
- package/_modules/components/CartRecovery/OpenCartList/styles.js +10 -7
- package/_modules/components/CartRecovery/OpenCartListing/styles.js +3 -1
- package/_modules/components/CartRecovery/RecoveryActionDetail/styles.js +3 -1
- package/package.json +2 -2
- package/src/components/BusinessIntelligence/AnalyticsBusinessFilter/index.js +7 -17
- package/src/components/BusinessIntelligence/AnalyticsBusinessFilter/styles.js +3 -3
- package/src/components/BusinessIntelligence/AnalyticsCalendar/index.js +1 -1
- package/src/components/BusinessIntelligence/AnalyticsDriverOrders/index.js +11 -3
- package/src/components/BusinessIntelligence/AnalyticsDriverOrders/styles.js +1 -1
- package/src/components/BusinessIntelligence/AnalyticsDriversFilter/styles.js +2 -2
- package/src/components/BusinessIntelligence/AnalyticsFilterTimeZone/styles.js +5 -8
- package/src/components/BusinessIntelligence/AnalyticsOrdersAcceptSpend/styles.js +1 -1
- package/src/components/BusinessIntelligence/AnalyticsOrdersOrSales/index.js +6 -2
- package/src/components/BusinessIntelligence/AnalyticsOrdersOrSales/styles.js +1 -1
- package/src/components/BusinessIntelligence/AnalyticsOrdersStatus/styles.js +1 -1
- package/src/components/BusinessIntelligence/BusinessAnalytics/index.js +23 -1
- package/src/components/BusinessIntelligence/BusinessAnalytics/styles.js +26 -7
- package/src/components/BusinessIntelligence/CountryFilter/index.js +128 -0
- package/src/components/BusinessIntelligence/CountryFilter/styles.js +65 -0
- package/src/components/BusinessIntelligence/DriverAnalytics/index.js +23 -1
- package/src/components/BusinessIntelligence/DriverAnalytics/styles.js +14 -7
- package/src/components/BusinessIntelligence/InvoiceGeneral/styles.js +2 -2
- package/src/components/BusinessIntelligence/ReportsAppIdFilter/styles.js +1 -1
- package/src/components/BusinessIntelligence/ReportsBrandFilter/index.js +7 -17
- package/src/components/BusinessIntelligence/ReportsBrandFilter/styles.js +3 -3
- package/src/components/BusinessIntelligence/ReportsBusinessDistance/index.js +19 -0
- package/src/components/BusinessIntelligence/ReportsBusinessSpend/index.js +20 -0
- package/src/components/BusinessIntelligence/ReportsDriverDistance/index.js +19 -0
- package/src/components/BusinessIntelligence/ReportsDriverFilter/styles.js +1 -1
- package/src/components/BusinessIntelligence/ReportsDriverGroupFilter/styles.js +1 -1
- package/src/components/BusinessIntelligence/ReportsDriverOrder/index.js +19 -0
- package/src/components/BusinessIntelligence/ReportsDriverOrderTime/index.js +19 -0
- package/src/components/BusinessIntelligence/ReportsDriverSpend/index.js +19 -0
- package/src/components/BusinessIntelligence/ReportsGeneralSales/index.js +19 -1
- package/src/components/BusinessIntelligence/ReportsHeatMap/index.js +19 -0
- package/src/components/BusinessIntelligence/ReportsOrderDistance/index.js +19 -0
- package/src/components/BusinessIntelligence/ReportsOrderStatus/index.js +19 -0
- package/src/components/BusinessIntelligence/ReportsOrderTypeFilter/styles.js +1 -1
- package/src/components/BusinessIntelligence/ReportsOrders/index.js +22 -3
- package/src/components/BusinessIntelligence/ReportsOrders/styles.js +1 -1
- package/src/components/BusinessIntelligence/ReportsSaleAndCategory/index.js +19 -0
- package/src/components/BusinessIntelligence/ReportsSales/index.js +19 -0
- package/src/components/BusinessIntelligence/ReportsSales/styles.js +1 -1
- package/src/components/BusinessIntelligence/SettingItemUI/styles.js +2 -2
- package/src/components/CartRecovery/OpenCartList/styles.js +1 -1
- package/src/components/CartRecovery/OpenCartListing/styles.js +1 -1
- package/src/components/CartRecovery/RecoveryActionDetail/styles.js +1 -1
|
@@ -19,7 +19,8 @@ import {
|
|
|
19
19
|
export const AnalyticsDriverOrders = (props) => {
|
|
20
20
|
const {
|
|
21
21
|
isOrders,
|
|
22
|
-
chartDataList
|
|
22
|
+
chartDataList,
|
|
23
|
+
countryCode
|
|
23
24
|
} = props
|
|
24
25
|
|
|
25
26
|
const [, t] = useLanguage()
|
|
@@ -91,11 +92,18 @@ export const AnalyticsDriverOrders = (props) => {
|
|
|
91
92
|
|
|
92
93
|
const TotalSales = () => {
|
|
93
94
|
let sales = 0
|
|
94
|
-
if (!chartDataList?.data?.dataset?.dataset[0]?.data || chartDataList?.data?.dataset?.dataset[0]?.data.length === 0) return sales
|
|
95
|
+
if (!chartDataList?.data?.dataset?.dataset[0]?.data || chartDataList?.data?.dataset?.dataset[0]?.data.length === 0) return getFormattedValue(sales, countryCode)
|
|
95
96
|
for (const data of chartDataList?.data?.dataset?.dataset[0]?.data) {
|
|
96
97
|
sales += data.y
|
|
97
98
|
}
|
|
98
|
-
return
|
|
99
|
+
return getFormattedValue(sales, countryCode)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const getFormattedValue = (value, flag) => {
|
|
103
|
+
const formattedValue = flag
|
|
104
|
+
? parsePrice(value.toFixed(2), { separator: '.' })
|
|
105
|
+
: value.toFixed(2)
|
|
106
|
+
return formattedValue
|
|
99
107
|
}
|
|
100
108
|
|
|
101
109
|
const downloadCSV = () => {
|
|
@@ -17,7 +17,7 @@ export const TreeViewParentItem = styled.div`
|
|
|
17
17
|
|
|
18
18
|
svg {
|
|
19
19
|
font-size: 24px;
|
|
20
|
-
color:
|
|
20
|
+
color: ${props => props.theme.colors.secundaryLight};
|
|
21
21
|
&.fill {
|
|
22
22
|
color: ${props => props.theme?.colors.primary};
|
|
23
23
|
}
|
|
@@ -49,7 +49,7 @@ export const TreeViewChildrenItem = styled.div`
|
|
|
49
49
|
|
|
50
50
|
svg {
|
|
51
51
|
font-size: 24px;
|
|
52
|
-
color:
|
|
52
|
+
color: ${props => props.theme.colors.secundaryLight};
|
|
53
53
|
&.fill {
|
|
54
54
|
color: ${props => props.theme?.colors.primary};
|
|
55
55
|
}
|
|
@@ -8,8 +8,9 @@ export const AnalyticsTimeZoneContainer = styled.div`
|
|
|
8
8
|
border-radius: 7.6px;
|
|
9
9
|
padding: 7px 12px;
|
|
10
10
|
font-size: 14px;
|
|
11
|
-
color:
|
|
11
|
+
color: ${props => props.theme.colors.secundaryContrast};
|
|
12
12
|
border: none;
|
|
13
|
+
width: 100%;
|
|
13
14
|
}
|
|
14
15
|
`
|
|
15
16
|
|
|
@@ -17,19 +18,15 @@ export const TimeZoneSelectWrapper = styled.div`
|
|
|
17
18
|
position: absolute;
|
|
18
19
|
width: 300px;
|
|
19
20
|
top: 100%;
|
|
20
|
-
right:
|
|
21
|
+
right: 0;
|
|
21
22
|
padding: 25px;
|
|
22
23
|
background: ${props => props.theme.colors?.backgroundPage || '#FFF'};
|
|
23
|
-
border: 1px solid
|
|
24
|
+
border: 1px solid ${props => props.theme.colors.borderColor};
|
|
24
25
|
box-sizing: border-box;
|
|
25
26
|
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.12);
|
|
26
27
|
border-radius: 7.6px;
|
|
27
28
|
z-index: 100;
|
|
28
29
|
margin-top: 18px;
|
|
29
|
-
|
|
30
|
-
@media (min-width: 576px) {
|
|
31
|
-
right: 0;
|
|
32
|
-
}
|
|
33
30
|
`
|
|
34
31
|
export const TimeZoneSearchWrapper = styled.div`
|
|
35
32
|
position: relative;
|
|
@@ -50,7 +47,7 @@ export const SearchIconWrapper = styled.div`
|
|
|
50
47
|
|
|
51
48
|
svg {
|
|
52
49
|
font-size: 16px;
|
|
53
|
-
color:
|
|
50
|
+
color: ${props => props.theme.colors.secundaryLight};
|
|
54
51
|
}
|
|
55
52
|
`
|
|
56
53
|
|
|
@@ -20,7 +20,8 @@ export const AnalyticsOrdersOrSales = (props) => {
|
|
|
20
20
|
const {
|
|
21
21
|
isOrders,
|
|
22
22
|
chartDataList,
|
|
23
|
-
filterList
|
|
23
|
+
filterList,
|
|
24
|
+
countryCode
|
|
24
25
|
} = props
|
|
25
26
|
|
|
26
27
|
const [, t] = useLanguage()
|
|
@@ -182,7 +183,10 @@ export const AnalyticsOrdersOrSales = (props) => {
|
|
|
182
183
|
for (const data of chartDataList?.data) {
|
|
183
184
|
sales += data.sales
|
|
184
185
|
}
|
|
185
|
-
|
|
186
|
+
const totalSales = countryCode
|
|
187
|
+
? parsePrice(sales.toFixed(2), { separator: '.' })
|
|
188
|
+
: sales.toFixed(2)
|
|
189
|
+
return totalSales
|
|
186
190
|
}
|
|
187
191
|
|
|
188
192
|
const downloadCSV = () => {
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
MapWrraper
|
|
29
29
|
} from './styles'
|
|
30
30
|
import { ReportsBrandFilter } from '../ReportsBrandFilter'
|
|
31
|
+
import { CountryFilter } from '../CountryFilter'
|
|
31
32
|
|
|
32
33
|
const BusinessAnalyticsUI = (props) => {
|
|
33
34
|
const {
|
|
@@ -42,7 +43,8 @@ const BusinessAnalyticsUI = (props) => {
|
|
|
42
43
|
customerSatisfactionList,
|
|
43
44
|
ordersAcceptSpendList,
|
|
44
45
|
arrivedPickUpSpendList,
|
|
45
|
-
orderLocationList
|
|
46
|
+
orderLocationList,
|
|
47
|
+
countryCode
|
|
46
48
|
} = props
|
|
47
49
|
|
|
48
50
|
const [, t] = useLanguage()
|
|
@@ -50,6 +52,7 @@ const BusinessAnalyticsUI = (props) => {
|
|
|
50
52
|
|
|
51
53
|
const [businessFilterModal, setBusinessFilterModal] = useState(false)
|
|
52
54
|
const [isBrandFilter, setIsBrandFilter] = useState(false)
|
|
55
|
+
const [openCountryFilter, setOpenCountryFilter] = useState(true)
|
|
53
56
|
|
|
54
57
|
const handleChangeDate = (date1, date2) => {
|
|
55
58
|
handleChangeFilterList({ ...filterList, lapse: `${date1},${date2}` })
|
|
@@ -70,6 +73,11 @@ const BusinessAnalyticsUI = (props) => {
|
|
|
70
73
|
<h1>{t('BUSINESS_ANALYTICS', 'Business Analytics')}</h1>
|
|
71
74
|
</HeaderTitleContainer>
|
|
72
75
|
<HeaderFilterContainer>
|
|
76
|
+
<BusinessFilterWrapper>
|
|
77
|
+
<Button onClick={() => setOpenCountryFilter(true)}>
|
|
78
|
+
{t('COUNTRY', 'Country')}
|
|
79
|
+
</Button>
|
|
80
|
+
</BusinessFilterWrapper>
|
|
73
81
|
<BusinessFilterWrapper>
|
|
74
82
|
<Button onClick={() => setIsBrandFilter(true)}>
|
|
75
83
|
{t('BRAND', 'Brand')} ({filterList?.franchises_id ? filterList?.franchises_id.length : t('ALL', 'All')})
|
|
@@ -106,12 +114,14 @@ const BusinessAnalyticsUI = (props) => {
|
|
|
106
114
|
isOrders
|
|
107
115
|
filterList={filterList}
|
|
108
116
|
chartDataList={ordersList}
|
|
117
|
+
countryCode={countryCode}
|
|
109
118
|
/>
|
|
110
119
|
</div>
|
|
111
120
|
<div className='col-md-12 col-lg-6'>
|
|
112
121
|
<AnalyticsOrdersOrSales
|
|
113
122
|
filterList={filterList}
|
|
114
123
|
chartDataList={salesList}
|
|
124
|
+
countryCode={countryCode}
|
|
115
125
|
/>
|
|
116
126
|
</div>
|
|
117
127
|
<div className='col-md-12 col-lg-6'>
|
|
@@ -184,6 +194,18 @@ const BusinessAnalyticsUI = (props) => {
|
|
|
184
194
|
onClose={() => setIsBrandFilter(false)}
|
|
185
195
|
/>
|
|
186
196
|
</Modal>
|
|
197
|
+
<Modal
|
|
198
|
+
width='450px'
|
|
199
|
+
height='650px'
|
|
200
|
+
padding='25px'
|
|
201
|
+
open={openCountryFilter}
|
|
202
|
+
onClose={() => setOpenCountryFilter(false)}
|
|
203
|
+
>
|
|
204
|
+
<CountryFilter
|
|
205
|
+
{...props}
|
|
206
|
+
onClose={() => setOpenCountryFilter(false)}
|
|
207
|
+
/>
|
|
208
|
+
</Modal>
|
|
187
209
|
</BusinessAnalyticsContainer>
|
|
188
210
|
)
|
|
189
211
|
}
|
|
@@ -13,7 +13,7 @@ export const BusinessAnalyticsHeader = styled.div`
|
|
|
13
13
|
display: flex;
|
|
14
14
|
flex-direction: column;
|
|
15
15
|
|
|
16
|
-
@media (min-width:
|
|
16
|
+
@media (min-width: 1024px) {
|
|
17
17
|
flex-direction: row;
|
|
18
18
|
align-items: center;
|
|
19
19
|
justify-content: space-between;
|
|
@@ -51,22 +51,41 @@ export const HeaderTitleContainer = styled.div`
|
|
|
51
51
|
export const HeaderFilterContainer = styled.div`
|
|
52
52
|
display: flex;
|
|
53
53
|
align-items: center;
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
> div {
|
|
56
|
+
width: 100%;
|
|
57
|
+
margin-top: 10px;
|
|
58
|
+
> button {
|
|
59
|
+
width: 100%;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@media (min-width: 600px) {
|
|
64
|
+
flex-direction: row;
|
|
65
|
+
> div {
|
|
66
|
+
margin-top: 0px;
|
|
67
|
+
width: auto;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
54
70
|
`
|
|
55
71
|
|
|
56
72
|
export const BusinessFilterWrapper = styled.div`
|
|
57
|
-
margin-left: 25px;
|
|
58
|
-
${props => props.theme.rtl && css`
|
|
59
|
-
margin-right: 25px;
|
|
60
|
-
margin-left: 0;
|
|
61
|
-
`}
|
|
62
73
|
> button {
|
|
63
74
|
background: #F8F9FA;
|
|
64
75
|
border-radius: 7.6px;
|
|
65
76
|
padding: 7px 12px;
|
|
66
77
|
font-size: 14px;
|
|
67
|
-
color:
|
|
78
|
+
color: ${props => props.theme.colors.secundaryContrast};
|
|
68
79
|
border: none;
|
|
69
80
|
}
|
|
81
|
+
|
|
82
|
+
@media (min-width: 600px) {
|
|
83
|
+
margin-left: 25px;
|
|
84
|
+
${props => props.theme.rtl && css`
|
|
85
|
+
margin-right: 25px;
|
|
86
|
+
margin-left: 0;
|
|
87
|
+
`}
|
|
88
|
+
}
|
|
70
89
|
`
|
|
71
90
|
|
|
72
91
|
export const BusinessCalendarWrapper = styled(BusinessFilterWrapper)`
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { useLanguage, CountryList } from 'ordering-components-admin-external'
|
|
3
|
+
import { Button } from '../../../styles'
|
|
4
|
+
import Skeleton from 'react-loading-skeleton'
|
|
5
|
+
import { SearchBar, Pagination } from '../../Shared'
|
|
6
|
+
import { RecordCircleFill, Circle } from 'react-bootstrap-icons'
|
|
7
|
+
import {
|
|
8
|
+
Container,
|
|
9
|
+
SearchWrapper,
|
|
10
|
+
CountryListWrapper,
|
|
11
|
+
CountryItem,
|
|
12
|
+
ButtonWrapper,
|
|
13
|
+
PaginationWrapper
|
|
14
|
+
} from './styles'
|
|
15
|
+
|
|
16
|
+
const CountryFilterUI = (props) => {
|
|
17
|
+
const {
|
|
18
|
+
countriesState,
|
|
19
|
+
searchValue,
|
|
20
|
+
onSearch,
|
|
21
|
+
handleClickFilterButton,
|
|
22
|
+
code,
|
|
23
|
+
setCode
|
|
24
|
+
} = props
|
|
25
|
+
|
|
26
|
+
const [, t] = useLanguage()
|
|
27
|
+
|
|
28
|
+
// Change page
|
|
29
|
+
const [currentPage, setCurrentPage] = useState(1)
|
|
30
|
+
const [pagesPerPage, setPagesPerPage] = useState(10)
|
|
31
|
+
|
|
32
|
+
// Get current products
|
|
33
|
+
const [currentPages, setCurrentPages] = useState([])
|
|
34
|
+
const [totalPages, setTotalPages] = useState(null)
|
|
35
|
+
|
|
36
|
+
const handleChangePage = (page) => {
|
|
37
|
+
setCurrentPage(page)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const handleChangePageSize = (pageSize) => {
|
|
41
|
+
const expectedPage = Math.ceil(((currentPage - 1) * pagesPerPage + 1) / pageSize)
|
|
42
|
+
setCurrentPage(expectedPage)
|
|
43
|
+
setPagesPerPage(pageSize)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (countriesState.loading) return
|
|
48
|
+
let _totalPages
|
|
49
|
+
if (countriesState.countries.length > 0) {
|
|
50
|
+
_totalPages = Math.ceil(countriesState.countries.length / pagesPerPage)
|
|
51
|
+
}
|
|
52
|
+
const indexOfLastPost = currentPage * pagesPerPage
|
|
53
|
+
const indexOfFirstPost = indexOfLastPost - pagesPerPage
|
|
54
|
+
const _currentBusinessList = countriesState.countries.slice(indexOfFirstPost, indexOfLastPost)
|
|
55
|
+
setTotalPages(_totalPages)
|
|
56
|
+
setCurrentPages(_currentBusinessList)
|
|
57
|
+
}, [countriesState, currentPage, pagesPerPage])
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<>
|
|
61
|
+
<Container>
|
|
62
|
+
<h2>{t('CHOOSE_A_COUNTRY', 'Choose a country')}</h2>
|
|
63
|
+
<SearchWrapper>
|
|
64
|
+
<SearchBar
|
|
65
|
+
search={searchValue}
|
|
66
|
+
isCustomLayout
|
|
67
|
+
lazyLoad
|
|
68
|
+
onSearch={(value) => onSearch(value)}
|
|
69
|
+
placeholder={t('SEARCH', 'Search')}
|
|
70
|
+
/>
|
|
71
|
+
</SearchWrapper>
|
|
72
|
+
<CountryListWrapper>
|
|
73
|
+
{countriesState?.loading ? (
|
|
74
|
+
<>
|
|
75
|
+
{[...Array(10).keys()].map(i => (
|
|
76
|
+
<CountryItem
|
|
77
|
+
key={i}
|
|
78
|
+
>
|
|
79
|
+
<Skeleton width={18} height={18} circle />
|
|
80
|
+
<Skeleton width={200} height={20} style={{ marginLeft: 10 }} />
|
|
81
|
+
</CountryItem>
|
|
82
|
+
))}
|
|
83
|
+
</>
|
|
84
|
+
) : (
|
|
85
|
+
<>
|
|
86
|
+
{currentPages?.map(country => (
|
|
87
|
+
<CountryItem key={country?.id} onClick={() => setCode(country?.code)}>
|
|
88
|
+
{code === country?.code ? <RecordCircleFill className='checked' /> : <Circle />}
|
|
89
|
+
<span className='name'>{country?.name}</span>
|
|
90
|
+
</CountryItem>
|
|
91
|
+
))}
|
|
92
|
+
</>
|
|
93
|
+
)}
|
|
94
|
+
</CountryListWrapper>
|
|
95
|
+
<PaginationWrapper>
|
|
96
|
+
{countriesState?.countries?.length > 0 && (
|
|
97
|
+
<Pagination
|
|
98
|
+
currentPage={currentPage}
|
|
99
|
+
totalPages={totalPages}
|
|
100
|
+
handleChangePage={handleChangePage}
|
|
101
|
+
defaultPageSize={pagesPerPage}
|
|
102
|
+
handleChangePageSize={handleChangePageSize}
|
|
103
|
+
/>
|
|
104
|
+
)}
|
|
105
|
+
</PaginationWrapper>
|
|
106
|
+
</Container>
|
|
107
|
+
<ButtonWrapper>
|
|
108
|
+
<Button
|
|
109
|
+
color='primary'
|
|
110
|
+
disabled={countriesState.loading}
|
|
111
|
+
onClick={handleClickFilterButton}
|
|
112
|
+
>
|
|
113
|
+
{t('FILTER', 'Filter')}
|
|
114
|
+
</Button>
|
|
115
|
+
</ButtonWrapper>
|
|
116
|
+
</>
|
|
117
|
+
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const CountryFilter = (props) => {
|
|
122
|
+
const countryFilterProps = {
|
|
123
|
+
...props,
|
|
124
|
+
UIComponent: CountryFilterUI,
|
|
125
|
+
isSearchByName: true
|
|
126
|
+
}
|
|
127
|
+
return <CountryList {...countryFilterProps} />
|
|
128
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
|
|
3
|
+
export const Container = styled.div`
|
|
4
|
+
h2 {
|
|
5
|
+
font-weight: 700;
|
|
6
|
+
font-size: 20px;
|
|
7
|
+
line-height: 30px;
|
|
8
|
+
margin-top: 0px;
|
|
9
|
+
margin-bottom: 24px;
|
|
10
|
+
}
|
|
11
|
+
`
|
|
12
|
+
|
|
13
|
+
export const SearchWrapper = styled.div`
|
|
14
|
+
input {
|
|
15
|
+
width: 100%;
|
|
16
|
+
}
|
|
17
|
+
`
|
|
18
|
+
|
|
19
|
+
export const CountryListWrapper = styled.div`
|
|
20
|
+
padding-top: 17px;
|
|
21
|
+
`
|
|
22
|
+
|
|
23
|
+
export const CountryItem = styled.div`
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
margin: 10px 0px;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
width: fit-content;
|
|
29
|
+
|
|
30
|
+
span.name {
|
|
31
|
+
font-weight: 500;
|
|
32
|
+
font-size: 14px;
|
|
33
|
+
line-height: 18px;
|
|
34
|
+
margin-left: 10px;
|
|
35
|
+
user-select: none;
|
|
36
|
+
${props => props.theme.rtl && css`
|
|
37
|
+
margin-right: 10px;
|
|
38
|
+
margin-left: 0px;
|
|
39
|
+
`}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
svg {
|
|
43
|
+
font-size: 16px;
|
|
44
|
+
color: ${props => props.theme.colors.secundaryLight};
|
|
45
|
+
&.checked {
|
|
46
|
+
color: ${props => props.theme.colors.primary};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
`
|
|
50
|
+
|
|
51
|
+
export const ButtonWrapper = styled.div`
|
|
52
|
+
display: flex;
|
|
53
|
+
justify-content: flex-end;
|
|
54
|
+
position: sticky;
|
|
55
|
+
top: 100%;
|
|
56
|
+
button {
|
|
57
|
+
border-radius: 8px;
|
|
58
|
+
height: 44px;
|
|
59
|
+
}
|
|
60
|
+
`
|
|
61
|
+
|
|
62
|
+
export const PaginationWrapper = styled.div`
|
|
63
|
+
display: flex;
|
|
64
|
+
justify-content: flex-end;
|
|
65
|
+
`
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
} from './styles'
|
|
34
34
|
import { AnalyticsDriverOrders } from '../AnalyticsDriverOrders'
|
|
35
35
|
import { ReportsBrandFilter } from '../ReportsBrandFilter'
|
|
36
|
+
import { CountryFilter } from '../CountryFilter'
|
|
36
37
|
|
|
37
38
|
const DriverAnalyticsUI = (props) => {
|
|
38
39
|
const {
|
|
@@ -51,7 +52,8 @@ const DriverAnalyticsUI = (props) => {
|
|
|
51
52
|
busyTimesList,
|
|
52
53
|
completeSpendList,
|
|
53
54
|
pickUpSpendList,
|
|
54
|
-
deliverySpendList
|
|
55
|
+
deliverySpendList,
|
|
56
|
+
countryCode
|
|
55
57
|
} = props
|
|
56
58
|
|
|
57
59
|
const [, t] = useLanguage()
|
|
@@ -64,6 +66,7 @@ const DriverAnalyticsUI = (props) => {
|
|
|
64
66
|
const [driversFilterModal, setDriversFilterModal] = useState(false)
|
|
65
67
|
const [driverGroupModal, setDriverGroupModal] = useState(false)
|
|
66
68
|
const [isBrandFilter, setIsBrandFilter] = useState(false)
|
|
69
|
+
const [openCountryFilter, setOpenCountryFilter] = useState(true)
|
|
67
70
|
|
|
68
71
|
return (
|
|
69
72
|
<BusinessAnalyticsContainer>
|
|
@@ -80,6 +83,11 @@ const DriverAnalyticsUI = (props) => {
|
|
|
80
83
|
<h1>{t('DRIVERS_ANALYTICS', 'Drivers analytics')}</h1>
|
|
81
84
|
</HeaderTitleContainer>
|
|
82
85
|
<HeaderFilterContainer>
|
|
86
|
+
<BusinessFilterWrapper>
|
|
87
|
+
<Button onClick={() => setOpenCountryFilter(true)}>
|
|
88
|
+
{t('COUNTRY', 'Country')}
|
|
89
|
+
</Button>
|
|
90
|
+
</BusinessFilterWrapper>
|
|
83
91
|
<BusinessFilterWrapper>
|
|
84
92
|
<Button onClick={() => setIsBrandFilter(true)}>
|
|
85
93
|
{t('BRAND', 'Brand')} ({filterList?.franchises_id ? filterList?.franchises_id.length : t('ALL', 'All')})
|
|
@@ -124,12 +132,14 @@ const DriverAnalyticsUI = (props) => {
|
|
|
124
132
|
isOrders
|
|
125
133
|
filterList={filterList}
|
|
126
134
|
chartDataList={ordersList}
|
|
135
|
+
countryCode={countryCode}
|
|
127
136
|
/>
|
|
128
137
|
</div>
|
|
129
138
|
<div className='col-md-12 col-lg-6'>
|
|
130
139
|
<AnalyticsDriverOrders
|
|
131
140
|
filterList={filterList}
|
|
132
141
|
chartDataList={salesList}
|
|
142
|
+
countryCode={countryCode}
|
|
133
143
|
/>
|
|
134
144
|
</div>
|
|
135
145
|
<div className='col-md-12 col-lg-6'>
|
|
@@ -236,6 +246,18 @@ const DriverAnalyticsUI = (props) => {
|
|
|
236
246
|
onClose={() => setIsBrandFilter(false)}
|
|
237
247
|
/>
|
|
238
248
|
</Modal>
|
|
249
|
+
<Modal
|
|
250
|
+
width='450px'
|
|
251
|
+
height='650px'
|
|
252
|
+
padding='25px'
|
|
253
|
+
open={openCountryFilter}
|
|
254
|
+
onClose={() => setOpenCountryFilter(false)}
|
|
255
|
+
>
|
|
256
|
+
<CountryFilter
|
|
257
|
+
{...props}
|
|
258
|
+
onClose={() => setOpenCountryFilter(false)}
|
|
259
|
+
/>
|
|
260
|
+
</Modal>
|
|
239
261
|
</BusinessAnalyticsContainer>
|
|
240
262
|
)
|
|
241
263
|
}
|
|
@@ -56,24 +56,23 @@ export const HeaderFilterContainer = styled.div`
|
|
|
56
56
|
|
|
57
57
|
> div {
|
|
58
58
|
margin-top: 10px;
|
|
59
|
+
width: 100%;
|
|
60
|
+
> button, > div:not(.ordering-calendar) {
|
|
61
|
+
width: 100%;
|
|
62
|
+
}
|
|
59
63
|
}
|
|
60
64
|
|
|
61
|
-
@media (min-width:
|
|
65
|
+
@media (min-width: 600px) {
|
|
62
66
|
flex-direction: row;
|
|
63
67
|
|
|
64
68
|
> div {
|
|
65
69
|
margin-top: 0;
|
|
70
|
+
width: auto;
|
|
66
71
|
}
|
|
67
72
|
}
|
|
68
73
|
`
|
|
69
74
|
|
|
70
75
|
export const BusinessFilterWrapper = styled.div`
|
|
71
|
-
margin-left: 25px;
|
|
72
|
-
${props => props.theme.rtl && css`
|
|
73
|
-
margin-right: 25px;
|
|
74
|
-
margin-left: 0;
|
|
75
|
-
`}
|
|
76
|
-
|
|
77
76
|
> button {
|
|
78
77
|
background: #F8F9FA;
|
|
79
78
|
border-radius: 7.6px;
|
|
@@ -82,6 +81,14 @@ export const BusinessFilterWrapper = styled.div`
|
|
|
82
81
|
color: #748194;
|
|
83
82
|
border: none;
|
|
84
83
|
}
|
|
84
|
+
|
|
85
|
+
@media (min-width: 600px) {
|
|
86
|
+
margin-left: 25px;
|
|
87
|
+
${props => props.theme.rtl && css`
|
|
88
|
+
margin-right: 25px;
|
|
89
|
+
margin-left: 0;
|
|
90
|
+
`}
|
|
91
|
+
}
|
|
85
92
|
`
|
|
86
93
|
|
|
87
94
|
export const BusinessCalendarWrapper = styled(BusinessFilterWrapper)`
|
|
@@ -88,8 +88,8 @@ export const CalendarWrapper = styled.div`
|
|
|
88
88
|
> button {
|
|
89
89
|
padding: 7px 15px;
|
|
90
90
|
width: 100%;
|
|
91
|
-
color:
|
|
92
|
-
background:
|
|
91
|
+
color: ${props => props.theme.colors.secundaryContrast};
|
|
92
|
+
background: ${props => props.theme.colors.secundary};
|
|
93
93
|
border-radius: 7.6px;
|
|
94
94
|
border: none;
|
|
95
95
|
text-align: left;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import Skeleton from 'react-loading-skeleton'
|
|
3
3
|
import { useLanguage, ReportsBrandFilter as ReportsBrandFilterController } from 'ordering-components-admin-external'
|
|
4
|
-
import
|
|
5
|
-
import RiCheckboxFill from '@meronex/icons/ri/RiCheckboxFill'
|
|
4
|
+
import { CheckSquareFill as Checked, Square as UnChecked } from 'react-bootstrap-icons'
|
|
6
5
|
import { Button } from '../../../styles'
|
|
7
6
|
import {
|
|
8
7
|
ReportsBrandFilterContainer,
|
|
@@ -23,22 +22,13 @@ const ReportsBrandFilterUI = (props) => {
|
|
|
23
22
|
|
|
24
23
|
const [, t] = useLanguage()
|
|
25
24
|
|
|
26
|
-
const isCheckEnableSate = (id) => {
|
|
27
|
-
const found = brandIds?.find(brandId => brandId === id)
|
|
28
|
-
let valid = false
|
|
29
|
-
if (found) {
|
|
30
|
-
valid = true
|
|
31
|
-
}
|
|
32
|
-
return valid
|
|
33
|
-
}
|
|
34
|
-
|
|
35
25
|
return (
|
|
36
26
|
<>
|
|
37
27
|
<ReportsBrandFilterContainer>
|
|
38
28
|
{brandList.loading ? (
|
|
39
29
|
[...Array(10).keys()].map(i => (
|
|
40
30
|
<BrandFilterOption key={i}>
|
|
41
|
-
<Skeleton width={
|
|
31
|
+
<Skeleton width={18} height={18} />
|
|
42
32
|
<BusinessName>
|
|
43
33
|
<Skeleton width={120} height={24} />
|
|
44
34
|
</BusinessName>
|
|
@@ -50,9 +40,9 @@ const ReportsBrandFilterUI = (props) => {
|
|
|
50
40
|
onClick={handleChangeAllCheck}
|
|
51
41
|
>
|
|
52
42
|
{isAllCheck ? (
|
|
53
|
-
<
|
|
43
|
+
<Checked className='fill' />
|
|
54
44
|
) : (
|
|
55
|
-
<
|
|
45
|
+
<UnChecked />
|
|
56
46
|
)}
|
|
57
47
|
<BusinessName>{t('ALL', 'All')}</BusinessName>
|
|
58
48
|
</BrandFilterOption>
|
|
@@ -61,10 +51,10 @@ const ReportsBrandFilterUI = (props) => {
|
|
|
61
51
|
key={i}
|
|
62
52
|
onClick={() => handleChangeBrandId(brand?.id)}
|
|
63
53
|
>
|
|
64
|
-
{
|
|
65
|
-
<
|
|
54
|
+
{brandIds?.includes(brand.id) ? (
|
|
55
|
+
<Checked className='fill' />
|
|
66
56
|
) : (
|
|
67
|
-
<
|
|
57
|
+
<UnChecked />
|
|
68
58
|
)}
|
|
69
59
|
<BusinessName>{brand?.name}</BusinessName>
|
|
70
60
|
</BrandFilterOption>
|