ordering-ui-admin-external 1.42.16 → 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 (41) hide show
  1. package/_bundles/{ordering-ui-admin.fe5b500282e81ee0fd32.js → ordering-ui-admin.4cea57b9d7d8884bab6f.js} +2 -2
  2. package/_modules/components/Delivery/DriversGroupGeneralForm/index.js +23 -23
  3. package/_modules/components/Delivery/DriversGroupGeneralForm/styles.js +28 -3
  4. package/_modules/components/MyProducts/AdvancedSettings/index.js +4 -0
  5. package/_modules/components/Orders/AllInOne/index.js +6 -1
  6. package/_modules/components/Orders/DeliveriesManager/index.js +3 -1
  7. package/_modules/components/Orders/DeliveryDashboard/index.js +9 -2
  8. package/_modules/components/Orders/DriverMultiSelector/index.js +9 -7
  9. package/_modules/components/Orders/DriversGroupTypeSelector/index.js +4 -3
  10. package/_modules/components/Orders/DriversGroupTypeSelector/styles.js +1 -1
  11. package/_modules/components/Orders/OrderLogisticInformation/index.js +24 -2
  12. package/_modules/components/Orders/OrdersFilterGroup/index.js +22 -24
  13. package/_modules/components/Orders/OrdersHeaderFilterGroup/index.js +101 -0
  14. package/_modules/components/Orders/OrdersHeaderFilterGroup/styles.js +20 -0
  15. package/_modules/components/Orders/OrdersManager/index.js +5 -0
  16. package/_modules/components/Settings/SettingsList/index.js +19 -3
  17. package/_modules/components/Users/CustomersListing/index.js +2 -1
  18. package/_modules/contexts/FilterValuesContext/index.js +75 -0
  19. package/_modules/index.js +19 -0
  20. package/index-template.js +5 -2
  21. package/package.json +2 -2
  22. package/src/components/Delivery/DriversGroupGeneralForm/index.js +36 -18
  23. package/src/components/Delivery/DriversGroupGeneralForm/styles.js +83 -0
  24. package/src/components/MyProducts/AdvancedSettings/index.js +2 -1
  25. package/src/components/Orders/AllInOne/index.js +6 -0
  26. package/src/components/Orders/DeliveriesManager/index.js +2 -0
  27. package/src/components/Orders/DeliveryDashboard/index.js +9 -1
  28. package/src/components/Orders/DriverMultiSelector/index.js +6 -5
  29. package/src/components/Orders/DriversGroupTypeSelector/index.js +2 -2
  30. package/src/components/Orders/DriversGroupTypeSelector/styles.js +2 -0
  31. package/src/components/Orders/OrderLogisticInformation/index.js +21 -3
  32. package/src/components/Orders/OrdersCards/index.js +1 -1
  33. package/src/components/Orders/OrdersFilterGroup/index.js +30 -18
  34. package/src/components/Orders/OrdersHeaderFilterGroup/index.js +94 -0
  35. package/src/components/Orders/OrdersHeaderFilterGroup/styles.js +68 -0
  36. package/src/components/Orders/OrdersManager/index.js +6 -0
  37. package/src/components/Settings/SettingsList/index.js +19 -1
  38. package/src/components/Users/CustomersListing/index.js +4 -1
  39. package/src/contexts/FilterValuesContext/index.js +60 -0
  40. package/src/index.js +4 -0
  41. /package/_bundles/{ordering-ui-admin.fe5b500282e81ee0fd32.js.LICENSE.txt → ordering-ui-admin.4cea57b9d7d8884bab6f.js.LICENSE.txt} +0 -0
@@ -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
  <>
@@ -0,0 +1,94 @@
1
+ import React, { useState, useEffect, useRef } from 'react'
2
+ import { useLanguage, useConfig, OrdersFilter as OrdersFilterController } from 'ordering-components-admin-external'
3
+ import { DriversGroupTypeSelector } from '../DriversGroupTypeSelector'
4
+ import { DriverMultiSelector } from '../DriverMultiSelector'
5
+ import { Input } from '../../../styles'
6
+ import {
7
+ WrapperRow
8
+ } from './styles'
9
+ import { useFilterValues } from '../../../contexts/FilterValuesContext'
10
+
11
+ const OrdersHeaderFilterGroupUI = (props) => {
12
+ const {
13
+ filterValues,
14
+ driverGroupList,
15
+ driversList,
16
+ handleChangeDriver,
17
+ handleChangeFilterValues,
18
+ handleChangeExternalId,
19
+ handleChangeGroupUnassigned
20
+ } = props
21
+
22
+ const [{ dictionary }] = useLanguage()
23
+ const [isShow, setIsShow] = useState(false)
24
+ const metafieldRef = useRef()
25
+ const [{ configs, loading }] = useConfig()
26
+ const configFilter = configs?.filter_order_options?.value.split('|').map(value => (value)) || []
27
+
28
+ const handleClickOutside = (e) => {
29
+ if (!isShow) return
30
+ const outsideCalendar = !metafieldRef.current?.contains(e.target)
31
+ if (outsideCalendar) {
32
+ setIsShow(false)
33
+ }
34
+ }
35
+
36
+ useEffect(() => {
37
+ window.addEventListener('mouseup', handleClickOutside)
38
+ return () => window.removeEventListener('mouseup', handleClickOutside)
39
+ }, [isShow])
40
+
41
+ useEffect(() => {
42
+ if (Object.keys(filterValues).length > 0) {
43
+ handleChangeFilterValues(filterValues)
44
+ }
45
+ }, [filterValues])
46
+
47
+ return (
48
+ <>
49
+ <WrapperRow>
50
+ {!loading && configFilter.includes('external_id') && (
51
+ <Input
52
+ type='text'
53
+ placeholder={dictionary?.EXTERNAL_ID ?? 'External Id'}
54
+ autoComplete='off'
55
+ value={filterValues?.externalId || ''}
56
+ onChange={handleChangeExternalId}
57
+ />
58
+ )}
59
+ {!loading && configFilter.includes('driver') && (
60
+ <DriverMultiSelector
61
+ drivers={driversList.drivers}
62
+ filterValues={filterValues}
63
+ handleChangeDriver={handleChangeDriver}
64
+ />
65
+ )}
66
+ {!loading && configFilter.includes('driver_group_general') && (
67
+ <DriversGroupTypeSelector
68
+ driverGroupList={driverGroupList}
69
+ handleChangeGroup={handleChangeGroupUnassigned}
70
+ filterValues={filterValues.groupTypesUnassigned}
71
+ title={dictionary?.DRIVER_GROUP_NOT_ASSIGNED ?? 'Driver group (general)'}
72
+ />
73
+ )}
74
+ </WrapperRow>
75
+ </>
76
+ )
77
+ }
78
+
79
+ export const OrdersHeaderFilterGroup = (props) => {
80
+ const [filterValues, { handleFilterValues }] = useFilterValues()
81
+
82
+ const FilterControlProps = {
83
+ ...props,
84
+ UIComponent: OrdersHeaderFilterGroupUI,
85
+ driverGroupList: props.driverGroupList,
86
+ filterValues: filterValues,
87
+ setFilterValues: handleFilterValues
88
+ }
89
+ return (
90
+ <>
91
+ <OrdersFilterController {...FilterControlProps} />
92
+ </>
93
+ )
94
+ }
@@ -0,0 +1,68 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const WrapperRow = styled.div`
4
+ display: flex;
5
+ width: 100% !important;
6
+ flex-direction: column;
7
+ justify-content: space-between;
8
+ padding-top: 10px;
9
+ padding-bottom: 0px;
10
+
11
+ & > div {
12
+ width: 100%;
13
+ height: 47px;
14
+ margin-bottom: 20px;
15
+ background-color: ${props => props.theme.colors.secundary};
16
+ border: none;
17
+ font-size: 14px;
18
+ border-radius: 8px;
19
+ > div:first-child {
20
+ height: 100%;
21
+ }
22
+ }
23
+
24
+ .order-status-multi-select {
25
+ p {
26
+ padding: 0;
27
+ color: ${props => props.theme.colors.headingColor} !important;
28
+ }
29
+ }
30
+
31
+ .date-filter-container {
32
+ z-index: 100;
33
+ }
34
+
35
+ > input {
36
+ width: 100%;
37
+ height: 47px;
38
+ margin-bottom: 20px;
39
+ padding: 10px 25px;
40
+ box-sizing: border-box;
41
+ &::-webkit-outer-spin-button,
42
+ &::-webkit-inner-spin-button {
43
+ -webkit-appearance: none;
44
+ margin: 0;
45
+ }
46
+ -moz-appearance: textfield;
47
+ }
48
+
49
+ @media (min-width: 992px) {
50
+ flex-direction: row;
51
+ & > div {
52
+ width: 48%;
53
+ }
54
+
55
+ > input {
56
+ width: 48%;
57
+ }
58
+ }
59
+ `
60
+ export const Option = styled.div`
61
+ font-weight: 400;
62
+ font-size: 14px;
63
+ line-height: 24px;
64
+ color: ${props => props.theme.colors.secundaryContrast};
65
+ display: flex;
66
+ align-items: center;
67
+ padding: 5px;
68
+ `
@@ -19,6 +19,7 @@ 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'
22
23
 
23
24
  const OrdersManagerUI = (props) => {
24
25
  const {
@@ -194,6 +195,11 @@ const OrdersManagerUI = (props) => {
194
195
  setSlaSettingTime={setSlaSettingTime}
195
196
  isLateralBar={isLateralBar}
196
197
  />
198
+ <OrdersHeaderFilterGroup
199
+ driverGroupList={driverGroupList}
200
+ driversList={driversList}
201
+ handleChangeFilterValues={handleChangeFilterValues}
202
+ />
197
203
  <OrderStatusFilterBar
198
204
  isUseQuery={isUseQuery}
199
205
  selectedOrderStatus={ordersStatusGroup}
@@ -187,7 +187,25 @@ export const SettingsListUI = (props) => {
187
187
  <p>{config?.description}</p>
188
188
  )}
189
189
  {
190
- config?.options?.length > 0 && config?.options?.map((item, j) => (
190
+ config?.key !== 'filter_order_options' && config?.options?.length > 0 && config?.options?.map((item, j) => (
191
+ <FormGroupWrapper key={j}>
192
+ <FormGroupCheck className='checkbox'>
193
+ <label>
194
+ <input
195
+ type='checkbox'
196
+ name={item?.value}
197
+ data-id={config?.id}
198
+ defaultChecked={config?.value.split('|').includes(item?.value)}
199
+ onChange={(e) => handleCheckBoxChange(e, true, config?.value)}
200
+ />
201
+ {t(item.text.toUpperCase(), item.text.replace(/_/g, ' ').toLowerCase())}
202
+ </label>
203
+ </FormGroupCheck>
204
+ </FormGroupWrapper>
205
+ ))
206
+ }
207
+ {
208
+ config?.key === 'filter_order_options' && config?.options?.length > 0 && config?.options?.filter(option => ((option.value === 'external_id') || (option.value === 'driver') || (option.value === 'driver_group_general'))).map((item, j) => (
191
209
  <FormGroupWrapper key={j}>
192
210
  <FormGroupCheck className='checkbox'>
193
211
  <label>
@@ -238,7 +238,10 @@ export const CustomersListing = (props) => {
238
238
  initialPage: props.isUseQuery && !isNaN(defaultPage) ? Number(defaultPage) : 1,
239
239
  pageSize: props.isUseQuery && !isNaN(defaultPage) ? Number(defaultPageSize) : 10,
240
240
  controlType: 'pages'
241
- }
241
+ },
242
+ propsToFetch: [
243
+ 'name', 'lastname', 'email', 'phone', 'photo', 'cellphone', 'loyalty_level', 'loyalty_level_id', 'country_phone_code', 'city_id', 'city', 'address', 'addresses', 'address_notes', 'dropdown_option_id', 'dropdown_option', 'location', 'zipcode', 'level', 'enabled', 'middle_name', 'second_lastname', 'birthdate', 'phone_verified', 'email_verified', 'wallets', 'orders_count', 'push_tokens'
244
+ ]
242
245
  }
243
246
  return (
244
247
  <UsersListController {...customersProps} />
@@ -0,0 +1,60 @@
1
+ import React, { useState, createContext } from 'react'
2
+ /**
3
+ * Create FilterValuesContext
4
+ * This context will manage the info between pages and provide an easy interface
5
+ */
6
+ export const FilterValuesContext = createContext()
7
+
8
+ /**
9
+ * Custom provider to mange shared info
10
+ * @param {props} props
11
+ */
12
+ export const FilterValuesProvider = ({ children }) => {
13
+ const [filterValues, setFilterValues] = useState({
14
+ orderId: null,
15
+ externalId: null,
16
+ groupTypes: [],
17
+ groupTypesUnassigned: [],
18
+ dateType: null,
19
+ deliveryFromDatetime: null,
20
+ deliveryEndDatetime: null,
21
+ businessIds: [],
22
+ driverIds: [],
23
+ driverGroupIds: [],
24
+ cityIds: [],
25
+ statuses: [],
26
+ deliveryTypes: [],
27
+ paymethodIds: [],
28
+ countryCode: [],
29
+ currency: [],
30
+ metafield: [],
31
+ logisticStatus: null,
32
+ assigned: null,
33
+ driverGroupBusinessIds: [],
34
+ customerName: null,
35
+ customerEmail: null,
36
+ customerCellphone: null,
37
+ customerLastname: null
38
+ })
39
+
40
+ const handleFilterValues = (filterValues) => {
41
+ setFilterValues(filterValues)
42
+ }
43
+
44
+ const functions = {
45
+ handleFilterValues
46
+ }
47
+
48
+ return (
49
+ <FilterValuesContext.Provider value={[filterValues, functions]}>
50
+ {children}
51
+ </FilterValuesContext.Provider>
52
+ )
53
+ }
54
+
55
+ // hook context
56
+
57
+ export function useFilterValues () {
58
+ const filterValuesManager = React.useContext(FilterValuesContext)
59
+ return filterValuesManager || [{}, () => {}]
60
+ }
package/src/index.js CHANGED
@@ -411,6 +411,7 @@ import { ThemeContext, ThemeProvider, useTheme } from './contexts/ThemeContext'
411
411
  import { ConfigFileContext } from './contexts/ConfigFileContext'
412
412
  import { ProjectContext, ProjectProvider, useProjectState } from './contexts/ProjectContext'
413
413
  import { InfoShareContext, InfoShareProvider, useInfoShare } from './contexts/InfoShareContext'
414
+ import { FilterValuesContext, FilterValuesProvider, useFilterValues } from './contexts/FilterValuesContext'
414
415
 
415
416
  // hooks
416
417
  import { useOnlineStatus } from './hooks/useOnlineStatus'
@@ -842,6 +843,9 @@ export {
842
843
  InfoShareContext,
843
844
  InfoShareProvider,
844
845
  useInfoShare,
846
+ FilterValuesContext,
847
+ FilterValuesProvider,
848
+ useFilterValues,
845
849
  ProjectContext,
846
850
  ProjectProvider,
847
851
  useProjectState,