ordering-ui-admin-external 1.42.15 → 1.43.0

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 (53) hide show
  1. package/_bundles/{ordering-ui-admin.b3638e5a67b10e3bcb5d.js → ordering-ui-admin.4cea57b9d7d8884bab6f.js} +2 -2
  2. package/_modules/components/Banners/index.js +62 -0
  3. package/_modules/components/Banners/styles.js +17 -0
  4. package/_modules/components/Delivery/DriversGroupGeneralForm/index.js +23 -23
  5. package/_modules/components/Delivery/DriversGroupGeneralForm/styles.js +28 -3
  6. package/_modules/components/Home/HomePage/index.js +5 -2
  7. package/_modules/components/Layout/index.js +3 -1
  8. package/_modules/components/MyProducts/AdvancedSettings/index.js +4 -0
  9. package/_modules/components/Orders/AllInOne/index.js +6 -1
  10. package/_modules/components/Orders/DeliveriesManager/index.js +3 -1
  11. package/_modules/components/Orders/DeliveryDashboard/index.js +9 -2
  12. package/_modules/components/Orders/DriverMultiSelector/index.js +9 -7
  13. package/_modules/components/Orders/DriversGroupTypeSelector/index.js +4 -3
  14. package/_modules/components/Orders/DriversGroupTypeSelector/styles.js +1 -1
  15. package/_modules/components/Orders/OrderLogisticInformation/index.js +24 -2
  16. package/_modules/components/Orders/OrdersFilterGroup/index.js +22 -24
  17. package/_modules/components/Orders/OrdersHeaderFilterGroup/index.js +101 -0
  18. package/_modules/components/Orders/OrdersHeaderFilterGroup/styles.js +20 -0
  19. package/_modules/components/Orders/OrdersManager/index.js +5 -0
  20. package/_modules/components/Settings/SettingsList/index.js +19 -3
  21. package/_modules/components/Users/CustomersListing/index.js +2 -1
  22. package/_modules/contexts/FilterValuesContext/index.js +75 -0
  23. package/_modules/index.js +26 -0
  24. package/_modules/styles/Buttons/index.js +34 -23
  25. package/index-template.js +8 -2
  26. package/package.json +2 -2
  27. package/src/components/Banners/index.js +69 -0
  28. package/src/components/Banners/styles.js +68 -0
  29. package/src/components/Delivery/DriversGroupGeneralForm/index.js +36 -18
  30. package/src/components/Delivery/DriversGroupGeneralForm/styles.js +83 -0
  31. package/src/components/Home/HomePage/index.js +2 -1
  32. package/src/components/Layout/index.js +1 -1
  33. package/src/components/MyProducts/AdvancedSettings/index.js +2 -1
  34. package/src/components/Orders/AllInOne/index.js +6 -0
  35. package/src/components/Orders/DeliveriesManager/index.js +2 -0
  36. package/src/components/Orders/DeliveryDashboard/index.js +9 -1
  37. package/src/components/Orders/DriverMultiSelector/index.js +6 -5
  38. package/src/components/Orders/DriversGroupTypeSelector/index.js +2 -2
  39. package/src/components/Orders/DriversGroupTypeSelector/styles.js +2 -0
  40. package/src/components/Orders/OrderLogisticInformation/index.js +21 -3
  41. package/src/components/Orders/OrdersCards/index.js +1 -1
  42. package/src/components/Orders/OrdersFilterGroup/index.js +30 -18
  43. package/src/components/Orders/OrdersHeaderFilterGroup/index.js +94 -0
  44. package/src/components/Orders/OrdersHeaderFilterGroup/styles.js +68 -0
  45. package/src/components/Orders/OrdersManager/index.js +6 -0
  46. package/src/components/Settings/SettingsList/index.js +19 -1
  47. package/src/components/Users/CustomersListing/index.js +4 -1
  48. package/src/contexts/FilterValuesContext/index.js +60 -0
  49. package/src/index.js +6 -0
  50. package/src/styles/Buttons/index.js +11 -0
  51. package/template/app.js +14 -1
  52. package/template/config.json +1 -1
  53. /package/_bundles/{ordering-ui-admin.b3638e5a67b10e3bcb5d.js.LICENSE.txt → ordering-ui-admin.4cea57b9d7d8884bab6f.js.LICENSE.txt} +0 -0
@@ -0,0 +1,68 @@
1
+ import styled from 'styled-components'
2
+
3
+ export const Container = styled.div`
4
+ width: 100vw;
5
+ position: fixed;
6
+ top: 0;
7
+ left: 0;
8
+ z-index: 10000;
9
+ `
10
+
11
+ export const Banner = styled.div`
12
+ display: flex;
13
+ justify-content: space-between;
14
+ align-items: center;
15
+ width: 100%;
16
+ background-color: ${props => props.theme.colors.warning100};
17
+ padding: 20px;
18
+ border-radius: 8px;
19
+
20
+ @media (max-width: 768px) {
21
+ flex-direction: column;
22
+ height: auto;
23
+ }
24
+ `
25
+
26
+ export const Icon = styled.div`
27
+ flex: 1;
28
+ max-width: 5%;
29
+ text-align: center;
30
+
31
+ @media (max-width: 768px) {
32
+ max-width: 100%;
33
+ margin-bottom: 10px;
34
+ }
35
+ `
36
+
37
+ export const Content = styled.div`
38
+ flex: 2;
39
+ max-width: 80%;
40
+ text-align: left;
41
+
42
+ h1, p {
43
+ font-size: 1rem;
44
+ margin: 0;
45
+ padding: 0;
46
+ }
47
+
48
+ h1 {
49
+ font-weight: bold;
50
+ }
51
+
52
+ @media (max-width: 768px) {
53
+ max-width: 100%;
54
+ text-align: center;
55
+ margin-bottom: 10px;
56
+ }
57
+ `
58
+
59
+ export const ButtonWrap = styled.div`
60
+ flex: 1;
61
+ max-width: 15%;
62
+ text-align: center;
63
+
64
+ @media (max-width: 768px) {
65
+ max-width: 100%;
66
+ margin-bottom: 10px;
67
+ }
68
+ `
@@ -1,15 +1,21 @@
1
1
  import React, { useState, useEffect } from 'react'
2
2
  import { useLanguage, useSession } from 'ordering-components-admin-external'
3
3
  import { useForm } from 'react-hook-form'
4
- import { Input, Button, SecondSelect as DefaultSelect } from '../../../styles'
4
+ import { Input, Button, SecondSelect as DefaultSelect, Checkbox } from '../../../styles'
5
5
  import { Alert } from '../../Shared'
6
6
  import { DriversGroupDrivers } from '../DriversGroupDrivers'
7
7
  import { DriversGroupCompanies } from '../DriversGroupCompanies'
8
8
 
9
9
  import {
10
10
  Container,
11
- InputWrapper
11
+ DriverManagerContainer,
12
+ DriverManagerWrapper,
13
+ Image,
14
+ InputWrapper,
15
+ ManagerInfoContainer,
16
+ WrapperImage
12
17
  } from './styles'
18
+ import FaUserAlt from '@meronex/icons/fa/FaUserAlt'
13
19
 
14
20
  export const DriversGroupGeneralForm = (props) => {
15
21
  const {
@@ -21,7 +27,9 @@ export const DriversGroupGeneralForm = (props) => {
21
27
  handleAddDriversGroup,
22
28
  actionDisabled,
23
29
  isTourOpen,
24
- handleNextClick
30
+ handleNextClick,
31
+ selectedDriverManager,
32
+ handleSelectDriverManager
25
33
  } = props
26
34
 
27
35
  const [, t] = useLanguage()
@@ -34,13 +42,6 @@ export const DriversGroupGeneralForm = (props) => {
34
42
  { value: 1, content: t('DRIVER_COMPANIES', 'Driver companies') }
35
43
  ]
36
44
 
37
- const driversManagersOptions = driversManagers.map(manager => {
38
- return {
39
- value: manager.id,
40
- content: <div>{manager?.name} {manager?.lastname}</div>
41
- }
42
- })
43
-
44
45
  const priorityOptions = [
45
46
  { value: -1, content: t('LOW', 'Low') },
46
47
  { value: 0, content: t('NORMAL', 'Normal') },
@@ -127,17 +128,34 @@ export const DriversGroupGeneralForm = (props) => {
127
128
  autoComplete='off'
128
129
  />
129
130
  </InputWrapper>
131
+
130
132
  {user?.level !== 5 && (
131
133
  <InputWrapper>
132
134
  <label>{t('DRIVER_MANAGER', 'Driver manager')}</label>
133
- <DefaultSelect
134
- isSecondIcon
135
- placeholder={t('SELECT_MANAGER', 'Select driver manager')}
136
- options={driversManagersOptions}
137
- defaultValue={changesState?.administrator_id ?? driversGroupState.driversGroup?.administrator_id}
138
- optionInnerMaxHeight='60vh'
139
- onChange={val => handleChangesState({ administrator_id: val })}
140
- />
135
+ <DriverManagerContainer>
136
+ {driversManagers.map(driverManager => (
137
+ <DriverManagerWrapper
138
+ key={driverManager.id}
139
+ >
140
+ <Checkbox
141
+ value={driverManager?.id}
142
+ checked={selectedDriverManager.includes(driverManager.id)}
143
+ onChange={e => handleSelectDriverManager(driverManager.id, e.target.checked)}
144
+ />
145
+ <WrapperImage>
146
+ {driverManager?.photo ? (
147
+ <Image bgimage={driverManager?.photo} alt='driverManager' />
148
+ ) : (
149
+ <FaUserAlt />
150
+ )}
151
+ </WrapperImage>
152
+ <ManagerInfoContainer>
153
+ <p>{driverManager?.name}</p>
154
+ <p>{driverManager?.email}</p>
155
+ </ManagerInfoContainer>
156
+ </DriverManagerWrapper>
157
+ ))}
158
+ </DriverManagerContainer>
141
159
  </InputWrapper>
142
160
  )}
143
161
  <InputWrapper>
@@ -1,3 +1,4 @@
1
+ import React from 'react'
1
2
  import styled, { css } from 'styled-components'
2
3
 
3
4
  export const Container = styled.form`
@@ -42,3 +43,85 @@ export const InputWrapper = styled.div`
42
43
  }
43
44
  }
44
45
  `
46
+
47
+ export const DriverManagerContainer = styled.div`
48
+ height: calc(100% - 130px);
49
+ overflow: auto;
50
+ max-height: 250px;
51
+ `
52
+
53
+ export const DriverManagerWrapper = styled.div`
54
+ display: flex;
55
+ align-items: center;
56
+ padding: 10px 0;
57
+ border-bottom: 1px solid ${props => props.theme.colors.borderColor};
58
+
59
+ p {
60
+ margin: 0px;
61
+ font-size: 12px;
62
+ }
63
+
64
+ ${({ isDisabed }) => isDisabed && css`
65
+ pointer-events: none;
66
+ `}
67
+ `
68
+
69
+ export const ManagerInfoContainer = styled.div`
70
+ p {
71
+ margin: 0px;
72
+ &:first-child {
73
+ font-weight: 500;
74
+ font-size: 13px;
75
+ }
76
+
77
+ &:last-child {
78
+ font-size: 12px;
79
+ color: ${props => props.theme.colors.lightGray};
80
+ }
81
+ }
82
+ `
83
+
84
+ export const WrapperImage = styled.div`
85
+ max-width: 40px;
86
+ max-height: 40px;
87
+ height: 40px;
88
+ width: 40px;
89
+ ${({ isSkeleton }) => !isSkeleton && css`
90
+ border: 1px solid #E3E3E3;
91
+ `}
92
+ border-radius: 8px;
93
+
94
+ svg {
95
+ width: 100%;
96
+ height: 100%;
97
+ padding: 7px;
98
+ box-sizing: border-box;
99
+ border-radius: 50%;
100
+ }
101
+
102
+ margin: 0 10px;
103
+ `
104
+
105
+ const ImageStyled = styled.div`
106
+ display: flex;
107
+ width: 100%;
108
+ height: 100%;
109
+ box-sizing: border-box;
110
+ position: relative;
111
+ background-repeat: no-repeat, repeat;
112
+ background-size: cover;
113
+ object-fit: cover;
114
+ background-position: center;
115
+ border-radius: 8px;
116
+ `
117
+
118
+ export const Image = (props) => {
119
+ return (
120
+ <ImageStyled
121
+ {...props}
122
+ style={{ backgroundImage: `url(${props.bgimage})` }}
123
+ >
124
+ {props.children}
125
+ </ImageStyled>
126
+ )
127
+ }
@@ -4,6 +4,7 @@ import { Line } from 'react-chartjs-2'
4
4
  import moment from 'moment'
5
5
  import { IconButton, Button } from '../../../styles/Buttons'
6
6
  import { useInfoShare } from '../../../contexts/InfoShareContext'
7
+ import { useProjectState } from '../../../contexts/ProjectContext'
7
8
  import Skeleton from 'react-loading-skeleton'
8
9
  import { useWindowSize } from '../../../hooks/useWindowSize'
9
10
  import { useTheme } from 'styled-components'
@@ -51,7 +52,6 @@ import {
51
52
 
52
53
  const HomeUI = (props) => {
53
54
  const {
54
- projectStatus,
55
55
  ordersList,
56
56
  todaySalelsList,
57
57
  monthSalesList,
@@ -65,6 +65,7 @@ const HomeUI = (props) => {
65
65
  const [{ isCollapse }, { handleMenuCollapse }] = useInfoShare()
66
66
  const [timeAxes, setTimeAxes] = useState([])
67
67
  const [events] = useEvent()
68
+ const [projectStatus] = useProjectState()
68
69
  const { width } = useWindowSize()
69
70
  const [{ parsePrice }] = useUtils()
70
71
  const [sessionState] = useSession()
@@ -2,7 +2,7 @@ import React from 'react'
2
2
 
3
3
  export const Layout = (props) => {
4
4
  return (
5
- <div className='d-flex' style={{ maxWidth: '100vw', width: '100vw' }}>
5
+ <div className='d-flex' style={{ maxWidth: '100vw', width: '100vw', paddingTop: props.pt ?? 0 }}>
6
6
  {props.children}
7
7
  </div>
8
8
  )
@@ -92,7 +92,8 @@ export const AdvancedSettings = (props) => {
92
92
  { name: t('DESCRIPTION', 'Description'), type: 'hidden', path: 'business_view.components.products.components.product.components.description.hidden' },
93
93
  { name: t('IMAGE', 'Image'), type: 'hidden', path: 'business_view.components.products.components.product.components.image.hidden' },
94
94
  { name: t('POSITION', 'Position'), type: 'position', path: 'business_view.components.products.components.product.components.image.position' },
95
- { name: t('ADD_TO_CART_BUTTON', 'Add to cart button'), type: 'hidden', path: 'business_view.components.products.components.add_to_cart_button.hidden' }
95
+ { name: t('ADD_TO_CART_BUTTON', 'Add to cart button'), type: 'hidden', path: 'business_view.components.products.components.add_to_cart_button.hidden' },
96
+ { name: t('FAVORITE', 'Favorite'), type: 'hidden', path: 'business_view.components.products.components.product.components.favorite.hidden' }
96
97
  ]
97
98
 
98
99
  const reviewsPopups = [
@@ -1,6 +1,7 @@
1
1
  import React, { useState, useEffect } from 'react'
2
2
  import { useLocation } from 'react-router-dom'
3
3
  import { useLanguage, useSession, OrdersManage as OrdersManageController } from 'ordering-components-admin-external'
4
+ import { OrdersHeaderFilterGroup } from '../OrdersHeaderFilterGroup'
4
5
  import { OrderStatusFilterBar } from '../OrderStatusFilterBar'
5
6
  import { OrdersContentHeader } from '../OrdersContentHeader'
6
7
  import { OrderDetails } from '../OrderDetails'
@@ -229,6 +230,11 @@ const OrdersManagerUI = (props) => {
229
230
  />
230
231
  </DriversContainer>
231
232
  <OrdersContainer showCompressedInfo>
233
+ <OrdersHeaderFilterGroup
234
+ driverGroupList={driverGroupList}
235
+ driversList={driversList}
236
+ handleChangeFilterValues={handleChangeFilterValues}
237
+ />
232
238
  <OrderStatusFilterBar
233
239
  isUseQuery={isUseQuery}
234
240
  selectedOrderStatus={ordersStatusGroup}
@@ -116,6 +116,8 @@ const DeliveriesManagerUI = (props) => {
116
116
  numberOfOrdersBySubstatus={numberOfOrdersBySubstatus}
117
117
  isUseQuery={isUseQuery}
118
118
  franchisesList={props.franchisesList}
119
+ driverGroupList={driverGroupList}
120
+ handleChangeFilterValues={handleChangeFilterValues}
119
121
  />
120
122
  </WrapItemView>
121
123
  </OrdersContent>
@@ -2,6 +2,7 @@ import React, { useState } from 'react'
2
2
  import { useConfig } from 'ordering-components-admin-external'
3
3
  import { DeliveriesLocation } from '../DeliveriesLocation'
4
4
  import { OrdersDashboardList } from '../OrdersDashboardList'
5
+ import { OrdersHeaderFilterGroup } from '../OrdersHeaderFilterGroup'
5
6
  import { OrderStatusFilterBar } from '../OrderStatusFilterBar'
6
7
  import { OrderStatusSubFilter } from '../OrderStatusSubFilter'
7
8
 
@@ -22,7 +23,9 @@ export const DeliveryDashboard = (props) => {
22
23
  handleSelectedSubOrderStatus,
23
24
  ordersAmountByStatus,
24
25
  setOrdersAmountByStatus,
25
- isUseQuery
26
+ isUseQuery,
27
+ driverGroupList,
28
+ handleChangeFilterValues
26
29
  } = props
27
30
 
28
31
  const ordersDashboardListProps = {
@@ -52,6 +55,11 @@ export const DeliveryDashboard = (props) => {
52
55
  return (
53
56
  <DeliveryDashboardContainer>
54
57
  <OrdersContainer>
58
+ <OrdersHeaderFilterGroup
59
+ driverGroupList={driverGroupList}
60
+ driversList={driversList}
61
+ handleChangeFilterValues={handleChangeFilterValues}
62
+ />
55
63
  <FilterContainer>
56
64
  <OrderStatusFilterBar
57
65
  isUseQuery={isUseQuery}
@@ -24,16 +24,17 @@ const DriverMultiSelectorUI = (props) => {
24
24
  filterValues
25
25
  } = props
26
26
 
27
- const [, t] = useLanguage()
27
+ const [{ dictionary }] = useLanguage()
28
28
  const theme = useTheme()
29
29
  const [driversMultiOptionList, setDriversMultiOptionList] = useState([])
30
30
  const [searchValue, setSearchValue] = useState(null)
31
- const driversLoading = [{ value: 'default', content: <Option small={small}>{t('LOADING', 'loading')}...</Option> }]
31
+ const driversLoading = [{ value: 'default', content: <Option small={small}>{dictionary?.LOADING ?? 'loading'}...</Option> }]
32
+
32
33
  useEffect(() => {
33
34
  const _driversOptionList = [
34
35
  {
35
36
  value: 'default',
36
- content: <Option padding='0px'><span>{t('SELECT_DRIVER', 'Select driver')}</span></Option>,
37
+ content: <Option padding='0px'><span>{dictionary?.SELECT_DRIVER ?? 'Select driver'}</span></Option>,
37
38
  color: 'primary',
38
39
  showDisable: true
39
40
  }
@@ -57,7 +58,7 @@ const DriverMultiSelectorUI = (props) => {
57
58
  <OptionContent>
58
59
  <DriverNameContainer className='driver-info'>
59
60
  <DriverName small={small}>{driver.name} {driver.lastname}</DriverName>
60
- <DriverText small={small}>{t('DRIVER', 'Driver')}</DriverText>
61
+ <DriverText small={small}>{dictionary?.DRIVER ?? 'Driver'}</DriverText>
61
62
  </DriverNameContainer>
62
63
  </OptionContent>
63
64
  </Option>
@@ -73,7 +74,7 @@ const DriverMultiSelectorUI = (props) => {
73
74
  }
74
75
  }, [driversList, defaultValue, searchValue])
75
76
 
76
- const Placeholder = <PlaceholderTitle>{t('SELECT_DRIVER', 'Select driver')}</PlaceholderTitle>
77
+ const Placeholder = <PlaceholderTitle>{dictionary?.SELECT_DRIVER ?? 'Select driver'}</PlaceholderTitle>
77
78
 
78
79
  return (
79
80
  <>
@@ -12,7 +12,7 @@ export const DriversGroupTypeSelector = (props) => {
12
12
  title
13
13
  } = props
14
14
 
15
- const [, t] = useLanguage()
15
+ const [{ dictionary }] = useLanguage()
16
16
 
17
17
  const [searchValue, setSearchValue] = useState('')
18
18
 
@@ -22,7 +22,7 @@ export const DriversGroupTypeSelector = (props) => {
22
22
  </PlaceholderTitle>
23
23
  )
24
24
  const [groupTypes, setGroupTypes] = useState([])
25
- const groupTypesLoading = [{ value: 'default', content: <Option>{t('GROUP_LOADING', 'Group loading')}...</Option> }]
25
+ const groupTypesLoading = [{ value: 'default', content: <Option>{dictionary?.GROUP_LOADING ?? 'Group loading'}...</Option> }]
26
26
 
27
27
  useEffect(() => {
28
28
  const _groupList = []
@@ -4,6 +4,8 @@ export const PlaceholderTitle = styled.div`
4
4
  display: flex;
5
5
  align-items: center;
6
6
  padding: 10px;
7
+ line-height:15px;
8
+ font-size:14px;
7
9
  `
8
10
 
9
11
  export const Option = styled.div`
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { LogisticInformation as LogisticInformationController, useLanguage, useUtils } from 'ordering-components-admin-external'
2
+ import { LogisticInformation as LogisticInformationController, useLanguage, useUtils, useConfig } from 'ordering-components-admin-external'
3
3
  import Skeleton from 'react-loading-skeleton'
4
4
  import { Button } from '../../../styles'
5
5
  import {
@@ -13,7 +13,8 @@ const LogisticInformationUI = (props) => {
13
13
  const { logisticInformation, getLogistics } = props
14
14
  const [, t] = useLanguage()
15
15
 
16
- const [{ parseDate, parseDistance }] = useUtils()
16
+ const [{ parseDate, parseNumber }] = useUtils()
17
+ const [configState] = useConfig()
17
18
 
18
19
  const getOrderStatus = (status) => {
19
20
  const orderStatus = [
@@ -50,6 +51,23 @@ const LogisticInformationUI = (props) => {
50
51
  return objectStatus && objectStatus
51
52
  }
52
53
 
54
+ const calculateDistanceParse = (distance, options = {}) => {
55
+ distance = parseFloat(distance) || 0
56
+ let unit = options?.unit || 'KM'
57
+ if (configState.configs.distance_unit_km?.value === '1') {
58
+ unit = 'KM'
59
+ }
60
+ if (configState.configs.distance_unit?.value) {
61
+ unit = configState.configs.distance_unit?.value
62
+ }
63
+ if (unit.toUpperCase() === 'MI') {
64
+ const dist = distance * 0.621371 / 1000
65
+ return `${parseNumber(dist, options)} ${t('MI', 'mi')}`
66
+ } else {
67
+ return `${parseNumber(distance / 1000, options)} ${t('KM', 'km')}`
68
+ }
69
+ }
70
+
53
71
  return (
54
72
  <>
55
73
  {logisticInformation.loading ? (
@@ -77,7 +95,7 @@ const LogisticInformationUI = (props) => {
77
95
  </Button>
78
96
  <BubbleConsole>
79
97
  <UppercaseText><strong>{t('DISTANCE_CUSTOMER_FROM_BUSINESS', 'DISTANCE FROM CUSTOMER TO BUSINESS')}</strong></UppercaseText>
80
- : {parseDistance((logisticInformation?.data?.distance_customer_from_business / 1000))}
98
+ : {calculateDistanceParse((logisticInformation?.data?.distance_customer_from_business))}
81
99
  </BubbleConsole>
82
100
  <>
83
101
  <BubbleConsole>
@@ -264,7 +264,7 @@ export const OrdersCards = (props) => {
264
264
  }
265
265
  </p>
266
266
  </div>
267
- )}
267
+ )}
268
268
  </CardHeading>
269
269
  {isMessagesView && order?.unread_count > 0 && (
270
270
  <UnreadMessageCounter>
@@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef } from 'react'
2
2
  import { PlusCircle, Trash3, Funnel } from 'react-bootstrap-icons'
3
3
  import MdcFilterOff from '@meronex/icons/mdc/MdcFilterOff'
4
4
  import TiWarningOutline from '@meronex/icons/ti/TiWarningOutline'
5
- import { useLanguage, OrdersFilter as OrdersFilterController } from 'ordering-components-admin-external'
5
+ import { useLanguage, useConfig, OrdersFilter as OrdersFilterController } from 'ordering-components-admin-external'
6
6
  import { BusinessesSelector } from '../BusinessesSelector'
7
7
  import { DriversGroupTypeSelector } from '../DriversGroupTypeSelector'
8
8
  import { DateTypeSelector } from '../DateTypeSelector'
@@ -16,6 +16,7 @@ import { Button, IconButton, Input, LinkButton } from '../../../styles'
16
16
  import { CurrencyFilter } from '../CurrencyFilter'
17
17
  import { getUniqueId } from '../../../utils'
18
18
  import { Select } from '../../../styles/Select/FirstSelect'
19
+ import { useFilterValues } from '../../../contexts/FilterValuesContext'
19
20
 
20
21
  import {
21
22
  FilterGroupListContainer,
@@ -71,6 +72,8 @@ const OrdersFilterGroupUI = (props) => {
71
72
  const [isShow, setIsShow] = useState(false)
72
73
  const [filterApplied, setFilterApplied] = useState(false)
73
74
  const metafieldRef = useRef()
75
+ const [{ configs }] = useConfig()
76
+ const configFilter = configs?.filter_order_options?.value.split('|').map(value =>(value)) || []
74
77
 
75
78
  const logisticStatusList = [
76
79
  { value: 0, content: <Option>{t('PENDING', 'Pending')}<LogisticStatusDot status={0} /></Option> },
@@ -175,13 +178,19 @@ const OrdersFilterGroupUI = (props) => {
175
178
  value={filterValues?.orderId || ''}
176
179
  onChange={(e) => handleChangeOrderId(e)}
177
180
  />
178
- <Input
179
- type='text'
180
- placeholder={t('EXTERNAL_ID', 'External Id')}
181
- autoComplete='off'
182
- value={filterValues?.externalId || ''}
183
- onChange={handleChangeExternalId}
181
+ <DateTypeSelector
182
+ filterValues={filterValues}
183
+ handleChangeDateType={handleChangeDateType}
184
+ handleChangeFromDate={handleChangeFromDate}
185
+ handleChangeEndDate={handleChangeEndDate}
184
186
  />
187
+ {/* <Input
188
+ type='text'
189
+ placeholder={t('EXTERNAL_ID', 'External Id')}
190
+ autoComplete='off'
191
+ value={filterValues?.externalId || ''}
192
+ onChange={handleChangeExternalId}
193
+ /> */}
185
194
  </WrapperRow>
186
195
  <WrapperRow>
187
196
  <Input
@@ -222,14 +231,19 @@ const OrdersFilterGroupUI = (props) => {
222
231
  filterValues={filterValues.groupTypes}
223
232
  title={t('DRIVER_GROUP_ASSIGNED', 'Driver group (assigned)')}
224
233
  />
225
- <DriversGroupTypeSelector
234
+ <BusinessesSelector
235
+ filterValues={filterValues}
236
+ businessesList={businessesList}
237
+ handleChangeBusinesses={handleChangeBusinesses}
238
+ />
239
+ {/* <DriversGroupTypeSelector
226
240
  driverGroupList={driverGroupList}
227
241
  handleChangeGroup={handleChangeGroupUnassigned}
228
242
  filterValues={filterValues.groupTypesUnassigned}
229
243
  title={t('DRIVER_GROUP_NOT_ASSIGNED', 'Driver group (general)')}
230
- />
244
+ /> */}
231
245
  </WrapperRow>
232
- <WrapperRow>
246
+ {/* <WrapperRow>
233
247
  <BusinessesSelector
234
248
  filterValues={filterValues}
235
249
  businessesList={businessesList}
@@ -240,7 +254,7 @@ const OrdersFilterGroupUI = (props) => {
240
254
  filterValues={filterValues}
241
255
  handleChangeDriver={handleChangeDriver}
242
256
  />
243
- </WrapperRow>
257
+ </WrapperRow> */}
244
258
  <WrapperRow>
245
259
  <CountryFilter
246
260
  filterValues={filterValues}
@@ -295,12 +309,6 @@ const OrdersFilterGroupUI = (props) => {
295
309
  onChange={(value) => handleChangeChildFilterValue({ assigned: value })}
296
310
  />
297
311
  </SelectWrapper>
298
- <DateTypeSelector
299
- filterValues={filterValues}
300
- handleChangeDateType={handleChangeDateType}
301
- handleChangeFromDate={handleChangeFromDate}
302
- handleChangeEndDate={handleChangeEndDate}
303
- />
304
312
  </WrapperRow>
305
313
  {filterValues?.metafield.map(item => (
306
314
  <WrapperRow key={item.id}>
@@ -388,10 +396,14 @@ const OrdersFilterGroupUI = (props) => {
388
396
  }
389
397
 
390
398
  export const OrdersFilterGroup = (props) => {
399
+ const [filterValues, { handleFilterValues }] = useFilterValues()
400
+
391
401
  const FilterControlProps = {
392
402
  ...props,
393
403
  UIComponent: OrdersFilterGroupUI,
394
- driverGroupList: props.driverGroupList
404
+ driverGroupList: props.driverGroupList,
405
+ filterValues: filterValues,
406
+ setFilterValues: handleFilterValues
395
407
  }
396
408
  return (
397
409
  <>