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,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
@@ -8,6 +8,7 @@ import {
8
8
  OrderingProductDetails
9
9
  } from './components/OrderingProducts'
10
10
  import { PageNotFound } from './components/PageNotFound'
11
+ import { Banners } from './components/Banners'
11
12
  import {
12
13
  AllInOne,
13
14
  Appointments,
@@ -410,6 +411,7 @@ import { ThemeContext, ThemeProvider, useTheme } from './contexts/ThemeContext'
410
411
  import { ConfigFileContext } from './contexts/ConfigFileContext'
411
412
  import { ProjectContext, ProjectProvider, useProjectState } from './contexts/ProjectContext'
412
413
  import { InfoShareContext, InfoShareProvider, useInfoShare } from './contexts/InfoShareContext'
414
+ import { FilterValuesContext, FilterValuesProvider, useFilterValues } from './contexts/FilterValuesContext'
413
415
 
414
416
  // hooks
415
417
  import { useOnlineStatus } from './hooks/useOnlineStatus'
@@ -436,6 +438,7 @@ export {
436
438
  ChatBusinessesList,
437
439
  OrdersManager,
438
440
  PageNotFound,
441
+ Banners,
439
442
  Messages,
440
443
  OrdersContentHeader,
441
444
  OrdersDashboardList,
@@ -840,6 +843,9 @@ export {
840
843
  InfoShareContext,
841
844
  InfoShareProvider,
842
845
  useInfoShare,
846
+ FilterValuesContext,
847
+ FilterValuesProvider,
848
+ useFilterValues,
843
849
  ProjectContext,
844
850
  ProjectProvider,
845
851
  useProjectState,
@@ -219,6 +219,17 @@ export const Button = styled.button`
219
219
  background: ${props => darken(0.1, props.theme.colors.lightPrimary)};
220
220
  }
221
221
  `}
222
+ ${({ color }) => color === 'warning' && css`
223
+ background: ${props => props.theme.colors.warning};
224
+ color: #FFF;
225
+ border-color: ${props => props.theme.colors.warning};
226
+ &:hover {
227
+ background: ${props => darken(0.04, props.theme.colors.warning)};
228
+ }
229
+ &:active {
230
+ background: ${props => darken(0.1, props.theme.colors.warning)};
231
+ }
232
+ `}
222
233
  ${({ color }) => color === 'secundaryDark' && css`
223
234
  background: ${props => props.theme.colors.secundaryDarkContrast};
224
235
  color: ${props => props.theme.colors.secundaryDark};
package/template/app.js CHANGED
@@ -86,14 +86,18 @@ import { CustomProject } from './pages/CustomProject'
86
86
  import { OrderingWidgets } from './pages/OrderingWidgets'
87
87
  import { BusinessDevicesList } from './pages/BusinessDevicesList'
88
88
  import { SettingsLogs } from './pages/SettingsLogs'
89
+ import { Banners } from '../src/components/Banners'
90
+ import { useProjectState } from '../src/contexts/ProjectContext'
89
91
 
90
92
  export const App = () => {
91
93
  const history = useHistory()
92
94
  const [events] = useEvent()
93
95
  const [{ auth, loading, user }] = useSession()
94
96
  const [orderStatus] = useOrder()
97
+ const [projectStatus] = useProjectState()
95
98
  const [{ configs, loading: configLoading }] = useConfig()
96
99
  const [loaded, setLoaded] = useState(false)
100
+ const [layoutPT, setLayoutPT] = useState(0)
97
101
  const [oneSignalState, setOneSignalState] = useState({
98
102
  notification_app: settings.notification_app
99
103
  })
@@ -102,6 +106,8 @@ export const App = () => {
102
106
  const { height } = useWindowSize()
103
107
 
104
108
  const cannyAppId = '5b05e5e2d3f6c47201694ad4'
109
+ const isPastDue = projectStatus.project?.current_status === 'past_due'
110
+ const showBanner = auth && isPastDue
105
111
 
106
112
  const { search } = useLocation()
107
113
  let queryProject
@@ -207,7 +213,14 @@ export const App = () => {
207
213
  {cannyAppId && (
208
214
  <CannyIdentification appId={cannyAppId} />
209
215
  )}
210
- <Layout>
216
+ {showBanner && (
217
+ <Banners
218
+ type={projectStatus.project?.current_status}
219
+ urlToGo={settings?.billing_url}
220
+ setLayoutPT={setLayoutPT}
221
+ />
222
+ )}
223
+ <Layout pt={showBanner && `${layoutPT}px`}>
211
224
  {auth && (
212
225
  <SidebarMenu billingUrl={settings?.billing_url} />
213
226
  )}
@@ -2,7 +2,7 @@
2
2
  "app_id": "ordering-admin-react",
3
3
  "notification_app": "dashboardweb",
4
4
  "app_name": "Ordering Admin",
5
- "billing_url": "https://billing-dashboard.tryordering.com",
5
+ "billing_url": "https://start-free.tryordering.com",
6
6
  "api": {
7
7
  "url": "https://apiv4.ordering.co",
8
8
  "language": "en",